Liferay.Loader.define("commerce-frontend-taglib@19.1.14/autocomplete_item/AutocompleteItem.es",["module","exports","require","frontend-js-metal-web$metal-component","frontend-js-metal-web$metal-soy","./AutocompleteItem.soy"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.AutocompleteItem=void 0;var o=_interopRequireDefault(r("frontend-js-metal-web$metal-component")),n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=o?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("frontend-js-metal-web$metal-soy")),i=_interopRequireDefault(r("./AutocompleteItem.soy"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class AutocompleteItem extends o.default{processQuery(){const e=new RegExp("(.*?)(".concat(this.query,")(.*)"),"gmi").exec(this.text);return e?this.updateHighlightedText(e.map((e=>e.toString()))):this.reinitializeTextGroups(),!!e}reinitializeTextGroups(){return this.firstGroup=this.text.toString(),this.secondGroup=null,this.thirdGroup=null,!1}syncQuery(){this.processQuery()}syncText(){this.processQuery()}updateHighlightedText(e){return this.firstGroup=e[1]||null,this.secondGroup=e[2]||null,this.thirdGroup=e[3]||null,!0}}t.AutocompleteItem=AutocompleteItem,n.default.register(AutocompleteItem,i.default),AutocompleteItem.STATE={firstGroup:n.Config.string().internal(),query:n.Config.string(),secondGroup:n.Config.string().internal(),text:n.Config.any(),thirdGroup:n.Config.string().internal()};var u=AutocompleteItem;t.default=u}}));
//# sourceMappingURL=AutocompleteItem.es.js.map