@shopify/hydrogen 2025.4.0 → 2025.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import {createContext,forwardRef,useContext,lazy,useMemo,useEffect,useRef,useState,createElement,Fragment as Fragment$1,Suspense}from'react';import {useFetcher,useFetchers,useNavigation,useLocation,useNavigate,Link,useMatches}from'@remix-run/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useLoadScript,createStorefrontClient,SHOPIFY_STOREFRONT_ID_HEADER,getShopifyCookies,SHOPIFY_Y,SHOPIFY_STOREFRONT_Y_HEADER,SHOPIFY_S,SHOPIFY_STOREFRONT_S_HEADER,flattenConnection,RichText,ShopPayButton,useShopifyCookies,parseGid,sendShopifyAnalytics,AnalyticsEventName,AnalyticsPageType,getClientBrowserParameters}from'@shopify/hydrogen-react';export{AnalyticsEventName,AnalyticsPageType,ExternalVideo,IMAGE_FRAGMENT,Image,MediaFile,ModelViewer,Money,ShopifySalesChannel,Video,customerAccountApiCustomScalars,decodeEncodedVariant,flattenConnection,getAdjacentAndFirstAvailableVariants,getClientBrowserParameters,getProductOptions,getShopifyCookies,isOptionValueCombinationInEncodedVariant,mapSelectedProductOptionToObject,parseGid,parseMetafield,sendShopifyAnalytics,storefrontApiCustomScalars,useLoadScript,useMoney,useSelectedOptionInUrlParam,useShopifyCookies}from'@shopify/hydrogen-react';import {parse,stringify}from'worktop/cookie';import ha from'content-security-policy-builder';function ue(e){let{type:t,data:r={},customData:n}=e,o=useLocation(),{publish:a,cart:s,prevCart:c,shop:i,customData:u}=G(),p=o.pathname+o.search,l={...r,customData:{...u,...n},cart:s,prevCart:c,shop:i};return useEffect(()=>{i?.shopId&&(l={...l,url:window.location.href},a(t,l));},[a,p,i?.shopId]),null}function Xt(e){return jsx(ue,{...e,type:"page_viewed"})}function Zt(e){return jsx(ue,{...e,type:"product_viewed"})}function er(e){return jsx(ue,{...e,type:"collection_viewed"})}function tr(e){return jsx(ue,{...e,type:"cart_viewed"})}function rr(e){return jsx(ue,{...e,type:"search_viewed"})}function or(e){return jsx(ue,{...e})}var V={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",CART_UPDATED:"cart_updated",PRODUCT_ADD_TO_CART:"product_added_to_cart",PRODUCT_REMOVED_FROM_CART:"product_removed_from_cart",CUSTOM_EVENT:"custom_"};var Oo="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.1/consent-tracking-api.js",Do="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function rt(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function ot(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:n,...o}=e;useLoadScript(t?Do:Oo,{attributes:{id:"customer-privacy-api"}});let{observing:a,setLoaded:s}=xo({withPrivacyBanner:t,onLoaded:n}),c=useMemo(()=>{let{checkoutDomain:u,storefrontAccessToken:p}=o;return u||rt("checkoutDomain"),p||rt("storefrontAccessToken"),(p.startsWith("shpat_")||p.length!==32)&&console.error("[h2:error:useCustomerPrivacy] It looks like you passed a private access token, make sure to use the public token"),{checkoutRootDomain:u,storefrontAccessToken:p,storefrontRootDomain:sr(u),country:o.country,locale:o.locale}},[o,sr,rt]);useEffect(()=>{let u=p=>{r&&r(p.detail);};return document.addEventListener("visitorConsentCollected",u),()=>{document.removeEventListener("visitorConsentCollected",u);}},[r]),useEffect(()=>{if(!t||a.current.privacyBanner)return;a.current.privacyBanner=true;let u=window.privacyBanner||void 0;Object.defineProperty(window,"privacyBanner",{configurable:true,get(){return u},set(l){if(typeof l=="object"&&l!==null&&"showPreferences"in l&&"loadBanner"in l){let m=l;m.loadBanner(c),u=cr({privacyBanner:m,config:c}),s.privacyBanner(),ar();}}});},[t,c,cr,s.privacyBanner]),useEffect(()=>{if(a.current.customerPrivacy)return;a.current.customerPrivacy=true;let u=null,p=window.Shopify||void 0;Object.defineProperty(window,"Shopify",{configurable:true,get(){return p},set(l){typeof l=="object"&&l!==null&&Object.keys(l).length===0&&(p=l,Object.defineProperty(window.Shopify,"customerPrivacy",{configurable:true,get(){return u},set(m){if(typeof m=="object"&&m!==null&&"setTrackingConsent"in m){let y=m;u={...y,setTrackingConsent:ir({customerPrivacy:y,config:c})},p={...p,customerPrivacy:u},s.customerPrivacy(),ar();}}}));}});},[c,ir,s.customerPrivacy]);let i={customerPrivacy:de()};return t&&(i.privacyBanner=Le()),i}var nr=false;function ar(){if(nr)return;nr=true;let e=new CustomEvent("shopifyCustomerPrivacyApiLoaded");document.dispatchEvent(e);}function xo({withPrivacyBanner:e,onLoaded:t}){let r=useRef({customerPrivacy:false,privacyBanner:false}),[n,o]=useState(e?[false,false]:[false]),a=n.every(Boolean),s={customerPrivacy:()=>{o(e?c=>[true,c[1]]:()=>[true]);},privacyBanner:()=>{e&&o(c=>[c[0],true]);}};return useEffect(()=>{a&&t&&t();},[a,t]),{observing:r,setLoaded:s}}function sr(e){if(typeof window>"u")return;let t=window.document.location.host,r=e.split(".").reverse(),n=t.split(".").reverse(),o=[];return r.forEach((a,s)=>{a===n[s]&&o.push(a);}),o.reverse().join(".")}function ir({customerPrivacy:e,config:t}){let r=e.setTrackingConsent,{locale:n,country:o,...a}=t;function s(c,i){r({...a,headlessStorefront:true,...c},i);}return s}function cr({privacyBanner:e,config:t}){let r=e.loadBanner,n=e.showPreferences;function o(s){if(typeof s=="object"){r({...t,...s});return}r(t);}function a(s){if(typeof s=="object"){n({...t,...s});return}n(t);}return {loadBanner:o,showPreferences:a}}function de(){try{return window.Shopify&&window.Shopify.customerPrivacy?window.Shopify?.customerPrivacy:null}catch{return null}}function Le(){try{return window&&window?.privacyBanner?window.privacyBanner:null}catch{return null}}var ur="2025.4.0";function No(){let e=de();if(!e)throw new Error("Shopify Customer Privacy API not available. Must be used within a useEffect. Make sure to load the Shopify Customer Privacy API with useCustomerPrivacy() or <AnalyticsProvider>.");return e}function lr({consent:e,onReady:t,domain:r}){let{subscribe:n,register:o,canTrack:a}=G(),[s,c]=useState(false),[i,u]=useState(false),p=useRef(false),{checkoutDomain:l,storefrontAccessToken:m,language:y}=e,{ready:d}=o("Internal_Shopify_Analytics");return ot({...e,locale:y,checkoutDomain:l||"mock.shop",storefrontAccessToken:m||"abcdefghijklmnopqrstuvwxyz123456",onVisitorConsentCollected:()=>u(true),onReady:()=>u(true)}),useShopifyCookies({hasUserConsent:i?a():true,domain:r,checkoutDomain:l}),useEffect(()=>{p.current||(p.current=true,n(V.PAGE_VIEWED,Vo),n(V.PRODUCT_VIEWED,$o),n(V.COLLECTION_VIEWED,Fo),n(V.SEARCH_VIEWED,qo),n(V.PRODUCT_ADD_TO_CART,Ho),c(true));},[n]),useEffect(()=>{s&&i&&(d(),t());},[s,i,t]),null}function ke(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Pe(e){let t=No(),r=t.analyticsProcessingAllowed();if(!e?.shop?.shopId){ke("shopId");return}if(!e?.shop?.acceptedLanguage){ke("acceptedLanguage");return}if(!e?.shop?.currency){ke("currency");return}if(!e?.shop?.hydrogenSubchannelId){ke("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:ur,...e.shop,hasUserConsent:r,...getClientBrowserParameters(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed()),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed()}}function Mo(e,t){if(t===null)return;let r=Pe(e);return r?{...r,cartId:t.id}:void 0}var Z={};function Vo(e){let t=Pe(e);t&&(sendShopifyAnalytics({eventName:AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...Z}}),Z={});}function $o(e){let t=Pe(e);if(t&&yr({type:"product",products:e.products})){let r=nt(e.products);Z={pageType:AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...Z,products:nt(e.products)},sendShopifyAnalytics({eventName:AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function Fo(e){let t=Pe(e);t&&(Z={pageType:AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...Z,collectionHandle:e.collection.handle,collectionId:e.collection.id},sendShopifyAnalytics({eventName:AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function qo(e){let t=Pe(e);t&&(Z={pageType:AnalyticsPageType.search},t={...t,...Z,searchString:e.searchTerm},sendShopifyAnalytics({eventName:AnalyticsEventName.SEARCH_VIEW,payload:t}));}function Ho(e){let{cart:t,currentLine:r}=e,n=Mo(e,t);!n||!r?.id||Go({matchedLine:r,eventPayload:n});}function Go({matchedLine:e,eventPayload:t}){let r={id:e.merchandise.product.id,variantId:e.merchandise.id,title:e.merchandise.product.title,variantTitle:e.merchandise.title,vendor:e.merchandise.product.vendor,price:e.merchandise.price.amount,quantity:e.quantity,productType:e.merchandise.product.productType,sku:e.merchandise.sku};yr({type:"cart",products:[r]})&&sendShopifyAnalytics({eventName:AnalyticsEventName.ADD_TO_CART,payload:{...t,products:nt([r])}});}function ae(e,t,r,n){if(e==="cart"){let o=`${r?"merchandise":"merchandise.product"}.${t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up cart analytics events because the \`cart.lines[].${o}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartLine on CartLine\` is defined and make sure \`${o}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L25-L56.`);}else {let o=`${n||t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up product view analytics events because the \`${o}\` is missing from your \`<Analytics.ProductView>\`. Make sure \`${o}\` is part of your products data prop. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx#L159-L165.`);}}function yr({type:e,products:t}){return !t||t.length===0?(ae(e,"",false,"data.products"),false):(t.forEach(r=>{if(!r.id)return ae(e,"id",false),false;if(!r.title)return ae(e,"title",false),false;if(!r.price)return ae(e,"price.amount",true,"price"),false;if(!r.vendor)return ae(e,"vendor",false),false;if(!r.variantId)return ae(e,"id",true,"variantId"),false;if(!r.variantTitle)return ae(e,"title",true,"variantTitle"),false}),true)}function nt(e){return e.map(t=>{let r={productGid:t.id,variantGid:t.variantId,name:t.title,variantName:t.variantTitle,brand:t.vendor,price:t.price,quantity:t.quantity||1,category:t.productType};return t.sku&&(r.sku=t.sku),t.productType&&(r.category=t.productType),r})}function gr(e){console.error(`[h2:error:CartAnalytics] Can't set up cart analytics events because the \`cart.${e}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartApiQuery on Cart\` is defined and make sure \`${e}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L59.`);}function hr({cart:e,setCarts:t}){let{publish:r,shop:n,customData:o,canTrack:a,cart:s,prevCart:c}=G(),i=useRef(null);return useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){gr("id");return}if(!u.updatedAt){gr("updatedAt");return}}t(({cart:p,prevCart:l})=>u?.updatedAt!==p?.updatedAt?{cart:u,prevCart:p}:{cart:p,prevCart:l});}),()=>{}},[t,e]),useEffect(()=>{if(!s||!s?.updatedAt||s?.updatedAt===c?.updatedAt)return;let u;try{u=JSON.parse(localStorage.getItem("cartLastUpdatedAt")||"");}catch{u=null;}if(s.id===u?.id&&s.updatedAt===u?.updatedAt)return;let p={eventTimestamp:Date.now(),cart:s,prevCart:c,shop:n,customData:o};if(s.updatedAt===i.current)return;i.current=s.updatedAt,r("cart_updated",p),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:s.id,updatedAt:s.updatedAt}));let l=c?.lines?flattenConnection(c?.lines):[],m=s.lines?flattenConnection(s.lines):[];l?.forEach(y=>{let d=m.filter(g=>y.id===g.id);if(d?.length===1){let g=d[0];y.quantity<g.quantity?r("product_added_to_cart",{...p,prevLine:y,currentLine:g}):y.quantity>g.quantity&&r("product_removed_from_cart",{...p,prevLine:y,currentLine:g});}else r("product_removed_from_cart",{...p,prevLine:y});}),m?.forEach(y=>{let d=l.filter(g=>y.id===g.id);(!d||d.length===0)&&r("product_added_to_cart",{...p,currentLine:y});});},[s,c,r,n,o,a]),null}var zo="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function Cr({shop:e}){let t=useRef(false),{subscribe:r,register:n}=G(),{ready:o}=n("Internal_Shopify_Perf_Kit"),a=useLoadScript(zo,{attributes:{id:"perfkit","data-application":"hydrogen","data-shop-id":parseGid(e.shopId).id.toString(),"data-storefront-id":e.hydrogenSubchannelId,"data-monorail-region":"global","data-spa-mode":"true","data-resource-timing-sampling-rate":"100"}});return useEffect(()=>{a!=="done"||t.current||(t.current=true,r(V.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(V.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(V.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(V.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(V.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),o());},[r,o,a]),null}var Ar=new Set,B=e=>{Ar.has(e)||(console.warn(e),Ar.add(e));},Pr=new Set,st=e=>{Pr.has(e)||(console.error(new Error(e)),Pr.add(e));};var tn={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},Er=createContext(tn),Ve=new Map,Se={};function br(){return Object.values(Se).every(Boolean)}function Sr(e,t){Ve.has(e)||Ve.set(e,new Map),Ve.get(e)?.set(t.toString(),t);}var $e=new Map;function vr(e,t){if(!br()){$e.set(e,t);return}wr(e,t);}function wr(e,t){(Ve.get(e)??new Map).forEach((r,n)=>{try{r(t);}catch(o){typeof o=="object"&&o instanceof Error?console.error("Analytics publish error",o.message,n,o.stack):console.error("Analytics publish error",o,n);}});}function Tr(e){return Se.hasOwnProperty(e)||(Se[e]=false),{ready:()=>{Se[e]=true,br()&&$e.size>0&&($e.forEach((t,r)=>{wr(r,t);}),$e.clear());}}}function Ir(){try{return window.Shopify.customerPrivacy.analyticsProcessingAllowed()}catch{}return false}function Rr(e,t){return `[h2:error:Analytics.Provider] - ${e} is required. Make sure ${t} is defined in your environment variables. See https://h2o.fyi/analytics/consent to learn how to setup environment variables in the Shopify admin.`}function rn({canTrack:e,cart:t,children:r,consent:n,customData:o={},shop:a=null,cookieDomain:s}){let c=useRef(false),{shop:i}=on(a),[u,p]=useState(!!e),[l,m]=useState({cart:null,prevCart:null}),[y,d]=useState(e?()=>e:()=>Ir);if(i)if(/\/68817551382$/.test(i.shopId))B("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!n.checkoutDomain){let P=Rr("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");st(P);}if(!n.storefrontAccessToken){let P=Rr("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");st(P);}n?.country||(n.country="US"),n?.language||(n.language="EN"),n.withPrivacyBanner===void 0&&(n.withPrivacyBanner=false);}let g=useMemo(()=>({canTrack:y,...l,customData:o,publish:y()?vr:()=>{},shop:i,subscribe:Sr,register:Tr,customerPrivacy:de(),privacyBanner:Le()}),[u,y,l,l.cart?.updatedAt,l.prevCart,vr,Sr,o,i,Tr,JSON.stringify(Se),de,Le]);return jsxs(Er.Provider,{value:g,children:[r,!!i&&jsx(Xt,{}),!!i&&!!t&&jsx(hr,{cart:t,setCarts:m}),!!i&&n.checkoutDomain&&jsx(lr,{consent:n,onReady:()=>{c.current=true,p(true),d(e?()=>e:()=>Ir);},domain:s}),!!i&&jsx(Cr,{shop:i})]})}function G(){let e=useContext(Er);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function on(e){let[t,r]=useState(null);return useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function nn({storefront:e,publicStorefrontId:t="0"}){return e.query(an,{cache:e.CacheLong()}).then(({shop:r,localization:n})=>({shopId:r.id,acceptedLanguage:n.language.isoCode,currency:n.country.currency.isoCode,hydrogenSubchannelId:t}))}var an=`#graphql
1
+ import {createContext,forwardRef,useContext,lazy,useMemo,useEffect,useRef,useState,createElement,Fragment as Fragment$1,Suspense}from'react';import {useRevalidator,useFetcher,useFetchers,useNavigation,useLocation,useNavigate,Link,useMatches}from'@remix-run/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useLoadScript,useShopifyCookies,getTrackingValues,createStorefrontClient,SHOPIFY_STOREFRONT_ID_HEADER,SHOPIFY_STOREFRONT_Y_HEADER,SHOPIFY_STOREFRONT_S_HEADER,SHOPIFY_UNIQUE_TOKEN_HEADER,SHOPIFY_VISIT_TOKEN_HEADER,flattenConnection,RichText,ShopPayButton,parseGid,sendShopifyAnalytics,AnalyticsEventName,AnalyticsPageType,getClientBrowserParameters}from'@shopify/hydrogen-react';export{AnalyticsEventName,AnalyticsPageType,ExternalVideo,IMAGE_FRAGMENT,Image,MediaFile,ModelViewer,Money,ShopifySalesChannel,Video,customerAccountApiCustomScalars,decodeEncodedVariant,flattenConnection,getAdjacentAndFirstAvailableVariants,getClientBrowserParameters,getProductOptions,getShopifyCookies,getTrackingValues,isOptionValueCombinationInEncodedVariant,mapSelectedProductOptionToObject,parseGid,parseMetafield,sendShopifyAnalytics,storefrontApiCustomScalars,useLoadScript,useMoney,useSelectedOptionInUrlParam,useShopifyCookies}from'@shopify/hydrogen-react';import {parse,stringify}from'worktop/cookie';import {createRequestHandler}from'@remix-run/server-runtime';import Na from'content-security-policy-builder';function le(e){let{type:t,data:r={},customData:o}=e,n=useLocation(),{publish:a,cart:s,prevCart:c,shop:i,customData:u}=Y(),d=n.pathname+n.search,f={...r,customData:{...u,...o},cart:s,prevCart:c,shop:i};return useEffect(()=>{i?.shopId&&(f={...f,url:window.location.href},a(t,f));},[a,d,i?.shopId]),null}function pr(e){return jsx(le,{...e,type:"page_viewed"})}function dr(e){return jsx(le,{...e,type:"product_viewed"})}function lr(e){return jsx(le,{...e,type:"collection_viewed"})}function yr(e){return jsx(le,{...e,type:"cart_viewed"})}function fr(e){return jsx(le,{...e,type:"search_viewed"})}function mr(e){return jsx(le,{...e})}var F={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",CART_UPDATED:"cart_updated",PRODUCT_ADD_TO_CART:"product_added_to_cart",PRODUCT_REMOVED_FROM_CART:"product_removed_from_cart",CUSTOM_EVENT:"custom_"};var Me="Custom-Storefront-Request-Group-ID",He="X-Shopify-Storefront-Access-Token",dt="X-SDK-Variant",lt="X-SDK-Variant-Source",yt="X-SDK-Version",ft="X-Shopify-Client-IP",mt="X-Shopify-Client-IP-Sig",Fe="_sfapi_proxy",$e="_server_tracking";function Mo(e){return Object.entries(e).map(([t,r])=>r?`${t};desc=${r}`:void 0).filter(Boolean).join(", ")}function Pe(e,t){let r=typeof t=="string"?t:Mo(t);r&&e.headers.append("Server-Timing",r);}var Ho=["_y","_s","_cmp"];function gr(e){let t={};if(!e)return t;let r=new RegExp(`\\b(${Ho.join("|")});desc="?([^",]+)"?`,"g"),o;for(;(o=r.exec(e))!==null;)t[o[1]]=o[2];return t}function hr(e){if(typeof window>"u")return false;try{return !!window.performance.getEntriesByType("navigation")[0]?.serverTiming?.some(r=>r.name===e)}catch{return false}}function Cr(){return hr(Fe)}function Ar(){return hr($e)}var Qo="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js",Wo="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function ht(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function Ct(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:o,checkoutDomain:n,storefrontAccessToken:a,country:s,locale:c,sameDomainForStorefrontApi:i}=e,u=useMemo(()=>i??Cr(),[i]),d=useMemo(()=>u&&!Ar(),[u]),f=useShopifyCookies({fetchTrackingValues:d,storefrontAccessToken:a,ignoreDeprecatedCookies:true}),g=useMemo(getTrackingValues,[f]),{revalidate:y}=useRevalidator();useLoadScript(t?Wo:Qo,{attributes:{id:"customer-privacy-api"}});let{observing:p,setLoaded:l,apisLoaded:I}=Ko({withPrivacyBanner:t}),m=useMemo(()=>{n||ht("checkoutDomain"),a||ht("storefrontAccessToken"),(a.startsWith("shpat_")||a.length!==32)&&console.error("[h2:error:useCustomerPrivacy] It looks like you passed a private access token, make sure to use the public token");let S=Yo(n);return {checkoutRootDomain:u&&typeof window<"u"?window.location.host:n,storefrontRootDomain:S?"."+S:void 0,storefrontAccessToken:a,country:s,locale:c}},[ht,n,a,s,c]);useEffect(()=>{let S=T=>{let h=getTrackingValues();if((g.visitToken!==h.visitToken||g.uniqueToken!==h.uniqueToken)&&y(),r){let P=te();if(P?.shouldShowBanner()){let A=P.currentVisitorConsent();if(A){let _="";if(A.marketing===_&&A.analytics===_&&A.preferences===_)return}}r(T.detail);}};return document.addEventListener("visitorConsentCollected",S),()=>{document.removeEventListener("visitorConsentCollected",S);}},[r]),useEffect(()=>{if(!t||p.current.privacyBanner)return;p.current.privacyBanner=true;let S=window.privacyBanner||void 0;Object.defineProperty(window,"privacyBanner",{configurable:true,get(){return S},set(h){typeof h=="object"&&h!==null&&"showPreferences"in h&&"loadBanner"in h&&(S=vr({privacyBanner:h,config:m}),l.privacyBanner());}});},[t,m,vr,l.privacyBanner]),useEffect(()=>{if(p.current.customerPrivacy)return;p.current.customerPrivacy=true;let S=null,T=window.Shopify||void 0;Object.defineProperty(window,"Shopify",{configurable:true,get(){return T},set(h){typeof h=="object"&&h!==null&&Object.keys(h).length===0&&(T=h,Object.defineProperty(window.Shopify,"customerPrivacy",{configurable:true,get(){return S},set(P){if(typeof P=="object"&&P!==null&&"setTrackingConsent"in P){let A=P;S={...A,setTrackingConsent:Pr({customerPrivacy:A,config:m})},T={...T,customerPrivacy:S},l.customerPrivacy();}}}));}});},[m,Pr,l.customerPrivacy]),useEffect(()=>{if(!I||!f)return;let S=te();if(S&&!S.cachedConsent){let T=getTrackingValues();T.consent&&(S.cachedConsent=T.consent);}if(t){let T=ve();T&&T.loadBanner(m);}jo(),o?.();},[I,f]);let C={customerPrivacy:te()};return t&&(C.privacyBanner=ve()),C}var Sr=false;function jo(){if(Sr)return;Sr=true;let e=new CustomEvent("shopifyCustomerPrivacyApiLoaded");document.dispatchEvent(e);}function Ko({withPrivacyBanner:e}){let t=useRef({customerPrivacy:false,privacyBanner:false}),[r,o]=useState(e?[false,false]:[false]),n=r.every(Boolean);return {observing:t,setLoaded:{customerPrivacy:()=>{o(e?s=>[true,s[1]]:()=>[true]);},privacyBanner:()=>{e&&o(s=>[s[0],true]);}},apisLoaded:n}}function Yo(e){if(typeof window>"u")return;let t=window.location.host,r=e.split(".").reverse(),o=t.split(".").reverse(),n=[];return r.forEach((a,s)=>{a===o[s]&&n.push(a);}),n.reverse().join(".")||void 0}function Pr({customerPrivacy:e,config:t}){let r=e.setTrackingConsent,{locale:o,country:n,...a}=t;function s(c,i){r({...a,headlessStorefront:true,...c},i);}return s}function vr({privacyBanner:e,config:t}){let r=e.loadBanner,o=e.showPreferences;function n(s){if(typeof s=="object"){r({...t,...s});return}r(t);}function a(s){if(typeof s=="object"){o({...t,...s});return}o(t);}return {loadBanner:n,showPreferences:a}}function te(){try{return window.Shopify&&window.Shopify.customerPrivacy?window.Shopify?.customerPrivacy:null}catch{return null}}function ve(){try{return window&&window?.privacyBanner?window.privacyBanner:null}catch{return null}}var Tr="2025.4.2";function tn(){let e=te();if(!e)throw new Error("Shopify Customer Privacy API not available. Must be used within a useEffect. Make sure to load the Shopify Customer Privacy API with useCustomerPrivacy() or <AnalyticsProvider>.");return e}function Rr({consent:e,onReady:t,domain:r}){let{subscribe:o,register:n,canTrack:a}=Y(),[s,c]=useState(false),[i,u]=useState(false),[d,f]=useState(""),g=useRef(false),{checkoutDomain:y,storefrontAccessToken:p,language:l}=e,{ready:I}=n("Internal_Shopify_Analytics");Ct({...e,locale:l,checkoutDomain:y||"mock.shop",storefrontAccessToken:p||"abcdefghijklmnopqrstuvwxyz123456",onReady:()=>!e.withPrivacyBanner&&u(true),onVisitorConsentCollected:C=>{try{f(JSON.stringify(C));}catch{}u(true);}});let m=useMemo(()=>i?a():true,[i,a,d]);return useShopifyCookies({hasUserConsent:m,domain:r,checkoutDomain:y,fetchTrackingValues:false,ignoreDeprecatedCookies:!i}),useEffect(()=>{g.current||(g.current=true,o(F.PAGE_VIEWED,on),o(F.PRODUCT_VIEWED,nn),o(F.COLLECTION_VIEWED,an),o(F.SEARCH_VIEWED,sn),o(F.PRODUCT_ADD_TO_CART,cn),c(true));},[o]),useEffect(()=>{s&&i&&(I(),t());},[s,i,t]),null}function Be(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Re(e){let t=tn(),r=t.analyticsProcessingAllowed();if(!e?.shop?.shopId){Be("shopId");return}if(!e?.shop?.acceptedLanguage){Be("acceptedLanguage");return}if(!e?.shop?.currency){Be("currency");return}if(!e?.shop?.hydrogenSubchannelId){Be("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:Tr,...e.shop,hasUserConsent:r,...getClientBrowserParameters(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function rn(e,t){if(t===null)return;let r=Re(e);return r?{...r,cartId:t.id}:void 0}var re={};function on(e){let t=Re(e);t&&(sendShopifyAnalytics({eventName:AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...re}}),re={});}function nn(e){let t=Re(e);if(t&&Er({type:"product",products:e.products})){let r=St(e.products);re={pageType:AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...re,products:St(e.products)},sendShopifyAnalytics({eventName:AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function an(e){let t=Re(e);t&&(re={pageType:AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...re,collectionHandle:e.collection.handle,collectionId:e.collection.id},sendShopifyAnalytics({eventName:AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function sn(e){let t=Re(e);t&&(re={pageType:AnalyticsPageType.search},t={...t,...re,searchString:e.searchTerm},sendShopifyAnalytics({eventName:AnalyticsEventName.SEARCH_VIEW,payload:t}));}function cn(e){let{cart:t,currentLine:r}=e,o=rn(e,t);!o||!r?.id||un({matchedLine:r,eventPayload:o});}function un({matchedLine:e,eventPayload:t}){let r={id:e.merchandise.product.id,variantId:e.merchandise.id,title:e.merchandise.product.title,variantTitle:e.merchandise.title,vendor:e.merchandise.product.vendor,price:e.merchandise.price.amount,quantity:e.quantity,productType:e.merchandise.product.productType,sku:e.merchandise.sku};Er({type:"cart",products:[r]})&&sendShopifyAnalytics({eventName:AnalyticsEventName.ADD_TO_CART,payload:{...t,products:St([r])}});}function ie(e,t,r,o){if(e==="cart"){let n=`${r?"merchandise":"merchandise.product"}.${t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up cart analytics events because the \`cart.lines[].${n}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartLine on CartLine\` is defined and make sure \`${n}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L25-L56.`);}else {let n=`${o||t}`;console.error(`[h2:error:ShopifyAnalytics] Can't set up product view analytics events because the \`${n}\` is missing from your \`<Analytics.ProductView>\`. Make sure \`${n}\` is part of your products data prop. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx#L159-L165.`);}}function Er({type:e,products:t}){return !t||t.length===0?(ie(e,"",false,"data.products"),false):(t.forEach(r=>{if(!r.id)return ie(e,"id",false),false;if(!r.title)return ie(e,"title",false),false;if(!r.price)return ie(e,"price.amount",true,"price"),false;if(!r.vendor)return ie(e,"vendor",false),false;if(!r.variantId)return ie(e,"id",true,"variantId"),false;if(!r.variantTitle)return ie(e,"title",true,"variantTitle"),false}),true)}function St(e){return e.map(t=>{let r={productGid:t.id,variantGid:t.variantId,name:t.title,variantName:t.variantTitle,brand:t.vendor,price:t.price,quantity:t.quantity||1,category:t.productType};return t.sku&&(r.sku=t.sku),t.productType&&(r.category=t.productType),r})}function Or(e){console.error(`[h2:error:CartAnalytics] Can't set up cart analytics events because the \`cart.${e}\` value is missing from your GraphQL cart query. In your project, search for where \`fragment CartApiQuery on Cart\` is defined and make sure \`${e}\` is part of your cart query. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L59.`);}function xr({cart:e,setCarts:t}){let{publish:r,shop:o,customData:n,canTrack:a,cart:s,prevCart:c}=Y(),i=useRef(null);return useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){Or("id");return}if(!u.updatedAt){Or("updatedAt");return}}t(({cart:d,prevCart:f})=>u?.updatedAt!==d?.updatedAt?{cart:u,prevCart:d}:{cart:d,prevCart:f});}),()=>{}},[t,e]),useEffect(()=>{if(!s||!s?.updatedAt||s?.updatedAt===c?.updatedAt)return;let u;try{u=JSON.parse(localStorage.getItem("cartLastUpdatedAt")||"");}catch{u=null;}if(s.id===u?.id&&s.updatedAt===u?.updatedAt)return;let d={eventTimestamp:Date.now(),cart:s,prevCart:c,shop:o,customData:n};if(s.updatedAt===i.current)return;i.current=s.updatedAt,r("cart_updated",d),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:s.id,updatedAt:s.updatedAt}));let f=c?.lines?flattenConnection(c?.lines):[],g=s.lines?flattenConnection(s.lines):[];f?.forEach(y=>{let p=g.filter(l=>y.id===l.id);if(p?.length===1){let l=p[0];y.quantity<l.quantity?r("product_added_to_cart",{...d,prevLine:y,currentLine:l}):y.quantity>l.quantity&&r("product_removed_from_cart",{...d,prevLine:y,currentLine:l});}else r("product_removed_from_cart",{...d,prevLine:y});}),g?.forEach(y=>{let p=f.filter(l=>y.id===l.id);(!p||p.length===0)&&r("product_added_to_cart",{...d,currentLine:y});});},[s,c,r,o,n,a]),null}var mn="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function Dr({shop:e}){let t=useRef(false),{subscribe:r,register:o}=Y(),{ready:n}=o("Internal_Shopify_Perf_Kit"),a=useLoadScript(mn,{attributes:{id:"perfkit","data-application":"hydrogen","data-shop-id":parseGid(e.shopId).id.toString(),"data-storefront-id":e.hydrogenSubchannelId,"data-monorail-region":"global","data-spa-mode":"true","data-resource-timing-sampling-rate":"100"}});return useEffect(()=>{a!=="done"||t.current||(t.current=true,r(F.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(F.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(F.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(F.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(F.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),n());},[r,n,a]),null}var _r=new Set,B=e=>{_r.has(e)||(console.warn(e),_r.add(e));},Ur=new Set,vt=e=>{Ur.has(e)||(console.error(new Error(e)),Ur.add(e));};var Sn={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},Hr=createContext(Sn),We=new Map,be={};function Fr(){return Object.values(be).every(Boolean)}function Lr(e,t){We.has(e)||We.set(e,new Map),We.get(e)?.set(t.toString(),t);}var je=new Map;function kr(e,t){if(!Fr()){je.set(e,t);return}$r(e,t);}function $r(e,t){(We.get(e)??new Map).forEach((r,o)=>{try{r(t);}catch(n){typeof n=="object"&&n instanceof Error?console.error("Analytics publish error",n.message,o,n.stack):console.error("Analytics publish error",n,o);}});}function Nr(e){return be.hasOwnProperty(e)||(be[e]=false),{ready:()=>{be[e]=true,Fr()&&je.size>0&&(je.forEach((t,r)=>{$r(r,t);}),je.clear());}}}function Vr(){try{return window.Shopify.customerPrivacy.analyticsProcessingAllowed()}catch{}return false}function Mr(e,t){return `[h2:error:Analytics.Provider] - ${e} is required. Make sure ${t} is defined in your environment variables. See https://h2o.fyi/analytics/consent to learn how to setup environment variables in the Shopify admin.`}function Pn({canTrack:e,cart:t,children:r,consent:o,customData:n={},shop:a=null,cookieDomain:s}){let{shop:c}=vn(a),[i,u]=useState(!!e),[d,f]=useState(false),[g,y]=useState({cart:null,prevCart:null}),[p,l]=useState(e?()=>e:()=>Vr);if(c)if(/\/68817551382$/.test(c.shopId))B("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!o.checkoutDomain){let m=Mr("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");vt(m);}if(!o.storefrontAccessToken){let m=Mr("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");vt(m);}o?.country||(o.country="US"),o?.language||(o.language="EN"),o.withPrivacyBanner===void 0&&(o.withPrivacyBanner=false);}let I=useMemo(()=>({canTrack:p,...g,customData:n,publish:p()?kr:()=>{},shop:c,subscribe:Lr,register:Nr,customerPrivacy:te(),privacyBanner:ve()}),[i,p,g,g.cart?.updatedAt,g.prevCart,kr,Lr,n,c,Nr,JSON.stringify(be),te,ve]);return jsxs(Hr.Provider,{value:I,children:[r,!!c&&jsx(pr,{}),!!c&&!!t&&jsx(xr,{cart:t,setCarts:y}),!!c&&jsx(Rr,{consent:o,onReady:()=>{u(true),l(e?()=>e:()=>Vr),f(true);},domain:s}),!!c&&d&&jsx(Dr,{shop:c})]})}function Y(){let e=useContext(Hr);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function vn(e){let[t,r]=useState(null);return useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function Tn({storefront:e,publicStorefrontId:t="0"}){return e.query(In,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var In=`#graphql
2
2
  query ShopData(
3
3
  $country: CountryCode
4
4
  $language: LanguageCode
@@ -17,15 +17,15 @@ import {createContext,forwardRef,useContext,lazy,useMemo,useEffect,useRef,useSta
17
17
  }
18
18
  }
19
19
  }
20
- `,sn={CartView:tr,CollectionView:er,CustomView:or,ProductView:Zt,Provider:rn,SearchView:rr};function Q(e,t){return it(e.headers,t)}function it(e,t){let r=e?.get?.(t)??e?.[t];return typeof r=="string"?r:null}function ee(e){return {requestId:e?Q(e,"request-id"):void 0,purpose:e?Q(e,"purpose"):void 0}}function le(e,t={}){let r=new Error,n=(o,a="Error")=>{let s=(r.stack??"").split(`
20
+ `,Rn={CartView:yr,CollectionView:lr,CustomView:mr,ProductView:dr,Provider:Pn,SearchView:fr};function Q(e,t){return Tt(e.headers,t)}function Tt(e,t){let r=e?.get?.(t)??e?.[t];return typeof r=="string"?r:null}function oe(e){return {requestId:e?Q(e,"request-id"):void 0,purpose:e?Q(e,"purpose"):void 0}}var It=/^\/api\/(unstable|2\d{3}-\d{2})\/graphql\.json$/,Rt=e=>{try{return new URL(e,"http://e.c").pathname}catch{return "/"}};function Et(e,t){return t.reduce((r,o)=>{let n=e(o);return n&&r.push([o,n]),r},[])}function fe(e,t={}){let r=new Error,o=(n,a="Error")=>{let s=(r.stack??"").split(`
21
21
  `).slice(3+(t.stackOffset??0)).join(`
22
- `).replace(/ at loader(\d+) \(/,(c,i)=>c.replace(i,""));return `${a}: ${o}
23
- `+s};return e.then(o=>{if(o?.errors&&Array.isArray(o.errors)){let a=typeof t.logErrors=="function"?t.logErrors:()=>t.logErrors??false;o.errors.forEach(s=>{s&&(s.stack=n(s.message,s.name),a(s)&&console.error(s));});}return o}).catch(o=>{throw o&&(o.stack=n(o.message,o.name)),o})}var F=void 0;var Fe="public",un="private",ct="no-store",Or={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function ve(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):Or[r]&&t.push(`${Or[r]}=${e[r]}`);}),t.join(", ")}function ut(){return {mode:ct}}function pt(e){if(e?.mode&&e?.mode!==Fe&&e?.mode!==un)throw Error("'mode' must be either 'public' or 'private'")}function se(e){return pt(e),{mode:Fe,maxAge:1,staleWhileRevalidate:9,...e}}function dt(e){return pt(e),{mode:Fe,maxAge:3600,staleWhileRevalidate:82800,...e}}function ye(e){return pt(e),{mode:Fe,maxAge:1,staleWhileRevalidate:86399,...e}}function lt(e){return e}function W(e){return String(e).includes("__proto__")?JSON.parse(e,pn):JSON.parse(e)}function pn(e,t){if(e!=="__proto__")return t}function qe(e,t){return e&&t?{...e,...t}:e||ye()}function yt(e){return ve(qe(e))}async function dn(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function ln(e,t,r,n){if(!e)return;let o=qe(n),a=yt(qe(o,{maxAge:(o.maxAge||0)+(o.staleWhileRevalidate||0)})),s=yt(qe(o));r.headers.set("cache-control",a),r.headers.set("real-cache-control",s),r.headers.set("cache-put-date",String(Date.now())),await e.put(t,r);}async function yn(e,t){e&&await e.delete(t);}function fn(e,t){let r=e.headers.get("real-cache-control"),n=0;if(r){let a=r.match(/max-age=(\d*)/);a&&a.length>1&&(n=parseFloat(a[1]));}return [(Date.now()-Number(t))/1e3,n]}function mn(e,t){let r=t.headers.get("cache-put-date");if(!r)return false;let[n,o]=fn(t,r),a=n>o;return a}var He={get:dn,set:ln,delete:yn,generateDefaultCacheControlHeader:yt,isStale:mn};function Te(e){return `https://shopify.dev/?${e}`}function gn(e){return e||ye()}async function Dr(e,t){if(!e)return;let r=Te(t),n=new Request(r),o=await He.get(e,n);if(!o)return;let a=await o.text();try{return [W(a),o]}catch{return [a,o]}}async function xr(e,t,r,n){if(!e)return;let o=Te(t),a=new Request(o),s=new Response(JSON.stringify(r));await He.set(e,a,s,gn(n));}function _r(e,t){return He.isStale(new Request(Te(e)),t)}function Ur(e){let t=Array.isArray(e)?e:[e],r="";for(let n of t)n!=null&&(typeof n=="object"?r+=JSON.stringify(n):r+=n.toString());return encodeURIComponent(r)}var ft=new Set;async function Ge(e,t,{strategy:r=se(),cacheInstance:n,shouldCacheResult:o=()=>true,waitUntil:a,debugInfo:s}){let i=Ur([...typeof e=="string"?[e]:e]),l=f=>{({displayName:f.displayName,url:f.response?.url,responseInit:{status:f.response?.status||0,statusText:f.response?.statusText||"",headers:Array.from(f.response?.headers.entries()||[])}});},y=void 0;if(!n||!r||r.mode===ct){let f=await t({addDebugData:l});return f}let d=f=>xr(n,i,{value:f,debugInfo:void 0},r),g=await Dr(n,i);if(g&&typeof g[0]!="string"){let[{value:f,debugInfo:C},v]=g;let b=_r(i,v)?"STALE":"HIT";if(!ft.has(i)&&b==="STALE"){ft.add(i);let x=Promise.resolve().then(async()=>{let k=Date.now();try{let O=await t({addDebugData:l});o(O)&&(await d(O),y?.({result:O,cacheStatus:"PUT",overrideStartTime:k}));}catch(O){O.message&&(O.message="SWR in sub-request failed: "+O.message),console.error(O);}finally{ft.delete(i);}});a?.(x);}return f}let P=await t({addDebugData:l});if(o(P)){let f=Promise.resolve().then(async()=>{await d(P);});a?.(f);}return P}function hn(e,t){return [e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}function Lr([e,t]){return [e,new Response(e,t)]}async function Be(e,t,{cacheInstance:r,cache:n,cacheKey:o=[e,t],shouldCacheResponse:a,waitUntil:s,debugInfo:c}){return !n&&(!t.method||t.method==="GET")&&(n=se()),Ge(o,async()=>{let i=await fetch(e,t);if(!i.ok)return i;let u=await i.text().catch(()=>"");try{u&&(u=W(u));}catch{}return hn(u,i)},{cacheInstance:r,waitUntil:s,strategy:n??null,debugInfo:c,shouldCacheResult:i=>"ok"in i?!1:a(...Lr(i))}).then(i=>"ok"in i?[null,i]:Lr(i))}function Cn(e){let{cache:t,waitUntil:r,request:n}=e;return {run:({cacheKey:o,cacheStrategy:a,shouldCacheResult:s},c)=>Ge(o,c,{shouldCacheResult:s,strategy:a,cacheInstance:t,waitUntil:r,debugInfo:{...ee(n),stackInfo:F?.()}}),fetch:(o,a,s)=>Be(o,a??{},{waitUntil:r,cacheKey:[o,a],cacheInstance:t,debugInfo:{url:o,...ee(n),stackInfo:F?.(),displayName:s?.displayName},cache:s.cacheStrategy,...s}).then(([c,i])=>({data:c,response:i}))}}var mt=class{#e;constructor(){this.#e=new Map;}add(t){throw new Error("Method not implemented. Use `put` instead.")}addAll(t){throw new Error("Method not implemented. Use `put` instead.")}matchAll(t,r){throw new Error("Method not implemented. Use `match` instead.")}async put(t,r){if(t.method!=="GET")throw new TypeError("Cannot cache response to non-GET request.");if(r.status===206)throw new TypeError("Cannot cache response to a range request (206 Partial Content).");if(r.headers.get("vary")?.includes("*"))throw new TypeError("Cannot cache response with 'Vary: *' header.");this.#e.set(t.url,{body:new Uint8Array(await r.arrayBuffer()),status:r.status,headers:[...r.headers],timestamp:Date.now()});}async match(t){if(t.method!=="GET")return;let r=this.#e.get(t.url);if(!r)return;let{body:n,timestamp:o,...a}=r,s=new Headers(a.headers),c=s.get("cache-control")||s.get("real-cache-control")||"",i=parseInt(c.match(/max-age=(\d+)/)?.[1]||"0",10),u=parseInt(c.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),p=(Date.now()-o)/1e3;if(p>i+u){this.#e.delete(t.url);return}let m=p>i;return s.set("cache",m?"STALE":"HIT"),s.set("date",new Date(o).toUTCString()),new Response(n,{status:a.status??200,headers:s})}async delete(t){return this.#e.has(t.url)?(this.#e.delete(t.url),true):false}keys(t){let r=[];for(let n of this.#e.keys())(!t||t.url===n)&&r.push(new Request(n));return Promise.resolve(r)}};var kr="cartFormInput";function j({children:e,action:t,inputs:r,route:n,fetcherKey:o}){let a=useFetcher({key:o});return jsxs(a.Form,{action:n||"",method:"post",children:[(t||r)&&jsx("input",{type:"hidden",name:kr,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}j.INPUT_NAME=kr;j.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",GiftCardCodesUpdate:"GiftCardCodesUpdate",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete",DeliveryAddressesAdd:"DeliveryAddressesAdd",DeliveryAddressesUpdate:"DeliveryAddressesUpdate",DeliveryAddressesRemove:"DeliveryAddressesRemove"};function Pn(e){let t={};for(let s of e.entries()){let c=s[0],i=e.getAll(c);t[c]=i.length>1?i:s[1],t[c]==="on"?t[c]=true:t[c]==="off"&&(t[c]=false);}let{cartFormInput:r,...n}=t,{action:o,inputs:a}=r?JSON.parse(String(r)):{};return {action:o,inputs:{...a,...n}}}j.getFormInput=Pn;var gt=e=>{let t=parse(it(e,"Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var ht=e=>t=>{let r=new Headers;return r.append("Set-Cookie",stringify("cart",t.split("/").pop()||"",{path:"/",...e})),r};var Ct="Custom-Storefront-Request-Group-ID",At="X-Shopify-Storefront-Access-Token",Pt="X-SDK-Variant",St="X-SDK-Variant-Source",vt="X-SDK-Version";function Nr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var Ie="2025.4.0";function fe(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var Rn=/(^|}\s)query[\s({]/im,En=/(^|}\s)mutation[\s({]/im;function Qe(e,t){if(!Rn.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function We(e,t){if(!En.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}var ie=class extends Error{locations;path;extensions;constructor(t,r={}){let o=(r.clientOperation?`[h2:error:${r.clientOperation}] `:"")+t+(r.requestId?` - Request ID: ${r.requestId}`:"");super(o),this.name="GraphQLError",this.extensions=r.extensions,this.locations=r.locations,this.path=r.path,this.stack=r.stack||void 0;try{this.cause=JSON.stringify({...typeof r.cause=="object"?r.cause:{},requestId:r.requestId});}catch{r.cause&&(this.cause=r.cause);}}get[Symbol.toStringTag](){return this.name}toString(){let t=`${this.name}: ${this.message}`;if(this.path)try{t+=` | path: ${JSON.stringify(this.path)}`;}catch{}if(this.extensions)try{t+=` | extensions: ${JSON.stringify(this.extensions)}`;}catch{}return t+=`
22
+ `).replace(/ at loader(\d+) \(/,(c,i)=>c.replace(i,""));return `${a}: ${n}
23
+ `+s};return e.then(n=>{if(n?.errors&&Array.isArray(n.errors)){let a=typeof t.logErrors=="function"?t.logErrors:()=>t.logErrors??false;n.errors.forEach(s=>{s&&(s.stack=o(s.message,s.name),a(s)&&console.error(s));});}return n}).catch(n=>{throw n&&(n.stack=o(n.message,n.name)),n})}var W=void 0;var Ke="public",bn="private",bt="no-store",qr={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function we(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):qr[r]&&t.push(`${qr[r]}=${e[r]}`);}),t.join(", ")}function wt(){return {mode:bt}}function Ot(e){if(e?.mode&&e?.mode!==Ke&&e?.mode!==bn)throw Error("'mode' must be either 'public' or 'private'")}function ce(e){return Ot(e),{mode:Ke,maxAge:1,staleWhileRevalidate:9,...e}}function xt(e){return Ot(e),{mode:Ke,maxAge:3600,staleWhileRevalidate:82800,...e}}function me(e){return Ot(e),{mode:Ke,maxAge:1,staleWhileRevalidate:86399,...e}}function Dt(e){return e}function z(e){return String(e).includes("__proto__")?JSON.parse(e,wn):JSON.parse(e)}function wn(e,t){if(e!=="__proto__")return t}function Ye(e,t){return e&&t?{...e,...t}:e||me()}function _t(e){return we(Ye(e))}async function On(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function xn(e,t,r,o){if(!e)return;let n=Ye(o),a=_t(Ye(n,{maxAge:(n.maxAge||0)+(n.staleWhileRevalidate||0)})),s=_t(Ye(n));r.headers.set("cache-control",a),r.headers.set("real-cache-control",s),r.headers.set("cache-put-date",String(Date.now())),await e.put(t,r);}async function Dn(e,t){e&&await e.delete(t);}function _n(e,t){let r=e.headers.get("real-cache-control"),o=0;if(r){let a=r.match(/max-age=(\d*)/);a&&a.length>1&&(o=parseFloat(a[1]));}return [(Date.now()-Number(t))/1e3,o]}function Un(e,t){let r=t.headers.get("cache-put-date");if(!r)return false;let[o,n]=_n(t,r),a=o>n;return a}var ze={get:On,set:xn,delete:Dn,generateDefaultCacheControlHeader:_t,isStale:Un};function Oe(e){return `https://shopify.dev/?${e}`}function Ln(e){return e||me()}async function Gr(e,t){if(!e)return;let r=Oe(t),o=new Request(r),n=await ze.get(e,o);if(!n)return;let a=await n.text();try{return [z(a),n]}catch{return [a,n]}}async function Br(e,t,r,o){if(!e)return;let n=Oe(t),a=new Request(n),s=new Response(JSON.stringify(r));await ze.set(e,a,s,Ln(o));}function Qr(e,t){return ze.isStale(new Request(Oe(e)),t)}function Wr(e){let t=Array.isArray(e)?e:[e],r="";for(let o of t)o!=null&&(typeof o=="object"?r+=JSON.stringify(o):r+=o.toString());return encodeURIComponent(r)}var Ut=new Set;async function Je(e,t,{strategy:r=ce(),cacheInstance:o,shouldCacheResult:n=()=>true,waitUntil:a,debugInfo:s}){let i=Wr([...typeof e=="string"?[e]:e]),f=m=>{({displayName:m.displayName,url:m.response?.url,responseInit:{status:m.response?.status||0,statusText:m.response?.statusText||"",headers:Array.from(m.response?.headers.entries()||[])}});},y=void 0;if(!o||!r||r.mode===bt){let m=await t({addDebugData:f});return m}let p=m=>Br(o,i,{value:m,debugInfo:void 0},r),l=await Gr(o,i);if(l&&typeof l[0]!="string"){let[{value:m,debugInfo:C},S]=l;let T=Qr(i,S)?"STALE":"HIT";if(!Ut.has(i)&&T==="STALE"){Ut.add(i);let h=Promise.resolve().then(async()=>{let P=Date.now();try{let A=await t({addDebugData:f});n(A)&&(await p(A),y?.({result:A,cacheStatus:"PUT",overrideStartTime:P}));}catch(A){A.message&&(A.message="SWR in sub-request failed: "+A.message),console.error(A);}finally{Ut.delete(i);}});a?.(h);}return m}let I=await t({addDebugData:f});if(n(I)){let m=Promise.resolve().then(async()=>{await p(I);});a?.(m);}return I}var kn=["set-cookie","server-timing"];function Nn(e,t){return [e,{status:t.status,statusText:t.statusText,headers:[...t.headers].filter(([r])=>!kn.includes(r.toLowerCase()))}]}function jr([e,t]){return [e,new Response(e,t)]}async function Xe(e,t,{cacheInstance:r,cache:o,cacheKey:n=[e,t],shouldCacheResponse:a,waitUntil:s,debugInfo:c,onRawHeaders:i}){return !o&&(!t.method||t.method==="GET")&&(o=ce()),Je(n,async()=>{let u=await fetch(e,t);if(i?.(u.headers),!u.ok)return u;let d=await u.text().catch(()=>"");try{d&&(d=z(d));}catch{}return Nn(d,u)},{cacheInstance:r,waitUntil:s,strategy:o??null,debugInfo:c,shouldCacheResult:u=>"ok"in u?!1:a(...jr(u))}).then(u=>"ok"in u?[null,u]:jr(u))}function Vn(e){let{cache:t,waitUntil:r,request:o}=e;return {run:({cacheKey:n,cacheStrategy:a,shouldCacheResult:s},c)=>Je(n,c,{shouldCacheResult:s,strategy:a,cacheInstance:t,waitUntil:r,debugInfo:{...oe(o),stackInfo:W?.()}}),fetch:(n,a,s)=>Xe(n,a??{},{waitUntil:r,cacheKey:[n,a],cacheInstance:t,debugInfo:{url:n,...oe(o),stackInfo:W?.(),displayName:s?.displayName},cache:s.cacheStrategy,...s}).then(([c,i])=>({data:c,response:i}))}}var Lt=class{#e;constructor(){this.#e=new Map;}add(t){throw new Error("Method not implemented. Use `put` instead.")}addAll(t){throw new Error("Method not implemented. Use `put` instead.")}matchAll(t,r){throw new Error("Method not implemented. Use `match` instead.")}async put(t,r){if(t.method!=="GET")throw new TypeError("Cannot cache response to non-GET request.");if(r.status===206)throw new TypeError("Cannot cache response to a range request (206 Partial Content).");if(r.headers.get("vary")?.includes("*"))throw new TypeError("Cannot cache response with 'Vary: *' header.");this.#e.set(t.url,{body:new Uint8Array(await r.arrayBuffer()),status:r.status,headers:[...r.headers],timestamp:Date.now()});}async match(t){if(t.method!=="GET")return;let r=this.#e.get(t.url);if(!r)return;let{body:o,timestamp:n,...a}=r,s=new Headers(a.headers),c=s.get("cache-control")||s.get("real-cache-control")||"",i=parseInt(c.match(/max-age=(\d+)/)?.[1]||"0",10),u=parseInt(c.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),d=(Date.now()-n)/1e3;if(d>i+u){this.#e.delete(t.url);return}let g=d>i;return s.set("cache",g?"STALE":"HIT"),s.set("date",new Date(n).toUTCString()),new Response(o,{status:a.status??200,headers:s})}async delete(t){return this.#e.has(t.url)?(this.#e.delete(t.url),true):false}keys(t){let r=[];for(let o of this.#e.keys())(!t||t.url===o)&&r.push(new Request(o));return Promise.resolve(r)}};var Kr="cartFormInput";function J({children:e,action:t,inputs:r,route:o,fetcherKey:n}){let a=useFetcher({key:n});return jsxs(a.Form,{action:o||"",method:"post",children:[(t||r)&&jsx("input",{type:"hidden",name:Kr,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}J.INPUT_NAME=Kr;J.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",GiftCardCodesUpdate:"GiftCardCodesUpdate",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete",DeliveryAddressesAdd:"DeliveryAddressesAdd",DeliveryAddressesUpdate:"DeliveryAddressesUpdate",DeliveryAddressesRemove:"DeliveryAddressesRemove"};function Hn(e){let t={};for(let s of e.entries()){let c=s[0],i=e.getAll(c);t[c]=i.length>1?i:s[1],t[c]==="on"?t[c]=true:t[c]==="off"&&(t[c]=false);}let{cartFormInput:r,...o}=t,{action:n,inputs:a}=r?JSON.parse(String(r)):{};return {action:n,inputs:{...a,...o}}}J.getFormInput=Hn;var kt=e=>{let t=parse(Tt(e,"Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var Nt=e=>t=>{let r=new Headers;return r.append("Set-Cookie",stringify("cart",t.split("/").pop()||"",{path:"/",...e})),r};function Ze(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var xe="2025.4.2";function ge(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var Bn=/(^|}\s)query[\s({]/im,Qn=/(^|}\s)mutation[\s({]/im;function et(e,t){if(!Bn.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function tt(e,t){if(!Qn.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}var ue=class extends Error{locations;path;extensions;constructor(t,r={}){let n=(r.clientOperation?`[h2:error:${r.clientOperation}] `:"")+t+(r.requestId?` - Request ID: ${r.requestId}`:"");super(n),this.name="GraphQLError",this.extensions=r.extensions,this.locations=r.locations,this.path=r.path,this.stack=r.stack||void 0;try{this.cause=JSON.stringify({...typeof r.cause=="object"?r.cause:{},requestId:r.requestId});}catch{r.cause&&(this.cause=r.cause);}}get[Symbol.toStringTag](){return this.name}toString(){let t=`${this.name}: ${this.message}`;if(this.path)try{t+=` | path: ${JSON.stringify(this.path)}`;}catch{}if(this.extensions)try{t+=` | extensions: ${JSON.stringify(this.extensions)}`;}catch{}return t+=`
24
24
  `,this.stack&&(t+=`${this.stack.slice(this.stack.indexOf(`
25
25
  `)+1)}
26
- `),t}toJSON(){return {name:"Error",message:""}}};function Re({url:e,response:t,errors:r,type:n,query:o,queryVariables:a,ErrorConstructor:s=Error,client:c="storefront"}){let i=(typeof r=="string"?r:r?.map?.(p=>p.message).join(`
26
+ `),t}toJSON(){return {name:"Error",message:""}}};function De({url:e,response:t,errors:r,type:o,query:n,queryVariables:a,ErrorConstructor:s=Error,client:c="storefront"}){let i=(typeof r=="string"?r:r?.map?.(d=>d.message).join(`
27
27
  `))||`URL: ${e}
28
- API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{errors:r},clientOperation:`${c}.${n}`,requestId:t.headers.get("x-request-id")});throw new s(u.message,{cause:u.cause})}var _n={language:"EN",country:"US"};function Fr(e){let {storefrontHeaders:t,cache:r,waitUntil:n,i18n:o,storefrontId:a,logErrors:s=true,...c}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:p,getStorefrontApiUrl:l,getShopifyDomain:m}=createStorefrontClient(c),d=(c.privateStorefrontToken?p:u)({contentType:"json",buyerIp:t?.buyerIp||""});if(d[Ct]=t?.requestGroupId||Nr(),a&&(d[SHOPIFY_STOREFRONT_ID_HEADER]=a),(d["user-agent"]=`Hydrogen ${Ie}`),t&&t.cookie){let f=getShopifyCookies(t.cookie??"");f[SHOPIFY_Y]&&(d[SHOPIFY_STOREFRONT_Y_HEADER]=f[SHOPIFY_Y]),f[SHOPIFY_S]&&(d[SHOPIFY_STOREFRONT_S_HEADER]=f[SHOPIFY_S]);}let g=JSON.stringify({"content-type":d["content-type"],"user-agent":d["user-agent"],[Pt]:d[Pt],[St]:d[St],[vt]:d[vt],[At]:d[At]});async function P({query:f,mutation:C,variables:v,cache:b,headers:x=[],storefrontApiVersion:k,displayName:O,stackInfo:q}){let De=x instanceof Headers?Object.fromEntries(x.entries()):Array.isArray(x)?Object.fromEntries(x):x,oe=f??C,Y={...v};o&&(!v?.country&&/\$country/.test(oe)&&(Y.country=o.country),!v?.language&&/\$language/.test(oe)&&(Y.language=o.language));let ne=l({storefrontApiVersion:k}),h=JSON.stringify({query:oe,variables:Y}),S={method:"POST",headers:{...d,...De},body:h},D=[ne,S.method,g,S.body],[w,_]=await Be(ne,S,{cacheInstance:C?void 0:r,cache:b||ye(),cacheKey:D,waitUntil:n,shouldCacheResponse:E=>!E?.errors,debugInfo:{requestId:S.headers[Ct],displayName:O,url:ne,stackInfo:q,graphql:h,purpose:t?.purpose}}),H={url:ne,response:_,type:C?"mutation":"query",query:oe,queryVariables:Y,errors:void 0};if(!_.ok){let E,M=w;try{M??=await _.text(),E=W(M);}catch{E=[{message:M??"Could not parse Storefront API response"}];}Re({...H,errors:E});}let{data:N,errors:J}=w,X=J?.map(({message:E,...M})=>new ie(E,{...M,clientOperation:`storefront.${H.type}`,requestId:_.headers.get("x-request-id"),queryVariables:Y,query:oe}));return A(N,X)}return {storefront:{query(f,C){f=fe(f),Qe(f,"storefront.query");let v=$r?.(f);return le(P({...C,query:f,stackInfo:F?.(v)}),{stackOffset:v,logErrors:s})},mutate(f,C){f=fe(f),We(f,"storefront.mutate");let v=$r?.(f);return le(P({...C,mutation:f,stackInfo:F?.(v)}),{stackOffset:v,logErrors:s})},cache:r,CacheNone:ut,CacheLong:dt,CacheShort:se,CacheCustom:lt,generateCacheControlHeader:ve,getPublicTokenHeaders:u,getPrivateTokenHeaders:p,getShopifyDomain:m,getApiUrl:l,i18n:o??_n}}}var $r=void 0;function A(e,t){return {...e,...t&&{errors:t}}}function Tt({storefront:e,customerAccount:t,getCartId:r,cartFragment:n}){return async o=>{let a=r();if(!a)return null;let[s,{cart:c,errors:i}]=await Promise.all([t?t.isLoggedIn():false,e.query(Un(n),{variables:{cartId:a,...o},cache:e.CacheNone()})]);if(s&&c?.checkoutUrl){let u=new URL(c.checkoutUrl);u.searchParams.set("logged_in","true"),c.checkoutUrl=u.toString();}return c||i?A(c,i):null}}var Un=(e=Ln)=>`#graphql
28
+ API response error: ${t.status}`,u=new ue(i,{query:n,queryVariables:a,cause:{errors:r},clientOperation:`${c}.${o}`,requestId:t.headers.get("x-request-id")});throw new s(u.message,{cause:u.cause})}var Yn={language:"EN",country:"US"};function Zr(e){let {storefrontHeaders:t,cache:r,waitUntil:o,i18n:n,storefrontId:a,logErrors:s=true,...c}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getStorefrontApiUrl:f,getShopifyDomain:g}=createStorefrontClient(c),p=(c.privateStorefrontToken?d:u)({contentType:"json",buyerIp:t?.buyerIp||""});t?.buyerIp&&(p[ft]=t.buyerIp),t?.buyerIpSig&&(p[mt]=t.buyerIpSig),p[Me]=t?.requestGroupId||Ze(),a&&(p[SHOPIFY_STOREFRONT_ID_HEADER]=a),(p["user-agent"]=`Hydrogen ${xe}`);let l=t?.cookie??"";l&&(p.cookie=l);let I,m;if(!/\b_shopify_(analytics|marketing)=/.test(l)){let h=l.match(/\b_shopify_y=([^;]+)/)?.[1],P=l.match(/\b_shopify_s=([^;]+)/)?.[1];h&&(p[SHOPIFY_STOREFRONT_Y_HEADER]=h),P&&(p[SHOPIFY_STOREFRONT_S_HEADER]=P),I=h??Ze(),m=P??Ze(),p[SHOPIFY_UNIQUE_TOKEN_HEADER]=I,p[SHOPIFY_VISIT_TOKEN_HEADER]=m;}let C,S=JSON.stringify({"content-type":p["content-type"],"user-agent":p["user-agent"],[dt]:p[dt],[lt]:p[lt],[yt]:p[yt],[He]:p[He]});async function T({query:h,mutation:P,variables:A,cache:_,headers:V=[],storefrontApiVersion:se,displayName:Ne,stackInfo:Ve}){let v=V instanceof Headers?Object.fromEntries(V.entries()):Array.isArray(V)?Object.fromEntries(V):V,E=h??P,x={...A};n&&(!A?.country&&/\$country/.test(E)&&(x.country=n.country),!A?.language&&/\$language/.test(E)&&(x.language=n.language));let D=f({storefrontApiVersion:se}),M=JSON.stringify({query:E,variables:x}),q={method:"POST",headers:{...p,...v},body:M},H=[D,q.method,S,q.body],[j,G]=await Xe(D,q,{cacheInstance:P?void 0:r,cache:_||me(),cacheKey:H,waitUntil:o,shouldCacheResponse:L=>!L?.errors,debugInfo:{requestId:q.headers[Me],displayName:Ne,url:D,stackInfo:Ve,graphql:M,purpose:t?.purpose},onRawHeaders:L=>{C??={setCookie:typeof L.getSetCookie=="function"?L.getSetCookie():[],serverTiming:L.get("server-timing")??""};}}),U={url:D,response:G,type:P?"mutation":"query",query:E,queryVariables:x,errors:void 0};if(!G.ok){let L,ee=j;try{ee??=await G.text(),L=z(ee);}catch{L=[{message:ee??"Could not parse Storefront API response"}];}De({...U,errors:L});}let{data:K,errors:Se}=j,de=Se?.map(({message:L,...ee})=>new ue(L,{...ee,clientOperation:`storefront.${U.type}`,requestId:G.headers.get("x-request-id"),queryVariables:x,query:E}));return R(K,de)}return {storefront:{query(h,P){h=ge(h),et(h,"storefront.query");let A=Xr?.(h);return fe(T({...P,query:h,stackInfo:W?.(A)}),{stackOffset:A,logErrors:s})},mutate(h,P){h=ge(h),tt(h,"storefront.mutate");let A=Xr?.(h);return fe(T({...P,mutation:h,stackInfo:W?.(A)}),{stackOffset:A,logErrors:s})},cache:r,CacheNone:wt,CacheLong:xt,CacheShort:ce,CacheCustom:Dt,generateCacheControlHeader:we,getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getHeaders:()=>({...p}),getShopifyDomain:g,getApiUrl:f,i18n:n??Yn,isStorefrontApiUrl(h){return It.test(Rt(h.url??""))},async forward(h,P){let A=new Headers([...Et(se=>h.headers.get(se),["accept","accept-encoding","accept-language","access-control-request-headers","access-control-request-method","content-type","content-length","cookie","origin","referer","user-agent",He,SHOPIFY_UNIQUE_TOKEN_HEADER,SHOPIFY_VISIT_TOKEN_HEADER]),...Et(se=>p[se],[ft,mt,SHOPIFY_STOREFRONT_ID_HEADER,Me])]);t?.buyerIp&&A.set("x-forwarded-for",t.buyerIp);let _=P?.storefrontApiVersion??Rt(h.url).match(It)?.[1],V=await fetch(f({storefrontApiVersion:_}),{method:h.method,body:h.body,headers:A});return new Response(V.body,V)},setCollectedSubrequestHeaders:h=>{if(C)for(let V of C.setCookie)h.headers.append("Set-Cookie",V);let P=gr(C?.serverTiming),A=h.headers.get("content-type")?.startsWith("text/html");Pe(h,{...A?{_y:I,_s:m}:void 0,...P}),A&&C&&C.setCookie.length>1&&P?._y&&P?._s&&P?._cmp&&Pe(h,{[$e]:"1"});}}}}var Xr=void 0;function R(e,t){return {...e,...t&&{errors:t}}}function Vt({storefront:e,customerAccount:t,getCartId:r,cartFragment:o}){return async n=>{let a=r();if(!a)return null;let[s,{cart:c,errors:i}]=await Promise.all([t?t.isLoggedIn():false,e.query(zn(o),{variables:{cartId:a,...n},cache:e.CacheNone()})]);if(s&&c?.checkoutUrl){let u=new URL(c.checkoutUrl);u.searchParams.set("logged_in","true"),c.checkoutUrl=u.toString();}return c||i?R(c,i):null}}var zn=(e=Jn)=>`#graphql
29
29
  query CartQuery(
30
30
  $cartId: ID!
31
31
  $numCartLines: Int = 100
@@ -38,7 +38,7 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
38
38
  }
39
39
 
40
40
  ${e}
41
- `,Ln=`#graphql
41
+ `,Jn=`#graphql
42
42
  fragment CartApiQuery on Cart {
43
43
  updatedAt
44
44
  id
@@ -146,25 +146,25 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
146
146
  width
147
147
  height
148
148
  }
149
- `;var T=`#graphql
149
+ `;var b=`#graphql
150
150
  fragment CartApiError on CartUserError {
151
151
  message
152
152
  field
153
153
  code
154
154
  }
155
- `,I=`#graphql
155
+ `,w=`#graphql
156
156
  fragment CartApiMutation on Cart {
157
157
  id
158
158
  totalQuantity
159
159
  checkoutUrl
160
160
  }
161
- `,R=`#graphql
161
+ `,O=`#graphql
162
162
  fragment CartApiWarning on CartWarning {
163
163
  code
164
164
  message
165
165
  target
166
166
  }
167
- `;function It(e){return async(t,r)=>{let n=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartId:o,...a}=r||{},{buyerIdentity:s,...c}=t,{cartCreate:i,errors:u}=await e.storefront.mutate(kn(e.cartFragment),{variables:{input:{...c,buyerIdentity:{...n,...s}},...a}});return A(i,u)}}var kn=(e=I)=>`#graphql
167
+ `;function Mt(e){return async(t,r)=>{let o=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartId:n,...a}=r||{},{buyerIdentity:s,...c}=t,{cartCreate:i,errors:u}=await e.storefront.mutate(Xn(e.cartFragment),{variables:{input:{...c,buyerIdentity:{...o,...s}},...a}});return R(i,u)}}var Xn=(e=w)=>`#graphql
168
168
  mutation cartCreate(
169
169
  $input: CartInput!
170
170
  $country: CountryCode = ZZ
@@ -184,9 +184,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
184
184
  }
185
185
  }
186
186
  ${e}
187
- ${T}
188
- ${R}
189
- `;function Rt(e){return async(t,r)=>{let{cartLinesAdd:n,errors:o}=await e.storefront.mutate(Nn(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return A(n,o)}}var Nn=(e=I)=>`#graphql
187
+ ${b}
188
+ ${O}
189
+ `;function Ht(e){return async(t,r)=>{let{cartLinesAdd:o,errors:n}=await e.storefront.mutate(Zn(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return R(o,n)}}var Zn=(e=w)=>`#graphql
190
190
  mutation cartLinesAdd(
191
191
  $cartId: ID!
192
192
  $lines: [CartLineInput!]!
@@ -206,9 +206,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
206
206
  }
207
207
  }
208
208
  ${e}
209
- ${T}
210
- ${R}
211
- `;var qr="__h_pending_";function Hr(e){return qr+e}function je(e){return e.startsWith(qr)}function Ke(e,t){if(t.some(r=>je(typeof r=="string"?r:r.id)))throw new Error(`Tried to perform an action on an optimistic line. Make sure to disable your "${e}" CartForm action when the line is optimistic.`)}function Et(e){return async(t,r)=>{Ke("updateLines",t);let{cartLinesUpdate:n,errors:o}=await e.storefront.mutate(Mn(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return A(n,o)}}var Mn=(e=I)=>`#graphql
209
+ ${b}
210
+ ${O}
211
+ `;var eo="__h_pending_";function to(e){return eo+e}function rt(e){return e.startsWith(eo)}function ot(e,t){if(t.some(r=>rt(typeof r=="string"?r:r.id)))throw new Error(`Tried to perform an action on an optimistic line. Make sure to disable your "${e}" CartForm action when the line is optimistic.`)}function Ft(e){return async(t,r)=>{ot("updateLines",t);let{cartLinesUpdate:o,errors:n}=await e.storefront.mutate(ea(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return R(o,n)}}var ea=(e=w)=>`#graphql
212
212
  mutation cartLinesUpdate(
213
213
  $cartId: ID!
214
214
  $lines: [CartLineUpdateInput!]!
@@ -228,9 +228,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
228
228
  }
229
229
  }
230
230
  ${e}
231
- ${T}
232
- ${R}
233
- `;function bt(e){return async(t,r)=>{Ke("removeLines",t);let{cartLinesRemove:n,errors:o}=await e.storefront.mutate(Vn(e.cartFragment),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return A(n,o)}}var Vn=(e=I)=>`#graphql
231
+ ${b}
232
+ ${O}
233
+ `;function $t(e){return async(t,r)=>{ot("removeLines",t);let{cartLinesRemove:o,errors:n}=await e.storefront.mutate(ta(e.cartFragment),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return R(o,n)}}var ta=(e=w)=>`#graphql
234
234
  mutation cartLinesRemove(
235
235
  $cartId: ID!
236
236
  $lineIds: [ID!]!
@@ -250,9 +250,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
250
250
  }
251
251
  }
252
252
  ${e}
253
- ${T}
254
- ${R}
255
- `;function wt(e){return async(t,r)=>{let n=t.filter((s,c,i)=>i.indexOf(s)===c),{cartDiscountCodesUpdate:o,errors:a}=await e.storefront.mutate($n(e.cartFragment),{variables:{cartId:e.getCartId(),discountCodes:n,...r}});return A(o,a)}}var $n=(e=I)=>`#graphql
253
+ ${b}
254
+ ${O}
255
+ `;function qt(e){return async(t,r)=>{let o=t.filter((s,c,i)=>i.indexOf(s)===c),{cartDiscountCodesUpdate:n,errors:a}=await e.storefront.mutate(ra(e.cartFragment),{variables:{cartId:e.getCartId(),discountCodes:o,...r}});return R(n,a)}}var ra=(e=w)=>`#graphql
256
256
  mutation cartDiscountCodesUpdate(
257
257
  $cartId: ID!
258
258
  $discountCodes: [String!]
@@ -272,9 +272,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
272
272
  }
273
273
  }
274
274
  ${e}
275
- ${T}
276
- ${R}
277
- `;function Ot(e){return async(t,r)=>{t.companyLocationId&&e.customerAccount&&e.customerAccount.setBuyer({companyLocationId:t.companyLocationId});let n=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartBuyerIdentityUpdate:o,errors:a}=await e.storefront.mutate(Fn(e.cartFragment),{variables:{cartId:e.getCartId(),buyerIdentity:{...n,...t},...r}});return A(o,a)}}var Fn=(e=I)=>`#graphql
275
+ ${b}
276
+ ${O}
277
+ `;function Gt(e){return async(t,r)=>{t.companyLocationId&&e.customerAccount&&e.customerAccount.setBuyer({companyLocationId:t.companyLocationId});let o=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartBuyerIdentityUpdate:n,errors:a}=await e.storefront.mutate(oa(e.cartFragment),{variables:{cartId:e.getCartId(),buyerIdentity:{...o,...t},...r}});return R(n,a)}}var oa=(e=w)=>`#graphql
278
278
  mutation cartBuyerIdentityUpdate(
279
279
  $cartId: ID!
280
280
  $buyerIdentity: CartBuyerIdentityInput!
@@ -294,9 +294,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
294
294
  }
295
295
  }
296
296
  ${e}
297
- ${T}
298
- ${R}
299
- `;function Dt(e){return async(t,r)=>{let{cartNoteUpdate:n,errors:o}=await e.storefront.mutate(qn(e.cartFragment),{variables:{cartId:e.getCartId(),note:t,...r}});return A(n,o)}}var qn=(e=I)=>`#graphql
297
+ ${b}
298
+ ${O}
299
+ `;function Bt(e){return async(t,r)=>{let{cartNoteUpdate:o,errors:n}=await e.storefront.mutate(na(e.cartFragment),{variables:{cartId:e.getCartId(),note:t,...r}});return R(o,n)}}var na=(e=w)=>`#graphql
300
300
  mutation cartNoteUpdate(
301
301
  $cartId: ID!
302
302
  $note: String!
@@ -316,9 +316,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
316
316
  }
317
317
  }
318
318
  ${e}
319
- ${T}
320
- ${R}
321
- `;function xt(e){return async(t,r)=>{let{cartSelectedDeliveryOptionsUpdate:n,errors:o}=await e.storefront.mutate(Hn(e.cartFragment),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return A(n,o)}}var Hn=(e=I)=>`#graphql
319
+ ${b}
320
+ ${O}
321
+ `;function Qt(e){return async(t,r)=>{let{cartSelectedDeliveryOptionsUpdate:o,errors:n}=await e.storefront.mutate(aa(e.cartFragment),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return R(o,n)}}var aa=(e=w)=>`#graphql
322
322
  mutation cartSelectedDeliveryOptionsUpdate(
323
323
  $cartId: ID!
324
324
  $selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
@@ -338,9 +338,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
338
338
  }
339
339
  }
340
340
  ${e}
341
- ${T}
342
- ${R}
343
- `;function _t(e){return async(t,r)=>{let{cartAttributesUpdate:n,errors:o}=await e.storefront.mutate(Gn(e.cartFragment),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t}});return A(n,o)}}var Gn=(e=I)=>`#graphql
341
+ ${b}
342
+ ${O}
343
+ `;function Wt(e){return async(t,r)=>{let{cartAttributesUpdate:o,errors:n}=await e.storefront.mutate(sa(e.cartFragment),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t}});return R(o,n)}}var sa=(e=w)=>`#graphql
344
344
  mutation cartAttributesUpdate(
345
345
  $cartId: ID!
346
346
  $attributes: [AttributeInput!]!
@@ -358,9 +358,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
358
358
  }
359
359
  }
360
360
  ${e}
361
- ${T}
362
- ${R}
363
- `;function Ut(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),o=t.map(c=>({...c,ownerId:n})),{cartMetafieldsSet:a,errors:s}=await e.storefront.mutate(Bn(),{variables:{metafields:o}});return A({cart:{id:n},...a},s)}}var Bn=()=>`#graphql
361
+ ${b}
362
+ ${O}
363
+ `;function jt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),n=t.map(c=>({...c,ownerId:o})),{cartMetafieldsSet:a,errors:s}=await e.storefront.mutate(ia(),{variables:{metafields:n}});return R({cart:{id:o},...a},s)}}var ia=()=>`#graphql
364
364
  mutation cartMetafieldsSet(
365
365
  $metafields: [CartMetafieldsSetInput!]!
366
366
  $language: LanguageCode
@@ -375,7 +375,7 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
375
375
  }
376
376
  }
377
377
  }
378
- `;function Lt(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),{cartMetafieldDelete:o,errors:a}=await e.storefront.mutate(Qn(),{variables:{input:{ownerId:n,key:t}}});return A({cart:{id:n},...o},a)}}var Qn=()=>`#graphql
378
+ `;function Kt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),{cartMetafieldDelete:n,errors:a}=await e.storefront.mutate(ca(),{variables:{input:{ownerId:o,key:t}}});return R({cart:{id:o},...n},a)}}var ca=()=>`#graphql
379
379
  mutation cartMetafieldDelete(
380
380
  $input: CartMetafieldDeleteInput!
381
381
  ) {
@@ -387,7 +387,7 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
387
387
  }
388
388
  }
389
389
  }
390
- `;function kt(e){return async(t,r)=>{let n=t.filter((s,c,i)=>i.indexOf(s)===c),{cartGiftCardCodesUpdate:o,errors:a}=await e.storefront.mutate(Wn(e.cartFragment),{variables:{cartId:e.getCartId(),giftCardCodes:n,...r}});return A(o,a)}}var Wn=(e=I)=>`#graphql
390
+ `;function Yt(e){return async(t,r)=>{let o=t.filter((s,c,i)=>i.indexOf(s)===c),{cartGiftCardCodesUpdate:n,errors:a}=await e.storefront.mutate(ua(e.cartFragment),{variables:{cartId:e.getCartId(),giftCardCodes:o,...r}});return R(n,a)}}var ua=(e=w)=>`#graphql
391
391
  mutation cartGiftCardCodesUpdate(
392
392
  $cartId: ID!
393
393
  $giftCardCodes: [String!]!
@@ -407,9 +407,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
407
407
  }
408
408
  }
409
409
  ${e}
410
- ${T}
411
- ${R}
412
- `;function Gr(e){return async(t,r)=>{let{cartDeliveryAddressesAdd:n,errors:o}=await e.storefront.mutate(jn(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return A(n,o)}}var jn=(e=I)=>`#graphql
410
+ ${b}
411
+ ${O}
412
+ `;function ro(e){return async(t,r)=>{let{cartDeliveryAddressesAdd:o,errors:n}=await e.storefront.mutate(pa(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return R(o,n)}}var pa=(e=w)=>`#graphql
413
413
  mutation cartDeliveryAddressesAdd(
414
414
  $cartId: ID!
415
415
  $addresses: [CartSelectableAddressInput!]!,
@@ -429,9 +429,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
429
429
  }
430
430
  }
431
431
  ${e}
432
- ${T}
433
- ${R}
434
- `;function Br(e){return async(t,r)=>{let{cartDeliveryAddressesRemove:n,errors:o}=await e.storefront.mutate(Kn(e.cartFragment),{variables:{cartId:e.getCartId(),addressIds:t,...r}});return A(n,o)}}var Kn=(e=I)=>`#graphql
432
+ ${b}
433
+ ${O}
434
+ `;function oo(e){return async(t,r)=>{let{cartDeliveryAddressesRemove:o,errors:n}=await e.storefront.mutate(da(e.cartFragment),{variables:{cartId:e.getCartId(),addressIds:t,...r}});return R(o,n)}}var da=(e=w)=>`#graphql
435
435
  mutation cartDeliveryAddressesRemove(
436
436
  $cartId: ID!
437
437
  $addressIds: [ID!]!,
@@ -451,9 +451,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
451
451
  }
452
452
  }
453
453
  ${e}
454
- ${T}
455
- ${R}
456
- `;function Qr(e){return async(t,r)=>{let{cartDeliveryAddressesUpdate:n,errors:o}=await e.storefront.mutate(zn(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return A(n,o)}}var zn=(e=I)=>`#graphql
454
+ ${b}
455
+ ${O}
456
+ `;function no(e){return async(t,r)=>{let{cartDeliveryAddressesUpdate:o,errors:n}=await e.storefront.mutate(la(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return R(o,n)}}var la=(e=w)=>`#graphql
457
457
  mutation cartDeliveryAddressesUpdate(
458
458
  $cartId: ID!
459
459
  $addresses: [CartSelectableAddressUpdateInput!]!,
@@ -473,9 +473,9 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
473
473
  }
474
474
  }
475
475
  ${e}
476
- ${T}
477
- ${R}
478
- `;function Nt(e){let{getCartId:t,setCartId:r,storefront:n,customerAccount:o,cartQueryFragment:a,cartMutateFragment:s}=e,c=t(),i=()=>c||t(),u={storefront:n,getCartId:i,cartFragment:s,customerAccount:o},p=It(u),l=async function(...y){let d=await p(...y);return c=d?.cart?.id,d},m={get:Tt({storefront:n,customerAccount:o,getCartId:i,cartFragment:a}),getCartId:i,setCartId:r,create:l,addLines:async(y,d)=>{let g=y.map(P=>({attributes:P.attributes,quantity:P.quantity,merchandiseId:P.merchandiseId,sellingPlanId:P.sellingPlanId}));return c||d?.cartId?await Rt(u)(g,d):await l({lines:g},d)},updateLines:Et(u),removeLines:bt(u),updateDiscountCodes:async(y,d)=>c||d?.cartId?await wt(u)(y,d):await l({discountCodes:y},d),updateGiftCardCodes:async(y,d)=>c||d?.cartId?await kt(u)(y,d):await l({giftCardCodes:y},d),updateBuyerIdentity:async(y,d)=>c||d?.cartId?await Ot(u)(y,d):await l({buyerIdentity:y},d),updateNote:async(y,d)=>c||d?.cartId?await Dt(u)(y,d):await l({note:y},d),updateSelectedDeliveryOption:xt(u),updateAttributes:async(y,d)=>c||d?.cartId?await _t(u)(y,d):await l({attributes:y},d),setMetafields:async(y,d)=>c||d?.cartId?await Ut(u)(y,d):await l({metafields:y},d),deleteMetafield:Lt(u),addDeliveryAddresses:Gr(u),removeDeliveryAddresses:Br(u),updateDeliveryAddresses:Qr(u)};return "customMethods"in e?{...m,...e.customMethods??{}}:m}function Jn(e){let t=useFetchers();if(!t||!t.length)return e;let r=e?.lines?structuredClone(e):{lines:{nodes:[]}},n=r.lines.nodes,o=false;for(let{formData:a}of t){if(!a)continue;let s=j.getFormInput(a);if(s.action===j.ACTIONS.LinesAdd)for(let c of s.inputs.lines){if(!c.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let i=n.find(u=>u.merchandise.id===c.selectedVariant?.id);o=true,i?(i.quantity=(i.quantity||1)+(c.quantity||1),i.isOptimistic=true):n.unshift({id:Hr(c.selectedVariant.id),merchandise:c.selectedVariant,isOptimistic:true,quantity:c.quantity||1});}else if(s.action===j.ACTIONS.LinesRemove)for(let c of s.inputs.lineIds){let i=n.findIndex(u=>u.id===c);if(i!==-1){if(je(n[i].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}n.splice(i,1),o=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${c}' but it doesn't exist in the cart`);}else if(s.action===j.ACTIONS.LinesUpdate)for(let c of s.inputs.lines){let i=n.findIndex(u=>c.id===u.id);if(i>-1){if(je(n[i].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}n[i].quantity=c.quantity,n[i].quantity===0&&n.splice(i,1),o=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${c.id}' but it doesn't exist in the cart`);}}return o&&(r.isOptimistic=o),r.totalQuantity=n.reduce((a,s)=>a+s.quantity,0),r}var Xn="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function Zn({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||Xn)}var ze="2025-04",me=`Shopify Hydrogen ${Ie}`,Wr="30243aa5-17c1-465a-8493-944bcc4e88aa",U="customerAccount",ge="buyer";var $=class extends Response{constructor(t,r,n){super(`Bad request: ${t}`,{status:400,headers:n});}};function be(e,t={}){let r=t.headers?new Headers(t.headers):new Headers({});return r.set("location",e),new Response(null,{status:t.status||302,headers:r})}async function ea({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:n,debugInfo:o}){let a=new URLSearchParams,s=e.get(U),c=s?.refreshToken,i=s?.idToken;if(!c)throw new $("Unauthorized","No refreshToken found in the session. Make sure your session is configured correctly and passed to `createCustomerAccountClient`.");a.append("grant_type","refresh_token"),a.append("refresh_token",c),a.append("client_id",t);let u={"content-type":"application/x-www-form-urlencoded","User-Agent":me,Origin:n};new Date().getTime();let l=r,m=await fetch(l,{method:"POST",headers:u,body:a});if(!m.ok){let P=await m.text();throw new Response(P,{status:m.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:y,expires_in:d,refresh_token:g}=await m.json();if(!y||y.length===0)throw new $("Unauthorized","Invalid access token received.");e.set(U,{accessToken:y,expiresAt:new Date(new Date().getTime()+(d-120)*1e3).getTime()+"",refreshToken:g,idToken:i});}function he(e){e.unset(U),e.unset(ge);}async function jr({locks:e,expiresAt:t,session:r,customerAccountId:n,customerAccountTokenExchangeUrl:o,httpsOrigin:a,debugInfo:s}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=ea({session:r,customerAccountId:n,customerAccountTokenExchangeUrl:o,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(c){throw he(r),c&&c.status!==401?c:new $("Unauthorized","Login before querying the Customer Account API.")}}function Kr(){let e=ta();return Yr(e)}async function zr(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=ra(t);return Yr(r)}function ta(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function Yr(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ra(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function Jr(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function Xr(e,t,r,n,o){let a=t;if(!e)throw new $("Unauthorized","oAuth access token was not provided during token exchange.");let s=new URLSearchParams;s.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),s.append("client_id",a),s.append("audience",Wr),s.append("subject_token",e),s.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),s.append("scopes","https://api.customers.com/auth/customer.graphql");let c={"content-type":"application/x-www-form-urlencoded","User-Agent":me,Origin:n};new Date().getTime();let u=r,p=await fetch(u,{method:"POST",headers:c,body:s});let l=await p.json();if(l.error)throw new $(l.error_description);return l.access_token}function Zr(e){return oa(e).payload.nonce}function oa(e){let[t,r,n]=e.split("."),o=JSON.parse(atob(t)),a=JSON.parse(atob(r));return {header:o,payload:a,signature:n}}function Ye(){return aa(na())}function na(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function aa(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function Je(e){if(!e)return;let{pathname:t,search:r}=new URL(e),n=t+r,o=new URLSearchParams(r),a=o.get("return_to")||o.get("redirect");if(a){if(to(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${n} to ${a}`);}}function to(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return false}}function Mt({requestUrl:e,defaultUrl:t,redirectUrl:r}){let n=e,o=eo(e,t),a=r?eo(e,r):o;return to(e,a.toString())?a.toString():(console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${n} to ${a}. Default url ${o} is used instead.`),o.toString())}function eo(e,t){return sa(t)?new URL(t):new URL(t,new URL(e).origin)}function sa(e){try{return new URL(e),!0}catch{return false}}function ro(e,t){let r=`https://shopify.com/${t}`,n=`https://shopify.com/authentication/${t}`;return function(a){switch(a){case "CA_BASE_URL":return r;case "CA_BASE_AUTH_URL":return n;case "GRAPHQL":return `${r}/account/customer/api/${e}/graphql`;case "AUTH":return `${n}/oauth/authorize`;case "LOGIN_SCOPE":return t?"openid email customer-account-api:full":"openid email https://api.customers.com/auth/customer.graphql";case "TOKEN_EXCHANGE":return `${n}/oauth/token`;case "LOGOUT":return `${n}/logout`}}}function ia(e,t){if(!e.url)return t;let{pathname:r}=new URL(e.url),n=r.replace(/\.data$/,"").replace(/\/_root$/,"/").replace(/(.+)\/$/,"$1"),o=t+`?${new URLSearchParams({return_to:n}).toString()}`;return be(o)}function Vt({session:e,customerAccountId:t,shopId:r,customerApiVersion:n=ze,request:o,waitUntil:a,authUrl:s,customAuthStatusHandler:c,logErrors:i=true,loginPath:u="/account/login",authorizePath:p="/account/authorize",defaultRedirectPath:l="/account",language:m}){if(n!==ze&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${n} when this version of Hydrogen was built for ${ze}.`),e||console.warn("[h2:warn:createCustomerAccountClient] session is required to use Customer Account API. Ensure the session object passed in exist."),!o?.url)throw new Error("[h2:error:createCustomerAccountClient] The request object does not contain a URL.");let y=c||(()=>ia(o,u)),d=new URL(o.url),g=d.protocol==="http:"?d.origin.replace("http","https"):d.origin,P=Mt({requestUrl:g,defaultUrl:p,redirectUrl:s}),f=ro(n,r),C=ca(f,t),v=f("GRAPHQL"),b={};async function x({query:h,type:S,variables:D={}}){let w=await q();if(!w)throw y();new Date().getTime();let N=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":me,Origin:g,Authorization:w},body:JSON.stringify({query:h,variables:D})});let J=await N.text(),X={url:v,response:N,type:S,query:h,queryVariables:D,errors:void 0,client:"customer"};if(!N.ok){if(N.status===401)throw he(e),y();let E;try{E=W(J);}catch{E=[{message:J}];}Re({...X,errors:E});}try{let E=W(J),{errors:M}=E,xe=M?.map(({message:_e,...tt})=>new ie(_e,{...tt,clientOperation:`customerAccount.${X.type}`,requestId:N.headers.get("x-request-id"),queryVariables:D,query:h}));return {...E,...M&&{errors:xe}}}catch{Re({...X,errors:[{message:J}]});}}async function k(){if(!r)return false;let h=e.get(U),S=h?.accessToken,D=h?.expiresAt;if(!S||!D)return false;let w=F?.();try{await jr({locks:b,expiresAt:D,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:f("TOKEN_EXCHANGE"),httpsOrigin:g,debugInfo:{waitUntil:a,stackInfo:w,...ee(o)}});}catch{return false}return true}async function O(){if(!await k())throw y()}async function q(){if(await k())return e.get(U)?.accessToken}async function De(h,S){return C(),h=fe(h),We(h,"customer.mutate"),le(x({query:h,type:"mutation",...S}),{logErrors:i})}async function oe(h,S){return C(),h=fe(h),Qe(h,"customer.query"),le(x({query:h,type:"query",...S}),{logErrors:i})}function Y(h){e.set(ge,{...e.get(ge),...h});}async function ne(){let h=await q();if(h)return {...e.get(ge),customerAccessToken:h}}return {login:async h=>{C();let S=new URL(f("AUTH")),D=Jr(),w=Ye();S.searchParams.set("client_id",t),S.searchParams.set("scope","openid email"),S.searchParams.append("response_type","code"),S.searchParams.append("redirect_uri",P),S.searchParams.set("scope",f("LOGIN_SCOPE")),S.searchParams.append("state",D),S.searchParams.append("nonce",w);let _=ua({contextLanguage:m??null,uiLocalesOverride:h?.uiLocales??null});_!=null&&S.searchParams.append("ui_locales",_);let H=Kr(),N=await zr(H);return e.set(U,{...e.get(U),codeVerifier:H,state:D,nonce:w,redirectPath:Je(o.url)||Q(o,"Referer")||l}),S.searchParams.append("code_challenge",N),S.searchParams.append("code_challenge_method","S256"),be(S.toString())},logout:async h=>{C();let S=e.get(U)?.idToken,D=Mt({requestUrl:g,defaultUrl:g,redirectUrl:h?.postLogoutRedirectUri}),w=S?new URL(`${f("LOGOUT")}?${new URLSearchParams([["id_token_hint",S],["post_logout_redirect_uri",D]]).toString()}`).toString():D;he(e);let _=h?.headers instanceof Headers?h?.headers:new Headers(h?.headers);return h?.keepSession||(e.destroy?_.set("Set-Cookie",await e.destroy()):console.warn("[h2:warn:customerAccount] session.destroy is not available on your session implementation. All session data might not be cleared on logout."),e.isPending=false),be(w,{headers:_})},isLoggedIn:k,handleAuthStatus:O,getAccessToken:q,getApiUrl:()=>v,mutate:De,query:oe,authorize:async()=>{C();let h=d.searchParams.get("code"),S=d.searchParams.get("state");if(!h||!S)throw he(e),new $("Unauthorized","No code or state parameter found in the redirect URL.");if(e.get(U)?.state!==S)throw he(e),new $("Unauthorized","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");let D=t,w=new URLSearchParams;w.append("grant_type","authorization_code"),w.append("client_id",D),w.append("redirect_uri",P),w.append("code",h);let _=e.get(U)?.codeVerifier;if(!_)throw new $("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");w.append("code_verifier",_);let H={"content-type":"application/x-www-form-urlencoded","User-Agent":me,Origin:g};new Date().getTime();let X=f("TOKEN_EXCHANGE"),E=await fetch(X,{method:"POST",headers:H,body:w});if(!E.ok)throw new Response(await E.text(),{status:E.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:M,expires_in:xe,id_token:_e,refresh_token:tt}=await E.json(),zt=e.get(U)?.nonce,Yt=await Zr(_e);if(zt!==Yt)throw new $("Unauthorized",`Returned nonce does not match: ${zt} !== ${Yt}`);let Jt=M;r||(Jt=await Xr(M,t,f("TOKEN_EXCHANGE"),g,{...ee(o)}));let vo=e.get(U)?.redirectPath;return e.set(U,{accessToken:Jt,expiresAt:new Date(new Date().getTime()+(xe-120)*1e3).getTime()+"",refreshToken:tt,idToken:_e}),be(vo||l)},setBuyer:Y,getBuyer:ne,UNSTABLE_setBuyer:h=>{B("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),Y(h);},UNSTABLE_getBuyer:()=>(B("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),ne())}}function ca(e,t){return function(){try{if(!t)throw Error();new URL(e("CA_BASE_URL")),new URL(e("CA_BASE_AUTH_URL"));}catch{console.error(new Error("[h2:error:customerAccount] You do not have the valid credential to use Customer Account API.\nRun `h2 env pull` to link your store credentials."));let n="Internal Server Error";throw new Response(n,{status:500})}}}function ua(e){let t=oo(e.contextLanguage??null);return oo(e.uiLocalesOverride)??t??null}function oo(e){if(e==null)return null;let n=da(e).toLowerCase().replaceAll("_","-").split("-"),o=n.at(0)??null,a=n.at(1)??null;return a?`${o}-${a.toUpperCase()}`:o}var pa={PT:"PT_PT",ZH:"ZH_CN"};function da(e){return pa[e]??e}function la(e){let{env:t,request:r,cache:n,waitUntil:o,i18n:a,session:s,logErrors:c,storefront:i={},customerAccount:u,cart:p={}}=e;s||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),u?.unstableB2b&&B("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:l}=Fr({cache:n,waitUntil:o,i18n:a,logErrors:c,storefrontHeaders:i.headers||ya(r),storefrontApiVersion:i.apiVersion,storefrontId:t.PUBLIC_STOREFRONT_ID,storeDomain:t.PUBLIC_STORE_DOMAIN,privateStorefrontToken:t.PRIVATE_STOREFRONT_API_TOKEN,publicStorefrontToken:t.PUBLIC_STOREFRONT_API_TOKEN}),m=Vt({session:s,request:r,waitUntil:o,logErrors:c,customerApiVersion:u?.apiVersion,authUrl:u?.authUrl,customAuthStatusHandler:u?.customAuthStatusHandler,language:a?.language,customerAccountId:t.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,shopId:t.SHOP_ID}),y=Nt({getCartId:p.getId||gt(r.headers),setCartId:p.setId||ht(),cartQueryFragment:p.queryFragment,cartMutateFragment:p.mutateFragment,customMethods:p.customMethods,storefront:l,customerAccount:m});return {storefront:l,customerAccount:m,cart:y,env:t,waitUntil:o,session:s}}function ya(e){return {requestGroupId:Q(e,"request-id"),buyerIp:Q(e,"oxygen-buyer-ip"),cookie:Q(e,"cookie"),purpose:Q(e,"purpose")}}var no=createContext(void 0),Ca=no.Provider,$t=()=>useContext(no);function Aa(e){let t=Ye(),r=Pa(t,e);return {nonce:t,header:r,NonceProvider:({children:o})=>createElement(Ca,{value:t},o)}}function Pa(e,t){let{shop:r,...n}=t??{},o=`'nonce-${e}'`,a=["'self'","'unsafe-inline'","https://cdn.shopify.com"],s=["'self'","https://monorail-edge.shopifysvc.com"];r&&r.checkoutDomain&&s.push(`https://${r.checkoutDomain}`),r&&r.storeDomain&&s.push(`https://${r.storeDomain}`);let i={baseUri:["'self'"],defaultSrc:["'self'",o,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:a,connectSrc:s},u=Object.assign({},i,n);for(let p in i){let l=n[p];p&&l&&(u[p]=Sa(l,i[p]));}return u.scriptSrc instanceof Array?u.scriptSrc=[...u.scriptSrc.filter(p=>!p.startsWith("'nonce")),o]:u.defaultSrc instanceof Array&&(u.defaultSrc=[...u.defaultSrc.filter(p=>!p.startsWith("'nonce")),o]),ha({directives:u})}function Sa(e,t){let r=typeof t=="string"?[t]:t,n=Array.isArray(e)?e:[String(e)];return Array.isArray(r)?r.every(a=>a==="'none'")?n:[...n,...r]:r}var Ia=forwardRef((e,t)=>{let{waitForHydration:r,src:n,...o}=e,a=$t();return r?jsx(Ra,{src:n,options:o}):jsx("script",{suppressHydrationWarning:true,...o,src:n,nonce:a,ref:t})});function Ra({src:e,options:t}){if(!e)throw new Error("`waitForHydration` with the Script component requires a `src` prop");return useLoadScript(e,{attributes:t}),null}async function ba(e){return e}function Oa(e){let t=useFetchers(),r={};for(let{formData:n}of t)if(n?.get("optimistic-identifier")===e)try{if(n.has("optimistic-data")){let o=JSON.parse(String(n.get("optimistic-data")));Object.assign(r,o);}}catch{}return r}function Da({id:e,data:t}){return jsxs(Fragment,{children:[jsx("input",{type:"hidden",name:"optimistic-identifier",value:e}),jsx("input",{type:"hidden",name:"optimistic-data",value:JSON.stringify(t)})]})}function ka({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null),namespace:r=""}){let [n,o]=useState(false),a=useNavigation(),s=useLocation();useNavigate();useEffect(()=>{a.state==="idle"&&o(false);},[a.state]);let{endCursor:i,hasNextPage:u,hasPreviousPage:p,nextPageUrl:l,nodes:m,previousPageUrl:y,startCursor:d}=Na(e,r),g=useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:i,hasPreviousPage:p,hasNextPage:u,startCursor:d},nodes:m}}}),[i,u,p,d,m,r,s.state]),P=useMemo(()=>forwardRef(function(v,b){return u?createElement(Link,{preventScrollReset:true,...v,to:l,state:g,replace:true,ref:b,onClick:()=>o(true)}):null}),[u,l,g]),f=useMemo(()=>forwardRef(function(v,b){return p?createElement(Link,{preventScrollReset:true,...v,to:y,state:g,replace:true,ref:b,onClick:()=>o(true)}):null}),[p,y,g]);return t({state:g,hasNextPage:u,hasPreviousPage:p,isLoading:n,nextPageUrl:l,nodes:m,previousPageUrl:y,NextLink:P,PreviousLink:f})}function Ze(e,t){let r=new URLSearchParams(e);return Object.keys(t?.pagination||{}).forEach(o=>{let a=o===""?"":`${o}_`,s=`${a}cursor`,c=`${a}direction`;r.delete(s),r.delete(c);}),r.toString()}function we(e){throw new Error(`The Pagination component requires ${"`"+e+"`"} to be a part of your query. See the guide on how to setup your query to include ${"`"+e+"`"}: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#setup-the-paginated-query`)}function Na(e,t=""){e.pageInfo||we("pageInfo"),typeof e.pageInfo.startCursor>"u"&&we("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&we("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&we("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&we("pageInfo.hasPreviousPage");let r=useNavigation(),n=useNavigate(),{state:o,search:a,pathname:s}=useLocation(),c=t?`${t}_cursor`:"cursor",i=t?`${t}_direction`:"direction",l=new URLSearchParams(a).get(i)==="previous",m=useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!o?.pagination?.[t]?.nodes?flattenConnection(e):l?[...flattenConnection(e),...o.pagination[t].nodes||[]]:[...o.pagination[t].nodes||[],...flattenConnection(e)],[o,e,t]),y=useMemo(()=>{let f=globalThis?.window?.__hydrogenHydrated,C=o?.pagination?.[t]?.pageInfo,v=!f||C?.startCursor===void 0?e.pageInfo.startCursor:C.startCursor,b=!f||C?.endCursor===void 0?e.pageInfo.endCursor:C.endCursor,x=!f||C?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:C.hasPreviousPage,k=!f||C?.hasNextPage===void 0?e.pageInfo.hasNextPage:C.hasNextPage;return o?.pagination?.[t]?.nodes&&(l?(v=e.pageInfo.startCursor,x=e.pageInfo.hasPreviousPage):(b=e.pageInfo.endCursor,k=e.pageInfo.hasNextPage)),{startCursor:v,endCursor:b,hasPreviousPage:x,hasNextPage:k}},[l,o,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),d=useRef({params:Ze(a,o),pathname:s});useEffect(()=>{window.__hydrogenHydrated=true;},[]),useEffect(()=>{let f=Ze(a,o),C=d.current.params;(s!==d.current.pathname||f!==C)&&!(r.state==="idle"&&!r.location)&&(d.current={pathname:s,params:Ze(a,o)},n(`${s}?${Ze(a,o)}`,{replace:true,preventScrollReset:true,state:{nodes:void 0,pageInfo:void 0}}));},[s,a,o]);let g=useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"previous"),y.startCursor&&f.set(c,y.startCursor),`?${f.toString()}`},[a,y.startCursor]),P=useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"next"),y.endCursor&&f.set(c,y.endCursor),`?${f.toString()}`},[a,y.endCursor]);return {...y,previousPageUrl:g,nextPageUrl:P,nodes:m}}function Ma(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r,namespace:n=""}=t,o=new URLSearchParams(new URL(e.url).search),a=n?`${n}_cursor`:"cursor",s=n?`${n}_direction`:"direction",c=o.get(a)??void 0;return (o.get(s)==="previous"?"previous":"next")==="previous"?{last:r,startCursor:c??null}:{first:r,endCursor:c??null}}function qa(e,t){let r=useNavigation(),[n,o]=useState([]);if(useEffect(()=>{Promise.resolve(t).then(a=>{a&&o(a instanceof Array?a:a.product?.variants?.nodes||[]);}).catch(a=>{reportError(new Error("[h2:error:useOptimisticVariant] An error occurred while resolving the variants for the optimistic product hook.",{cause:a}));});},[JSON.stringify(t)]),r.state==="loading"){let a=new URLSearchParams(r.location.search),s=false,c=n.find(i=>i.selectedOptions?i.selectedOptions.every(u=>a.get(u.name)===u.value):(s||(s=true,reportError(new Error("[h2:error:useOptimisticVariant] The optimistic product hook requires your product query to include variants with the selectedOptions field."))),false));if(c)return {...c,isOptimistic:true}}return e}function ja({handle:e,options:t=[],variants:r=[],productPath:n="products",waitForNavigation:o=false,selectedVariant:a,children:s}){let c=t;c[0]?.values&&(B("[h2:warn:VariantSelector] product.options.values is deprecated. Use product.options.optionValues instead."),c[0]&&!c[0].optionValues&&(c=t.map(d=>({...d,optionValues:d.values?.map(g=>({name:g}))||[]}))));let i=r instanceof Array?r:flattenConnection(r),{searchParams:u,path:p,alreadyOnProductPage:l}=za(e,n,o),m=c.filter(d=>d?.optionValues?.length===1),y=a?a?.selectedOptions?.reduce((d,g)=>(d[g.name]=g.value,d),{}):{};return createElement(Fragment$1,null,...useMemo(()=>c.map(d=>{let g,P=[];for(let f of d.optionValues){let C=new URLSearchParams(l?u:void 0);C.set(d.name,f.name),m.forEach(O=>{O.optionValues[0].name&&C.set(O.name,O.optionValues[0].name);});let v=i.find(O=>O?.selectedOptions?.every(q=>(C.get(q?.name)||y?.[q?.name])===q?.value)),b=u.get(d.name);!b&&a&&(b=y?.[d.name]||null);let x=b?b===f.name:false;x&&(g=f.name);let k="?"+C.toString();P.push({value:f.name,optionValue:f,isAvailable:v?v.availableForSale:true,to:p+k,search:k,isActive:x,variant:v});}return s({option:{name:d.name,value:g,values:P}})}),[c,i,s]))}var Ka=e=>{if(typeof e?.url>"u")throw new TypeError(`Expected a Request instance, got ${typeof e}`);let t=new URL(e.url).searchParams,r=[];return t.forEach((n,o)=>{r.push({name:o,value:n});}),r};function za(e,t,r){let{pathname:n,search:o}=useLocation(),a=useNavigation();return useMemo(()=>{let s=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(n),c=s&&s.length>0;t=t.startsWith("/")?t.substring(1):t;let i=c?`${s[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(r||a.state!=="loading"?o:a.location.search),alreadyOnProductPage:i===n,path:i}},[n,o,r,e,t,a])}var Xa=function(e){return jsx(RichText,{...e,components:{link:({node:t})=>jsx(Link,{to:t.url,title:t.title,target:t.target,prefetch:"intent",children:t.children}),...e.components}})};var Za=async function({request:t,context:r}){let n=r.storefront,o=r.customerAccount,a=new URL(t.url);if(!n)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let s={};if(n){let u="X-Shopify-Storefront-Access-Token";s.storefront={name:"Storefront API",authHeader:u,accessToken:n.getPublicTokenHeaders()[u],apiUrl:n.getApiUrl(),icon:"SF"};}if(o){let u=await(await fetch(a.origin+"/graphiql/customer-account.schema.json")).json(),p=await o.getAccessToken();u&&(s["customer-account"]={name:"Customer Account API",value:u,authHeader:"Authorization",accessToken:p,apiUrl:o.getApiUrl(),icon:"CA"});}let c="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",i=String.raw;return new Response(i`
476
+ ${b}
477
+ ${O}
478
+ `;function zt(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:n,cartQueryFragment:a,cartMutateFragment:s,buyerIdentity:c}=e,i=t(),u=()=>i||t(),d={storefront:o,getCartId:u,cartFragment:s,customerAccount:n},f=Mt(d),g=async function(...p){p[0].buyerIdentity={...c,...p[0].buyerIdentity};let l=await f(...p);return i=l?.cart?.id,l},y={get:Vt({storefront:o,customerAccount:n,getCartId:u,cartFragment:a}),getCartId:u,setCartId:r,create:g,addLines:async(p,l)=>{let I=p.map(m=>({attributes:m.attributes,quantity:m.quantity,merchandiseId:m.merchandiseId,sellingPlanId:m.sellingPlanId}));return i||l?.cartId?await Ht(d)(I,l):await g({lines:I,buyerIdentity:c},l)},updateLines:Ft(d),removeLines:$t(d),updateDiscountCodes:async(p,l)=>i||l?.cartId?await qt(d)(p,l):await g({discountCodes:p},l),updateGiftCardCodes:async(p,l)=>i||l?.cartId?await Yt(d)(p,l):await g({giftCardCodes:p},l),updateBuyerIdentity:async(p,l)=>i||l?.cartId?await Gt(d)(p,l):await g({buyerIdentity:p},l),updateNote:async(p,l)=>i||l?.cartId?await Bt(d)(p,l):await g({note:p},l),updateSelectedDeliveryOption:Qt(d),updateAttributes:async(p,l)=>i||l?.cartId?await Wt(d)(p,l):await g({attributes:p},l),setMetafields:async(p,l)=>i||l?.cartId?await jt(d)(p,l):await g({metafields:p},l),deleteMetafield:Kt(d),addDeliveryAddresses:ro(d),removeDeliveryAddresses:oo(d),updateDeliveryAddresses:no(d)};return "customMethods"in e?{...y,...e.customMethods??{}}:y}function fa(e){let t=useFetchers();if(!t||!t.length)return e;let r=e?.lines?structuredClone(e):{lines:{nodes:[]}},o=r.lines.nodes,n=false;for(let{formData:a}of t){if(!a)continue;let s=J.getFormInput(a);if(s.action===J.ACTIONS.LinesAdd)for(let c of s.inputs.lines){if(!c.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let i=o.find(u=>u.merchandise.id===c.selectedVariant?.id);n=true,i?(i.quantity=(i.quantity||1)+(c.quantity||1),i.isOptimistic=true):o.unshift({id:to(c.selectedVariant.id),merchandise:c.selectedVariant,isOptimistic:true,quantity:c.quantity||1});}else if(s.action===J.ACTIONS.LinesRemove)for(let c of s.inputs.lineIds){let i=o.findIndex(u=>u.id===c);if(i!==-1){if(rt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${c}' but it doesn't exist in the cart`);}else if(s.action===J.ACTIONS.LinesUpdate)for(let c of s.inputs.lines){let i=o.findIndex(u=>c.id===u.id);if(i>-1){if(rt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}o[i].quantity=c.quantity,o[i].quantity===0&&o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${c.id}' but it doesn't exist in the cart`);}}return n&&(r.isOptimistic=n),r.totalQuantity=o.reduce((a,s)=>a+s.quantity,0),r}var ma="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function ga({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||ma)}var nt="2025-04",he=`Shopify Hydrogen ${xe}`,ao="30243aa5-17c1-465a-8493-944bcc4e88aa",k="customerAccount",Ce="buyer";var $=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function Ue(e,t={}){let r=t.headers?new Headers(t.headers):new Headers({});return r.set("location",e),new Response(null,{status:t.status||302,headers:r})}async function ha({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:o,debugInfo:n}){let a=new URLSearchParams,s=e.get(k),c=s?.refreshToken,i=s?.idToken;if(!c)throw new $("Unauthorized","No refreshToken found in the session. Make sure your session is configured correctly and passed to `createCustomerAccountClient`.");a.append("grant_type","refresh_token"),a.append("refresh_token",c),a.append("client_id",t);let u={"content-type":"application/x-www-form-urlencoded","User-Agent":he,Origin:o};new Date().getTime();let f=r,g=await fetch(f,{method:"POST",headers:u,body:a});if(!g.ok){let I=await g.text();throw new Response(I,{status:g.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:y,expires_in:p,refresh_token:l}=await g.json();if(!y||y.length===0)throw new $("Unauthorized","Invalid access token received.");e.set(k,{accessToken:y,expiresAt:new Date(new Date().getTime()+(p-120)*1e3).getTime()+"",refreshToken:l,idToken:i});}function Ae(e){e.unset(k),e.unset(Ce);}async function so({locks:e,expiresAt:t,session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=ha({session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(c){throw Ae(r),c&&c.status!==401?c:new $("Unauthorized","Login before querying the Customer Account API.")}}function io(){let e=Ca();return uo(e)}async function co(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=Aa(t);return uo(r)}function Ca(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function uo(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Aa(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function po(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function lo(e,t,r,o,n){let a=t;if(!e)throw new $("Unauthorized","oAuth access token was not provided during token exchange.");let s=new URLSearchParams;s.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),s.append("client_id",a),s.append("audience",ao),s.append("subject_token",e),s.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),s.append("scopes","https://api.customers.com/auth/customer.graphql");let c={"content-type":"application/x-www-form-urlencoded","User-Agent":he,Origin:o};new Date().getTime();let u=r,d=await fetch(u,{method:"POST",headers:c,body:s});let f=await d.json();if(f.error)throw new $(f.error_description);return f.access_token}function yo(e){return Sa(e).payload.nonce}function Sa(e){let[t,r,o]=e.split("."),n=JSON.parse(atob(t)),a=JSON.parse(atob(r));return {header:n,payload:a,signature:o}}function at(){return va(Pa())}function Pa(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function va(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function st(e){if(!e)return;let{pathname:t,search:r}=new URL(e),o=t+r,n=new URLSearchParams(r),a=n.get("return_to")||n.get("redirect");if(a){if(mo(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}`);}}function mo(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return false}}function Jt({requestUrl:e,defaultUrl:t,redirectUrl:r}){let o=e,n=fo(e,t),a=r?fo(e,r):n;return mo(e,a.toString())?a.toString():(console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}. Default url ${n} is used instead.`),n.toString())}function fo(e,t){return Ta(t)?new URL(t):new URL(t,new URL(e).origin)}function Ta(e){try{return new URL(e),!0}catch{return false}}function go(e,t){let r=`https://shopify.com/${t}`,o=`https://shopify.com/authentication/${t}`;return function(a){switch(a){case "CA_BASE_URL":return r;case "CA_BASE_AUTH_URL":return o;case "GRAPHQL":return `${r}/account/customer/api/${e}/graphql`;case "AUTH":return `${o}/oauth/authorize`;case "LOGIN_SCOPE":return t?"openid email customer-account-api:full":"openid email https://api.customers.com/auth/customer.graphql";case "TOKEN_EXCHANGE":return `${o}/oauth/token`;case "LOGOUT":return `${o}/logout`}}}function Ia(e,t){if(!e.url)return t;let{pathname:r}=new URL(e.url),o=r.replace(/\.data$/,"").replace(/\/_root$/,"/").replace(/(.+)\/$/,"$1"),n=t+`?${new URLSearchParams({return_to:o}).toString()}`;return Ue(n)}function Xt({session:e,customerAccountId:t,shopId:r,customerApiVersion:o=nt,request:n,waitUntil:a,authUrl:s,customAuthStatusHandler:c,logErrors:i=true,loginPath:u="/account/login",authorizePath:d="/account/authorize",defaultRedirectPath:f="/account",language:g}){if(o!==nt&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${nt}.`),e||console.warn("[h2:warn:createCustomerAccountClient] session is required to use Customer Account API. Ensure the session object passed in exist."),!n?.url)throw new Error("[h2:error:createCustomerAccountClient] The request object does not contain a URL.");let y=c||(()=>Ia(n,u)),p=new URL(n.url),l=p.protocol==="http:"?p.origin.replace("http","https"):p.origin,I=Jt({requestUrl:l,defaultUrl:d,redirectUrl:s}),m=go(o,r),C=Ra(m,t),S=m("GRAPHQL"),T={};async function h({query:v,type:E,variables:x={}}){let D=await _();if(!D)throw y();new Date().getTime();let H=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":he,Origin:l,Authorization:D},body:JSON.stringify({query:v,variables:x})});let j=await H.text(),G={url:S,response:H,type:E,query:v,queryVariables:x,errors:void 0,client:"customer"};if(!H.ok){if(H.status===401)throw Ae(e),y();let U;try{U=z(j);}catch{U=[{message:j}];}De({...G,errors:U});}try{let U=z(j),{errors:K}=U,Se=K?.map(({message:de,...L})=>new ue(de,{...L,clientOperation:`customerAccount.${G.type}`,requestId:H.headers.get("x-request-id"),queryVariables:x,query:v}));return {...U,...K&&{errors:Se}}}catch{De({...G,errors:[{message:j}]});}}async function P(){if(!r)return false;let v=e.get(k),E=v?.accessToken,x=v?.expiresAt;if(!E||!x)return false;let D=W?.();try{await so({locks:T,expiresAt:x,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:m("TOKEN_EXCHANGE"),httpsOrigin:l,debugInfo:{waitUntil:a,stackInfo:D,...oe(n)}});}catch{return false}return true}async function A(){if(!await P())throw y()}async function _(){if(await P())return e.get(k)?.accessToken}async function V(v,E){return C(),v=ge(v),tt(v,"customer.mutate"),fe(h({query:v,type:"mutation",...E}),{logErrors:i})}async function se(v,E){return C(),v=ge(v),et(v,"customer.query"),fe(h({query:v,type:"query",...E}),{logErrors:i})}function Ne(v){e.set(Ce,{...e.get(Ce),...v});}async function Ve(){let v=await _();if(v)return {...e.get(Ce),customerAccessToken:v}}return {login:async v=>{C();let E=new URL(m("AUTH")),x=po(),D=at();E.searchParams.set("client_id",t),E.searchParams.set("scope","openid email"),E.searchParams.append("response_type","code"),E.searchParams.append("redirect_uri",I),E.searchParams.set("scope",m("LOGIN_SCOPE")),E.searchParams.append("state",x),E.searchParams.append("nonce",D);let M=Ea({contextLanguage:g??null,uiLocalesOverride:v?.uiLocales??null});M!=null&&E.searchParams.append("ui_locales",M);let q=io(),H=await co(q);return e.set(k,{...e.get(k),codeVerifier:q,state:x,nonce:D,redirectPath:st(n.url)||Q(n,"Referer")||f}),E.searchParams.append("code_challenge",H),E.searchParams.append("code_challenge_method","S256"),Ue(E.toString())},logout:async v=>{C();let E=e.get(k)?.idToken,x=Jt({requestUrl:l,defaultUrl:l,redirectUrl:v?.postLogoutRedirectUri}),D=E?new URL(`${m("LOGOUT")}?${new URLSearchParams([["id_token_hint",E],["post_logout_redirect_uri",x]]).toString()}`).toString():x;Ae(e);let M=v?.headers instanceof Headers?v?.headers:new Headers(v?.headers);return v?.keepSession||(e.destroy?M.set("Set-Cookie",await e.destroy()):console.warn("[h2:warn:customerAccount] session.destroy is not available on your session implementation. All session data might not be cleared on logout."),e.isPending=false),Ue(D,{headers:M})},isLoggedIn:P,handleAuthStatus:A,getAccessToken:_,getApiUrl:()=>S,mutate:V,query:se,authorize:async()=>{C();let v=p.searchParams.get("code"),E=p.searchParams.get("state");if(!v||!E)throw Ae(e),new $("Unauthorized","No code or state parameter found in the redirect URL.");if(e.get(k)?.state!==E)throw Ae(e),new $("Unauthorized","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");let x=t,D=new URLSearchParams;D.append("grant_type","authorization_code"),D.append("client_id",x),D.append("redirect_uri",I),D.append("code",v);let M=e.get(k)?.codeVerifier;if(!M)throw new $("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");D.append("code_verifier",M);let q={"content-type":"application/x-www-form-urlencoded","User-Agent":he,Origin:l};new Date().getTime();let G=m("TOKEN_EXCHANGE"),U=await fetch(G,{method:"POST",headers:q,body:D});if(!U.ok)throw new Response(await U.text(),{status:U.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:K,expires_in:Se,id_token:de,refresh_token:L}=await U.json(),ee=e.get(k)?.nonce,pt=await yo(de);if(ee!==pt)throw new $("Unauthorized",`Returned nonce does not match: ${ee} !== ${pt}`);let ur=K;r||(ur=await lo(K,t,m("TOKEN_EXCHANGE"),l,{...oe(n)}));let ko=e.get(k)?.redirectPath;return e.set(k,{accessToken:ur,expiresAt:new Date(new Date().getTime()+(Se-120)*1e3).getTime()+"",refreshToken:L,idToken:de}),Ue(ko||f)},setBuyer:Ne,getBuyer:Ve,UNSTABLE_setBuyer:v=>{B("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),Ne(v);},UNSTABLE_getBuyer:()=>(B("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),Ve())}}function Ra(e,t){return function(){try{if(!t)throw Error();new URL(e("CA_BASE_URL")),new URL(e("CA_BASE_AUTH_URL"));}catch{console.error(new Error("[h2:error:customerAccount] You do not have the valid credential to use Customer Account API.\nRun `h2 env pull` to link your store credentials."));let o="Internal Server Error";throw new Response(o,{status:500})}}}function Ea(e){let t=ho(e.contextLanguage??null);return ho(e.uiLocalesOverride)??t??null}function ho(e){if(e==null)return null;let o=wa(e).toLowerCase().replaceAll("_","-").split("-"),n=o.at(0)??null,a=o.at(1)??null;return a?`${n}-${a.toUpperCase()}`:n}var ba={PT:"PT_PT",ZH:"ZH_CN"};function wa(e){return ba[e]??e}function Oa(e){let{env:t,request:r,cache:o,waitUntil:n,i18n:a,session:s,logErrors:c,storefront:i={},customerAccount:u,cart:d={},buyerIdentity:f}=e;s||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),u?.unstableB2b&&B("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:g}=Zr({cache:o,waitUntil:n,i18n:a,logErrors:c,storefrontHeaders:i.headers||xa(r),storefrontApiVersion:i.apiVersion,storefrontId:t.PUBLIC_STOREFRONT_ID,storeDomain:t.PUBLIC_STORE_DOMAIN,privateStorefrontToken:t.PRIVATE_STOREFRONT_API_TOKEN,publicStorefrontToken:t.PUBLIC_STOREFRONT_API_TOKEN}),y=Xt({session:s,request:r,waitUntil:n,logErrors:c,customerApiVersion:u?.apiVersion,authUrl:u?.authUrl,customAuthStatusHandler:u?.customAuthStatusHandler,language:a?.language,customerAccountId:t.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,shopId:t.SHOP_ID}),p=zt({getCartId:d.getId||kt(r.headers),setCartId:d.setId||Nt(),cartQueryFragment:d.queryFragment,cartMutateFragment:d.mutateFragment,customMethods:d.customMethods,buyerIdentity:f,storefront:g,customerAccount:y});return {storefront:g,customerAccount:y,cart:p,env:t,waitUntil:n,session:s}}function xa(e){return {requestGroupId:Q(e,"request-id"),buyerIp:Q(e,"oxygen-buyer-ip"),buyerIpSig:Q(e,"X-Shopify-Client-IP-Sig"),cookie:Q(e,"cookie"),purpose:Q(e,"sec-purpose")||Q(e,"purpose")}}function _a({build:e,mode:t,poweredByHeader:r=true,getLoadContext:o,collectTrackingInformation:n=true,proxyStandardRoutes:a=true}){let s=createRequestHandler(e,t),c=r?i=>i.headers.append("powered-by","Shopify, Hydrogen"):void 0;return async i=>{let u=i.method;if((u==="GET"||u==="HEAD")&&i.body)return new Response(`${u} requests cannot have a body`,{status:400});let d=new URL(i.url);if(d.pathname.includes("//"))return new Response(null,{status:301,headers:{location:d.pathname.replace(/\/+/g,"/")}});let f=o?await o(i):void 0,g=f?.storefront;if(a&&(g||B("[h2:createRequestHandler] Storefront instance is required to proxy standard routes."),g?.isStorefrontApiUrl(i))){let p=await g.forward(i);return c?.(p),p}let y=await s(i,f);if(g&&a){n&&g.setCollectedSubrequestHeaders(y);let p=i.headers.get("sec-fetch-dest");(p&&p==="document"||i.headers.get("accept")?.includes("text/html"))&&Pe(y,{[Fe]:"1"});}return c?.(y),y}}var Co=createContext(void 0),Va=Co.Provider,Zt=()=>useContext(Co);function Ma(e){let t=at(),r=Ha(t,e);return {nonce:t,header:r,NonceProvider:({children:n})=>createElement(Va,{value:t},n)}}function Ha(e,t){let{shop:r,...o}=t??{},n=`'nonce-${e}'`,a=["'self'","'unsafe-inline'","https://cdn.shopify.com"],s=["'self'","https://monorail-edge.shopifysvc.com"];r&&r.checkoutDomain&&s.push(`https://${r.checkoutDomain}`),r&&r.storeDomain&&s.push(`https://${r.storeDomain}`);let i={baseUri:["'self'"],defaultSrc:["'self'",n,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:a,connectSrc:s},u=Object.assign({},i,o);for(let d in i){let f=o[d];d&&f&&(u[d]=Fa(f,i[d]));}return u.scriptSrc instanceof Array?u.scriptSrc=[...u.scriptSrc.filter(d=>!d.startsWith("'nonce")),n]:u.defaultSrc instanceof Array&&(u.defaultSrc=[...u.defaultSrc.filter(d=>!d.startsWith("'nonce")),n]),Na({directives:u})}function Fa(e,t){let r=typeof t=="string"?[t]:t,o=Array.isArray(e)?e:[String(e)];return Array.isArray(r)?r.every(a=>a==="'none'")?o:[...o,...r]:r}var Ga=forwardRef((e,t)=>{let{waitForHydration:r,src:o,...n}=e,a=Zt();return r?jsx(Ba,{src:o,options:n}):jsx("script",{suppressHydrationWarning:true,...n,src:o,nonce:a,ref:t})});function Ba({src:e,options:t}){if(!e)throw new Error("`waitForHydration` with the Script component requires a `src` prop");return useLoadScript(e,{attributes:t}),null}async function Wa(e){return e}function Ka(e){let t=useFetchers(),r={};for(let{formData:o}of t)if(o?.get("optimistic-identifier")===e)try{if(o.has("optimistic-data")){let n=JSON.parse(String(o.get("optimistic-data")));Object.assign(r,n);}}catch{}return r}function Ya({id:e,data:t}){return jsxs(Fragment,{children:[jsx("input",{type:"hidden",name:"optimistic-identifier",value:e}),jsx("input",{type:"hidden",name:"optimistic-data",value:JSON.stringify(t)})]})}function es({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null),namespace:r=""}){let [o,n]=useState(false),a=useNavigation(),s=useLocation();useNavigate();useEffect(()=>{a.state==="idle"&&n(false);},[a.state]);let{endCursor:i,hasNextPage:u,hasPreviousPage:d,nextPageUrl:f,nodes:g,previousPageUrl:y,startCursor:p}=ts(e,r),l=useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:i,hasPreviousPage:d,hasNextPage:u,startCursor:p},nodes:g}}}),[i,u,d,p,g,r,s.state]),I=useMemo(()=>forwardRef(function(S,T){return u?createElement(Link,{preventScrollReset:true,...S,to:f,state:l,replace:true,ref:T,onClick:()=>n(true)}):null}),[u,f,l]),m=useMemo(()=>forwardRef(function(S,T){return d?createElement(Link,{preventScrollReset:true,...S,to:y,state:l,replace:true,ref:T,onClick:()=>n(true)}):null}),[d,y,l]);return t({state:l,hasNextPage:u,hasPreviousPage:d,isLoading:o,nextPageUrl:f,nodes:g,previousPageUrl:y,NextLink:I,PreviousLink:m})}function ct(e,t){let r=new URLSearchParams(e);return Object.keys(t?.pagination||{}).forEach(n=>{let a=n===""?"":`${n}_`,s=`${a}cursor`,c=`${a}direction`;r.delete(s),r.delete(c);}),r.toString()}function Le(e){throw new Error(`The Pagination component requires ${"`"+e+"`"} to be a part of your query. See the guide on how to setup your query to include ${"`"+e+"`"}: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#setup-the-paginated-query`)}function ts(e,t=""){e.pageInfo||Le("pageInfo"),typeof e.pageInfo.startCursor>"u"&&Le("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&Le("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&Le("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&Le("pageInfo.hasPreviousPage");let r=useNavigation(),o=useNavigate(),{state:n,search:a,pathname:s}=useLocation(),c=t?`${t}_cursor`:"cursor",i=t?`${t}_direction`:"direction",f=new URLSearchParams(a).get(i)==="previous",g=useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!n?.pagination?.[t]?.nodes?flattenConnection(e):f?[...flattenConnection(e),...n.pagination[t].nodes||[]]:[...n.pagination[t].nodes||[],...flattenConnection(e)],[n,e,t]),y=useMemo(()=>{let m=globalThis?.window?.__hydrogenHydrated,C=n?.pagination?.[t]?.pageInfo,S=!m||C?.startCursor===void 0?e.pageInfo.startCursor:C.startCursor,T=!m||C?.endCursor===void 0?e.pageInfo.endCursor:C.endCursor,h=!m||C?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:C.hasPreviousPage,P=!m||C?.hasNextPage===void 0?e.pageInfo.hasNextPage:C.hasNextPage;return n?.pagination?.[t]?.nodes&&(f?(S=e.pageInfo.startCursor,h=e.pageInfo.hasPreviousPage):(T=e.pageInfo.endCursor,P=e.pageInfo.hasNextPage)),{startCursor:S,endCursor:T,hasPreviousPage:h,hasNextPage:P}},[f,n,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),p=useRef({params:ct(a,n),pathname:s});useEffect(()=>{window.__hydrogenHydrated=true;},[]),useEffect(()=>{let m=ct(a,n),C=p.current.params;(s!==p.current.pathname||m!==C)&&!(r.state==="idle"&&!r.location)&&(p.current={pathname:s,params:ct(a,n)},o(`${s}?${ct(a,n)}`,{replace:true,preventScrollReset:true,state:{nodes:void 0,pageInfo:void 0}}));},[s,a,n]);let l=useMemo(()=>{let m=new URLSearchParams(a);return m.set(i,"previous"),y.startCursor&&m.set(c,y.startCursor),`?${m.toString()}`},[a,y.startCursor]),I=useMemo(()=>{let m=new URLSearchParams(a);return m.set(i,"next"),y.endCursor&&m.set(c,y.endCursor),`?${m.toString()}`},[a,y.endCursor]);return {...y,previousPageUrl:l,nextPageUrl:I,nodes:g}}function rs(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r,namespace:o=""}=t,n=new URLSearchParams(new URL(e.url).search),a=o?`${o}_cursor`:"cursor",s=o?`${o}_direction`:"direction",c=n.get(a)??void 0;return (n.get(s)==="previous"?"previous":"next")==="previous"?{last:r,startCursor:c??null}:{first:r,endCursor:c??null}}function ss(e,t){let r=useNavigation(),[o,n]=useState([]);if(useEffect(()=>{Promise.resolve(t).then(a=>{a&&n(a instanceof Array?a:a.product?.variants?.nodes||[]);}).catch(a=>{reportError(new Error("[h2:error:useOptimisticVariant] An error occurred while resolving the variants for the optimistic product hook.",{cause:a}));});},[JSON.stringify(t)]),r.state==="loading"){let a=new URLSearchParams(r.location.search),s=false,c=o.find(i=>i.selectedOptions?i.selectedOptions.every(u=>a.get(u.name)===u.value):(s||(s=true,reportError(new Error("[h2:error:useOptimisticVariant] The optimistic product hook requires your product query to include variants with the selectedOptions field."))),false));if(c)return {...c,isOptimistic:true}}return e}function ls({handle:e,options:t=[],variants:r=[],productPath:o="products",waitForNavigation:n=false,selectedVariant:a,children:s}){let c=t;c[0]?.values&&(B("[h2:warn:VariantSelector] product.options.values is deprecated. Use product.options.optionValues instead."),c[0]&&!c[0].optionValues&&(c=t.map(p=>({...p,optionValues:p.values?.map(l=>({name:l}))||[]}))));let i=r instanceof Array?r:flattenConnection(r),{searchParams:u,path:d,alreadyOnProductPage:f}=fs(e,o,n),g=c.filter(p=>p?.optionValues?.length===1),y=a?a?.selectedOptions?.reduce((p,l)=>(p[l.name]=l.value,p),{}):{};return createElement(Fragment$1,null,...useMemo(()=>c.map(p=>{let l,I=[];for(let m of p.optionValues){let C=new URLSearchParams(f?u:void 0);C.set(p.name,m.name),g.forEach(A=>{A.optionValues[0].name&&C.set(A.name,A.optionValues[0].name);});let S=i.find(A=>A?.selectedOptions?.every(_=>(C.get(_?.name)||y?.[_?.name])===_?.value)),T=u.get(p.name);!T&&a&&(T=y?.[p.name]||null);let h=T?T===m.name:false;h&&(l=m.name);let P="?"+C.toString();I.push({value:m.name,optionValue:m,isAvailable:S?S.availableForSale:true,to:d+P,search:P,isActive:h,variant:S});}return s({option:{name:p.name,value:l,values:I}})}),[c,i,s]))}var ys=e=>{if(typeof e?.url>"u")throw new TypeError(`Expected a Request instance, got ${typeof e}`);let t=new URL(e.url).searchParams,r=[];return t.forEach((o,n)=>{r.push({name:n,value:o});}),r};function fs(e,t,r){let{pathname:o,search:n}=useLocation(),a=useNavigation();return useMemo(()=>{let s=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(o),c=s&&s.length>0;t=t.startsWith("/")?t.substring(1):t;let i=c?`${s[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(r||a.state!=="loading"?n:a.location.search),alreadyOnProductPage:i===o,path:i}},[o,n,r,e,t,a])}var hs=function(e){return jsx(RichText,{...e,components:{link:({node:t})=>jsx(Link,{to:t.url,title:t.title,target:t.target,prefetch:"intent",children:t.children}),...e.components}})};var Cs=async function({request:t,context:r}){let o=r.storefront,n=r.customerAccount,a=new URL(t.url);if(!o)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let s={};if(o){let u="X-Shopify-Storefront-Access-Token";s.storefront={name:"Storefront API",authHeader:u,accessToken:o.getPublicTokenHeaders()[u],apiUrl:o.getApiUrl(),icon:"SF"};}if(n){let u=await(await fetch(a.origin+"/graphiql/customer-account.schema.json")).json(),d=await n.getAccessToken();u&&(s["customer-account"]={name:"Customer Account API",value:u,authHeader:"Authorization",accessToken:d,apiUrl:n.getApiUrl(),icon:"CA"});}let c="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",i=String.raw;return new Response(i`
479
479
  <!DOCTYPE html>
480
480
  <html lang="en">
481
481
  <head>
@@ -741,7 +741,7 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
741
741
  </script>
742
742
  </body>
743
743
  </html>
744
- `,{status:200,headers:{"content-type":"text/html"}})};async function es(e){let{storefront:t,request:r,noAdminRedirect:n,matchQueryParams:o,response:a=new Response("Not Found",{status:404})}=e,s=new URL(r.url),{pathname:c,searchParams:i}=s,u=i.has("_data");i.delete("redirect"),i.delete("return_to"),i.delete("_data");let p=(o?s.toString().replace(s.origin,""):c).toLowerCase();if(s.pathname==="/admin"&&!n)return Qt(`${t.getShopifyDomain()}/admin`,u,i,o);try{let{urlRedirects:l}=await t.query(ts,{variables:{query:"path:"+p.replace(/\/+$/,"")}}),m=l?.edges?.[0]?.node?.target;if(m)return Qt(m,u,i,o);let y=Je(r.url);if(y)return Qt(y,u,i,o)}catch(l){console.error(`Failed to fetch redirects from Storefront API for route ${p}`,l);}return a}var Bt="https://example.com";function Qt(e,t,r,n){let o=new URL(e,Bt);if(!n)for(let[a,s]of r)o.searchParams.append(a,s);return t?new Response(null,{status:200,headers:{"X-Remix-Redirect":o.toString().replace(Bt,""),"X-Remix-Status":"301"}}):new Response(null,{status:301,headers:{location:o.toString().replace(Bt,"")}})}var ts=`#graphql
744
+ `,{status:200,headers:{"content-type":"text/html"}})};async function As(e){let{storefront:t,request:r,noAdminRedirect:o,matchQueryParams:n,response:a=new Response("Not Found",{status:404})}=e,s=new URL(r.url),{pathname:c,searchParams:i}=s,u=i.has("_data");i.delete("redirect"),i.delete("return_to"),i.delete("_data");let d=(n?s.toString().replace(s.origin,""):c).toLowerCase();if(s.pathname==="/admin"&&!o)return ar(`${t.getShopifyDomain()}/admin`,u,i,n);try{let{urlRedirects:f}=await t.query(Ss,{variables:{query:"path:"+d.replace(/\/+$/,"")}}),g=f?.edges?.[0]?.node?.target;if(g)return ar(g,u,i,n);let y=st(r.url);if(y)return ar(y,u,i,n)}catch(f){console.error(`Failed to fetch redirects from Storefront API for route ${d}`,f);}return a}var nr="https://example.com";function ar(e,t,r,o){let n=new URL(e,nr);if(!o)for(let[a,s]of r)n.searchParams.append(a,s);return t?new Response(null,{status:200,headers:{"X-Remix-Redirect":n.toString().replace(nr,""),"X-Remix-Status":"301"}}):new Response(null,{status:301,headers:{location:n.toString().replace(nr,"")}})}var Ss=`#graphql
745
745
  query redirects($query: String) {
746
746
  urlRedirects(first: 1, query: $query) {
747
747
  edges {
@@ -751,24 +751,24 @@ API response error: ${t.status}`,u=new ie(i,{query:o,queryVariables:a,cause:{err
751
751
  }
752
752
  }
753
753
  }
754
- `;var rs={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},os=/[&><\u2028\u2029]/g;function ho(e){return e.replace(os,t=>rs[t])}var te="Error in SEO input: ",K={title:{validate:e=>{if(typeof e!="string")throw new Error(te.concat("`title` should be a string"));if(typeof e=="string"&&e.length>120)throw new Error(te.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(te.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(te.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(te.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(te.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(te.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(te.concat("`handle` should start with `@`"));return e}}};function Co(e){let t=[];for(let r of Object.keys(e))switch(r){case "title":{let n=z(K.title,e.title),o=jt(e?.titleTemplate,n);if(!o)break;t.push(L("title",{title:o}),L("meta",{property:"og:title",content:o}),L("meta",{name:"twitter:title",content:o}));break}case "description":{let n=z(K.description,e.description);if(!n)break;t.push(L("meta",{name:"description",content:n}),L("meta",{property:"og:description",content:n}),L("meta",{name:"twitter:description",content:n}));break}case "url":{let n=z(K.url,e.url);if(!n)break;let a=n.split("?")[0].replace(/\/$/,"");t.push(L("link",{rel:"canonical",href:a}),L("meta",{property:"og:url",content:a}));break}case "handle":{let n=z(K.handle,e.handle);if(!n)break;t.push(L("meta",{name:"twitter:site",content:n}),L("meta",{name:"twitter:creator",content:n}));break}case "media":{let n,o=re(e.media);for(let a of o)if(typeof a=="string"&&t.push(L("meta",{name:"og:image",content:a})),a&&typeof a=="object"){let s=a.type||"image",c=a?{url:a?.url,secure_url:a?.url,type:Kt(a.url),width:a?.width,height:a?.height,alt:a?.altText}:{};for(let i of Object.keys(c))c[i]&&(n=c[i],t.push(L("meta",{property:`og:${s}:${i}`,content:n},c.url)));}break}case "jsonLd":{let n=re(e.jsonLd),o=0;for(let a of n){if(typeof a!="object")continue;let s=L("script",{type:"application/ld+json",children:JSON.stringify(a,(c,i)=>typeof i=="string"?ho(i):i)},`json-ld-${a?.["@type"]||a?.name||o++}`);t.push(s);}break}case "alternates":{let n=re(e.alternates);for(let o of n){if(!o)continue;let{language:a,url:s,default:c}=o,i=a?`${a}${c?"-default":""}`:void 0;t.push(L("link",{rel:"alternate",hrefLang:i,href:s}));}break}case "robots":{if(!e.robots)break;let{maxImagePreview:n,maxSnippet:o,maxVideoPreview:a,noArchive:s,noFollow:c,noImageIndex:i,noIndex:u,noSnippet:p,noTranslate:l,unavailableAfter:m}=e.robots,y=[s&&"noarchive",i&&"noimageindex",p&&"nosnippet",l&&"notranslate",n&&`max-image-preview:${n}`,o&&`max-snippet:${o}`,a&&`max-video-preview:${a}`,m&&`unavailable_after:${m}`],d=(u?"noindex":"index")+","+(c?"nofollow":"follow");for(let g of y)g&&(d+=`,${g}`);t.push(L("meta",{name:"robots",content:d}));break}}return t.flat().sort((r,n)=>r.key.localeCompare(n.key))}function L(e,t,r){let n={tag:e,props:{},key:""};return e==="title"?(n.children=t.title,n.key=Wt(n),n):e==="script"?(n.children=typeof t.children=="string"?t.children:"",n.key=Wt(n,r),delete t.children,n.props=t,n):(n.props=t,Object.keys(n.props).forEach(o=>!n.props[o]&&delete n.props[o]),n.key=Wt(n,r),n)}function Wt(e,t){let{tag:r,props:n}=e;if(r==="title")return "0-title";if(r==="meta"){let o=n.content===t&&typeof n.property=="string"&&!n.property.endsWith("secure_url")&&"0";return [r,...[t,o],n.property||n.name].filter(s=>s).join("-")}return r==="link"?[r,n.rel,n.hrefLang||n.media].filter(a=>a).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${n.type}`}function jt(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function Kt(e){switch(e&&e.split(".").pop()){case "svg":return "image/svg+xml";case "png":return "image/png";case "gif":return "image/gif";case "swf":return "application/x-shockwave-flash";case "mp3":return "audio/mpeg";case "jpg":case "jpeg":default:return "image/jpeg"}}function re(e){return Array.isArray(e)?e:[e]}function z(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}function ns(...e){let t=[],r=e.reduce((n,o)=>{if(!o)return n;Object.keys(o).forEach(s=>!o[s]&&delete o[s]);let{jsonLd:a}=o;return a?n?.jsonLd?{...n,...o,jsonLd:re(n.jsonLd).concat(a)}:{...n,...o,jsonLd:[a]}:{...n,...o}},{})||{};for(let n of Object.keys(r))switch(n){case "title":{let o=z(K.title,r.title),a=jt(r?.titleTemplate,o);if(!a)break;t.push({title:a},{property:"og:title",content:a},{property:"twitter:title",content:a});break}case "description":{let o=z(K.description,r.description);if(!o)break;t.push({name:"description",content:o},{property:"og:description",content:o},{property:"twitter:description",content:o});break}case "url":{let o=z(K.url,r.url);if(!o)break;let s=o.split("?")[0].replace(/\/$/,"");t.push({tagName:"link",rel:"canonical",href:s},{property:"og:url",content:s});break}case "handle":{let o=z(K.handle,r.handle);if(!o)break;t.push({property:"twitter:site",content:o},{property:"twitter:creator",content:o});break}case "media":{let o,a=re(r.media);for(let s of a)if(typeof s=="string"&&t.push({property:"og:image",content:s}),s&&typeof s=="object"){let c=s.type||"image",i=s?{url:s?.url,secure_url:s?.url,type:Kt(s.url),width:s?.width,height:s?.height,alt:s?.altText}:{};for(let u of Object.keys(i))i[u]&&(o=i[u],t.push({property:`og:${c}:${u}`,content:o}));}break}case "jsonLd":{let o=re(r.jsonLd);for(let s of o)typeof s!="object"||Object.keys(s).length===0||t.push({"script:ld+json":s});break}case "alternates":{let o=re(r.alternates);for(let a of o){if(!a)continue;let{language:s,url:c,default:i}=a,u=s?`${s}${i?"-default":""}`:void 0;t.push({tagName:"link",rel:"alternate",hrefLang:u,href:c});}break}case "robots":{if(!r.robots)break;let{maxImagePreview:o,maxSnippet:a,maxVideoPreview:s,noArchive:c,noFollow:i,noImageIndex:u,noIndex:p,noSnippet:l,noTranslate:m,unavailableAfter:y}=r.robots,d=[c&&"noarchive",u&&"noimageindex",l&&"nosnippet",m&&"notranslate",o&&`max-image-preview:${o}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,y&&`unavailable_after:${y}`],g=(p?"noindex":"index")+","+(i?"nofollow":"follow");for(let P of d)P&&(g+=`,${P}`);t.push({name:"robots",content:g});break}}return t}var ps=lazy(()=>import('./log-seo-tags-TY72EQWZ.js'));function ds({debug:e}){let t=useMatches(),r=useLocation();console.warn("[h2:warn:Seo] The `<Seo/>` component is deprecated. Use `getSeoMeta` instead.\nSee: https://shopify.dev/docs/api/hydrogen/2025-04/utilities/getseometa");let n=useMemo(()=>t.flatMap(s=>{let{handle:c,...i}=s,u={...i,...r},p=c?.seo,l=i?.data?.seo;return !p&&!l?[]:p?et(p,u):[l]}).reduce((s,c)=>{Object.keys(c).forEach(u=>!c[u]&&delete c[u]);let{jsonLd:i}=c;return i?s?.jsonLd?Array.isArray(i)?{...s,...c,jsonLd:[...s.jsonLd,...i]}:{...s,...c,jsonLd:[...s.jsonLd,i]}:{...s,...c,jsonLd:[i]}:{...s,...c}},{}),[t,r]),{html:o,loggerMarkup:a}=useMemo(()=>{let s=Co(n),c=s.map(u=>u.tag==="script"?createElement(u.tag,{...u.props,key:u.key,dangerouslySetInnerHTML:{__html:u.children}}):createElement(u.tag,{...u.props,key:u.key},u.children)),i=createElement(Suspense,{fallback:null},createElement(ps,{headTags:s}));return {html:c,loggerMarkup:i}},[n]);return createElement(Fragment$1,null,o,e&&a)}function et(e,...t){if(e instanceof Function)return et(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((n,o)=>[...n,et(o)],[]),r):e instanceof Object?(Object.entries(e).forEach(([o,a])=>{r[o]=et(a,...t);}),r):e}function ys(e){return jsx(ShopPayButton,{channel:"hydrogen",...e})}var ms=`<?xml version="1.0" encoding="UTF-8"?>
754
+ `;var Ps={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},vs=/[&><\u2028\u2029]/g;function xo(e){return e.replace(vs,t=>Ps[t])}var ne="Error in SEO input: ",X={title:{validate:e=>{if(typeof e!="string")throw new Error(ne.concat("`title` should be a string"));if(typeof e=="string"&&e.length>120)throw new Error(ne.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(ne.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(ne.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(ne.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(ne.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(ne.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(ne.concat("`handle` should start with `@`"));return e}}};function Do(e){let t=[];for(let r of Object.keys(e))switch(r){case "title":{let o=Z(X.title,e.title),n=ir(e?.titleTemplate,o);if(!n)break;t.push(N("title",{title:n}),N("meta",{property:"og:title",content:n}),N("meta",{name:"twitter:title",content:n}));break}case "description":{let o=Z(X.description,e.description);if(!o)break;t.push(N("meta",{name:"description",content:o}),N("meta",{property:"og:description",content:o}),N("meta",{name:"twitter:description",content:o}));break}case "url":{let o=Z(X.url,e.url);if(!o)break;let a=o.split("?")[0].replace(/\/$/,"");t.push(N("link",{rel:"canonical",href:a}),N("meta",{property:"og:url",content:a}));break}case "handle":{let o=Z(X.handle,e.handle);if(!o)break;t.push(N("meta",{name:"twitter:site",content:o}),N("meta",{name:"twitter:creator",content:o}));break}case "media":{let o,n=ae(e.media);for(let a of n)if(typeof a=="string"&&t.push(N("meta",{name:"og:image",content:a})),a&&typeof a=="object"){let s=a.type||"image",c=a?{url:a?.url,secure_url:a?.url,type:cr(a.url),width:a?.width,height:a?.height,alt:a?.altText}:{};for(let i of Object.keys(c))c[i]&&(o=c[i],t.push(N("meta",{property:`og:${s}:${i}`,content:o},c.url)));}break}case "jsonLd":{let o=ae(e.jsonLd),n=0;for(let a of o){if(typeof a!="object")continue;let s=N("script",{type:"application/ld+json",children:JSON.stringify(a,(c,i)=>typeof i=="string"?xo(i):i)},`json-ld-${a?.["@type"]||a?.name||n++}`);t.push(s);}break}case "alternates":{let o=ae(e.alternates);for(let n of o){if(!n)continue;let{language:a,url:s,default:c}=n,i=a?`${a}${c?"-default":""}`:void 0;t.push(N("link",{rel:"alternate",hrefLang:i,href:s}));}break}case "robots":{if(!e.robots)break;let{maxImagePreview:o,maxSnippet:n,maxVideoPreview:a,noArchive:s,noFollow:c,noImageIndex:i,noIndex:u,noSnippet:d,noTranslate:f,unavailableAfter:g}=e.robots,y=[s&&"noarchive",i&&"noimageindex",d&&"nosnippet",f&&"notranslate",o&&`max-image-preview:${o}`,n&&`max-snippet:${n}`,a&&`max-video-preview:${a}`,g&&`unavailable_after:${g}`],p=(u?"noindex":"index")+","+(c?"nofollow":"follow");for(let l of y)l&&(p+=`,${l}`);t.push(N("meta",{name:"robots",content:p}));break}}return t.flat().sort((r,o)=>r.key.localeCompare(o.key))}function N(e,t,r){let o={tag:e,props:{},key:""};return e==="title"?(o.children=t.title,o.key=sr(o),o):e==="script"?(o.children=typeof t.children=="string"?t.children:"",o.key=sr(o,r),delete t.children,o.props=t,o):(o.props=t,Object.keys(o.props).forEach(n=>!o.props[n]&&delete o.props[n]),o.key=sr(o,r),o)}function sr(e,t){let{tag:r,props:o}=e;if(r==="title")return "0-title";if(r==="meta"){let n=o.content===t&&typeof o.property=="string"&&!o.property.endsWith("secure_url")&&"0";return [r,...[t,n],o.property||o.name].filter(s=>s).join("-")}return r==="link"?[r,o.rel,o.hrefLang||o.media].filter(a=>a).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${o.type}`}function ir(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function cr(e){switch(e&&e.split(".").pop()){case "svg":return "image/svg+xml";case "png":return "image/png";case "gif":return "image/gif";case "swf":return "application/x-shockwave-flash";case "mp3":return "audio/mpeg";case "jpg":case "jpeg":default:return "image/jpeg"}}function ae(e){return Array.isArray(e)?e:[e]}function Z(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}function Ts(...e){let t=[],r=e.reduce((o,n)=>{if(!n)return o;Object.keys(n).forEach(s=>!n[s]&&delete n[s]);let{jsonLd:a}=n;return a?o?.jsonLd?{...o,...n,jsonLd:ae(o.jsonLd).concat(a)}:{...o,...n,jsonLd:[a]}:{...o,...n}},{})||{};for(let o of Object.keys(r))switch(o){case "title":{let n=Z(X.title,r.title),a=ir(r?.titleTemplate,n);if(!a)break;t.push({title:a},{property:"og:title",content:a},{property:"twitter:title",content:a});break}case "description":{let n=Z(X.description,r.description);if(!n)break;t.push({name:"description",content:n},{property:"og:description",content:n},{property:"twitter:description",content:n});break}case "url":{let n=Z(X.url,r.url);if(!n)break;let s=n.split("?")[0].replace(/\/$/,"");t.push({tagName:"link",rel:"canonical",href:s},{property:"og:url",content:s});break}case "handle":{let n=Z(X.handle,r.handle);if(!n)break;t.push({property:"twitter:site",content:n},{property:"twitter:creator",content:n});break}case "media":{let n,a=ae(r.media);for(let s of a)if(typeof s=="string"&&t.push({property:"og:image",content:s}),s&&typeof s=="object"){let c=s.type||"image",i=s?{url:s?.url,secure_url:s?.url,type:cr(s.url),width:s?.width,height:s?.height,alt:s?.altText}:{};for(let u of Object.keys(i))i[u]&&(n=i[u],t.push({property:`og:${c}:${u}`,content:n}));}break}case "jsonLd":{let n=ae(r.jsonLd);for(let s of n)typeof s!="object"||Object.keys(s).length===0||t.push({"script:ld+json":s});break}case "alternates":{let n=ae(r.alternates);for(let a of n){if(!a)continue;let{language:s,url:c,default:i}=a,u=s?`${s}${i?"-default":""}`:void 0;t.push({tagName:"link",rel:"alternate",hrefLang:u,href:c});}break}case "robots":{if(!r.robots)break;let{maxImagePreview:n,maxSnippet:a,maxVideoPreview:s,noArchive:c,noFollow:i,noImageIndex:u,noIndex:d,noSnippet:f,noTranslate:g,unavailableAfter:y}=r.robots,p=[c&&"noarchive",u&&"noimageindex",f&&"nosnippet",g&&"notranslate",n&&`max-image-preview:${n}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,y&&`unavailable_after:${y}`],l=(d?"noindex":"index")+","+(i?"nofollow":"follow");for(let I of p)I&&(l+=`,${I}`);t.push({name:"robots",content:l});break}}return t}var Os=lazy(()=>import('./log-seo-tags-TY72EQWZ.js'));function xs({debug:e}){let t=useMatches(),r=useLocation();console.warn("[h2:warn:Seo] The `<Seo/>` component is deprecated. Use `getSeoMeta` instead.\nSee: https://shopify.dev/docs/api/hydrogen/2025-04/utilities/getseometa");let o=useMemo(()=>t.flatMap(s=>{let{handle:c,...i}=s,u={...i,...r},d=c?.seo,f=i?.data?.seo;return !d&&!f?[]:d?ut(d,u):[f]}).reduce((s,c)=>{Object.keys(c).forEach(u=>!c[u]&&delete c[u]);let{jsonLd:i}=c;return i?s?.jsonLd?Array.isArray(i)?{...s,...c,jsonLd:[...s.jsonLd,...i]}:{...s,...c,jsonLd:[...s.jsonLd,i]}:{...s,...c,jsonLd:[i]}:{...s,...c}},{}),[t,r]),{html:n,loggerMarkup:a}=useMemo(()=>{let s=Do(o),c=s.map(u=>u.tag==="script"?createElement(u.tag,{...u.props,key:u.key,dangerouslySetInnerHTML:{__html:u.children}}):createElement(u.tag,{...u.props,key:u.key},u.children)),i=createElement(Suspense,{fallback:null},createElement(Os,{headTags:s}));return {html:c,loggerMarkup:i}},[o]);return createElement(Fragment$1,null,n,e&&a)}function ut(e,...t){if(e instanceof Function)return ut(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((o,n)=>[...o,ut(n)],[]),r):e instanceof Object?(Object.entries(e).forEach(([n,a])=>{r[n]=ut(a,...t);}),r):e}function _s(e){return jsx(ShopPayButton,{channel:"hydrogen",...e})}var Ls=`<?xml version="1.0" encoding="UTF-8"?>
755
755
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
756
- `,gs=`
757
- </sitemapindex>`,Po=`<?xml version="1.0" encoding="UTF-8"?>
758
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">`,So="</urlset>";async function hs(e){let{storefront:t,request:r,types:n=["products","pages","collections","metaObjects","articles","blogs"],customChildSitemaps:o=[]}=e;if(!r||!r.url)throw new Error("A request object is required to generate a sitemap index");if(!t||!t.query)throw new Error("A storefront client is required to generate a sitemap index");let a=await t.query(ws);if(!a)throw console.warn("[h2:sitemap:warning] Sitemap index is available in API version 2024-10 and later"),new Response("Sitemap index not found.",{status:404});let s=new URL(r.url).origin,c=ms+n.map(i=>{if(!a[i])throw new Error(`[h2:sitemap:error] No data found for type ${i}. Check types passed to \`getSitemapIndex\``);return As(i,a[i].pagesCount.count,s)}).join(`
759
- `)+o.map(i=>" <sitemap><loc>"+(s+(i.startsWith("/")?i:"/"+i))+"</loc></sitemap>").join(`
760
- `)+gs;return new Response(c,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${60*60*24}`}})}async function Cs(e){let{storefront:t,request:r,params:n,getLink:o,locales:a=[],getChangeFreq:s,noItemsFallback:c="/"}=e;if(!n)throw new Error("[h2:sitemap:error] Remix params object is required to generate a sitemap");if(!r||!r.url)throw new Error("A request object is required to generate a sitemap");if(!t||!t.query)throw new Error("A storefront client is required to generate a index");if(!o)throw new Error("A `getLink` function to generate each resource is required to build a sitemap");if(!n.type||!n.page)throw new Response("No data found",{status:404});let i=n.type,u=Os[i];if(!u)throw new Response("Not found",{status:404});let p=await t.query(u,{variables:{page:parseInt(n.page,10)}});if(!p)throw console.warn("[h2:sitemap:warning] Sitemap is available in API version 2024-10 and later"),new Response("Sitemap not found.",{status:404});let l=new URL(r.url).origin,m="";return p?.sitemap?.resources?.items?.length?m=Po+p.sitemap.resources.items.map(y=>Ps({getChangeFreq:s,url:o({type:y.type??i,baseUrl:l,handle:y.handle}),type:i,getLink:o,updatedAt:y.updatedAt,handle:y.handle,metaobjectType:y.type,locales:a,baseUrl:l})).join(`
761
- `)+So:m=Po+`
762
- <url><loc>${l+c}</loc></url>
763
- `+So,new Response(m,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${60*60*24}`}})}function As(e,t,r){let n="";for(let o=1;o<=t;o++)n+=` <sitemap><loc>${r}/sitemap/${e}/${o}.xml</loc></sitemap>
764
- `;return n}function Ps({url:e,updatedAt:t,locales:r,type:n,getLink:o,baseUrl:a,handle:s,getChangeFreq:c,metaobjectType:i}){return `<url>
756
+ `,ks=`
757
+ </sitemapindex>`,Uo=`<?xml version="1.0" encoding="UTF-8"?>
758
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">`,Lo="</urlset>";async function Ns(e){let{storefront:t,request:r,types:o=["products","pages","collections","metaObjects","articles","blogs"],customChildSitemaps:n=[]}=e;if(!r||!r.url)throw new Error("A request object is required to generate a sitemap index");if(!t||!t.query)throw new Error("A storefront client is required to generate a sitemap index");let a=await t.query(js);if(!a)throw console.warn("[h2:sitemap:warning] Sitemap index is available in API version 2024-10 and later"),new Response("Sitemap index not found.",{status:404});let s=new URL(r.url).origin,c=Ls+o.map(i=>{if(!a[i])throw new Error(`[h2:sitemap:error] No data found for type ${i}. Check types passed to \`getSitemapIndex\``);return Ms(i,a[i].pagesCount.count,s)}).join(`
759
+ `)+n.map(i=>" <sitemap><loc>"+(s+(i.startsWith("/")?i:"/"+i))+"</loc></sitemap>").join(`
760
+ `)+ks;return new Response(c,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${60*60*24}`}})}async function Vs(e){let{storefront:t,request:r,params:o,getLink:n,locales:a=[],getChangeFreq:s,noItemsFallback:c="/"}=e;if(!o)throw new Error("[h2:sitemap:error] Remix params object is required to generate a sitemap");if(!r||!r.url)throw new Error("A request object is required to generate a sitemap");if(!t||!t.query)throw new Error("A storefront client is required to generate a index");if(!n)throw new Error("A `getLink` function to generate each resource is required to build a sitemap");if(!o.type||!o.page)throw new Response("No data found",{status:404});let i=o.type,u=Ks[i];if(!u)throw new Response("Not found",{status:404});let d=await t.query(u,{variables:{page:parseInt(o.page,10)}});if(!d)throw console.warn("[h2:sitemap:warning] Sitemap is available in API version 2024-10 and later"),new Response("Sitemap not found.",{status:404});let f=new URL(r.url).origin,g="";return d?.sitemap?.resources?.items?.length?g=Uo+d.sitemap.resources.items.map(y=>Hs({getChangeFreq:s,url:n({type:y.type??i,baseUrl:f,handle:y.handle}),type:i,getLink:n,updatedAt:y.updatedAt,handle:y.handle,metaobjectType:y.type,locales:a,baseUrl:f})).join(`
761
+ `)+Lo:g=Uo+`
762
+ <url><loc>${f+c}</loc></url>
763
+ `+Lo,new Response(g,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${60*60*24}`}})}function Ms(e,t,r){let o="";for(let n=1;n<=t;n++)o+=` <sitemap><loc>${r}/sitemap/${e}/${n}.xml</loc></sitemap>
764
+ `;return o}function Hs({url:e,updatedAt:t,locales:r,type:o,getLink:n,baseUrl:a,handle:s,getChangeFreq:c,metaobjectType:i}){return `<url>
765
765
  <loc>${e}</loc>
766
766
  <lastmod>${t}</lastmod>
767
- <changefreq>${c?c({type:i??n,handle:s}):"weekly"}</changefreq>
768
- ${r.map(u=>Ss(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
767
+ <changefreq>${c?c({type:i??o,handle:s}):"weekly"}</changefreq>
768
+ ${r.map(u=>Fs(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
769
769
  `)}
770
770
  </url>
771
- `.trim()}function Ss(e,t){return ` <xhtml:link rel="alternate" hreflang="${t}" href="${e}" />`}var vs=`#graphql
771
+ `.trim()}function Fs(e,t){return ` <xhtml:link rel="alternate" hreflang="${t}" href="${e}" />`}var $s=`#graphql
772
772
  query SitemapProducts($page: Int!) {
773
773
  sitemap(type: PRODUCT) {
774
774
  resources(page: $page) {
@@ -779,7 +779,7 @@ ${r.map(u=>Ss(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
779
779
  }
780
780
  }
781
781
  }
782
- `,Ts=`#graphql
782
+ `,qs=`#graphql
783
783
  query SitemapCollections($page: Int!) {
784
784
  sitemap(type: COLLECTION) {
785
785
  resources(page: $page) {
@@ -790,7 +790,7 @@ ${r.map(u=>Ss(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
790
790
  }
791
791
  }
792
792
  }
793
- `,Is=`#graphql
793
+ `,Gs=`#graphql
794
794
  query SitemapArticles($page: Int!) {
795
795
  sitemap(type: ARTICLE) {
796
796
  resources(page: $page) {
@@ -801,7 +801,7 @@ ${r.map(u=>Ss(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
801
801
  }
802
802
  }
803
803
  }
804
- `,Rs=`#graphql
804
+ `,Bs=`#graphql
805
805
  query SitemapPages($page: Int!) {
806
806
  sitemap(type: PAGE) {
807
807
  resources(page: $page) {
@@ -812,7 +812,7 @@ ${r.map(u=>Ss(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
812
812
  }
813
813
  }
814
814
  }
815
- `,Es=`#graphql
815
+ `,Qs=`#graphql
816
816
  query SitemapBlogs($page: Int!) {
817
817
  sitemap(type: BLOG) {
818
818
  resources(page: $page) {
@@ -823,7 +823,7 @@ ${r.map(u=>Ss(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
823
823
  }
824
824
  }
825
825
  }
826
- `,bs=`#graphql
826
+ `,Ws=`#graphql
827
827
  query SitemapMetaobjects($page: Int!) {
828
828
  sitemap(type: METAOBJECT) {
829
829
  resources(page: $page) {
@@ -837,7 +837,7 @@ ${r.map(u=>Ss(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
837
837
  }
838
838
  }
839
839
  }
840
- `,ws=`#graphql
840
+ `,js=`#graphql
841
841
  query SitemapIndex {
842
842
  products: sitemap(type: PRODUCT) {
843
843
  pagesCount {
@@ -870,7 +870,7 @@ query SitemapIndex {
870
870
  }
871
871
  }
872
872
  }
873
- `,Os={products:vs,articles:Is,collections:Ts,pages:Rs,blogs:Es,metaObjects:bs};//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
873
+ `,Ks={products:$s,articles:Gs,collections:qs,pages:Bs,blogs:Qs,metaObjects:Ws};//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
874
874
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartCreate
875
875
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesAdd
876
876
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate
@@ -885,5 +885,5 @@ query SitemapIndex {
885
885
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesAdd
886
886
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesRemove
887
887
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesUpdate
888
- export{sn as Analytics,V as AnalyticsEvent,lt as CacheCustom,dt as CacheLong,ut as CacheNone,se as CacheShort,j as CartForm,mt as InMemoryCache,Da as OptimisticInput,ka as Pagination,Xa as RichText,Ia as Script,ds as Seo,ys as ShopPayButton,ja as VariantSelector,_t as cartAttributesUpdateDefault,Ot as cartBuyerIdentityUpdateDefault,It as cartCreateDefault,wt as cartDiscountCodesUpdateDefault,Tt as cartGetDefault,gt as cartGetIdDefault,kt as cartGiftCardCodesUpdateDefault,Rt as cartLinesAddDefault,bt as cartLinesRemoveDefault,Et as cartLinesUpdateDefault,Lt as cartMetafieldDeleteDefault,Ut as cartMetafieldsSetDefault,Dt as cartNoteUpdateDefault,xt as cartSelectedDeliveryOptionsUpdateDefault,ht as cartSetIdDefault,Zn as changelogHandler,Nt as createCartHandler,Aa as createContentSecurityPolicy,Vt as createCustomerAccountClient,la as createHydrogenContext,Fr as createStorefrontClient,Cn as createWithCache,A as formatAPIResult,ve as generateCacheControlHeader,Ma as getPaginationVariables,Ka as getSelectedProductOptions,ns as getSeoMeta,nn as getShopAnalytics,Cs as getSitemap,hs as getSitemapIndex,Za as graphiqlLoader,ba as hydrogenRoutes,es as storefrontRedirect,G as useAnalytics,ot as useCustomerPrivacy,$t as useNonce,Jn as useOptimisticCart,Oa as useOptimisticData,qa as useOptimisticVariant};//# sourceMappingURL=index.js.map
888
+ export{Rn as Analytics,F as AnalyticsEvent,Dt as CacheCustom,xt as CacheLong,wt as CacheNone,ce as CacheShort,J as CartForm,Lt as InMemoryCache,Ya as OptimisticInput,es as Pagination,hs as RichText,Ga as Script,xs as Seo,_s as ShopPayButton,ls as VariantSelector,Wt as cartAttributesUpdateDefault,Gt as cartBuyerIdentityUpdateDefault,Mt as cartCreateDefault,qt as cartDiscountCodesUpdateDefault,Vt as cartGetDefault,kt as cartGetIdDefault,Yt as cartGiftCardCodesUpdateDefault,Ht as cartLinesAddDefault,$t as cartLinesRemoveDefault,Ft as cartLinesUpdateDefault,Kt as cartMetafieldDeleteDefault,jt as cartMetafieldsSetDefault,Bt as cartNoteUpdateDefault,Qt as cartSelectedDeliveryOptionsUpdateDefault,Nt as cartSetIdDefault,ga as changelogHandler,zt as createCartHandler,Ma as createContentSecurityPolicy,Xt as createCustomerAccountClient,Oa as createHydrogenContext,_a as createRequestHandler,Zr as createStorefrontClient,Vn as createWithCache,R as formatAPIResult,we as generateCacheControlHeader,rs as getPaginationVariables,ys as getSelectedProductOptions,Ts as getSeoMeta,Tn as getShopAnalytics,Vs as getSitemap,Ns as getSitemapIndex,Cs as graphiqlLoader,Wa as hydrogenRoutes,As as storefrontRedirect,Y as useAnalytics,Ct as useCustomerPrivacy,Zt as useNonce,fa as useOptimisticCart,Ka as useOptimisticData,ss as useOptimisticVariant};//# sourceMappingURL=index.js.map
889
889
  //# sourceMappingURL=index.js.map