1(function(){var __snippets__={};(function(){for(var element=document.getElementById("snippets-script"),attribute=element?element.getAttribute("data-snippets"):"",snippets=attribute.split(",").filter(Boolean),i=0;i<snippets.length;i++)__snippets__[snippets[i]]=!0})(),(function(){if(!(!__snippets__["bp-card-swatches"]&&!Shopify.designMode))try{(function(){function preload(sw){if(!(!sw||sw.__bpHovered)){sw.__bpHovered=!0;var url=sw.dataset.bpCardSwatchHover;if(url){var p=new Image;p.src=url}}}document.addEventListener("mouseover",function(e){preload(e.target.closest("[data-bp-card-swatch-hover]"))},{passive:!0}),document.addEventListener("focusin",function(e){preload(e.target.closest("[data-bp-card-swatch-hover]"))});function activeSwatchColor(card){var a=card.querySelector('[data-bp-card-swatch-image].bp-card__swatch--active, [data-bp-card-swatch-image][aria-current="true"]')||card.querySelector("[data-bp-card-swatch-image]");return a?(a.getAttribute("aria-label")||"").trim():""}function stripTrailingColor(title,color){if(!title||!color)return title;var c=color.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),out=title.replace(new RegExp("\\s*[-\\u2013\\u2014/]?\\s*"+c+"\\s*$","i"),"").trim();return out||title}function cleanCardTitle(card){if(card){var link=card.querySelector(".bp-card__title a, .bp-card__title");if(link){var color=activeSwatchColor(card);if(color){var text=(link.textContent||"").trim(),clean=stripTrailingColor(text,color);clean!==text&&(link.textContent=clean)}}}}function cleanAllCardTitles(){for(var cards=document.querySelectorAll(".bp-card"),i=0;i<cards.length;i++)cleanCardTitle(cards[i])}document.addEventListener("click",function(e){var swatch=e.target.closest("[data-bp-card-swatch-image]");if(swatch){e.preventDefault(),e.stopPropagation();var card=swatch.closest(".bp-card");if(card){card.querySelectorAll("[data-bp-card-swatch-image]").forEach(function(s){s.classList.remove("bp-card__swatch--active"),s.removeAttribute("aria-current")}),swatch.classList.add("bp-card__swatch--active"),swatch.setAttribute("aria-current","true");var imgUrl=swatch.dataset.bpCardSwatchImage,img=card.querySelector("[data-bp-card-image-primary]");img&&imgUrl&&(img.src=imgUrl,img.removeAttribute("srcset"));var hoverUrl=swatch.dataset.bpCardSwatchHover,hoverImg=card.querySelector("[data-bp-card-image-secondary]");if(hoverImg&&hoverUrl){var preload2=new Image;preload2.onload=function(){hoverImg.src=hoverUrl,hoverImg.removeAttribute("srcset")},preload2.src=hoverUrl}var price=swatch.dataset.bpSwatchPrice,compare=swatch.dataset.bpSwatchCompare,priceEl=card.querySelector(".bp-card__price, [data-bp-card-price]"),compareEl=card.querySelector(".bp-card__compare, [data-bp-card-compare]");priceEl&&price&&(priceEl.textContent=price),compareEl&&(compare?(compareEl.textContent=compare,compareEl.hidden=!1):compareEl.hidden=!0);var siblingUrl=swatch.dataset.bpVariantUrl;siblingUrl&&card.querySelectorAll("a.bp-card__media-link, .bp-card__title a, [data-bp-card-product-link]").forEach(function(a){a.href=siblingUrl});var swatchColor=swatch.dataset.bpCardSwatchColor||swatch.getAttribute("aria-label")||"";if(swatchColor){var nameEl=card.querySelector("[data-bp-card-color-name]");nameEl&&(nameEl.textContent=swatchColor,nameEl.hidden=!1)}cleanCardTitle(card)}}},!0);var cleanTimer=null;function scheduleClean(){cleanTimer||(cleanTimer=setTimeout(function(){cleanTimer=null,cleanAllCardTitles()},80))}document.readyState!=="loading"?cleanAllCardTitles():document.addEventListener("DOMContentLoaded",cleanAllCardTitles),window.MutationObserver&&new MutationObserver(scheduleClean).observe(document.documentElement,{childList:!0,subtree:!0})})()}catch(e){console.error(e)}})(),(function(){if(!(!__snippets__["bp-search-drawer"]&&!Shopify.designMode))try{window.bpBr=window.bpBr||{},Object.assign(window.bpBr,{uid(){const m=document.cookie.match(/(?:^|;\s*)_br_uid_2=([^;]+)/);if(!m)return"";try{return decodeURIComponent(m[1])}catch{return m[1]}},reqId(){return"br_"+Math.floor(Math.random()*1e10)},config(){return window.shop?.br??{}},formatPrice(value){return value==null||value===""?"":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(Number(value)).replace(/\.00$/,"")},esc(str){return String(str??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},handleize(s){return String(s??"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")},matchColor(handle,colors){if(!handle||!Array.isArray(colors)||!colors.length)return"";for(let i=0;i<colors.length;i++){const ch=window.bpBr.handleize(colors[i]);if(ch&&handle.length>
1ch.length+1&&handle.slice(-(ch.length+1))==="-"+ch)return colors[i]}return""},stripTitleColor(title,handle,colors){const color=window.bpBr.matchColor(handle,colors);if(!title||!color)return title;const c=String(color).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),re=new RegExp("\\s*[-\\u2013\\u2014]?\\s*"+c+"\\s*$","i");return String(title).replace(re,"").trim()||title},skuFromImage(url){const clean=String(url||"").split(/[?#]/)[0],token=clean.slice(clean.lastIndexOf("/")+1).split(/[_.]/)[0].toUpperCase();return/^\d[A-Z]{2}\d{4}$/.test(token)?token:""},sameOriginUrl(u){if(u=String(u||""),!u||u[0]==="/"||u[0]==="#")return u||"#";const m=u.match(/^https?:\/\/[^/]+(\/.*)?$/i);return m?m[1]||"/":u},productCard(p){const _sale=p.sale_price!=null?Number(p.sale_price):null,_list=p.price!=null?Number(p.price):null,_validSale=_sale!=null&&!isNaN(_sale)&&_sale>0,_validList=_list!=null&&!isNaN(_list)&&_list>0,hasSale=_validSale&&_validList&&_sale<_list-.001,priceOut=hasSale?_sale:_validList?_list:_validSale?_sale:null,compareOut=hasSale?_list:null,esc=window.bpBr.esc,fmt=window.bpBr.formatPrice,url=window.bpBr.sameOriginUrl(p.url),_handle=(String(url).match(/\/products\/([^/?#]+)/)||[])[1]||"",cardName=window.bpBr.stripTitleColor?window.bpBr.stripTitleColor(p.title,_handle,p.colors):p.title,brand=(p.brand||"").trim(),eyebrow=brand&&brand.toLowerCase()!=="boston proper"?`<p class="bp-card__collection">Brands We Love: ${esc(brand)}</p>`:"",img=p.thumb_image?`<img 2 class="bp-card__image bp-card__image--primary" 3 src="${esc(p.thumb_image)}" 4 alt="${esc(p.title)}" 5 loading="lazy" 6 data-bp-card-image-primary 7 >`:"",trackJson=esc(JSON.stringify({id:p.pid,title:p.title,vendor:brand||"Boston Proper",handle:(String(url).match(/\/products\/([^/?#]+)/)||[])[1]||"",url,image:p.thumb_image||"",sku:p.sku||"",category:p.category||"",selected_variant:{price:priceOut,compare_at_price:compareOut}}));return`<product-card class="bp-card-host"> 8 <article class="bp-card" data-product-id="${esc(p.pid)}" data-product-url="${esc(url)}" data-bp-track-product='${trackJson}'> 9 <div class="bp-card__media"> 10 <a class="bp-card__media-link" href="${esc(url)}" aria-label="${esc(p.title)}" ref="productCardLink"> 11 ${img} 12 </a> 13 <div class="bp-card__badges" data-bp-card-badges></div> 14 </div> 15 <div class="bp-card__body"> 16 ${eyebrow} 17 <h3 class="bp-card__title"> 18 <a href="${esc(url)}">${esc(cardName)}</a> 19 </h3> 20 <div class="bp-card__price-row"> 21 <span class="bp-card__price">${priceOut!=null?fmt(priceOut):""}</span> 22 <s class="bp-card__compare"${compareOut!=null?"":" hidden"}>${compareOut!=null?fmt(compareOut):""}</s> 23 </div> 24 ${window.bpBr.swatches(p.colors)} 25 </div> 26 </article> 27 </product-card>`},swatches(colors){if(!Array.isArray(colors)||!colors.length)return"";const esc=window.bpBr.esc,LIMIT=8,items=[...new Set(colors)].slice(0,LIMIT).map(c=>{const css=String(c).toLowerCase().replace(/[^a-z]/g,"");return`<li class="bp-card__swatch-item"><span class="bp-card__swatch-img" 28 style="background-color:${esc(css)};" role="img" aria-label="${esc(c)}" title="${esc(c)}"></span></li>`}).join(""),overflow=colors.length>LIMIT?`<li class="bp-card__swatch-more" aria-hidden="true">+${colors.length-LIMIT}</li>`:"";return`<ul class="bp-card__swatches" role="list" aria-label="Available colors">${items}${overflow}</ul>`},suggestProduct(s){const u=String(s.url||""),m=u.match(/\/products\/[^#]*/);return{pid:s.pid,title:s.title||"",url:m?m[0]:u||"#",thumb_image:s.thumb_image||"",price:s.sale_price!=null?s.sale_price:s.price,sale_price:null,brand:s.brand||"",colors:Array.isArray(s.colors)?s.colors:[]}},fetchSearch(q,{rows=24,start=0,viewId=""}={}){const{accountId,host,domainKey,authKey}=window.bpBr.config();if(!accountId||!domainKey)return Promise.reject(new Error("br-config"));const params=new URLSearchParams({account_id:accountId,domain_key:domainKey,q,request_type:"search",search_type:"keyword",fl:"pid,title,price,sale_price,thumb_image,url,brand,colors",start:String(start),rows:String(rows),url:location.href,ref_url:document.referrer||location.href,_br_uid_2
28:window.bpBr.uid(),request_id:window.bpBr.reqId()});return viewId&¶ms.set("view_id",viewId),authKey&¶ms.set("auth_key",authKey),fetch(`${host||"https://core.dxpapi.com/api/v1/core/"}?${params}`).then(r=>{if(!r.ok)throw new Error(r.status);return r.json()})},fetchSuggest(q,{rows=6}={}){const{accountId,suggestHost,domainKey,authKey}=window.bpBr.config();if(!accountId||!domainKey)return Promise.reject(new Error("br-config"));const params=new URLSearchParams({account_id:accountId,catalog_views:domainKey,q,request_type:"suggest",search_type:"keyword",url:location.href,ref_url:document.referrer||location.href,_br_uid_2:window.bpBr.uid(),request_id:window.bpBr.reqId(),rows:String(rows)});return authKey&¶ms.set("auth_key",authKey),fetch(`${suggestHost||"https://suggest.dxpapi.com/api/v2/suggest/"}?${params}`).then(r=>{if(!r.ok)throw new Error(r.status);return r.json()})},suggestSidebarHtml(queries,q,searchUrl){const escaped=window.bpBr.esc(q).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return`<div class="bp-sp__group"> 29 <h3 class="bp-sp__group-title">Suggestions</h3> 30 <ul class="bp-sp__links" role="list">${(queries||[]).slice(0,8).map(sug=>{const term=sug.displayText||sug.query,hl=window.bpBr.esc(term).replace(new RegExp(`(${escaped})`,"gi"),"<strong>$1</strong>");return`<li><a class="bp-sp__link" href="${searchUrl}?q=${encodeURIComponent(sug.query)}" data-bp-search="${window.bpBr.esc(sug.query)}">${hl}</a></li>`}).join("")}</ul> 31 </div>`},productGridHtml(docs,{q="",searchUrl="/search",cta="",title="Products"}={}){const cards=(docs||[]).map(p=>`<li class="bp-sp__item">${window.bpBr.productCard(p)}</li>`).join(""),footer=cta==="view-all"?`<div class="bp-sp__footer"> 32 <a class="bp-sp__view-all" href="${searchUrl}?q=${encodeURIComponent(q)}">View All Results</a> 33 </div>`:"";return`<h3 class="bp-sp__products-title">${window.bpBr.esc(title)}</h3> 34 <ul class="bp-sp__grid" role="list">${cards}</ul>${footer}`},fetchTrending({rows=12}={}){const{accountId,domainKey,authKey}=window.bpBr.config();if(!accountId)return Promise.resolve([]);const params=new URLSearchParams({account_id:accountId,domain_key:domainKey||"bostonproper",rows:String(rows),fields:"pid,title,url,thumb_image,price,sale_price,colors",_br_uid_2:window.bpBr.uid(),url:location.href,ref_url:document.referrer||location.href});return authKey&¶ms.set("auth_key",authKey),fetch(`https://pathways.dxpapi.com/api/v2/widgets/global/6j835y6l?${params}`,{credentials:"omit"}).then(r=>r.ok?r.json():null).then(d=>d?.response?.docs||[]).catch(()=>[])}});class BpSearchDrawer extends HTMLElement{#ctrl=null;#suggestTimer=null;#searchQuery="";#defaultSidebarHtml="";connectedCallback(){this.#ctrl=new AbortController;const sig=this.#ctrl.signal,input=this.querySelector(".bp-sd__input"),clear=this.querySelector(".bp-sd__clear");this.brEnabled=this.dataset.brEnabled==="1";const sidebar=this.querySelector("[data-br-sidebar]");sidebar&&(this.#defaultSidebarHtml=sidebar.innerHTML);const searchModal=document.getElementById("search-modal");searchModal&&(searchModal.showDialog=()=>{});const horizonDialogEl=document.querySelector("#search-modal dialog");horizonDialogEl&&(horizonDialogEl.removeAttribute("scroll-lock"),horizonDialogEl.showModal=()=>{},horizonDialogEl.show=()=>{}),this.querySelector(".bp-sd__form")?.addEventListener("submit",e=>{e.preventDefault();const q=input?.value.trim();if(!q)return;const searchUrl=this.dataset.searchUrl||"/search";window.location.href=searchUrl+"?q="+encodeURIComponent(q)},{signal:sig}),this.addEventListener("click",e=>{const link=e.target.closest("[data-bp-search]");if(!link)return;e.preventDefault();const term=(link.getAttribute("data-bp-search")||"").trim();if(!term)return;const searchUrl=this.dataset.searchUrl||"/search";window.location.href=searchUrl+"?q="+encodeURIComponent(term)},{signal:sig}),window.addEventListener("click",this.#interceptSearch,{capture:!0,signal:sig}),document.addEventListener("click",this.#onOutside,{signal:sig}),document.addEventListener("keydown",e=>{e.key==="Escape"&&this.#isOpen&&this.close()},{signal:sig}),input?.addEventListener("input",()=>{clear.hidden=!input.value,this.#debouncedSuggest(input.value.trim())},{signal:sig}),clear?.addEventListener("click",()=>{input.value="",clear.hidden=!0,input.focus(),this.#searchQuery="",this.#showDefaultState()},{signal:sig})}disconnectedCallback(){this.#ctrl?.abort(),clearTimeout(this.#suggestTimer),window.removeEventListener("scroll",this.#positionPanel),window.removeEventListener("resize",this.#positionPanel)}get#isOpen(){return this.classList.contains("bp-sd--open")}#isSearchTrigger(el){return!!el.closest("search-button, .search-action")}#interceptSearch=e=>{this.#isSearchTrigger(e.target)&&(e.stopImmediatePropagation(),e.preventDefault(),this.#isOpen?this.close():this.open())};#onOutside=e=>{if(!this.#isOpen||this.#isSearchTrigger(e.target))return;const panel=this.querySelector(".bp-sd__panel");panel&&!panel.contains(e.target)&&this.close()};#positionPanel=()=>{let bottom=0;if(["#header-component",".announcement-bar"].forEach(sel=>{const el=document.querySelector(sel);el&&(bottom=Math.max(bottom,el.getBoundingClientRect().bottom))}),bottom<=0){const g=document.getElementById("header-group");g&&(bottom=g.getBoundingClientRect().bottom)}bottom>0&&this.style.setProperty("--bp-sd-top",`${Math.round(bottom)}px`)};open(){this._bpOpener=document.activeElement instanceof HTMLElement?document.activeElement:null;const horizonDialogEl=document.querySelector("#search-modal dialog");horizonDialogEl?.open&&horizonDialogEl.close(),document.documentElement.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),this.#positionPanel(),window.addEventListener("scroll",this.#positionPanel,{passive:!0}),window.addEventListener("resize",this.#positionPanel,{passive:!0}),this.classList.add("bp-sd--open"),this.setAttribute("aria-hidden","false"),this.removeAttribute("inert");const input=this.querySelector(".bp-sd__input");input?.value.trim()?this.#debouncedSuggest(input.value.trim()):this.#showDefaultState(),requestAnimationFrame(()=>input?.focus())}close(){window.removeEventListener("scroll",this.#positionPanel),window.removeEventListener("resize",this.#positionPanel),this.classList.remove("bp-sd--open"),this.setAttribute("aria-hidden","true"),this.setAttribute("inert","");const input=this.querySelector(".bp-sd__input");
34input&&(input.value="",input.setAttribute("aria-expanded","false"));const clear=this.querySelector(".bp-sd__clear");clear&&(clear.hidden=!0),this.#searchQuery="",clearTimeout(this.#suggestTimer),this.#showDefaultState(),this._bpOpener&&typeof this._bpOpener.focus=="function"&&(this._bpOpener.focus(),this._bpOpener=null)}#debouncedSuggest(q){if(clearTimeout(this.#suggestTimer),!q){this.#showDefaultState();return}this.#defaultToken=null,this.#suggestTimer=setTimeout(()=>{if(!this.brEnabled){this.#fetchNativeSuggest(q);return}this.#fetchSuggest(q)},250)}async#fetchNativeSuggest(q){const base=typeof Theme<"u"&&Theme.routes&&Theme.routes.predictive_search_url||"/search/suggest",params=new URLSearchParams({q,"resources[type]":"product,query","resources[limit]":"6","resources[limit_scope]":"each",section_id:"bp-predictive-search"});try{const res=await fetch(`${base}?${params}`);if(!res.ok||this.querySelector(".bp-sd__input")?.value.trim()!==q)return;this.#renderNativeSuggest(await res.text(),q)}catch{}}#renderNativeSuggest(html,q){const doc=new DOMParser().parseFromString(html,"text/html"),sidebarFrag=doc.querySelector("[data-bp-native-sidebar]"),productsFrag=doc.querySelector("[data-bp-native-products]"),sidebar=this.querySelector("[data-br-sidebar]");sidebar&&(sidebar.innerHTML=sidebarFrag&&sidebarFrag.innerHTML.trim()?sidebarFrag.innerHTML:this.#defaultSidebarHtml);const productsEl=this.querySelector("[data-br-products]");productsEl&&(productsFrag?(productsEl.hidden=!1,productsEl.innerHTML=productsFrag.innerHTML,this.#hydrateCards(productsEl)):(productsEl.hidden=!1,productsEl.innerHTML=`<p class="bp-sr__empty">No results for “${window.bpBr.esc(q)}”. Try a different search term.</p>`))}async#fetchSuggest(q){const{accountId,suggestHost,domainKey,authKey}=window.shop?.br??{};if(!accountId||!domainKey){console.warn("[bp-search] Bloomreach credentials missing in window.shop.br:",window.shop?.br);return}const params=new URLSearchParams({account_id:accountId,catalog_views:domainKey,q,request_type:"suggest",search_type:"keyword",url:location.href,ref_url:document.referrer||location.href,_br_uid_2:window.bpBr.uid(),request_id:window.bpBr.reqId(),rows:"6"});authKey&¶ms.set("auth_key",authKey);const endpoint=suggestHost||"https://suggest.dxpapi.com/api/v2/suggest/";try{const res=await fetch(`${endpoint}?${params}`);if(!res.ok)return;this.#renderSuggest(await res.json(),q)}catch{}}#renderSuggest(data,q){const group=data.suggestionGroups?.[0]??{},queries=group.querySuggestions??[],products=group.searchSuggestions??[],searchUrl=this.dataset.searchUrl||"/search",sidebar=this.querySelector("[data-br-sidebar]");if(sidebar)if(queries.length){const escaped=window.bpBr.esc(q).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),links=queries.slice(0,8).map(s=>{const hl=window.bpBr.esc(s.displayText||s.query).replace(new RegExp(`(${escaped})`,"gi"),"<strong>$1</strong>");return`<li><a class="bp-sp__link" href="${searchUrl}?q=${encodeURIComponent(s.query)}" data-bp-search="${window.bpBr.esc(s.query)}">${hl}</a></li>`}).join("");sidebar.innerHTML=`<div class="bp-sp__group"> 35 <h3 class="bp-sp__group-title">Suggestions</h3> 36 <ul class="bp-sp__links" role="list">${links}</ul> 37 </div>`}else sidebar.innerHTML=this.#defaultSidebarHtml;const productsEl=this.querySelector("[data-br-products]");if(productsEl)if(products.length){const searchUrl2=this.dataset.searchUrl||"/search",cards=products.slice(0,5).map(s=>`<li class="bp-sp__item">${window.bpBr.productCard(window.bpBr.suggestProduct(s))}</li>`).join("");productsEl.hidden=!1,productsEl.innerHTML=` 38 <h3 class="bp-sp__products-title">Products</h3> 39 <ul class="bp-sp__grid" role="list">${cards}</ul> 40 <div class="bp-sp__footer"> 41 <a class="bp-sp__view-all" href="${searchUrl2}?q=${encodeURIComponent(q)}">View All Results</a> 42 </div>`}else this.#doSearch(q,{fromTyping:!0})}async#doSearch(q,opts={}){this.#searchQuery=q,this.#defaultToken=null;const{accountId,host,domainKey,authKey}=window.shop?.br??{};if(!accountId||!domainKey){console.warn("[bp-search] Bloomreach credentials missing in window.shop.br:",window.shop?.br);return}const params=new URLSearchParams({account_id:accountId,domain_key:domainKey,q,request_type:"search",search_type:"keyword",fl:"pid,title,price,sale_price,thumb_image,url,brand,colors",start:"0",rows:"24",url:location.href,ref_url:document.referrer||location.href,_br_uid_2
42:window.bpBr.uid(),request_id:window.bpBr.reqId()});authKey&¶ms.set("auth_key",authKey);const endpoint=host||"https://core.dxpapi.com/api/v1/core/";try{const res=await fetch(`${endpoint}?${params}`);if(!res.ok||opts.fromTyping&&this.querySelector(".bp-sd__input")?.value.trim()!==q)return;this.#renderSearch(await res.json(),q,opts)}catch{}}#renderSearch(data,q,opts={}){const docs=data.response?.docs??[],numFound=data.response?.numFound??0,searchUrl=this.dataset.searchUrl||"/search",sidebar=opts.fromTyping?null:this.querySelector("[data-br-sidebar]");sidebar&&(sidebar.innerHTML=`<div class="bp-sp__group"> 43 <p class="bp-sp__group-title">${numFound} result${numFound!==1?"s":""} for “${window.bpBr.esc(q)}”</p> 44 <ul class="bp-sp__links" style="margin-top:12px" role="list"> 45 <li><a class="bp-sp__link" href="#" data-br-back>← Back</a></li> 46 </ul> 47 </div>`,sidebar.querySelector("[data-br-back]")?.addEventListener("click",e=>{e.preventDefault(),this.#searchQuery="",this.#showDefaultState()}));const productsEl=this.querySelector("[data-br-products]");if(!productsEl)return;if(docs.length===0){productsEl.hidden=!1,productsEl.innerHTML=`<p class="bp-sr__empty">No results for “${window.bpBr.esc(q)}”. Try a different search term.</p>`;return}const cards=docs.map(p=>`<li class="bp-sp__item">${window.bpBr.productCard(p)}</li>`).join("");productsEl.hidden=!1,productsEl.innerHTML=` 48 <h3 class="bp-sp__products-title">Products</h3> 49 <ul class="bp-sp__grid" role="list">${cards}</ul> 50 <div class="bp-sp__footer"> 51 <a class="bp-sp__view-all" href="${searchUrl}?q=${encodeURIComponent(q)}">View All Results</a> 52 </div>`,this.#hydrateCards(productsEl)}#trendingCache=null;#fetchTrending(){if(this.#trendingCache)return this.#trendingCache;const br=window.shop?.br??{};if(!br.accountId)return Promise.resolve([]);const params=new URLSearchParams({account_id:br.accountId,domain_key:br.domainKey||"bostonproper",rows:"12",fields:"pid,title,url,thumb_image,price,sale_price,colors",_br_uid_2:window.bpBr.uid(),url:location.href,ref_url:document.referrer||location.href});br.authKey&¶ms.set("auth_key",br.authKey);const url=`https://pathways.dxpapi.com/api/v2/widgets/global/6j835y6l?${params}`;return this.#trendingCache=fetch(url,{credentials:"omit"}).then(res=>res.ok?res.json():null).then(data=>data?.response?.docs||[]).catch(err=>(console.warn("[bp-search] trending fetch failed",err),[])),this.#trendingCache}#hydrateCards(scope,left=3e3){if(!scope)return;const hydrate=window.BpCardHydrate,badges=window.BpBadges;hydrate?.observeCards&&hydrate.observeCards(scope),badges?.applyToCards&&badges.applyToCards(scope),(!hydrate||!badges)&&left>0&&setTimeout(()=>this.#hydrateCards(scope,left-150),150)}#showDefaultState(){const sidebar=this.querySelector("[data-br-sidebar]");sidebar&&this.#defaultSidebarHtml&&(sidebar.innerHTML=this.#defaultSidebarHtml);const productsEl=this.querySelector("[data-br-products]");if(!productsEl)return;if(!this.brEnabled){productsEl.hidden=!0,productsEl.innerHTML="";return}const token=Symbol("trending");this.#defaultToken=token,productsEl.hidden=!1,this.#fetchTrending().then(docs=>{if(this.#defaultToken!==token)return;if(!docs.length){productsEl.hidden=!0;return}const cards=docs.map(p=>`<li class="bp-sp__item">${window.bpBr.productCard(p)}</li>`).join("");productsEl.innerHTML=` 53 <h3 class="bp-sp__products-title">Trending Products</h3> 54 <ul class="bp-sp__grid" role="list">${cards}</ul>`,this.#hydrateCards(productsEl)})}#defaultToken=null}customElements.get("bp-search-drawer")||customElements.define("bp-search-drawer",BpSearchDrawer)}catch(e){console.error(e)}})()})(); 55//# sourceMappingURL=/cdn/shop/t/1521/compiled_assets/snippet-scripts.js.map?v=66079492489357529931790713714
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.