@abtasty/search 0.0.2-10 → 0.0.2-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";const e=()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S?.USER?.accountIdentifier?.length?e=window.ABTASTY_S.USER.accountIdentifier:"function"==typeof window.ABTasty?.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty?.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e},t=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),a=e=>(e=>{if("string"!=typeof e||!e.trim().length)return null;const[t,a,s]=e.split("[]").map(e=>e.trim()),i=Boolean(s)?s:e,r=a?document.querySelector(t)?.[a]:document;return r?r.querySelector(i):null})(e),s=(e,t)=>{const s=document.querySelector("body")||document.documentElement,i={childList:!0,subtree:!0,attributes:!0},r=()=>n.disconnect(),n=new MutationObserver(()=>{const s=a(t);return s&&!r()&&e(s)});return{clear:r,observe:(e=s)=>n.observe(e,i)}},i=()=>{},r=(e,n)=>{const o=a(e),c={selector:e,clear:i,observe:i};if(o)return setTimeout(()=>n(o),0),c;if(t())return setTimeout(()=>r(e,n),1e3),c;if(e.includes("[]"))return((e,t)=>{const[i,r]=t.split("[]").map(e=>e.trim()),n=a(i),o=n?.[r],{clear:c,observe:l}=s(e,t),h=()=>{const s=a(t);return s&&!d()&&e(s)},d=()=>{c(),n?.removeEventListener("load",h)},g=()=>{l(o),"iframe"===n?.localName&&n.addEventListener("load",h)};return g(),{selector:t,clear:d,observe:g}})(n,e);const{clear:l,observe:h}=s(n,e);return h(),{selector:e,clear:l,observe:h}},n=e=>{const t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),t},o="https://ms-839f1388554f-19719.fra.meilisearch.io",c=`${o}/indexes/${DATA.meilisearchIndex||e()}/search`,l=`${o}/multi-search`,h=["hasbro","lego","mattel"],d={"Content-Type":"application/json",Authorization:"Bearer 1b3d6acfb9eac2780cd20a30ce8728a565960d213b0729b01d9b5e9fdcd3f77b"};function g(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,s)}return a}function b(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?g(Object(a),!0).forEach(function(t){u(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):g(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function u(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const m=e=>{for(;e.firstChild;)e.removeChild(e.lastChild)},p=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Object.entries(e).reduce((e,t)=>{let[s,i]=t;return e[s]&&(Array.isArray(e[s].values)?e[s]=b(b({},i),{},{values:e[s].values.map(e=>{let[t,s]=e;const r=i.values.find(e=>{let[a]=e;return a===t});return r?[t,r[1]]:[t,a?0:s]})}):e[s]=b(b({},i),{},{min:e[s].values.min,max:e[s].values.max})),e},b({},t))};class f{constructor(e){let{baseContainer:t,baseClassName:a,target:s,onInput:i,closeSearchWidget:r}=e;this.baseContainer=t,this.baseClassName=a,this.target=s,this.onInput=i,this.closeSearchWidget=r,this.inputId=`${this.baseClassName}-search-input`,this.searchBarContainer=this.getSearchBarContainer(),this.searchBarLabel=this.getSearchBarLabel(),this.searchBar=this.getSearchBar(),this.searchInput=this.getSearchInput(),this.renderSearchBar()}getSearchBarContainerHeight(){const e=this.target.closest("header");if(e){const t=e.getBoundingClientRect().height;return Math.max(t,150)+"px"}return"auto"}getCurrentSearchBarContainerHeight(){return this.searchBarContainer.getBoundingClientRect().height}resetSearchBarHeight(){this.searchBarContainer.style.minHeight=this.getSearchBarContainerHeight()}focusInput(){this.searchInput.focus()}getSearchBarContainer(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-bar-container`,e.style.minHeight=this.getSearchBarContainerHeight(),e}getSearchBarLabel(){const{searchLabel:e}=DATA,t=document.createElement("label");return t.className=`${this.baseClassName}-search-input-label`,t.innerHTML=e,t.htmlFor=this.inputId,t}getSearchBarAndCloseButtonContainer(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-bar-close-button-container`,e}getSearchBar(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-bar`,e}getSearchInput(){const e=document.createElement("input");return e.id=this.inputId,e.className=`${this.baseClassName}-search-input`,e.oninput=this.onInput,e}getSearchCloseButton(){const e=document.createElement("button");e.className=`${this.baseClassName}-close-icon-container`,e.onclick=this.closeSearchWidget;const t=document.createElement("i");return t.className=`${this.baseClassName}-close-icon`,e.appendChild(t),e}renderSearchBar(){this.searchBar.appendChild(this.searchInput);const e=this.getSearchBarAndCloseButtonContainer();e.append(this.searchBar,this.getSearchCloseButton()),this.searchBarContainer.appendChild(this.searchBarLabel),this.searchBarContainer.appendChild(e),this.baseContainer.appendChild(this.searchBarContainer)}}function y(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,s)}return a}function w(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?y(Object(a),!0).forEach(function(t){v(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):y(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function v(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const x={text:"",filters:{},sort:[],page:0,totalPages:0,totalHits:0},C=function(){let e=w({},x);return w({get state(){return e}},{logState(e){},setText(t){e.text=t,this.logState("setText")},setPage(t){e.page=t,this.logState("setPage")},setTotalPages(t){e.totalPages=t,this.logState("setTotalPages")},setTotalHits(t){e.totalHits=t,this.logState("setTotalHits")},setSort(t){e.sort=""===t?[]:[t],this.logState("setSort")},onFilterChange(t,a,s){e.page=0,void 0!==s.checked?this.updateFilterArray(t,a,s.checked):this.updateRangeFilter(t,s.min,s.max),this.logState("onFilterChange")},updateRangeFilter(t,a,s){e.filters[t]=[{operator:">",value:a},{operator:"<",value:s}],this.logState("updateRangeFilter")},updateFilterArray(t,a,s){s?e.filters[t]=[...e.filters[t]||[],a]:(e.filters[t].length&&(e.filters[t]=e.filters[t].filter(e=>e!==a)),0===e.filters[t].length&&delete e.filters[t]),this.logState("updateFilterArray")},resetFiltersAndPagination(){this.resetFilters(),this.resetPagination(),this.logState("resetFiltersAndPagination")},resetFilters(){e.filters={},this.logState("resetFilters")},resetPagination(){e.page=0,e.totalPages=0,this.logState("resetPagination")},reset(){e=w({},x),this.logState("reset")}})}();class S{constructor(e){let{baseClassName:t,currentRange:a,min:s,max:i,onRangeChange:r}=e;this.baseClassName=t,this.currentRange=a||{min:s,max:i},this.min=s,this.max=i,this.onRangeChange=r}render(){const e=document.createElement("div");e.className=`${this.baseClassName}-range-slider`;const t=document.createElement("div");t.className="range-progress";const a=document.createElement("div");a.className="range-handle";const s=document.createElement("div");s.className="range-handle";const i=document.createElement("div");if(i.className=`${this.baseClassName}-range-values`,this.min===this.max)return a.style.left="0%",s.style.left="100%",t.style.left="0%",t.style.width="100%",a.style.pointerEvents="none",s.style.pointerEvents="none",i.innerHTML=`\n\t\t\t\t<span>${this.min}</span>\n\t\t\t\t<span>${this.max}</span>\n\t\t\t`,e.append(t,a,s),{rangeContainer:e,valuesContainer:i};const r=(this.currentRange.min-this.min)/(this.max-this.min)*100,n=(this.currentRange.max-this.min)/(this.max-this.min)*100;a.style.left=`${r}%`,s.style.left=`${n}%`,t.style.left=`${r}%`,t.style.width=n-r+"%",i.innerHTML=`\n\t\t\t<span>${this.currentRange.min}</span>\n\t\t\t<span>${this.currentRange.max}</span>\n\t\t`,e.append(t,a,s);let o=!1,c=null,l=0,h=0;const d=()=>{const e=parseFloat(a.style.left),t=parseFloat(s.style.left),r=(this.min+e/100*(this.max-this.min)).toFixed(2),n=(this.min+t/100*(this.max-this.min)).toFixed(2);return i.innerHTML=`\n\t\t\t\t<span>${r}</span>\n\t\t\t\t<span>${n}</span>\n\t\t\t`,{minValue:r,maxValue:n}},g=e=>{e.preventDefault(),o=!0,c=e.target,l=e.clientX,h=parseFloat(c.style.left)},b=i=>{if(!o)return;i.preventDefault();const r=i.clientX-l,n=e.offsetWidth;let g=h+r/n*100;g=c===a?Math.max(0,Math.min(g,parseFloat(s.style.left))):Math.max(parseFloat(a.style.left),Math.min(g,100)),g=.8*Math.round(g/.8),c.style.left=`${g}%`,(()=>{const e=parseFloat(a.style.left),i=parseFloat(s.style.left);t.style.left=`${e}%`,t.style.width=i-e+"%"})(),d()},u=()=>{if(!o)return;o=!1,c=null;const{minValue:e,maxValue:t}=d();this.currentRange={min:e,max:t},this.onRangeChange(this.currentRange)};return[a,s].forEach(e=>{e.addEventListener("mousedown",g),document.addEventListener("mousemove",b),document.addEventListener("mouseup",u)}),{rangeContainer:e,valuesContainer:i}}}class k{constructor(e){let{id:t,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=e;this.id=t,this.facet=a,this.baseClassName=s,this.facetsListContainer=i,this.onFiltersChange=r,this.facetContentContainers=this.createFacetContainers(),this.facetsListContainer.insertBefore(this.facetContentContainers.facetContainer,this.facetsListContainer.lastChild)}createFacetContainers(){const e=document.createElement("details");e.className=`${this.baseClassName}-search-facet`,e.open=!0;const t=document.createElement("summary");var a;t.innerHTML=`\n\t\t\t<span>${a=this.facet.title,`${a.charAt(0).toUpperCase()}${a.slice(1)}`}</span>\n\t\t\t<div class="${this.baseClassName}-search-facet-arrow" />\n\t\t`;const s=document.createElement("div");return s.className=`${this.baseClassName}-search-facet-content ${this.facet.type}-facet`,e.append(t,s),{facetContainer:e,facetContent:s}}getFacetContainers(){return this.facetContentContainers}}class F extends k{constructor(e){let{id:t,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=e;super({id:t,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r});const{facetContent:n,facetContainer:o}=this.getFacetContainers();this.facetContent=n,this.facetContainer=o,this.onFiltersChange=r,this.filterRange=new S({baseClassName:this.baseClassName,currentRange:{min:this.facet.values.min,max:this.facet.values.max},min:this.facet.values.min,max:this.facet.values.max,onRangeChange:e=>{this.onFiltersChange({facetType:"range",facetKey:this.facet.title,options:e})}})}createFacetContent(){const{rangeContainer:e,valuesContainer:t}=this.filterRange.render();this.facetContent.append(e,t)}updateFacetContent(){m(this.facetContent),void 0!==this.facet.values.min&&void 0!==this.facet.values.max&&(this.filterRange=new S({baseClassName:this.baseClassName,currentRange:{min:this.facet.values.min,max:this.facet.values.max},min:this.facet.values.min,max:this.facet.values.max,onRangeChange:e=>{this.onFiltersChange({facetType:"range",facetKey:this.facet.title,options:e})}}),this.createFacetContent())}updateFacet(e){this.facet={title:this.facet.title,type:this.facet.type,values:e.values},this.updateFacetContent()}}class E extends k{constructor(e){let{id:t,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=e;super({id:t,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r});const{facetContent:n,facetContainer:o}=this.getFacetContainers();this.facetContent=n,this.facetContainer=o,this.facetList=this.getFacetListElement(),this.onFiltersChange=r,this.showAll=!1,this.facetContent.append(this.facetList)}createFacetContent(){const e=this.showAll?this.facet.values:this.facet.values.sort((e,t)=>{let[a,s]=e,[i,r]=t;return r-s}).slice(0,10),t=[];for(const[a,s]of e){const e=this.getFacetListItemElement({name:a,count:s});t.push(e)}if(this.facetList.append(...t),this.facet.values.length>10){const e=document.createElement("button");e.className=`${this.baseClassName}-search-facet-show-more`,e.innerHTML="Show "+(this.showAll?"less":"more"),e.onclick=()=>{this.showAll=!this.showAll,this.updateFacetContent()},this.facetList.append(e)}}getFacetListElement(){const e=document.createElement("ul");return e.style.padding="0",e}getFacetListItemElement(e){const{name:t,count:a}=e,s=document.createElement("li");s.className=`${this.baseClassName}-search-facet-list-item`,s.id=`${this.baseClassName}-search-facet-list-item-${t.replace(" ","-").toLowerCase()}`;const i=(C.state.filters[this.facet.title]||[]).includes(t),r=document.createElement("label");r.className=`${this.baseClassName}-search-facet-checkbox-container ${i||0!==a?"":"disabled"} ${i?"checked":""}`,r.innerHTML=`${t} (${a})`;const n=document.createElement("span");n.className=`${this.baseClassName}-search-facet-checkbox-checkmark`;const o=document.createElement("input");return o.disabled=!i&&0===a,o.checked=i,o.type="checkbox",o.onclick=()=>{const e=o.checked;this.onFiltersChange({facetType:"list",facetKey:this.facet.title,facetValue:t,options:{checked:e}})},r.appendChild(o),r.appendChild(n),s.appendChild(r),s}updateFacetContent(){m(this.facetList),0!==this.facet.values.length&&this.createFacetContent()}updateFacet(e){this.facet={title:this.facet.title,type:this.facet.type,values:e.values},this.showAll=!1,this.updateFacetContent()}}class N{constructor(e){let{baseClassName:t,baseContainer:a,searchBar:s,onFiltersChange:i}=e;this.baseClassName=t,this.baseContainer=a,this.searchBar=s,this.onFiltersChange=i,this.facets=[],this.facetsListContainer=this.getFacetsListContainer()}setMaxHeight(e){this.facetsListContainer.style.maxHeight=e}getFacetsListContainer(){const e=document.createElement("div");e.className=`${this.baseClassName}-search-facets-list`;const t=document.createElement("button");t.className=`${this.baseClassName}-search-facets-list-close-button`,t.onclick=this.closeFilters.bind(this);const a=document.createElement("i");a.className=`${this.baseClassName}-close-icon`,t.appendChild(a);const s=document.createElement("button");return s.className=`${this.baseClassName}-search-facets-list-bottom-close-button`,s.innerHTML="Close",s.onclick=this.closeFilters.bind(this),e.insertAdjacentElement("afterbegin",t),e.insertAdjacentElement("beforeend",s),e}renderFacets(e){[...this.facetsListContainer.children].forEach(e=>{e.tagName.toLowerCase()==="details".toLowerCase()&&e.parentNode.removeChild(e)}),this.facets=[];for(const[t,a]of Object.entries(e)){if(0===a.values.length||1===a.values.length)continue;const e={id:t,facet:{title:t,values:a.values,type:a.type},baseClassName:this.baseClassName,facetsListContainer:this.facetsListContainer,onFiltersChange:this.onFiltersChange},s=new("range"===a.type?F:E)(e);this.facets.push(s)}this.facets.forEach(e=>{e.createFacetContent()}),this.baseContainer.appendChild(this.facetsListContainer)}updateRangeFacets(e){this.facets.filter(e=>e instanceof F).forEach(t=>{t.updateFacet(e[t.id])})}updateListFacets(e){this.facets.filter(e=>e instanceof E).forEach(t=>{t.updateFacet(e[t.id])})}updateFacets(e){this.updateRangeFacets(e),this.updateListFacets(e)}openFilters(){const e=this.baseContainer.parentElement,t=document.createElement("div");t.className=`${this.baseClassName}-search-facets-list-overlay`,t.onclick=this.closeFilters.bind(this),e.insertAdjacentElement("afterbegin",t),this.facetsListContainer.classList.add("open")}closeFilters(){this.facetsListContainer.classList.remove("open");const e=this.baseContainer.parentElement.firstChild;this.baseContainer.parentElement.removeChild(e)}}class A{constructor(e){let{result:t,index:a,baseClassName:s}=e;this.result=t,this.index=a,this.baseClassName=s}getSearchResultElement(){const e=document.createElement("a");return e.className=`${this.baseClassName}-search-result-container`,e.href=this.result.link,e.target="_blank",e.rel="noreferrer",e.innerHTML=`\n <div class="${this.baseClassName}-search-result result-${this.index}">\n <img loading="lazy" style="height: 60%; width: 100%" src="${this.result.img_link}" />\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-name">${this.result.name}</div>\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-price">${this.result.price}€</div>\n\t\t\t\t\t</div>\n </div\n\t\t`,e}}class T{constructor(e){let{baseClassName:t,sortOptions:a,infos:s,onSortChange:i,openFilters:r}=e;this.baseClassName=t,this.onSortChange=i,this.sortOptions=a,this.infos=s,this.openFilters=r,this.infosElement=this.getInfosElement(),this.sortLabelElement=this.getSortLabelElement(),this.sortSelectElement=this.getSortSelectElement(),this.sortAndFiltersButtonElement=this.getSortAndFiltersButtonElement(),this.infosAndSortContainer=this.getInfoAndSortContainerElement(),this.infosAndSortContainer.appendChild(this.infosElement),this.infosAndSortContainer.appendChild(this.sortAndFiltersButtonElement),this.setSortOptions()}getInfoAndSortContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-info-and-sort`,e}getInfosElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-infos`,e.style.whiteSpace="nowrap",e.innerHTML=`\n\t\t\t<span><strong>${this.infos.totalHits}</strong> items</span>\n\t\t`,e}getSortLabelElement(){const e=document.createElement("label");return e.className=`${this.baseClassName}-search-sort-label`,e.textContent="Sort by:",e.htmlFor=`${this.baseClassName}-search-sort-select`,e}getSortSelectElement(){const e=document.createElement("select");return e.className=`${this.baseClassName}-search-sort-select`,e.id=`${this.baseClassName}-search-sort-select`,e.name=`${this.baseClassName}-search-sort-select`,e.onchange=this.handleSortChange.bind(this),e}getSortElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-sort`,e.appendChild(this.sortLabelElement),e.appendChild(this.sortSelectElement),e}getFiltersButtonElement(){const e=document.createElement("button");return e.className=`${this.baseClassName}-search-filters-button`,e.innerHTML="Filters",e.onclick=this.openFilters.bind(this),e}getSortAndFiltersButtonElement(){const e=document.createElement("div");e.className=`${this.baseClassName}-search-sort-and-filters-button-container`;const t=this.getSortElement(),a=this.getFiltersButtonElement();return e.appendChild(t),e.appendChild(a),e}setSortOptions(){this.sortSelectElement.childElementCount&&removeChildren(this.sortSelectElement);for(const e of this.sortOptions){const t=document.createElement("option");t.value=e.value,t.textContent=e.label,this.sortSelectElement.appendChild(t)}}handleSortChange(e){const t=e.target.value;this.onSortChange(t)}updateInfos(e){this.infos=e,this.infosElement.innerHTML=`\n\t\t\t<span><strong>${this.infos.totalHits}</strong> items</span>\n\t\t`}updateSortOptions(e){this.sortOptions=e,this.setSortOptions()}}class L{hasTriggeredSeeMore=!1;constructor(e){let{baseContainer:t,baseClassName:a,searchBar:s,onFiltersChange:i,onSortChange:r,onSeeMore:n}=e;this.baseContainer=t,this.baseClassName=a,this.searchBar=s,this.onFiltersChange=i,this.onSortChange=r,this.onSeeMore=n,this.sortOptions=[{value:"",label:"Relevance"},{value:"price:asc",label:"↑ Price"},{value:"price:desc",label:"↓ Price"}],this.searchResultContainer=this.getSearchResultContainerElement(),this.searchResultListContainer=this.getSearchResultListContainerElement(),this.searchResultList=this.getSearchResultListElement(),this.facetsList=new N({searchBar:this.searchBar,baseContainer:this.searchResultContainer,baseClassName:this.baseClassName,onFiltersChange:this.onFiltersChange}),this.infoAndSort=new T({baseClassName:this.baseClassName,infos:{totalHits:C.state.totalHits},sortOptions:this.sortOptions,onSortChange:this.onSortChange,openFilters:this.openFilters.bind(this)}),new MutationObserver(this.mutationCallback.bind(this)).observe(this.searchResultContainer,{childList:!0})}mutationCallback(e){for(const t of e)if("childList"===t.type)if(!t.target.childNodes.length||"0px"!==this.searchResultContainer.style.maxHeight&&""!==this.searchResultContainer.style.maxHeight)0===t.target.childNodes.length&&(this.searchResultListContainer.style.maxHeight="0px",this.facetsList.setMaxHeight("0px"));else{const e=`calc(100vh - ${this.searchBar.getCurrentSearchBarContainerHeight()||0}px)`;this.searchResultListContainer.style.maxHeight=e,this.facetsList.setMaxHeight(e)}}scrollToTop(){this.searchResultList.scrollTop=0}openFilters(){this.facetsList.openFilters()}clearSearchResults(){m(this.searchResultList),m(this.searchResultListContainer),m(this.searchResultContainer),this.searchResultContainer.classList.remove("visible","no-results")}getSearchResultContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-result-container`,e}getSearchResultListContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-result-list-container`,e.addEventListener("scroll",e=>{const t=e.target.scrollTop+e.target.clientHeight>=e.target.scrollHeight-500;!this.hasTriggeredSeeMore&&t&&C.state.page<C.state.totalPages&&(this.hasTriggeredSeeMore=!0,this.onSeeMore())}),e}getSearchResultListElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-result-list`,e}updateFacets(e){this.facetsList.updateFacets(e)}updateListFacets(e){this.facetsList.updateListFacets(e)}updateRangeFacets(e){this.facetsList.updateRangeFacets(e)}updateSearchResults(e){if(m(this.searchResultList),this.searchResultList.classList.remove("no-results"),this.infoAndSort.updateInfos({totalHits:C.state.totalHits}),e.length)for(const[t,a]of e.entries()){const e=new A({result:a,index:t,searchResultContainer:this.searchResultList,baseClassName:this.baseClassName});this.searchResultList.appendChild(e.getSearchResultElement())}else{const e=document.createElement("div");e.className=`${this.baseClassName}-search-no-result`,e.innerHTML="No results found",this.searchResultList.classList.add("no-results"),this.searchResultList.appendChild(e)}this.hasTriggeredSeeMore=!1}renderSearchResults(e,t){if(this.baseContainer.classList.add("search-completed"),this.clearSearchResults(),this.infoAndSort.updateInfos({totalHits:C.state.totalHits}),e.length){this.facetsList.renderFacets(t);for(const[t,a]of e.entries()){const e=new A({result:a,index:t,searchResultContainer:this.searchResultList,baseClassName:this.baseClassName});this.searchResultList.appendChild(e.getSearchResultElement())}this.searchResultListContainer.appendChild(this.infoAndSort.infosAndSortContainer),this.searchResultListContainer.appendChild(this.searchResultList),this.searchResultContainer.appendChild(this.searchResultListContainer),this.baseContainer.appendChild(this.searchResultContainer)}else{const e=document.createElement("div");e.className=`${this.baseClassName}-search-no-result`,e.innerHTML="No results found",this.searchResultContainer.classList.add("no-results"),this.searchResultContainer.appendChild(e)}this.searchResultContainer.classList.add("visible"),this.baseContainer.appendChild(this.searchResultContainer),this.hasTriggeredSeeMore=!1}}function R(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,s)}return a}function $(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?R(Object(a),!0).forEach(function(t){P(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):R(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function P(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const O={results:[],facets:{},selectedFacets:{}},j=(()=>{let e=$({},O);return $({get state(){return e}},{logState(e){},addResults(t){e.results=[...e.results,...t.sort((e,t)=>((e,t)=>{const a=e.toLowerCase(),s=t.toLowerCase();return h.some(e=>a.includes(e))&&!h.some(e=>s.includes(e))?-1:h.some(e=>s.includes(e))&&!h.some(e=>a.includes(e))?1:0})(e.name,t.name))],this.logState("addResults")},setFacets(t){e.facets=t,this.logState("setFacets")},addRangeToSelectedFacets(t,a){e.selectedFacets[t]={type:a.type,values:a.values},this.logState("addRangeToSelectedFacets")},addListToSelectedFacets(t,a){if(a){const s=a.values[0],i=a.values[1],r=e.selectedFacets[t];if(r){const e=r.values.findIndex(e=>{let[t]=e;return t===s});e>-1?r.values[e]=[s,r.values[e][1]+i]:r.values.push([s,i])}else e.selectedFacets[t]={type:a.type,values:[[s,i]]}}this.logState("addListToSelectedFacets")},removeSelectedFacet(t,a){const s=e.selectedFacets[t];s&&(s.values=s.values.filter(e=>{let[t]=e;return t!==a})),0===s.values.length&&delete e.selectedFacets[t],this.logState("removeSelectedFacet")},updateSelectedFacets(t){const a=p(t,e.selectedFacets,!0);e.selectedFacets=a,this.logState("updateSelectedFacets")},updateFacets(t){e.facets=p(t,e.facets,!0),this.logState("updateFacets")},setSelectedFacets(t){e.selectedFacets=t,this.logState("setSelectedFacets")},clearResults(){e.results=[],this.logState("clearResults")},reset(){e=$({},O),this.logState("reset")}})})();function B(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,s)}return a}function I(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?B(Object(a),!0).forEach(function(t){M(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):B(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function M(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const D=function(e){let t=[];for(const a in e){const s=e[a];if(Array.isArray(s))if("object"==typeof s[0]){const e=s.map(e=>`${a} ${e.operator} ${e.value}`);t.push(`(${e.join(" AND ")})`)}else{const e=s.map(e=>`"${a}" = "${e}"`);t.push(`(${e.join(" OR ")})`)}}return t.join(" AND ")},H=function(e){const{facetDistribution:t,facetStats:a}=e;let s={};for(const e in t)a&&a[e]?s[e]={type:"range",values:{min:a[e].min,max:a[e].max}}:s[e]={type:"list",values:Object.entries(t[e])};return s},z=e=>e.filter(e=>e.img_link&&e.price&&e.link).map(e=>({name:e.title,img_link:e.img_link,link:e.link,price:e.price,category:e.category,brand:e.brand})),W=e=>{let{text:t,filters:a,sort:s,page:i}=e;return JSON.stringify({q:t,filter:D(a),facets:["*"],hitsPerPage:50,page:i+1,sort:s||[]})},_=e=>({hits:z(e.hits),facets:H(e),page:e.page,totalPages:e.totalPages,totalHits:e.totalHits}),q=/.+\/([^.]+)\.(otf|ttf)$/,U=(e,t)=>e&&"inherit"!==e?`font-family:${e}_${t.match(q)?t.match(q)[1]:""};`:t||"";class X{constructor(e){let{target:t,rootElement:a}=e;this.baseClassName="abtasty-search-widget",this.target=t,this.rootElement=a,this.searchOpen=!1,this.searchWidgetContainer=this.getSearchWidgetContainerElement(),this.searchBar=new f({baseContainer:this.searchWidgetContainer,baseClassName:this.baseClassName,target:this.target,onInput:this.debouncedOnInput.bind(this),closeSearchWidget:this.closeSearchWidget.bind(this)}),this.searchResultsList=new L({baseClassName:this.baseClassName,baseContainer:this.searchWidgetContainer,searchBar:this.searchBar,onFiltersChange:this.onFiltersChange.bind(this),onSeeMore:this.onSeeMore.bind(this),onSortChange:this.onSortChange.bind(this)})}insertIn(e,t){e.insertAdjacentElement(t,this.searchWidgetContainer)}remove(){this.rootElement.querySelector("body").removeChild(this.searchWidgetContainer)}openSearchWidget(){if(this.searchOpen)return;const e=this.rootElement.querySelector("body");this.rootElement.querySelector("html").classList.add("search-open"),this.insertIn(e,"afterbegin"),this.searchBar.focusInput(),this.searchOpen=!0}closeSearchWidget(){this.rootElement.querySelector("html").classList.remove("search-open"),this.searchOpen=!1,this.remove()}onFiltersChange=e=>{let{facetType:t,facetKey:a,facetValue:s,options:i}=e;"range"===t?this.onRangeChange(a,i.min,i.max):this.onListCheckboxChange(a,s,i.checked)};onSortChange=async e=>{C.setPage(0),j.clearResults(),C.setSort(e),this.searchResultsList.scrollToTop();const t=await(async()=>{try{const e=await fetch(c,{method:"POST",headers:d,body:W(C.state)}),t=await e.json();return{results:_(t).hits}}catch(e){return window.console.error(e),{results:[]}}})();if(!t)return;const{results:a}=t;j.addResults(a),this.searchResultsList.updateSearchResults(j.state.results)};onRangeChange=async(e,t,a)=>{C.resetPagination(),j.clearResults(),C.updateRangeFilter(e,t,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n,totalHits:o}=s;j.addResults(i),r[e]&&delete r[e],j.updateFacets(r),j.addRangeToSelectedFacets(e,{type:"range",values:{min:t,max:a}}),C.setTotalPages(n),C.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.updateListFacets(j.state.facets)};onListCheckboxChange=async(e,t,a)=>{C.resetPagination(),j.clearResults(),C.updateFilterArray(e,t,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n,totalHits:o}=s;if(j.addResults(i),j.updateFacets(r),a){const a=r[e]?.values.find(e=>{let[a]=e;return a===t});j.addListToSelectedFacets(e,{type:"list",values:a||[t,0]})}else j.removeSelectedFacet(e,t);C.setTotalPages(n),C.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.updateFacets(j.state.facets)};onInput=e=>{C.setText(e.target.value),e.target.value.length?((Object.keys(C.state.filters).length||C.state.page>0)&&C.resetFiltersAndPagination(),this.onSearch()):(this.searchWidgetContainer.classList.remove("search-completed"),this.searchResultsList.clearSearchResults())};onSeeMore=async()=>{C.setPage(C.state.page+1);const e=await(async()=>{try{const e=await fetch(c,{method:"POST",headers:d,body:W(C.state)}),t=await e.json(),a=_(t);return{results:a.hits,totalPages:a.totalPages}}catch(e){return window.console.error(e),null}})();if(!e)return;const{results:t,totalPages:a}=e;j.addResults(t),C.setTotalPages(a),this.searchResultsList.updateSearchResults(j.state.results)};async onSearchWithFilters(){const{text:t}=C.state;return this.searchResultsList.scrollToTop(),t?await(async()=>{const t=(e=>{const t=[],{text:a,filters:s,page:i,sort:r}=C.state;return t.push({indexUid:e,q:a,filter:D(s),hitsPerPage:50,page:i+1,sort:r||[]}),Object.entries(j.state.facets).forEach(i=>{let[r]=i;const n=I({},s);delete n[r],t.push({indexUid:e,q:a,filter:D(n),facets:[r],hitsPerPage:0})}),JSON.stringify({queries:t})})(DATA.meilisearchIndex||e());try{const e=await fetch(l,{method:"POST",headers:d,body:t}),a=(e=>{const{results:t}=e,a=t.slice(1).reduce((e,t)=>{const a=H(t);return I(I({},e),a)},{});return{hits:z(t[0].hits),facets:a,page:t[0].page,totalPages:t[0].totalPages,totalHits:t[0].totalHits}})(await e.json());return{results:a.hits,facets:a.facets,totalPages:a.totalPages,page:a.page,totalHits:a.totalHits}}catch(e){return window.console.error(e),null}})():(this.searchWidgetContainer.classList.remove("search-completed"),null)}onSearch=async()=>{const{text:e}=C.state;if(j.clearResults(),this.searchResultsList.scrollToTop(),e)try{const e=await(async()=>{try{const e=await fetch(c,{method:"POST",headers:d,body:W(C.state)}),t=await e.json(),a=_(t);return{results:a.hits,facets:a.facets,totalPages:a.totalPages,page:a.page,totalHits:a.totalHits}}catch(e){return window.console.error(e),{results:[],facets:{},totalPages:0,page:0,totalHits:0}}})(),{results:t,facets:a,totalPages:s,totalHits:i}=e;j.addResults(t),j.setFacets(a),C.setTotalPages(s),C.setTotalHits(i),this.searchResultsList.renderSearchResults(t,a)}catch(e){window.console.error(e)}else this.searchWidgetContainer.classList.remove("search-completed")};debouncedOnInput=(()=>(e=>{let t=null;return function(){for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];window.clearTimeout(t),t=window.setTimeout(()=>{e(...s)},150)}})(this.onInput.bind(this)))();getSearchWidgetContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-container`,e.insertAdjacentElement("afterbegin",n((()=>{const{primaryColor:e,secondaryColor:t,tertiaryColor:a,searchBarTitleAlign:s,searchBarTitleFontName:i,searchBarTitleFontSize:r,searchBarTitleFontStyle:n,searchBarTitleCustomFontColor:o,searchBarInputAlign:c,searchBarInputFontName:l,searchBarInputFontSize:h,searchBarInputFontStyle:d,searchBarTitleTextColor:g,searchBarInputTextColor:b,searchBarInputCustomFontColor:u,facetSectionTitleAlign:m,facetSectionTitleFontName:p,facetSectionTitleFontSize:f,facetSectionTitleFontStyle:y,facetSectionTitleCustomFontColor:w,facetSectionTitleTextColor:v,facetTitleAlign:x,facetTitleFontName:C,facetTitleFontSize:S,facetTitleFontStyle:k,facetTitleTextColor:F,facetTitleCustomFontColor:E,searchResultNameAlign:N,searchResultNameFontName:A,searchResultNameFontSize:T,searchResultNameFontStyle:L,searchResultNameCustomFontColor:R,searchResultNameTextColor:$,searchResultPriceAlign:P,searchResultPriceFontName:O,searchResultPriceFontSize:j,searchResultPriceFontStyle:B,searchResultPriceCustomFontColor:I,searchResultPriceTextColor:M}=DATA,D=U(i,n),H=U(l,d);return["div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container {",`background-color: ${e};`,"}","div.abtasty-search-widget-container i.abtasty-search-widget-close-icon {",`background-color: ${e};`,"}","div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary {",`text-align: ${m};`,U(p,y),`font-size: ${f}px;`,`color: ${w?v:e};`,"}","div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container {",`text-align: ${x};`,U(C,k),`font-size: ${S}px;`,`color: ${E?F:a};`,"}","div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label {",`text-align: ${s};`,D,`font-size: ${r}px;`,`color: ${o?g:t};`,"}","div.abtasty-search-widget-container input.abtasty-search-widget-search-input {",`text-align: ${c};`,H,`font-size: ${h}px;`,`color: ${u?b:a};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-result-name {",`text-align: ${N};`,U(A,L),`font-size: ${T}px;`,`color: ${R?$:e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-result-price {",`text-align: ${P};`,U(O,B),`font-size: ${j}px;`,`color: ${I?M:a};`,"}","div.abtasty-search-widget-container button.abtasty-search-widget-search-facet-show-more {",`color: ${e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider {",`background-color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button,","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-progress {",`background-color: ${e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button {",`background-color: ${e};`,`color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-handle {",`background-color: ${e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-values {",`color: ${a};`,"}"].join("")})())),e.insertAdjacentElement("afterbegin",n("html.search-open{height:100vh;overflow:hidden;padding:0}div.abtasty-search-widget-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:hsla(0,0%,100%,.5);bottom:0;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:inherit;height:100vh;left:0;position:fixed;right:0;top:0;width:100vw;z-index:9999}div.abtasty-search-widget-container i{display:inline-block;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}div.abtasty-search-widget-container.search-completed{background-color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:#0c4884;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:22.5px 100px;position:sticky;top:0}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar{background-color:#fff;border-radius:12px;margin-top:12px;padding:12px;width:100%}div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label{color:#fff;font-size:16px;font-weight:700;line-height:17px;margin-left:auto;margin-right:auto;margin-top:auto}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-close-button-container{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;line-height:unset}div.abtasty-search-widget-container input.abtasty-search-widget-search-input{border:unset;font-size:1.6em;font-weight:700;outline:0;padding:unset;width:100%}div.abtasty-search-widget-container button.abtasty-search-widget-close-icon-container{background-color:#fff!important;border:none;border-radius:100%;cursor:pointer!important;margin-top:12px;padding:8px;-webkit-transform:translateX(150%);transform:translateX(150%);vertical-align:middle}div.abtasty-search-widget-container i.abtasty-search-widget-close-icon{background-color:#0c4884;height:28px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");vertical-align:middle;width:28px}div.abtasty-search-widget-container i.abtasty-search-widget-search-icon{background-color:#fff;height:12.5px;margin-right:6px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");width:12.5px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container{display:none}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible{-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible.no-results{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-pack:center;-ms-flex-pack:center;-ms-flex-direction:row;flex-direction:row;justify-content:center}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;overscroll-behavior:none;padding:16px 16px 50px}div.abtasty-search-widget-container div.abtasty-search-widget-search-info-and-sort{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:space-between}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;position:relative}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort label.abtasty-search-widget-search-sort-label{margin-right:12px;white-space:nowrap}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border:1px solid #caced1;border-radius:.25rem;color:#000;cursor:pointer;font-size:16px;font-size:1rem;outline:none;padding:.675em 2em .675em 1em;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:after,div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:before{content:\"\";pointer-events:none;position:absolute;right:16px;right:1rem}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:before{border-bottom:.3rem solid #000;border-left:.3rem solid transparent;border-right:.3rem solid transparent;top:35%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:after{border-left:.3rem solid transparent;border-right:.3rem solid transparent;border-top:.3rem solid #000;top:55%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-and-filters-button-container{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-pack:end;-ms-flex-pack:end;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;justify-content:end;width:100%}div.abtasty-search-widget-container button.abtasty-search-widget-search-filters-button{background-color:#fff;border:1px solid #caced1;border-radius:.25rem;color:#000;cursor:pointer;display:none;font-size:16px;font-size:1rem;margin-left:12px;outline:none;padding:.675em}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:grid;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:24px;justify-content:center;margin-top:16px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list.no-results{display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(5,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-no-result{font-size:38px;font-weight:700;margin-left:auto;margin-right:auto;margin-top:82px}div.abtasty-search-widget-container a.abtasty-search-widget-search-result-container{color:unset!important;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-result{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-pack:justify;-ms-flex-pack:justify;border-radius:12px;-webkit-box-shadow:0 2px 8px 0 rgba(0,0,0,.11);box-shadow:0 2px 8px 0 rgba(0,0,0,.11);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:400px;justify-content:space-between;padding:18px;width:auto}div.abtasty-search-widget-container div.abtasty-search-widget-search-result img{aspect-ratio:400/450;height:60%;margin-bottom:12px;margin-left:auto;margin-right:auto;-o-object-fit:contain;object-fit:contain;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-name{-webkit-line-clamp:3;-webkit-box-orient:vertical;color:#0d4884;display:-webkit-box;font-size:1em;font-weight:700;height:auto;line-height:1.5em;margin-bottom:8px;max-height:4.5em;min-height:1.5em;overflow:hidden;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-price{color:#404040;font-size:1.833em;font-weight:bolder;line-height:normal;margin-top:auto;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list{-webkit-box-sizing:border-box;box-sizing:border-box;min-width:240px;overflow-y:auto;overscroll-behavior:none;padding-bottom:50px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list-overlay{background-color:rgba(0,0,0,.5);bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#0c4884;border:none;cursor:pointer;display:none;margin-left:auto;padding:8px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button{-webkit-box-pack:center;-ms-flex-pack:center;border-radius:8px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff;cursor:pointer;display:none;justify-content:center;margin-left:auto;margin-right:auto;padding:8px;width:85%}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button i.abtasty-search-widget-close-icon{background-color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content{padding-left:18px;padding-right:18px}div.abtasty-search-widget-container button.abtasty-search-widget-search-facet-show-more{background-color:transparent;border:none;color:#0c4884;font-size:14px;font-weight:700;margin-bottom:12px;padding:0;text-decoration:underline}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content.range-facet{margin-bottom:12px;padding-right:18px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-list-item-container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;justify-content:space-between}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-list-item-container div.checkbox{margin:unset}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container{cursor:pointer;display:block;font-size:14px;font-weight:400;line-height:14px;margin-bottom:12px;padding-left:30px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.checked,div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container:hover:not(.disabled){font-weight:700}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.disabled{cursor:not-allowed}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input{cursor:pointer;height:0;opacity:0;position:absolute;width:0}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.disabled input{cursor:not-allowed}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input[type=checkbox]:before{content:none!important}div.abtasty-search-widget-container span.abtasty-search-widget-search-facet-checkbox-checkmark{background-color:transparent;border:1px solid #000;border-radius:4px;height:15px;left:0;position:absolute;top:0;width:15px}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input:checked~span.abtasty-search-widget-search-facet-checkbox-checkmark{background-color:#0c4884;font-weight:700}div.abtasty-search-widget-container span.abtasty-search-widget-search-facet-checkbox-checkmark:after{content:\"\";display:none;position:absolute}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input:checked~span.abtasty-search-widget-search-facet-checkbox-checkmark:after{display:block}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container span.abtasty-search-widget-search-facet-checkbox-checkmark:after{border:solid #fff;border-width:0 2px 2px 0;height:8px;left:4.5px;top:1.5px;-webkit-transform:rotate(45deg);transform:rotate(45deg);width:4px}div.abtasty-search-widget-container li.abtasty-search-widget-search-facet-list-item{margin-bottom:12px;margin-top:12px}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:rgba(0,0,0,.067);cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-size:16px;font-weight:700;justify-content:space-between;padding:13.5px 18px}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary:before{content:none}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary div.abtasty-search-widget-search-facet-arrow:before{content:\"\\276F\"}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary div.abtasty-search-widget-search-facet-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg);-webkit-transform-origin:center;transform-origin:center}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet[open] summary div.abtasty-search-widget-search-facet-arrow{-webkit-transform:rotate(270deg);transform:rotate(270deg)}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content ul{list-style:none}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider{background-color:#e0e0e0;border-radius:5px;height:5px;margin:20px 0;position:relative;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-progress{background-color:#0c4884;border-radius:5px;height:100%;position:absolute;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-handle{background-color:#0c4884;border:2px solid #fff;border-radius:50%;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.2);box-shadow:0 2px 4px rgba(0,0,0,.2);cursor:pointer;height:20px;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:20px;z-index:2}div.abtasty-search-widget-container div.abtasty-search-widget-range-values{-webkit-box-pack:justify;-ms-flex-pack:justify;color:#404040;display:-webkit-box;display:-ms-flexbox;display:flex;font-size:14px;justify-content:space-between;margin-top:10px}div.abtasty-search-widget-container div.abtasty-search-widget-range-values span{font-weight:600}div.abtasty-search-widget-container button.abtasty-search-widget-filters-button{background-color:#fff!important;border:none;border-radius:100%;cursor:pointer!important;display:none;margin-top:12px;padding:11px;-webkit-transform:translateX(-15%);transform:translateX(-15%);vertical-align:middle}div.abtasty-search-widget-container i.abtasty-search-widget-filters-icon{background-color:#0c4884;height:22px;-webkit-mask-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDE4IDE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGw9IiM0OTRjNGUiIGQ9Ik0xNyA1SDFhMSAxIDAgMCAxIDAtMmgxNmExIDEgMCAwIDEgMCAyem0wIDVIMWExIDEgMCAwIDEgMC0yaDE2YTEgMSAwIDAgMSAwIDJ6bTAgNUgxYTEgMSAwIDAgMSAwLTJoMTZhMSAxIDAgMCAxIDAgMnoiLz48L3N2Zz4=\");mask-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDE4IDE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGw9IiM0OTRjNGUiIGQ9Ik0xNyA1SDFhMSAxIDAgMCAxIDAtMmgxNmExIDEgMCAwIDEgMCAyem0wIDVIMWExIDEgMCAwIDEgMC0yaDE2YTEgMSAwIDAgMSAwIDJ6bTAgNUgxYTEgMSAwIDAgMSAwLTJoMTZhMSAxIDAgMCAxIDAgMnoiLz48L3N2Zz4=\");vertical-align:middle;width:22px}@media (max-width:1199.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (max-width:991.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:767.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(2,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-result{height:300px}}@media (max-width:575.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container{padding:22.5px}div.abtasty-search-widget-container button.abtasty-search-widget-close-icon-container{-webkit-transform:translateX(15%);transform:translateX(15%)}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list-container{width:100vw}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(1,minmax(0,1fr))}div.abtasty-search-widget-container button.abtasty-search-widget-filters-button,div.abtasty-search-widget-container button.abtasty-search-widget-search-filters-button{display:block}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list{background-color:#fff;bottom:0;left:0;max-height:unset!important;min-width:unset;overflow-x:hidden;position:absolute;top:0;-webkit-transition:.5s;transition:.5s;width:0;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button,div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button{display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list-overlay{display:block}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list.open{width:240px}}@media (max-width:374.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list.open{width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-info-and-sort{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-ms-flex-direction:column;flex-direction:column}div.abtasty-search-widget-container div.abtasty-search-widget-search-infos{margin-bottom:12px}}")),e}}(()=>{const{elementReferrer:e}=DATA;return(e=>{const a=(()=>{if(t()||(()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t})())return!1;const e=ABTasty.getTestsOnPage()[TEST_ID];return!!e&&Object.keys(e.targetings.qaParameters).length>0})(),s=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(a||s){const t=(()=>{const e=(()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`})();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")})();window.console.log(`%c${t} - ${a?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${e}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}})("Widget launch"),(()=>{const e=[{name:DATA.facetTitleFontName,style:DATA.facetTitleFontStyle},{name:DATA.searchBarTitleFontName,style:DATA.searchBarTitleFontStyle},{name:DATA.searchBarInputFontName,style:DATA.searchBarInputFontStyle},{name:DATA.facetSectionTitleFontName,style:DATA.facetSectionTitleFontStyle},{name:DATA.searchResultNameFontName,style:DATA.searchResultNameFontStyle},{name:DATA.searchResultPriceFontName,style:DATA.searchResultPriceFontStyle}];for(const{name:t,style:a}of e){if(!t||"inherit"===t||!/otf|ttf/g.test(a))continue;const e=document.createElement("style"),s=a.match(q)?a.match(q)[1]:"";e.innerHTML=`@font-face { font-family: '${t}_${s}'; src: url('${a}'); font-display: swap; }`,document.head.appendChild(e)}})(),new Promise(s=>{r(e,()=>{const i=a(e),r=i.getRootNode();i.style.position="relative";const n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.right="0",n.style.bottom="0",n.style.backgroundColor="transparent",n.style.cursor="pointer",n.onclick=e=>{e?.preventDefault?.(),e?.stopPropagation?.(),new X({target:i,rootElement:r}).openSearchWidget()},i.appendChild(n),t()&&n.onclick(),s()})})})().then(()=>{})}();
1
+ !function(){"use strict";const t=()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S?.USER?.accountIdentifier?.length?t=window.ABTASTY_S.USER.accountIdentifier:"function"==typeof window.ABTasty?.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty?.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t},e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),a=t=>(t=>{if("string"!=typeof t||!t.trim().length)return null;const[e,a,s]=t.split("[]").map(t=>t.trim()),i=Boolean(s)?s:t,r=a?document.querySelector(e)?.[a]:document;return r?r.querySelector(i):null})(t),s=(t,e)=>{const s=document.querySelector("body")||document.documentElement,i={childList:!0,subtree:!0,attributes:!0},r=()=>n.disconnect(),n=new MutationObserver(()=>{const s=a(e);return s&&!r()&&t(s)});return{clear:r,observe:(t=s)=>n.observe(t,i)}},i=()=>{},r=(t,n)=>{const o=a(t),c={selector:t,clear:i,observe:i};if(o)return setTimeout(()=>n(o),0),c;if(e())return setTimeout(()=>r(t,n),1e3),c;if(t.includes("[]"))return((t,e)=>{const[i,r]=e.split("[]").map(t=>t.trim()),n=a(i),o=n?.[r],{clear:c,observe:l}=s(t,e),h=()=>{const s=a(e);return s&&!d()&&t(s)},d=()=>{c(),n?.removeEventListener("load",h)},b=()=>{l(o),"iframe"===n?.localName&&n.addEventListener("load",h)};return b(),{selector:e,clear:d,observe:b}})(n,t);const{clear:l,observe:h}=s(n,t);return h(),{selector:t,clear:l,observe:h}},n="https://ms-839f1388554f-19719.fra.meilisearch.io",o=`${n}/indexes/${DATA.meilisearchIndex||t()}/search`,c=`${n}/multi-search`,l=["hasbro","lego","mattel"],h={"Content-Type":"application/json",Authorization:"Bearer 1b3d6acfb9eac2780cd20a30ce8728a565960d213b0729b01d9b5e9fdcd3f77b"};function d(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function b(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?d(Object(a),!0).forEach(function(e){g(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):d(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function g(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const u=t=>{for(;t.firstChild;)t.removeChild(t.lastChild)},m=function(t,e){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Object.entries(t).reduce((t,e)=>{let[s,i]=e;return t[s]&&(Array.isArray(t[s].values)?t[s]=b(b({},i),{},{values:t[s].values.map(t=>{let[e,s]=t;const r=i.values.find(t=>{let[a]=t;return a===e});return r?[e,r[1]]:[e,a?0:s]})}):t[s]=b(b({},i),{},{min:t[s].values.min,max:t[s].values.max})),t},b({},e))};class p{constructor(t){let{baseContainer:e,baseClassName:a,target:s,onInput:i,closeSearchWidget:r}=t;this.baseContainer=e,this.baseClassName=a,this.target=s,this.onInput=i,this.closeSearchWidget=r,this.inputId=`${this.baseClassName}-search-input`,this.searchBarContainer=this.getSearchBarContainer(),this.searchBarLabel=this.getSearchBarLabel(),this.searchBar=this.getSearchBar(),this.searchInput=this.getSearchInput(),this.renderSearchBar()}getSearchBarContainerHeight(){const t=this.target.closest("header");if(t){const e=t.getBoundingClientRect().height;return Math.max(e,150)+"px"}return"auto"}getCurrentSearchBarContainerHeight(){return this.searchBarContainer.getBoundingClientRect().height}resetSearchBarHeight(){this.searchBarContainer.style.minHeight=this.getSearchBarContainerHeight()}focusInput(){this.searchInput.focus()}getSearchBarContainer(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-bar-container`,t.style.minHeight=this.getSearchBarContainerHeight(),t}getSearchBarLabel(){const{searchLabel:t}=DATA,e=document.createElement("label");return e.className=`${this.baseClassName}-search-input-label`,e.innerHTML=t,e.htmlFor=this.inputId,e}getSearchBarAndCloseButtonContainer(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-bar-close-button-container`,t}getSearchBar(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-bar`,t}getSearchInput(){const t=document.createElement("input");return t.id=this.inputId,t.className=`${this.baseClassName}-search-input`,t.oninput=this.onInput,t}getSearchCloseButton(){const t=document.createElement("button");t.className=`${this.baseClassName}-close-icon-container`,t.onclick=this.closeSearchWidget;const e=document.createElement("i");return e.className=`${this.baseClassName}-close-icon`,t.appendChild(e),t}renderSearchBar(){this.searchBar.appendChild(this.searchInput);const t=this.getSearchBarAndCloseButtonContainer();t.append(this.searchBar,this.getSearchCloseButton()),this.searchBarContainer.appendChild(this.searchBarLabel),this.searchBarContainer.appendChild(t),this.baseContainer.appendChild(this.searchBarContainer)}}function f(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function y(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?f(Object(a),!0).forEach(function(e){w(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):f(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function w(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const v={text:"",filters:{},sort:["relevance"],page:0,totalPages:0,totalHits:0},x=function(){let t=y({},v);return y({get state(){return t},isNoFiltersAndNoSort:()=>0===Object.keys(t.filters).length&&"relevance"===t.sort[0]},{logState(t){},setText(e){t.text=e,this.logState("setText")},setPage(e){t.page=e,this.logState("setPage")},setTotalPages(e){t.totalPages=e,this.logState("setTotalPages")},setTotalHits(e){t.totalHits=e,this.logState("setTotalHits")},setSort(e){t.sort=""===e?[]:[e],this.logState("setSort")},onFilterChange(e,a,s){t.page=0,void 0!==s.checked?this.updateFilterArray(e,a,s.checked):this.updateRangeFilter(e,s.min,s.max),this.logState("onFilterChange")},updateRangeFilter(e,a,s){t.filters[e]=[{operator:">",value:a},{operator:"<",value:s}],this.logState("updateRangeFilter")},updateFilterArray(e,a,s){s?t.filters[e]=[...t.filters[e]||[],a]:(t.filters[e].length&&(t.filters[e]=t.filters[e].filter(t=>t!==a)),0===t.filters[e].length&&delete t.filters[e]),this.logState("updateFilterArray")},resetFiltersAndPagination(){this.resetFilters(),this.resetPagination(),this.logState("resetFiltersAndPagination")},resetFilters(){t.filters={},this.logState("resetFilters")},resetPagination(){t.page=0,t.totalPages=0,this.logState("resetPagination")},resetSort(){t.sort=["relevance"],this.logState("resetSort")},reset(){t=y({},v),this.logState("reset")}})}();class C{constructor(t){let{id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=t;this.id=e,this.facet=a,this.baseClassName=s,this.facetsListContainer=i,this.onFiltersChange=r,this.facetContentContainers=this.createFacetContainers(),this.facetsListContainer.insertBefore(this.facetContentContainers.facetContainer,this.facetsListContainer.lastChild.previousElementSibling)}createFacetContainers(){const{facetsTranslationKeys:t}=DATA,e=t?JSON.parse(t):{},a=`${(s=this.facet.title).charAt(0).toUpperCase()}${s.slice(1)}`;var s;const i=e[a]??a,r=document.createElement("details");r.className=`${this.baseClassName}-search-facet`,r.open=!0;const n=document.createElement("summary");n.innerHTML=`\n\t\t\t<span>${i}</span>\n\t\t\t<div class="${this.baseClassName}-search-facet-arrow" />\n\t\t`;const o=document.createElement("div");return o.className=`${this.baseClassName}-search-facet-content ${this.facet.type}-facet`,r.append(n,o),{facetContainer:r,facetContent:o}}getFacetContainers(){return this.facetContentContainers}}class S extends C{constructor(t){let{id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=t;super({id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r});const{facetContent:n,facetContainer:o}=this.getFacetContainers();this.facetContent=n,this.facetContainer=o,this.facetList=this.getFacetListElement(),this.onFiltersChange=r,this.showAll=!1,this.facetContent.append(this.facetList)}createFacetContent(){const t=this.facet.values.sort((t,e)=>{let[a,s]=t,[i,r]=e;return r-s}).sort((t,e)=>{let[a,s]=t,[i,r]=e;const n=(x.state.filters[this.facet.title]||[]).includes(a),o=(x.state.filters[this.facet.title]||[]).includes(i);return n===o?r-s:o-n}),e=this.showAll?t:t.slice(0,10),a=[];for(const[t,s]of e){const e=this.getFacetListItemElement({name:t,count:s});a.push(e)}if(this.facetList.append(...a),this.facet.values.length>10){const t=document.createElement("button");t.className=`${this.baseClassName}-search-facet-show-more`,t.innerHTML="Show "+(this.showAll?"less":"more"),t.onclick=()=>{this.showAll=!this.showAll,this.updateFacetContent()},this.facetList.append(t)}}getFacetListElement(){const t=document.createElement("ul");return t.style.padding="0",t}getFacetListItemElement(t){const{name:e,count:a}=t,s=document.createElement("li");s.className=`${this.baseClassName}-search-facet-list-item`,s.id=`${this.baseClassName}-search-facet-list-item-${e.replace(" ","-").toLowerCase()}`;const i=(x.state.filters[this.facet.title]||[]).includes(e),r=document.createElement("label");r.className=`${this.baseClassName}-search-facet-checkbox-container ${i||0!==a?"":"disabled"} ${i?"checked":""}`,r.innerHTML=`${e} (${a})`;const n=document.createElement("span");n.className=`${this.baseClassName}-search-facet-checkbox-checkmark`;const o=document.createElement("input");return o.disabled=!i&&0===a,o.checked=i,o.type="checkbox",o.onclick=()=>{const t=o.checked;this.onFiltersChange({facetType:"list",facetKey:this.facet.title,facetValue:e,options:{checked:t}})},r.appendChild(o),r.appendChild(n),s.appendChild(r),s}updateFacetContent(){u(this.facetList),0!==this.facet.values.length&&this.createFacetContent()}updateFacet(t){this.facet={title:this.facet.title,type:this.facet.type,values:t.values},this.showAll=!1,this.updateFacetContent()}}class k{constructor(t){let{baseClassName:e,currentRange:a,min:s,max:i,onRangeChange:r}=t;this.baseClassName=e,this.currentRange=a||{min:s,max:i},this.min=s,this.max=i,this.onRangeChange=r}render(){const t=document.createElement("div");t.className=`${this.baseClassName}-range-slider`;const e=document.createElement("div");e.className="range-progress";const a=document.createElement("div");a.className="range-handle";const s=document.createElement("div");s.className="range-handle";const i=document.createElement("div");if(i.className=`${this.baseClassName}-range-values`,this.min===this.max)return a.style.left="0%",s.style.left="100%",e.style.left="0%",e.style.width="100%",a.style.pointerEvents="none",s.style.pointerEvents="none",i.innerHTML=`\n\t\t\t\t<span>${this.min}</span>\n\t\t\t\t<span>${this.max}</span>\n\t\t\t`,t.append(e,a,s),{rangeContainer:t,valuesContainer:i};const r=(this.currentRange.min-this.min)/(this.max-this.min)*100,n=(this.currentRange.max-this.min)/(this.max-this.min)*100;a.style.left=`${r}%`,s.style.left=`${n}%`,e.style.left=`${r}%`,e.style.width=n-r+"%",i.innerHTML=`\n\t\t\t<span>${this.currentRange.min}</span>\n\t\t\t<span>${this.currentRange.max}</span>\n\t\t`,t.append(e,a,s);let o=!1,c=null,l=0,h=0;const d=()=>{const t=parseFloat(a.style.left),e=parseFloat(s.style.left),r=(this.min+t/100*(this.max-this.min)).toFixed(2),n=(this.min+e/100*(this.max-this.min)).toFixed(2);return i.innerHTML=`\n\t\t\t\t<span>${r}</span>\n\t\t\t\t<span>${n}</span>\n\t\t\t`,{minValue:r,maxValue:n}},b=t=>{t.preventDefault(),o=!0,c=t.target,l=t.clientX,h=parseFloat(c.style.left)},g=i=>{if(!o)return;i.preventDefault();const r=i.clientX-l,n=t.offsetWidth;let b=h+r/n*100;b=c===a?Math.max(0,Math.min(b,parseFloat(s.style.left))):Math.max(parseFloat(a.style.left),Math.min(b,100)),b=.8*Math.round(b/.8),c.style.left=`${b}%`,(()=>{const t=parseFloat(a.style.left),i=parseFloat(s.style.left);e.style.left=`${t}%`,e.style.width=i-t+"%"})(),d()},u=()=>{if(!o)return;o=!1,c=null;const{minValue:t,maxValue:e}=d();this.currentRange={min:t,max:e},this.onRangeChange(this.currentRange)};return[a,s].forEach(t=>{t.addEventListener("mousedown",b),document.addEventListener("mousemove",g),document.addEventListener("mouseup",u)}),{rangeContainer:t,valuesContainer:i}}}class F extends C{constructor(t){let{id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=t;super({id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r});const{facetContent:n,facetContainer:o}=this.getFacetContainers();this.facetContent=n,this.facetContainer=o,this.onFiltersChange=r,this.filterRange=new k({baseClassName:this.baseClassName,currentRange:{min:this.facet.values.min,max:this.facet.values.max},min:this.facet.values.min,max:this.facet.values.max,onRangeChange:t=>{this.onFiltersChange({facetType:"range",facetKey:this.facet.title,options:t})}})}createFacetContent(){const{rangeContainer:t,valuesContainer:e}=this.filterRange.render();this.facetContent.append(t,e)}updateFacetContent(){u(this.facetContent),void 0!==this.facet.values.min&&void 0!==this.facet.values.max&&(this.filterRange=new k({baseClassName:this.baseClassName,currentRange:{min:this.facet.values.min,max:this.facet.values.max},min:this.facet.values.min,max:this.facet.values.max,onRangeChange:t=>{this.onFiltersChange({facetType:"range",facetKey:this.facet.title,options:t})}}),this.createFacetContent())}updateFacet(t){this.facet={title:this.facet.title,type:this.facet.type,values:t.values},this.updateFacetContent()}}class N{constructor(t){let{baseClassName:e,sortOptions:a,onSortChange:s}=t;this.baseClassName=e,this.onSortChange=s,this.sortOptions=a,this.element=this.getSortFacetElement()}getSortOptionsElements(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-sort-options`;for(const e of this.sortOptions){const a=document.createElement("button");a.classList.add(`${this.baseClassName}-search-sort-option`),(""===e.value&&0===x.state.sort.length||x.state.sort.includes(e.value))&&(a.classList.add("active"),a.disabled=!0),a.innerHTML=e.label,a.dataset.value=e.value,a.onclick=()=>this.onSortChange(e.value),t.appendChild(a)}return t}getSortFacetElement(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-sort-facet`;const e=document.createElement("label");return e.className=`${this.baseClassName}-search-sort-label`,e.textContent="Sort by:",t.appendChild(e),t.appendChild(this.getSortOptionsElements()),t}update(t){this.element.querySelectorAll(".active").forEach(t=>{t.classList.remove("active"),t.disabled=!1});const e=this.element.querySelector(`[data-value="${t[0]||"relevance"}"]`);e&&(e.classList.add("active"),e.disabled=!0)}}class E{constructor(t){let{baseClassName:e,baseContainer:a,searchBar:s,onFiltersChange:i,onFiltersReset:r,onSortChange:n,sortOptions:o}=t;this.baseClassName=e,this.baseContainer=a,this.searchBar=s,this.onFiltersChange=i,this.onFiltersReset=r,this.onSortChange=n,this.sortOptions=o,this.facets=[],this.facetsListContainer=this.getFacetsListContainer()}setMaxHeight(t){this.facetsListContainer.style.maxHeight=t}getFacetsListContainer(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-facets-list`;const e=document.createElement("button");e.className=`${this.baseClassName}-search-facets-list-close-button`,e.onclick=this.closeFilters.bind(this);const a=document.createElement("i");a.className=`${this.baseClassName}-close-icon`,e.appendChild(a),this.sortFacet=new N({baseClassName:this.baseClassName,sortOptions:this.sortOptions,onSortChange:this.onSortChange});const s=document.createElement("button");s.className=`${this.baseClassName}-search-facets-list-reset-button`,s.innerHTML="Reset",s.onclick=this.onFiltersReset.bind(this);const i=document.createElement("button");return i.className=`${this.baseClassName}-search-facets-list-bottom-close-button`,i.innerHTML="Close",i.onclick=this.closeFilters.bind(this),t.append(e,this.sortFacet.element,s,i),t}renderFacets(t){[...this.facetsListContainer.children].forEach(t=>{t.tagName.toLowerCase()==="details".toLowerCase()&&t.parentNode.removeChild(t)}),this.facets=[];for(const[e,a]of Object.entries(t)){if(0===a.values.length||1===a.values.length)continue;const t={id:e,facet:{title:e,values:a.values,type:a.type},baseClassName:this.baseClassName,facetsListContainer:this.facetsListContainer,onFiltersChange:this.onFiltersChange},s=new("range"===a.type?F:S)(t);this.facets.push(s)}this.facets.forEach(t=>{t.createFacetContent()}),this.baseContainer.appendChild(this.facetsListContainer)}updateRangeFacets(t){this.facets.filter(t=>t instanceof F).forEach(e=>{e.updateFacet(t[e.id])})}updateListFacets(t){this.facets.filter(t=>t instanceof S).forEach(e=>{e.updateFacet(t[e.id])})}updateFacets(t){this.updateRangeFacets(t),this.updateListFacets(t)}openFilters(){const t=this.baseContainer.parentElement,e=document.createElement("div");e.className=`${this.baseClassName}-search-facets-list-overlay`,e.onclick=this.closeFilters.bind(this),t.insertAdjacentElement("afterbegin",e),this.facetsListContainer.classList.add("open")}closeFilters(){this.facetsListContainer.classList.remove("open");const t=this.baseContainer.parentElement.firstChild;this.baseContainer.parentElement.removeChild(t)}}class A{constructor(t){let{result:e,index:a,baseClassName:s}=t;this.result=e,this.index=a,this.baseClassName=s}getSearchResultElement(){const t=document.createElement("a");return t.className=`${this.baseClassName}-search-result-container`,t.href=this.result.link,t.target="_blank",t.rel="noreferrer",t.innerHTML=`\n <div class="${this.baseClassName}-search-result result-${this.index}">\n <img loading="lazy" src="${this.result.img_link}" />\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-name">${this.result.name}</div>\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-price">${this.result.price}€</div>\n\t\t\t\t\t</div>\n </div\n\t\t`,t}}class T{constructor(t){let{baseClassName:e,sortOptions:a,infos:s,onSortChange:i,openFilters:r}=t;this.baseClassName=e,this.onSortChange=i,this.sortOptions=a,this.infos=s,this.openFilters=r,this.infosElement=this.getInfosElement(),this.sortLabelElement=this.getSortLabelElement(),this.sortSelectElement=this.getSortSelectElement(),this.sortAndFiltersButtonElement=this.getSortAndFiltersButtonElement(),this.infosAndSortContainer=this.getInfoAndSortContainerElement(),this.infosAndSortContainer.appendChild(this.infosElement),this.infosAndSortContainer.appendChild(this.sortAndFiltersButtonElement),this.setSortOptions()}getInfoAndSortContainerElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-info-and-sort`,t}getInfosElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-infos`,t.style.whiteSpace="nowrap",t.innerHTML=`\n\t\t\t<span><strong>${this.infos.totalHits}</strong> items</span>\n\t\t`,t}getSortLabelElement(){const t=document.createElement("label");return t.className=`${this.baseClassName}-search-sort-label`,t.textContent="Sort by:",t.htmlFor=`${this.baseClassName}-search-sort-select`,t}getSortSelectElement(){const t=document.createElement("select");return t.className=`${this.baseClassName}-search-sort-select`,t.id=`${this.baseClassName}-search-sort-select`,t.name=`${this.baseClassName}-search-sort-select`,t.onchange=this.handleSortChange.bind(this),t}getSortElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-sort`,t.appendChild(this.sortLabelElement),t.appendChild(this.sortSelectElement),t}getFiltersButtonElement(){const t=document.createElement("button");return t.className=`${this.baseClassName}-search-filters-button`,t.innerHTML="Filters",t.onclick=this.openFilters.bind(this),t}getSortAndFiltersButtonElement(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-sort-and-filters-button-container`;const e=this.getSortElement(),a=this.getFiltersButtonElement();return t.appendChild(e),t.appendChild(a),t}setSortOptions(){this.sortSelectElement.childElementCount&&removeChildren(this.sortSelectElement);for(const t of this.sortOptions){const e=document.createElement("option");e.value=t.value,e.textContent=t.label,this.sortSelectElement.appendChild(e)}}handleSortChange(t){const e=t.target.value;this.onSortChange(e)}updateInfos(t){this.infos=t,this.infosElement.innerHTML=`\n\t\t\t<span><strong>${this.infos.totalHits}</strong> items</span>\n\t\t`}updateSort(t){this.sortSelectElement.value=t[0]||"relevance"}updateSortOptions(t){this.sortOptions=t,this.setSortOptions()}}class R{hasTriggeredSeeMore=!1;constructor(t){let{baseContainer:e,baseClassName:a,searchBar:s,onFiltersChange:i,onSortChange:r,onSeeMore:n,onFiltersReset:o}=t;this.baseContainer=e,this.baseClassName=a,this.searchBar=s,this.onFiltersChange=i,this.onSortChange=r,this.onSeeMore=n,this.onFiltersReset=o,this.sortOptions=[{value:"relevance",label:"Relevance"},{value:"price:asc",label:"↑ Price"},{value:"price:desc",label:"↓ Price"}],this.searchResultContainer=this.getSearchResultContainerElement(),this.searchResultListContainer=this.getSearchResultListContainerElement(),this.searchResultList=this.getSearchResultListElement(),this.facetsList=new E({searchBar:this.searchBar,baseContainer:this.searchResultContainer,baseClassName:this.baseClassName,onFiltersChange:this.onFiltersChange,onFiltersReset:this.onFiltersReset,onSortChange:this.onSortChange,sortOptions:this.sortOptions}),this.infoAndSort=new T({baseClassName:this.baseClassName,infos:{totalHits:x.state.totalHits},sortOptions:this.sortOptions,onSortChange:this.onSortChange,openFilters:this.openFilters.bind(this)}),new MutationObserver(this.mutationCallback.bind(this)).observe(this.searchResultContainer,{childList:!0})}mutationCallback(t){for(const e of t)if("childList"===e.type)if(!e.target.childNodes.length||"0px"!==this.searchResultContainer.style.maxHeight&&""!==this.searchResultContainer.style.maxHeight)0===e.target.childNodes.length&&(this.searchResultListContainer.style.maxHeight="0px",this.facetsList.setMaxHeight("0px"));else{const t=`calc(100vh - ${this.searchBar.getCurrentSearchBarContainerHeight()||0}px)`;this.searchResultListContainer.style.maxHeight=t,this.facetsList.setMaxHeight(t)}}scrollToTop(){this.searchResultList.scrollTop=0}openFilters(){this.facetsList.openFilters()}clearSearchResults(){u(this.searchResultList),u(this.searchResultListContainer),u(this.searchResultContainer),this.searchResultContainer.classList.remove("visible","no-results")}getSearchResultContainerElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-result-container`,t}getSearchResultListContainerElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-result-list-container`,t.addEventListener("scroll",t=>{const e=t.target.scrollTop+t.target.clientHeight>=t.target.scrollHeight-500;!this.hasTriggeredSeeMore&&e&&x.state.page<x.state.totalPages&&(this.hasTriggeredSeeMore=!0,this.onSeeMore())}),t}getSearchResultListElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-result-list`,t}updateSearchResults(t){if(u(this.searchResultList),this.searchResultContainer.classList.remove("no-results"),this.infoAndSort.updateInfos({totalHits:x.state.totalHits}),t.length)for(const[e,a]of t.entries()){const t=new A({result:a,index:e,searchResultContainer:this.searchResultList,baseClassName:this.baseClassName});this.searchResultList.appendChild(t.getSearchResultElement())}else{const t=document.createElement("div");t.className=`${this.baseClassName}-search-no-result`,t.innerHTML="No results found",this.searchResultContainer.classList.add("no-results"),this.searchResultList.appendChild(t)}this.hasTriggeredSeeMore=!1}renderSearchResults(t,e){if(this.baseContainer.classList.add("search-completed"),this.clearSearchResults(),this.infoAndSort.updateInfos({totalHits:x.state.totalHits}),t.length){this.facetsList.renderFacets(e);for(const[e,a]of t.entries()){const t=new A({result:a,index:e,searchResultContainer:this.searchResultList,baseClassName:this.baseClassName});this.searchResultList.appendChild(t.getSearchResultElement())}this.searchResultListContainer.appendChild(this.infoAndSort.infosAndSortContainer),this.searchResultListContainer.appendChild(this.searchResultList),this.searchResultContainer.appendChild(this.searchResultListContainer),this.baseContainer.appendChild(this.searchResultContainer)}else{const t=document.createElement("div");t.className=`${this.baseClassName}-search-no-result`,t.innerHTML="No results found",this.searchResultContainer.classList.add("no-results"),this.searchResultContainer.appendChild(t)}this.searchResultContainer.classList.add("visible"),this.baseContainer.appendChild(this.searchResultContainer),this.hasTriggeredSeeMore=!1}}function L(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function $(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?L(Object(a),!0).forEach(function(e){O(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):L(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function O(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const P={results:[],facets:{},selectedFacets:{}},j=(()=>{let t=$({},P);return $({get state(){return t}},{logState(t){},addResults(e){t.results=[...t.results,...e.sort((t,e)=>((t,e)=>{const a=t.toLowerCase(),s=e.toLowerCase();return l.some(t=>a.includes(t))&&!l.some(t=>s.includes(t))?-1:l.some(t=>s.includes(t))&&!l.some(t=>a.includes(t))?1:0})(t.name,e.name))],this.logState("addResults")},setFacets(e){t.facets=e,this.logState("setFacets")},addRangeToSelectedFacets(e,a){t.selectedFacets[e]={type:a.type,values:a.values},this.logState("addRangeToSelectedFacets")},addListToSelectedFacets(e,a){if(a){const s=a.values[0],i=a.values[1],r=t.selectedFacets[e];if(r){const t=r.values.findIndex(t=>{let[e]=t;return e===s});t>-1?r.values[t]=[s,r.values[t][1]+i]:r.values.push([s,i])}else t.selectedFacets[e]={type:a.type,values:[[s,i]]}}this.logState("addListToSelectedFacets")},removeSelectedFacet(e,a){const s=t.selectedFacets[e];s&&(s.values=s.values.filter(t=>{let[e]=t;return e!==a})),0===s.values.length&&delete t.selectedFacets[e],this.logState("removeSelectedFacet")},updateSelectedFacets(e){const a=m(e,t.selectedFacets,!0);t.selectedFacets=a,this.logState("updateSelectedFacets")},updateFacets(e){t.facets=m(e,t.facets,!0),this.logState("updateFacets")},setSelectedFacets(e){t.selectedFacets=e,this.logState("setSelectedFacets")},clearResults(){t.results=[],this.logState("clearResults")},reset(){t=$({},P),this.logState("reset")}})})();function B(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function I(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?B(Object(a),!0).forEach(function(e){D(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):B(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function D(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const M=function(t){let e=[];for(const a in t){const s=t[a];if(Array.isArray(s))if("object"==typeof s[0]){const t=s.map(t=>`${a} ${t.operator} ${t.value}`);e.push(`(${t.join(" AND ")})`)}else{const t=s.map(t=>`"${a}" = "${t}"`);e.push(`(${t.join(" OR ")})`)}}return e.join(" AND ")},H=function(t){const{facetDistribution:e,facetStats:a}=t;let s={};for(const t in e)a&&a[t]?s[t]={type:"range",values:{min:a[t].min,max:a[t].max}}:s[t]={type:"list",values:Object.entries(e[t])};return s},z=t=>{const e=DATA.language,a=[];for(const s of t){let t=s.title,i=s.link;e&&(s.localized_title&&(t=JSON.parse(s.localized_title)[e]??s.title),s.localized_link&&(i=JSON.parse(s.localized_link)[e]??s.link)),i&&s.img_link&&s.price&&a.push({name:t,link:i,img_link:s.img_link,price:s.price,category:s.category,brand:s.brand})}return a},W=t=>{let{text:e,filters:a,sort:s,page:i}=t;return JSON.stringify({q:e,filter:M(a),facets:["*"],hitsPerPage:50,page:i+1,sort:"relevance"===s[0]?[]:s})},_=t=>({hits:z(t.hits),facets:H(t),page:t.page,totalPages:t.totalPages,totalHits:t.totalHits}),q=/.+\/([^.]+)\.(otf|ttf)$/,J=(t,e)=>t&&"inherit"!==t?`font-family:${t}_${e.match(q)?e.match(q)[1]:""};`:e||"",U=()=>{const{primaryColor:t,secondaryColor:e,tertiaryColor:a,searchBarTitleAlign:s,searchBarTitleFontName:i,searchBarTitleFontSize:r,searchBarTitleFontStyle:n,searchBarTitleCustomFontColor:o,searchBarTitleTextColor:c,searchBarInputAlign:l,searchBarInputFontName:h,searchBarInputFontSize:d,searchBarInputFontStyle:b,searchBarInputCustomFontColor:g,searchBarInputTextColor:u}=DATA;return["div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container {",`background-color: ${t};`,"}","div.abtasty-search-widget-container i.abtasty-search-widget-close-icon {",`background-color: ${t};`,"}","div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label {",`text-align: ${s};`,J(i,n),`font-size: ${r}px;`,`color: ${o?c:e};`,"}","div.abtasty-search-widget-container input.abtasty-search-widget-search-input {",`text-align: ${l};`,J(h,b),`font-size: ${d}px;`,`color: ${g?u:a};`,"}"].join("")},X=()=>{const{primaryColor:t,secondaryColor:e,tertiaryColor:a,facetSectionTitleAlign:s,facetSectionTitleFontName:i,facetSectionTitleFontSize:r,facetSectionTitleFontStyle:n,facetSectionTitleCustomFontColor:o,facetSectionTitleTextColor:c,facetTitleAlign:l,facetTitleFontName:h,facetTitleFontSize:d,facetTitleFontStyle:b,facetTitleCustomFontColor:g,facetTitleTextColor:u}=DATA;return["div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary {",`text-align: ${s};`,J(i,n),`font-size: ${r}px;`,`color: ${o?c:t};`,"}","div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container {",`text-align: ${l};`,J(h,b),`font-size: ${d}px;`,`color: ${g?u:a};`,"}","div.abtasty-search-widget-container button.abtasty-search-widget-search-facet-show-more {",`color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider {",`background-color: ${e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button,","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-progress {",`background-color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button {",`background-color: ${t};`,`color: ${e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-handle {",`background-color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-values {",`color: ${a};`,"}"].join("")},Z=()=>{const{primaryColor:t,tertiaryColor:e,searchResultNameAlign:a,searchResultNameFontName:s,searchResultNameFontSize:i,searchResultNameFontStyle:r,searchResultNameCustomFontColor:n,searchResultNameTextColor:o,searchResultPriceAlign:c,searchResultPriceFontName:l,searchResultPriceFontSize:h,searchResultPriceFontStyle:d,searchResultPriceCustomFontColor:b,searchResultPriceTextColor:g}=DATA;return["div.abtasty-search-widget-container div.abtasty-search-widget-search-result-name {",`text-align: ${a};`,J(s,r),`font-size: ${i}px;`,`color: ${n?o:t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-result-price {",`text-align: ${c};`,J(l,d),`font-size: ${h}px;`,`color: ${b?g:e};`,"}"].join("")};class G{constructor(t){let{target:e,rootElement:a}=t;this.baseClassName="abtasty-search-widget",this.target=e,this.rootElement=a,this.searchOpen=!1,this.searchWidgetContainer=this.getSearchWidgetContainerElement(),this.searchBar=new p({baseContainer:this.searchWidgetContainer,baseClassName:this.baseClassName,target:this.target,onInput:this.debouncedOnInput.bind(this),closeSearchWidget:this.closeSearchWidget.bind(this)}),this.searchResultsList=new R({baseClassName:this.baseClassName,baseContainer:this.searchWidgetContainer,searchBar:this.searchBar,onFiltersChange:this.onFiltersChange.bind(this),onSeeMore:this.onSeeMore.bind(this),onSortChange:this.onSortChange.bind(this),onFiltersReset:this.onFiltersReset.bind(this)})}insertIn(t,e){t.insertAdjacentElement(e,this.searchWidgetContainer)}remove(){this.rootElement.querySelector("body").removeChild(this.searchWidgetContainer)}openSearchWidget(){if(this.searchOpen)return;const t=this.rootElement.querySelector("body");this.rootElement.querySelector("html").classList.add("search-open"),this.insertIn(t,"afterbegin"),this.searchBar.focusInput(),this.searchOpen=!0}closeSearchWidget(){this.rootElement.querySelector("html").classList.remove("search-open"),this.searchOpen=!1,this.remove()}onFiltersReset=()=>{x.isNoFiltersAndNoSort()||(x.resetFiltersAndPagination(),x.resetSort(),this.onSearch())};onFiltersChange=t=>{let{facetType:e,facetKey:a,facetValue:s,options:i}=t;"range"===e?this.onRangeChange(a,i.min,i.max):this.onListCheckboxChange(a,s,i.checked)};onSortChange=async t=>{x.setPage(0),j.clearResults(),x.setSort(t),this.searchResultsList.scrollToTop();const e=await(async()=>{try{const t=await fetch(o,{method:"POST",headers:h,body:W(x.state)}),e=await t.json();return{results:_(e).hits}}catch(t){return window.console.error(t),{results:[]}}})();if(!e)return;const{results:a}=e;j.addResults(a),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.facetsList.sortFacet.update(x.state.sort),this.searchResultsList.infoAndSort.updateSort(x.state.sort)};onRangeChange=async(t,e,a)=>{x.resetPagination(),j.clearResults(),x.updateRangeFilter(t,e,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n,totalHits:o}=s;j.addResults(i),r[t]&&delete r[t],j.updateFacets(r),j.addRangeToSelectedFacets(t,{type:"range",values:{min:e,max:a}}),x.setTotalPages(n),x.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.facetsList.updateListFacets(j.state.facets)};onListCheckboxChange=async(t,e,a)=>{x.resetPagination(),j.clearResults(),x.updateFilterArray(t,e,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n,totalHits:o}=s;if(j.addResults(i),j.updateFacets(r),a){const a=r[t]?.values.find(t=>{let[a]=t;return a===e});j.addListToSelectedFacets(t,{type:"list",values:a||[e,0]})}else j.removeSelectedFacet(t,e);x.setTotalPages(n),x.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.facetsList.updateFacets(j.state.facets)};onInput=t=>{x.setText(t.target.value),t.target.value.length?((Object.keys(x.state.filters).length||x.state.page>0)&&x.resetFiltersAndPagination(),this.onSearch()):(this.searchWidgetContainer.classList.remove("search-completed"),this.searchResultsList.clearSearchResults())};onSeeMore=async()=>{x.setPage(x.state.page+1);const t=await(async()=>{try{const t=await fetch(o,{method:"POST",headers:h,body:W(x.state)}),e=await t.json(),a=_(e);return{results:a.hits,totalPages:a.totalPages}}catch(t){return window.console.error(t),null}})();if(!t)return;const{results:e,totalPages:a}=t;j.addResults(e),x.setTotalPages(a),this.searchResultsList.updateSearchResults(j.state.results)};async onSearchWithFilters(){const{text:e}=x.state;return this.searchResultsList.scrollToTop(),e?await(async()=>{const e=(t=>{const e=[],{text:a,filters:s,page:i,sort:r}=x.state;return e.push({indexUid:t,q:a,filter:M(s),hitsPerPage:50,page:i+1,sort:"relevance"===r[0]?[]:r}),Object.entries(j.state.facets).forEach(i=>{let[r]=i;const n=I({},s);delete n[r],e.push({indexUid:t,q:a,filter:M(n),facets:[r],hitsPerPage:0})}),JSON.stringify({queries:e})})(DATA.meilisearchIndex||t());try{const t=await fetch(c,{method:"POST",headers:h,body:e}),a=(t=>{const{results:e}=t,a=e.slice(1).reduce((t,e)=>{const a=H(e);return I(I({},t),a)},{});return{hits:z(e[0].hits),facets:a,page:e[0].page,totalPages:e[0].totalPages,totalHits:e[0].totalHits}})(await t.json());return{results:a.hits,facets:a.facets,totalPages:a.totalPages,page:a.page,totalHits:a.totalHits}}catch(t){return window.console.error(t),null}})():(this.searchWidgetContainer.classList.remove("search-completed"),null)}onSearch=async()=>{const{text:t}=x.state;if(j.clearResults(),this.searchResultsList.scrollToTop(),t)try{const t=await(async()=>{try{const t=await fetch(o,{method:"POST",headers:h,body:W(x.state)}),e=await t.json(),a=_(e);return{results:a.hits,facets:a.facets,totalPages:a.totalPages,page:a.page,totalHits:a.totalHits}}catch(t){return window.console.error(t),{results:[],facets:{},totalPages:0,page:0,totalHits:0}}})(),{results:e,facets:a,totalPages:s,totalHits:i}=t;j.addResults(e),j.setFacets(a),x.setTotalPages(s),x.setTotalHits(i),this.searchResultsList.renderSearchResults(e,a)}catch(t){window.console.error(t)}else this.searchWidgetContainer.classList.remove("search-completed")};debouncedOnInput=(()=>(t=>{let e=null;return function(){for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];window.clearTimeout(e),e=window.setTimeout(()=>{t(...s)},150)}})(this.onInput.bind(this)))();getSearchWidgetContainerElement(){const t=document.createElement("div"),e=document.createElement("style");t.className=`${this.baseClassName}-container`;const[a,s,i]=[U(),Z(),X()],r=document.createTextNode("html.search-open{height:100vh;overflow:hidden;padding:0}div.abtasty-search-widget-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:hsla(0,0%,100%,.5);bottom:0;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:inherit;height:100vh;left:0;position:fixed;right:0;top:0;width:100vw;z-index:9999}div.abtasty-search-widget-container button:not(:disabled):hover{opacity:.5}div.abtasty-search-widget-container i{display:inline-block;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}div.abtasty-search-widget-container.search-completed{background-color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:#0c4884;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:22.5px 100px;position:sticky;top:0}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar{background-color:#fff;border-radius:12px;margin-top:12px;padding:12px;width:100%}div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label{color:#fff;font-size:16px;font-weight:700;line-height:17px;margin-left:auto;margin-right:auto;margin-top:auto}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-close-button-container{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;line-height:unset}div.abtasty-search-widget-container input.abtasty-search-widget-search-input{border:unset;font-size:1.6em;font-weight:700;outline:0;padding:unset;width:100%}div.abtasty-search-widget-container button.abtasty-search-widget-close-icon-container{background-color:#fff!important;border:none;border-radius:100%;cursor:pointer!important;margin-top:12px;padding:8px;-webkit-transform:translateX(150%);transform:translateX(150%);vertical-align:middle}div.abtasty-search-widget-container i.abtasty-search-widget-close-icon{background-color:#0c4884;height:28px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");vertical-align:middle;width:28px}div.abtasty-search-widget-container i.abtasty-search-widget-search-icon{background-color:#fff;height:12.5px;margin-right:6px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");width:12.5px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container{display:none}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible{-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;overscroll-behavior:none;padding:16px 16px 50px}div.abtasty-search-widget-container div.abtasty-search-widget-search-info-and-sort{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:space-between}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;position:relative}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort label.abtasty-search-widget-search-sort-label{margin-right:12px;white-space:nowrap}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border:1px solid #caced1;border-radius:4px;color:#000;cursor:pointer;font-size:16px;outline:none;padding:.675em 2em .675em 1em;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:after,div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:before{content:\"\";pointer-events:none;position:absolute;right:16px;right:1rem}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:before{border-bottom:.3rem solid #000;border-left:.3rem solid transparent;border-right:.3rem solid transparent;top:35%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:after{border-left:.3rem solid transparent;border-right:.3rem solid transparent;border-top:.3rem solid #000;top:55%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-and-filters-button-container{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-pack:end;-ms-flex-pack:end;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;justify-content:end;width:100%}div.abtasty-search-widget-container button.abtasty-search-widget-search-filters-button{background-color:#fff;border:1px solid #caced1;border-radius:4px;color:#000;cursor:pointer;display:none;font-size:16px;margin-left:12px;outline:none;padding:.675em}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:grid;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:24px;justify-content:center;margin-top:16px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible.no-results div.abtasty-search-widget-search-result-list-container{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(5,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-no-result{font-size:38px;font-weight:700;margin-left:auto;margin-right:auto;margin-top:82px;text-align:center}div.abtasty-search-widget-container a.abtasty-search-widget-search-result-container{color:unset!important;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-result{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-pack:justify;-ms-flex-pack:justify;border-radius:12px;-webkit-box-shadow:0 2px 8px 0 rgba(0,0,0,.11);box-shadow:0 2px 8px 0 rgba(0,0,0,.11);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:400px;justify-content:space-between;padding:18px;width:auto}div.abtasty-search-widget-container div.abtasty-search-widget-search-result img{aspect-ratio:400/450;height:60%;margin-bottom:12px;margin-left:auto;margin-right:auto;-o-object-fit:contain;object-fit:contain;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-name{-webkit-line-clamp:3;-webkit-box-orient:vertical;color:#0d4884;display:-webkit-box;font-size:1em;font-weight:700;height:4.5em;line-height:1.5em;margin-bottom:8px;max-height:4.5em;min-height:4.5em;overflow:hidden;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-price{color:#404040;font-size:1.833em;font-weight:bolder;line-height:normal;margin-top:auto;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list{-webkit-box-sizing:border-box;box-sizing:border-box;min-width:240px;overflow-y:auto;overscroll-behavior:none;padding-bottom:50px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list-overlay{background-color:rgba(0,0,0,.5);bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:rgba(0,0,0,.067);display:none;-ms-flex-direction:column;flex-direction:column}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet label.abtasty-search-widget-search-sort-label{margin-left:18px;margin-top:18px;white-space:nowrap}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet div.abtasty-search-widget-search-sort-options{-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px;padding:12px 18px}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet button.abtasty-search-widget-search-sort-option{border:1px solid #caced1;border-radius:50rem;padding:.2em .675em;white-space:nowrap}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet button.abtasty-search-widget-search-sort-option.active{background-color:#0c4884;color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#0c4884;border:none;cursor:pointer;display:none;margin-left:auto;padding:8px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button,div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-reset-button{-webkit-box-pack:center;-ms-flex-pack:center;border:2px solid #0c4884;border-radius:8px;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;justify-content:center;margin-left:auto;margin-right:auto;padding:8px;width:85%}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-reset-button{background-color:transparent;color:#0c4884;display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button{background-color:#0c4884;color:#fff;display:none;margin-top:12px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button i.abtasty-search-widget-close-icon{background-color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content{padding-left:18px;padding-right:18px}div.abtasty-search-widget-container button.abtasty-search-widget-search-facet-show-more{background-color:transparent;border:none;color:#0c4884;font-size:14px;font-weight:700;margin-bottom:12px;padding:0;text-decoration:underline}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content.range-facet{margin-bottom:12px;padding-right:18px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-list-item-container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;justify-content:space-between}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-list-item-container div.checkbox{margin:unset}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container{cursor:pointer;display:block;font-size:14px;font-weight:400;line-height:14px;margin-bottom:12px;padding-left:30px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.checked,div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container:hover:not(.disabled){font-weight:700}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.disabled{cursor:not-allowed}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input{cursor:pointer;height:0;opacity:0;position:absolute;width:0}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.disabled input{cursor:not-allowed}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input[type=checkbox]:before{content:none!important}div.abtasty-search-widget-container span.abtasty-search-widget-search-facet-checkbox-checkmark{background-color:transparent;border:1px solid #000;border-radius:4px;height:15px;left:0;position:absolute;top:0;width:15px}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input:checked~span.abtasty-search-widget-search-facet-checkbox-checkmark{background-color:#0c4884;font-weight:700}div.abtasty-search-widget-container span.abtasty-search-widget-search-facet-checkbox-checkmark:after{content:\"\";display:none;position:absolute}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input:checked~span.abtasty-search-widget-search-facet-checkbox-checkmark:after{display:block}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container span.abtasty-search-widget-search-facet-checkbox-checkmark:after{border:solid #fff;border-width:0 2px 2px 0;height:8px;left:4.5px;top:1.5px;-webkit-transform:rotate(45deg);transform:rotate(45deg);width:4px}div.abtasty-search-widget-container li.abtasty-search-widget-search-facet-list-item{margin-bottom:12px;margin-top:12px}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:rgba(0,0,0,.067);cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-size:16px;font-weight:700;justify-content:space-between;padding:13.5px 18px}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary:before{content:none}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary div.abtasty-search-widget-search-facet-arrow:before{content:\"\\276F\"}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary div.abtasty-search-widget-search-facet-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg);-webkit-transform-origin:center;transform-origin:center}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet[open] summary div.abtasty-search-widget-search-facet-arrow{-webkit-transform:rotate(270deg);transform:rotate(270deg)}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content ul{list-style:none}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider{background-color:#e0e0e0;border-radius:5px;height:5px;margin:20px 0;position:relative;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-progress{background-color:#0c4884;border-radius:5px;height:100%;position:absolute;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-handle{background-color:#0c4884;border:2px solid #fff;border-radius:50%;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.2);box-shadow:0 2px 4px rgba(0,0,0,.2);cursor:pointer;height:20px;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:20px;z-index:2}div.abtasty-search-widget-container div.abtasty-search-widget-range-values{-webkit-box-pack:justify;-ms-flex-pack:justify;color:#404040;display:-webkit-box;display:-ms-flexbox;display:flex;font-size:14px;justify-content:space-between;margin-top:10px}div.abtasty-search-widget-container div.abtasty-search-widget-range-values span{font-weight:600}div.abtasty-search-widget-container button.abtasty-search-widget-filters-button{background-color:#fff!important;border:none;border-radius:100%;cursor:pointer!important;display:none;margin-top:12px;padding:11px;-webkit-transform:translateX(-15%);transform:translateX(-15%);vertical-align:middle}div.abtasty-search-widget-container i.abtasty-search-widget-filters-icon{background-color:#0c4884;height:22px;-webkit-mask-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDE4IDE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGw9IiM0OTRjNGUiIGQ9Ik0xNyA1SDFhMSAxIDAgMCAxIDAtMmgxNmExIDEgMCAwIDEgMCAyem0wIDVIMWExIDEgMCAwIDEgMC0yaDE2YTEgMSAwIDAgMSAwIDJ6bTAgNUgxYTEgMSAwIDAgMSAwLTJoMTZhMSAxIDAgMCAxIDAgMnoiLz48L3N2Zz4=\");mask-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDE4IDE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGw9IiM0OTRjNGUiIGQ9Ik0xNyA1SDFhMSAxIDAgMCAxIDAtMmgxNmExIDEgMCAwIDEgMCAyem0wIDVIMWExIDEgMCAwIDEgMC0yaDE2YTEgMSAwIDAgMSAwIDJ6bTAgNUgxYTEgMSAwIDAgMSAwLTJoMTZhMSAxIDAgMCAxIDAgMnoiLz48L3N2Zz4=\");vertical-align:middle;width:22px}@media (max-width:1199.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (max-width:991.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:767.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(2,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-result{height:300px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result img{height:50%}}@media (max-width:575.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container{padding:22.5px}div.abtasty-search-widget-container button.abtasty-search-widget-close-icon-container{-webkit-transform:translateX(15%);transform:translateX(15%)}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list-container{width:100vw}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(1,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet{display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort{display:none}div.abtasty-search-widget-container button.abtasty-search-widget-filters-button,div.abtasty-search-widget-container button.abtasty-search-widget-search-filters-button{display:block}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list{background-color:#fff;bottom:0;left:0;max-height:unset!important;min-width:unset;overflow-x:hidden;position:absolute;top:0;-webkit-transition:.5s;transition:.5s;width:0;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button,div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button{display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list-overlay{display:block}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list.open{width:240px}}@media (max-width:374.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list.open{width:100%}}");return e.appendChild(r),e.textContent+=[a,s,i].join(""),t.insertAdjacentElement("afterbegin",e),t}}(()=>{const{elementReferrer:t}=DATA;return(t=>{const a=(()=>{if(e()||(()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e})())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})(),s=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(a||s){const e=(()=>{const t=(()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`})();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")})();window.console.log(`%c${e} - ${a?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${t}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}})("Widget launch"),(()=>{const t=[{name:DATA.facetTitleFontName,style:DATA.facetTitleFontStyle},{name:DATA.searchBarTitleFontName,style:DATA.searchBarTitleFontStyle},{name:DATA.searchBarInputFontName,style:DATA.searchBarInputFontStyle},{name:DATA.facetSectionTitleFontName,style:DATA.facetSectionTitleFontStyle},{name:DATA.searchResultNameFontName,style:DATA.searchResultNameFontStyle},{name:DATA.searchResultPriceFontName,style:DATA.searchResultPriceFontStyle}];for(const{name:e,style:a}of t){if(!e||"inherit"===e||!/otf|ttf/g.test(a))continue;const t=document.createElement("style"),s=a.match(q)?a.match(q)[1]:"";t.innerHTML=`@font-face { font-family: '${e}_${s}'; src: url('${a}'); font-display: swap; }`,document.head.appendChild(t)}})(),new Promise(s=>{r(t,()=>{const i=a(t),r=i.getRootNode();i.style.position="relative";const n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.right="0",n.style.bottom="0",n.style.backgroundColor="transparent",n.style.cursor="pointer",n.onclick=t=>{t?.preventDefault?.(),t?.stopPropagation?.(),new G({target:i,rootElement:r}).openSearchWidget()},i.appendChild(n),e()&&n.onclick(),s()})})})().then(()=>{})}();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abtasty/search",
3
3
  "description": "Search Widget MVP",
4
- "version": "0.0.2-10",
4
+ "version": "0.0.2-11",
5
5
  "form": "dist/form.js",
6
6
  "main": "dist/main.js",
7
7
  "type": "module",
@@ -44,5 +44,5 @@
44
44
  "rollup": "^4.12.0",
45
45
  "rollup-plugin-postcss": "^4.0.2"
46
46
  },
47
- "stableVersion": "0.0.2-9"
47
+ "stableVersion": "0.0.2-10"
48
48
  }