@abtasty/search 0.0.2-5 → 0.0.2-7
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 +1 -1
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),t=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),a=(e,a)=>{const s=document.querySelector("body")||document.documentElement,i={childList:!0,subtree:!0,attributes:!0},r=()=>n.disconnect(),n=new MutationObserver(()=>{const s=t(a);return s&&!r()&&e(s)});return{clear:r,observe:(e=s)=>n.observe(e,i)}},s=()=>{},i=(r,n)=>{const c=t(r),o={selector:r,clear:s,observe:s};if(c)return setTimeout(()=>n(c),0),o;if(e())return setTimeout(()=>i(r,n),1e3),o;if(r.includes("[]"))return((e,s)=>{const[i,r]=s.split("[]").map(e=>e.trim()),n=t(i),c=n?.[r],{clear:o,observe:l}=a(e,s),h=()=>{const a=t(s);return a&&!d()&&e(a)},d=()=>{o(),n?.removeEventListener("load",h)},u=()=>{l(c),"iframe"===n?.localName&&n.addEventListener("load",h)};return u(),{selector:s,clear:d,observe:u}})(n,r);const{clear:l,observe:h}=a(n,r);return h(),{selector:r,clear:l,observe:h}};let r;const n=`https://ms-839f1388554f-19719.fra.meilisearch.io/indexes/${DATA.meilisearchIndex||(()=>{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})()}/search`,c=["hasbro","lego","mattel"],o={"Content-Type":"application/json",Authorization:"Bearer 1b3d6acfb9eac2780cd20a30ce8728a565960d213b0729b01d9b5e9fdcd3f77b"};function l(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 h(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach(function(t){d(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function d(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 u=e=>{for(;e.firstChild;)e.removeChild(e.lastChild)},g=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]=h(h({},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]=h(h({},i),{},{min:e[s].values.min,max:e[s].values.max})),e},h({},t))};class b{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 p(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 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 f=(()=>{const e={results:[],facets:{},selectedFacets:{}};return function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?p(Object(a),!0).forEach(function(t){m(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}({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 c.some(e=>a.includes(e))&&!c.some(e=>s.includes(e))?-1:c.some(e=>s.includes(e))&&!c.some(e=>a.includes(e))?1:0})(e.name,t.name)).filter(e=>e.link&&e.img_link&&e.price)],this.logState("addResults")},setFacets(t){e.facets=t,this.logState("setFacets")},addRangeToSelectedFacets(t,a){e.selectedFacets[t]={type:a.type,values:a.values}},addToSelectedFacets(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("addToSelectedFacets")},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=g(t,e.selectedFacets,!0);e.selectedFacets=a,this.logState("updateSelectedFacets")},updateFacets(t){e.facets=g(t,e.facets,!0),this.logState("updateFacets")},setSelectedFacets(t){e.selectedFacets=t,this.logState("setSelectedFacets")},clearResults(){e.results=[],this.logState("clearResults")}})})();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,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 v=function(){const e={text:"",filters:{},page:0,totalPages:0};return function(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){w(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}({get state(){return e}},{logState(e){},setText(t){e.text=t,this.logState("setText")},setPage(t){e.page=t,this.logState("setPage")},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")},setTotalPages(t){e.totalPages=t,this.logState("setTotalPages")}})}();class x{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");i.className=`${this.baseClassName}-range-values`;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 c=!1,o=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}},u=e=>{e.preventDefault(),c=!0,o=e.target,l=e.clientX,h=parseFloat(o.style.left)},g=i=>{if(!c)return;i.preventDefault();const r=i.clientX-l,n=e.offsetWidth;let u=h+r/n*100;u=o===a?Math.max(0,Math.min(u,parseFloat(s.style.left))):Math.max(parseFloat(a.style.left),Math.min(u,100)),u=.8*Math.round(u/.8),o.style.left=`${u}%`,(()=>{const e=parseFloat(a.style.left),i=parseFloat(s.style.left);t.style.left=`${e}%`,t.style.width=i-e+"%"})(),d()},b=()=>{if(!c)return;c=!1,o=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",u),document.addEventListener("mousemove",g),document.addEventListener("mouseup",b)}),{rangeContainer:e,valuesContainer:i}}}class C{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.appendChild(this.facetContentContainers.facetContainer)}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">▼</div>\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 k extends C{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:c}=this.getFacetContainers();this.facetContent=n,this.facetContainer=c,this.onFiltersChange=r,this.filterRange=new x({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(this.facet.title,null,e)}})}createFacetContent(){const{rangeContainer:e,valuesContainer:t}=this.filterRange.render();this.facetContent.append(e,t)}updateFacetContent(){u(this.facetContent),this.filterRange=new x({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(this.facet.title,null,e)}}),this.createFacetContent()}updateFacet(e){this.facet=e,this.updateFacetContent()}}class S extends C{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:c}=this.getFacetContainers();this.facetContent=n,this.facetContainer=c,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=(v.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 c=document.createElement("input");return c.disabled=!i&&0===a,c.checked=i,c.type="checkbox",c.onclick=()=>{const e=c.checked;this.onFiltersChange(this.facet.title,t,{checked:e})},r.appendChild(c),r.appendChild(n),s.appendChild(r),s}updateFacetContent(){u(this.facetList),this.createFacetContent()}updateFacet(e){this.facet={title:this.facet.title,type:this.facet.type,values:e.values},this.showAll=!1,this.updateFacetContent()}}class F{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()}getFacetsListContainer(){const e=document.createElement("div");e.className=`${this.baseClassName}-search-facets-list`;const t=this.searchBar.getCurrentSearchBarContainerHeight();return e.style.maxHeight=`calc(100vh - ${t||0}px)`,e}renderFacets(e){u(this.facetsListContainer),this.facets=[];for(const[t,a]of Object.entries(e)){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?k:S)(e);this.facets.push(s)}this.facets.forEach(e=>{e.createFacetContent()}),this.baseContainer.appendChild(this.facetsListContainer)}updateFacets(e){this.facets.filter(e=>e instanceof S).forEach(t=>{t.updateFacet(e[t.id])})}}class N{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 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 L{hasTriggeredSeeMore=!1;constructor(e){let{baseContainer:t,baseClassName:a,searchBar:s,onFiltersChange:i,onSeeMore:r}=e;this.baseContainer=t,this.baseClassName=a,this.searchBar=s,this.onFiltersChange=i,this.onSeeMore=r,this.searchResultsContainer=this.getSearchResultsContainerElement(),this.searchResultsList=this.getSearchResultsListElement(),this.facetsList=new F({searchBar:this.searchBar,baseContainer:this.searchResultsContainer,baseClassName:this.baseClassName,onFiltersChange:this.onFiltersChange}),this.searchResultsContainer.appendChild(this.searchResultsList)}clearSearchResults(){u(this.searchResultsList),u(this.searchResultsContainer),this.searchResultsContainer.classList.remove("visible","no-results")}getSearchResultsContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-results-container`,e}getSearchResultsListElement(){const e=document.createElement("div");e.className=`${this.baseClassName}-search-results`;const t=this.searchBar.getCurrentSearchBarContainerHeight();return e.style.maxHeight=`calc(100vh - ${t||0}px)`,e.addEventListener("scroll",e=>{!this.hasTriggeredSeeMore&&e.target.scrollTop+e.target.clientHeight>=e.target.scrollHeight-500&&v.state.page<v.state.totalPages&&(this.hasTriggeredSeeMore=!0,this.onSeeMore())}),e}updateFacets(e){this.facetsList.updateFacets(e)}updateSearchResults(e){if(u(this.searchResultsList),this.searchResultsList.classList.remove("no-results"),e.length)for(const[t,a]of e.entries()){const e=new N({result:a,index:t,searchResultsContainer:this.searchResultsList,baseClassName:this.baseClassName});this.searchResultsList.appendChild(e.getSearchResultElement())}else{const e=document.createElement("div");e.className=`${this.baseClassName}-search-no-result`,e.innerHTML="No results found",this.searchResultsList.classList.add("no-results"),this.searchResultsList.appendChild(e)}this.hasTriggeredSeeMore=!1}renderSearchResults(e,t){if(this.baseContainer.classList.add("search-completed"),this.clearSearchResults(),e.length){this.facetsList.renderFacets(t);for(const[t,a]of e.entries()){const e=new N({result:a,index:t,searchResultsContainer:this.searchResultsList,baseClassName:this.baseClassName});this.searchResultsList.appendChild(e.getSearchResultElement())}this.searchResultsContainer.appendChild(this.searchResultsList)}else{const e=document.createElement("div");e.className=`${this.baseClassName}-search-no-result`,e.innerHTML="No results found",this.searchResultsContainer.classList.add("no-results"),this.searchResultsContainer.appendChild(e)}this.searchResultsContainer.classList.add("visible"),this.baseContainer.appendChild(this.searchResultsContainer),this.hasTriggeredSeeMore=!1}}const R=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 ")},E=e=>{let{search:t,filters:a,maxPerPage:s,page:i}=e;return JSON.stringify({q:t,filter:R(a),facets:["*"],hitsPerPage:s,page:i+1})},T=e=>({hits:e.hits.map(e=>({name:e.title,img_link:e.img_link,link:e.link,price:e.price,category:e.category,brand:e.brand})),facets:function(e){const{facetDistribution:t,facetStats:a}=e;let s={};for(const e in t)if(a&&a[e])s[e]={type:"range",values:{min:a[e].min,max:a[e].max}};else{if(0===Object.entries(t[e]).length)continue;s[e]={type:"list",values:Object.entries(t[e])}}return s}(e),page:e.page,totalPages:e.totalPages}),$=e=>fetch(n,{method:"POST",headers:o,body:E(e)}),B=/.+\/([^.]+)\.(otf|ttf)$/,P=(e,t)=>e&&"inherit"!==e?`font-family:${e}_${t.match(B)?t.match(B)[1]:""};`:t||"";class j{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 b({baseContainer:this.searchWidgetContainer,baseClassName:this.baseClassName,target:this.target,onInput:this.onInput.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)})}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.insertIn(e,"afterbegin"),this.searchBar.focusInput(),i("body",()=>{const{body:e}=document;r=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"}),this.searchOpen=!0}closeSearchWidget(){this.remove(),this.rootElement.querySelector("body"),i("body",()=>{const{body:e}=document;r&&(e.style.overflowY=r)})}onFiltersChange=(e,t,a)=>{"price"===e?this.onRangeChange(e,a.min,a.max):this.onListCheckboxChange(e,t,a.checked)};onRangeChange=async(e,t,a)=>{v.resetPagination(),f.clearResults(),v.updateRangeFilter(e,t,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n}=s,c=r[e]?.values;f.addResults(i),r.price&&delete r.price,f.updateFacets(r),f.addRangeToSelectedFacets(e,{type:"range",values:c||{min:t,max:a}}),v.setTotalPages(n),this.searchResultsList.updateSearchResults(f.state.results),this.searchResultsList.updateFacets(f.state.facets)};onListCheckboxChange=async(e,t,a)=>{v.resetPagination(),f.clearResults(),v.updateFilterArray(e,t,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n}=s,c=r[e]?.values.find(e=>{let[a]=e;return a===t});f.addResults(i);for(const e in r)"list"!==e.type&&delete r[e];f.updateFacets(r),a?f.addToSelectedFacets(e,{type:"list",values:c||[t,0]}):f.removeSelectedFacet(e,t),v.setTotalPages(n),this.searchResultsList.updateSearchResults(f.state.results),this.searchResultsList.updateFacets(f.state.facets)};onInput=e=>{v.setText(e.target.value),f.clearResults(),e.target.value.length?((Object.keys(v.state.filters).length||v.state.page>0)&&v.resetFiltersAndPagination(),this.debouncedSearch()):(this.searchWidgetContainer.classList.remove("search-completed"),this.searchResultsList.clearSearchResults())};onSeeMore=async()=>{v.setPage(v.state.page+1);const e=await this.onSearchWithFilters();if(!e)return;const{results:t,totalPages:a}=e;f.addResults(t),v.setTotalPages(a),this.searchResultsList.updateSearchResults(f.state.results)};async onSearchWithFilters(){const{text:e,filters:t,page:a}=v.state;return e?$({search:e,filters:t,maxPerPage:50,page:a}).then(e=>e.json()).then(e=>T(e)).then(e=>{const{hits:t,facets:a,totalPages:s,page:i}=e;return{results:t,facets:a,totalPages:s,page:i}}).catch(e=>(window.console.error(e),null)):(this.searchWidgetContainer.classList.remove("search-completed"),null)}onSearch=()=>{const{text:e,page:t}=v.state;e?$({search:e,maxPerPage:50,page:t}).then(e=>e.json()).then(e=>T(e)).then(e=>{const{hits:t,facets:a}=e;f.addResults(t),f.setFacets(a),v.setTotalPages(e.totalPages),this.searchResultsList.renderSearchResults(f.state.results,a)}).catch(e=>{window.console.error(e)}):this.searchWidgetContainer.classList.remove("search-completed")};debouncedSearch=(()=>(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.onSearch.bind(this)))();getSearchWidgetContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-container`,e.insertAdjacentElement("afterbegin",(e=>{const t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),t})(`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-results-container{display:none}div.abtasty-search-widget-container div.abtasty-search-widget-search-results-container.visible{display:grid;grid-template-columns:240px 1fr}div.abtasty-search-widget-container div.abtasty-search-widget-search-results-container.visible.no-results{grid-template-columns:1fr}div.abtasty-search-widget-container div.abtasty-search-widget-search-results{-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;overflow-y:auto;padding:16px 16px 350px 8px}div.abtasty-search-widget-container div.abtasty-search-widget-search-results.no-results{display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-results-container.visible div.abtasty-search-widget-search-results{grid-template-columns:1fr 1fr 1fr 1fr 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:100%}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{overflow-y:auto;padding-bottom:350px;padding-right:10px}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{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:normal;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 span.abtasty-search-widget-search-facet-arrow{font-size:14px}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet[open] summary span.abtasty-search-widget-search-facet-arrow{-webkit-transform:rotate(180deg);transform:rotate(180deg);-webkit-transform-origin:center;transform-origin:center}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content ul{list-style:none}@media (max-width:1199.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-results-container.visible div.abtasty-search-widget-search-results{grid-template-columns:1fr 1fr 1fr 1fr}}@media (max-width:991.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-results-container.visible div.abtasty-search-widget-search-results{grid-template-columns:1fr 1fr 1fr}}@media (max-width:767.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-results-container.visible div.abtasty-search-widget-search-results{grid-template-columns:1fr 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-results-container.visible div.abtasty-search-widget-search-results{grid-template-columns:1fr}}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider{background:#e0e0e0;border-radius:5px;height:5px;margin:20px 0;padding-right:18px;position:relative;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-progress{background:#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:#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} ${(()=>{(()=>{const e=[{name:DATA.facetTitleFontName,style:DATA.facetTitleFontStyle},{name:DATA.searchBarTitleFontName,style:DATA.searchBarTitleFontStyle},{name:DATA.searchBarInputFontName,style:DATA.searchBarInputFontStyle}];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(B)?a.match(B)[1]:"";e.innerHTML=`@font-face { font-family: '${t}_${s}'; src: url('${a}'); font-display: swap; }`,document.head.appendChild(e)}})();const{backgroundColor:e,facetTitleAlign:t,facetTitleFontName:a,facetTitleFontSize:s,facetTitleFontStyle:i,facetTitleTextColor:r,searchBarTitleAlign:n,searchBarTitleFontName:c,searchBarTitleFontSize:o,searchBarTitleFontStyle:l,searchBarInputAlign:h,searchBarInputFontName:d,searchBarInputFontSize:u,searchBarInputFontStyle:g,searchBarTitleTextColor:b,searchBarInputTextColor:p}=DATA;return`\n div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container {\n background-color: ${e};\n }\n div.abtasty-search-widget-container i.abtasty-search-widget-close-icon {\n background-color: ${e};\n }\n div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary {\n text-align: ${t};\n ${P(a,i)};\n font-size: ${s}px;\n color: ${r};\n }\n div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label {\n text-align: ${n};\n ${P(c,l)};\n font-size: ${o}px;\n color: ${b};\n div.abtasty-search-widget-container input.abtasty-search-widget-search-input {\n text-align: ${h};\n ${P(d,g)};\n font-size: ${u}px;\n color: ${p};\n `})()}`)),e}}(()=>{const{elementReferrer:t}=DATA;(t=>{const a=(()=>{if(e()||(()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t})())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 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${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"),new Promise(a=>{i(t,t=>{const s=t.getRootNode();t.style.position="relative";const i=document.createElement("div");i.style.position="absolute",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.backgroundColor="transparent",i.style.cursor="pointer";const r=new j({target:t,rootElement:s});i.onclick=e=>{e.preventDefault(),e.stopPropagation(),r.openSearchWidget()},t.appendChild(i),e()&&r.openSearchWidget(),a()})})})()}();
|
|
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)},u=()=>{l(o),"iframe"===n?.localName&&n.addEventListener("load",h)};return u(),{selector:t,clear:d,observe:u}})(n,e);const{clear:l,observe:h}=s(n,e);return h(),{selector:e,clear:l,observe:h}},n="https://ms-839f1388554f-19719.fra.meilisearch.io",o=`${n}/indexes/${DATA.meilisearchIndex||e()}`,c=`${o}/search`,l=`${n}/multi-search`,h=`${o}/settings/sortable-attributes`,d=["hasbro","lego","mattel"],u={"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 p(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){b(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 b(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)},f=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]=p(p({},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]=p(p({},i),{},{min:e[s].values.min,max:e[s].values.max})),e},p({},t))};class y{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 w(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 v(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?w(Object(a),!0).forEach(function(t){x(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):w(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function x(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 C={text:"",filters:{},sort:[],page:0,totalPages:0,totalHits:0},S=function(){let e=v({},C);return v({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=v({},C),this.logState("reset")}})}();class k{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}},u=e=>{e.preventDefault(),o=!0,c=e.target,l=e.clientX,h=parseFloat(c.style.left)},g=i=>{if(!o)return;i.preventDefault();const r=i.clientX-l,n=e.offsetWidth;let u=h+r/n*100;u=c===a?Math.max(0,Math.min(u,parseFloat(s.style.left))):Math.max(parseFloat(a.style.left),Math.min(u,100)),u=.8*Math.round(u/.8),c.style.left=`${u}%`,(()=>{const e=parseFloat(a.style.left),i=parseFloat(s.style.left);t.style.left=`${e}%`,t.style.width=i-e+"%"})(),d()},p=()=>{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",u),document.addEventListener("mousemove",g),document.addEventListener("mouseup",p)}),{rangeContainer:e,valuesContainer:i}}}class F{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.appendChild(this.facetContentContainers.facetContainer)}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 E extends F{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 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: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 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: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 L extends F{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=(S.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");return e.className=`${this.baseClassName}-search-facets-list`,e}renderFacets(e){m(this.facetsListContainer),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?E:L)(e);this.facets.push(s)}this.facets.forEach(e=>{e.createFacetContent()}),this.baseContainer.appendChild(this.facetsListContainer)}updateRangeFacets(e){this.facets.filter(e=>e instanceof E).forEach(t=>{t.updateFacet(e[t.id])})}updateListFacets(e){this.facets.filter(e=>e instanceof L).forEach(t=>{t.updateFacet(e[t.id])})}updateFacets(e){this.updateRangeFacets(e),this.updateListFacets(e)}}class T{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}}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 O(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){$(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 $(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 P={results:[],facets:{},selectedFacets:{}},j=(()=>{let e=O({},P);return O({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 d.some(e=>a.includes(e))&&!d.some(e=>s.includes(e))?-1:d.some(e=>s.includes(e))&&!d.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=f(t,e.selectedFacets,!0);e.selectedFacets=a,this.logState("updateSelectedFacets")},updateFacets(t){e.facets=f(t,e.facets,!0),this.logState("updateFacets")},setSelectedFacets(t){e.selectedFacets=t,this.logState("setSelectedFacets")},clearResults(){e.results=[],this.logState("clearResults")},reset(){e=O({},P),this.logState("reset")}})})();function A(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?A(Object(a),!0).forEach(function(t){H(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):A(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function H(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 I=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 ")},M=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},D=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})),z=e=>{let{text:t,filters:a,sort:s,page:i}=e;return JSON.stringify({q:t,filter:I(a),facets:["*"],hitsPerPage:50,page:i+1,sort:s||[]})},W=e=>({hits:D(e.hits),facets:M(e),page:e.page,totalPages:e.totalPages,totalHits:e.totalHits});class _{constructor(e){let{baseClassName:t,sortOptions:a,infos:s,onSortChange:i}=e;this.baseClassName=t,this.onSortChange=i,this.sortOptions=a,this.infos=s,this.infosElement=this.getInfosElement(),this.sortLabelElement=this.getSortLabelElement(),this.sortSelectElement=this.getSortSelectElement(),this.sortElement=this.getSortElement(),this.infosAndSortContainer=this.getInfoAndSortContainerElement(),this.infosAndSortContainer.appendChild(this.infosElement),this.infosAndSortContainer.appendChild(this.sortElement),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.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}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)}}async getSortableAttributesAndUpdateOptions(){const e=await(async()=>await fetch(h,{method:"GET",headers:u}))(),t=await e.json();t&&this.updateSortOptions(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 q{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 _({baseClassName:this.baseClassName,infos:{totalHits:S.state.totalHits},sortOptions:this.sortOptions,onSortChange:this.onSortChange}),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}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&&S.state.page<S.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:S.state.totalHits}),e.length)for(const[t,a]of e.entries()){const e=new T({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:S.state.totalHits}),e.length){this.facetsList.renderFacets(t);for(const[t,a]of e.entries()){const e=new T({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}}const U=/.+\/([^.]+)\.(otf|ttf)$/,V=(e,t)=>e&&"inherit"!==e?`font-family:${e}_${t.match(U)?t.match(U)[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 y({baseContainer:this.searchWidgetContainer,baseClassName:this.baseClassName,target:this.target,onInput:this.debouncedOnInput.bind(this),closeSearchWidget:this.closeSearchWidget.bind(this)}),this.searchResultsList=new q({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=>{S.setPage(0),j.clearResults(),S.setSort(e),this.searchResultsList.scrollToTop();const t=await(async()=>{const e=await fetch(c,{method:"POST",headers:u,body:z(S.state)}),t=await e.json();return{results:W(t).hits}})();if(!t)return;const{results:a}=t;j.addResults(a),this.searchResultsList.updateSearchResults(j.state.results)};onRangeChange=async(e,t,a)=>{S.resetPagination(),j.clearResults(),S.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}}),S.setTotalPages(n),S.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.updateListFacets(j.state.facets)};onListCheckboxChange=async(e,t,a)=>{S.resetPagination(),j.clearResults(),S.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);S.setTotalPages(n),S.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.updateFacets(j.state.facets)};onInput=e=>{S.setText(e.target.value),e.target.value.length?((Object.keys(S.state.filters).length||S.state.page>0)&&S.resetFiltersAndPagination(),this.onSearch()):(this.searchWidgetContainer.classList.remove("search-completed"),this.searchResultsList.clearSearchResults())};onSeeMore=async()=>{S.setPage(S.state.page+1);const e=await(async()=>{try{const e=await fetch(c,{method:"POST",headers:u,body:z(S.state)}),t=await e.json(),a=W(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),S.setTotalPages(a),this.searchResultsList.updateSearchResults(j.state.results)};async onSearchWithFilters(){const{text:t}=S.state;return this.searchResultsList.scrollToTop(),t?await(async()=>{const t=(e=>{const t=[],{text:a,filters:s,page:i,sort:r}=S.state;return t.push({indexUid:e,q:a,filter:I(s),hitsPerPage:50,page:i+1,sort:r||[]}),Object.entries(j.state.facets).forEach(i=>{let[r]=i;const n=B({},s);delete n[r],t.push({indexUid:e,q:a,filter:I(n),facets:[r],hitsPerPage:0})}),JSON.stringify({queries:t})})(DATA.meilisearchIndex||e());try{const e=await fetch(l,{method:"POST",headers:u,body:t}),a=(e=>{const{results:t}=e,a=t.slice(1).reduce((e,t)=>{const a=M(t);return B(B({},e),a)},{});return{hits:D(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}=S.state;if(j.clearResults(),this.searchResultsList.scrollToTop(),e)try{const e=await(async()=>{try{const e=await fetch(c,{method:"POST",headers:u,body:z(S.state)}),t=await e.json(),a=W(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),S.setTotalPages(s),S.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",(e=>{const t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),t})(`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{display:grid;grid-template-columns:240px 1fr}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible.no-results{grid-template-columns:1fr}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;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 6em .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-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{overflow-y:auto;overscroll-behavior:none;padding-bottom:50px}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:normal;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:#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:#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:#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}@media (max-width:1199.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list.visible div.abtasty-search-widget-search-results{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (max-width:991.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list.visible div.abtasty-search-widget-search-results{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:767.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list.visible div.abtasty-search-widget-search-results{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-list.visible div.abtasty-search-widget-search-results{grid-template-columns:repeat(1,minmax(0,1fr))}} ${(()=>{const{backgroundColor:e,facetTitleAlign:t,facetTitleFontName:a,facetTitleFontSize:s,facetTitleFontStyle:i,facetTitleTextColor:r,searchBarTitleAlign:n,searchBarTitleFontName:o,searchBarTitleFontSize:c,searchBarTitleFontStyle:l,searchBarInputAlign:h,searchBarInputFontName:d,searchBarInputFontSize:u,searchBarInputFontStyle:g,searchBarTitleTextColor:p,searchBarInputTextColor:b}=DATA;return`\n div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container {\n\t\tbackground-color: ${e};\n }\n div.abtasty-search-widget-container i.abtasty-search-widget-close-icon {\n background-color: ${e};\n }\n div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary {\n text-align: ${t};\n ${V(a,i)};\n font-size: ${s}px;\n color: ${r};\n }\n div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label {\n text-align: ${n};\n ${V(o,l)};\n font-size: ${c}px;\n color: ${p};\n div.abtasty-search-widget-container input.abtasty-search-widget-search-input {\n text-align: ${h};\n ${V(d,g)};\n font-size: ${u}px;\n color: ${b};\n `})()}`)),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}];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(U)?a.match(U)[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(()=>{})}();
|
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-
|
|
4
|
+
"version": "0.0.2-7",
|
|
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-
|
|
47
|
+
"stableVersion": "0.0.2-6"
|
|
48
48
|
}
|