1var e=[`out_of_stock`,`discontinued`],t=t=>!!t&&e.includes(t),n={available:null,preorder:null,out_of_stock:`outOfStock`,discontinued:`productDiscontinued`,unknown:`productUnavailable`},r=new Set([`available`,`preorder`]),i=(e,t=Date.now())=>r.has(s(e,t)),a=(e,t)=>{if(!e)return null;let n=e.variants.edges.map(e=>e.node);return t?n.find(e=>e.sku===t)??null:n[0]??null},o=(e,t)=>{if(!e||!t)return null;for(let{node:n}of e.variants.edges){if(n.id===t)return n;let e=n.subscriptionsUpsell?.references?.edges?.find(e=>e.node.id===t)?.node;if(e)return e}return null},s=(e,n=Date.now())=>{if(!e)return`unknown`;let r=e.salesStatus?.value;return t(r)?r:l(e.preorderShipDate?.value,n)?`preorder`:`available`},c=(e,t,n=Date.now())=>{if(!e)return`unknown`;let i=(Array.isArray(t)?t:[t]).filter(e=>!!e);if(i.length<=1){let t=a(e,i[0]);return t?s(t,n):`unknown`}let o=i.map(t=>{let r=a(e,t);return r?s(r,n):`unknown`}),c=o.filter(e=>r.has(e));return c.length?c.includes(`available`)?`available`:`preorder`:new Set(o).size===1?o[0]:`unknown`},l=(e,t)=>{let n=e?.match(/^(\d{4})-(\d{2})-(\d{2})/);if(!n)return!1;let[r,i,a]=n.slice(1).map(Number),o=Date.UTC(r,i-1,a),s=new Date(o);if(s.getUTCFullYear()!==r||s.getUTCMonth()!==i-1||s.getUTCDate()!==a)return!1;let c=new Date(t);return o>=Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate())},u=(e,t)=>t===`resolved`?{state:e,status:t,buyable:r.has(e),messageKey:n[e]}:{state:e,status:t,buyable:!1,messageKey:null},d=e=>!!e?.messageKey,f=(e,t,n=Date.now())=>{let r=(t??[]).filter(e=>!!e);return(r.length?r.map(t=>a(e,t)):e?.variants.edges.map(e=>e.node)??[]).filter(e=>!!e&&i(e,n))},p={available:`https://schema.org/InStock`,preorder:`https://schema.org/PreOrder`,out_of_stock:`https://schema.org/OutOfStock`,discontinued:`https://schema.org/Discontinued`,unknown:`https://schema.org/OutOfStock`};export{a,c,o as i,s as l,u as n,d as o,f as r,i as s,p as t};
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.