@shopify/hydrogen 2026.4.5 → 2026.4.7

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,lazy,useContext,useMemo,useEffect,useRef,useState,createElement,Fragment as Fragment$1,Suspense}from'react';import {createContext as createContext$1,useRevalidator,useFetcher,useFetchers,RouterContextProvider,createRequestHandler,useNavigation,useLocation,useNavigate,Link,useMatches}from'react-router';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 {useLoadScript as useLoadScript$1}from'@shopify/hydrogen-react/load-script';import {createGraphQLClient}from'@shopify/graphql-client';import {parse,stringify}from'worktop/cookie';import is from'content-security-policy-builder';function Ce(e){let{type:t,data:r={},customData:o}=e,n=useLocation(),{publish:a,cart:s,prevCart:i,shop:c,customData:u}=ee(),d=n.pathname+n.search,y={...r,customData:{...u,...o},cart:s,prevCart:i,shop:c};return useEffect(()=>{c?.shopId&&(y={...y,url:window.location.href},a(t,y));},[a,d,c?.shopId]),null}function br(e){return jsx(Ce,{...e,type:"page_viewed"})}function wr(e){return jsx(Ce,{...e,type:"product_viewed"})}function Dr(e){return jsx(Ce,{...e,type:"collection_viewed"})}function xr(e){return jsx(Ce,{...e,type:"cart_viewed"})}function Or(e){return jsx(Ce,{...e,type:"search_viewed"})}function _r(e){return jsx(Ce,{...e})}var B={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 be="Custom-Storefront-Request-Group-ID",we="X-Shopify-Storefront-Access-Token",Tt="X-SDK-Variant",St="X-SDK-Variant-Source",Pt="X-SDK-Version",je="X-Shopify-Client-IP",he="X-Shopify-Client-IP-Sig",Ke="_sfapi_proxy",Ye="_server_tracking";function cn(e){return Object.entries(e).map(([t,r])=>r?`${t};desc=${r}`:void 0).filter(Boolean).join(", ")}function De(e,t){let r=typeof t=="string"?t:cn(t);r&&e.headers.append("Server-Timing",r);}var un=["_y","_s","_cmp"];function Ur(e){let t={};if(!e)return t;let r=new RegExp(`\\b(${un.join("|")});desc="?([^",]+)"?`,"g"),o;for(;(o=r.exec(e))!==null;)t[o[1]]=o[2];return t}function Lr(e){if(typeof window>"u")return false;try{return !!window.performance.getEntriesByType("navigation")[0]?.serverTiming?.some(r=>r.name===e)}catch{return false}}function kr(){return Lr(Ke)}function Vr(){return Lr(Ye)}var mn="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js",Cn="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function vt(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function It(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:o,checkoutDomain:n,storefrontAccessToken:a,country:s,locale:i,sameDomainForStorefrontApi:c}=e,u=useMemo(()=>c??kr(),[c]),d=useMemo(()=>u&&!Vr(),[u]),y=useShopifyCookies({fetchTrackingValues:d,storefrontAccessToken:a,ignoreDeprecatedCookies:true}),m=useMemo(getTrackingValues,[y]),{revalidate:C}=useRevalidator();useLoadScript$1(t?Cn:mn,{attributes:{id:"customer-privacy-api"}});let{observing:p,setLoaded:l,apisLoaded:S}=hn({withPrivacyBanner:t}),f=useMemo(()=>{n||vt("checkoutDomain"),a||vt("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 h=An(n);return {checkoutRootDomain:u&&typeof window<"u"?window.location.host:n,storefrontRootDomain:h?"."+h:void 0,storefrontAccessToken:a,country:s,locale:i}},[vt,n,a,s,i]);useEffect(()=>{let h=T=>{let g=getTrackingValues();if((m.visitToken!==g.visitToken||m.uniqueToken!==g.uniqueToken)&&C().catch(()=>{console.warn("[h2:warn:useCustomerPrivacy] Revalidation failed after consent change.");}),r){let v=se();if(v?.shouldShowBanner()){let P=v.currentVisitorConsent();if(P&&P.marketing===""&&P.analytics===""&&P.preferences==="")return}r(T.detail);}};return document.addEventListener("visitorConsentCollected",h),()=>{document.removeEventListener("visitorConsentCollected",h);}},[r]),useEffect(()=>{if(!t||p.current.privacyBanner)return;p.current.privacyBanner=true;let h=window.privacyBanner||void 0;Object.defineProperty(window,"privacyBanner",{configurable:true,get(){return h},set(g){typeof g=="object"&&g!==null&&"showPreferences"in g&&"loadBanner"in g&&(h=Fr({privacyBanner:g,config:f}),l.privacyBanner());}});},[t,f,Fr,l.privacyBanner]),useEffect(()=>{if(p.current.customerPrivacy)return;p.current.customerPrivacy=true;let h=null,T=null,g=window.Shopify||void 0;Object.defineProperty(window,"Shopify",{configurable:true,get(){return g},set(v){typeof v=="object"&&v!==null&&Object.keys(v).length===0&&(g=v,h={backendConsentEnabled:true},Object.defineProperty(window.Shopify,"customerPrivacy",{configurable:true,get(){return T??h},set(P){if(typeof P=="object"&&P!==null&&"setTrackingConsent"in P){let U=P;T={...U,setTrackingConsent:Mr({customerPrivacy:U,config:f})},g={...g,customerPrivacy:T},l.customerPrivacy();}}}));}});},[f,Mr,l.customerPrivacy]),useEffect(()=>{if(!S||!y)return;let h=se();if(h&&!h.cachedConsent){let T=getTrackingValues();T.consent&&(h.cachedConsent=T.consent);}if(t){let T=xe();T&&T.loadBanner(f);}gn(),o?.();},[S,y]);let R={customerPrivacy:se()};return t&&(R.privacyBanner=xe()),R}var Nr=false;function gn(){if(Nr)return;Nr=true;let e=new CustomEvent("shopifyCustomerPrivacyApiLoaded");document.dispatchEvent(e);}function hn({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 An(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 Mr({customerPrivacy:e,config:t}){let r=e.setTrackingConsent,{locale:o,country:n,...a}=t;function s(i,c){r({...a,headlessStorefront:true,...i},c);}return s}function Fr({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 se(){try{let e=window.Shopify?.customerPrivacy;return e&&"setTrackingConsent"in e?e:null}catch{return null}}function xe(){try{return window&&window?.privacyBanner?window.privacyBanner:null}catch{return null}}var Hr="2026.4.5";function In(){let e=se();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 $r({consent:e,onReady:t,domain:r}){let{subscribe:o,register:n,canTrack:a}=ee(),[s,i]=useState(false),[c,u]=useState(false),[d,y]=useState(""),m=useRef(false),{checkoutDomain:C,storefrontAccessToken:p,language:l}=e,{ready:S}=n("Internal_Shopify_Analytics");It({...e,locale:l,checkoutDomain:C||"mock.shop",storefrontAccessToken:p||"abcdefghijklmnopqrstuvwxyz123456",onReady:()=>!e.withPrivacyBanner&&u(true),onVisitorConsentCollected:R=>{try{y(JSON.stringify(R));}catch{}u(true);}});let f=useMemo(()=>c?a():true,[c,a,d]);return useShopifyCookies({hasUserConsent:f,domain:r,checkoutDomain:C,fetchTrackingValues:false,ignoreDeprecatedCookies:!c}),useEffect(()=>{m.current||(m.current=true,o(B.PAGE_VIEWED,bn),o(B.PRODUCT_VIEWED,wn),o(B.COLLECTION_VIEWED,Dn),o(B.SEARCH_VIEWED,xn),o(B.PRODUCT_ADD_TO_CART,On),i(true));},[o]),useEffect(()=>{s&&c&&(S(),t());},[s,c,t]),null}function Xe(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Ue(e){let t=In(),r=t.analyticsProcessingAllowed();if(!e?.shop?.shopId){Xe("shopId");return}if(!e?.shop?.acceptedLanguage){Xe("acceptedLanguage");return}if(!e?.shop?.currency){Xe("currency");return}if(!e?.shop?.hydrogenSubchannelId){Xe("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:Hr,...e.shop,hasUserConsent:r,...getClientBrowserParameters(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function En(e,t){if(t===null)return;let r=Ue(e);return r?{...r,cartId:t.id}:void 0}var ie={};function bn(e){let t=Ue(e);t&&(sendShopifyAnalytics({eventName:AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...ie}}),ie={});}function wn(e){let t=Ue(e);if(t&&Gr({type:"product",products:e.products})){let r=bt(e.products);ie={pageType:AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...ie,products:bt(e.products)},sendShopifyAnalytics({eventName:AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function Dn(e){let t=Ue(e);t&&(ie={pageType:AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...ie,collectionHandle:e.collection.handle,collectionId:e.collection.id},sendShopifyAnalytics({eventName:AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function xn(e){let t=Ue(e);t&&(ie={pageType:AnalyticsPageType.search},t={...t,...ie,searchString:e.searchTerm},sendShopifyAnalytics({eventName:AnalyticsEventName.SEARCH_VIEW,payload:t}));}function On(e){let{cart:t,currentLine:r}=e,o=En(e,t);!o||!r?.id||_n({matchedLine:r,eventPayload:o});}function _n({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};Gr({type:"cart",products:[r]})&&sendShopifyAnalytics({eventName:AnalyticsEventName.ADD_TO_CART,payload:{...t,products:bt([r])}});}function pe(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 Gr({type:e,products:t}){return !t||t.length===0?(pe(e,"",false,"data.products"),false):(t.forEach(r=>{if(!r.id)return pe(e,"id",false),false;if(!r.title)return pe(e,"title",false),false;if(!r.price)return pe(e,"price.amount",true,"price"),false;if(!r.vendor)return pe(e,"vendor",false),false;if(!r.variantId)return pe(e,"id",true,"variantId"),false;if(!r.variantTitle)return pe(e,"title",true,"variantTitle"),false}),true)}function bt(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 Wr(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 jr({cart:e,setCarts:t}){let{publish:r,shop:o,customData:n,canTrack:a,cart:s,prevCart:i}=ee(),c=useRef(null);return useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){Wr("id");return}if(!u.updatedAt){Wr("updatedAt");return}}t(({cart:d,prevCart:y})=>u?.updatedAt!==d?.updatedAt?{cart:u,prevCart:d}:{cart:d,prevCart:y});}),()=>{}},[t,e]),useEffect(()=>{if(!s||!s?.updatedAt||s?.updatedAt===i?.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:i,shop:o,customData:n};if(s.updatedAt===c.current)return;c.current=s.updatedAt,r("cart_updated",d),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:s.id,updatedAt:s.updatedAt}));let y=i?.lines?flattenConnection(i?.lines):[],m=s.lines?flattenConnection(s.lines):[];y?.forEach(C=>{let p=m.filter(l=>C.id===l.id);if(p?.length===1){let l=p[0];C.quantity<l.quantity?r("product_added_to_cart",{...d,prevLine:C,currentLine:l}):C.quantity>l.quantity&&r("product_removed_from_cart",{...d,prevLine:C,currentLine:l});}else r("product_removed_from_cart",{...d,prevLine:C});}),m?.forEach(C=>{let p=y.filter(l=>C.id===l.id);(!p||p.length===0)&&r("product_added_to_cart",{...d,currentLine:C});});},[s,i,r,o,n,a]),null}var Mn="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function Kr({shop:e}){let t=useRef(false),{subscribe:r,register:o}=ee(),{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":"10"}});return useEffect(()=>{a!=="done"||t.current||(t.current=true,r(B.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(B.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(B.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(B.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(B.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),n());},[r,n,a]),null}var Yr=new Set,J=e=>{Yr.has(e)||(console.warn(e),Yr.add(e));},Jr=new Set,Dt=e=>{Jr.has(e)||(console.error(new Error(e)),Jr.add(e));};var Gn={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},ro=createContext(Gn),et=new Map,ke={};function oo(){return Object.values(ke).every(Boolean)}function zr(e,t){et.has(e)||et.set(e,new Map),et.get(e)?.set(t.toString(),t);}var tt=new Map;function Xr(e,t){if(!oo()){tt.set(e,t);return}no(e,t);}function no(e,t){(et.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 Zr(e){return ke.hasOwnProperty(e)||(ke[e]=false),{ready:()=>{ke[e]=true,oo()&&tt.size>0&&(tt.forEach((t,r)=>{no(r,t);}),tt.clear());}}}function eo(){try{return window.Shopify.customerPrivacy?.analyticsProcessingAllowed?.()??!1}catch{}return false}function to(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 Bn({canTrack:e,cart:t,children:r,consent:o,customData:n={},shop:a=null,cookieDomain:s}){let{shop:i}=Qn(a),[c,u]=useState(!!e),[d,y]=useState(false),[m,C]=useState({cart:null,prevCart:null}),[p,l]=useState(e?()=>e:()=>eo);if(i)if(/\/68817551382$/.test(i.shopId))J("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!o.checkoutDomain){let f=to("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");Dt(f);}if(!o.storefrontAccessToken){let f=to("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");Dt(f);}o?.country||(o.country="US"),o?.language||(o.language="EN"),o.withPrivacyBanner===void 0&&(o.withPrivacyBanner=false);}let S=useMemo(()=>({canTrack:p,...m,customData:n,publish:p()?Xr:()=>{},shop:i,subscribe:zr,register:Zr,customerPrivacy:se(),privacyBanner:xe()}),[c,p,m,m.cart?.updatedAt,m.prevCart,Xr,zr,n,i,Zr,JSON.stringify(ke),se,xe]);return jsxs(ro.Provider,{value:S,children:[r,!!i&&jsx(br,{}),!!i&&!!t&&jsx(jr,{cart:t,setCarts:C}),!!i&&jsx($r,{consent:o,onReady:()=>{u(true),l(e?()=>e:()=>eo),y(true);},domain:s}),!!i&&d&&jsx(Kr,{shop:i})]})}function ee(){let e=useContext(ro);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function Qn(e){let[t,r]=useState(null);return useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function Wn({storefront:e,publicStorefrontId:t="0"}){return e.query(jn,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var jn=`#graphql
1
+ import {createContext,forwardRef,lazy,useContext,useRef,useState,useMemo,useEffect,useCallback,startTransition,createElement,Fragment as Fragment$1,Suspense}from'react';import {createContext as createContext$1,useRevalidator,useFetcher,useFetchers,RouterContextProvider,createRequestHandler,useNavigation,useLocation,useNavigate,Link,useMatches}from'react-router';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useLoadScript,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,getTrackingValues,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 {loadScript}from'@shopify/hydrogen-react/load-script';import {createGraphQLClient}from'@shopify/graphql-client';import {parse,stringify}from'worktop/cookie';import is from'content-security-policy-builder';function ge(e){let{type:t,data:r={},customData:n}=e,o=useLocation(),{publish:a,cart:s,prevCart:c,shop:i,customData:u}=ee(),d=o.pathname+o.search,y={...r,customData:{...u,...n},cart:s,prevCart:c,shop:i};return useEffect(()=>{i?.shopId&&(y={...y,url:window.location.href},a(t,y));},[a,d,i?.shopId]),null}function Rr(e){return jsx(ge,{...e,type:"page_viewed"})}function Ir(e){return jsx(ge,{...e,type:"product_viewed"})}function vr(e){return jsx(ge,{...e,type:"collection_viewed"})}function Er(e){return jsx(ge,{...e,type:"cart_viewed"})}function br(e){return jsx(ge,{...e,type:"search_viewed"})}function wr(e){return jsx(ge,{...e})}function We(){try{let e=window.Shopify?.customerPrivacy;return e?.consentStatus!=="loaded"||e.currentVisitorConsent?.().analytics==="no"?!1:e.analyticsProcessingAllowed?.()??!1}catch{return false}}function Dr(e){if(!e.shouldShowBanner())return false;let t=e.currentVisitorConsent();return ![t.marketing,t.analytics,t.preferences].some(r=>r==="yes"||r==="no")}var B={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 dn="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js",pn="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function xr(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function ln(){console.warn("[h2:warn:useCustomerPrivacy] `sameDomainForStorefrontApi: false` is ignored. Consent and analytics require the same-origin Storefront API proxy included in Hydrogen's `createRequestHandler`, so consent requests always use it. Remove this option. See https://shopify.dev/changelog/posts/tracking-cookie-deprecation-hydrogen");}function gt(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:n,checkoutDomain:o,storefrontAccessToken:a,country:s,locale:c,sameDomainForStorefrontApi:i}=e,{revalidate:u}=useRevalidator(),d=useRef({onReady:n,onVisitorConsentCollected:r,revalidate:u});d.current={onReady:n,onVisitorConsentCollected:r,revalidate:u};let y=useRef(false),C=useRef(),[m,p]=useState(()=>({customerPrivacy:pe(),privacyBanner:we()})),l=useMemo(()=>{o||xr("checkoutDomain"),a||xr("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"),i===false&&ln();let T=gn(o);return {checkoutRootDomain:typeof window<"u"?window.location.host:o,storefrontRootDomain:T?"."+T:void 0,storefrontAccessToken:a,country:s,locale:c}},[i,o,a,s,c]);return useEffect(()=>{let T=true,f=window.Shopify??={},I=f.customerPrivacy??={};I.config={...I.config,isHeadless:true,asyncConsent:true,asyncVisitorState:true,consentDomain:l.checkoutRootDomain,storefrontAccessToken:l.storefrontAccessToken,debug:{...I.config?.debug,hydrogen:fn}},l.country&&(f.country=l.country),l.locale&&(f.locale=l.locale.toLowerCase());let h=()=>{let P=getTrackingValues(),R=C.current;C.current=P,R&&(R.visitToken!==P.visitToken||R.uniqueToken!==P.uniqueToken)&&d.current.revalidate().catch(()=>{console.warn("[h2:warn:useCustomerPrivacy] Revalidation failed after consent change.");});},S=()=>{if(!T)return false;let P=pe(),R=we();return P&&mn(P,l),t&&R&&Cn(R,l),p(U=>U.customerPrivacy===P&&U.privacyBanner===R?U:{customerPrivacy:P,privacyBanner:R}),P?.consentStatus!=="loaded"||t&&!R?false:(y.current||(y.current=true,h(),yn(P),d.current.onReady?.()),true)},A=P=>{S()&&(h(),d.current.onVisitorConsentCollected?.(P.detail));};return document.addEventListener("consentTrackingApiLoaded",S),document.addEventListener("visitorConsentCollected",A),S()||loadScript(t?pn:dn,{attributes:{id:"customer-privacy-api"}}).then(S,()=>{T&&console.error("[h2:error:useCustomerPrivacy] Unable to load the Customer Privacy API.");}),()=>{T=false,document.removeEventListener("consentTrackingApiLoaded",S),document.removeEventListener("visitorConsentCollected",A);}},[l,t]),{customerPrivacy:m.customerPrivacy,...t?{privacyBanner:m.privacyBanner}:{}}}var Or=new WeakSet;function yn(e){Or.has(e)||(Or.add(e),document.dispatchEvent(new CustomEvent("shopifyCustomerPrivacyApiLoaded")));}var fn={generation:2,serverTiming:false},_r=new WeakMap;function mn(e,t){let r=_r.get(e);if(r){r.config=t;return}let n={config:t};_r.set(e,n);let o=e.setTrackingConsent;e.setTrackingConsent=(a,s)=>{let{locale:c,country:i,...u}=n.config,d={...u,headlessStorefront:true,...a};o.call(e,d,s);};}var Ur=new WeakMap;function Cn(e,t){let r=Ur.get(e);if(r){r.config=t;return}let n={config:t};Ur.set(e,n);let{loadBanner:o,showPreferences:a}=e;e.loadBanner=s=>o.call(e,{...n.config,...s}),e.showPreferences=s=>a.call(e,{...n.config,...s});}function gn(e){if(typeof window>"u")return;let t=window.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(".")||void 0}function pe(){try{let e=window.Shopify?.customerPrivacy;return typeof e?.setTrackingConsent=="function"?e:null}catch{return null}}function we(){try{let e=window.privacyBanner;return typeof e?.loadBanner=="function"&&typeof e.showPreferences=="function"?e:null}catch{return null}}var Lr="2026.4.7";function Vr(){let e=pe();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 Nr({consent:e,onConsentChange:t}){let{subscribe:r,register:n}=ee(),[o,a]=useState(false),s=useRef(false),{checkoutDomain:c,storefrontAccessToken:i,language:u}=e,{ready:d}=n("Internal_Shopify_Analytics");useEffect(()=>{s.current||(s.current=true,r(B.PAGE_VIEWED,Rn),r(B.PRODUCT_VIEWED,In),r(B.COLLECTION_VIEWED,vn),r(B.SEARCH_VIEWED,En),r(B.PRODUCT_ADD_TO_CART,bn));},[r]);let y=()=>{o?t():(!e.withPrivacyBanner||!Dr(Vr()))&&a(true);};return gt({...e,locale:u,checkoutDomain:c||"mock.shop",storefrontAccessToken:i||"abcdefghijklmnopqrstuvwxyz123456",onReady:y,onVisitorConsentCollected:y}),useEffect(()=>{o&&(d(),t());},[o,t]),null}function je(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Oe(e){let t=Vr(),r=We();if(!r)return;if(!e?.shop?.shopId){je("shopId");return}if(!e?.shop?.acceptedLanguage){je("acceptedLanguage");return}if(!e?.shop?.currency){je("currency");return}if(!e?.shop?.hydrogenSubchannelId){je("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:Lr,...e.shop,hasUserConsent:r,...getClientBrowserParameters(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function Pn(e,t){if(t===null)return;let r=Oe(e);return r?{...r,cartId:t.id}:void 0}var se={};function Rn(e){let t=Oe(e);t&&(sendShopifyAnalytics({eventName:AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...se}}),se={});}function In(e){let t=Oe(e);if(t&&Mr({type:"product",products:e.products})){let r=ht(e.products);se={pageType:AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...se,products:ht(e.products)},sendShopifyAnalytics({eventName:AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function vn(e){let t=Oe(e);t&&(se={pageType:AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...se,collectionHandle:e.collection.handle,collectionId:e.collection.id},sendShopifyAnalytics({eventName:AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function En(e){let t=Oe(e);t&&(se={pageType:AnalyticsPageType.search},t={...t,...se,searchString:e.searchTerm},sendShopifyAnalytics({eventName:AnalyticsEventName.SEARCH_VIEW,payload:t}));}function bn(e){let{cart:t,currentLine:r}=e,n=Pn(e,t);!n||!r?.id||wn({matchedLine:r,eventPayload:n});}function wn({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};Mr({type:"cart",products:[r]})&&sendShopifyAnalytics({eventName:AnalyticsEventName.ADD_TO_CART,payload:{...t,products:ht([r])}});}function le(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 Mr({type:e,products:t}){return !t||t.length===0?(le(e,"",false,"data.products"),false):(t.forEach(r=>{if(!r.id)return le(e,"id",false),false;if(!r.title)return le(e,"title",false),false;if(!r.price)return le(e,"price.amount",true,"price"),false;if(!r.vendor)return le(e,"vendor",false),false;if(!r.variantId)return le(e,"id",true,"variantId"),false;if(!r.variantTitle)return le(e,"title",true,"variantTitle"),false}),true)}function ht(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 qr(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 $r({cart:e,setCarts:t}){let{publish:r,shop:n,customData:o,canTrack:a,cart:s,prevCart:c}=ee(),i=useRef(null);return useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){qr("id");return}if(!u.updatedAt){qr("updatedAt");return}}t(({cart:d,prevCart:y})=>u?.updatedAt!==d?.updatedAt?{cart:u,prevCart:d}:{cart:d,prevCart:y});}),()=>{}},[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:n,customData:o};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 y=c?.lines?flattenConnection(c?.lines):[],C=s.lines?flattenConnection(s.lines):[];y?.forEach(m=>{let p=C.filter(l=>m.id===l.id);if(p?.length===1){let l=p[0];m.quantity<l.quantity?r("product_added_to_cart",{...d,prevLine:m,currentLine:l}):m.quantity>l.quantity&&r("product_removed_from_cart",{...d,prevLine:m,currentLine:l});}else r("product_removed_from_cart",{...d,prevLine:m});}),C?.forEach(m=>{let p=y.filter(l=>m.id===l.id);(!p||p.length===0)&&r("product_added_to_cart",{...d,currentLine:m});});},[s,c,r,n,o,a]),null}var Ln="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function Gr({shop:e}){let t=useRef(false),{subscribe:r,register:n}=ee(),{ready:o}=n("Internal_Shopify_Perf_Kit"),a=useLoadScript(Ln,{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":"10"}});return useEffect(()=>{a!=="done"||t.current||(t.current=true,r(B.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(B.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(B.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(B.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(B.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),o());},[r,o,a]),null}var Br=new Set,J=e=>{Br.has(e)||(console.warn(e),Br.add(e));},Qr=new Set,Tt=e=>{Qr.has(e)||(console.error(new Error(e)),Qr.add(e));};var Hn={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},Yr=createContext(Hn),Je=new Map,_e={};function Jr(){return Object.values(_e).every(Boolean)}function Wr(e,t){Je.has(e)||Je.set(e,new Map),Je.get(e)?.set(t.toString(),t);}var ze=new Map;function qn(e,t){if(!Jr()){ze.set(e,t);return}zr(e,t);}function zr(e,t){(Je.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 jr(e){return _e.hasOwnProperty(e)||(_e[e]=false),{ready:()=>{_e[e]=true,Jr()&&ze.size>0&&(ze.forEach((t,r)=>{zr(r,t);}),ze.clear());}}}var $n=()=>{};function Kr(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 Gn({canTrack:e,cart:t,children:r,consent:n,customData:o={},shop:a=null}){let{shop:s}=Bn(a),[c,i]=useState(0),[u,d]=useState(false),[y,C]=useState({cart:null,prevCart:null}),m=useCallback(h=>startTransition(()=>C(h)),[]),p=e??We,l=useRef(p);l.current=p;let T=useCallback((h,S)=>{l.current()&&qn(h,S);},[]),f=useCallback(()=>{startTransition(()=>{d(true),i(h=>h+1);});},[]);if(s)if(/\/68817551382$/.test(s.shopId))J("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!n.checkoutDomain){let h=Kr("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");Tt(h);}if(!n.storefrontAccessToken){let h=Kr("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");Tt(h);}n?.country||(n.country="US"),n?.language||(n.language="EN"),n.withPrivacyBanner===void 0&&(n.withPrivacyBanner=false);}let I=useMemo(()=>({canTrack:p,...y,customData:o,publish:p()?T:$n,shop:s,subscribe:Wr,register:jr,customerPrivacy:pe(),privacyBanner:we()}),[c,p,y,y.cart?.updatedAt,y.prevCart,T,Wr,o,s,jr,JSON.stringify(_e),pe,we]);return jsxs(Yr.Provider,{value:I,children:[r,!!s&&jsx(Rr,{}),!!s&&!!t&&jsx($r,{cart:t,setCarts:m}),!!s&&jsx(Nr,{consent:n,onConsentChange:f}),!!s&&u&&jsx(Gr,{shop:s})]})}function ee(){let e=useContext(Yr);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function Bn(e){let[t,r]=useState(null);return useEffect(()=>(Promise.resolve(e).then(n=>{startTransition(()=>r(n));}),()=>{}),[r,e]),{shop:t}}async function Qn({storefront:e,publicStorefrontId:t="0"}){return e.query(Wn,{cache:e.CacheLong()}).then(({shop:r,localization:n})=>({shopId:r.id,acceptedLanguage:n.language.isoCode,currency:n.country.currency.isoCode,hydrogenSubchannelId:t}))}var Wn=`#graphql
2
2
  query ShopData(
3
3
  $country: CountryCode
4
4
  $language: LanguageCode
@@ -17,17 +17,17 @@ import {createContext,forwardRef,lazy,useContext,useMemo,useEffect,useRef,useSta
17
17
  }
18
18
  }
19
19
  }
20
- `,Kn={CartView:xr,CollectionView:Dr,CustomView:_r,ProductView:wr,Provider:Bn,SearchView:Or};function z(e,t){return xt(e.headers,t)}function xt(e,t){let r=e?.get?.(t)??e?.[t];return typeof r=="string"?r:null}function ce(e){return {requestId:e?z(e,"request-id"):void 0,purpose:e?z(e,"purpose"):void 0}}function ao(e){return {requestGroupId:z(e,"request-id"),buyerIp:z(e,"oxygen-buyer-ip"),buyerIpSig:z(e,he),cookie:z(e,"cookie"),purpose:z(e,"sec-purpose")||z(e,"purpose")}}var Ot=/^\/api\/(unstable|2\d{3}-\d{2})\/graphql\.json$/,so=/^\/api\/mcp$/,rt=e=>{try{return new URL(e,"http://e.c").pathname}catch{return "/"}};function Ve(e,t){return t.reduce((r,o)=>{let n=e(o);return n&&r.push([o,n]),r},[])}function Ae(e,t={}){let r=new Error,o=(n,a="Error")=>{let s=(r.stack??"").split(`
20
+ `,jn={CartView:Er,CollectionView:vr,CustomView:wr,ProductView:Ir,Provider:Gn,SearchView:br};var Ue="Custom-Storefront-Request-Group-ID",Le="X-Shopify-Storefront-Access-Token",Rt="X-SDK-Variant",It="X-SDK-Variant-Source",vt="X-SDK-Version",Xe="X-Shopify-Client-IP",Ae="X-Shopify-Client-IP-Sig",Xr="_sfapi_proxy",Zr="Shopify-Storefront-Consent-Management";function z(e,t){return Et(e.headers,t)}function Et(e,t){let r=e?.get?.(t)??e?.[t];return typeof r=="string"?r:null}function ie(e){return {requestId:e?z(e,"request-id"):void 0,purpose:e?z(e,"purpose"):void 0}}function eo(e){return {requestGroupId:z(e,"request-id"),buyerIp:z(e,"oxygen-buyer-ip"),buyerIpSig:z(e,Ae),cookie:z(e,"cookie"),purpose:z(e,"sec-purpose")||z(e,"purpose")}}var bt=/^\/api\/(unstable|2\d{3}-\d{2})\/graphql\.json$/,to=/^\/api\/mcp$/,Ze=e=>{try{return new URL(e,"http://e.c").pathname}catch{return "/"}};function ke(e,t){return t.reduce((r,n)=>{let o=e(n);return o&&r.push([n,o]),r},[])}function Te(e,t={}){let r=new Error,n=(o,a="Error")=>{let s=(r.stack??"").split(`
21
21
  `).slice(3+(t.stackOffset??0)).join(`
22
- `).replace(/ at loader(\d+) \(/,(i,c)=>i.replace(c,""));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 X=void 0;var ot="public",Jn="private",_t="no-store",io={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function Ne(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):io[r]&&t.push(`${io[r]}=${e[r]}`);}),t.join(", ")}function Ut(){return {mode:_t}}function Lt(e){if(e?.mode&&e?.mode!==ot&&e?.mode!==Jn)throw Error("'mode' must be either 'public' or 'private'")}function le(e){return Lt(e),{mode:ot,maxAge:1,staleWhileRevalidate:9,...e}}function kt(e){return Lt(e),{mode:ot,maxAge:3600,staleWhileRevalidate:82800,...e}}function Te(e){return Lt(e),{mode:ot,maxAge:1,staleWhileRevalidate:86399,...e}}function Vt(e){return e}function te(e){return String(e).includes("__proto__")?JSON.parse(e,zn):JSON.parse(e)}function zn(e,t){if(e!=="__proto__")return t}function nt(e,t){return e&&t?{...e,...t}:e||Te()}function Nt(e){return Ne(nt(e))}async function Xn(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function Zn(e,t,r,o){if(!e)return;let n=nt(o),a=Nt(nt(n,{maxAge:(n.maxAge||0)+(n.staleWhileRevalidate||0)})),s=Nt(nt(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 ea(e,t){e&&await e.delete(t);}function ta(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 ra(e,t){let r=t.headers.get("cache-put-date");if(!r)return false;let[o,n]=ta(t,r),a=o>n;return a}var at={get:Xn,set:Zn,delete:ea,generateDefaultCacheControlHeader:Nt,isStale:ra};function Me(e){return `https://shopify.dev/?${e}`}function oa(e){return e||Te()}async function co(e,t){if(!e)return;let r=Me(t),o=new Request(r),n=await at.get(e,o);if(!n)return;let a=await n.text();try{return [te(a),n]}catch{return [a,n]}}async function uo(e,t,r,o){if(!e)return;let n=Me(t),a=new Request(n),s=new Response(JSON.stringify(r));await at.set(e,a,s,oa(o));}function po(e,t){return at.isStale(new Request(Me(e)),t)}function lo(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 Mt=new Set;async function st(e,t,{strategy:r=le(),cacheInstance:o,shouldCacheResult:n=()=>true,waitUntil:a,debugInfo:s}){let c=lo([...typeof e=="string"?[e]:e]),y=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()||[])}});},C=void 0;if(!o||!r||r.mode===_t){let f=await t({addDebugData:y});return f}let p=f=>uo(o,c,{value:f,debugInfo:void 0},r),l=await co(o,c);if(l&&typeof l[0]!="string"){let[{value:f,debugInfo:R},h]=l;let T=po(c,h)?"STALE":"HIT";if(!Mt.has(c)&&T==="STALE"){Mt.add(c);let g=Promise.resolve().then(async()=>{let v=Date.now();try{let P=await t({addDebugData:y});n(P)&&(await p(P),C?.({result:P,cacheStatus:"PUT",overrideStartTime:v}));}catch(P){P.message&&(P.message="SWR in sub-request failed: "+P.message),console.error(P);}finally{Mt.delete(c);}});a?.(g);}return f}let S=await t({addDebugData:y});if(n(S)){let f=Promise.resolve().then(async()=>{await p(S);});a?.(f);}return S}var aa=["set-cookie","server-timing"];function yo(e,t){return [e,{status:t.status,statusText:t.statusText,headers:[...t.headers].filter(([r])=>!aa.includes(r.toLowerCase()))}]}function fo([e,t]){return [e,new Response(e,t)]}async function it(e,t,{cacheInstance:r,cache:o,cacheKey:n=[e,t],shouldCacheResponse:a,waitUntil:s,debugInfo:i,streamConfig:c,onRawHeaders:u}){return !o&&(!t.method||t.method==="GET")&&(o=le()),st(n,async()=>{if(c){let m=null,p=await createGraphQLClient({url:e,customFetchApi:async(f,R)=>(m=await fetch(f,R),u?.(m.headers),m),headers:t.headers}).requestStream(c.query,{variables:c.variables}),l,S;for await(let f of p){let{data:R,errors:h}=f;l=R,S=h?.graphQLErrors??h;}return m?.ok?yo({data:l,errors:S},m):m}let d=await fetch(e,t);if(u?.(d.headers),!d.ok)return d;let y=await d.text().catch(()=>"");try{y&&(y=te(y));}catch{}return yo(y,d)},{cacheInstance:r,waitUntil:s,strategy:o??null,debugInfo:i,shouldCacheResult:d=>"ok"in d?!1:a(...fo(d))}).then(d=>"ok"in d?[null,d]:fo(d))}function sa(e){let{cache:t,waitUntil:r,request:o}=e;return {run:({cacheKey:n,cacheStrategy:a,shouldCacheResult:s},i)=>st(n,i,{shouldCacheResult:s,strategy:a,cacheInstance:t,waitUntil:r,debugInfo:{...ce(o),stackInfo:X?.()}}),fetch:(n,a,s)=>it(n,a??{},{waitUntil:r,cacheKey:[n,a],cacheInstance:t,debugInfo:{url:n,...ce(o),stackInfo:X?.(),displayName:s?.displayName},cache:s.cacheStrategy,...s}).then(([i,c])=>({data:i,response:c}))}}var Ft=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),i=s.get("cache-control")||s.get("real-cache-control")||"",c=parseInt(i.match(/max-age=(\d+)/)?.[1]||"0",10),u=parseInt(i.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),d=(Date.now()-n)/1e3;if(d>c+u){this.#e.delete(t.url);return}let m=d>c;return s.set("cache",m?"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 mo="cartFormInput";function re({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:mo,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}re.INPUT_NAME=mo;re.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",GiftCardCodesUpdate:"GiftCardCodesUpdate",GiftCardCodesAdd:"GiftCardCodesAdd",GiftCardCodesRemove:"GiftCardCodesRemove",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete",DeliveryAddressesAdd:"DeliveryAddressesAdd",DeliveryAddressesUpdate:"DeliveryAddressesUpdate",DeliveryAddressesRemove:"DeliveryAddressesRemove",DeliveryAddressesReplace:"DeliveryAddressesReplace"};function ca(e){let t={};for(let s of e.entries()){let i=s[0],c=e.getAll(i);t[i]=c.length>1?c:s[1],t[i]==="on"?t[i]=true:t[i]==="off"&&(t[i]=false);}let{cartFormInput:r,...o}=t,{action:n,inputs:a}=r?JSON.parse(String(r)):{};return {action:n,inputs:{...a,...o}}}re.getFormInput=ca;var Ht=e=>{let t=parse(xt(e,"Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var qt=e=>t=>{let r=new Headers;return r.append("Set-Cookie",stringify("cart",t.split("/").pop()||"",{path:"/",...e})),r};function ct(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var Fe="2026.4.5";function Se(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var ya=/(^|}\s)query[\s({]/im,fa=/(^|}\s)mutation[\s({]/im;function ut(e,t){if(!ya.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function dt(e,t){if(!fa.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}var ye=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+=`
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 X=void 0;var et="public",Yn="private",wt="no-store",ro={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]):ro[r]&&t.push(`${ro[r]}=${e[r]}`);}),t.join(", ")}function Dt(){return {mode:wt}}function xt(e){if(e?.mode&&e?.mode!==et&&e?.mode!==Yn)throw Error("'mode' must be either 'public' or 'private'")}function ye(e){return xt(e),{mode:et,maxAge:1,staleWhileRevalidate:9,...e}}function Ot(e){return xt(e),{mode:et,maxAge:3600,staleWhileRevalidate:82800,...e}}function Se(e){return xt(e),{mode:et,maxAge:1,staleWhileRevalidate:86399,...e}}function _t(e){return e}function te(e){return String(e).includes("__proto__")?JSON.parse(e,Jn):JSON.parse(e)}function Jn(e,t){if(e!=="__proto__")return t}function tt(e,t){return e&&t?{...e,...t}:e||Se()}function Ut(e){return Ve(tt(e))}async function zn(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function Xn(e,t,r,n){if(!e)return;let o=tt(n),a=Ut(tt(o,{maxAge:(o.maxAge||0)+(o.staleWhileRevalidate||0)})),s=Ut(tt(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 Zn(e,t){e&&await e.delete(t);}function ea(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 ta(e,t){let r=t.headers.get("cache-put-date");if(!r)return false;let[n,o]=ea(t,r),a=n>o;return a}var rt={get:zn,set:Xn,delete:Zn,generateDefaultCacheControlHeader:Ut,isStale:ta};function Ne(e){return `https://shopify.dev/?${e}`}function ra(e){return e||Se()}async function oo(e,t){if(!e)return;let r=Ne(t),n=new Request(r),o=await rt.get(e,n);if(!o)return;let a=await o.text();try{return [te(a),o]}catch{return [a,o]}}async function no(e,t,r,n){if(!e)return;let o=Ne(t),a=new Request(o),s=new Response(JSON.stringify(r));await rt.set(e,a,s,ra(n));}function ao(e,t){return rt.isStale(new Request(Ne(e)),t)}function so(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 Lt=new Set;async function ot(e,t,{strategy:r=ye(),cacheInstance:n,shouldCacheResult:o=()=>true,waitUntil:a,debugInfo:s}){let i=so([...typeof e=="string"?[e]:e]),y=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()||[])}});},m=void 0;if(!n||!r||r.mode===wt){let f=await t({addDebugData:y});return f}let p=f=>no(n,i,{value:f,debugInfo:void 0},r),l=await oo(n,i);if(l&&typeof l[0]!="string"){let[{value:f,debugInfo:I},h]=l;let S=ao(i,h)?"STALE":"HIT";if(!Lt.has(i)&&S==="STALE"){Lt.add(i);let A=Promise.resolve().then(async()=>{let P=Date.now();try{let R=await t({addDebugData:y});o(R)&&(await p(R),m?.({result:R,cacheStatus:"PUT",overrideStartTime:P}));}catch(R){R.message&&(R.message="SWR in sub-request failed: "+R.message),console.error(R);}finally{Lt.delete(i);}});a?.(A);}return f}let T=await t({addDebugData:y});if(o(T)){let f=Promise.resolve().then(async()=>{await p(T);});a?.(f);}return T}var na=["set-cookie","server-timing"];function io(e,t){return [e,{status:t.status,statusText:t.statusText,headers:[...t.headers].filter(([r])=>!na.includes(r.toLowerCase()))}]}function co([e,t]){return [e,new Response(e,t)]}async function nt(e,t,{cacheInstance:r,cache:n,cacheKey:o=[e,t],shouldCacheResponse:a,waitUntil:s,debugInfo:c,streamConfig:i,onRawHeaders:u}){return !n&&(!t.method||t.method==="GET")&&(n=ye()),ot(o,async()=>{if(i){let C=null,p=await createGraphQLClient({url:e,customFetchApi:async(f,I)=>(C=await fetch(f,I),u?.(C.headers),C),headers:t.headers}).requestStream(i.query,{variables:i.variables}),l,T;for await(let f of p){let{data:I,errors:h}=f;l=I,T=h?.graphQLErrors??h;}return C?.ok?io({data:l,errors:T},C):C}let d=await fetch(e,t);if(u?.(d.headers),!d.ok)return d;let y=await d.text().catch(()=>"");try{y&&(y=te(y));}catch{}return io(y,d)},{cacheInstance:r,waitUntil:s,strategy:n??null,debugInfo:c,shouldCacheResult:d=>"ok"in d?!1:a(...co(d))}).then(d=>"ok"in d?[null,d]:co(d))}function aa(e){let{cache:t,waitUntil:r,request:n}=e;return {run:({cacheKey:o,cacheStrategy:a,shouldCacheResult:s},c)=>ot(o,c,{shouldCacheResult:s,strategy:a,cacheInstance:t,waitUntil:r,debugInfo:{...ie(n),stackInfo:X?.()}}),fetch:(o,a,s)=>nt(o,a??{},{waitUntil:r,cacheKey:[o,a],cacheInstance:t,debugInfo:{url:o,...ie(n),stackInfo:X?.(),displayName:s?.displayName},cache:s.cacheStrategy,...s}).then(([c,i])=>({data:c,response:i}))}}var kt=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),d=(Date.now()-o)/1e3;if(d>i+u){this.#e.delete(t.url);return}let C=d>i;return s.set("cache",C?"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 uo="cartFormInput";function re({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:uo,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}re.INPUT_NAME=uo;re.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",GiftCardCodesUpdate:"GiftCardCodesUpdate",GiftCardCodesAdd:"GiftCardCodesAdd",GiftCardCodesRemove:"GiftCardCodesRemove",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete",DeliveryAddressesAdd:"DeliveryAddressesAdd",DeliveryAddressesUpdate:"DeliveryAddressesUpdate",DeliveryAddressesRemove:"DeliveryAddressesRemove",DeliveryAddressesReplace:"DeliveryAddressesReplace"};function ia(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}}}re.getFormInput=ia;var Vt=e=>{let t=parse(Et(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 at(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var Me="2026.4.7";function Pe(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var la=/(^|}\s)query[\s({]/im,ya=/(^|}\s)mutation[\s({]/im;function st(e,t){if(!la.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function it(e,t){if(!ya.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}var fe=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+=`
24
24
  `,this.stack&&(t+=`${this.stack.slice(this.stack.indexOf(`
25
25
  `)+1)}
26
- `),t}toJSON(){return {name:"Error",message:""}}};function He({url:e,response:t,errors:r,type:o,query:n,queryVariables:a,ErrorConstructor:s=Error,client:i="storefront"}){let c=(typeof r=="string"?r:r?.map?.(d=>d.message).join(`
26
+ `),t}toJSON(){return {name:"Error",message:""}}};function Fe({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?.(d=>d.message).join(`
27
27
  `))||`URL: ${e}
28
- API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{errors:r},clientOperation:`${i}.${o}`,requestId:t.headers.get("x-request-id")});throw new s(u.message,{cause:u.cause})}var ha={language:"EN",country:"US"};function Ao(e){let {storefrontHeaders:t,cache:r,waitUntil:o,i18n:n,storefrontId:a,logErrors:s=true,...i}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getStorefrontApiUrl:y,getShopifyDomain:m}=createStorefrontClient(i),p=(i.privateStorefrontToken?d:u)({contentType:"json",buyerIp:t?.buyerIp||""});t?.buyerIp&&(p[je]=t.buyerIp),t?.buyerIpSig&&(p[he]=t.buyerIpSig),p[be]=t?.requestGroupId||ct(),a&&(p[SHOPIFY_STOREFRONT_ID_HEADER]=a),(p["user-agent"]=`Hydrogen ${Fe}`);let l=t?.cookie??"";l&&(p.cookie=l);let S,f;if(!/\b_shopify_(analytics|marketing)=/.test(l)){let g=l.match(/\b_shopify_y=([^;]+)/)?.[1],v=l.match(/\b_shopify_s=([^;]+)/)?.[1];g&&(p[SHOPIFY_STOREFRONT_Y_HEADER]=g),v&&(p[SHOPIFY_STOREFRONT_S_HEADER]=v),S=g??ct(),f=v??ct(),p[SHOPIFY_UNIQUE_TOKEN_HEADER]=S,p[SHOPIFY_VISIT_TOKEN_HEADER]=f;}let R,h=JSON.stringify({"content-type":p["content-type"],"user-agent":p["user-agent"],[Tt]:p[Tt],[St]:p[St],[Pt]:p[Pt],[we]:p[we]});async function T({query:g,mutation:v,variables:P,cache:U,headers:M=[],storefrontApiVersion:j,displayName:ht,stackInfo:At}){let Qe=M instanceof Headers?Object.fromEntries(M.entries()):Array.isArray(M)?Object.fromEntries(M):M,K=g??v,A={...P};n&&(!P?.country&&/\$country/.test(K)&&(A.country=n.country),!P?.language&&/\$language/.test(K)&&(A.language=n.language));let E=y({storefrontApiVersion:j}),L=JSON.stringify({query:K,variables:A}),V={method:"POST",headers:{...p,...Qe},body:L},N=[E,V.method,h,V.body],Z=K.includes("@defer")?{query:K,variables:A}:void 0,[q,$]=await it(E,V,{cacheInstance:v?void 0:r,cache:U||Te(),cacheKey:N,waitUntil:o,shouldCacheResponse:G=>!G?.errors,debugInfo:{requestId:V.headers[be],displayName:ht,url:E,stackInfo:At,graphql:L,purpose:t?.purpose},streamConfig:Z,onRawHeaders:G=>{R??={setCookie:G.getSetCookie(),serverTiming:G.get("server-timing")??""};}}),ae={url:E,response:$,type:v?"mutation":"query",query:K,queryVariables:A,errors:void 0};if(!$.ok){let G,Y=q;try{Y??=await $.text(),G=te(Y);}catch{G=[{message:Y??"Could not parse Storefront API response"}];}He({...ae,errors:G});}let{data:W,errors:k}=q;k=k?Array.isArray(k)?k:[k]:void 0;let me=k?.map(({message:G,...Y})=>new ye(G,{...Y,clientOperation:`storefront.${ae.type}`,requestId:$.headers.get("x-request-id"),queryVariables:A,query:K}));return I(W,me)}return {storefront:{query(g,v){g=Se(g),ut(g,"storefront.query");let P=ho?.(g);return Ae(T({...v,query:g,stackInfo:X?.(P)}),{stackOffset:P,logErrors:s})},mutate(g,v){g=Se(g),dt(g,"storefront.mutate");let P=ho?.(g);return Ae(T({...v,mutation:g,stackInfo:X?.(P)}),{stackOffset:P,logErrors:s})},cache:r,CacheNone:Ut,CacheLong:kt,CacheShort:le,CacheCustom:Vt,generateCacheControlHeader:Ne,getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getHeaders:()=>({...p}),getShopifyDomain:m,getApiUrl:y,i18n:n??ha,isStorefrontApiUrl(g){return Ot.test(rt(g.url??""))},async forward(g,v){let P=new Headers([...Ve(j=>g.headers.get(j),["accept","accept-encoding","accept-language","access-control-request-headers","access-control-request-method","content-type","content-length","cookie","origin","referer","user-agent",we,SHOPIFY_UNIQUE_TOKEN_HEADER,SHOPIFY_VISIT_TOKEN_HEADER]),...Ve(j=>p[j],[je,he,SHOPIFY_STOREFRONT_ID_HEADER,be])]);t?.buyerIp&&P.set("x-forwarded-for",t.buyerIp);let U=v?.storefrontApiVersion??rt(g.url).match(Ot)?.[1],M=await fetch(y({storefrontApiVersion:U}),{method:g.method,body:g.body,headers:P});return new Response(M.body,M)},isMcpUrl(g){return so.test(rt(g.url??""))},async forwardMcp(g){let v=new Headers([...Ve(U=>g.headers.get(U),["accept","accept-encoding","accept-language","content-type","cookie","origin","referer","user-agent"]),...Ve(U=>p[U],[je,he,we,be,SHOPIFY_STOREFRONT_ID_HEADER])]);t?.buyerIp&&v.set("x-forwarded-for",t.buyerIp);let P=`${m()}/api/mcp`;try{let U=await fetch(P,{method:g.method,body:g.body,headers:v});return new Response(U.body,U)}catch(U){let j=U instanceof Error?U.message:"Internal proxy error";return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32603,message:j},id:null}),{status:502,headers:{"content-type":"application/json"}})}},setCollectedSubrequestHeaders:g=>{if(R)for(let M of R.setCookie)g.headers.append("Set-Cookie",M);let v=Ur(R?.serverTiming),P=g.headers.get("content-type")?.startsWith("text/html");De(g,{...P?{_y:S,_s:f}:void 0,...v}),P&&R&&R.setCookie.length>1&&v?._y&&v?._s&&v?._cmp&&De(g,{[Ye]:"1"});}}}}var ho=void 0;function I(e,t){return {...e,...t&&{errors:t}}}function b(e){return e?.visitorConsent!==void 0}function w(e=false){let t=`$country: CountryCode = ZZ
28
+ API response error: ${t.status}`,u=new fe(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 ga={language:"EN",country:"US"};function fo(e){let {storefrontHeaders:t,cache:r,waitUntil:n,i18n:o,storefrontId:a,logErrors:s=true,...c}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getStorefrontApiUrl:y,getShopifyDomain:C}=createStorefrontClient(c),p=(c.privateStorefrontToken?d:u)({contentType:"json",buyerIp:t?.buyerIp||""});t?.buyerIp&&(p[Xe]=t.buyerIp),t?.buyerIpSig&&(p[Ae]=t.buyerIpSig),p[Ue]=t?.requestGroupId||at(),a&&(p[SHOPIFY_STOREFRONT_ID_HEADER]=a),(p["user-agent"]=`Hydrogen ${Me}`);let l=t?.cookie??"";l&&(p.cookie=l);let T,f;if(!/\b_shopify_(analytics|marketing)=/.test(l)){let A=l.match(/\b_shopify_y=([^;]+)/)?.[1],P=l.match(/\b_shopify_s=([^;]+)/)?.[1];A&&(p[SHOPIFY_STOREFRONT_Y_HEADER]=A),P&&(p[SHOPIFY_STOREFRONT_S_HEADER]=P),T=A??at(),f=P??at(),p[SHOPIFY_UNIQUE_TOKEN_HEADER]=T,p[SHOPIFY_VISIT_TOKEN_HEADER]=f;}let I,h=JSON.stringify({"content-type":p["content-type"],"user-agent":p["user-agent"],[Rt]:p[Rt],[It]:p[It],[vt]:p[vt],[Le]:p[Le]});async function S({query:A,mutation:P,variables:R,cache:U,headers:M=[],storefrontApiVersion:j,displayName:de,stackInfo:mt}){let Be=M instanceof Headers?Object.fromEntries(M.entries()):Array.isArray(M)?Object.fromEntries(M):M,K=A??P,g={...R};o&&(!R?.country&&/\$country/.test(K)&&(g.country=o.country),!R?.language&&/\$language/.test(K)&&(g.language=o.language));let E=y({storefrontApiVersion:j}),L=JSON.stringify({query:K,variables:g}),V={method:"POST",headers:{...p,...Be},body:L},N=[E,V.method,h,V.body],Z=K.includes("@defer")?{query:K,variables:g}:void 0,[q,$]=await nt(E,V,{cacheInstance:P?void 0:r,cache:U||Se(),cacheKey:N,waitUntil:n,shouldCacheResponse:G=>!G?.errors,debugInfo:{requestId:V.headers[Ue],displayName:de,url:E,stackInfo:mt,graphql:L,purpose:t?.purpose},streamConfig:Z,onRawHeaders:G=>{I??={setCookie:G.getSetCookie()};}}),ae={url:E,response:$,type:P?"mutation":"query",query:K,queryVariables:g,errors:void 0};if(!$.ok){let G,Y=q;try{Y??=await $.text(),G=te(Y);}catch{G=[{message:Y??"Could not parse Storefront API response"}];}Fe({...ae,errors:G});}let{data:W,errors:k}=q;k=k?Array.isArray(k)?k:[k]:void 0;let Ce=k?.map(({message:G,...Y})=>new fe(G,{...Y,clientOperation:`storefront.${ae.type}`,requestId:$.headers.get("x-request-id"),queryVariables:g,query:K}));return v(W,Ce)}return {storefront:{query(A,P){A=Pe(A),st(A,"storefront.query");let R=yo?.(A);return Te(S({...P,query:A,stackInfo:X?.(R)}),{stackOffset:R,logErrors:s})},mutate(A,P){A=Pe(A),it(A,"storefront.mutate");let R=yo?.(A);return Te(S({...P,mutation:A,stackInfo:X?.(R)}),{stackOffset:R,logErrors:s})},cache:r,CacheNone:Dt,CacheLong:Ot,CacheShort:ye,CacheCustom:_t,generateCacheControlHeader:Ve,getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getHeaders:()=>({...p}),getShopifyDomain:C,getApiUrl:y,i18n:o??ga,isStorefrontApiUrl(A){return bt.test(Ze(A.url??""))},async forward(A,P){let R=new Headers([...ke(de=>A.headers.get(de),["accept","accept-encoding","accept-language","access-control-request-headers","access-control-request-method","content-type","content-length","cookie","origin","referer","user-agent",Zr,Le,SHOPIFY_UNIQUE_TOKEN_HEADER,SHOPIFY_VISIT_TOKEN_HEADER]),...ke(de=>p[de],[Xe,Ae,SHOPIFY_STOREFRONT_ID_HEADER,Ue])]);t?.buyerIp&&R.set("x-forwarded-for",t.buyerIp);let U=P?.storefrontApiVersion??Ze(A.url).match(bt)?.[1],M=await fetch(y({storefrontApiVersion:U}),{method:A.method,body:A.body,headers:R}),j=new Response(M.body,M);return j.headers.delete("server-timing"),j},isMcpUrl(A){return to.test(Ze(A.url??""))},async forwardMcp(A){let P=new Headers([...ke(U=>A.headers.get(U),["accept","accept-encoding","accept-language","content-type","cookie","origin","referer","user-agent"]),...ke(U=>p[U],[Xe,Ae,Le,Ue,SHOPIFY_STOREFRONT_ID_HEADER])]);t?.buyerIp&&P.set("x-forwarded-for",t.buyerIp);let R=`${C()}/api/mcp`;try{let U=await fetch(R,{method:A.method,body:A.body,headers:P}),M=new Response(U.body,U);return M.headers.delete("server-timing"),M}catch(U){let j=U instanceof Error?U.message:"Internal proxy error";return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32603,message:j},id:null}),{status:502,headers:{"content-type":"application/json"}})}},setCollectedSubrequestHeaders:A=>{if(I)for(let P of I.setCookie)A.headers.append("Set-Cookie",P);}}}}var yo=void 0;function v(e,t){return {...e,...t&&{errors:t}}}function b(e){return e?.visitorConsent!==void 0}function w(e=false){let t=`$country: CountryCode = ZZ
29
29
  $language: LanguageCode`;return e?`${t}
30
- $visitorConsent: VisitorConsent`:t}function D(e=false){return e?"@inContext(country: $country, language: $language, visitorConsent: $visitorConsent)":"@inContext(country: $country, language: $language)"}function Gt({storefront:e,customerAccount:t,getCartId:r,cartFragment:o}){return async n=>{let a=n?.cartId??r();if(!a)return null;let s=b(n),[i,{cart:c,errors:u}]=await Promise.all([t?t.isLoggedIn():false,e.query(Aa(o,{includeVisitorConsent:s}),{variables:{cartId:a,...n},cache:e.CacheNone()})]);if(i&&c&&typeof c=="object"&&"checkoutUrl"in c&&typeof c.checkoutUrl=="string"){let d=new URL(c.checkoutUrl);d.searchParams.set("logged_in","true"),Object.assign(c,{checkoutUrl:d.toString()});}return c||u?I(c,u):null}}var Aa=(e=Ta,t={})=>`#graphql
30
+ $visitorConsent: VisitorConsent`:t}function D(e=false){return e?"@inContext(country: $country, language: $language, visitorConsent: $visitorConsent)":"@inContext(country: $country, language: $language)"}function Ft({storefront:e,customerAccount:t,getCartId:r,cartFragment:n}){return async o=>{let a=o?.cartId??r();if(!a)return null;let s=b(o),[c,{cart:i,errors:u}]=await Promise.all([t?t.isLoggedIn():false,e.query(ha(n,{includeVisitorConsent:s}),{variables:{cartId:a,...o},cache:e.CacheNone()})]);if(c&&i&&typeof i=="object"&&"checkoutUrl"in i&&typeof i.checkoutUrl=="string"){let d=new URL(i.checkoutUrl);d.searchParams.set("logged_in","true"),Object.assign(i,{checkoutUrl:d.toString()});}return i||u?v(i,u):null}}var ha=(e=Aa,t={})=>`#graphql
31
31
  query CartQuery(
32
32
  $cartId: ID!
33
33
  $numCartLines: Int = 100
@@ -39,7 +39,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
39
39
  }
40
40
 
41
41
  ${e}
42
- `,Ta=`#graphql
42
+ `,Aa=`#graphql
43
43
  fragment CartApiQuery on Cart {
44
44
  updatedAt
45
45
  id
@@ -172,7 +172,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
172
172
  message
173
173
  target
174
174
  }
175
- `;function Bt(e){return async(t,r)=>{let o=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartId:n,...a}=r||{},{buyerIdentity:s,...i}=t,c=b(r),{cartCreate:u,errors:d}=await e.storefront.mutate(Sa(e.cartFragment,{includeVisitorConsent:c}),{variables:{input:{...i,buyerIdentity:{...o,...s}},...a}});return I(u,d)}}var Sa=(e=O,t={})=>`#graphql
175
+ `;function Ht(e){return async(t,r)=>{let n=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartId:o,...a}=r||{},{buyerIdentity:s,...c}=t,i=b(r),{cartCreate:u,errors:d}=await e.storefront.mutate(Ta(e.cartFragment,{includeVisitorConsent:i}),{variables:{input:{...c,buyerIdentity:{...n,...s}},...a}});return v(u,d)}}var Ta=(e=O,t={})=>`#graphql
176
176
  mutation cartCreate(
177
177
  $input: CartInput!
178
178
  ${w(t.includeVisitorConsent)}
@@ -193,7 +193,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
193
193
  ${e}
194
194
  ${x}
195
195
  ${_}
196
- `;function Qt(e){return async(t,r)=>{let o=b(r),{cartLinesAdd:n,errors:a}=await e.storefront.mutate(Pa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lines:t,...r}});return I(n,a)}}var Pa=(e=O,t={})=>`#graphql
196
+ `;function qt(e){return async(t,r)=>{let n=b(r),{cartLinesAdd:o,errors:a}=await e.storefront.mutate(Sa(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),lines:t,...r}});return v(o,a)}}var Sa=(e=O,t={})=>`#graphql
197
197
  mutation cartLinesAdd(
198
198
  $cartId: ID!
199
199
  $lines: [CartLineInput!]!
@@ -214,7 +214,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
214
214
  ${e}
215
215
  ${x}
216
216
  ${_}
217
- `;var To="__h_pending_";function So(e){return To+e}function pt(e){return e.startsWith(To)}function lt(e,t){if(t.some(r=>pt(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 Wt(e){return async(t,r)=>{lt("updateLines",t);let o=b(r),{cartLinesUpdate:n,errors:a}=await e.storefront.mutate(Ra(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lines:t,...r}});return I(n,a)}}var Ra=(e=O,t={})=>`#graphql
217
+ `;var mo="__h_pending_";function Co(e){return mo+e}function ct(e){return e.startsWith(mo)}function ut(e,t){if(t.some(r=>ct(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 $t(e){return async(t,r)=>{ut("updateLines",t);let n=b(r),{cartLinesUpdate:o,errors:a}=await e.storefront.mutate(Pa(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),lines:t,...r}});return v(o,a)}}var Pa=(e=O,t={})=>`#graphql
218
218
  mutation cartLinesUpdate(
219
219
  $cartId: ID!
220
220
  $lines: [CartLineUpdateInput!]!
@@ -235,7 +235,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
235
235
  ${e}
236
236
  ${x}
237
237
  ${_}
238
- `;function jt(e){return async(t,r)=>{lt("removeLines",t);let o=b(r),{cartLinesRemove:n,errors:a}=await e.storefront.mutate(va(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return I(n,a)}}var va=(e=O,t={})=>`#graphql
238
+ `;function Gt(e){return async(t,r)=>{ut("removeLines",t);let n=b(r),{cartLinesRemove:o,errors:a}=await e.storefront.mutate(Ra(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return v(o,a)}}var Ra=(e=O,t={})=>`#graphql
239
239
  mutation cartLinesRemove(
240
240
  $cartId: ID!
241
241
  $lineIds: [ID!]!
@@ -256,7 +256,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
256
256
  ${e}
257
257
  ${x}
258
258
  ${_}
259
- `;function Kt(e){return async(t,r)=>{let o=t.filter((i,c,u)=>u.indexOf(i)===c),n=b(r),{cartDiscountCodesUpdate:a,errors:s}=await e.storefront.mutate(Ia(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),discountCodes:o,...r}});return I(a,s)}}var Ia=(e=O,t={})=>`#graphql
259
+ `;function Bt(e){return async(t,r)=>{let n=t.filter((c,i,u)=>u.indexOf(c)===i),o=b(r),{cartDiscountCodesUpdate:a,errors:s}=await e.storefront.mutate(Ia(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),discountCodes:n,...r}});return v(a,s)}}var Ia=(e=O,t={})=>`#graphql
260
260
  mutation cartDiscountCodesUpdate(
261
261
  $cartId: ID!
262
262
  $discountCodes: [String!]!
@@ -279,7 +279,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
279
279
  ${e}
280
280
  ${x}
281
281
  ${_}
282
- `;function Yt(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,n=b(r),{cartBuyerIdentityUpdate:a,errors:s}=await e.storefront.mutate(Ea(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),buyerIdentity:{...o,...t},...r}});return I(a,s)}}var Ea=(e=O,t={})=>`#graphql
282
+ `;function Qt(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,o=b(r),{cartBuyerIdentityUpdate:a,errors:s}=await e.storefront.mutate(va(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),buyerIdentity:{...n,...t},...r}});return v(a,s)}}var va=(e=O,t={})=>`#graphql
283
283
  mutation cartBuyerIdentityUpdate(
284
284
  $cartId: ID!
285
285
  $buyerIdentity: CartBuyerIdentityInput!
@@ -300,7 +300,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
300
300
  ${e}
301
301
  ${x}
302
302
  ${_}
303
- `;function Jt(e){return async(t,r)=>{let o=b(r),{cartNoteUpdate:n,errors:a}=await e.storefront.mutate(ba(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),note:t,...r}});return I(n,a)}}var ba=(e=O,t={})=>`#graphql
303
+ `;function Wt(e){return async(t,r)=>{let n=b(r),{cartNoteUpdate:o,errors:a}=await e.storefront.mutate(Ea(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),note:t,...r}});return v(o,a)}}var Ea=(e=O,t={})=>`#graphql
304
304
  mutation cartNoteUpdate(
305
305
  $cartId: ID!
306
306
  $note: String!
@@ -321,7 +321,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
321
321
  ${e}
322
322
  ${x}
323
323
  ${_}
324
- `;function zt(e){return async(t,r)=>{let o=b(r),{cartSelectedDeliveryOptionsUpdate:n,errors:a}=await e.storefront.mutate(wa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return I(n,a)}}var wa=(e=O,t={})=>`#graphql
324
+ `;function jt(e){return async(t,r)=>{let n=b(r),{cartSelectedDeliveryOptionsUpdate:o,errors:a}=await e.storefront.mutate(ba(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return v(o,a)}}var ba=(e=O,t={})=>`#graphql
325
325
  mutation cartSelectedDeliveryOptionsUpdate(
326
326
  $cartId: ID!
327
327
  $selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
@@ -342,7 +342,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
342
342
  ${e}
343
343
  ${x}
344
344
  ${_}
345
- `;function Xt(e){return async(t,r)=>{let o=b(r),{cartAttributesUpdate:n,errors:a}=await e.storefront.mutate(Da(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t,...r}});return I(n,a)}}var Da=(e=O,t={})=>`#graphql
345
+ `;function Kt(e){return async(t,r)=>{let n=b(r),{cartAttributesUpdate:o,errors:a}=await e.storefront.mutate(wa(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t,...r}});return v(o,a)}}var wa=(e=O,t={})=>`#graphql
346
346
  mutation cartAttributesUpdate(
347
347
  $cartId: ID!
348
348
  $attributes: [AttributeInput!]!
@@ -363,7 +363,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
363
363
  ${e}
364
364
  ${x}
365
365
  ${_}
366
- `;function Zt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),n=t.map(c=>({...c,ownerId:o})),a=b(r),{cartMetafieldsSet:s,errors:i}=await e.storefront.mutate(xa({includeVisitorConsent:a}),{variables:{metafields:n,...r}});return I({cart:{id:o},...s},i)}}var xa=(e={})=>`#graphql
366
+ `;function Yt(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),o=t.map(i=>({...i,ownerId:n})),a=b(r),{cartMetafieldsSet:s,errors:c}=await e.storefront.mutate(Da({includeVisitorConsent:a}),{variables:{metafields:o,...r}});return v({cart:{id:n},...s},c)}}var Da=(e={})=>`#graphql
367
367
  mutation cartMetafieldsSet(
368
368
  $metafields: [CartMetafieldsSetInput!]!
369
369
  ${w(e.includeVisitorConsent)}
@@ -377,7 +377,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
377
377
  }
378
378
  }
379
379
  }
380
- `;function er(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),n=b(r),{cartMetafieldDelete:a,errors:s}=await e.storefront.mutate(Oa({includeVisitorConsent:n}),{variables:{input:{ownerId:o,key:t},...r}});return I({cart:{id:o},...a},s)}}var Oa=(e={})=>`#graphql
380
+ `;function Jt(e){return async(t,r)=>{let n=r?.cartId||e.getCartId(),o=b(r),{cartMetafieldDelete:a,errors:s}=await e.storefront.mutate(xa({includeVisitorConsent:o}),{variables:{input:{ownerId:n,key:t},...r}});return v({cart:{id:n},...a},s)}}var xa=(e={})=>`#graphql
381
381
  mutation cartMetafieldDelete(
382
382
  $input: CartMetafieldDeleteInput!
383
383
  ${w(e.includeVisitorConsent)}
@@ -390,7 +390,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
390
390
  }
391
391
  }
392
392
  }
393
- `;function tr(e){return async(t,r)=>{let o=b(r),{cartGiftCardCodesUpdate:n,errors:a}=await e.storefront.mutate(_a(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return I(n,a)}}var _a=(e=O,t={})=>`#graphql
393
+ `;function zt(e){return async(t,r)=>{let n=b(r),{cartGiftCardCodesUpdate:o,errors:a}=await e.storefront.mutate(Oa(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return v(o,a)}}var Oa=(e=O,t={})=>`#graphql
394
394
  mutation cartGiftCardCodesUpdate(
395
395
  $cartId: ID!
396
396
  $giftCardCodes: [String!]!
@@ -411,7 +411,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
411
411
  ${e}
412
412
  ${x}
413
413
  ${_}
414
- `;function rr(e){return async(t,r)=>{let{cartGiftCardCodesAdd:o,errors:n}=await e.storefront.mutate(Ua(e.cartFragment),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return I(o,n)}}var Ua=(e=O)=>`#graphql
414
+ `;function Xt(e){return async(t,r)=>{let{cartGiftCardCodesAdd:n,errors:o}=await e.storefront.mutate(_a(e.cartFragment),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return v(n,o)}}var _a=(e=O)=>`#graphql
415
415
  mutation cartGiftCardCodesAdd(
416
416
  $cartId: ID!
417
417
  $giftCardCodes: [String!]!
@@ -433,7 +433,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
433
433
  ${e}
434
434
  ${x}
435
435
  ${_}
436
- `;function or(e){return async(t,r)=>{let o=b(r),{cartGiftCardCodesRemove:n,errors:a}=await e.storefront.mutate(La(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),appliedGiftCardIds:t,...r}});return I(n,a)}}var La=(e=O,t={})=>`#graphql
436
+ `;function Zt(e){return async(t,r)=>{let n=b(r),{cartGiftCardCodesRemove:o,errors:a}=await e.storefront.mutate(Ua(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),appliedGiftCardIds:t,...r}});return v(o,a)}}var Ua=(e=O,t={})=>`#graphql
437
437
  mutation cartGiftCardCodesRemove(
438
438
  $cartId: ID!
439
439
  $appliedGiftCardIds: [ID!]!
@@ -454,7 +454,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
454
454
  ${e}
455
455
  ${x}
456
456
  ${_}
457
- `;function Po(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesAdd:n,errors:a}=await e.storefront.mutate(ka(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return I(n,a)}}var ka=(e=O,t={})=>`#graphql
457
+ `;function go(e){return async(t,r)=>{let n=b(r),{cartDeliveryAddressesAdd:o,errors:a}=await e.storefront.mutate(La(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return v(o,a)}}var La=(e=O,t={})=>`#graphql
458
458
  mutation cartDeliveryAddressesAdd(
459
459
  $cartId: ID!
460
460
  $addresses: [CartSelectableAddressInput!]!,
@@ -475,7 +475,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
475
475
  ${e}
476
476
  ${x}
477
477
  ${_}
478
- `;function Ro(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesRemove:n,errors:a}=await e.storefront.mutate(Va(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addressIds:t,...r}});return I(n,a)}}var Va=(e=O,t={})=>`#graphql
478
+ `;function ho(e){return async(t,r)=>{let n=b(r),{cartDeliveryAddressesRemove:o,errors:a}=await e.storefront.mutate(ka(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),addressIds:t,...r}});return v(o,a)}}var ka=(e=O,t={})=>`#graphql
479
479
  mutation cartDeliveryAddressesRemove(
480
480
  $cartId: ID!
481
481
  $addressIds: [ID!]!,
@@ -496,7 +496,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
496
496
  ${e}
497
497
  ${x}
498
498
  ${_}
499
- `;function vo(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesUpdate:n,errors:a}=await e.storefront.mutate(Na(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return I(n,a)}}var Na=(e=O,t={})=>`#graphql
499
+ `;function Ao(e){return async(t,r)=>{let n=b(r),{cartDeliveryAddressesUpdate:o,errors:a}=await e.storefront.mutate(Va(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return v(o,a)}}var Va=(e=O,t={})=>`#graphql
500
500
  mutation cartDeliveryAddressesUpdate(
501
501
  $cartId: ID!
502
502
  $addresses: [CartSelectableAddressUpdateInput!]!,
@@ -517,7 +517,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
517
517
  ${e}
518
518
  ${x}
519
519
  ${_}
520
- `;function Io(e){return async(t,r)=>{let{cartDeliveryAddressesReplace:o,errors:n}=await e.storefront.mutate(Ma(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return I(o,n)}}var Ma=(e=O)=>`#graphql
520
+ `;function To(e){return async(t,r)=>{let{cartDeliveryAddressesReplace:n,errors:o}=await e.storefront.mutate(Na(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return v(n,o)}}var Na=(e=O)=>`#graphql
521
521
  mutation cartDeliveryAddressesReplace(
522
522
  $cartId: ID!
523
523
  $addresses: [CartSelectableAddressInput!]!,
@@ -539,7 +539,7 @@ API response error: ${t.status}`,u=new ye(c,{query:n,queryVariables:a,cause:{err
539
539
  ${e}
540
540
  ${x}
541
541
  ${_}
542
- `;function nr(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:n,cartQueryFragment:a,cartMutateFragment:s,buyerIdentity:i}=e,c=t(),u=()=>c||t(),d={storefront:o,getCartId:u,cartFragment:s,customerAccount:n},y=Bt(d),m=async function(...p){p[0].buyerIdentity={...i,...p[0].buyerIdentity};let l=await y(...p);if(l?.cart&&(typeof l.cart!="object"||!("id"in l.cart)||typeof l.cart.id!="string"))throw new Error("[h2:error:createCartHandler] Cart created but response is missing a valid `id` field. Ensure your cart query fragment includes the `id` field.");return c=l?.cart&&typeof l.cart=="object"&&"id"in l.cart&&typeof l.cart.id=="string"?l.cart.id:void 0,l},C={get:Gt({storefront:o,customerAccount:n,getCartId:u,cartFragment:a}),getCartId:u,setCartId:r,create:m,addLines:async(p,l)=>{let S=p.map(f=>({attributes:f.attributes,quantity:f.quantity,merchandiseId:f.merchandiseId,sellingPlanId:f.sellingPlanId,parent:f.parent}));return c||l?.cartId?await Qt(d)(S,l):await m({lines:S,buyerIdentity:i},l)},updateLines:Wt(d),removeLines:jt(d),updateDiscountCodes:async(p,l)=>c||l?.cartId?await Kt(d)(p,l):await m({discountCodes:p},l),updateGiftCardCodes:async(p,l)=>c||l?.cartId?await tr(d)(p,l):await m({giftCardCodes:p},l),addGiftCardCodes:rr(d),removeGiftCardCodes:or(d),updateBuyerIdentity:async(p,l)=>c||l?.cartId?await Yt(d)(p,l):await m({buyerIdentity:p},l),updateNote:async(p,l)=>c||l?.cartId?await Jt(d)(p,l):await m({note:p},l),updateSelectedDeliveryOption:zt(d),updateAttributes:async(p,l)=>c||l?.cartId?await Xt(d)(p,l):await m({attributes:p},l),setMetafields:async(p,l)=>c||l?.cartId?await Zt(d)(p,l):await m({metafields:p},l),deleteMetafield:er(d),addDeliveryAddresses:Po(d),removeDeliveryAddresses:Ro(d),updateDeliveryAddresses:vo(d),replaceDeliveryAddresses:Io(d)};return "customMethods"in e?{...C,...e.customMethods??{}}:C}function Ha(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=re.getFormInput(a);if(s.action===re.ACTIONS.LinesAdd)for(let i of s.inputs.lines){if(!i.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 c=o.find(u=>u.merchandise.id===i.selectedVariant?.id);n=true,c?(c.quantity=(c.quantity||1)+(i.quantity||1),c.isOptimistic=true):o.unshift({id:So(i.selectedVariant.id),merchandise:i.selectedVariant,isOptimistic:true,quantity:i.quantity||1});}else if(s.action===re.ACTIONS.LinesRemove)for(let i of s.inputs.lineIds){let c=o.findIndex(u=>u.id===i);if(c!==-1){if(pt(o[c].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}o.splice(c,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${i}' but it doesn't exist in the cart`);}else if(s.action===re.ACTIONS.LinesUpdate)for(let i of s.inputs.lines){let c=o.findIndex(u=>i.id===u.id);if(c>-1){if(pt(o[c].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}o[c].quantity=i.quantity,o[c].quantity===0&&o.splice(c,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${i.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 qa="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function $a({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||qa)}var qe=createContext$1(),ar=createContext$1(),sr=createContext$1(),ir=createContext$1(),cr=createContext$1(),ur=createContext$1(),Ga={storefront:qe,cart:ar,customerAccount:sr,env:ir,session:cr,waitUntil:ur};var yt="2026-04",Re=`Shopify Hydrogen ${Fe}`,Eo="30243aa5-17c1-465a-8493-944bcc4e88aa",F="customerAccount",ve="buyer";var Q=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function Ee(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 Ba({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:o,debugInfo:n}){let a=new URLSearchParams,s=e.get(F),i=s?.refreshToken,c=s?.idToken;if(!i)throw Ie(e),new Q("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",i),a.append("client_id",t);let u={"content-type":"application/x-www-form-urlencoded","User-Agent":Re,Origin:o};new Date().getTime();let y=r,m=await fetch(y,{method:"POST",headers:u,body:a});if(!m.ok){let f=await m.text();throw Qa(f)==="invalid_grant"&&Ie(e),new Response(f,{status:m.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:C,expires_in:p,refresh_token:l,error:S}=await m.json();if(!C||C.length===0)throw S==="invalid_grant"&&Ie(e),new Q("Unauthorized","Invalid access token received.");e.set(F,{accessToken:C,expiresAt:new Date(new Date().getTime()+(p-120)*1e3).getTime()+"",refreshToken:l,idToken:c});}function Ie(e){e.unset(F),e.unset(ve);}async function bo({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=Ba({session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(i){throw i&&i.status!==401?i:new Q("Unauthorized","Login before querying the Customer Account API.")}}function Qa(e){try{let t=JSON.parse(e);return typeof t?.error=="string"?t.error:void 0}catch{return}}function wo(){let e=xo();return dr(e)}async function Do(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=Wa(t);return dr(r)}function xo(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function dr(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Wa(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function Oo(){return dr(xo())}async function _o(e,t,r,o,n){let a=t;if(!e)throw new Q("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",Eo),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 i={"content-type":"application/x-www-form-urlencoded","User-Agent":Re,Origin:o};new Date().getTime();let u=r,d=await fetch(u,{method:"POST",headers:i,body:s});let y=await d.json();if(y.error)throw new Q(y.error_description);return y.access_token}function Uo(e){return ja(e).payload.nonce}function ja(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 ft(){return Ya(Ka())}function Ka(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function Ya(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function mt(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(ko(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}`);}}function ko(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return false}}function pr({requestUrl:e,defaultUrl:t,redirectUrl:r}){let o=e,n=Lo(e,t),a=r?Lo(e,r):n;return ko(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 Lo(e,t){return Ja(t)?new URL(t):new URL(t,new URL(e).origin)}function Ja(e){try{return new URL(e),!0}catch{return false}}function Vo(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`}}}var No="oauth_recovery",Mo="oauth-recovery.";function za(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 Ee(n)}function yr({session:e,customerAccountId:t,shopId:r,customerApiVersion:o=yt,request:n,waitUntil:a,authUrl:s,customAuthStatusHandler:i,logErrors:c=true,loginPath:u="/account/login",authorizePath:d="/account/authorize",defaultRedirectPath:y="/account",language:m,useCustomAuthDomain:C}){if(o!==yt&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${yt}.`),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 p=new URL(n.url),l=p.protocol==="http:"?p.origin.replace("http","https"):p.origin,S=pr({requestUrl:l,defaultUrl:d,redirectUrl:s}),f=A=>void 0,R=i||(()=>(f(p.hostname),za(n,u))),h=Vo(o,r),T=Xa(h,t),g=h("GRAPHQL"),v={};async function P({query:A,type:E,variables:L={}}){let V=await j();if(!V)throw R();new Date().getTime();let q=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":Re,Origin:l,Authorization:V},body:JSON.stringify({query:A,variables:L})});let $=await q.text(),ae={url:g,response:q,type:E,query:A,queryVariables:L,errors:void 0,client:"customer"};if(!q.ok){if(q.status===401)throw Ie(e),R();let W;try{W=te($);}catch{W=[{message:$}];}He({...ae,errors:W});}try{let W=te($),{errors:k}=W,me=k?.map(({message:G,...Y})=>new ye(G,{...Y,clientOperation:`customerAccount.${ae.type}`,requestId:q.headers.get("x-request-id"),queryVariables:L,query:A}));return {...W,...k&&{errors:me}}}catch{He({...ae,errors:[{message:$}]});}}async function U(){if(!r)return false;let A=e.get(F),E=A?.accessToken,L=A?.expiresAt;if(!E||!L)return false;let V=X?.();try{await bo({locks:v,expiresAt:L,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:h("TOKEN_EXCHANGE"),httpsOrigin:l,debugInfo:{waitUntil:a,stackInfo:V,...ce(n)}});}catch{return false}return true}async function M(){if(!await U())throw R()}async function j(){if(await U())return e.get(F)?.accessToken}async function ht(A,E){return f(p.hostname),T(),A=Se(A),dt(A,"customer.mutate"),Ae(P({query:A,type:"mutation",...E}),{logErrors:c})}async function At(A,E){return f(p.hostname),T(),A=Se(A),ut(A,"customer.query"),Ae(P({query:A,type:"query",...E}),{logErrors:c})}function Qe(A){e.set(ve,{...e.get(ve),...A});}async function K(){let A=await j();if(A)return {...e.get(ve),customerAccessToken:A}}return {i18n:{language:m??"EN"},login:async A=>{f(p.hostname),T();let E=new URL(h("AUTH")),V=`${p.searchParams.get(No)==="true"?Mo:""}${Oo()}`,N=ft();E.searchParams.set("client_id",t),E.searchParams.set("scope","openid email"),E.searchParams.append("response_type","code"),E.searchParams.append("redirect_uri",S),E.searchParams.set("scope",h("LOGIN_SCOPE")),E.searchParams.append("state",V),E.searchParams.append("nonce",N);let Z=Za({contextLanguage:m??null,localeOverride:A?.locale??null,uiLocalesOverride:A?.uiLocales??null});Z!=null&&E.searchParams.append("locale",Z),A?.countryCode&&E.searchParams.append("region_country",A.countryCode),A?.acrValues&&E.searchParams.append("acr_values",A.acrValues),A?.loginHint&&(E.searchParams.append("login_hint",A.loginHint),A?.loginHintMode&&E.searchParams.append("login_hint_mode",A.loginHintMode));let q=wo(),$=await Do(q);return e.set(F,{...e.get(F),codeVerifier:q,state:V,nonce:N,redirectPath:mt(n.url)||z(n,"Referer")||y}),E.searchParams.append("code_challenge",$),E.searchParams.append("code_challenge_method","S256"),Ee(E.toString())},logout:async A=>{f(p.hostname),T();let E=e.get(F)?.idToken,L=pr({requestUrl:l,defaultUrl:l,redirectUrl:A?.postLogoutRedirectUri}),V=E?new URL(`${h("LOGOUT")}?${new URLSearchParams([["id_token_hint",E],["post_logout_redirect_uri",L]]).toString()}`).toString():L;Ie(e);let N=A?.headers instanceof Headers?A?.headers:new Headers(A?.headers);return A?.keepSession||(e.destroy?N.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),Ee(V,{headers:N})},isLoggedIn:U,handleAuthStatus:M,getAccessToken:j,getApiUrl:()=>g,mutate:ht,query:At,authorize:async()=>{f(p.hostname),T();let A=p.searchParams.get("code"),E=p.searchParams.get("state");if(!A||!E)throw new Q("Unauthorized","No code or state parameter found in the redirect URL.");let L=e.get(F);if(L?.state!==E){if(E.startsWith(Mo))throw new Q("Unable to complete sign in. Please try again.","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");J("[h2:warn:customerAccount] OAuth callback state mismatch. Restarting customer login once.");let We=new URL(u,n.url);return We.searchParams.set("return_to",L?.redirectPath??y),We.searchParams.set(No,"true"),Ee(`${We.pathname}${We.search}`)}let V=t,N=new URLSearchParams;N.append("grant_type","authorization_code"),N.append("client_id",V),N.append("redirect_uri",S),N.append("code",A);let Z=e.get(F)?.codeVerifier;if(!Z)throw new Q("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");N.append("code_verifier",Z);let q={"content-type":"application/x-www-form-urlencoded","User-Agent":Re,Origin:l};new Date().getTime();let W=h("TOKEN_EXCHANGE"),k=await fetch(W,{method:"POST",headers:q,body:N});if(!k.ok)throw new Response(await k.text(),{status:k.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:me,expires_in:G,id_token:Y,refresh_token:Rr}=await k.json(),vr=e.get(F)?.nonce,Ir=await Uo(Y);if(vr!==Ir)throw new Q("Unauthorized",`Returned nonce does not match: ${vr} !== ${Ir}`);let Er=me;r||(Er=await _o(me,t,h("TOKEN_EXCHANGE"),l,{...ce(n)}));let nn=e.get(F)?.redirectPath;return e.set(F,{accessToken:Er,expiresAt:new Date(new Date().getTime()+(G-120)*1e3).getTime()+"",refreshToken:Rr,idToken:Y}),Ee(nn||y)},setBuyer:Qe,getBuyer:K,UNSTABLE_setBuyer:A=>{J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),Qe(A);},UNSTABLE_getBuyer:()=>(J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),K())}}function Xa(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 Za(e){return e.localeOverride!=null?lr(e.localeOverride):e.uiLocalesOverride!=null?lr(e.uiLocalesOverride):e.contextLanguage!=null?lr(e.contextLanguage):null}function lr(e){let r=e.toLowerCase().replaceAll("_","-").split("-"),o=r[0],n=r[1];return n?`${o}-${n.toUpperCase()}`:o}function ts(e,t){let{env:r,request:o,cache:n,waitUntil:a,i18n:s,session:i,logErrors:c,storefront:u={},customerAccount:d,cart:y={},buyerIdentity:m}=e;i||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),d?.unstableB2b&&J("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:C}=Ao({cache:n,waitUntil:a,i18n:s,logErrors:c,storefrontHeaders:u.headers||ao(o),storefrontApiVersion:u.apiVersion,storefrontId:r.PUBLIC_STOREFRONT_ID,storeDomain:r.PUBLIC_STORE_DOMAIN,privateStorefrontToken:r.PRIVATE_STOREFRONT_API_TOKEN,publicStorefrontToken:r.PUBLIC_STOREFRONT_API_TOKEN}),p=yr({session:i,request:o,waitUntil:a,logErrors:c,customerApiVersion:d?.apiVersion,authUrl:d?.authUrl,customAuthStatusHandler:d?.customAuthStatusHandler,useCustomAuthDomain:d?.useCustomAuthDomain,language:s?.language,customerAccountId:r.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,shopId:r.SHOP_ID}),l=nr({getCartId:y.getId||Ht(o.headers),setCartId:y.setId||qt(),cartQueryFragment:y.queryFragment,cartMutateFragment:y.mutateFragment,...y.customMethods&&{customMethods:y.customMethods},buyerIdentity:m,storefront:C,customerAccount:p}),S=new RouterContextProvider;S.set(qe,C),S.set(ar,l),S.set(sr,p),S.set(ir,r),S.set(cr,i),a&&S.set(ur,a);let f={storefront:C,cart:l,customerAccount:p,env:r,session:i,waitUntil:a,...t||{}};return new Proxy(S,{get(h,T,g){if(T in h){let v=h[T];return typeof v=="function"?v.bind(h):v}return T in f?f[T]:Reflect.get(h,T,g)},has(h,T){return T in h||T in f},ownKeys(h){return [...Reflect.ownKeys(h),...Object.keys(f)]},getOwnPropertyDescriptor(h,T){if(T in h)return Reflect.getOwnPropertyDescriptor(h,T);if(T in f)return {enumerable:true,configurable:true,writable:false,value:f[T]}}})}function os({build:e,mode:t,poweredByHeader:r=true,getLoadContext:o,collectTrackingInformation:n=true}){let a=createRequestHandler(e,t),s=r?i=>i.headers.append("powered-by","Shopify, Hydrogen"):void 0;return async i=>{let c=i.method;if((c==="GET"||c==="HEAD")&&i.body)return new Response(`${c} requests cannot have a body`,{status:400});let u=new URL(i.url);if(u.pathname.includes("//"))return new Response(null,{status:301,headers:{location:u.pathname.replace(/\/+/g,"/")}});let d=await o?.(i),y=d?.storefront||d?.get?.(qe);if(!y)throw new Error("[h2:createRequestHandler] Storefront instance is required in the load context. Make sure to use createHydrogenContext() or provide a storefront instance via getLoadContext.");if(y.isStorefrontApiUrl(i)){let p=await y.forward(i);return s?.(p),p}if(y.isMcpUrl(i)){let p=await y.forwardMcp(i);return s?.(p),p}let m=await a(i,d);n&&y.setCollectedSubrequestHeaders(m);let C=i.headers.get("sec-fetch-dest");return (C&&C==="document"||i.headers.get("accept")?.includes("text/html"))&&De(m,{[Ke]:"1"}),s?.(m),m}}var Fo=createContext(void 0),Ho=Fo.Provider,fr=()=>useContext(Fo);function cs(e){let t=ft(),r=us(t,e);return {nonce:t,header:r,NonceProvider:({children:n})=>createElement(Ho,{value:t},n)}}function us(e,t){let{shop:r,...o}=t??{},n=`'nonce-${e}'`,a=["'self'","'unsafe-inline'","https://cdn.shopify.com"],s=["'self'","https://cdn.shopify.com/","https://monorail-edge.shopifysvc.com"];r&&r.checkoutDomain&&s.push(`https://${r.checkoutDomain}`),r&&r.storeDomain&&s.push(`https://${r.storeDomain}`);let c={baseUri:["'self'"],defaultSrc:["'self'",n,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:a,connectSrc:s},u=Object.assign({},c,o);for(let d in c){let y=o[d];d&&y&&(u[d]=ds(y,c[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]),is({directives:u})}function ds(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 ys=forwardRef((e,t)=>{let{waitForHydration:r,src:o,...n}=e,a=fr();return r?jsx(fs,{src:o,options:n}):jsx("script",{suppressHydrationWarning:true,...n,src:o,nonce:a,ref:t})});function fs({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 ms(e){return e;}function gs(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 hs({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 Rs({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:c,hasNextPage:u,hasPreviousPage:d,nextPageUrl:y,nodes:m,previousPageUrl:C,startCursor:p}=vs(e,r),l=useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:c,hasPreviousPage:d,hasNextPage:u,startCursor:p},nodes:m}}}),[c,u,d,p,m,r,s.state]),S=useMemo(()=>forwardRef(function(h,T){return u?createElement(Link,{preventScrollReset:true,...h,to:y,state:l,replace:true,ref:T,onClick:()=>n(true)}):null}),[u,y,l]),f=useMemo(()=>forwardRef(function(h,T){return d?createElement(Link,{preventScrollReset:true,...h,to:C,state:l,replace:true,ref:T,onClick:()=>n(true)}):null}),[d,C,l]);return t({state:l,hasNextPage:u,hasPreviousPage:d,isLoading:o,nextPageUrl:y,nodes:m,previousPageUrl:C,NextLink:S,PreviousLink:f})}function Ct(e,t){let r=new URLSearchParams(e);return Object.keys(t?.pagination||{}).forEach(n=>{let a=n===""?"":`${n}_`,s=`${a}cursor`,i=`${a}direction`;r.delete(s),r.delete(i);}),r.toString()}function Ge(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 vs(e,t=""){e.pageInfo||Ge("pageInfo"),typeof e.pageInfo.startCursor>"u"&&Ge("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&Ge("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&Ge("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&Ge("pageInfo.hasPreviousPage");let r=useNavigation(),o=useNavigate(),{state:n,search:a,pathname:s}=useLocation(),i=t?`${t}_cursor`:"cursor",c=t?`${t}_direction`:"direction",y=new URLSearchParams(a).get(c)==="previous",m=useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!n?.pagination?.[t]?.nodes?flattenConnection(e):y?[...flattenConnection(e),...n.pagination[t].nodes||[]]:[...n.pagination[t].nodes||[],...flattenConnection(e)],[n,e,t]),C=useMemo(()=>{let f=globalThis?.window?.__hydrogenHydrated,R=n?.pagination?.[t]?.pageInfo,h=!f||R?.startCursor===void 0?e.pageInfo.startCursor:R.startCursor,T=!f||R?.endCursor===void 0?e.pageInfo.endCursor:R.endCursor,g=!f||R?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:R.hasPreviousPage,v=!f||R?.hasNextPage===void 0?e.pageInfo.hasNextPage:R.hasNextPage;return n?.pagination?.[t]?.nodes&&(y?(h=e.pageInfo.startCursor,g=e.pageInfo.hasPreviousPage):(T=e.pageInfo.endCursor,v=e.pageInfo.hasNextPage)),{startCursor:h,endCursor:T,hasPreviousPage:g,hasNextPage:v}},[y,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 f=Ct(a,n),R=p.current.params;(s!==p.current.pathname||f!==R)&&!(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 f=new URLSearchParams(a);return f.set(c,"previous"),C.startCursor&&f.set(i,C.startCursor),`?${f.toString()}`},[a,C.startCursor]),S=useMemo(()=>{let f=new URLSearchParams(a);return f.set(c,"next"),C.endCursor&&f.set(i,C.endCursor),`?${f.toString()}`},[a,C.endCursor]);return {...C,previousPageUrl:l,nextPageUrl:S,nodes:m}}function Is(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",i=n.get(a)??void 0;return (n.get(s)==="previous"?"previous":"next")==="previous"?{last:r,startCursor:i??null}:{first:r,endCursor:i??null}}function Ds(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,i=o.find(c=>c.selectedOptions?c.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(i)return {...i,isOptimistic:true}}return e}function ks({handle:e,options:t=[],variants:r=[],productPath:o="products",waitForNavigation:n=false,selectedVariant:a,children:s}){let i=t;i[0]?.values&&(J("[h2:warn:VariantSelector] product.options.values is deprecated. Use product.options.optionValues instead."),i[0]&&!i[0].optionValues&&(i=t.map(p=>({...p,optionValues:p.values?.map(l=>({name:l}))||[]}))));let c=r instanceof Array?r:flattenConnection(r),{searchParams:u,path:d,alreadyOnProductPage:y}=Ns(e,o,n),m=i.filter(p=>p?.optionValues?.length===1),C=a?a?.selectedOptions?.reduce((p,l)=>(p[l.name]=l.value,p),{}):{};return createElement(Fragment$1,null,...useMemo(()=>i.map(p=>{let l,S=[];for(let f of p.optionValues){let R=new URLSearchParams(y?u:void 0);R.set(p.name,f.name),m.forEach(P=>{P.optionValues[0].name&&R.set(P.name,P.optionValues[0].name);});let h=c.find(P=>P?.selectedOptions?.every(U=>(R.get(U?.name)||C?.[U?.name])===U?.value)),T=u.get(p.name);!T&&a&&(T=C?.[p.name]||null);let g=T?T===f.name:false;g&&(l=f.name);let v="?"+R.toString();S.push({value:f.name,optionValue:f,isAvailable:h?h.availableForSale:true,to:d+v,search:v,isActive:g,variant:h});}return s({option:{name:p.name,value:l,values:S}})}),[i,c,s]))}var Vs=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 Ns(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),i=s&&s.length>0;t=t.startsWith("/")?t.substring(1):t;let c=i?`${s[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(r||a.state!=="loading"?n:a.location.search),alreadyOnProductPage:c===o,path:c}},[o,n,r,e,t,a])}function Ms(){return {name:"hydrogen-2025.7.0",reactRouterConfig:()=>({appDirectory:"app",buildDirectory:"dist",ssr:true,future:{v8_middleware:true,v8_splitRouteModules:true,v8_viteEnvironmentApi:false,unstable_optimizeDeps:true},subResourceIntegrity:false}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
542
+ `;function er(e){let{getCartId:t,setCartId:r,storefront:n,customerAccount:o,cartQueryFragment:a,cartMutateFragment:s,buyerIdentity:c}=e,i=t(),u=()=>i||t(),d={storefront:n,getCartId:u,cartFragment:s,customerAccount:o},y=Ht(d),C=async function(...p){p[0].buyerIdentity={...c,...p[0].buyerIdentity};let l=await y(...p);if(l?.cart&&(typeof l.cart!="object"||!("id"in l.cart)||typeof l.cart.id!="string"))throw new Error("[h2:error:createCartHandler] Cart created but response is missing a valid `id` field. Ensure your cart query fragment includes the `id` field.");return i=l?.cart&&typeof l.cart=="object"&&"id"in l.cart&&typeof l.cart.id=="string"?l.cart.id:void 0,l},m={get:Ft({storefront:n,customerAccount:o,getCartId:u,cartFragment:a}),getCartId:u,setCartId:r,create:C,addLines:async(p,l)=>{let T=p.map(f=>({attributes:f.attributes,quantity:f.quantity,merchandiseId:f.merchandiseId,sellingPlanId:f.sellingPlanId,parent:f.parent}));return i||l?.cartId?await qt(d)(T,l):await C({lines:T,buyerIdentity:c},l)},updateLines:$t(d),removeLines:Gt(d),updateDiscountCodes:async(p,l)=>i||l?.cartId?await Bt(d)(p,l):await C({discountCodes:p},l),updateGiftCardCodes:async(p,l)=>i||l?.cartId?await zt(d)(p,l):await C({giftCardCodes:p},l),addGiftCardCodes:Xt(d),removeGiftCardCodes:Zt(d),updateBuyerIdentity:async(p,l)=>i||l?.cartId?await Qt(d)(p,l):await C({buyerIdentity:p},l),updateNote:async(p,l)=>i||l?.cartId?await Wt(d)(p,l):await C({note:p},l),updateSelectedDeliveryOption:jt(d),updateAttributes:async(p,l)=>i||l?.cartId?await Kt(d)(p,l):await C({attributes:p},l),setMetafields:async(p,l)=>i||l?.cartId?await Yt(d)(p,l):await C({metafields:p},l),deleteMetafield:Jt(d),addDeliveryAddresses:go(d),removeDeliveryAddresses:ho(d),updateDeliveryAddresses:Ao(d),replaceDeliveryAddresses:To(d)};return "customMethods"in e?{...m,...e.customMethods??{}}:m}function Fa(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=re.getFormInput(a);if(s.action===re.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:Co(c.selectedVariant.id),merchandise:c.selectedVariant,isOptimistic:true,quantity:c.quantity||1});}else if(s.action===re.ACTIONS.LinesRemove)for(let c of s.inputs.lineIds){let i=n.findIndex(u=>u.id===c);if(i!==-1){if(ct(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===re.ACTIONS.LinesUpdate)for(let c of s.inputs.lines){let i=n.findIndex(u=>c.id===u.id);if(i>-1){if(ct(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 Ha="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function qa({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||Ha)}var He=createContext$1(),tr=createContext$1(),rr=createContext$1(),or=createContext$1(),nr=createContext$1(),ar=createContext$1(),$a={storefront:He,cart:tr,customerAccount:rr,env:or,session:nr,waitUntil:ar};var dt="2026-04",Ie=`Shopify Hydrogen ${Me}`,So="30243aa5-17c1-465a-8493-944bcc4e88aa",F="customerAccount",ve="buyer";var Q=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 Ga({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:n,debugInfo:o}){let a=new URLSearchParams,s=e.get(F),c=s?.refreshToken,i=s?.idToken;if(!c)throw Ee(e),new Q("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":Ie,Origin:n};new Date().getTime();let y=r,C=await fetch(y,{method:"POST",headers:u,body:a});if(!C.ok){let f=await C.text();throw Ba(f)==="invalid_grant"&&Ee(e),new Response(f,{status:C.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:m,expires_in:p,refresh_token:l,error:T}=await C.json();if(!m||m.length===0)throw T==="invalid_grant"&&Ee(e),new Q("Unauthorized","Invalid access token received.");e.set(F,{accessToken:m,expiresAt:new Date(new Date().getTime()+(p-120)*1e3).getTime()+"",refreshToken:l,idToken:i});}function Ee(e){e.unset(F),e.unset(ve);}async function Po({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=Ga({session:r,customerAccountId:n,customerAccountTokenExchangeUrl:o,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(c){throw c&&c.status!==401?c:new Q("Unauthorized","Login before querying the Customer Account API.")}}function Ba(e){try{let t=JSON.parse(e);return typeof t?.error=="string"?t.error:void 0}catch{return}}function Ro(){let e=vo();return sr(e)}async function Io(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=Qa(t);return sr(r)}function vo(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function sr(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Qa(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function Eo(){return sr(vo())}async function bo(e,t,r,n,o){let a=t;if(!e)throw new Q("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",So),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":Ie,Origin:n};new Date().getTime();let u=r,d=await fetch(u,{method:"POST",headers:c,body:s});let y=await d.json();if(y.error)throw new Q(y.error_description);return y.access_token}function wo(e){return Wa(e).payload.nonce}function Wa(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 pt(){return Ka(ja())}function ja(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function Ka(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function lt(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(xo(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${n} to ${a}`);}}function xo(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return false}}function ir({requestUrl:e,defaultUrl:t,redirectUrl:r}){let n=e,o=Do(e,t),a=r?Do(e,r):o;return xo(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 Do(e,t){return Ya(t)?new URL(t):new URL(t,new URL(e).origin)}function Ya(e){try{return new URL(e),!0}catch{return false}}function Oo(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`}}}var _o="oauth_recovery",Uo="oauth-recovery.";function Ja(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 ur({session:e,customerAccountId:t,shopId:r,customerApiVersion:n=dt,request:o,waitUntil:a,authUrl:s,customAuthStatusHandler:c,logErrors:i=true,loginPath:u="/account/login",authorizePath:d="/account/authorize",defaultRedirectPath:y="/account",language:C,useCustomAuthDomain:m}){if(n!==dt&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${n} when this version of Hydrogen was built for ${dt}.`),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 p=new URL(o.url),l=p.protocol==="http:"?p.origin.replace("http","https"):p.origin,T=ir({requestUrl:l,defaultUrl:d,redirectUrl:s}),f=g=>void 0,I=c||(()=>(f(p.hostname),Ja(o,u))),h=Oo(n,r),S=za(h,t),A=h("GRAPHQL"),P={};async function R({query:g,type:E,variables:L={}}){let V=await j();if(!V)throw I();new Date().getTime();let q=await fetch(A,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":Ie,Origin:l,Authorization:V},body:JSON.stringify({query:g,variables:L})});let $=await q.text(),ae={url:A,response:q,type:E,query:g,queryVariables:L,errors:void 0,client:"customer"};if(!q.ok){if(q.status===401)throw Ee(e),I();let W;try{W=te($);}catch{W=[{message:$}];}Fe({...ae,errors:W});}try{let W=te($),{errors:k}=W,Ce=k?.map(({message:G,...Y})=>new fe(G,{...Y,clientOperation:`customerAccount.${ae.type}`,requestId:q.headers.get("x-request-id"),queryVariables:L,query:g}));return {...W,...k&&{errors:Ce}}}catch{Fe({...ae,errors:[{message:$}]});}}async function U(){if(!r)return false;let g=e.get(F),E=g?.accessToken,L=g?.expiresAt;if(!E||!L)return false;let V=X?.();try{await Po({locks:P,expiresAt:L,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:h("TOKEN_EXCHANGE"),httpsOrigin:l,debugInfo:{waitUntil:a,stackInfo:V,...ie(o)}});}catch{return false}return true}async function M(){if(!await U())throw I()}async function j(){if(await U())return e.get(F)?.accessToken}async function de(g,E){return f(p.hostname),S(),g=Pe(g),it(g,"customer.mutate"),Te(R({query:g,type:"mutation",...E}),{logErrors:i})}async function mt(g,E){return f(p.hostname),S(),g=Pe(g),st(g,"customer.query"),Te(R({query:g,type:"query",...E}),{logErrors:i})}function Be(g){e.set(ve,{...e.get(ve),...g});}async function K(){let g=await j();if(g)return {...e.get(ve),customerAccessToken:g}}return {i18n:{language:C??"EN"},login:async g=>{f(p.hostname),S();let E=new URL(h("AUTH")),V=`${p.searchParams.get(_o)==="true"?Uo:""}${Eo()}`,N=pt();E.searchParams.set("client_id",t),E.searchParams.set("scope","openid email"),E.searchParams.append("response_type","code"),E.searchParams.append("redirect_uri",T),E.searchParams.set("scope",h("LOGIN_SCOPE")),E.searchParams.append("state",V),E.searchParams.append("nonce",N);let Z=Xa({contextLanguage:C??null,localeOverride:g?.locale??null,uiLocalesOverride:g?.uiLocales??null});Z!=null&&E.searchParams.append("locale",Z),g?.countryCode&&E.searchParams.append("region_country",g.countryCode),g?.acrValues&&E.searchParams.append("acr_values",g.acrValues),g?.loginHint&&(E.searchParams.append("login_hint",g.loginHint),g?.loginHintMode&&E.searchParams.append("login_hint_mode",g.loginHintMode));let q=Ro(),$=await Io(q);return e.set(F,{...e.get(F),codeVerifier:q,state:V,nonce:N,redirectPath:lt(o.url)||z(o,"Referer")||y}),E.searchParams.append("code_challenge",$),E.searchParams.append("code_challenge_method","S256"),be(E.toString())},logout:async g=>{f(p.hostname),S();let E=e.get(F)?.idToken,L=ir({requestUrl:l,defaultUrl:l,redirectUrl:g?.postLogoutRedirectUri}),V=E?new URL(`${h("LOGOUT")}?${new URLSearchParams([["id_token_hint",E],["post_logout_redirect_uri",L]]).toString()}`).toString():L;Ee(e);let N=g?.headers instanceof Headers?g?.headers:new Headers(g?.headers);return g?.keepSession||(e.destroy?N.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(V,{headers:N})},isLoggedIn:U,handleAuthStatus:M,getAccessToken:j,getApiUrl:()=>A,mutate:de,query:mt,authorize:async()=>{f(p.hostname),S();let g=p.searchParams.get("code"),E=p.searchParams.get("state");if(!g||!E)throw new Q("Unauthorized","No code or state parameter found in the redirect URL.");let L=e.get(F);if(L?.state!==E){if(E.startsWith(Uo))throw new Q("Unable to complete sign in. Please try again.","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");J("[h2:warn:customerAccount] OAuth callback state mismatch. Restarting customer login once.");let Qe=new URL(u,o.url);return Qe.searchParams.set("return_to",L?.redirectPath??y),Qe.searchParams.set(_o,"true"),be(`${Qe.pathname}${Qe.search}`)}let V=t,N=new URLSearchParams;N.append("grant_type","authorization_code"),N.append("client_id",V),N.append("redirect_uri",T),N.append("code",g);let Z=e.get(F)?.codeVerifier;if(!Z)throw new Q("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");N.append("code_verifier",Z);let q={"content-type":"application/x-www-form-urlencoded","User-Agent":Ie,Origin:l};new Date().getTime();let W=h("TOKEN_EXCHANGE"),k=await fetch(W,{method:"POST",headers:q,body:N});if(!k.ok)throw new Response(await k.text(),{status:k.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:Ce,expires_in:G,id_token:Y,refresh_token:Ar}=await k.json(),Tr=e.get(F)?.nonce,Sr=await wo(Y);if(Tr!==Sr)throw new Q("Unauthorized",`Returned nonce does not match: ${Tr} !== ${Sr}`);let Pr=Ce;r||(Pr=await bo(Ce,t,h("TOKEN_EXCHANGE"),l,{...ie(o)}));let en=e.get(F)?.redirectPath;return e.set(F,{accessToken:Pr,expiresAt:new Date(new Date().getTime()+(G-120)*1e3).getTime()+"",refreshToken:Ar,idToken:Y}),be(en||y)},setBuyer:Be,getBuyer:K,UNSTABLE_setBuyer:g=>{J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),Be(g);},UNSTABLE_getBuyer:()=>(J("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),K())}}function za(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 Xa(e){return e.localeOverride!=null?cr(e.localeOverride):e.uiLocalesOverride!=null?cr(e.uiLocalesOverride):e.contextLanguage!=null?cr(e.contextLanguage):null}function cr(e){let r=e.toLowerCase().replaceAll("_","-").split("-"),n=r[0],o=r[1];return o?`${n}-${o.toUpperCase()}`:n}function es(e,t){let{env:r,request:n,cache:o,waitUntil:a,i18n:s,session:c,logErrors:i,storefront:u={},customerAccount:d,cart:y={},buyerIdentity:C}=e;c||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),d?.unstableB2b&&J("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:m}=fo({cache:o,waitUntil:a,i18n:s,logErrors:i,storefrontHeaders:u.headers||eo(n),storefrontApiVersion:u.apiVersion,storefrontId:r.PUBLIC_STOREFRONT_ID,storeDomain:r.PUBLIC_STORE_DOMAIN,privateStorefrontToken:r.PRIVATE_STOREFRONT_API_TOKEN,publicStorefrontToken:r.PUBLIC_STOREFRONT_API_TOKEN}),p=ur({session:c,request:n,waitUntil:a,logErrors:i,customerApiVersion:d?.apiVersion,authUrl:d?.authUrl,customAuthStatusHandler:d?.customAuthStatusHandler,useCustomAuthDomain:d?.useCustomAuthDomain,language:s?.language,customerAccountId:r.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,shopId:r.SHOP_ID}),l=er({getCartId:y.getId||Vt(n.headers),setCartId:y.setId||Nt(),cartQueryFragment:y.queryFragment,cartMutateFragment:y.mutateFragment,...y.customMethods&&{customMethods:y.customMethods},buyerIdentity:C,storefront:m,customerAccount:p}),T=new RouterContextProvider;T.set(He,m),T.set(tr,l),T.set(rr,p),T.set(or,r),T.set(nr,c),a&&T.set(ar,a);let f={storefront:m,cart:l,customerAccount:p,env:r,session:c,waitUntil:a,...t||{}};return new Proxy(T,{get(h,S,A){if(S in h){let P=h[S];return typeof P=="function"?P.bind(h):P}return S in f?f[S]:Reflect.get(h,S,A)},has(h,S){return S in h||S in f},ownKeys(h){return [...Reflect.ownKeys(h),...Object.keys(f)]},getOwnPropertyDescriptor(h,S){if(S in h)return Reflect.getOwnPropertyDescriptor(h,S);if(S in f)return {enumerable:true,configurable:true,writable:false,value:f[S]}}})}function ts(e){return Object.entries(e).map(([t,r])=>r?`${t};desc=${r}`:void 0).filter(Boolean).join(", ")}function Lo(e,t){let r=typeof t=="string"?t:ts(t);r&&e.headers.append("Server-Timing",r);}function os({build:e,mode:t,poweredByHeader:r=true,getLoadContext:n,collectTrackingInformation:o=true}){let a=createRequestHandler(e,t),s=r?c=>c.headers.append("powered-by","Shopify, Hydrogen"):void 0;return async c=>{let i=c.method;if((i==="GET"||i==="HEAD")&&c.body)return new Response(`${i} requests cannot have a body`,{status:400});let u=new URL(c.url);if(u.pathname.includes("//"))return new Response(null,{status:301,headers:{location:u.pathname.replace(/\/+/g,"/")}});let d=await n?.(c),y=d?.storefront||d?.get?.(He);if(!y)throw new Error("[h2:createRequestHandler] Storefront instance is required in the load context. Make sure to use createHydrogenContext() or provide a storefront instance via getLoadContext.");if(y.isStorefrontApiUrl(c)){let p=await y.forward(c);return s?.(p),p}if(y.isMcpUrl(c)){let p=await y.forwardMcp(c);return s?.(p),p}let C=await a(c,d);o&&y.setCollectedSubrequestHeaders(C);let m=c.headers.get("sec-fetch-dest");return (m&&m==="document"||c.headers.get("accept")?.includes("text/html"))&&Lo(C,{[Xr]:"1"}),s?.(C),C}}var ko=createContext(void 0),Vo=ko.Provider,dr=()=>useContext(ko);function cs(e){let t=pt(),r=us(t,e);return {nonce:t,header:r,NonceProvider:({children:o})=>createElement(Vo,{value:t},o)}}function us(e,t){let{shop:r,...n}=t??{},o=`'nonce-${e}'`,a=["'self'","'unsafe-inline'","https://cdn.shopify.com"],s=["'self'","https://cdn.shopify.com/","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 d in i){let y=n[d];d&&y&&(u[d]=ds(y,i[d]));}return u.scriptSrc instanceof Array?u.scriptSrc=[...u.scriptSrc.filter(d=>!d.startsWith("'nonce")),o]:u.defaultSrc instanceof Array&&(u.defaultSrc=[...u.defaultSrc.filter(d=>!d.startsWith("'nonce")),o]),is({directives:u})}function ds(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 ys=forwardRef((e,t)=>{let{waitForHydration:r,src:n,...o}=e,a=dr();return r?jsx(fs,{src:n,options:o}):jsx("script",{suppressHydrationWarning:true,...o,src:n,nonce:a,ref:t})});function fs({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 ms(e){return e;}function gs(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 hs({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 Rs({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:d,nextPageUrl:y,nodes:C,previousPageUrl:m,startCursor:p}=Is(e,r),l=useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:i,hasPreviousPage:d,hasNextPage:u,startCursor:p},nodes:C}}}),[i,u,d,p,C,r,s.state]),T=useMemo(()=>forwardRef(function(h,S){return u?createElement(Link,{preventScrollReset:true,...h,to:y,state:l,replace:true,ref:S,onClick:()=>o(true)}):null}),[u,y,l]),f=useMemo(()=>forwardRef(function(h,S){return d?createElement(Link,{preventScrollReset:true,...h,to:m,state:l,replace:true,ref:S,onClick:()=>o(true)}):null}),[d,m,l]);return t({state:l,hasNextPage:u,hasPreviousPage:d,isLoading:n,nextPageUrl:y,nodes:C,previousPageUrl:m,NextLink:T,PreviousLink:f})}function yt(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 $e(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 Is(e,t=""){e.pageInfo||$e("pageInfo"),typeof e.pageInfo.startCursor>"u"&&$e("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&$e("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&$e("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&$e("pageInfo.hasPreviousPage");let r=useNavigation(),n=useNavigate(),{state:o,search:a,pathname:s}=useLocation(),c=t?`${t}_cursor`:"cursor",i=t?`${t}_direction`:"direction",y=new URLSearchParams(a).get(i)==="previous",C=useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!o?.pagination?.[t]?.nodes?flattenConnection(e):y?[...flattenConnection(e),...o.pagination[t].nodes||[]]:[...o.pagination[t].nodes||[],...flattenConnection(e)],[o,e,t]),m=useMemo(()=>{let f=globalThis?.window?.__hydrogenHydrated,I=o?.pagination?.[t]?.pageInfo,h=!f||I?.startCursor===void 0?e.pageInfo.startCursor:I.startCursor,S=!f||I?.endCursor===void 0?e.pageInfo.endCursor:I.endCursor,A=!f||I?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:I.hasPreviousPage,P=!f||I?.hasNextPage===void 0?e.pageInfo.hasNextPage:I.hasNextPage;return o?.pagination?.[t]?.nodes&&(y?(h=e.pageInfo.startCursor,A=e.pageInfo.hasPreviousPage):(S=e.pageInfo.endCursor,P=e.pageInfo.hasNextPage)),{startCursor:h,endCursor:S,hasPreviousPage:A,hasNextPage:P}},[y,o,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),p=useRef({params:yt(a,o),pathname:s});useEffect(()=>{window.__hydrogenHydrated=true;},[]),useEffect(()=>{let f=yt(a,o),I=p.current.params;(s!==p.current.pathname||f!==I)&&!(r.state==="idle"&&!r.location)&&(p.current={pathname:s,params:yt(a,o)},n(`${s}?${yt(a,o)}`,{replace:true,preventScrollReset:true,state:{nodes:void 0,pageInfo:void 0}}));},[s,a,o]);let l=useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"previous"),m.startCursor&&f.set(c,m.startCursor),`?${f.toString()}`},[a,m.startCursor]),T=useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"next"),m.endCursor&&f.set(c,m.endCursor),`?${f.toString()}`},[a,m.endCursor]);return {...m,previousPageUrl:l,nextPageUrl:T,nodes:C}}function vs(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 Ds(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 ks({handle:e,options:t=[],variants:r=[],productPath:n="products",waitForNavigation:o=false,selectedVariant:a,children:s}){let c=t;c[0]?.values&&(J("[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:y}=Ns(e,n,o),C=c.filter(p=>p?.optionValues?.length===1),m=a?a?.selectedOptions?.reduce((p,l)=>(p[l.name]=l.value,p),{}):{};return createElement(Fragment$1,null,...useMemo(()=>c.map(p=>{let l,T=[];for(let f of p.optionValues){let I=new URLSearchParams(y?u:void 0);I.set(p.name,f.name),C.forEach(R=>{R.optionValues[0].name&&I.set(R.name,R.optionValues[0].name);});let h=i.find(R=>R?.selectedOptions?.every(U=>(I.get(U?.name)||m?.[U?.name])===U?.value)),S=u.get(p.name);!S&&a&&(S=m?.[p.name]||null);let A=S?S===f.name:false;A&&(l=f.name);let P="?"+I.toString();T.push({value:f.name,optionValue:f,isAvailable:h?h.availableForSale:true,to:d+P,search:P,isActive:A,variant:h});}return s({option:{name:p.name,value:l,values:T}})}),[c,i,s]))}var Vs=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 Ns(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])}function Ms(){return {name:"hydrogen-2025.7.0",reactRouterConfig:()=>({appDirectory:"app",buildDirectory:"dist",ssr:true,future:{v8_middleware:true,v8_splitRouteModules:true,v8_viteEnvironmentApi:false,unstable_optimizeDeps:true},subResourceIntegrity:false}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
543
543
  Reason: Requires major CLI infrastructure modernization.
544
544
  Workaround: Use reverse proxy or CDN path rewriting for subdirectory hosting.`);if(e.prerender)throw new Error(`[Hydrogen Preset] prerender is not supported in Hydrogen 2025.7.0.
545
545
  Reason: React Router plugin incompatibility with Hydrogen CLI build pipeline.
@@ -549,12 +549,12 @@ Alternative: Route-level code splitting via v8_splitRouteModules is enabled.`);i
549
549
  Reason: Hydrogen CLI bypasses React Router buildEnd hook execution.
550
550
  Workaround: Use external build scripts or package.json post-build hooks.`);if(e.subResourceIntegrity===true)throw new Error(`[Hydrogen Preset] subResourceIntegrity cannot be enabled.
551
551
  Reason: Conflicts with Hydrogen CSP nonce-based authentication.
552
- Impact: Would break Content Security Policy and cause script execution failures.`)}}}var qs=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 $s=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 i="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",c=String.raw;return new Response(c`
552
+ Impact: Would break Content Security Policy and cause script execution failures.`)}}}var qs=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 $s=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(),d=await o.getAccessToken();u&&(s["customer-account"]={name:"Customer Account API",value:u,authHeader:"Authorization",accessToken:d,apiUrl:o.getApiUrl(),icon:"CA"});}let c="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",i=String.raw;return new Response(i`
553
553
  <!DOCTYPE html>
554
554
  <html lang="en">
555
555
  <head>
556
556
  <title>GraphiQL</title>
557
- <link rel="icon" type="image/x-icon" href="${i}" />
557
+ <link rel="icon" type="image/x-icon" href="${c}" />
558
558
  <meta charset="utf-8" />
559
559
  <style>
560
560
  body {
@@ -868,7 +868,7 @@ Impact: Would break Content Security Policy and cause script execution failures.
868
868
  </div>
869
869
  </body>
870
870
  </html>
871
- `,{status:200,headers:{"content-type":"text/html"}})};var zo=".data",gr="_root.data",Xo="_.data";async function Gs(e){let{storefront:t,request:r,noAdminRedirect:o,matchQueryParams:n,response:a=new Response("Not Found",{status:404})}=e,s=new URL(r.url),{searchParams:i}=s,{pathname:c,isSoftNavigation:u}=Bs(s.pathname);i.delete("redirect"),i.delete("return_to"),i.delete("_routes");let d=(n?`${c}${s.search}`:c).toLowerCase();if(c==="/admin"&&!o)return Ar(`${t.getShopifyDomain()}/admin`,u,i,n);try{let{urlRedirects:y}=await t.query(Qs,{variables:{query:"path:"+d.replace(/\/+$/,"")}}),m=y?.edges?.[0]?.node?.target;if(m)return Ar(m,u,i,n);let C=mt(r.url);if(C)return Ar(C,u,i,n)}catch(y){console.error(`Failed to fetch redirects from Storefront API for route ${d}`,y);}return a}var hr="https://example.com";function Ar(e,t,r,o){let n=new URL(e,hr);if(!o)for(let[a,s]of r)n.searchParams.append(a,s);return t?new Response(null,{status:204,headers:{"X-Remix-Redirect":n.toString().replace(hr,""),"X-Remix-Status":"301"}}):new Response(null,{status:301,headers:{location:n.toString().replace(hr,"")}})}function Bs(e){return e.endsWith(zo)?e.endsWith("/"+Xo)?{pathname:e.slice(0,-Xo.length),isSoftNavigation:true}:e==="/"+gr||e.endsWith("/"+gr)?{pathname:e.slice(0,-gr.length)||"/",isSoftNavigation:true}:{pathname:e.slice(0,-zo.length),isSoftNavigation:true}:{pathname:e,isSoftNavigation:false}}var Qs=`#graphql
871
+ `,{status:200,headers:{"content-type":"text/html"}})};var jo=".data",yr="_root.data",Ko="_.data";async function Gs(e){let{storefront:t,request:r,noAdminRedirect:n,matchQueryParams:o,response:a=new Response("Not Found",{status:404})}=e,s=new URL(r.url),{searchParams:c}=s,{pathname:i,isSoftNavigation:u}=Bs(s.pathname);c.delete("redirect"),c.delete("return_to"),c.delete("_routes");let d=(o?`${i}${s.search}`:i).toLowerCase();if(i==="/admin"&&!n)return mr(`${t.getShopifyDomain()}/admin`,u,c,o);try{let{urlRedirects:y}=await t.query(Qs,{variables:{query:"path:"+d.replace(/\/+$/,"")}}),C=y?.edges?.[0]?.node?.target;if(C)return mr(C,u,c,o);let m=lt(r.url);if(m)return mr(m,u,c,o)}catch(y){console.error(`Failed to fetch redirects from Storefront API for route ${d}`,y);}return a}var fr="https://example.com";function mr(e,t,r,n){let o=new URL(e,fr);if(!n)for(let[a,s]of r)o.searchParams.append(a,s);return t?new Response(null,{status:204,headers:{"X-Remix-Redirect":o.toString().replace(fr,""),"X-Remix-Status":"301"}}):new Response(null,{status:301,headers:{location:o.toString().replace(fr,"")}})}function Bs(e){return e.endsWith(jo)?e.endsWith("/"+Ko)?{pathname:e.slice(0,-Ko.length),isSoftNavigation:true}:e==="/"+yr||e.endsWith("/"+yr)?{pathname:e.slice(0,-yr.length)||"/",isSoftNavigation:true}:{pathname:e.slice(0,-jo.length),isSoftNavigation:true}:{pathname:e,isSoftNavigation:false}}var Qs=`#graphql
872
872
  query redirects($query: String) {
873
873
  urlRedirects(first: 1, query: $query) {
874
874
  edges {
@@ -878,21 +878,21 @@ Impact: Would break Content Security Policy and cause script execution failures.
878
878
  }
879
879
  }
880
880
  }
881
- `;var Ws={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},js=/[&><\u2028\u2029]/g;function Zo(e){return e.replace(js,t=>Ws[t])}var ue="Error in SEO input: ",oe={title:{validate:e=>{if(typeof e!="string")throw new Error(ue.concat("`title` should be a string"));if(typeof e=="string"&&e.length>70)throw new Error(ue.concat("`title` should not be longer than 70 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(ue.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(ue.concat("`description` should not be longer than 160 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(ue.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(ue.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(ue.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(ue.concat("`handle` should start with `@`"));return e}}};function en(e){let t=[];for(let r of Object.keys(e))switch(r){case "title":{let o=ne(oe.title,e.title),n=Sr(e?.titleTemplate,o);if(!n)break;t.push(H("title",{title:n}),H("meta",{property:"og:title",content:n}),H("meta",{name:"twitter:title",content:n}));break}case "description":{let o=ne(oe.description,e.description);if(!o)break;t.push(H("meta",{name:"description",content:o}),H("meta",{property:"og:description",content:o}),H("meta",{name:"twitter:description",content:o}));break}case "url":{let o=ne(oe.url,e.url);if(!o)break;let a=o.split("?")[0].replace(/\/$/,"");t.push(H("link",{rel:"canonical",href:a}),H("meta",{property:"og:url",content:a}));break}case "handle":{let o=ne(oe.handle,e.handle);if(!o)break;t.push(H("meta",{name:"twitter:site",content:o}),H("meta",{name:"twitter:creator",content:o}));break}case "media":{let o,n=de(e.media);for(let a of n)if(typeof a=="string"&&t.push(H("meta",{name:"og:image",content:a})),a&&typeof a=="object"){let s=a.type||"image",i=a?{url:a?.url,secure_url:a?.url,type:Pr(a.url),width:a?.width,height:a?.height,alt:a?.altText}:{};for(let c of Object.keys(i))i[c]&&(o=i[c],t.push(H("meta",{property:`og:${s}:${c}`,content:o},i.url)));}break}case "jsonLd":{let o=de(e.jsonLd),n=0;for(let a of o){if(typeof a!="object")continue;let s=H("script",{type:"application/ld+json",children:JSON.stringify(a,(i,c)=>typeof c=="string"?Zo(c):c)},`json-ld-${a?.["@type"]||a?.name||n++}`);t.push(s);}break}case "alternates":{let o=de(e.alternates);for(let n of o){if(!n)continue;let{language:a,url:s,default:i}=n,c=a?`${a}${i?"-default":""}`:void 0;t.push(H("link",{rel:"alternate",hrefLang:c,href:s}));}break}case "robots":{if(!e.robots)break;let{maxImagePreview:o,maxSnippet:n,maxVideoPreview:a,noArchive:s,noFollow:i,noImageIndex:c,noIndex:u,noSnippet:d,noTranslate:y,unavailableAfter:m}=e.robots,C=[s&&"noarchive",c&&"noimageindex",d&&"nosnippet",y&&"notranslate",o&&`max-image-preview:${o}`,n&&`max-snippet:${n}`,a&&`max-video-preview:${a}`,m&&`unavailable_after:${m}`],p=(u?"noindex":"index")+","+(i?"nofollow":"follow");for(let l of C)l&&(p+=`,${l}`);t.push(H("meta",{name:"robots",content:p}));break}}return t.flat().sort((r,o)=>r.key.localeCompare(o.key))}function H(e,t,r){let o={tag:e,props:{},key:""};return e==="title"?(o.children=t.title,o.key=Tr(o),o):e==="script"?(o.children=typeof t.children=="string"?t.children:"",o.key=Tr(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=Tr(o,r),o)}function Tr(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 Sr(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function Pr(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";default:return "image/jpeg"}}function de(e){return Array.isArray(e)?e:[e]}function ne(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}function Ks(...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:de(o.jsonLd).concat(a)}:{...o,...n,jsonLd:[a]}:{...o,...n}},{})||{};for(let o of Object.keys(r))switch(o){case "title":{let n=ne(oe.title,r.title),a=Sr(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=ne(oe.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=ne(oe.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=ne(oe.handle,r.handle);if(!n)break;t.push({property:"twitter:site",content:n},{property:"twitter:creator",content:n});break}case "media":{let n,a=de(r.media);for(let s of a)if(typeof s=="string"&&t.push({property:"og:image",content:s}),s&&typeof s=="object"){let i=s.type||"image",c=s?{url:s?.url,secure_url:s?.url,type:Pr(s.url),width:s?.width,height:s?.height,alt:s?.altText}:{};for(let u of Object.keys(c))c[u]&&(n=c[u],t.push({property:`og:${i}:${u}`,content:n}));}break}case "jsonLd":{let n=de(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=de(r.alternates);for(let a of n){if(!a)continue;let{language:s,url:i,default:c}=a,u=s?`${s}${c?"-default":""}`:void 0;t.push({tagName:"link",rel:"alternate",hrefLang:u,href:i});}break}case "robots":{if(!r.robots)break;let{maxImagePreview:n,maxSnippet:a,maxVideoPreview:s,noArchive:i,noFollow:c,noImageIndex:u,noIndex:d,noSnippet:y,noTranslate:m,unavailableAfter:C}=r.robots,p=[i&&"noarchive",u&&"noimageindex",y&&"nosnippet",m&&"notranslate",n&&`max-image-preview:${n}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,C&&`unavailable_after:${C}`],l=(d?"noindex":"index")+","+(c?"nofollow":"follow");for(let S of p)S&&(l+=`,${S}`);t.push({name:"robots",content:l});break}}return t}var ei=lazy(()=>import('./log-seo-tags-TY72EQWZ.js'));function ti({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/utilities/getseometa");let o=useMemo(()=>t.flatMap(s=>{let{handle:i,...c}=s,u={...c,...r},d=i?.seo,y=c?.data?.seo;return !d&&!y?[]:d?gt(d,u):[y]}).reduce((s,i)=>{Object.keys(i).forEach(u=>!i[u]&&delete i[u]);let{jsonLd:c}=i;return c?s?.jsonLd?Array.isArray(c)?{...s,...i,jsonLd:[...s.jsonLd,...c]}:{...s,...i,jsonLd:[...s.jsonLd,c]}:{...s,...i,jsonLd:[c]}:{...s,...i}},{}),[t,r]),{html:n,loggerMarkup:a}=useMemo(()=>{let s=en(o),i=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)),c=createElement(Suspense,{fallback:null},createElement(ei,{headTags:s}));return {html:i,loggerMarkup:c}},[o]);return createElement(Fragment$1,null,n,e&&a)}function gt(e,...t){if(e instanceof Function)return gt(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((o,n)=>[...o,gt(n)],[]),r):e instanceof Object?(Object.entries(e).forEach(([n,a])=>{r[n]=gt(a,...t);}),r):e}function oi(e){return jsx(ShopPayButton,{channel:"hydrogen",...e})}var ai=`<?xml version="1.0" encoding="UTF-8"?>
881
+ `;var Ws={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},js=/[&><\u2028\u2029]/g;function Yo(e){return e.replace(js,t=>Ws[t])}var ce="Error in SEO input: ",oe={title:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`title` should be a string"));if(typeof e=="string"&&e.length>70)throw new Error(ce.concat("`title` should not be longer than 70 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(ce.concat("`description` should not be longer than 160 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(ce.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(ce.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(ce.concat("`handle` should start with `@`"));return e}}};function Jo(e){let t=[];for(let r of Object.keys(e))switch(r){case "title":{let n=ne(oe.title,e.title),o=gr(e?.titleTemplate,n);if(!o)break;t.push(H("title",{title:o}),H("meta",{property:"og:title",content:o}),H("meta",{name:"twitter:title",content:o}));break}case "description":{let n=ne(oe.description,e.description);if(!n)break;t.push(H("meta",{name:"description",content:n}),H("meta",{property:"og:description",content:n}),H("meta",{name:"twitter:description",content:n}));break}case "url":{let n=ne(oe.url,e.url);if(!n)break;let a=n.split("?")[0].replace(/\/$/,"");t.push(H("link",{rel:"canonical",href:a}),H("meta",{property:"og:url",content:a}));break}case "handle":{let n=ne(oe.handle,e.handle);if(!n)break;t.push(H("meta",{name:"twitter:site",content:n}),H("meta",{name:"twitter:creator",content:n}));break}case "media":{let n,o=ue(e.media);for(let a of o)if(typeof a=="string"&&t.push(H("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:hr(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(H("meta",{property:`og:${s}:${i}`,content:n},c.url)));}break}case "jsonLd":{let n=ue(e.jsonLd),o=0;for(let a of n){if(typeof a!="object")continue;let s=H("script",{type:"application/ld+json",children:JSON.stringify(a,(c,i)=>typeof i=="string"?Yo(i):i)},`json-ld-${a?.["@type"]||a?.name||o++}`);t.push(s);}break}case "alternates":{let n=ue(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(H("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:d,noTranslate:y,unavailableAfter:C}=e.robots,m=[s&&"noarchive",i&&"noimageindex",d&&"nosnippet",y&&"notranslate",n&&`max-image-preview:${n}`,o&&`max-snippet:${o}`,a&&`max-video-preview:${a}`,C&&`unavailable_after:${C}`],p=(u?"noindex":"index")+","+(c?"nofollow":"follow");for(let l of m)l&&(p+=`,${l}`);t.push(H("meta",{name:"robots",content:p}));break}}return t.flat().sort((r,n)=>r.key.localeCompare(n.key))}function H(e,t,r){let n={tag:e,props:{},key:""};return e==="title"?(n.children=t.title,n.key=Cr(n),n):e==="script"?(n.children=typeof t.children=="string"?t.children:"",n.key=Cr(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=Cr(n,r),n)}function Cr(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 gr(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function hr(e){switch(e&&e.split(/[?#]/)[0].split(".").pop()?.toLowerCase()){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";default:return "image/jpeg"}}function ue(e){return Array.isArray(e)?e:[e]}function ne(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}function Ks(...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:ue(n.jsonLd).concat(a)}:{...n,...o,jsonLd:[a]}:{...n,...o}},{})||{};for(let n of Object.keys(r))switch(n){case "title":{let o=ne(oe.title,r.title),a=gr(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=ne(oe.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=ne(oe.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=ne(oe.handle,r.handle);if(!o)break;t.push({property:"twitter:site",content:o},{property:"twitter:creator",content:o});break}case "media":{let o,a=ue(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:hr(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=ue(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=ue(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:d,noSnippet:y,noTranslate:C,unavailableAfter:m}=r.robots,p=[c&&"noarchive",u&&"noimageindex",y&&"nosnippet",C&&"notranslate",o&&`max-image-preview:${o}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,m&&`unavailable_after:${m}`],l=(d?"noindex":"index")+","+(i?"nofollow":"follow");for(let T of p)T&&(l+=`,${T}`);t.push({name:"robots",content:l});break}}return t}var ei=lazy(()=>import('./log-seo-tags-TY72EQWZ.js'));function ti({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/utilities/getseometa");let n=useMemo(()=>t.flatMap(s=>{let{handle:c,...i}=s,u={...i,...r},d=c?.seo,y=i?.data?.seo;return !d&&!y?[]:d?ft(d,u):[y]}).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=Jo(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(ei,{headTags:s}));return {html:c,loggerMarkup:i}},[n]);return createElement(Fragment$1,null,o,e&&a)}function ft(e,...t){if(e instanceof Function)return ft(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((n,o)=>[...n,ft(o)],[]),r):e instanceof Object?(Object.entries(e).forEach(([o,a])=>{r[o]=ft(a,...t);}),r):e}function oi(e){return jsx(ShopPayButton,{channel:"hydrogen",...e})}var ai=`<?xml version="1.0" encoding="UTF-8"?>
882
882
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
883
883
  `,si=`
884
- </sitemapindex>`,rn=`<?xml version="1.0" encoding="UTF-8"?>
885
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">`,on="</urlset>";async function ii(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(hi);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,i=ai+o.map(c=>{if(!a[c])throw new Error(`[h2:sitemap:error] No data found for type ${c}. Check types passed to \`getSitemapIndex\``);return ui(c,a[c].pagesCount.count,s)}).join(`
886
- `)+n.map(c=>" <sitemap><loc>"+(s+(c.startsWith("/")?c:"/"+c))+"</loc></sitemap>").join(`
887
- `)+si;return new Response(i,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}async function ci(e){let{storefront:t,request:r,params:o,getLink:n,locales:a=[],getChangeFreq:s,noItemsFallback:i="/"}=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 c=o.type,u=Ai[c];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 y=new URL(r.url).origin,m="";return d?.sitemap?.resources?.items?.length?m=rn+d.sitemap.resources.items.map(C=>di({getChangeFreq:s,url:n({type:C.type??c,baseUrl:y,handle:C.handle}),type:c,getLink:n,updatedAt:C.updatedAt,handle:C.handle,metaobjectType:C.type,locales:a,baseUrl:y})).join(`
888
- `)+on:m=rn+`
889
- <url><loc>${y+i}</loc></url>
890
- `+on,new Response(m,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}function ui(e,t,r){let o="";for(let n=1;n<=t;n++)o+=` <sitemap><loc>${r}/sitemap/${e}/${n}.xml</loc></sitemap>
891
- `;return o}function di({url:e,updatedAt:t,locales:r,type:o,getLink:n,baseUrl:a,handle:s,getChangeFreq:i,metaobjectType:c}){return `<url>
884
+ </sitemapindex>`,Xo=`<?xml version="1.0" encoding="UTF-8"?>
885
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">`,Zo="</urlset>";async function ii(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(hi);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=ai+n.map(i=>{if(!a[i])throw new Error(`[h2:sitemap:error] No data found for type ${i}. Check types passed to \`getSitemapIndex\``);return ui(i,a[i].pagesCount.count,s)}).join(`
886
+ `)+o.map(i=>" <sitemap><loc>"+(s+(i.startsWith("/")?i:"/"+i))+"</loc></sitemap>").join(`
887
+ `)+si;return new Response(c,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}async function ci(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=Ai[i];if(!u)throw new Response("Not found",{status:404});let d=await t.query(u,{variables:{page:parseInt(n.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 y=new URL(r.url).origin,C="";return d?.sitemap?.resources?.items?.length?C=Xo+d.sitemap.resources.items.map(m=>di({getChangeFreq:s,url:o({type:m.type??i,baseUrl:y,handle:m.handle}),type:i,getLink:o,updatedAt:m.updatedAt,handle:m.handle,metaobjectType:m.type,locales:a,baseUrl:y})).join(`
888
+ `)+Zo:C=Xo+`
889
+ <url><loc>${y+c}</loc></url>
890
+ `+Zo,new Response(C,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}function ui(e,t,r){let n="";for(let o=1;o<=t;o++)n+=` <sitemap><loc>${r}/sitemap/${e}/${o}.xml</loc></sitemap>
891
+ `;return n}function di({url:e,updatedAt:t,locales:r,type:n,getLink:o,baseUrl:a,handle:s,getChangeFreq:c,metaobjectType:i}){return `<url>
892
892
  <loc>${e}</loc>
893
893
  <lastmod>${t}</lastmod>
894
- <changefreq>${i?i({type:c??o,handle:s}):"weekly"}</changefreq>
895
- ${r.map(u=>pi(n({type:c??o,baseUrl:a,handle:s,locale:u}),u)).join(`
894
+ <changefreq>${c?c({type:i??n,handle:s}):"weekly"}</changefreq>
895
+ ${r.map(u=>pi(o({type:i??n,baseUrl:a,handle:s,locale:u}),u)).join(`
896
896
  `)}
897
897
  </url>
898
898
  `.trim()}function pi(e,t){return ` <xhtml:link rel="alternate" hreflang="${t}" href="${e}" />`}var li=`#graphql
@@ -1015,5 +1015,5 @@ query SitemapIndex {
1015
1015
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesRemove
1016
1016
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesUpdate
1017
1017
  //! @see: https://shopify.dev/docs/api/storefront/2026-04/mutations/cartDeliveryAddressesReplace
1018
- export{Kn as Analytics,B as AnalyticsEvent,Vt as CacheCustom,kt as CacheLong,Ut as CacheNone,le as CacheShort,re as CartForm,Ft as InMemoryCache,Ho as NonceProvider,hs as OptimisticInput,Rs as Pagination,qs as RichText,ys as Script,ti as Seo,oi as ShopPayButton,ks as VariantSelector,Xt as cartAttributesUpdateDefault,Yt as cartBuyerIdentityUpdateDefault,Bt as cartCreateDefault,Kt as cartDiscountCodesUpdateDefault,Gt as cartGetDefault,Ht as cartGetIdDefault,rr as cartGiftCardCodesAddDefault,or as cartGiftCardCodesRemoveDefault,tr as cartGiftCardCodesUpdateDefault,Qt as cartLinesAddDefault,jt as cartLinesRemoveDefault,Wt as cartLinesUpdateDefault,er as cartMetafieldDeleteDefault,Zt as cartMetafieldsSetDefault,Jt as cartNoteUpdateDefault,zt as cartSelectedDeliveryOptionsUpdateDefault,qt as cartSetIdDefault,$a as changelogHandler,nr as createCartHandler,cs as createContentSecurityPolicy,yr as createCustomerAccountClient,ts as createHydrogenContext,os as createRequestHandler,Ao as createStorefrontClient,sa as createWithCache,I as formatAPIResult,Ne as generateCacheControlHeader,Is as getPaginationVariables,Vs as getSelectedProductOptions,Ks as getSeoMeta,Wn as getShopAnalytics,ci as getSitemap,ii as getSitemapIndex,$s as graphiqlLoader,Ga as hydrogenContext,Ms as hydrogenPreset,ms as hydrogenRoutes,Gs as storefrontRedirect,ee as useAnalytics,It as useCustomerPrivacy,fr as useNonce,Ha as useOptimisticCart,gs as useOptimisticData,Ds as useOptimisticVariant};//# sourceMappingURL=index.js.map
1018
+ export{jn as Analytics,B as AnalyticsEvent,_t as CacheCustom,Ot as CacheLong,Dt as CacheNone,ye as CacheShort,re as CartForm,kt as InMemoryCache,Vo as NonceProvider,hs as OptimisticInput,Rs as Pagination,qs as RichText,ys as Script,ti as Seo,oi as ShopPayButton,ks as VariantSelector,Kt as cartAttributesUpdateDefault,Qt as cartBuyerIdentityUpdateDefault,Ht as cartCreateDefault,Bt as cartDiscountCodesUpdateDefault,Ft as cartGetDefault,Vt as cartGetIdDefault,Xt as cartGiftCardCodesAddDefault,Zt as cartGiftCardCodesRemoveDefault,zt as cartGiftCardCodesUpdateDefault,qt as cartLinesAddDefault,Gt as cartLinesRemoveDefault,$t as cartLinesUpdateDefault,Jt as cartMetafieldDeleteDefault,Yt as cartMetafieldsSetDefault,Wt as cartNoteUpdateDefault,jt as cartSelectedDeliveryOptionsUpdateDefault,Nt as cartSetIdDefault,qa as changelogHandler,er as createCartHandler,cs as createContentSecurityPolicy,ur as createCustomerAccountClient,es as createHydrogenContext,os as createRequestHandler,fo as createStorefrontClient,aa as createWithCache,v as formatAPIResult,Ve as generateCacheControlHeader,vs as getPaginationVariables,Vs as getSelectedProductOptions,Ks as getSeoMeta,Qn as getShopAnalytics,ci as getSitemap,ii as getSitemapIndex,$s as graphiqlLoader,$a as hydrogenContext,Ms as hydrogenPreset,ms as hydrogenRoutes,Gs as storefrontRedirect,ee as useAnalytics,gt as useCustomerPrivacy,dr as useNonce,Fa as useOptimisticCart,gs as useOptimisticData,Ds as useOptimisticVariant};//# sourceMappingURL=index.js.map
1019
1019
  //# sourceMappingURL=index.js.map