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