1const{typeSuggestionsRender,quickLinkRender,textSuggestionsSectionRender,popularSearchItemRender,productRender,plainProductRender,recentSearchItemRender}=window.BAO.TagalysLibrary;class TagalysSearch extends window.BAO.CustomElement(){connectedCallback(){super.connectedCallback()}setupListeners(){super.setupListeners(),onTagalysReady(()=>{this.initialise()})}initialise(){const searchInput=this.els.search.element,widgetResultCache=[],smartWidgetId=this.dataset.smartWidgetId,searchSuggestionSelectors=["#header-search","#desktop-search"],searchSuggestionsConfig={searchResultsURL:window.BAO.TagalysLibrary.getSearchResultsUrl(),callbacks:{beforeAPICall(requestParams,helpers){return window.theme.tagalys=window.theme.tagalys||{},window.theme.tagalys.searchSuggestionsTotal=null,document.querySelector(".tag-SearchSuggestions_Main")?.classList?.add("request-in-progress"),requestParams},onSuccessfulAPICall(response,helpers){window.theme.tagalys=window.theme.tagalys||{};const total=response?.sections?.products?.total_count;return window.theme.tagalys.searchSuggestionsTotal=total??null,document.querySelector(".tag-SearchSuggestions_Main")?.classList?.remove("request-in-progress"),response},onFailedAPICall(response,helpers){document.querySelector(".tag-SearchSuggestions_Main")?.classList?.remove("request-in-progress")}},templates:{quickLinks:{render:quickLinkRender},recentSearchItem:{render:recentSearchItemRender},widget:{callbacks:{afterInitialRender(helpers){const productWrapper=document.querySelector("[data-widget='smart-widget']");if(widgetResultCache.length>0){productWrapper.insertAdjacentHTML("beforeend",widgetResultCache.join(""));return}window.Tagalys.UIWidgets.Recommendations.init("[data-widget='smart-widget']",{recommendationId:smartWidgetId,options:{includeTagalysCSS:!1},callbacks:{onSuccessfulAPICall(response,helpers2){return productWrapper.classList.remove("tagalys-namespace"),productWrapper.removeAttribute("id"),response.products?.forEach((product,index)=>{!product||index>3||widgetResultCache.push(plainProductRender(product))}),productWrapper.insertAdjacentHTML("beforeend",widgetResultCache.join("")),response}},templates:{widget:{render:()=>{}}}})},afterEveryRender(helpers){const searchAside=document.querySelector(".tag-SearchSuggestions_Aside"),resultsLabel=window.BAO.TagalysLibrary.formatResultsWithCount(window.BAO.TagalysLibrary.getSearchResultsCount(helpers));document.querySelectorAll(".tag-ResultTotal").forEach(span=>{span.textContent=resultsLabel}),searchInput.value.length>1&&helpers.hasTextSearchSuggestions()?searchAside.classList.add("has-type-results"):(searchAside.classList.remove("has-type-results"),widgetResultCache.length>0&&(document.querySelector("[data-widget='smart-widget']")?.replaceChildren(),document.querySelector("[data-widget='smart-widget']")?.insertAdjacentHTML("beforeend",widgetResultCache.join(""))))}},options:{sections:{products:{include:["total_count","items"],count:24}},hierarchySeparator:"\u279C",position:!1,minimumCharactersToShowSuggestions:2,maxRecentSearchesCount:5,maxTotalSearchesCount:24,alignToSelector:!1,inheritAlignmentElementWidth:!1,includeTagalysCSS:!1},render(html,args){const helpers=args.props.helpers,recentAndPopularSearches=helpers.getRecentAndPopularSearches();return html` 2 <div class="tag-SearchSuggestions"> 3 <div class="tag-SearchSuggestions_Columns"> 4 <aside class="tag-SearchSuggestions_Aside"> 5 <section class="tag-SearchSuggestions_Results"> 6 <div> 7 <h3 class="tag-SearchSuggestions_Header fz-15_21"> 8 ${window.BAO.Utils.parseHtmlEntities(window.TagalysTranslations?.popular_searches)} 9 </h3> 10 <ul> 11 ${recentAndPopularSearches.popularSearches.slice(0,5).map(popularSearch=>html` 12 <${args.templates.popularSearchItem} 13 popularSearch=${popularSearch} 14 /> 15 `)} 16 </ul> 17 </div> 18 <div> 19 <h3 class="tag-SearchSuggestions_Header fz-15_21"> 20 ${window.BAO.Utils.parseHtmlEntities(window.TagalysTranslations?.recent_searches)} 21 </h3> 22 <ul> 23 ${recentAndPopularSearches.recentSearches.map(recentSearch=>html` 24 <${args.templates.recentSearchItem} 25 recentSearch=${recentSearch} 26 /> 27 `)} 28 </ul> 29 </div> 30 </section> 31 32 <${args.templates.quickLinks} /> 33 </aside> 34 35 <main class="tag-SearchSuggestions_Main"> 36 ${helpers.exceedsMinimumCharactersToShowSuggestions()?html` 37 <${args.templates.typeSuggestions} /> 38 `:html` 39 <p 40 class="fz-15_28 tag-SearchSuggestions_Header-short" 41 > 42 ${window.BAO.Utils.parseHtmlEntities(window.TagalysTranslations?.trending_products)} 43 </p> 44 <ul 45 class="products tag-SearchSuggestions_Products" 46 data-widget="smart-widget" 47 ></ul> 48 `} 49 </main> 50 </div> 51 </div> 52 `}},textSuggestionSection:{render:textSuggestionsSectionRender},product:{render:productRender,options:{productPageUrl:product=>window.BAO.TagalysLibrary.getProductLink(product)}},typeSuggestions:{render:typeSuggestionsRender},products:{render(html,args){const props=args.props,products=props.helpers.getProducts();return html` 53 <div class=${`products ${props.className}`}> 54 ${products.map((product,index)=>window.innerWidth<=900&&index>=window.tagalysConfiguration.settings.suggestionsLimitMobile||window.innerWidth>900&&index>=window.tagalysConfiguration.settings.suggestionsLimitDesktop?!1:html` 55 <${args.templates.product} 56 key=${index} 57 product=${product} 58 /> 59 `)} 60 </div> 61 `}},popularSearchItem:{render:popularSearchItemRender}}};window.Tagalys.UIWidgets.SearchSuggestions.init(searchSuggestionSelectors,{...searchSuggestionsConfig,failover:()=>{if(!this.hasFailedOverToShopify)return this.hasFailedOverToShopify=!0,window.Tagalys.UIWidgets.ShopifySearchSuggestions.init(searchSuggestionSelectors,searchSuggestionsConfig)}})}}customElements.get("tagalys-search")||customElements.define("tagalys-search",TagalysSearch); 62//# sourceMappingURL=/cdn/shop/t/532/assets/tagalys-search.js.map?v=159520121438464855361789480011
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.