1import{aq as J,w as re,h as ie,ar as ce,as as de,at as ue,au as pe}from"./zRKRMFEZ.js";import{_ as me}from"./CH5njUTC.js";import{m as X,q as fe,C as i,P as c,a8 as he,ak as ge,o as ve,N as _e,v as q,l as ye,a0 as e,a1 as A,a9 as u,G as m,u as f,al as xe,j as C,p as G,am as be,an as we,_ as ke,ao as qe,ap as K,M as Ce,ac as v,aq as Se,a5 as R,ar as Ne,a6 as B,as as Ie,F as T,H as je,a7 as E,at as Be,D as H,au as $e}from"./DUCOj2lJ.js";import{E as Re}from"./NpysqToT.js";import{d as Z}from"./DD84joPr.js";import{B as Ee}from"./Cr0LzuPc.js";import{u as Le,a as De}from"./DRnLhJL0.js";import"./DUudcvDl.js";import"./D8N2DAGO.js";import"./C3e4t58V.js";import"./Dipz0mOK.js";import"./1uQHCFUG.js";import"./tncAhSry.js";import"./DMf_iQbA.js";import"./BaxD1dWw.js";import"./BXlfQJEK.js";import"./Dxzbedgu.js";import"./DCmGOuG7.js";import"./F8doVSIJ.js";const Pe=X({__name:"SearchNoResultsWatcher",props:{results:{type:Object,required:!0},query:{type:String,required:!0}},setup(M){const y=M,S=Z((h,$)=>{h.length>2&&$===0&&w(h)},600);fe(()=>y.results,h=>{S(y.query,h.nbHits)},{deep:!0,immediate:!0});const w=h=>{J("search_no_results",h)};return(h,$)=>(i(),c("div"))}}),Te=Object.assign(Pe,{__name:"SearchNoResultsWatcher"}),He={class:"container relative mx-auto px-4"},Me={class:"min-h-[50vh]"},Ue={class:"mx-auto py-8 lg:px-14 lg:py-28"},Ve={class:"flex flex-col-reverse md:flex-row"},Fe={class:"flex items-center justify-end"},Qe={class:"relative"},ze={class:"pointer-events-none absolute left-3 top-1/2 z-10 -translate-y-1/2 md:left-10"},Oe=["onInput"],We={key:0,class:"italic text-gray-500"},Ae={key:1},Ge={class:"text-gray-500"},Ke={class:"italic"},Ye={key:2},Je={class:"gap-x-8 lg:flex"},Xe={class:"flex-none lg:top-32 lg:w-1/4 lg:self-start"},Ze={class:"hidden lg:block"},et={class:"mb-4 flex justify-end"},tt={class:"flex-1 text-grind"},st=["href","onClick"],ot=["onClick"],at={class:"flex items-center justify-between space-x-2"},nt={class:"flex items-center space-x-2"},lt=["checked","aria-label"],rt={class:"flex flex-1"}
1,it={class:"rounded-full px-2 text-sm ring-1 ring-brew group-hover:bg-brew"},ct={key:1,class:"hidden"},dt={key:0,class:"mt-8 hidden lg:block"},ut={class:"mt-8 flex-1 lg:mt-0"},pt={key:0,class:"italic text-gray-500"},mt={key:1},ft={key:0,class:"grid gap-4 sm:grid-cols-2 md:gap-[30px] xl:grid-cols-3"},ht={key:0,class:"h-[120px] w-[120px] overflow-hidden rounded-t-[10px] bg-gray-100 sm:h-[235px] sm:w-full"},gt={key:1,class:"hidden"},vt={key:2,class:"h-[120px] w-[120px] overflow-hidden rounded-t-[10px] sm:h-[235px] sm:w-full sm:bg-grind-100"},_t={class:"mb-2 text-sm font-bold md:text-xl",itemprop:"headline"},yt={key:0,class:"text-brew group-hover:!underline"},xt={key:1,class:"mt-4 text-lg italic text-gray-500"},bt={class:"flex items-center space-x-4 sm:hidden"},wt=["disabled","onClick"],kt={class:"text-gray-700"},qt=["disabled","onClick"],Ct={class:"hidden items-center space-x-2 sm:flex"},St=["disabled","onClick"],Nt=["onClick"],It=["disabled","onClick"],jt={key:2},Y="/",Jt=X({__name:"search",async setup(M){let y,L;const S=C("/"),{story:w,initBridge:h}=([y,L]=he(()=>De({})),y=await y,L(),y);Le(w.value);const $=G(()=>{var t,o,l;return(l=(o=(t=w==null?void 0:w.value)==null?void 0:t.content)==null?void 0:o.blocks)==null?void 0:l.filter(a=>a.component==="empty_result_group")}),D=C(null),g=C(null),P=ie(),U=P.public.algolia.indexes.searchStory,x=ce(),V=pe(),p=C(""),b=C(null),k=C(0),ee=G(()=>({[U]:{query:x.query.q||""}})),N=(t,o)=>{k.value=t,o(t),V.push({query:{...x.query,q:p.value||void 0,page:t>0?t.toString():void 0}})},te=(t,o)=>{const l=t.target.value;p.value=l,o(l),k.value=0,se(l),V.push({query:{...x.query,q:l||void 0,page:void 0}})},se=Z(t=>{t&&J("search",t)},600),oe=t=>{const o=["product","page","faq","article","design_lab_theme"];return t.sort((l,a)=>{const n=o.indexOf(l.label),r=o.indexOf(a.label);return(n===-1?999:n)-(r===-1?999:r)})};function ae(t){if(p.value.length<2)return[];const o=a=>a.replace(/<[^>]+>/g,""),l=(a,n=250)=>a.length<=n?a:a.slice(0,n).trimEnd()+"â¦";return t.map(a=>{const n=a.meta_description||"";let r="";if(a.component==="faq"&&n)try{const s=de(n);r=l(o(s))}catch{r=l(typeof n=="string"?n:"")}else r=l(typeof n=="string"?n:"");return{title:a.meta_title||"",link:a.slug?{label:a.meta_title||"View",url:a.slug,linktype:"story"}:void 0,image:a.meta_image||void 0,tags:a.tags||[],description:r,component:a.component,objectID:a.objectID||a.slug||`${a.meta_title}-${Math.random()}`}})}const ne=t=>{if(!t)return"";let l={article:"blog"}[t.toLowerCase()]||t;return l.toLowerCase()==="faq"&&(l="FAQ"),ue(l)},le=ge(P.public.algolia.applicationId,P.public.algolia.search),F=()=>{let t=S.value||Y;t.includes("/search")&&(t=Y),window.location.href=t},Q=t=>{t.key==="Escape"&&F()};ve(()=>{window.removeEventListener("keydown",Q)}),_e(async()=>{var l,a;h(),window.addEventListener("keydown",Q),history.state&&history.state.back?S.value=((l=history.state)==null?void 0:l.back)||"/":document.referrer&&(S.value=document.referrer);const t=x.query.q,o=x.query.page;if(t&&typeof t=="string"&&(p.value=t,await q(),(a=b.value)!=null&&a.refine&&b.value.refine(t)),o&&typeof o=="string"){const n=Number.parseInt(o,10);!isNaN(n)&&n>0&&(k.value=n,await q(),setTimeout(()=>{var r;(r=g.value)!=null&&r.refine&&g.value.refine(n)},100))}await q(),setTimeout(()=>{D.value&&D.value.focus()},100),window.addEventListener("popstate",z)}),ye(()=>{window.removeEventListener("popstate",z)});const z=async()=>{var l,a,n,r,d;const t=x.query.q,o=x.query.page;if(t&&typeof t=="string"?(p.value=t,(l=b.value)!=null&&l.refine&&b.value.refine(t)):(p.value="",(a=b.value)!=null&&a.refine&&b.value.refine("")),o&&typeof o=="string"){const s=Number.parseInt(o,10);!isNaN(s)&&s>0?(k.value=s,await q(),(n=g.value)!=null&&n.refine&&g.value.refine(s)):(k.value=0,await q(),(r=g.value)!=null&&r.refine&&g.value.refine(0))}else k.value=0,await q(),(d=g.value)!=null&&d.refine&&g.value.refine(0)};return(t,o)=>{const l=re,a=me;return i(),c("div",He,[e("div",Me,[e("div",Ue,[e("div",Ve,[o[2]||(o[2]=e("div",{class:"flex-1"},[e("h2",null,"How can we help you?")],-1)),e("div",Fe,[e("a",{href:"#",class:"flex flex-col-reverse items-center !no-underline hover:!underline",onClick:A(F,["prevent"])},[o[1]||(o[1]=e("div",{class:"close-btn-text text-black"},"esc",-1)),u(l,{name:"close",class:"text-lg"})])])]),u(f(xe),{"search-client":f(le),"index-name":f(U),"initial-ui-state":ee.value},{default:m(()=>[u(f(be),{hitsPerPage:12}),u(f(we),{ref_key:"searchBox",ref:b,"submit-icon":!1,"reset-icon":!1,class:"relative mx-auto my-8"},{default:m(({refine:n})=>[e("div",Qe,[e("div",ze,[u(l,{name:"magnifying-glass",class:"text-brew md:text-lg"})]),ke(e("input",{ref_key:"searchInput",ref:D,"onUpdate:modelValue":o[0]||(o[0]=r=>p.value=r),type:"search",placeholder:"Search packaging, resources, and moreâ¦",class:"w-full rounded-lg border border-gray-300 bg-white pl-8 pr-4 text-base leading-6 text-gray-900 placeholder-gray-400 shadow-sm transition-all duration-200 focus:border-brew focus:outline-none focus:ring-2 focus:ring-brew md:py-7 md:pl-20 md:text-2xl",onInput:r=>te(r,n)},null,40,Oe),[[qe,p.value]])])]),_:1},512),u(f(K),null,{default:m(({results:n})=>[p.value.length<=2?(i(),c("div",We," Please enter at least 3 characters to search. ")):n.nbHits===0?(i(),c("div",Ae,[e("div",Ge,[o[3]||(o[3]=Ce(" There are no results for ",-1)),e("span",Ke,v(p.value),1)]),u(Re,{"empty-result-blocks":$.value,"block-slug":"empty-search"},null,8,["empty-result-blocks"])])):(i(),c("div",Ye)),u(Te,{query:p.value,results:n},null,8,["query","results"])]),_:1}),e("div",Je,[e("aside",Xe,[e("div",Ze,[u(f(Se),null,{default:m(({nbHits:n})=>[n>0&&p.value.length>2?(i(),c(R,{key:0},[e("div",et,[e("div",tt," FILTER BY ("+v(n)+" RESULTS) ",1),u(f(Ne),null,{default:m(({canRefine:r,refine:d,createURL:s})=>[e("a",{href:s(),class:B({"pointer-events-none no-underline opacity-70":!r}),onClick:A(d,["prevent"])}," Reset ",10,st)]),_:1})]),u(f(Ie),{attribute:"component",operator:"or","sort-by":["name"],"transform-items":oe},{default:m(({items:r,refine:d})=>[e("ul",null,[(i(!0),c(R,null,T(r,s=>(i(),c("li",{key:s.value,class:B(["group cursor-pointer rounded p-2 hover:bg-brew hover:text-white",(s.isRefined,"text-grind")]),onClick:I=>d(s.value)},[e("div",at,[e("div",nt,[e("input",{type:"checkbox",checked:s.isRef
1ined,"aria-label":s.label??s.value,class:"pointer-events-none accent-grind",tabindex:"-1",readonly:""},null,8,lt),e("span",{class:B({"font-bold":s.isRefined})},v(ne(s.label??s.value)),3)]),e("span",rt,[e("span",it,v(s.count),1)])])],10,ot))),128))])]),_:1},8,["transform-items"])],64)):(i(),c("span",ct))]),_:1})]),t.$slots["product-filter-cta"]?(i(),c("div",dt,[je(t.$slots,"product-filter-cta")])):E("",!0)]),e("div",ut,[u(f(K),null,{default:m(({results:n,state:r})=>[n.nbHits===0?(i(),c("div",pt)):r.query&&r.query.length>2?(i(),c("div",mt,[u(f(Be),{"transform-items":ae},{default:m(({items:d})=>[d.length>0?(i(),c("div",ft,[(i(!0),c(R,null,T(d,s=>(i(),H(Ee,{key:s.objectID,card:s,"main-classes":"group flex sm:flex-col items-center sm:items-stretch !no-underline transition-all duration-200 ease-in-out shadow-base hover:shadow-lg hover:-translate-y-1","footer-classes":s.component==="faq"||s.component==="article"?"":"hidden","image-container-classes":s.component==="faq"?"hidden":""},{image:m(()=>{var I;return[s.component==="article"?(i(),c("div",ht,[s.image?(i(),H(a,{key:0,src:s.image,class:"h-full w-full rounded-t-[10px] object-cover transition-transform duration-200 ease-in-out group-hover:-translate-y-0.5 group-hover:scale-[1.03]",itemprop:"image",sizes:"342px","image-width":342,"image-height":235,quality:80},null,8,["src"])):E("",!0)])):s.component==="faq"?(i(),c("div",gt)):(i(),c("div",vt,[u(a,{src:s.image||"/images/image-placeholder.svg",class:B(["h-full w-full rounded-t-[10px] object-contain transition-transform duration-200 ease-in-out group-hover:-translate-y-0.5 group-hover:scale-[1.03]",{"m-auto p-4":!((I=s.image)!=null&&I.src)}]),sizes:"120px 342px","image-width":342,"image-height":235,quality:90},null,8,["src","class"])]))]}),title:m(()=>[e("div",_t,v(s.title),1)]),footer:m(()=>[s.component==="faq"||s.component==="article"?(i(),c("span",yt,v(s.component==="faq"?"Learn more":"Read more"),1)):E("",!0)]),_:2},1032,["card","footer-classes","image-container-classes"]))),128))])):(i(),c("div",xt," 0 results "))]),_:1}),n.nbHits>0&&r.query&&r.query.length>2?(i(),H(f($e),{key:0,ref_key:"pagination",ref:g,class:"mt-8 flex justify-center"},{default:m(({currentRefinement:d,pages:s,nbPages:I,refine:j,isFirstPage:O,isLastPage:W})=>[e("div",bt,[e("button",{disabled:O,class:"rounded-full px-3 py-2 text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",onClick:_=>N(d-1,j)}," Prev ",8,wt),e("span",kt," Page "+v(d+1)+" / "+v(I),1),e("button",{disabled:W,class:"rounded-full px-3 py-2 text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",onClick:_=>N(d+1,j)}," Next ",8,qt)]),e("ul",Ct,[e("li",null,[e("button",{disabled:O,class:"rounded-full px-3 py-2 text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",onClick:_=>N(d-1,j)},[...o[4]||(o[4]=[e("svg",{class:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])],8,St)]),(i(!0),c(R,null,T(s,_=>(i(),c("li",{key:_},[e("button",{class:B(["rounded-full px-5 py-3 text-xl transition-colors",d===_?"bg-drip text-white":"text-gray-600 hover:bg-gray-100"]),onClick:$t=>N(_,j)},v(_+1),11,Nt)]))),128)),e("li",null,[e("button",{disabled:W,class:"rounded-full px-3 py-2 text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",onClick:_=>N(d+1,j)},[...o[5]||(o[5]=[e("svg",{class:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1)])],8,It)])])]),_:1},512)):E("",!0)])):(i(),c("div",jt))]),_:1})])])]),_:3},8,["search-client","index-name","initial-ui-state"])])])])}}});export{Jt as default}; 2//# sourceMappingURL=BfMU-1EG.js.map
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.