PageSourceSearch

https://www.bbuc.co/build/routes/($lang).collections.$handle-NIVP44TK.js

js bbuc.co collected 2026-10-04 04:02:50 UTC 6,911 bytes, 2 lines download raw bytes

1import{a as I,b as _,c as M,d as R,e as F,f as K,g as ge,h as fe}from"/build/_shared/chunk-YIKBFPOB.js";import{a as ze}from"/build/_shared/chunk-55MMSFOA.js";import"/build/_shared/chunk-KJ7SXDMH.js";import{F as ce,G as de,H as me,W as pe,ma as L,t as x,va as ue}from"/build/_shared/chunk-JORJI2QB.js";import"/build/_shared/chunk-HHIOPWQS.js";import{a as Ne}from"/build/_shared/chunk-ICWSYIYD.js";import"/build/_shared/chunk-APCSVQYF.js";import"/build/_shared/chunk-XAW4XMTF.js";import"/build/_shared/chunk-UGPSAXNF.js";import{n as f,s as B,t as j,u as Q,w as q,x as H}from"/build/_shared/chunk-XY52G2QU.js";import"/build/_shared/chunk-F52VNS4P.js";import{a as z}from"/build/_shared/chunk-YPGOJSUX.js";import{b as se,c as ae,h as ne,n as le,q as ie}from"/build/_shared/chunk-YXEZXZAO.js";import{a as $}from"/build/_shared/chunk-LEBH2O6Q.js";import"/build/_shared/chunk-Y7PCBEHX.js";import{d as g}from"/build/_shared/chunk-2LOM2E4Y.js";var s=g($());var V=g($());var h=g(z()),O=[{label:"Featured",key:"featured",sortKey:"MANUAL",reverse:!1},{label:"Newest",key:"newest",sortKey:"CREATED",reverse:!0},{label:"Best Selling",key:"best-selling",sortKey:"BEST_SELLING",reverse:void 0},{label:"Price ascending",key:"price-low-high",sortKey:"PRICE",reverse:!1},{label:"Price descending",key:"price-high-low",sortKey:"PRICE",reverse:!0},{label:"Name ascending",key:"title-a-z",sortKey:"TITLE",reverse:!1},{label:"Name descending",key:"title-z-a",sortKey:"TITLE",reverse:!0}];function W({initialSortOrder:p="",onSortChange:d}){let[w,N]=(0,V.useState)(!1),[m,v]=(0,V.useState)(()=>{let t=O.find(y=>y.key===p);return t?t.key:""}),u=O.find(t=>t.key===m)||O[0],C=t=>{if(t===m){N(!1);return}console.log("Sort changed to:",t),v(t),d(t),N(!1)};return(0,h.jsxs)(R,{open:w,onOpenChange:N,children:[(0,h.jsx)(F,{asChild:!0,children:(0,h.jsxs)(x,{variant:"outline",size:"filter",role:"combobox","aria-expanded":w,className:"w-full justify-between",children:[(0,h.jsx)("span",{className:"sr-only",children:"Sort by "}),u&&`${u?.label}`,(0,h.jsx)(L,{className:"ml-auto mr-[-3px] h-4 w-4 shrink-0"})]})}),(0,h.jsx)(K,{className:"p-0",children:(0,h.jsx)(I,{className:"",children:(0,h.jsx)(_,{children:O.map(t=>{let y=t.key===u?.key;return(0,h.jsx)(M,{onSelect:()=>C(t.key),className:f(t.key===m?"bg-gray-100":""),children:t.label},t.key)})})})})]})}var G=g($());var l=g(z());function Y({availableSizes:p,currentSize:d,sizeAvailability:w,sizeCounts:N,onSizeChange:m}){let[v,u]=(0,G.useState)(!1),C=(0,G.useRef)(null),t=d||"All",y=p.length>0?p:["All"],i=a=>{if(a===C.current){console.log("filter unchanged, skip update =",a),u(!1);return}console.log("size filter changed from",C.current,"to",a),m(a),C.current=a,u(!1)};return(0,l.jsxs)(R,{open:v,onOpenChange:u,children:[(0,l.jsx)(F,{asChild:!0,children:(0,l.jsxs)(x,{variant:"outline",size:"filter",role:"combobox","aria-expanded":v,className:"w-full justify-between",children:[(0,l.jsx)("span",{className:"sr-only",children:"Filter by "}),"Size ",t&&`${t}`,(0,l.jsx)(L,{className:"ml-auto mr-[-3px] h-4 w-4 shrink-0"})]})}),(0,l.jsx)(K,{className:"p-0",children:(0,l.jsx)(I,{className:"",children:(0,l.jsx)(_,{children:y.map(a=>{let E=a===t,k=w[a],A=N[a]||0;return(0,l.jsx)(M,{onSelect:()=>i(a),className:f(E?"bg-gray-100":"",!k&&a!=="All"?"opacity-50 cursor-not-allowed":""),disabled:!k&&a!=="All",children:(0,l.jsxs)("div",{className:"flex justify-between w-full",children:[(0,l.jsx)("span",{children:a}),(0,l.jsx)("span",{className:"text-xs text-gray-500",children:a==="All"?A>0?`(${A})`:"(0)":A>0?`(${A})`:"(Out of stock)"})]})},a)})})})})]})}var he=g(ze());var Te=g(Ne()),o=g(z());var Oe=({data:p,matches:d})=>ue(p?.seo,d);function ye(){let{collection:p,page:d,gids:w,filterParams:N}=ie(),m=ae(),v=se(),[u]=ne(),C=u.get("sort"),t=u.get("size")||"All",y=u.get("tag")||"All",i=p.products.nodes??[],[a,E]=(0,s.useState)(["All"]),[k,A]=(0,s.useState)([{title:"All",slug:"All"}]),[Se,X]=(0,s.useState)({All:!0}),[ve,Z]=(0,s.useState)({All:0}),[Ee,J]=(0,s.useState)([]),[ee,te]=(0,s.useState)("initial"),be=Object.keys(q);function oe(e,r=ge){return e.filter(n=>!!n&&n!=="All"&&!r.includes(n)).map(n=>({title:n,slug:n})).sort((n,b)=>n.title.localeCompare(b.title))}(0,s.useEffect)(()=>
1{if(i.length>0){let e=`size:${t}-tag:${y}`;te(e),J(i);let r=B(i),n=[...new Set([...be,...r])],b=H(n),P=["All",...b],S={All:!0},T={All:i.length};b.forEach(c=>{S[c]=j(i,c),T[c]=Q(i,c)}),E(P),X(S),Z(T);let D=[...new Set(i.flatMap(c=>c.tags||[]))],U=oe(D);A([{title:"All",slug:"All"},...U])}},[i,t,y]),(0,s.useEffect)(()=>{let e=`size:${t}-tag:${y}`;e!==ee&&te(e)},[t,y,ee]);let re=(0,s.useCallback)(e=>{if(!e||e.length===0)return;let r=Object.keys(q),n=B(e),b=[...new Set([...r,...n])],P=H(b);E(["All",...P]);let S={All:!0},T={All:e.length};P.forEach(c=>{S[c]=j(e,c),T[c]=Q(e,c)}),X(S),Z(T);let D=[...new Set(i.flatMap(c=>c.tags||[]))],U=oe(D);A([{title:"All",slug:"All"},...U])},[]),Ce=(0,s.useCallback)(e=>{!e||e.length===0||J(r=>{let n=new Set(r.map(S=>S.id)),b=e.filter(S=>!n.has(S.id)),P=[...r,...b];return re(P),P})},[re]),Ae=(0,s.useCallback)(e=>{let r=new URLSearchParams(window.location.search);e==="All"?r.delete("size"):r.set("size",e),m({search:r.toString()})},[v,m]),Pe=(0,s.useCallback)(e=>{let r=new URLSearchParams(window.location.search);e==="All"?r.delete("tag"):r.set("tag",e),m({search:r.toString()})},[v,m]),we=(0,s.useCallback)(e=>{let r=new URLSearchParams(window.location.search);e?r.set("sort",e):r.delete("sort"),m({search:r.toString()})},[v,m]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(s.Suspense,{children:(0,o.jsxs)(le,{resolve:w,children:[d.headerModules&&(0,o.jsx)(me,{surface:"header",items:d.headerModules,className:"mb-16"}),(0,o.jsxs)("section",{children:[(0,o.jsxs)("header",{id:"collection-toolbar",className:f(ce,de,"items-center gap-y-2","text-theme-text text-xs uppercase","my-4 lg:my-0 lg:mb-8"),children:[(0,o.jsx)("h1",{className:f("col-span-full","lg:col-span-3 lg:col-start-2 lg:mb-0"),children:d.title}),i.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:f("col-span-2","lg:col-span-2 lg:col-start-7 "),children:(0,o.jsx)(fe,{availableTags:k,currentTag:y,onTagChange:Pe})}),(0,o.jsx)("div",{className:f("col-span-2 col-start-3","lg:col-span-2 lg:col-start-9 "),children:(0,o.jsx)(Y,{availableSizes:a,currentSize:t,sizeAvailability:Se,sizeCounts:ve,onSizeChange:Ae})}),(0,o.jsx)("div",{className:f("col-span-3 col-start-1","lg:col-span-3 lg:col-start-12 "),children:(0,o.jsx)(W,{initialSortOrder:d.sortOrder,onSortChange:we},d._id)})]})]}),i.length===0&&(0,o.jsx)("div",{className:f("relative mt-8 lg:mt-32 grid grid-cols-15 gap-x-[12px] px-[12px]"),children:(0,o.jsx)("div",{className:"z-10 col-span-7 col-start-2 mt-8 text-xs uppercase",children:"No products."})}),(0,o.jsx)(pe,{collection:p,modules:d.gridModules,url:`/collections/${p.handle}`,onNewProductsLoaded:Ce},`${p.handle}-${C}`)]})]})})})}export{ye as default,Oe as meta};
2

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.