@shopify/hydrogen 2026.1.4 → 2026.4.1
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.
- package/dist/customer-account-api-types.d.ts +23 -1
- package/dist/customer-account.schema.json +1 -1
- package/dist/development/index.cjs +261 -209
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +261 -209
- package/dist/development/index.js.map +1 -1
- package/dist/oxygen/index.d.ts +63 -10
- package/dist/oxygen/index.js +21 -35
- package/dist/production/index.cjs +118 -150
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.cts +173 -115
- package/dist/production/index.d.ts +173 -115
- package/dist/production/index.js +118 -150
- package/dist/production/index.js.map +1 -1
- package/dist/storefront-api-types.d.ts +1467 -443
- package/dist/storefront.schema.json +1 -1
- package/dist/vite/{chunk-ZSWP2RO7.js → chunk-4O5OI3OO.js} +0 -4
- package/dist/vite/{chunk-XTDF5RJS.js → chunk-QXBQVDMY.js} +1 -2
- package/dist/vite/hydrogen-middleware.js +2 -2
- package/dist/vite/plugin.js +2 -3
- package/dist/vite/request-events.d.ts +61 -2
- package/dist/vite/request-events.js +1 -1
- package/package.json +5 -5
package/dist/production/index.js
CHANGED
|
@@ -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 Ja from'content-security-policy-builder';function le(e){let{type:t,data:r={},customData:o}=e,n=useLocation(),{publish:a,cart:s,prevCart:c,shop:i,customData:u}=z(),p=n.pathname+n.search,y={...r,customData:{...u,...o},cart:s,prevCart:c,shop:i};return useEffect(()=>{i?.shopId&&(y={...y,url:window.location.href},a(t,y));},[a,p,i?.shopId]),null}function Pr(e){return jsx(le,{...e,type:"page_viewed"})}function Sr(e){return jsx(le,{...e,type:"product_viewed"})}function vr(e){return jsx(le,{...e,type:"collection_viewed"})}function Rr(e){return jsx(le,{...e,type:"cart_viewed"})}function Ir(e){return jsx(le,{...e,type:"search_viewed"})}function Tr(e){return jsx(le,{...e})}var F={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",CART_UPDATED:"cart_updated",PRODUCT_ADD_TO_CART:"product_added_to_cart",PRODUCT_REMOVED_FROM_CART:"product_removed_from_cart",CUSTOM_EVENT:"custom_"};var Re="Custom-Storefront-Request-Group-ID",Ie="X-Shopify-Storefront-Access-Token",Ct="X-SDK-Variant",ht="X-SDK-Variant-Source",At="X-SDK-Version",Ge="X-Shopify-Client-IP",fe="X-Shopify-Client-IP-Sig",Be="_sfapi_proxy",Qe="_server_tracking";function Jo(e){return Object.entries(e).map(([t,r])=>r?`${t};desc=${r}`:void 0).filter(Boolean).join(", ")}function Te(e,t){let r=typeof t=="string"?t:Jo(t);r&&e.headers.append("Server-Timing",r);}var zo=["_y","_s","_cmp"];function Er(e){let t={};if(!e)return t;let r=new RegExp(`\\b(${zo.join("|")});desc="?([^",]+)"?`,"g"),o;for(;(o=r.exec(e))!==null;)t[o[1]]=o[2];return t}function br(e){if(typeof window>"u")return false;try{return !!window.performance.getEntriesByType("navigation")[0]?.serverTiming?.some(r=>r.name===e)}catch{return false}}function wr(){return br(Be)}function Dr(){return br(Qe)}var on="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js",nn="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function St(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function vt(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:o,checkoutDomain:n,storefrontAccessToken:a,country:s,locale:c,sameDomainForStorefrontApi:i}=e,u=useMemo(()=>i??wr(),[i]),p=useMemo(()=>u&&!Dr(),[u]),y=useShopifyCookies({fetchTrackingValues:p,storefrontAccessToken:a,ignoreDeprecatedCookies:true}),m=useMemo(getTrackingValues,[y]),{revalidate:g}=useRevalidator();useLoadScript$1(t?nn:on,{attributes:{id:"customer-privacy-api"}});let{observing:d,setLoaded:l,apisLoaded:S}=sn({withPrivacyBanner:t}),f=useMemo(()=>{n||St("checkoutDomain"),a||St("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=cn(n);return {checkoutRootDomain:u&&typeof window<"u"?window.location.host:n,storefrontRootDomain:h?"."+h:void 0,storefrontAccessToken:a,country:s,locale:c}},[St,n,a,s,c]);useEffect(()=>{let h=P=>{let C=getTrackingValues();if((m.visitToken!==C.visitToken||m.uniqueToken!==C.uniqueToken)&&g().catch(()=>{console.warn("[h2:warn:useCustomerPrivacy] Revalidation failed after consent change.");}),r){let R=oe();if(R?.shouldShowBanner()){let I=R.currentVisitorConsent();if(I&&I.marketing===""&&I.analytics===""&&I.preferences==="")return}r(P.detail);}};return document.addEventListener("visitorConsentCollected",h),()=>{document.removeEventListener("visitorConsentCollected",h);}},[r]),useEffect(()=>{if(!t||d.current.privacyBanner)return;d.current.privacyBanner=true;let h=window.privacyBanner||void 0;Object.defineProperty(window,"privacyBanner",{configurable:true,get(){return h},set(C){typeof C=="object"&&C!==null&&"showPreferences"in C&&"loadBanner"in C&&(h=_r({privacyBanner:C,config:f}),l.privacyBanner());}});},[t,f,_r,l.privacyBanner]),useEffect(()=>{if(d.current.customerPrivacy)return;d.current.customerPrivacy=true;let h=null,P=window.Shopify||void 0;Object.defineProperty(window,"Shopify",{configurable:true,get(){return P},set(C){typeof C=="object"&&C!==null&&Object.keys(C).length===0&&(P=C,Object.defineProperty(window.Shopify,"customerPrivacy",{configurable:true,get(){return h},set(R){if(typeof R=="object"&&R!==null&&"setTrackingConsent"in R){let I=R;h={...I,setTrackingConsent:xr({customerPrivacy:I,config:f})},P={...P,customerPrivacy:h},l.customerPrivacy();}}}));}});},[f,xr,l.customerPrivacy]),useEffect(()=>{if(!S||!y)return;let h=oe();if(h&&!h.cachedConsent){let P=getTrackingValues();P.consent&&(h.cachedConsent=P.consent);}if(t){let P=Ee();P&&P.loadBanner(f);}an(),o?.();},[S,y]);let v={customerPrivacy:oe()};return t&&(v.privacyBanner=Ee()),v}var Or=false;function an(){if(Or)return;Or=true;let e=new CustomEvent("shopifyCustomerPrivacyApiLoaded");document.dispatchEvent(e);}function sn({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 cn(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 xr({customerPrivacy:e,config:t}){let r=e.setTrackingConsent,{locale:o,country:n,...a}=t;function s(c,i){r({...a,headlessStorefront:true,...c},i);}return s}function _r({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 oe(){try{return window.Shopify&&window.Shopify.customerPrivacy?window.Shopify?.customerPrivacy:null}catch{return null}}function Ee(){try{return window&&window?.privacyBanner?window.privacyBanner:null}catch{return null}}var Lr="2026.1.4";function fn(){let e=oe();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 kr({consent:e,onReady:t,domain:r}){let{subscribe:o,register:n,canTrack:a}=z(),[s,c]=useState(false),[i,u]=useState(false),[p,y]=useState(""),m=useRef(false),{checkoutDomain:g,storefrontAccessToken:d,language:l}=e,{ready:S}=n("Internal_Shopify_Analytics");vt({...e,locale:l,checkoutDomain:g||"mock.shop",storefrontAccessToken:d||"abcdefghijklmnopqrstuvwxyz123456",onReady:()=>!e.withPrivacyBanner&&u(true),onVisitorConsentCollected:v=>{try{y(JSON.stringify(v));}catch{}u(true);}});let f=useMemo(()=>i?a():true,[i,a,p]);return useShopifyCookies({hasUserConsent:f,domain:r,checkoutDomain:g,fetchTrackingValues:false,ignoreDeprecatedCookies:!i}),useEffect(()=>{m.current||(m.current=true,o(F.PAGE_VIEWED,gn),o(F.PRODUCT_VIEWED,Cn),o(F.COLLECTION_VIEWED,hn),o(F.SEARCH_VIEWED,An),o(F.PRODUCT_ADD_TO_CART,Pn),c(true));},[o]),useEffect(()=>{s&&i&&(S(),t());},[s,i,t]),null}function Ke(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function De(e){let t=fn(),r=t.analyticsProcessingAllowed();if(!e?.shop?.shopId){Ke("shopId");return}if(!e?.shop?.acceptedLanguage){Ke("acceptedLanguage");return}if(!e?.shop?.currency){Ke("currency");return}if(!e?.shop?.hydrogenSubchannelId){Ke("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:Lr,...e.shop,hasUserConsent:r,...getClientBrowserParameters(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function mn(e,t){if(t===null)return;let r=De(e);return r?{...r,cartId:t.id}:void 0}var ne={};function gn(e){let t=De(e);t&&(sendShopifyAnalytics({eventName:AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...ne}}),ne={});}function Cn(e){let t=De(e);if(t&&Nr({type:"product",products:e.products})){let r=It(e.products);ne={pageType:AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...ne,products:It(e.products)},sendShopifyAnalytics({eventName:AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function hn(e){let t=De(e);t&&(ne={pageType:AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...ne,collectionHandle:e.collection.handle,collectionId:e.collection.id},sendShopifyAnalytics({eventName:AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function An(e){let t=De(e);t&&(ne={pageType:AnalyticsPageType.search},t={...t,...ne,searchString:e.searchTerm},sendShopifyAnalytics({eventName:AnalyticsEventName.SEARCH_VIEW,payload:t}));}function Pn(e){let{cart:t,currentLine:r}=e,o=mn(e,t);!o||!r?.id||Sn({matchedLine:r,eventPayload:o});}function Sn({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};Nr({type:"cart",products:[r]})&&sendShopifyAnalytics({eventName:AnalyticsEventName.ADD_TO_CART,payload:{...t,products:It([r])}});}function ce(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 Nr({type:e,products:t}){return !t||t.length===0?(ce(e,"",false,"data.products"),false):(t.forEach(r=>{if(!r.id)return ce(e,"id",false),false;if(!r.title)return ce(e,"title",false),false;if(!r.price)return ce(e,"price.amount",true,"price"),false;if(!r.vendor)return ce(e,"vendor",false),false;if(!r.variantId)return ce(e,"id",true,"variantId"),false;if(!r.variantTitle)return ce(e,"title",true,"variantTitle"),false}),true)}function It(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 $r(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 Fr({cart:e,setCarts:t}){let{publish:r,shop:o,customData:n,canTrack:a,cart:s,prevCart:c}=z(),i=useRef(null);return useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){$r("id");return}if(!u.updatedAt){$r("updatedAt");return}}t(({cart:p,prevCart:y})=>u?.updatedAt!==p?.updatedAt?{cart:u,prevCart:p}:{cart:p,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 p={eventTimestamp:Date.now(),cart:s,prevCart:c,shop:o,customData:n};if(s.updatedAt===i.current)return;i.current=s.updatedAt,r("cart_updated",p),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:s.id,updatedAt:s.updatedAt}));let y=c?.lines?flattenConnection(c?.lines):[],m=s.lines?flattenConnection(s.lines):[];y?.forEach(g=>{let d=m.filter(l=>g.id===l.id);if(d?.length===1){let l=d[0];g.quantity<l.quantity?r("product_added_to_cart",{...p,prevLine:g,currentLine:l}):g.quantity>l.quantity&&r("product_removed_from_cart",{...p,prevLine:g,currentLine:l});}else r("product_removed_from_cart",{...p,prevLine:g});}),m?.forEach(g=>{let d=y.filter(l=>g.id===l.id);(!d||d.length===0)&&r("product_added_to_cart",{...p,currentLine:g});});},[s,c,r,o,n,a]),null}var bn="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function Hr({shop:e}){let t=useRef(false),{subscribe:r,register:o}=z(),{ready:n}=o("Internal_Shopify_Perf_Kit"),a=useLoadScript(bn,{attributes:{id:"perfkit","data-application":"hydrogen","data-shop-id":parseGid(e.shopId).id.toString(),"data-storefront-id":e.hydrogenSubchannelId,"data-monorail-region":"global","data-spa-mode":"true","data-resource-timing-sampling-rate":"100"}});return useEffect(()=>{a!=="done"||t.current||(t.current=true,r(F.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(F.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(F.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(F.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(F.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),n());},[r,n,a]),null}var qr=new Set,Q=e=>{qr.has(e)||(console.warn(e),qr.add(e));},Gr=new Set,Et=e=>{Gr.has(e)||(console.error(new Error(e)),Gr.add(e));};var _n={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},Yr=createContext(_n),Je=new Map,xe={};function Jr(){return Object.values(xe).every(Boolean)}function Br(e,t){Je.has(e)||Je.set(e,new Map),Je.get(e)?.set(t.toString(),t);}var ze=new Map;function Qr(e,t){if(!Jr()){ze.set(e,t);return}zr(e,t);}function zr(e,t){(Je.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 Wr(e){return xe.hasOwnProperty(e)||(xe[e]=false),{ready:()=>{xe[e]=true,Jr()&&ze.size>0&&(ze.forEach((t,r)=>{zr(r,t);}),ze.clear());}}}function jr(){try{return window.Shopify.customerPrivacy.analyticsProcessingAllowed()}catch{}return false}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 Ln({canTrack:e,cart:t,children:r,consent:o,customData:n={},shop:a=null,cookieDomain:s}){let{shop:c}=Un(a),[i,u]=useState(!!e),[p,y]=useState(false),[m,g]=useState({cart:null,prevCart:null}),[d,l]=useState(e?()=>e:()=>jr);if(c)if(/\/68817551382$/.test(c.shopId))Q("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!o.checkoutDomain){let f=Kr("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");Et(f);}if(!o.storefrontAccessToken){let f=Kr("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");Et(f);}o?.country||(o.country="US"),o?.language||(o.language="EN"),o.withPrivacyBanner===void 0&&(o.withPrivacyBanner=false);}let S=useMemo(()=>({canTrack:d,...m,customData:n,publish:d()?Qr:()=>{},shop:c,subscribe:Br,register:Wr,customerPrivacy:oe(),privacyBanner:Ee()}),[i,d,m,m.cart?.updatedAt,m.prevCart,Qr,Br,n,c,Wr,JSON.stringify(xe),oe,Ee]);return jsxs(Yr.Provider,{value:S,children:[r,!!c&&jsx(Pr,{}),!!c&&!!t&&jsx(Fr,{cart:t,setCarts:g}),!!c&&jsx(kr,{consent:o,onReady:()=>{u(true),l(e?()=>e:()=>jr),y(true);},domain:s}),!!c&&p&&jsx(Hr,{shop:c})]})}function z(){let e=useContext(Yr);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function Un(e){let[t,r]=useState(null);return useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function kn({storefront:e,publicStorefrontId:t="0"}){return e.query(Nn,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var Nn=`#graphql
|
|
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 Za from'content-security-policy-builder';function me(e){let{type:t,data:r={},customData:o}=e,n=useLocation(),{publish:a,cart:s,prevCart:c,shop:i,customData:u}=Z(),d=n.pathname+n.search,y={...r,customData:{...u,...o},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(me,{...e,type:"page_viewed"})}function Ir(e){return jsx(me,{...e,type:"product_viewed"})}function Tr(e){return jsx(me,{...e,type:"collection_viewed"})}function Er(e){return jsx(me,{...e,type:"cart_viewed"})}function br(e){return jsx(me,{...e,type:"search_viewed"})}function wr(e){return jsx(me,{...e})}var G={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 Ee="Custom-Storefront-Request-Group-ID",be="X-Shopify-Storefront-Access-Token",St="X-SDK-Variant",Pt="X-SDK-Variant-Source",vt="X-SDK-Version",We="X-Shopify-Client-IP",Ce="X-Shopify-Client-IP-Sig",je="_sfapi_proxy",Ke="_server_tracking";function Zo(e){return Object.entries(e).map(([t,r])=>r?`${t};desc=${r}`:void 0).filter(Boolean).join(", ")}function we(e,t){let r=typeof t=="string"?t:Zo(t);r&&e.headers.append("Server-Timing",r);}var en=["_y","_s","_cmp"];function Dr(e){let t={};if(!e)return t;let r=new RegExp(`\\b(${en.join("|")});desc="?([^",]+)"?`,"g"),o;for(;(o=r.exec(e))!==null;)t[o[1]]=o[2];return t}function Or(e){if(typeof window>"u")return false;try{return !!window.performance.getEntriesByType("navigation")[0]?.serverTiming?.some(r=>r.name===e)}catch{return false}}function xr(){return Or(je)}function _r(){return Or(Ke)}var sn="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 It(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function Tt(e){let{withPrivacyBanner:t=false,onVisitorConsentCollected:r,onReady:o,checkoutDomain:n,storefrontAccessToken:a,country:s,locale:c,sameDomainForStorefrontApi:i}=e,u=useMemo(()=>i??xr(),[i]),d=useMemo(()=>u&&!_r(),[u]),y=useShopifyCookies({fetchTrackingValues:d,storefrontAccessToken:a,ignoreDeprecatedCookies:true}),m=useMemo(getTrackingValues,[y]),{revalidate:g}=useRevalidator();useLoadScript$1(t?cn:sn,{attributes:{id:"customer-privacy-api"}});let{observing:p,setLoaded:l,apisLoaded:P}=dn({withPrivacyBanner:t}),f=useMemo(()=>{n||It("checkoutDomain"),a||It("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=pn(n);return {checkoutRootDomain:u&&typeof window<"u"?window.location.host:n,storefrontRootDomain:h?"."+h:void 0,storefrontAccessToken:a,country:s,locale:c}},[It,n,a,s,c]);useEffect(()=>{let h=S=>{let C=getTrackingValues();if((m.visitToken!==C.visitToken||m.uniqueToken!==C.uniqueToken)&&g().catch(()=>{console.warn("[h2:warn:useCustomerPrivacy] Revalidation failed after consent change.");}),r){let I=se();if(I?.shouldShowBanner()){let v=I.currentVisitorConsent();if(v&&v.marketing===""&&v.analytics===""&&v.preferences==="")return}r(S.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(C){typeof C=="object"&&C!==null&&"showPreferences"in C&&"loadBanner"in C&&(h=kr({privacyBanner:C,config:f}),l.privacyBanner());}});},[t,f,kr,l.privacyBanner]),useEffect(()=>{if(p.current.customerPrivacy)return;p.current.customerPrivacy=true;let h=null,S=null,C=window.Shopify||void 0;Object.defineProperty(window,"Shopify",{configurable:true,get(){return C},set(I){typeof I=="object"&&I!==null&&Object.keys(I).length===0&&(C=I,h={backendConsentEnabled:true},Object.defineProperty(window.Shopify,"customerPrivacy",{configurable:true,get(){return S??h},set(v){if(typeof v=="object"&&v!==null&&"setTrackingConsent"in v){let U=v;S={...U,setTrackingConsent:Lr({customerPrivacy:U,config:f})},C={...C,customerPrivacy:S},l.customerPrivacy();}}}));}});},[f,Lr,l.customerPrivacy]),useEffect(()=>{if(!P||!y)return;let h=se();if(h&&!h.cachedConsent){let S=getTrackingValues();S.consent&&(h.cachedConsent=S.consent);}if(t){let S=De();S&&S.loadBanner(f);}un(),o?.();},[P,y]);let R={customerPrivacy:se()};return t&&(R.privacyBanner=De()),R}var Ur=false;function un(){if(Ur)return;Ur=true;let e=new CustomEvent("shopifyCustomerPrivacyApiLoaded");document.dispatchEvent(e);}function dn({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 pn(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 Lr({customerPrivacy:e,config:t}){let r=e.setTrackingConsent,{locale:o,country:n,...a}=t;function s(c,i){r({...a,headlessStorefront:true,...c},i);}return s}function kr({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 De(){try{return window&&window?.privacyBanner?window.privacyBanner:null}catch{return null}}var Vr="2026.4.1";function Cn(){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 Mr({consent:e,onReady:t,domain:r}){let{subscribe:o,register:n,canTrack:a}=Z(),[s,c]=useState(false),[i,u]=useState(false),[d,y]=useState(""),m=useRef(false),{checkoutDomain:g,storefrontAccessToken:p,language:l}=e,{ready:P}=n("Internal_Shopify_Analytics");Tt({...e,locale:l,checkoutDomain:g||"mock.shop",storefrontAccessToken:p||"abcdefghijklmnopqrstuvwxyz123456",onReady:()=>!e.withPrivacyBanner&&u(true),onVisitorConsentCollected:R=>{try{y(JSON.stringify(R));}catch{}u(true);}});let f=useMemo(()=>i?a():true,[i,a,d]);return useShopifyCookies({hasUserConsent:f,domain:r,checkoutDomain:g,fetchTrackingValues:false,ignoreDeprecatedCookies:!i}),useEffect(()=>{m.current||(m.current=true,o(G.PAGE_VIEWED,An),o(G.PRODUCT_VIEWED,Sn),o(G.COLLECTION_VIEWED,Pn),o(G.SEARCH_VIEWED,vn),o(G.PRODUCT_ADD_TO_CART,Rn),c(true));},[o]),useEffect(()=>{s&&i&&(P(),t());},[s,i,t]),null}function ze(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function _e(e){let t=Cn(),r=t.analyticsProcessingAllowed();if(!e?.shop?.shopId){ze("shopId");return}if(!e?.shop?.acceptedLanguage){ze("acceptedLanguage");return}if(!e?.shop?.currency){ze("currency");return}if(!e?.shop?.hydrogenSubchannelId){ze("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",assetVersionId:Vr,...e.shop,hasUserConsent:r,...getClientBrowserParameters(),analyticsAllowed:t.analyticsProcessingAllowed(),marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function hn(e,t){if(t===null)return;let r=_e(e);return r?{...r,cartId:t.id}:void 0}var ie={};function An(e){let t=_e(e);t&&(sendShopifyAnalytics({eventName:AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...ie}}),ie={});}function Sn(e){let t=_e(e);if(t&&Fr({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 Pn(e){let t=_e(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 vn(e){let t=_e(e);t&&(ie={pageType:AnalyticsPageType.search},t={...t,...ie,searchString:e.searchTerm},sendShopifyAnalytics({eventName:AnalyticsEventName.SEARCH_VIEW,payload:t}));}function Rn(e){let{cart:t,currentLine:r}=e,o=hn(e,t);!o||!r?.id||In({matchedLine:r,eventPayload:o});}function In({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};Fr({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 Fr({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 $r(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 Gr({cart:e,setCarts:t}){let{publish:r,shop:o,customData:n,canTrack:a,cart:s,prevCart:c}=Z(),i=useRef(null);return useEffect(()=>{if(e)return Promise.resolve(e).then(u=>{if(u&&u.lines){if(!u.id){$r("id");return}if(!u.updatedAt){$r("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:o,customData:n};if(s.updatedAt===i.current)return;i.current=s.updatedAt,r("cart_updated",d),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:s.id,updatedAt:s.updatedAt}));let y=c?.lines?flattenConnection(c?.lines):[],m=s.lines?flattenConnection(s.lines):[];y?.forEach(g=>{let p=m.filter(l=>g.id===l.id);if(p?.length===1){let l=p[0];g.quantity<l.quantity?r("product_added_to_cart",{...d,prevLine:g,currentLine:l}):g.quantity>l.quantity&&r("product_removed_from_cart",{...d,prevLine:g,currentLine:l});}else r("product_removed_from_cart",{...d,prevLine:g});}),m?.forEach(g=>{let p=y.filter(l=>g.id===l.id);(!p||p.length===0)&&r("product_added_to_cart",{...d,currentLine:g});});},[s,c,r,o,n,a]),null}var On="https://cdn.shopify.com/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js";function Br({shop:e}){let t=useRef(false),{subscribe:r,register:o}=Z(),{ready:n}=o("Internal_Shopify_Perf_Kit"),a=useLoadScript(On,{attributes:{id:"perfkit","data-application":"hydrogen","data-shop-id":parseGid(e.shopId).id.toString(),"data-storefront-id":e.hydrogenSubchannelId,"data-monorail-region":"global","data-spa-mode":"true","data-resource-timing-sampling-rate":"100"}});return useEffect(()=>{a!=="done"||t.current||(t.current=true,r(G.PAGE_VIEWED,()=>{window.PerfKit?.navigate();}),r(G.PRODUCT_VIEWED,()=>{window.PerfKit?.setPageType("product");}),r(G.COLLECTION_VIEWED,()=>{window.PerfKit?.setPageType("collection");}),r(G.SEARCH_VIEWED,()=>{window.PerfKit?.setPageType("search");}),r(G.CART_VIEWED,()=>{window.PerfKit?.setPageType("cart");}),n());},[r,n,a]),null}var Qr=new Set,ee=e=>{Qr.has(e)||(console.warn(e),Qr.add(e));},Wr=new Set,Dt=e=>{Wr.has(e)||(console.error(new Error(e)),Wr.add(e));};var kn={canTrack:()=>false,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}}),customerPrivacy:null,privacyBanner:null},Xr=createContext(kn),Ze=new Map,Le={};function Zr(){return Object.values(Le).every(Boolean)}function jr(e,t){Ze.has(e)||Ze.set(e,new Map),Ze.get(e)?.set(t.toString(),t);}var et=new Map;function Kr(e,t){if(!Zr()){et.set(e,t);return}eo(e,t);}function eo(e,t){(Ze.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 Yr(e){return Le.hasOwnProperty(e)||(Le[e]=false),{ready:()=>{Le[e]=true,Zr()&&et.size>0&&(et.forEach((t,r)=>{eo(r,t);}),et.clear());}}}function Jr(){try{return window.Shopify.customerPrivacy?.analyticsProcessingAllowed?.()??!1}catch{}return false}function zr(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 Vn({canTrack:e,cart:t,children:r,consent:o,customData:n={},shop:a=null,cookieDomain:s}){let{shop:c}=Nn(a),[i,u]=useState(!!e),[d,y]=useState(false),[m,g]=useState({cart:null,prevCart:null}),[p,l]=useState(e?()=>e:()=>Jr);if(c)if(/\/68817551382$/.test(c.shopId))ee("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!o.checkoutDomain){let f=zr("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");Dt(f);}if(!o.storefrontAccessToken){let f=zr("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 P=useMemo(()=>({canTrack:p,...m,customData:n,publish:p()?Kr:()=>{},shop:c,subscribe:jr,register:Yr,customerPrivacy:se(),privacyBanner:De()}),[i,p,m,m.cart?.updatedAt,m.prevCart,Kr,jr,n,c,Yr,JSON.stringify(Le),se,De]);return jsxs(Xr.Provider,{value:P,children:[r,!!c&&jsx(Rr,{}),!!c&&!!t&&jsx(Gr,{cart:t,setCarts:g}),!!c&&jsx(Mr,{consent:o,onReady:()=>{u(true),l(e?()=>e:()=>Jr),y(true);},domain:s}),!!c&&d&&jsx(Br,{shop:c})]})}function Z(){let e=useContext(Xr);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function Nn(e){let[t,r]=useState(null);return useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function Mn({storefront:e,publicStorefrontId:t="0"}){return e.query(Fn,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var Fn=`#graphql
|
|
2
2
|
query ShopData(
|
|
3
3
|
$country: CountryCode
|
|
4
4
|
$language: LanguageCode
|
|
@@ -17,29 +17,29 @@ import {createContext,forwardRef,lazy,useContext,useMemo,useEffect,useRef,useSta
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,Hn={CartView:Er,CollectionView:Tr,CustomView:wr,ProductView:Ir,Provider:Vn,SearchView:br};function Y(e,t){return Ot(e.headers,t)}function Ot(e,t){let r=e?.get?.(t)??e?.[t];return typeof r=="string"?r:null}function ce(e){return {requestId:e?Y(e,"request-id"):void 0,purpose:e?Y(e,"purpose"):void 0}}function to(e){return {requestGroupId:Y(e,"request-id"),buyerIp:Y(e,"oxygen-buyer-ip"),buyerIpSig:Y(e,Ce),cookie:Y(e,"cookie"),purpose:Y(e,"sec-purpose")||Y(e,"purpose")}}var xt=/^\/api\/(unstable|2\d{3}-\d{2})\/graphql\.json$/,ro=/^\/api\/mcp$/,tt=e=>{try{return new URL(e,"http://e.c").pathname}catch{return "/"}};function ke(e,t){return t.reduce((r,o)=>{let n=e(o);return n&&r.push([o,n]),r},[])}function he(e,t={}){let r=new Error,o=(n,a="Error")=>{let s=(r.stack??"").split(`
|
|
21
21
|
`).slice(3+(t.stackOffset??0)).join(`
|
|
22
22
|
`).replace(/ at loader(\d+) \(/,(c,i)=>c.replace(i,""));return `${a}: ${n}
|
|
23
|
-
`+s};return e.then(n=>{if(n?.errors&&Array.isArray(n.errors)){let a=typeof t.logErrors=="function"?t.logErrors:()=>t.logErrors??false;n.errors.forEach(s=>{s&&(s.stack=o(s.message,s.name),a(s)&&console.error(s));});}return n}).catch(n=>{throw n&&(n.stack=o(n.message,n.name)),n})}var
|
|
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 J=void 0;var rt="public",$n="private",_t="no-store",oo={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]):oo[r]&&t.push(`${oo[r]}=${e[r]}`);}),t.join(", ")}function Ut(){return {mode:_t}}function Lt(e){if(e?.mode&&e?.mode!==rt&&e?.mode!==$n)throw Error("'mode' must be either 'public' or 'private'")}function le(e){return Lt(e),{mode:rt,maxAge:1,staleWhileRevalidate:9,...e}}function kt(e){return Lt(e),{mode:rt,maxAge:3600,staleWhileRevalidate:82800,...e}}function Ae(e){return Lt(e),{mode:rt,maxAge:1,staleWhileRevalidate:86399,...e}}function Vt(e){return e}function te(e){return String(e).includes("__proto__")?JSON.parse(e,Gn):JSON.parse(e)}function Gn(e,t){if(e!=="__proto__")return t}function ot(e,t){return e&&t?{...e,...t}:e||Ae()}function Nt(e){return Ve(ot(e))}async function Bn(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function Qn(e,t,r,o){if(!e)return;let n=ot(o),a=Nt(ot(n,{maxAge:(n.maxAge||0)+(n.staleWhileRevalidate||0)})),s=Nt(ot(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 Wn(e,t){e&&await e.delete(t);}function jn(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 Kn(e,t){let r=t.headers.get("cache-put-date");if(!r)return false;let[o,n]=jn(t,r),a=o>n;return a}var nt={get:Bn,set:Qn,delete:Wn,generateDefaultCacheControlHeader:Nt,isStale:Kn};function Ne(e){return `https://shopify.dev/?${e}`}function Yn(e){return e||Ae()}async function no(e,t){if(!e)return;let r=Ne(t),o=new Request(r),n=await nt.get(e,o);if(!n)return;let a=await n.text();try{return [te(a),n]}catch{return [a,n]}}async function ao(e,t,r,o){if(!e)return;let n=Ne(t),a=new Request(n),s=new Response(JSON.stringify(r));await nt.set(e,a,s,Yn(o));}function so(e,t){return nt.isStale(new Request(Ne(e)),t)}function io(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 at(e,t,{strategy:r=le(),cacheInstance:o,shouldCacheResult:n=()=>true,waitUntil:a,debugInfo:s}){let i=io([...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()||[])}});},g=void 0;if(!o||!r||r.mode===_t){let f=await t({addDebugData:y});return f}let p=f=>ao(o,i,{value:f,debugInfo:void 0},r),l=await no(o,i);if(l&&typeof l[0]!="string"){let[{value:f,debugInfo:R},h]=l;let S=so(i,h)?"STALE":"HIT";if(!Mt.has(i)&&S==="STALE"){Mt.add(i);let C=Promise.resolve().then(async()=>{let I=Date.now();try{let v=await t({addDebugData:y});n(v)&&(await p(v),g?.({result:v,cacheStatus:"PUT",overrideStartTime:I}));}catch(v){v.message&&(v.message="SWR in sub-request failed: "+v.message),console.error(v);}finally{Mt.delete(i);}});a?.(C);}return f}let P=await t({addDebugData:y});if(n(P)){let f=Promise.resolve().then(async()=>{await p(P);});a?.(f);}return P}var zn=["set-cookie","server-timing"];function co(e,t){return [e,{status:t.status,statusText:t.statusText,headers:[...t.headers].filter(([r])=>!zn.includes(r.toLowerCase()))}]}function uo([e,t]){return [e,new Response(e,t)]}async function st(e,t,{cacheInstance:r,cache:o,cacheKey:n=[e,t],shouldCacheResponse:a,waitUntil:s,debugInfo:c,streamConfig:i,onRawHeaders:u}){return !o&&(!t.method||t.method==="GET")&&(o=le()),at(n,async()=>{if(i){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(i.query,{variables:i.variables}),l,P;for await(let f of p){let{data:R,errors:h}=f;l=R,P=h?.graphQLErrors??h;}return m?.ok?co({data:l,errors:P},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 co(y,d)},{cacheInstance:r,waitUntil:s,strategy:o??null,debugInfo:c,shouldCacheResult:d=>"ok"in d?!1:a(...uo(d))}).then(d=>"ok"in d?[null,d]:uo(d))}function Xn(e){let{cache:t,waitUntil:r,request:o}=e;return {run:({cacheKey:n,cacheStrategy:a,shouldCacheResult:s},c)=>at(n,c,{shouldCacheResult:s,strategy:a,cacheInstance:t,waitUntil:r,debugInfo:{...ce(o),stackInfo:J?.()}}),fetch:(n,a,s)=>st(n,a??{},{waitUntil:r,cacheKey:[n,a],cacheInstance:t,debugInfo:{url:n,...ce(o),stackInfo:J?.(),displayName:s?.displayName},cache:s.cacheStrategy,...s}).then(([c,i])=>({data:c,response:i}))}}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),c=s.get("cache-control")||s.get("real-cache-control")||"",i=parseInt(c.match(/max-age=(\d+)/)?.[1]||"0",10),u=parseInt(c.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),d=(Date.now()-n)/1e3;if(d>i+u){this.#e.delete(t.url);return}let m=d>i;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 po="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:po,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(a):e]})}re.INPUT_NAME=po;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 ea(e){let t={};for(let s of e.entries()){let c=s[0],i=e.getAll(c);t[c]=i.length>1?i:s[1],t[c]==="on"?t[c]=true:t[c]==="off"&&(t[c]=false);}let{cartFormInput:r,...o}=t,{action:n,inputs:a}=r?JSON.parse(String(r)):{};return {action:n,inputs:{...a,...o}}}re.getFormInput=ea;var Ht=e=>{let t=parse(Ot(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 it(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var Me="2026.4.1";function Se(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var aa=/(^|}\s)query[\s({]/im,sa=/(^|}\s)mutation[\s({]/im;function ct(e,t){if(!aa.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function ut(e,t){if(!sa.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+=`
|
|
24
24
|
`,this.stack&&(t+=`${this.stack.slice(this.stack.indexOf(`
|
|
25
25
|
`)+1)}
|
|
26
|
-
`),t}toJSON(){return {name:"Error",message:""}}};function
|
|
26
|
+
`),t}toJSON(){return {name:"Error",message:""}}};function Fe({url:e,response:t,errors:r,type:o,query:n,queryVariables:a,ErrorConstructor:s=Error,client:c="storefront"}){let i=(typeof r=="string"?r:r?.map?.(d=>d.message).join(`
|
|
27
27
|
`))||`URL: ${e}
|
|
28
|
-
API response error: ${t.status}`,u=new
|
|
28
|
+
API response error: ${t.status}`,u=new ye(i,{query:n,queryVariables:a,cause:{errors:r},clientOperation:`${c}.${o}`,requestId:t.headers.get("x-request-id")});throw new s(u.message,{cause:u.cause})}var da={language:"EN",country:"US"};function mo(e){let {storefrontHeaders:t,cache:r,waitUntil:o,i18n:n,storefrontId:a,logErrors:s=true,...c}=e,{getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getStorefrontApiUrl:y,getShopifyDomain:m}=createStorefrontClient(c),p=(c.privateStorefrontToken?d:u)({contentType:"json",buyerIp:t?.buyerIp||""});t?.buyerIp&&(p[We]=t.buyerIp),t?.buyerIpSig&&(p[Ce]=t.buyerIpSig),p[Ee]=t?.requestGroupId||it(),a&&(p[SHOPIFY_STOREFRONT_ID_HEADER]=a),(p["user-agent"]=`Hydrogen ${Me}`);let l=t?.cookie??"";l&&(p.cookie=l);let P,f;if(!/\b_shopify_(analytics|marketing)=/.test(l)){let C=l.match(/\b_shopify_y=([^;]+)/)?.[1],I=l.match(/\b_shopify_s=([^;]+)/)?.[1];C&&(p[SHOPIFY_STOREFRONT_Y_HEADER]=C),I&&(p[SHOPIFY_STOREFRONT_S_HEADER]=I),P=C??it(),f=I??it(),p[SHOPIFY_UNIQUE_TOKEN_HEADER]=P,p[SHOPIFY_VISIT_TOKEN_HEADER]=f;}let R,h=JSON.stringify({"content-type":p["content-type"],"user-agent":p["user-agent"],[St]:p[St],[Pt]:p[Pt],[vt]:p[vt],[be]:p[be]});async function S({query:C,mutation:I,variables:v,cache:U,headers:V=[],storefrontApiVersion:W,displayName:Ct,stackInfo:ht}){let Qe=V instanceof Headers?Object.fromEntries(V.entries()):Array.isArray(V)?Object.fromEntries(V):V,K=C??I,A={...v};n&&(!v?.country&&/\$country/.test(K)&&(A.country=n.country),!v?.language&&/\$language/.test(K)&&(A.language=n.language));let E=y({storefrontApiVersion:W}),k=JSON.stringify({query:K,variables:A}),L={method:"POST",headers:{...p,...Qe},body:k},Q=[E,L.method,h,L.body],ae=K.includes("@defer")?{query:K,variables:A}:void 0,[q,j]=await st(E,L,{cacheInstance:I?void 0:r,cache:U||Ae(),cacheKey:Q,waitUntil:o,shouldCacheResponse:M=>!M?.errors,debugInfo:{requestId:L.headers[Ee],displayName:Ct,url:E,stackInfo:ht,graphql:k,purpose:t?.purpose},streamConfig:ae,onRawHeaders:M=>{R??={setCookie:M.getSetCookie(),serverTiming:M.get("server-timing")??""};}}),z={url:E,response:j,type:I?"mutation":"query",query:K,queryVariables:A,errors:void 0};if(!j.ok){let M,X=q;try{X??=await j.text(),M=te(X);}catch{M=[{message:X??"Could not parse Storefront API response"}];}Fe({...z,errors:M});}let{data:N,errors:$}=q;$=$?Array.isArray($)?$:[$]:void 0;let Te=$?.map(({message:M,...X})=>new ye(M,{...X,clientOperation:`storefront.${z.type}`,requestId:j.headers.get("x-request-id"),queryVariables:A,query:K}));return T(N,Te)}return {storefront:{query(C,I){C=Se(C),ct(C,"storefront.query");let v=fo?.(C);return he(S({...I,query:C,stackInfo:J?.(v)}),{stackOffset:v,logErrors:s})},mutate(C,I){C=Se(C),ut(C,"storefront.mutate");let v=fo?.(C);return he(S({...I,mutation:C,stackInfo:J?.(v)}),{stackOffset:v,logErrors:s})},cache:r,CacheNone:Ut,CacheLong:kt,CacheShort:le,CacheCustom:Vt,generateCacheControlHeader:Ve,getPublicTokenHeaders:u,getPrivateTokenHeaders:d,getHeaders:()=>({...p}),getShopifyDomain:m,getApiUrl:y,i18n:n??da,isStorefrontApiUrl(C){return xt.test(tt(C.url??""))},async forward(C,I){let v=new Headers([...ke(W=>C.headers.get(W),["accept","accept-encoding","accept-language","access-control-request-headers","access-control-request-method","content-type","content-length","cookie","origin","referer","user-agent",be,SHOPIFY_UNIQUE_TOKEN_HEADER,SHOPIFY_VISIT_TOKEN_HEADER]),...ke(W=>p[W],[We,Ce,SHOPIFY_STOREFRONT_ID_HEADER,Ee])]);t?.buyerIp&&v.set("x-forwarded-for",t.buyerIp);let U=I?.storefrontApiVersion??tt(C.url).match(xt)?.[1],V=await fetch(y({storefrontApiVersion:U}),{method:C.method,body:C.body,headers:v});return new Response(V.body,V)},isMcpUrl(C){return ro.test(tt(C.url??""))},async forwardMcp(C){let I=new Headers([...ke(U=>C.headers.get(U),["accept","accept-encoding","accept-language","content-type","cookie","origin","referer","user-agent"]),...ke(U=>p[U],[We,Ce,be,Ee,SHOPIFY_STOREFRONT_ID_HEADER])]);t?.buyerIp&&I.set("x-forwarded-for",t.buyerIp);let v=`${m()}/api/mcp`;try{let U=await fetch(v,{method:C.method,body:C.body,headers:I});return new Response(U.body,U)}catch(U){let W=U instanceof Error?U.message:"Internal proxy error";return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32603,message:W},id:null}),{status:502,headers:{"content-type":"application/json"}})}},setCollectedSubrequestHeaders:C=>{if(R)for(let V of R.setCookie)C.headers.append("Set-Cookie",V);let I=Dr(R?.serverTiming),v=C.headers.get("content-type")?.startsWith("text/html");we(C,{...v?{_y:P,_s:f}:void 0,...I}),v&&R&&R.setCookie.length>1&&I?._y&&I?._s&&I?._cmp&&we(C,{[Ke]:"1"});}}}}var fo=void 0;function T(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
|
+
$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=r();if(!a)return null;let s=b(n),[c,{cart:i,errors:u}]=await Promise.all([t?t.isLoggedIn():false,e.query(pa(o,{includeVisitorConsent:s}),{variables:{cartId:a,...n},cache:e.CacheNone()})]);if(c&&i?.checkoutUrl){let d=new URL(i.checkoutUrl);d.searchParams.set("logged_in","true"),i.checkoutUrl=d.toString();}return i||u?T(i,u):null}}var pa=(e=la,t={})=>`#graphql
|
|
29
31
|
query CartQuery(
|
|
30
32
|
$cartId: ID!
|
|
31
33
|
$numCartLines: Int = 100
|
|
32
|
-
$
|
|
33
|
-
|
|
34
|
-
$visitorConsent: VisitorConsent
|
|
35
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
34
|
+
${w(t.includeVisitorConsent)}
|
|
35
|
+
) ${D(t.includeVisitorConsent)} {
|
|
36
36
|
cart(id: $cartId) {
|
|
37
37
|
...CartApiQuery
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
${e}
|
|
42
|
-
`,
|
|
42
|
+
`,la=`#graphql
|
|
43
43
|
fragment CartApiQuery on Cart {
|
|
44
44
|
updatedAt
|
|
45
45
|
id
|
|
@@ -154,31 +154,29 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
154
154
|
width
|
|
155
155
|
height
|
|
156
156
|
}
|
|
157
|
-
`;var
|
|
157
|
+
`;var O=`#graphql
|
|
158
158
|
fragment CartApiError on CartUserError {
|
|
159
159
|
message
|
|
160
160
|
field
|
|
161
161
|
code
|
|
162
162
|
}
|
|
163
|
-
`,
|
|
163
|
+
`,x=`#graphql
|
|
164
164
|
fragment CartApiMutation on Cart {
|
|
165
165
|
id
|
|
166
166
|
totalQuantity
|
|
167
167
|
checkoutUrl
|
|
168
168
|
}
|
|
169
|
-
`,
|
|
169
|
+
`,_=`#graphql
|
|
170
170
|
fragment CartApiWarning on CartWarning {
|
|
171
171
|
code
|
|
172
172
|
message
|
|
173
173
|
target
|
|
174
174
|
}
|
|
175
|
-
`;function
|
|
175
|
+
`;function Bt(e){return async(t,r)=>{let o=e.customerAccount?await e.customerAccount.getBuyer():void 0,{cartId:n,...a}=r||{},{buyerIdentity:s,...c}=t,i=b(r),{cartCreate:u,errors:d}=await e.storefront.mutate(ya(e.cartFragment,{includeVisitorConsent:i}),{variables:{input:{...c,buyerIdentity:{...o,...s}},...a}});return T(u,d)}}var ya=(e=x,t={})=>`#graphql
|
|
176
176
|
mutation cartCreate(
|
|
177
177
|
$input: CartInput!
|
|
178
|
-
$
|
|
179
|
-
|
|
180
|
-
$visitorConsent: VisitorConsent
|
|
181
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
178
|
+
${w(t.includeVisitorConsent)}
|
|
179
|
+
) ${D(t.includeVisitorConsent)} {
|
|
182
180
|
cartCreate(input: $input) {
|
|
183
181
|
cart {
|
|
184
182
|
...CartApiMutation
|
|
@@ -193,16 +191,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
193
191
|
}
|
|
194
192
|
}
|
|
195
193
|
${e}
|
|
196
|
-
${
|
|
197
|
-
${
|
|
198
|
-
`;function
|
|
194
|
+
${O}
|
|
195
|
+
${_}
|
|
196
|
+
`;function Qt(e){return async(t,r)=>{let o=b(r),{cartLinesAdd:n,errors:a}=await e.storefront.mutate(fa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lines:t,...r}});return T(n,a)}}var fa=(e=x,t={})=>`#graphql
|
|
199
197
|
mutation cartLinesAdd(
|
|
200
198
|
$cartId: ID!
|
|
201
199
|
$lines: [CartLineInput!]!
|
|
202
|
-
$
|
|
203
|
-
|
|
204
|
-
$visitorConsent: VisitorConsent
|
|
205
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
200
|
+
${w(t.includeVisitorConsent)}
|
|
201
|
+
) ${D(t.includeVisitorConsent)} {
|
|
206
202
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
207
203
|
cart {
|
|
208
204
|
...CartApiMutation
|
|
@@ -216,16 +212,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
216
212
|
}
|
|
217
213
|
}
|
|
218
214
|
${e}
|
|
219
|
-
${
|
|
220
|
-
${
|
|
221
|
-
`;var
|
|
215
|
+
${O}
|
|
216
|
+
${_}
|
|
217
|
+
`;var go="__h_pending_";function Co(e){return go+e}function dt(e){return e.startsWith(go)}function pt(e,t){if(t.some(r=>dt(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)=>{pt("updateLines",t);let o=b(r),{cartLinesUpdate:n,errors:a}=await e.storefront.mutate(ma(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lines:t,...r}});return T(n,a)}}var ma=(e=x,t={})=>`#graphql
|
|
222
218
|
mutation cartLinesUpdate(
|
|
223
219
|
$cartId: ID!
|
|
224
220
|
$lines: [CartLineUpdateInput!]!
|
|
225
|
-
$
|
|
226
|
-
|
|
227
|
-
$visitorConsent: VisitorConsent
|
|
228
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
221
|
+
${w(t.includeVisitorConsent)}
|
|
222
|
+
) ${D(t.includeVisitorConsent)} {
|
|
229
223
|
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
230
224
|
cart {
|
|
231
225
|
...CartApiMutation
|
|
@@ -239,16 +233,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
239
233
|
}
|
|
240
234
|
}
|
|
241
235
|
${e}
|
|
242
|
-
${
|
|
243
|
-
${
|
|
244
|
-
`;function
|
|
236
|
+
${O}
|
|
237
|
+
${_}
|
|
238
|
+
`;function jt(e){return async(t,r)=>{pt("removeLines",t);let o=b(r),{cartLinesRemove:n,errors:a}=await e.storefront.mutate(ga(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return T(n,a)}}var ga=(e=x,t={})=>`#graphql
|
|
245
239
|
mutation cartLinesRemove(
|
|
246
240
|
$cartId: ID!
|
|
247
241
|
$lineIds: [ID!]!
|
|
248
|
-
$
|
|
249
|
-
|
|
250
|
-
$visitorConsent: VisitorConsent
|
|
251
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
242
|
+
${w(t.includeVisitorConsent)}
|
|
243
|
+
) ${D(t.includeVisitorConsent)} {
|
|
252
244
|
cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
|
|
253
245
|
cart {
|
|
254
246
|
...CartApiMutation
|
|
@@ -262,16 +254,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
262
254
|
}
|
|
263
255
|
}
|
|
264
256
|
${e}
|
|
265
|
-
${
|
|
266
|
-
${
|
|
267
|
-
`;function
|
|
257
|
+
${O}
|
|
258
|
+
${_}
|
|
259
|
+
`;function Kt(e){return async(t,r)=>{let o=t.filter((c,i,u)=>u.indexOf(c)===i),n=b(r),{cartDiscountCodesUpdate:a,errors:s}=await e.storefront.mutate(Ca(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),discountCodes:o,...r}});return T(a,s)}}var Ca=(e=x,t={})=>`#graphql
|
|
268
260
|
mutation cartDiscountCodesUpdate(
|
|
269
261
|
$cartId: ID!
|
|
270
262
|
$discountCodes: [String!]!
|
|
271
|
-
$
|
|
272
|
-
|
|
273
|
-
$visitorConsent: VisitorConsent
|
|
274
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
263
|
+
${w(t.includeVisitorConsent)}
|
|
264
|
+
) ${D(t.includeVisitorConsent)} {
|
|
275
265
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
276
266
|
... @defer {
|
|
277
267
|
cart {
|
|
@@ -287,16 +277,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
287
277
|
}
|
|
288
278
|
}
|
|
289
279
|
${e}
|
|
290
|
-
${
|
|
291
|
-
${
|
|
292
|
-
`;function
|
|
280
|
+
${O}
|
|
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(ha(e.cartFragment,{includeVisitorConsent:n}),{variables:{cartId:e.getCartId(),buyerIdentity:{...o,...t},...r}});return T(a,s)}}var ha=(e=x,t={})=>`#graphql
|
|
293
283
|
mutation cartBuyerIdentityUpdate(
|
|
294
284
|
$cartId: ID!
|
|
295
285
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
296
|
-
$
|
|
297
|
-
|
|
298
|
-
$visitorConsent: VisitorConsent
|
|
299
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
286
|
+
${w(t.includeVisitorConsent)}
|
|
287
|
+
) ${D(t.includeVisitorConsent)} {
|
|
300
288
|
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
|
301
289
|
cart {
|
|
302
290
|
...CartApiMutation
|
|
@@ -310,16 +298,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
310
298
|
}
|
|
311
299
|
}
|
|
312
300
|
${e}
|
|
313
|
-
${
|
|
314
|
-
${
|
|
315
|
-
`;function
|
|
301
|
+
${O}
|
|
302
|
+
${_}
|
|
303
|
+
`;function Jt(e){return async(t,r)=>{let o=b(r),{cartNoteUpdate:n,errors:a}=await e.storefront.mutate(Aa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),note:t,...r}});return T(n,a)}}var Aa=(e=x,t={})=>`#graphql
|
|
316
304
|
mutation cartNoteUpdate(
|
|
317
305
|
$cartId: ID!
|
|
318
306
|
$note: String!
|
|
319
|
-
$
|
|
320
|
-
|
|
321
|
-
$visitorConsent: VisitorConsent
|
|
322
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
307
|
+
${w(t.includeVisitorConsent)}
|
|
308
|
+
) ${D(t.includeVisitorConsent)} {
|
|
323
309
|
cartNoteUpdate(cartId: $cartId, note: $note) {
|
|
324
310
|
cart {
|
|
325
311
|
...CartApiMutation
|
|
@@ -333,16 +319,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
333
319
|
}
|
|
334
320
|
}
|
|
335
321
|
${e}
|
|
336
|
-
${
|
|
337
|
-
${
|
|
338
|
-
`;function
|
|
322
|
+
${O}
|
|
323
|
+
${_}
|
|
324
|
+
`;function zt(e){return async(t,r)=>{let o=b(r),{cartSelectedDeliveryOptionsUpdate:n,errors:a}=await e.storefront.mutate(Sa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return T(n,a)}}var Sa=(e=x,t={})=>`#graphql
|
|
339
325
|
mutation cartSelectedDeliveryOptionsUpdate(
|
|
340
326
|
$cartId: ID!
|
|
341
327
|
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
|
342
|
-
$
|
|
343
|
-
|
|
344
|
-
$visitorConsent: VisitorConsent
|
|
345
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
328
|
+
${w(t.includeVisitorConsent)}
|
|
329
|
+
) ${D(t.includeVisitorConsent)} {
|
|
346
330
|
cartSelectedDeliveryOptionsUpdate(cartId: $cartId, selectedDeliveryOptions: $selectedDeliveryOptions) {
|
|
347
331
|
cart {
|
|
348
332
|
...CartApiMutation
|
|
@@ -356,16 +340,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
356
340
|
}
|
|
357
341
|
}
|
|
358
342
|
${e}
|
|
359
|
-
${
|
|
360
|
-
${
|
|
361
|
-
`;function
|
|
343
|
+
${O}
|
|
344
|
+
${_}
|
|
345
|
+
`;function Xt(e){return async(t,r)=>{let o=b(r),{cartAttributesUpdate:n,errors:a}=await e.storefront.mutate(Pa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t,...r}});return T(n,a)}}var Pa=(e=x,t={})=>`#graphql
|
|
362
346
|
mutation cartAttributesUpdate(
|
|
363
347
|
$cartId: ID!
|
|
364
348
|
$attributes: [AttributeInput!]!
|
|
365
|
-
$
|
|
366
|
-
|
|
367
|
-
$visitorConsent: VisitorConsent
|
|
368
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
349
|
+
${w(t.includeVisitorConsent)}
|
|
350
|
+
) ${D(t.includeVisitorConsent)} {
|
|
369
351
|
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
|
|
370
352
|
cart {
|
|
371
353
|
...CartApiMutation
|
|
@@ -379,15 +361,13 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
379
361
|
}
|
|
380
362
|
}
|
|
381
363
|
${e}
|
|
382
|
-
${
|
|
383
|
-
${
|
|
384
|
-
`;function
|
|
364
|
+
${O}
|
|
365
|
+
${_}
|
|
366
|
+
`;function Zt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),n=t.map(i=>({...i,ownerId:o})),a=b(r),{cartMetafieldsSet:s,errors:c}=await e.storefront.mutate(va({includeVisitorConsent:a}),{variables:{metafields:n,...r}});return T({cart:{id:o},...s},c)}}var va=(e={})=>`#graphql
|
|
385
367
|
mutation cartMetafieldsSet(
|
|
386
368
|
$metafields: [CartMetafieldsSetInput!]!
|
|
387
|
-
$
|
|
388
|
-
|
|
389
|
-
$visitorConsent: VisitorConsent
|
|
390
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
369
|
+
${w(e.includeVisitorConsent)}
|
|
370
|
+
) ${D(e.includeVisitorConsent)} {
|
|
391
371
|
cartMetafieldsSet(metafields: $metafields) {
|
|
392
372
|
userErrors {
|
|
393
373
|
code
|
|
@@ -397,13 +377,11 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
397
377
|
}
|
|
398
378
|
}
|
|
399
379
|
}
|
|
400
|
-
`;function
|
|
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(Ra({includeVisitorConsent:n}),{variables:{input:{ownerId:o,key:t},...r}});return T({cart:{id:o},...a},s)}}var Ra=(e={})=>`#graphql
|
|
401
381
|
mutation cartMetafieldDelete(
|
|
402
382
|
$input: CartMetafieldDeleteInput!
|
|
403
|
-
$
|
|
404
|
-
|
|
405
|
-
$visitorConsent: VisitorConsent
|
|
406
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
383
|
+
${w(e.includeVisitorConsent)}
|
|
384
|
+
) ${D(e.includeVisitorConsent)} {
|
|
407
385
|
cartMetafieldDelete(input: $input) {
|
|
408
386
|
userErrors {
|
|
409
387
|
code
|
|
@@ -412,14 +390,12 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
412
390
|
}
|
|
413
391
|
}
|
|
414
392
|
}
|
|
415
|
-
`;function
|
|
393
|
+
`;function tr(e){return async(t,r)=>{let o=b(r),{cartGiftCardCodesUpdate:n,errors:a}=await e.storefront.mutate(Ia(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return T(n,a)}}var Ia=(e=x,t={})=>`#graphql
|
|
416
394
|
mutation cartGiftCardCodesUpdate(
|
|
417
395
|
$cartId: ID!
|
|
418
396
|
$giftCardCodes: [String!]!
|
|
419
|
-
$
|
|
420
|
-
|
|
421
|
-
$visitorConsent: VisitorConsent
|
|
422
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
397
|
+
${w(t.includeVisitorConsent)}
|
|
398
|
+
) ${D(t.includeVisitorConsent)} {
|
|
423
399
|
cartGiftCardCodesUpdate(cartId: $cartId, giftCardCodes: $giftCardCodes) {
|
|
424
400
|
cart {
|
|
425
401
|
...CartApiMutation
|
|
@@ -433,9 +409,9 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
433
409
|
}
|
|
434
410
|
}
|
|
435
411
|
${e}
|
|
436
|
-
${
|
|
437
|
-
${
|
|
438
|
-
`;function
|
|
412
|
+
${O}
|
|
413
|
+
${_}
|
|
414
|
+
`;function rr(e){return async(t,r)=>{let{cartGiftCardCodesAdd:o,errors:n}=await e.storefront.mutate(Ta(e.cartFragment),{variables:{cartId:e.getCartId(),giftCardCodes:t,...r}});return T(o,n)}}var Ta=(e=x)=>`#graphql
|
|
439
415
|
mutation cartGiftCardCodesAdd(
|
|
440
416
|
$cartId: ID!
|
|
441
417
|
$giftCardCodes: [String!]!
|
|
@@ -455,16 +431,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
455
431
|
}
|
|
456
432
|
}
|
|
457
433
|
${e}
|
|
458
|
-
${
|
|
459
|
-
${
|
|
460
|
-
`;function
|
|
434
|
+
${O}
|
|
435
|
+
${_}
|
|
436
|
+
`;function or(e){return async(t,r)=>{let o=b(r),{cartGiftCardCodesRemove:n,errors:a}=await e.storefront.mutate(Ea(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),appliedGiftCardIds:t,...r}});return T(n,a)}}var Ea=(e=x,t={})=>`#graphql
|
|
461
437
|
mutation cartGiftCardCodesRemove(
|
|
462
438
|
$cartId: ID!
|
|
463
439
|
$appliedGiftCardIds: [ID!]!
|
|
464
|
-
$
|
|
465
|
-
|
|
466
|
-
$visitorConsent: VisitorConsent
|
|
467
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
440
|
+
${w(t.includeVisitorConsent)}
|
|
441
|
+
) ${D(t.includeVisitorConsent)} {
|
|
468
442
|
cartGiftCardCodesRemove(cartId: $cartId, appliedGiftCardIds: $appliedGiftCardIds) {
|
|
469
443
|
cart {
|
|
470
444
|
...CartApiMutation
|
|
@@ -478,16 +452,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
478
452
|
}
|
|
479
453
|
}
|
|
480
454
|
${e}
|
|
481
|
-
${
|
|
482
|
-
${
|
|
483
|
-
`;function
|
|
455
|
+
${O}
|
|
456
|
+
${_}
|
|
457
|
+
`;function ho(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesAdd:n,errors:a}=await e.storefront.mutate(ba(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return T(n,a)}}var ba=(e=x,t={})=>`#graphql
|
|
484
458
|
mutation cartDeliveryAddressesAdd(
|
|
485
459
|
$cartId: ID!
|
|
486
460
|
$addresses: [CartSelectableAddressInput!]!,
|
|
487
|
-
$
|
|
488
|
-
|
|
489
|
-
$visitorConsent: VisitorConsent
|
|
490
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
461
|
+
${w(t.includeVisitorConsent)}
|
|
462
|
+
) ${D(t.includeVisitorConsent)} {
|
|
491
463
|
cartDeliveryAddressesAdd(addresses: $addresses, cartId: $cartId) {
|
|
492
464
|
cart {
|
|
493
465
|
...CartApiMutation
|
|
@@ -501,16 +473,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
501
473
|
}
|
|
502
474
|
}
|
|
503
475
|
${e}
|
|
504
|
-
${
|
|
505
|
-
${
|
|
506
|
-
`;function
|
|
476
|
+
${O}
|
|
477
|
+
${_}
|
|
478
|
+
`;function Ao(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesRemove:n,errors:a}=await e.storefront.mutate(wa(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addressIds:t,...r}});return T(n,a)}}var wa=(e=x,t={})=>`#graphql
|
|
507
479
|
mutation cartDeliveryAddressesRemove(
|
|
508
480
|
$cartId: ID!
|
|
509
481
|
$addressIds: [ID!]!,
|
|
510
|
-
$
|
|
511
|
-
|
|
512
|
-
$visitorConsent: VisitorConsent
|
|
513
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
482
|
+
${w(t.includeVisitorConsent)}
|
|
483
|
+
) ${D(t.includeVisitorConsent)} {
|
|
514
484
|
cartDeliveryAddressesRemove(addressIds: $addressIds, cartId: $cartId) {
|
|
515
485
|
cart {
|
|
516
486
|
...CartApiMutation
|
|
@@ -524,16 +494,14 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
524
494
|
}
|
|
525
495
|
}
|
|
526
496
|
${e}
|
|
527
|
-
${
|
|
528
|
-
${
|
|
529
|
-
`;function
|
|
497
|
+
${O}
|
|
498
|
+
${_}
|
|
499
|
+
`;function So(e){return async(t,r)=>{let o=b(r),{cartDeliveryAddressesUpdate:n,errors:a}=await e.storefront.mutate(Da(e.cartFragment,{includeVisitorConsent:o}),{variables:{cartId:e.getCartId(),addresses:t,...r}});return T(n,a)}}var Da=(e=x,t={})=>`#graphql
|
|
530
500
|
mutation cartDeliveryAddressesUpdate(
|
|
531
501
|
$cartId: ID!
|
|
532
502
|
$addresses: [CartSelectableAddressUpdateInput!]!,
|
|
533
|
-
$
|
|
534
|
-
|
|
535
|
-
$visitorConsent: VisitorConsent
|
|
536
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
503
|
+
${w(t.includeVisitorConsent)}
|
|
504
|
+
) ${D(t.includeVisitorConsent)} {
|
|
537
505
|
cartDeliveryAddressesUpdate(addresses: $addresses, cartId: $cartId) {
|
|
538
506
|
cart {
|
|
539
507
|
...CartApiMutation
|
|
@@ -547,9 +515,9 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
547
515
|
}
|
|
548
516
|
}
|
|
549
517
|
${e}
|
|
550
|
-
${
|
|
551
|
-
${
|
|
552
|
-
`;function
|
|
518
|
+
${O}
|
|
519
|
+
${_}
|
|
520
|
+
`;function Po(e){return async(t,r)=>{let{cartDeliveryAddressesReplace:o,errors:n}=await e.storefront.mutate(Oa(e.cartFragment),{variables:{cartId:e.getCartId(),addresses:t,...r}});return T(o,n)}}var Oa=(e=x)=>`#graphql
|
|
553
521
|
mutation cartDeliveryAddressesReplace(
|
|
554
522
|
$cartId: ID!
|
|
555
523
|
$addresses: [CartSelectableAddressInput!]!,
|
|
@@ -569,9 +537,9 @@ API response error: ${t.status}`,u=new de(i,{query:n,queryVariables:a,cause:{err
|
|
|
569
537
|
}
|
|
570
538
|
}
|
|
571
539
|
${e}
|
|
572
|
-
${
|
|
573
|
-
${
|
|
574
|
-
`;function tr(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:n,cartQueryFragment:a,cartMutateFragment:s,buyerIdentity:c}=e,i=t(),u=()=>i||t(),p={storefront:o,getCartId:u,cartFragment:s,customerAccount:n},y=Ht(p),m=async function(...d){d[0].buyerIdentity={...c,...d[0].buyerIdentity};let l=await y(...d);return i=l?.cart?.id,l},g={get:Ft({storefront:o,customerAccount:n,getCartId:u,cartFragment:a}),getCartId:u,setCartId:r,create:m,addLines:async(d,l)=>{let S=d.map(f=>({attributes:f.attributes,quantity:f.quantity,merchandiseId:f.merchandiseId,sellingPlanId:f.sellingPlanId,parent:f.parent}));return i||l?.cartId?await qt(p)(S,l):await m({lines:S,buyerIdentity:c},l)},updateLines:Gt(p),removeLines:Bt(p),updateDiscountCodes:async(d,l)=>i||l?.cartId?await Qt(p)(d,l):await m({discountCodes:d},l),updateGiftCardCodes:async(d,l)=>i||l?.cartId?await Xt(p)(d,l):await m({giftCardCodes:d},l),addGiftCardCodes:Zt(p),removeGiftCardCodes:er(p),updateBuyerIdentity:async(d,l)=>i||l?.cartId?await Wt(p)(d,l):await m({buyerIdentity:d},l),updateNote:async(d,l)=>i||l?.cartId?await jt(p)(d,l):await m({note:d},l),updateSelectedDeliveryOption:Kt(p),updateAttributes:async(d,l)=>i||l?.cartId?await Yt(p)(d,l):await m({attributes:d},l),setMetafields:async(d,l)=>i||l?.cartId?await Jt(p)(d,l):await m({metafields:d},l),deleteMetafield:zt(p),addDeliveryAddresses:mo(p),removeDeliveryAddresses:go(p),updateDeliveryAddresses:Co(p),replaceDeliveryAddresses:ho(p)};return "customMethods"in e?{...g,...e.customMethods??{}}:g}function Da(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=Z.getFormInput(a);if(s.action===Z.ACTIONS.LinesAdd)for(let c of s.inputs.lines){if(!c.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let i=o.find(u=>u.merchandise.id===c.selectedVariant?.id);n=true,i?(i.quantity=(i.quantity||1)+(c.quantity||1),i.isOptimistic=true):o.unshift({id:fo(c.selectedVariant.id),merchandise:c.selectedVariant,isOptimistic:true,quantity:c.quantity||1});}else if(s.action===Z.ACTIONS.LinesRemove)for(let c of s.inputs.lineIds){let i=o.findIndex(u=>u.id===c);if(i!==-1){if(it(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${c}' but it doesn't exist in the cart`);}else if(s.action===Z.ACTIONS.LinesUpdate)for(let c of s.inputs.lines){let i=o.findIndex(u=>c.id===u.id);if(i>-1){if(it(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}o[i].quantity=c.quantity,o[i].quantity===0&&o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${c.id}' but it doesn't exist in the cart`);}}return n&&(r.isOptimistic=n),r.totalQuantity=o.reduce((a,s)=>a+s.quantity,0),r}var Oa="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function xa({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||Oa)}var Me=createContext$1(),rr=createContext$1(),or=createContext$1(),nr=createContext$1(),ar=createContext$1(),sr=createContext$1(),_a={storefront:Me,cart:rr,customerAccount:or,env:nr,session:ar,waitUntil:sr};var ut="2026-01",Ae=`Shopify Hydrogen ${ke}`,Ao="30243aa5-17c1-465a-8493-944bcc4e88aa",N="customerAccount",Pe="buyer";var H=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function $e(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 La({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:o,debugInfo:n}){let a=new URLSearchParams,s=e.get(N),c=s?.refreshToken,i=s?.idToken;if(!c)throw new H("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":Ae,Origin:o};new Date().getTime();let y=r,m=await fetch(y,{method:"POST",headers:u,body:a});if(!m.ok){let S=await m.text();throw new Response(S,{status:m.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:g,expires_in:d,refresh_token:l}=await m.json();if(!g||g.length===0)throw new H("Unauthorized","Invalid access token received.");e.set(N,{accessToken:g,expiresAt:new Date(new Date().getTime()+(d-120)*1e3).getTime()+"",refreshToken:l,idToken:i});}function Se(e){e.unset(N),e.unset(Pe);}async function Po({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=La({session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(c){throw Se(r),c&&c.status!==401?c:new H("Unauthorized","Login before querying the Customer Account API.")}}function So(){let e=Ua();return Ro(e)}async function vo(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=ka(t);return Ro(r)}function Ua(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function Ro(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ka(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function Io(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function To(e,t,r,o,n){let a=t;if(!e)throw new H("Unauthorized","oAuth access token was not provided during token exchange.");let s=new URLSearchParams;s.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),s.append("client_id",a),s.append("audience",Ao),s.append("subject_token",e),s.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),s.append("scopes","https://api.customers.com/auth/customer.graphql");let c={"content-type":"application/x-www-form-urlencoded","User-Agent":Ae,Origin:o};new Date().getTime();let u=r,p=await fetch(u,{method:"POST",headers:c,body:s});let y=await p.json();if(y.error)throw new H(y.error_description);return y.access_token}function Eo(e){return Na(e).payload.nonce}function Na(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 dt(){return Va(Ma())}function Ma(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function Va(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function pt(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(wo(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}`);}}function wo(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 o=e,n=bo(e,t),a=r?bo(e,r):n;return wo(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 bo(e,t){return $a(t)?new URL(t):new URL(t,new URL(e).origin)}function $a(e){try{return new URL(e),!0}catch{return false}}function Do(e,t){let r=`https://shopify.com/${t}`,o=`https://shopify.com/authentication/${t}`;return function(a){switch(a){case "CA_BASE_URL":return r;case "CA_BASE_AUTH_URL":return o;case "GRAPHQL":return `${r}/account/customer/api/${e}/graphql`;case "AUTH":return `${o}/oauth/authorize`;case "LOGIN_SCOPE":return t?"openid email customer-account-api:full":"openid email https://api.customers.com/auth/customer.graphql";case "TOKEN_EXCHANGE":return `${o}/oauth/token`;case "LOGOUT":return `${o}/logout`}}}function Fa(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 $e(n)}function ur({session:e,customerAccountId:t,shopId:r,customerApiVersion:o=ut,request:n,waitUntil:a,authUrl:s,customAuthStatusHandler:c,logErrors:i=true,loginPath:u="/account/login",authorizePath:p="/account/authorize",defaultRedirectPath:y="/account",language:m,useCustomAuthDomain:g}){if(o!==ut&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${ut}.`),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 d=new URL(n.url),l=d.protocol==="http:"?d.origin.replace("http","https"):d.origin,S=ir({requestUrl:l,defaultUrl:p,redirectUrl:s}),f=A=>void 0,v=c||(()=>(f(d.hostname),Fa(n,u))),h=Do(o,r),P=Ha(h,t),C=h("GRAPHQL"),R={};async function I({query:A,type:E,variables:_={}}){let x=await G();if(!x)throw v();new Date().getTime();let V=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":Ae,Origin:l,Authorization:x},body:JSON.stringify({query:A,variables:_})});let B=await V.text(),Y={url:C,response:V,type:E,query:A,queryVariables:_,errors:void 0,client:"customer"};if(!V.ok){if(V.status===401)throw Se(e),v();let U;try{U=X(B);}catch{U=[{message:B}];}Ne({...Y,errors:U});}try{let U=X(B),{errors:$}=U,ve=$?.map(({message:k,...J})=>new de(k,{...J,clientOperation:`customerAccount.${Y.type}`,requestId:V.headers.get("x-request-id"),queryVariables:_,query:A}));return {...U,...$&&{errors:ve}}}catch{Ne({...Y,errors:[{message:B}]});}}async function O(){if(!r)return false;let A=e.get(N),E=A?.accessToken,_=A?.expiresAt;if(!E||!_)return false;let x=K?.();try{await Po({locks:R,expiresAt:_,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:h("TOKEN_EXCHANGE"),httpsOrigin:l,debugInfo:{waitUntil:a,stackInfo:x,...ae(n)}});}catch{return false}return true}async function L(){if(!await O())throw v()}async function G(){if(await O())return e.get(N)?.accessToken}async function ft(A,E){return f(d.hostname),P(),A=Ce(A),st(A,"customer.mutate"),me(I({query:A,type:"mutation",...E}),{logErrors:i})}async function mt(A,E){return f(d.hostname),P(),A=Ce(A),at(A,"customer.query"),me(I({query:A,type:"query",...E}),{logErrors:i})}function qe(A){e.set(Pe,{...e.get(Pe),...A});}async function W(){let A=await G();if(A)return {...e.get(Pe),customerAccessToken:A}}return {i18n:{language:m??"EN"},login:async A=>{f(d.hostname),P();let E=new URL(h("AUTH")),_=Io(),x=dt();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",_),E.searchParams.append("nonce",x);let q=qa({contextLanguage:m??null,localeOverride:A?.locale??null,uiLocalesOverride:A?.uiLocales??null});q!=null&&E.searchParams.append("locale",q),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 re=So(),V=await vo(re);return e.set(N,{...e.get(N),codeVerifier:re,state:_,nonce:x,redirectPath:pt(n.url)||j(n,"Referer")||y}),E.searchParams.append("code_challenge",V),E.searchParams.append("code_challenge_method","S256"),$e(E.toString())},logout:async A=>{f(d.hostname),P();let E=e.get(N)?.idToken,_=ir({requestUrl:l,defaultUrl:l,redirectUrl:A?.postLogoutRedirectUri}),x=E?new URL(`${h("LOGOUT")}?${new URLSearchParams([["id_token_hint",E],["post_logout_redirect_uri",_]]).toString()}`).toString():_;Se(e);let q=A?.headers instanceof Headers?A?.headers:new Headers(A?.headers);return A?.keepSession||(e.destroy?q.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),$e(x,{headers:q})},isLoggedIn:O,handleAuthStatus:L,getAccessToken:G,getApiUrl:()=>C,mutate:ft,query:mt,authorize:async()=>{f(d.hostname),P();let A=d.searchParams.get("code"),E=d.searchParams.get("state");if(!A||!E)throw Se(e),new H("Unauthorized","No code or state parameter found in the redirect URL.");if(e.get(N)?.state!==E)throw Se(e),new H("Unauthorized","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");let _=t,x=new URLSearchParams;x.append("grant_type","authorization_code"),x.append("client_id",_),x.append("redirect_uri",S),x.append("code",A);let q=e.get(N)?.codeVerifier;if(!q)throw new H("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");x.append("code_verifier",q);let re={"content-type":"application/x-www-form-urlencoded","User-Agent":Ae,Origin:l};new Date().getTime();let Y=h("TOKEN_EXCHANGE"),U=await fetch(Y,{method:"POST",headers:re,body:x});if(!U.ok)throw new Response(await U.text(),{status:U.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:$,expires_in:ve,id_token:k,refresh_token:J}=await U.json(),gt=e.get(N)?.nonce,hr=await Eo(k);if(gt!==hr)throw new H("Unauthorized",`Returned nonce does not match: ${gt} !== ${hr}`);let Ar=$;r||(Ar=await To($,t,h("TOKEN_EXCHANGE"),l,{...ae(n)}));let jo=e.get(N)?.redirectPath;return e.set(N,{accessToken:Ar,expiresAt:new Date(new Date().getTime()+(ve-120)*1e3).getTime()+"",refreshToken:J,idToken:k}),$e(jo||y)},setBuyer:qe,getBuyer:W,UNSTABLE_setBuyer:A=>{Q("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),qe(A);},UNSTABLE_getBuyer:()=>(Q("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),W())}}function Ha(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 qa(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("-"),o=r[0],n=r[1];return n?`${o}-${n.toUpperCase()}`:o}function Ba(e,t){let{env:r,request:o,cache:n,waitUntil:a,i18n:s,session:c,logErrors:i,storefront:u={},customerAccount:p,cart:y={},buyerIdentity:m}=e;c||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),p?.unstableB2b&&Q("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:g}=lo({cache:n,waitUntil:a,i18n:s,logErrors:i,storefrontHeaders:u.headers||Xr(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}),d=ur({session:c,request:o,waitUntil:a,logErrors:i,customerApiVersion:p?.apiVersion,authUrl:p?.authUrl,customAuthStatusHandler:p?.customAuthStatusHandler,useCustomAuthDomain:p?.useCustomAuthDomain,language:s?.language,customerAccountId:r.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,shopId:r.SHOP_ID}),l=tr({getCartId:y.getId||Mt(o.headers),setCartId:y.setId||Vt(),cartQueryFragment:y.queryFragment,cartMutateFragment:y.mutateFragment,customMethods:y.customMethods,buyerIdentity:m,storefront:g,customerAccount:d}),S=new RouterContextProvider;S.set(Me,g),S.set(rr,l),S.set(or,d),S.set(nr,r),S.set(ar,c),a&&S.set(sr,a);let f={storefront:g,cart:l,customerAccount:d,env:r,session:c,waitUntil:a,...t||{}};return new Proxy(S,{get(h,P,C){if(P in h){let R=h[P];return typeof R=="function"?R.bind(h):R}return P in f?f[P]:Reflect.get(h,P,C)},has(h,P){return P in h||P in f},ownKeys(h){return [...Reflect.ownKeys(h),...Object.keys(f)]},getOwnPropertyDescriptor(h,P){if(P in h)return Reflect.getOwnPropertyDescriptor(h,P);if(P in f)return {enumerable:true,configurable:true,writable:false,value:f[P]}}})}function Wa({build:e,mode:t,poweredByHeader:r=true,getLoadContext:o,collectTrackingInformation:n=true,proxyStandardRoutes:a=true}){let s=createRequestHandler(e,t),c=r?i=>i.headers.append("powered-by","Shopify, Hydrogen"):void 0;return async i=>{let u=i.method;if((u==="GET"||u==="HEAD")&&i.body)return new Response(`${u} requests cannot have a body`,{status:400});let p=new URL(i.url);if(p.pathname.includes("//"))return new Response(null,{status:301,headers:{location:p.pathname.replace(/\/+/g,"/")}});let y=await o?.(i),m=y?.storefront||y?.get?.(Me);if(a){if(m||Q("[h2:createRequestHandler] Storefront instance is required to proxy standard routes."),m?.isStorefrontApiUrl(i)){let d=await m.forward(i);return c?.(d),d}if(m?.isMcpUrl(i)){let d=await m.forwardMcp(i);return c?.(d),d}}let g=await s(i,y);if(m&&a){n&&m.setCollectedSubrequestHeaders(g);let d=i.headers.get("sec-fetch-dest");(d&&d==="document"||i.headers.get("accept")?.includes("text/html"))&&Te(g,{[Be]:"1"});}return c?.(g),g}}var Oo=createContext(void 0),xo=Oo.Provider,dr=()=>useContext(Oo);function za(e){let t=dt(),r=Xa(t,e);return {nonce:t,header:r,NonceProvider:({children:n})=>createElement(xo,{value:t},n)}}function Xa(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 i={baseUri:["'self'"],defaultSrc:["'self'",n,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:a,connectSrc:s},u=Object.assign({},i,o);for(let p in i){let y=o[p];p&&y&&(u[p]=Za(y,i[p]));}return u.scriptSrc instanceof Array?u.scriptSrc=[...u.scriptSrc.filter(p=>!p.startsWith("'nonce")),n]:u.defaultSrc instanceof Array&&(u.defaultSrc=[...u.defaultSrc.filter(p=>!p.startsWith("'nonce")),n]),Ja({directives:u})}function Za(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 rs=forwardRef((e,t)=>{let{waitForHydration:r,src:o,...n}=e,a=dr();return r?jsx(os,{src:o,options:n}):jsx("script",{suppressHydrationWarning:true,...n,src:o,nonce:a,ref:t})});function os({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 ns(e){return e;}function ss(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 is({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 ls({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null),namespace:r=""}){let [o,n]=useState(false),a=useNavigation(),s=useLocation();useNavigate();useEffect(()=>{a.state==="idle"&&n(false);},[a.state]);let{endCursor:i,hasNextPage:u,hasPreviousPage:p,nextPageUrl:y,nodes:m,previousPageUrl:g,startCursor:d}=ys(e,r),l=useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:i,hasPreviousPage:p,hasNextPage:u,startCursor:d},nodes:m}}}),[i,u,p,d,m,r,s.state]),S=useMemo(()=>forwardRef(function(h,P){return u?createElement(Link,{preventScrollReset:true,...h,to:y,state:l,replace:true,ref:P,onClick:()=>n(true)}):null}),[u,y,l]),f=useMemo(()=>forwardRef(function(h,P){return p?createElement(Link,{preventScrollReset:true,...h,to:g,state:l,replace:true,ref:P,onClick:()=>n(true)}):null}),[p,g,l]);return t({state:l,hasNextPage:u,hasPreviousPage:p,isLoading:o,nextPageUrl:y,nodes:m,previousPageUrl:g,NextLink:S,PreviousLink:f})}function lt(e,t){let r=new URLSearchParams(e);return Object.keys(t?.pagination||{}).forEach(n=>{let a=n===""?"":`${n}_`,s=`${a}cursor`,c=`${a}direction`;r.delete(s),r.delete(c);}),r.toString()}function Fe(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 ys(e,t=""){e.pageInfo||Fe("pageInfo"),typeof e.pageInfo.startCursor>"u"&&Fe("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&Fe("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&Fe("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&Fe("pageInfo.hasPreviousPage");let r=useNavigation(),o=useNavigate(),{state:n,search:a,pathname:s}=useLocation(),c=t?`${t}_cursor`:"cursor",i=t?`${t}_direction`:"direction",y=new URLSearchParams(a).get(i)==="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]),g=useMemo(()=>{let f=globalThis?.window?.__hydrogenHydrated,v=n?.pagination?.[t]?.pageInfo,h=!f||v?.startCursor===void 0?e.pageInfo.startCursor:v.startCursor,P=!f||v?.endCursor===void 0?e.pageInfo.endCursor:v.endCursor,C=!f||v?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:v.hasPreviousPage,R=!f||v?.hasNextPage===void 0?e.pageInfo.hasNextPage:v.hasNextPage;return n?.pagination?.[t]?.nodes&&(y?(h=e.pageInfo.startCursor,C=e.pageInfo.hasPreviousPage):(P=e.pageInfo.endCursor,R=e.pageInfo.hasNextPage)),{startCursor:h,endCursor:P,hasPreviousPage:C,hasNextPage:R}},[y,n,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),d=useRef({params:lt(a,n),pathname:s});useEffect(()=>{window.__hydrogenHydrated=true;},[]),useEffect(()=>{let f=lt(a,n),v=d.current.params;(s!==d.current.pathname||f!==v)&&!(r.state==="idle"&&!r.location)&&(d.current={pathname:s,params:lt(a,n)},o(`${s}?${lt(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(i,"previous"),g.startCursor&&f.set(c,g.startCursor),`?${f.toString()}`},[a,g.startCursor]),S=useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"next"),g.endCursor&&f.set(c,g.endCursor),`?${f.toString()}`},[a,g.endCursor]);return {...g,previousPageUrl:l,nextPageUrl:S,nodes:m}}function fs(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r,namespace:o=""}=t,n=new URLSearchParams(new URL(e.url).search),a=o?`${o}_cursor`:"cursor",s=o?`${o}_direction`:"direction",c=n.get(a)??void 0;return (n.get(s)==="previous"?"previous":"next")==="previous"?{last:r,startCursor:c??null}:{first:r,endCursor:c??null}}function hs(e,t){let r=useNavigation(),[o,n]=useState([]);if(useEffect(()=>{Promise.resolve(t).then(a=>{a&&n(a instanceof Array?a:a.product?.variants?.nodes||[]);}).catch(a=>{reportError(new Error("[h2:error:useOptimisticVariant] An error occurred while resolving the variants for the optimistic product hook.",{cause:a}));});},[JSON.stringify(t)]),r.state==="loading"){let a=new URLSearchParams(r.location.search),s=false,c=o.find(i=>i.selectedOptions?i.selectedOptions.every(u=>a.get(u.name)===u.value):(s||(s=true,reportError(new Error("[h2:error:useOptimisticVariant] The optimistic product hook requires your product query to include variants with the selectedOptions field."))),false));if(c)return {...c,isOptimistic:true}}return e}function Is({handle:e,options:t=[],variants:r=[],productPath:o="products",waitForNavigation:n=false,selectedVariant:a,children:s}){let c=t;c[0]?.values&&(Q("[h2:warn:VariantSelector] product.options.values is deprecated. Use product.options.optionValues instead."),c[0]&&!c[0].optionValues&&(c=t.map(d=>({...d,optionValues:d.values?.map(l=>({name:l}))||[]}))));let i=r instanceof Array?r:flattenConnection(r),{searchParams:u,path:p,alreadyOnProductPage:y}=Es(e,o,n),m=c.filter(d=>d?.optionValues?.length===1),g=a?a?.selectedOptions?.reduce((d,l)=>(d[l.name]=l.value,d),{}):{};return createElement(Fragment$1,null,...useMemo(()=>c.map(d=>{let l,S=[];for(let f of d.optionValues){let v=new URLSearchParams(y?u:void 0);v.set(d.name,f.name),m.forEach(I=>{I.optionValues[0].name&&v.set(I.name,I.optionValues[0].name);});let h=i.find(I=>I?.selectedOptions?.every(O=>(v.get(O?.name)||g?.[O?.name])===O?.value)),P=u.get(d.name);!P&&a&&(P=g?.[d.name]||null);let C=P?P===f.name:false;C&&(l=f.name);let R="?"+v.toString();S.push({value:f.name,optionValue:f,isAvailable:h?h.availableForSale:true,to:p+R,search:R,isActive:C,variant:h});}return s({option:{name:d.name,value:l,values:S}})}),[c,i,s]))}var Ts=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 Es(e,t,r){let{pathname:o,search:n}=useLocation(),a=useNavigation();return useMemo(()=>{let s=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(o),c=s&&s.length>0;t=t.startsWith("/")?t.substring(1):t;let i=c?`${s[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(r||a.state!=="loading"?n:a.location.search),alreadyOnProductPage:i===o,path:i}},[o,n,r,e,t,a])}function bs(){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,unstable_subResourceIntegrity:false}}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
|
|
540
|
+
${O}
|
|
541
|
+
${_}
|
|
542
|
+
`;function nr(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:n,cartQueryFragment:a,cartMutateFragment:s,buyerIdentity:c}=e,i=t(),u=()=>i||t(),d={storefront:o,getCartId:u,cartFragment:s,customerAccount:n},y=Bt(d),m=async function(...p){p[0].buyerIdentity={...c,...p[0].buyerIdentity};let l=await y(...p);return i=l?.cart?.id,l},g={get:Gt({storefront:o,customerAccount:n,getCartId:u,cartFragment:a}),getCartId:u,setCartId:r,create:m,addLines:async(p,l)=>{let P=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)(P,l):await m({lines:P,buyerIdentity:c},l)},updateLines:Wt(d),removeLines:jt(d),updateDiscountCodes:async(p,l)=>i||l?.cartId?await Kt(d)(p,l):await m({discountCodes:p},l),updateGiftCardCodes:async(p,l)=>i||l?.cartId?await tr(d)(p,l):await m({giftCardCodes:p},l),addGiftCardCodes:rr(d),removeGiftCardCodes:or(d),updateBuyerIdentity:async(p,l)=>i||l?.cartId?await Yt(d)(p,l):await m({buyerIdentity:p},l),updateNote:async(p,l)=>i||l?.cartId?await Jt(d)(p,l):await m({note:p},l),updateSelectedDeliveryOption:zt(d),updateAttributes:async(p,l)=>i||l?.cartId?await Xt(d)(p,l):await m({attributes:p},l),setMetafields:async(p,l)=>i||l?.cartId?await Zt(d)(p,l):await m({metafields:p},l),deleteMetafield:er(d),addDeliveryAddresses:ho(d),removeDeliveryAddresses:Ao(d),updateDeliveryAddresses:So(d),replaceDeliveryAddresses:Po(d)};return "customMethods"in e?{...g,...e.customMethods??{}}:g}function _a(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 c of s.inputs.lines){if(!c.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let i=o.find(u=>u.merchandise.id===c.selectedVariant?.id);n=true,i?(i.quantity=(i.quantity||1)+(c.quantity||1),i.isOptimistic=true):o.unshift({id: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=o.findIndex(u=>u.id===c);if(i!==-1){if(dt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${c}' but it doesn't exist in the cart`);}else if(s.action===re.ACTIONS.LinesUpdate)for(let c of s.inputs.lines){let i=o.findIndex(u=>c.id===u.id);if(i>-1){if(dt(o[i].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}o[i].quantity=c.quantity,o[i].quantity===0&&o.splice(i,1),n=true;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${c.id}' but it doesn't exist in the cart`);}}return n&&(r.isOptimistic=n),r.totalQuantity=o.reduce((a,s)=>a+s.quantity,0),r}var Ua="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function La({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||Ua)}var He=createContext$1(),ar=createContext$1(),sr=createContext$1(),ir=createContext$1(),cr=createContext$1(),ur=createContext$1(),ka={storefront:He,cart:ar,customerAccount:sr,env:ir,session:cr,waitUntil:ur};var lt="2026-04",ve=`Shopify Hydrogen ${Me}`,vo="30243aa5-17c1-465a-8493-944bcc4e88aa",F="customerAccount",Re="buyer";var B=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function $e(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 Va({session:e,customerAccountId:t,customerAccountTokenExchangeUrl:r,httpsOrigin:o,debugInfo:n}){let a=new URLSearchParams,s=e.get(F),c=s?.refreshToken,i=s?.idToken;if(!c)throw new B("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":ve,Origin:o};new Date().getTime();let y=r,m=await fetch(y,{method:"POST",headers:u,body:a});if(!m.ok){let P=await m.text();throw new Response(P,{status:m.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:g,expires_in:p,refresh_token:l}=await m.json();if(!g||g.length===0)throw new B("Unauthorized","Invalid access token received.");e.set(F,{accessToken:g,expiresAt:new Date(new Date().getTime()+(p-120)*1e3).getTime()+"",refreshToken:l,idToken:i});}function Ie(e){e.unset(F),e.unset(Re);}async function Ro({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=Va({session:r,customerAccountId:o,customerAccountTokenExchangeUrl:n,httpsOrigin:a,debugInfo:s})),await e.refresh,delete e.refresh;}catch(c){throw Ie(r),c&&c.status!==401?c:new B("Unauthorized","Login before querying the Customer Account API.")}}function Io(){let e=Na();return Eo(e)}async function To(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=Ma(t);return Eo(r)}function Na(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function Eo(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ma(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function bo(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function wo(e,t,r,o,n){let a=t;if(!e)throw new B("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",vo),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":ve,Origin:o};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 B(y.error_description);return y.access_token}function Do(e){return Fa(e).payload.nonce}function Fa(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 yt(){return qa(Ha())}function Ha(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function qa(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}function ft(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(xo(e,a))return a;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${a}`);}}function xo(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return false}}function dr({requestUrl:e,defaultUrl:t,redirectUrl:r}){let o=e,n=Oo(e,t),a=r?Oo(e,r):n;return xo(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 Oo(e,t){return $a(t)?new URL(t):new URL(t,new URL(e).origin)}function $a(e){try{return new URL(e),!0}catch{return false}}function _o(e,t){let r=`https://shopify.com/${t}`,o=`https://shopify.com/authentication/${t}`;return function(a){switch(a){case "CA_BASE_URL":return r;case "CA_BASE_AUTH_URL":return o;case "GRAPHQL":return `${r}/account/customer/api/${e}/graphql`;case "AUTH":return `${o}/oauth/authorize`;case "LOGIN_SCOPE":return t?"openid email customer-account-api:full":"openid email https://api.customers.com/auth/customer.graphql";case "TOKEN_EXCHANGE":return `${o}/oauth/token`;case "LOGOUT":return `${o}/logout`}}}function Ga(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 $e(n)}function lr({session:e,customerAccountId:t,shopId:r,customerApiVersion:o=lt,request:n,waitUntil:a,authUrl:s,customAuthStatusHandler:c,logErrors:i=true,loginPath:u="/account/login",authorizePath:d="/account/authorize",defaultRedirectPath:y="/account",language:m,useCustomAuthDomain:g}){if(o!==lt&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${lt}.`),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,P=dr({requestUrl:l,defaultUrl:d,redirectUrl:s}),f=A=>void 0,R=c||(()=>(f(p.hostname),Ga(n,u))),h=_o(o,r),S=Ba(h,t),C=h("GRAPHQL"),I={};async function v({query:A,type:E,variables:k={}}){let L=await W();if(!L)throw R();new Date().getTime();let q=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":ve,Origin:l,Authorization:L},body:JSON.stringify({query:A,variables:k})});let j=await q.text(),z={url:C,response:q,type:E,query:A,queryVariables:k,errors:void 0,client:"customer"};if(!q.ok){if(q.status===401)throw Ie(e),R();let N;try{N=te(j);}catch{N=[{message:j}];}Fe({...z,errors:N});}try{let N=te(j),{errors:$}=N,Te=$?.map(({message:M,...X})=>new ye(M,{...X,clientOperation:`customerAccount.${z.type}`,requestId:q.headers.get("x-request-id"),queryVariables:k,query:A}));return {...N,...$&&{errors:Te}}}catch{Fe({...z,errors:[{message:j}]});}}async function U(){if(!r)return false;let A=e.get(F),E=A?.accessToken,k=A?.expiresAt;if(!E||!k)return false;let L=J?.();try{await Ro({locks:I,expiresAt:k,session:e,customerAccountId:t,customerAccountTokenExchangeUrl:h("TOKEN_EXCHANGE"),httpsOrigin:l,debugInfo:{waitUntil:a,stackInfo:L,...ce(n)}});}catch{return false}return true}async function V(){if(!await U())throw R()}async function W(){if(await U())return e.get(F)?.accessToken}async function Ct(A,E){return f(p.hostname),S(),A=Se(A),ut(A,"customer.mutate"),he(v({query:A,type:"mutation",...E}),{logErrors:i})}async function ht(A,E){return f(p.hostname),S(),A=Se(A),ct(A,"customer.query"),he(v({query:A,type:"query",...E}),{logErrors:i})}function Qe(A){e.set(Re,{...e.get(Re),...A});}async function K(){let A=await W();if(A)return {...e.get(Re),customerAccessToken:A}}return {i18n:{language:m??"EN"},login:async A=>{f(p.hostname),S();let E=new URL(h("AUTH")),k=bo(),L=yt();E.searchParams.set("client_id",t),E.searchParams.set("scope","openid email"),E.searchParams.append("response_type","code"),E.searchParams.append("redirect_uri",P),E.searchParams.set("scope",h("LOGIN_SCOPE")),E.searchParams.append("state",k),E.searchParams.append("nonce",L);let Q=Qa({contextLanguage:m??null,localeOverride:A?.locale??null,uiLocalesOverride:A?.uiLocales??null});Q!=null&&E.searchParams.append("locale",Q),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 ae=Io(),q=await To(ae);return e.set(F,{...e.get(F),codeVerifier:ae,state:k,nonce:L,redirectPath:ft(n.url)||Y(n,"Referer")||y}),E.searchParams.append("code_challenge",q),E.searchParams.append("code_challenge_method","S256"),$e(E.toString())},logout:async A=>{f(p.hostname),S();let E=e.get(F)?.idToken,k=dr({requestUrl:l,defaultUrl:l,redirectUrl:A?.postLogoutRedirectUri}),L=E?new URL(`${h("LOGOUT")}?${new URLSearchParams([["id_token_hint",E],["post_logout_redirect_uri",k]]).toString()}`).toString():k;Ie(e);let Q=A?.headers instanceof Headers?A?.headers:new Headers(A?.headers);return A?.keepSession||(e.destroy?Q.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),$e(L,{headers:Q})},isLoggedIn:U,handleAuthStatus:V,getAccessToken:W,getApiUrl:()=>C,mutate:Ct,query:ht,authorize:async()=>{f(p.hostname),S();let A=p.searchParams.get("code"),E=p.searchParams.get("state");if(!A||!E)throw Ie(e),new B("Unauthorized","No code or state parameter found in the redirect URL.");if(e.get(F)?.state!==E)throw Ie(e),new B("Unauthorized","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");let k=t,L=new URLSearchParams;L.append("grant_type","authorization_code"),L.append("client_id",k),L.append("redirect_uri",P),L.append("code",A);let Q=e.get(F)?.codeVerifier;if(!Q)throw new B("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");L.append("code_verifier",Q);let ae={"content-type":"application/x-www-form-urlencoded","User-Agent":ve,Origin:l};new Date().getTime();let z=h("TOKEN_EXCHANGE"),N=await fetch(z,{method:"POST",headers:ae,body:L});if(!N.ok)throw new Response(await N.text(),{status:N.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:$,expires_in:Te,id_token:M,refresh_token:X}=await N.json(),At=e.get(F)?.nonce,Pr=await Do(M);if(At!==Pr)throw new B("Unauthorized",`Returned nonce does not match: ${At} !== ${Pr}`);let vr=$;r||(vr=await wo($,t,h("TOKEN_EXCHANGE"),l,{...ce(n)}));let Jo=e.get(F)?.redirectPath;return e.set(F,{accessToken:vr,expiresAt:new Date(new Date().getTime()+(Te-120)*1e3).getTime()+"",refreshToken:X,idToken:M}),$e(Jo||y)},setBuyer:Qe,getBuyer:K,UNSTABLE_setBuyer:A=>{ee("[h2:warn:customerAccount] `customerAccount.UNSTABLE_setBuyer` is deprecated. Please use `customerAccount.setBuyer`."),Qe(A);},UNSTABLE_getBuyer:()=>(ee("[h2:warn:customerAccount] `customerAccount.UNSTABLE_getBuyer` is deprecated. Please use `customerAccount.getBuyer`."),K())}}function Ba(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 Qa(e){return e.localeOverride!=null?pr(e.localeOverride):e.uiLocalesOverride!=null?pr(e.uiLocalesOverride):e.contextLanguage!=null?pr(e.contextLanguage):null}function pr(e){let r=e.toLowerCase().replaceAll("_","-").split("-"),o=r[0],n=r[1];return n?`${o}-${n.toUpperCase()}`:o}function ja(e,t){let{env:r,request:o,cache:n,waitUntil:a,i18n:s,session:c,logErrors:i,storefront:u={},customerAccount:d,cart:y={},buyerIdentity:m}=e;c||console.warn("[h2:warn:createHydrogenContext] A session object is required to create hydrogen context."),d?.unstableB2b&&ee("[h2:warn:createHydrogenContext] `customerAccount.unstableB2b` is now stable. Please remove the `unstableB2b` option.");let{storefront:g}=mo({cache:n,waitUntil:a,i18n:s,logErrors:i,storefrontHeaders:u.headers||to(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=lr({session:c,request:o,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=nr({getCartId:y.getId||Ht(o.headers),setCartId:y.setId||qt(),cartQueryFragment:y.queryFragment,cartMutateFragment:y.mutateFragment,customMethods:y.customMethods,buyerIdentity:m,storefront:g,customerAccount:p}),P=new RouterContextProvider;P.set(He,g),P.set(ar,l),P.set(sr,p),P.set(ir,r),P.set(cr,c),a&&P.set(ur,a);let f={storefront:g,cart:l,customerAccount:p,env:r,session:c,waitUntil:a,...t||{}};return new Proxy(P,{get(h,S,C){if(S in h){let I=h[S];return typeof I=="function"?I.bind(h):I}return S in f?f[S]:Reflect.get(h,S,C)},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 Ya({build:e,mode:t,poweredByHeader:r=true,getLoadContext:o,collectTrackingInformation:n=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 o?.(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 m=await a(c,d);n&&y.setCollectedSubrequestHeaders(m);let g=c.headers.get("sec-fetch-dest");return (g&&g==="document"||c.headers.get("accept")?.includes("text/html"))&&we(m,{[je]:"1"}),s?.(m),m}}var Uo=createContext(void 0),Lo=Uo.Provider,yr=()=>useContext(Uo);function es(e){let t=yt(),r=ts(t,e);return {nonce:t,header:r,NonceProvider:({children:n})=>createElement(Lo,{value:t},n)}}function ts(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 i={baseUri:["'self'"],defaultSrc:["'self'",n,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:a,connectSrc:s},u=Object.assign({},i,o);for(let d in i){let y=o[d];d&&y&&(u[d]=rs(y,i[d]));}return u.scriptSrc instanceof Array?u.scriptSrc=[...u.scriptSrc.filter(d=>!d.startsWith("'nonce")),n]:u.defaultSrc instanceof Array&&(u.defaultSrc=[...u.defaultSrc.filter(d=>!d.startsWith("'nonce")),n]),Za({directives:u})}function rs(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 as=forwardRef((e,t)=>{let{waitForHydration:r,src:o,...n}=e,a=yr();return r?jsx(ss,{src:o,options:n}):jsx("script",{suppressHydrationWarning:true,...n,src:o,nonce:a,ref:t})});function ss({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 is(e){return e;}function us(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 ds({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 ms({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null),namespace:r=""}){let [o,n]=useState(false),a=useNavigation(),s=useLocation();useNavigate();useEffect(()=>{a.state==="idle"&&n(false);},[a.state]);let{endCursor:i,hasNextPage:u,hasPreviousPage:d,nextPageUrl:y,nodes:m,previousPageUrl:g,startCursor:p}=gs(e,r),l=useMemo(()=>({...s.state,pagination:{...s.state?.pagination||{},[r]:{pageInfo:{endCursor:i,hasPreviousPage:d,hasNextPage:u,startCursor:p},nodes:m}}}),[i,u,d,p,m,r,s.state]),P=useMemo(()=>forwardRef(function(h,S){return u?createElement(Link,{preventScrollReset:true,...h,to:y,state:l,replace:true,ref:S,onClick:()=>n(true)}):null}),[u,y,l]),f=useMemo(()=>forwardRef(function(h,S){return d?createElement(Link,{preventScrollReset:true,...h,to:g,state:l,replace:true,ref:S,onClick:()=>n(true)}):null}),[d,g,l]);return t({state:l,hasNextPage:u,hasPreviousPage:d,isLoading:o,nextPageUrl:y,nodes:m,previousPageUrl:g,NextLink:P,PreviousLink:f})}function mt(e,t){let r=new URLSearchParams(e);return Object.keys(t?.pagination||{}).forEach(n=>{let a=n===""?"":`${n}_`,s=`${a}cursor`,c=`${a}direction`;r.delete(s),r.delete(c);}),r.toString()}function 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 gs(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(),c=t?`${t}_cursor`:"cursor",i=t?`${t}_direction`:"direction",y=new URLSearchParams(a).get(i)==="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]),g=useMemo(()=>{let f=globalThis?.window?.__hydrogenHydrated,R=n?.pagination?.[t]?.pageInfo,h=!f||R?.startCursor===void 0?e.pageInfo.startCursor:R.startCursor,S=!f||R?.endCursor===void 0?e.pageInfo.endCursor:R.endCursor,C=!f||R?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:R.hasPreviousPage,I=!f||R?.hasNextPage===void 0?e.pageInfo.hasNextPage:R.hasNextPage;return n?.pagination?.[t]?.nodes&&(y?(h=e.pageInfo.startCursor,C=e.pageInfo.hasPreviousPage):(S=e.pageInfo.endCursor,I=e.pageInfo.hasNextPage)),{startCursor:h,endCursor:S,hasPreviousPage:C,hasNextPage:I}},[y,n,t,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),p=useRef({params:mt(a,n),pathname:s});useEffect(()=>{window.__hydrogenHydrated=true;},[]),useEffect(()=>{let f=mt(a,n),R=p.current.params;(s!==p.current.pathname||f!==R)&&!(r.state==="idle"&&!r.location)&&(p.current={pathname:s,params:mt(a,n)},o(`${s}?${mt(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(i,"previous"),g.startCursor&&f.set(c,g.startCursor),`?${f.toString()}`},[a,g.startCursor]),P=useMemo(()=>{let f=new URLSearchParams(a);return f.set(i,"next"),g.endCursor&&f.set(c,g.endCursor),`?${f.toString()}`},[a,g.endCursor]);return {...g,previousPageUrl:l,nextPageUrl:P,nodes:m}}function Cs(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r,namespace:o=""}=t,n=new URLSearchParams(new URL(e.url).search),a=o?`${o}_cursor`:"cursor",s=o?`${o}_direction`:"direction",c=n.get(a)??void 0;return (n.get(s)==="previous"?"previous":"next")==="previous"?{last:r,startCursor:c??null}:{first:r,endCursor:c??null}}function Ps(e,t){let r=useNavigation(),[o,n]=useState([]);if(useEffect(()=>{Promise.resolve(t).then(a=>{a&&n(a instanceof Array?a:a.product?.variants?.nodes||[]);}).catch(a=>{reportError(new Error("[h2:error:useOptimisticVariant] An error occurred while resolving the variants for the optimistic product hook.",{cause:a}));});},[JSON.stringify(t)]),r.state==="loading"){let a=new URLSearchParams(r.location.search),s=false,c=o.find(i=>i.selectedOptions?i.selectedOptions.every(u=>a.get(u.name)===u.value):(s||(s=true,reportError(new Error("[h2:error:useOptimisticVariant] The optimistic product hook requires your product query to include variants with the selectedOptions field."))),false));if(c)return {...c,isOptimistic:true}}return e}function bs({handle:e,options:t=[],variants:r=[],productPath:o="products",waitForNavigation:n=false,selectedVariant:a,children:s}){let c=t;c[0]?.values&&(ee("[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}=Ds(e,o,n),m=c.filter(p=>p?.optionValues?.length===1),g=a?a?.selectedOptions?.reduce((p,l)=>(p[l.name]=l.value,p),{}):{};return createElement(Fragment$1,null,...useMemo(()=>c.map(p=>{let l,P=[];for(let f of p.optionValues){let R=new URLSearchParams(y?u:void 0);R.set(p.name,f.name),m.forEach(v=>{v.optionValues[0].name&&R.set(v.name,v.optionValues[0].name);});let h=i.find(v=>v?.selectedOptions?.every(U=>(R.get(U?.name)||g?.[U?.name])===U?.value)),S=u.get(p.name);!S&&a&&(S=g?.[p.name]||null);let C=S?S===f.name:false;C&&(l=f.name);let I="?"+R.toString();P.push({value:f.name,optionValue:f,isAvailable:h?h.availableForSale:true,to:d+I,search:I,isActive:C,variant:h});}return s({option:{name:p.name,value:l,values:P}})}),[c,i,s]))}var ws=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 Ds(e,t,r){let{pathname:o,search:n}=useLocation(),a=useNavigation();return useMemo(()=>{let s=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(o),c=s&&s.length>0;t=t.startsWith("/")?t.substring(1):t;let i=c?`${s[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(r||a.state!=="loading"?n:a.location.search),alreadyOnProductPage:i===o,path:i}},[o,n,r,e,t,a])}function Os(){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,unstable_subResourceIntegrity:false}}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
|
|
575
543
|
Reason: Requires major CLI infrastructure modernization.
|
|
576
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.
|
|
577
545
|
Reason: React Router plugin incompatibility with Hydrogen CLI build pipeline.
|
|
@@ -581,7 +549,7 @@ Alternative: Route-level code splitting via v8_splitRouteModules is enabled.`);i
|
|
|
581
549
|
Reason: Hydrogen CLI bypasses React Router buildEnd hook execution.
|
|
582
550
|
Workaround: Use external build scripts or package.json post-build hooks.`);if(e.future?.unstable_subResourceIntegrity===true)throw new Error(`[Hydrogen Preset] unstable_subResourceIntegrity cannot be enabled.
|
|
583
551
|
Reason: Conflicts with Hydrogen CSP nonce-based authentication.
|
|
584
|
-
Impact: Would break Content Security Policy and cause script execution failures.`)}}}var
|
|
552
|
+
Impact: Would break Content Security Policy and cause script execution failures.`)}}}var Us=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 Ls=async function({request:t,context:r}){let o=r.storefront,n=r.customerAccount,a=new URL(t.url);if(!o)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let s={};if(o){let u="X-Shopify-Storefront-Access-Token";s.storefront={name:"Storefront API",authHeader:u,accessToken:o.getPublicTokenHeaders()[u],apiUrl:o.getApiUrl(),icon:"SF"};}if(n){let u=await(await fetch(a.origin+"/graphiql/customer-account.schema.json")).json(),d=await n.getAccessToken();u&&(s["customer-account"]={name:"Customer Account API",value:u,authHeader:"Authorization",accessToken:d,apiUrl:n.getApiUrl(),icon:"CA"});}let c="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",i=String.raw;return new Response(i`
|
|
585
553
|
<!DOCTYPE html>
|
|
586
554
|
<html lang="en">
|
|
587
555
|
<head>
|
|
@@ -900,7 +868,7 @@ Impact: Would break Content Security Policy and cause script execution failures.
|
|
|
900
868
|
</div>
|
|
901
869
|
</body>
|
|
902
870
|
</html>
|
|
903
|
-
`,{status:200,headers:{"content-type":"text/html"}})};async function
|
|
871
|
+
`,{status:200,headers:{"content-type":"text/html"}})};async function ks(e){let{storefront:t,request:r,noAdminRedirect:o,matchQueryParams:n,response:a=new Response("Not Found",{status:404})}=e,s=new URL(r.url),{pathname:c,searchParams:i}=s,u=i.has("_data");i.delete("redirect"),i.delete("return_to"),i.delete("_data");let d=(n?s.toString().replace(s.origin,""):c).toLowerCase();if(s.pathname==="/admin"&&!o)return Cr(`${t.getShopifyDomain()}/admin`,u,i,n);try{let{urlRedirects:y}=await t.query(Vs,{variables:{query:"path:"+d.replace(/\/+$/,"")}}),m=y?.edges?.[0]?.node?.target;if(m)return Cr(m,u,i,n);let g=ft(r.url);if(g)return Cr(g,u,i,n)}catch(y){console.error(`Failed to fetch redirects from Storefront API for route ${d}`,y);}return a}var gr="https://example.com";function Cr(e,t,r,o){let n=new URL(e,gr);if(!o)for(let[a,s]of r)n.searchParams.append(a,s);return t?new Response(null,{status:200,headers:{"X-Remix-Redirect":n.toString().replace(gr,""),"X-Remix-Status":"301"}}):new Response(null,{status:301,headers:{location:n.toString().replace(gr,"")}})}var Vs=`#graphql
|
|
904
872
|
query redirects($query: String) {
|
|
905
873
|
urlRedirects(first: 1, query: $query) {
|
|
906
874
|
edges {
|
|
@@ -910,24 +878,24 @@ Impact: Would break Content Security Policy and cause script execution failures.
|
|
|
910
878
|
}
|
|
911
879
|
}
|
|
912
880
|
}
|
|
913
|
-
`;var
|
|
881
|
+
`;var Ns={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Ms=/[&><\u2028\u2029]/g;function Qo(e){return e.replace(Ms,t=>Ns[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 Wo(e){let t=[];for(let r of Object.keys(e))switch(r){case "title":{let o=ne(oe.title,e.title),n=Ar(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",c=a?{url:a?.url,secure_url:a?.url,type:Sr(a.url),width:a?.width,height:a?.height,alt:a?.altText}:{};for(let i of Object.keys(c))c[i]&&(o=c[i],t.push(H("meta",{property:`og:${s}:${i}`,content:o},c.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,(c,i)=>typeof i=="string"?Qo(i):i)},`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:c}=n,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:o,maxSnippet:n,maxVideoPreview:a,noArchive:s,noFollow:c,noImageIndex:i,noIndex:u,noSnippet:d,noTranslate:y,unavailableAfter:m}=e.robots,g=[s&&"noarchive",i&&"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")+","+(c?"nofollow":"follow");for(let l of g)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=hr(o),o):e==="script"?(o.children=typeof t.children=="string"?t.children:"",o.key=hr(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=hr(o,r),o)}function hr(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 Ar(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function Sr(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 Fs(...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=Ar(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 c=s.type||"image",i=s?{url:s?.url,secure_url:s?.url,type:Sr(s.url),width:s?.width,height:s?.height,alt:s?.altText}:{};for(let u of Object.keys(i))i[u]&&(n=i[u],t.push({property:`og:${c}:${u}`,content:n}));}break}case "jsonLd":{let n=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:c,default:i}=a,u=s?`${s}${i?"-default":""}`:void 0;t.push({tagName:"link",rel:"alternate",hrefLang:u,href:c});}break}case "robots":{if(!r.robots)break;let{maxImagePreview:n,maxSnippet:a,maxVideoPreview:s,noArchive:c,noFollow:i,noImageIndex:u,noIndex:d,noSnippet:y,noTranslate:m,unavailableAfter:g}=r.robots,p=[c&&"noarchive",u&&"noimageindex",y&&"nosnippet",m&&"notranslate",n&&`max-image-preview:${n}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,g&&`unavailable_after:${g}`],l=(d?"noindex":"index")+","+(i?"nofollow":"follow");for(let P of p)P&&(l+=`,${P}`);t.push({name:"robots",content:l});break}}return t}var Qs=lazy(()=>import('./log-seo-tags-TY72EQWZ.js'));function Ws({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:c,...i}=s,u={...i,...r},d=c?.seo,y=i?.data?.seo;return !d&&!y?[]:d?gt(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:n,loggerMarkup:a}=useMemo(()=>{let s=Wo(o),c=s.map(u=>u.tag==="script"?createElement(u.tag,{...u.props,key:u.key,dangerouslySetInnerHTML:{__html:u.children}}):createElement(u.tag,{...u.props,key:u.key},u.children)),i=createElement(Suspense,{fallback:null},createElement(Qs,{headTags:s}));return {html:c,loggerMarkup:i}},[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 Ks(e){return jsx(ShopPayButton,{channel:"hydrogen",...e})}var Js=`<?xml version="1.0" encoding="UTF-8"?>
|
|
914
882
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
915
|
-
`,
|
|
916
|
-
</sitemapindex>`,
|
|
917
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">`,
|
|
883
|
+
`,zs=`
|
|
884
|
+
</sitemapindex>`,Ko=`<?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">`,Yo="</urlset>";async function Xs(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(ui);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=Js+o.map(i=>{if(!a[i])throw new Error(`[h2:sitemap:error] No data found for type ${i}. Check types passed to \`getSitemapIndex\``);return ei(i,a[i].pagesCount.count,s)}).join(`
|
|
918
886
|
`)+n.map(i=>" <sitemap><loc>"+(s+(i.startsWith("/")?i:"/"+i))+"</loc></sitemap>").join(`
|
|
919
|
-
`)+
|
|
920
|
-
`)+
|
|
887
|
+
`)+zs;return new Response(c,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}async function Zs(e){let{storefront:t,request:r,params:o,getLink:n,locales:a=[],getChangeFreq:s,noItemsFallback:c="/"}=e;if(!o)throw new Error("[h2:sitemap:error] Remix params object is required to generate a sitemap");if(!r||!r.url)throw new Error("A request object is required to generate a sitemap");if(!t||!t.query)throw new Error("A storefront client is required to generate a index");if(!n)throw new Error("A `getLink` function to generate each resource is required to build a sitemap");if(!o.type||!o.page)throw new Response("No data found",{status:404});let i=o.type,u=di[i];if(!u)throw new Response("Not found",{status:404});let d=await t.query(u,{variables:{page:parseInt(o.page,10)}});if(!d)throw console.warn("[h2:sitemap:warning] Sitemap is available in API version 2024-10 and later"),new Response("Sitemap not found.",{status:404});let y=new URL(r.url).origin,m="";return d?.sitemap?.resources?.items?.length?m=Ko+d.sitemap.resources.items.map(g=>ti({getChangeFreq:s,url:n({type:g.type??i,baseUrl:y,handle:g.handle}),type:i,getLink:n,updatedAt:g.updatedAt,handle:g.handle,metaobjectType:g.type,locales:a,baseUrl:y})).join(`
|
|
888
|
+
`)+Yo:m=Ko+`
|
|
921
889
|
<url><loc>${y+c}</loc></url>
|
|
922
|
-
`+
|
|
923
|
-
`;return o}function
|
|
890
|
+
`+Yo,new Response(m,{headers:{"Content-Type":"application/xml","Cache-Control":`max-age=${3600*24}`}})}function ei(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 ti({url:e,updatedAt:t,locales:r,type:o,getLink:n,baseUrl:a,handle:s,getChangeFreq:c,metaobjectType:i}){return `<url>
|
|
924
892
|
<loc>${e}</loc>
|
|
925
893
|
<lastmod>${t}</lastmod>
|
|
926
894
|
<changefreq>${c?c({type:i??o,handle:s}):"weekly"}</changefreq>
|
|
927
|
-
${r.map(u=>
|
|
895
|
+
${r.map(u=>ri(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
928
896
|
`)}
|
|
929
897
|
</url>
|
|
930
|
-
`.trim()}function
|
|
898
|
+
`.trim()}function ri(e,t){return ` <xhtml:link rel="alternate" hreflang="${t}" href="${e}" />`}var oi=`#graphql
|
|
931
899
|
query SitemapProducts($page: Int!) {
|
|
932
900
|
sitemap(type: PRODUCT) {
|
|
933
901
|
resources(page: $page) {
|
|
@@ -938,7 +906,7 @@ ${r.map(u=>Zs(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
938
906
|
}
|
|
939
907
|
}
|
|
940
908
|
}
|
|
941
|
-
`,
|
|
909
|
+
`,ni=`#graphql
|
|
942
910
|
query SitemapCollections($page: Int!) {
|
|
943
911
|
sitemap(type: COLLECTION) {
|
|
944
912
|
resources(page: $page) {
|
|
@@ -949,7 +917,7 @@ ${r.map(u=>Zs(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
949
917
|
}
|
|
950
918
|
}
|
|
951
919
|
}
|
|
952
|
-
`,
|
|
920
|
+
`,ai=`#graphql
|
|
953
921
|
query SitemapArticles($page: Int!) {
|
|
954
922
|
sitemap(type: ARTICLE) {
|
|
955
923
|
resources(page: $page) {
|
|
@@ -960,7 +928,7 @@ ${r.map(u=>Zs(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
960
928
|
}
|
|
961
929
|
}
|
|
962
930
|
}
|
|
963
|
-
`,
|
|
931
|
+
`,si=`#graphql
|
|
964
932
|
query SitemapPages($page: Int!) {
|
|
965
933
|
sitemap(type: PAGE) {
|
|
966
934
|
resources(page: $page) {
|
|
@@ -971,7 +939,7 @@ ${r.map(u=>Zs(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
971
939
|
}
|
|
972
940
|
}
|
|
973
941
|
}
|
|
974
|
-
`,
|
|
942
|
+
`,ii=`#graphql
|
|
975
943
|
query SitemapBlogs($page: Int!) {
|
|
976
944
|
sitemap(type: BLOG) {
|
|
977
945
|
resources(page: $page) {
|
|
@@ -982,7 +950,7 @@ ${r.map(u=>Zs(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
982
950
|
}
|
|
983
951
|
}
|
|
984
952
|
}
|
|
985
|
-
`,
|
|
953
|
+
`,ci=`#graphql
|
|
986
954
|
query SitemapMetaobjects($page: Int!) {
|
|
987
955
|
sitemap(type: METAOBJECT) {
|
|
988
956
|
resources(page: $page) {
|
|
@@ -996,7 +964,7 @@ ${r.map(u=>Zs(n({type:i??o,baseUrl:a,handle:s,locale:u}),u)).join(`
|
|
|
996
964
|
}
|
|
997
965
|
}
|
|
998
966
|
}
|
|
999
|
-
`,
|
|
967
|
+
`,ui=`#graphql
|
|
1000
968
|
query SitemapIndex {
|
|
1001
969
|
products: sitemap(type: PRODUCT) {
|
|
1002
970
|
pagesCount {
|
|
@@ -1029,7 +997,7 @@ query SitemapIndex {
|
|
|
1029
997
|
}
|
|
1030
998
|
}
|
|
1031
999
|
}
|
|
1032
|
-
`,
|
|
1000
|
+
`,di={products:oi,articles:ai,collections:ni,pages:si,blogs:ii,metaObjects:ci};//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
|
|
1033
1001
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartCreate
|
|
1034
1002
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesAdd
|
|
1035
1003
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate
|
|
@@ -1039,13 +1007,13 @@ query SitemapIndex {
|
|
|
1039
1007
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartNoteUpdate
|
|
1040
1008
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartSelectedDeliveryOptionsUpdate
|
|
1041
1009
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet
|
|
1042
|
-
//! @see https://shopify.dev/docs/api/storefront/2026-
|
|
1010
|
+
//! @see https://shopify.dev/docs/api/storefront/2026-04/mutations/cartMetafieldDelete
|
|
1043
1011
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartGiftCardCodesUpdate
|
|
1044
1012
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartGiftCardCodesAdd
|
|
1045
1013
|
//! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartGiftCardCodesRemove
|
|
1046
1014
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesAdd
|
|
1047
1015
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesRemove
|
|
1048
1016
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesUpdate
|
|
1049
|
-
//! @see: https://shopify.dev/docs/api/storefront/2026-
|
|
1050
|
-
export{
|
|
1017
|
+
//! @see: https://shopify.dev/docs/api/storefront/2026-04/mutations/cartDeliveryAddressesReplace
|
|
1018
|
+
export{Hn as Analytics,G as AnalyticsEvent,Vt as CacheCustom,kt as CacheLong,Ut as CacheNone,le as CacheShort,re as CartForm,Ft as InMemoryCache,Lo as NonceProvider,ds as OptimisticInput,ms as Pagination,Us as RichText,as as Script,Ws as Seo,Ks as ShopPayButton,bs 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,La as changelogHandler,nr as createCartHandler,es as createContentSecurityPolicy,lr as createCustomerAccountClient,ja as createHydrogenContext,Ya as createRequestHandler,mo as createStorefrontClient,Xn as createWithCache,T as formatAPIResult,Ve as generateCacheControlHeader,Cs as getPaginationVariables,ws as getSelectedProductOptions,Fs as getSeoMeta,Mn as getShopAnalytics,Zs as getSitemap,Xs as getSitemapIndex,Ls as graphiqlLoader,ka as hydrogenContext,Os as hydrogenPreset,is as hydrogenRoutes,ks as storefrontRedirect,Z as useAnalytics,Tt as useCustomerPrivacy,yr as useNonce,_a as useOptimisticCart,us as useOptimisticData,Ps as useOptimisticVariant};//# sourceMappingURL=index.js.map
|
|
1051
1019
|
//# sourceMappingURL=index.js.map
|