/*! For license information please see vendor.4f965324c0be7ed9ccde.js.LICENSE.txt */ (self.webpackChunkui=self.webpackChunkui||[]).push([[20],{9:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initBentoAnalytics=e.logCollectionView=e.loadShopifyAccount=e.DEFAULT_SHOPIFY_ACCOUNT_DATA=void 0,e.logViewCart=async function(){const t=(0,y.uuid)();await(0,y.callOrlyTagHooks)("viewCart",t)},e.logViewContent=async function(t){const n=(0,y.uuid)(),r=[(0,l.logGoogleViewContent)(t,n),(0,p.logSnapchatViewContent)(t,n)];await(0,e.loadShopifyAccount)();const o=[(0,y.callOrlyTagHooks)("viewContent",t,n),(0,d.logOutsmartlyViewedProduct)(t,n),(0,d.logOutsmartlySelectedVariant)(t,n),(0,s.logFacebookViewContent)(t,n)];await Promise.allSettled([...r,...o])},e.loadScript=v,e.loadAccount=_,e.logClickContent=async function(t,e,n=0){const r=window.__APP_CONFIG__.eventId||(0,y.uuid)();await(0,y.callOrlyTagHooks)("clickContent",t,e,n,r)},e.logSignUp=async function(t){const e=(0,y.uuid)();await Promise.allSettled([(0,y.callOrlyTagHooks)("signUp",t,e)])},e.logSignIn=async function(t){const e=(0,y.uuid)();await Promise.allSettled([(0,y.callOrlyTagHooks)("signIn",t,e)])},e.logSearch=async function(t,e){const n=(0,y.uuid)();await Promise.allSettled([(0,y.callOrlyTagHooks)("search",t,e,n)])};const o=n(43),i=n(60),a=n(136),c=n(242),s=n(244),l=n(137),d=n(138),u=n(51),p=n(140),y=n(5),f=r(n(61));async function g(t,e){const n=await(0,y.getCartComponents)(t);await Promise.allSettled(n.map(A).flatMap((t=>[(0,y.callOrlyTagHooks)("addToCart",t,e),(0,s.logAddToCartFacebook)(t,e),(0,u.logAddToCartPinterest)(t,e),(0,p.logAddToCartSnapchat)(t,e),(0,l.logAddToCartGoogleAnalytics)(t,e)])))}async function h(t,e){await(0,y.callOrlyTagHooks)("removeFromCart",t,e)}async function m(){const t=window.__APP_CONFIG__.eventId||(0,y.uuid)(),n=(0,e.loadShopifyAccount)(),r=n.then((async t=>{await _(t)}));await Promise.allSettled([(0,y.callOrlyTagHooks)("pageView",t,n),(0,l.logGooglePageView)(t,n),(0,p.logSnapchatPageView)(t,n),(0,d.logOutsmartlyPageView)(t,n),(0,u.logPinterestPageView)(t,n),(0,s.logFacebookPageView)(t,n),r])}async function v(){await Promise.allSettled([(0,y.callOrlyTagHooks)("loadScript"),new Promise((t=>{(0,l.loadGoogleAnalytics)(),t()}))])}async function _(t){await Promise.allSettled([(0,y.callOrlyTagHooks)("loadAccount",t),new Promise((e=>{(0,p.loadSnapchat)(t),e()}))])}e.DEFAULT_SHOPIFY_ACCOUNT_DATA={loggedIn:!1,id:"",email:"",phone:"",first_name:"",last_name:"",city:"",country:"",countryCode:"",zip:"",address1:"",address2:"",hashedEmail:"",loyaltylion_has_account:!1,loyaltylion_token:"",loyaltylion_auth_token:"",province:"",provinceCode:"",rechargeHash:"",date:"",tags:"",orderValue:"",orderId:"",theme:void 0},e.loadShopifyAccount=(0,f.default)((async()=>{const t=window.__APP_CONFIG__.ANALYTICS.accountEndpoint??"/api/account";try{return await fetch(t).then((t=>t.json())).catch((n=>(console.error("loadShopifyAccount from endpoint failed.\n",`Tried to fetch from: ${t}\n.`,"Returning a default account...\n",`error: ${JSON.stringify(n,Object.getOwnPropertyNames(n),2)}`),e.DEFAULT_SHOPIFY_ACCOUNT_DATA)))}catch(n){return console.warn(`Error loading account from '${t}', returning default account instead.\n You can change default account endpoint on window.__APP_CONFIG__.ANALYTICS.accountEndpoint.\n ${JSON.stringify(n,Object.getOwnPropertyNames(n),2)}`),e.DEFAULT_SHOPIFY_ACCOUNT_DATA}})),e.logCollectionView=(0,f.default)((async(t,e)=>{const n=(0,y.uuid)();await Promise.allSettled([(0,y.callOrlyTagHooks)("collectionView",t,e,n),(0,u.logPinterestCollectionView)(t,e,n),(0,l.logGoogleCollectionView)(t,e,n)])}));const w=async(t,e)=>{const n=await fetch(t,e),r=await n.json();return queueMicrotask((()=>function(t,e,n){if(!(0,y.isShopifyCart)(n)){if(!(0,y.isShopifyCartError)(n))throw new Error("unexpected response, not a ShopifyCart or ShopifyCartError");return n}const r=(0,y.normalizeCart)(n),o=e.get("x-event-id")??(0,y.uuid)();t.startsWith("/cart/add.js")?C(r,o):t.startsWith("/cart/change.js")||t.startsWith("/cart/update.js")?I(r,o):t.startsWith("/cart.json")?(0,y.updateCart)(r):console.error(`Unknown URL: ${t}`)}(t,n.headers,r))),r},C=(t,e)=>{const n=(0,y.getOldCart)();if(!n)return void(0,y.updateCart)(t);const r=new Map(n.items.map((t=>[t.key,t])));t.items.forEach((t=>{const n=r.get(t.key),o=n?.quantity||0,i=t.quantity-o;g({...t,quantity:i},e).catch((t=>{console.error(t)}))}))};function A(t){try{const e=t.properties,n=e._olpid??t.product_id.toString(),r=e._olvid??t.variant_id.toString();return{...t,product_id:Number.parseInt(n.toString()),variant_id:Number.parseInt(r.toString())}}catch{return t}}const I=(t,e)=>{const n=(0,y.getOldCart)();if(!n)return void(0,y.updateCart)(t);const r=(0,y.getItemCounts)(n.items),o=(0,y.getItemCounts)(t.items);for(const[t,n]of o.entries()){const o=r.get(t),i=o?.quantity||0,a=n.quantity-i;a>0?g({...n,quantity:a},e).catch((t=>{console.error(t)})):a<0&&h({...n,quantity:-a},e).catch((t=>{console.error(t)}))}for(const[t,n]of r.entries())o.has(t)||h(n,e).catch((t=>{console.error(t)}));(0,y.updateCart)(t)};e.initBentoAnalytics=(0,f.default)((async t=>{if("undefined"==typeof window)return void console.warn("initBentoAnalytics: window not defined, NOP.");if(!window.__APP_CONFIG__)return void console.warn("initBentoAnalytics: No window.__APP_CONFIG__ found.");if(!window.__APP_CONFIG__.ANALYTICS)return void console.warn("initBentoAnalytics: No window.__APP_CONFIG__.ANALYTICS found.");window.__APP_CONFIG__.fetchCartJSON=w;const e={elevar:o.initElevar};for(const n of(0,y.entries)(t))if(n){const[t,r]=n;r&&e[t]()}(0,i.initKlaviyo)(),(0,a.initShopify)(),(0,c.initTikTok)();try{await v().then(m)}catch(t){console.log(t)}}))},251:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useViewContent=function(t){(0,r.useEffect)((()=>{(0,o.logViewContent)(t).catch((t=>{console.error(t)}))}),[t.product_id,t.variant_id])},e.useCollectionView=function(t,e){(0,r.useEffect)((()=>{(0,o.logCollectionView)(t,e).catch((t=>{console.error(t)}))}),[t,e])};const r=n(2),o=n(9)},240:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadScriptWithDelay=e.loadScript=e.initBentoAnalytics=e.logCollectionView=e.logSearch=e.logSignIn=e.logSignUp=e.logViewContent=e.logViewCart=e.loadShopifyAccount=e.useCollectionView=e.useViewContent=e.useOutsmartlyErrorReporting=e.logOutsmartlyError=e.loadImapactRadius=e.loadAttn=e.loadIntellipse=e.loadKlaviyoSubscribe=e.loadKlaviyo=e.loadLoyaltyLion=e.loadSnapchat=e.loadPinterest=e.loadGoogleAnalytics=e.initShopify=e.initElevar=void 0;var r=n(43);Object.defineProperty(e,"initElevar",{enumerable:!0,get:function(){return r.initElevar}});var o=n(136);Object.defineProperty(e,"initShopify",{enumerable:!0,get:function(){return o.initShopify}});var i=n(137);Object.defineProperty(e,"loadGoogleAnalytics",{enumerable:!0,get:function(){return i.loadGoogleAnalytics}});var a=n(51);Object.defineProperty(e,"loadPinterest",{enumerable:!0,get:function(){return a.loadPinterest}});var c=n(140);Object.defineProperty(e,"loadSnapchat",{enumerable:!0,get:function(){return c.loadSnapchat}});var s=n(246);Object.defineProperty(e,"loadLoyaltyLion",{enumerable:!0,get:function(){return s.loadLoyaltyLion}});var l=n(60);Object.defineProperty(e,"loadKlaviyo",{enumerable:!0,get:function(){return l.loadKlaviyo}}),Object.defineProperty(e,"loadKlaviyoSubscribe",{enumerable:!0,get:function(){return l.loadKlaviyoSubscribe}});var d=n(248);Object.defineProperty(e,"loadIntellipse",{enumerable:!0,get:function(){return d.loadIntellipse}});var u=n(249);Object.defineProperty(e,"loadAttn",{enumerable:!0,get:function(){return u.loadAttn}});var p=n(250);Object.defineProperty(e,"loadImapactRadius",{enumerable:!0,get:function(){return p.loadImapactRadius}});var y=n(138);Object.defineProperty(e,"logOutsmartlyError",{enumerable:!0,get:function(){return y.logOutsmartlyError}}),Object.defineProperty(e,"useOutsmartlyErrorReporting",{enumerable:!0,get:function(){return y.useOutsmartlyErrorReporting}});var f=n(251);Object.defineProperty(e,"useViewContent",{enumerable:!0,get:function(){return f.useViewContent}}),Object.defineProperty(e,"useCollectionView",{enumerable:!0,get:function(){return f.useCollectionView}});var g=n(9);Object.defineProperty(e,"loadShopifyAccount",{enumerable:!0,get:function(){return g.loadShopifyAccount}}),Object.defineProperty(e,"logViewCart",{enumerable:!0,get:function(){return g.logViewCart}}),Object.defineProperty(e,"logViewContent",{enumerable:!0,get:function(){return g.logViewContent}}),Object.defineProperty(e,"logSignUp",{enumerable:!0,get:function(){return g.logSignUp}}),Object.defineProperty(e,"logSignIn",{enumerable:!0,get:function(){return g.logSignIn}}),Object.defineProperty(e,"logSearch",{enumerable:!0,get:function(){return g.logSearch}}),Object.defineProperty(e,"logCollectionView",{enumerable:!0,get:function(){return g.logCollectionView}}),Object.defineProperty(e,"initBentoAnalytics",{enumerable:!0,get:function(){return g.initBentoAnalytics}});var h=n(5);Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return h.loadScript}}),Object.defineProperty(e,"loadScriptWithDelay",{enumerable:!0,get:function(){return h.loadScriptWithDelay}})},249:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadAttn=function(){const{ATTN_ID:t,ATTN_DELAY:e=10}=window.__APP_CONFIG__.ANALYTICS;t&&(0,r.loadScriptWithDelay)({src:`//cdn.attn.tv/${t}/dtag.js`,id:"attn-script",timeout:1e3*e,anonymous:!1})};const r=n(5)},43:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.logElevarSearch=e.logElevarViewCart=e.logElevarViewContent=e.logElevarClickContent=e.logElevarCollectionView=e.logElevarRemoveFromCart=e.logElevarAddToCart=e.logElevarPageView=void 0,e.initElevar=function(){"undefined"!=typeof window&&(window._orlyTags||(window._orlyTags=[]),window._orlyTags.push(["addToCart",e.logElevarAddToCart],["removeFromCart",e.logElevarRemoveFromCart],["clickContent",e.logElevarClickContent],["collectionView",e.logElevarCollectionView],["pageView",e.logElevarPageView],["viewCart",e.logElevarViewCart],["viewContent",e.logElevarViewContent],["loadScript",c],["search",e.logElevarSearch]))},e.loadElevar=c;const o=n(9),i=n(5),a=r(n(61));async function c(){try{await(0,i.waitForShopifyY)(),await fetch("/static-489c224a/elevar/live.html").then((t=>t.text())).then((t=>{const e=document.createRange().createContextualFragment(t);document.body.append(e)})),window.ElevarPushToDataLayer||(window.ElevarPushToDataLayer=t=>(window.ElevarDataLayer=window.ElevarDataLayer??[],window.ElevarDataLayer.push(t)))}catch(t){throw new Error("loadElevar error:"+JSON.stringify(t,Object.getOwnPropertyNames(t),2))}}async function s(t){const e=t??await(0,o.loadShopifyAccount)(),n=(0,i.getOldCart)(),r=n?.items.map(((t,e)=>({name:t.title,id:t.id.toString(),category:t.product_type||"unknown",brand:t.vendor,variant:t.variant_title,price:t.final_line_price.toString(),quantity:t.quantity.toString(),product_id:t.product_id.toString(),variant_id:t.variant_id.toString(),compare_at_price:t.original_line_price.toString(),image:t.image,inventory:"",list:"",url:t.url,position:e,properties:t.properties})))??[];return{user:{customer_address_1:e.address1||void 0,customer_address_2:e.address2||void 0,customer_city:e.city||void 0,customer_country:e.country||void 0,customer_email:e.email||void 0,customer_first_name:e.first_name||void 0,customer_id:e.id||void 0,customer_last_name:e.last_name||void 0,customer_order_count:void 0,customer_phone:e.phone||void 0,customer_province:e.province||void 0,customer_province_code:e.provinceCode||void 0,customer_tags:e.tags||void 0,customer_total_spent:e.orderValue||void 0,customer_zip:e.zip||void 0,user_consent:void 0,visitor_type:e.loggedIn?"logged_in":"guest"},cart:{items:r,total:n?.total_price.toString()??""}}}const l=async t=>{const e=(0,i.readCookie)("cart_currency")||(0,i.readCookie)("cartCurrency");return e&&""!==e?e:(t??await(0,o.loadShopifyAccount)()).currency||"USD"},d=(t,e)=>{const n=new URL(e?.url||window.location.href),r=n.pathname+n.search;return t.map(((t,e)=>{const n=t.selected_variant?.id||t.product.id,o=t.selected_variant?.price??t.product.price,i=t.selected_variant?.compare_at_price??t.product.compare_at_price,a=t.selected_variant?.inventory_quantity;return{id:t.selected_variant?.sku??n?.toString(),name:t.product.title,list:r,brand:t.product.vendor,category:t.product.type||"unknown",variant:t.selected_variant?.title,variant_id:t.selected_variant?.id?.toString(),position:e+1,price:o?.toFixed(2),quantity:a?a.toString():"1",product_id:t.product.id?.toString(),compare_at_price:i?.toFixed(2)??o?.toFixed(2),url:t.selected_variant?.url||t.product.url}}))};function u(t){const e=t.price.toFixed(2),n=t.original_price.toFixed(2),r=t.position??0,o=document.referrer?new URL(document.referrer):void 0;return{id:t.sku,name:t.product_title,price:e,image:t.image,brand:t.vendor,category:t.product_type||"unknown",compare_at_price:n===e||"0.00"===n?e:n,product_id:t.product_id.toString(),variant_id:t.variant_id.toString(),variant:t.variant_title,inventory:t.inventory?.toString(),list:o?`${o.pathname}${o.search}`:"",position:r+1,quantity:t.quantity.toString(),url:t.url,properties:t.properties}}function p(t,e,n=0){const r=t.selected_variant?.price??t.product.price,o=t.selected_variant?.compare_at_price??t.product.compare_at_price,i=t.selected_variant?.image??t.product.image,a=new URL(e?.url||window.location.href),c=a.pathname+a.search;return{id:t.selected_variant?.sku||t.product.id?.toString(),name:t.product.title,price:r?.toFixed(2),image:i?.src,brand:t.product.vendor,category:t.product.type||"unknown",compare_at_price:o===r||0===o?r?.toFixed(2):o?.toFixed(2),product_id:t.product.id?.toString(),variant_id:t.selected_variant?.id?.toString(),variant:t.selected_variant?.title,inventory:t.selected_variant?.inventory_quantity?.toString(),list:c,position:n+1,quantity:t.quantity?.toString(),url:t.selected_variant?.url||t.product.url}}e.logElevarPageView=async(t,e)=>{const n=await e,r=await l(n),{user:o,cart:i}=await s(n);window.ElevarPushToDataLayer?.({event:"dl_user_data",eventId:t,cart_total:i.total,user_properties:o,ecommerce:{currencyCode:r,cart_contents:{products:i.items}}})},e.logElevarAddToCart=async(t,e=(0,i.uuid)())=>{const n=u(t),r=await l(),{user:o}=await s();window.ElevarPushToDataLayer?.({event:"dl_add_to_cart",eventId:e,user_properties:o,ecommerce:{currencyCode:r,add:{actionField:{list:document.referrer?new URL(document.referrer).pathname:"",action:"add"},products:[n]}}})},e.logElevarRemoveFromCart=async(t,e=(0,i.uuid)())=>{const n=u(t),r=await l(),{user:o}=await s();window.ElevarPushToDataLayer?.({event:"dl_remove_from_cart",eventId:e,user_properties:o,ecommerce:{currencyCode:r,remove:{actionField:{list:"Shopping Cart"},products:[n]}}})},e.logElevarCollectionView=async(t,e,n=(0,i.uuid)())=>{const r=await l(),{user:o}=await s(),a=d(e,t);window.ElevarPushToDataLayer?.({event:"dl_view_item_list",eventId:n,user_properties:o,ecommerce:{currencyCode:r,impressions:a}})},e.logElevarClickContent=async(t,e,n=0,r=(0,i.uuid)())=>{const{user:o}=await s(),a=await l(),c=new URL(t.url||window.location.href),d=`${c.pathname}${c.search}`,u=[p(e,t,n)];window.ElevarPushToDataLayer?.({event:"dl_select_item",eventId:r,user_properties:o,ecommerce:{currencyCode:a,click:{actionField:{list:d,action:"click"},products:u}}})};const y=(0,a.default)((async t=>{const n=(0,i.cartItemToBentoAnalyticsItem)(t),r=document.referrer?new URL(document.referrer):void 0;await(0,e.logElevarClickContent)({id:-1,title:r?`${r.pathname}${r.search}`:"",url:document.referrer},n,0)}));e.logElevarViewContent=async(t,e=(0,i.uuid)())=>{document.referrer&&await y(t);const n=document.referrer||window.location.href?new URL(document.referrer||window.location.href):void 0,r=await l(),o=p((0,i.cartItemToBentoAnalyticsItem)(t));o.inventory||console.error("Please attach an inventory value to cartItem for logViewContent events.");const{user:a}=await s(),c=[o];window.ElevarPushToDataLayer?.({event:"dl_view_item",eventId:e,user_properties:a,ecommerce:{currencyCode:r,detail:{actionField:{list:n?`${n.pathname}${n.search}`:"",action:"detail"},products:c}}})},e.logElevarViewCart=async(t=(0,i.uuid)())=>{const n=await l();await(0,e.logElevarPageView)(t,(0,o.loadShopifyAccount)());const{user:r,cart:a}=await s();var c;window.ElevarPushToDataLayer?.({event:"dl_view_cart",eventId:t,user_properties:r,ecommerce:{currencyCode:n,actionField:{list:"Shopping Cart"},impressions:(c=a.items??[],c.map(((t,e)=>({...t,position:e+1,list:"Shopping Cart"}))))},cart_total:a.total})},e.logElevarSearch=async(t,e,n=(0,i.uuid)())=>{const r=await l(),{user:o}=await s(),a=new URL(window.location.href);a.searchParams.set("query",t),window.ElevarPushToDataLayer?.({event:"dl_view_search_results",eventId:n,user_properties:o,ecommerce:{currencyCode:r,actionField:{list:"search results"},impressions:d(e,{title:"search results test",url:a.toString(),id:-1})}})}},244:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.logFacebookPageView=e.logFacebookViewContent=e.logAddToCartFacebook=void 0;const r=n(5),o=n(245);function i(){const{USE_FB_SDK:t,FB_INIT:e}=window.__APP_CONFIG__.ANALYTICS;return!t||e?e:(window.__APP_CONFIG__.ANALYTICS.FB_INIT=(async()=>{const{FB_ID:t}=window.__APP_CONFIG__.ANALYTICS;if(t&&((0,o.loadFacebookSdk)(),window.fbq)){(0,r.ccpa_dns)()?window.fbq("dataProcessingOptions",["LDU"],1,1e3):window.fbq("dataProcessingOptions",[]);const e=await l();window.fbq("init",t,e)}})(),window.__APP_CONFIG__.ANALYTICS.FB_INIT)}function a(t,e){const n=`${t.title??""} - ${e.title??""}`;return[`&cd[content_ids]=${e.id??""}`,"&cd[content_type]=product_group",`&cd[content_name]=${window.encodeURIComponent(n)}`,`&cd[currency]=${(0,r.readCookie)("cartCurrency")??"USD"}`,`&cd[value]=${window.encodeURIComponent(e.price??"0")}`,t.productType?`&cd[content_category]=${t.productType}`:"","&cd[num_items]=1"]}function c(t,e){const n=`${t.title??""} - ${e.title??""}`;return{content_ids:void 0===t.content_ids?e.id?[e.id]:[]:t.content_ids,content_type:"product",content_name:n,curency:(0,r.readCookie)("cartCurrency")??"USD",value:Number.parseFloat(e.price??"0"),content_category:t.productType}}async function s(t){const e=(0,r.readCookie)("_shopify_y"),n=(0,r.readCookie)("_fbp"),o=(0,r.readCookie)("_fbc"),i=await async function(){const t=await l();return t?await Promise.all(Object.entries(t).map((async([t,e])=>e&&"string"==typeof e?`&ud[${t}]=${window.encodeURIComponent(await(0,r.sha256)(e))}`:""))):[]}(),a=`${document.location.pathname}${document.location.search}`;return[`&dl=${window.encodeURIComponent(a)}`,`&eid=${t}`,n?`&fbp=${window.encodeURIComponent(n)}`:"",o?`&fbc=${window.encodeURIComponent(o)}`:"",e?`&external_id[0]=${window.encodeURIComponent(e)}`:"",...i,(0,r.ccpa_dns)()?"&dpo=LDU&dpoco=1&dpost=1000":"&dpo="].join("")}async function l(){const t=await window.__APP_CONFIG__.account;if(t?.id)return{em:t.email,fn:t.first_name,ln:t.last_name,ph:t.phone?.replace(/\D+/g,"")}}e.logAddToCartFacebook=async(t,e)=>{const{FB_ID:n,USE_FB_SDK:o}=window.__APP_CONFIG__.ANALYTICS;if(!n)return;const[l,d]=(0,r.buildProductAndVariant)(t);if(await i(),o&&window.fbq?.loaded)window.fbq("track","AddToCart",c(l,d),{eventID:e});else try{(0,r.imagePixel)([`https://www.facebook.com/tr/?id=${n}`,"&ev=AddToCart",await s(e),...a(l,d)].join(""))}catch(t){console.error(t)}},e.logFacebookViewContent=async(t,e)=>{const{FB_ID:n,USE_FB_SDK:o}=window.__APP_CONFIG__.ANALYTICS;if(!n)return;const[l,d]=(0,r.buildProductAndVariant)(t);try{if(await i(),o&&window.fbq?.loaded)return void window.fbq("track","ViewContent",c(l,d),{eventID:e});(0,r.imagePixel)([`https://www.facebook.com/tr/?id=${n}`,"&ev=ViewContent",await s(e),...a(l,d)].join(""))}catch(t){console.error(t)}},e.logFacebookPageView=async t=>{const{FB_ID:e,USE_FB_SDK:n}=window.__APP_CONFIG__.ANALYTICS;if(e)if(await i(),n&&window.fbq?.loaded)window.fbq("track","PageView");else try{(0,r.imagePixel)(`https://www.facebook.com/tr/?id=${e}&ev=PageView${await s(t)}`)}catch(t){console.error(t)}}},137:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.logGoogleCollectionView=e.logGoogleClickContent=e.logGoogleViewContent=e.logAddToCartGoogleAnalytics=e.event=e.logGooglePageView=e.loadGoogleAnalytics=void 0;const r=n(5);e.loadGoogleAnalytics=()=>{const{GA_ID:t,GA_USE_GTM:e}=window.__APP_CONFIG__.ANALYTICS;t&&(window.gtag||(window.gtag=function(...t){window.dataLayer=window.dataLayer||[],window.dataLayer.push(t)},window.gtag("js",new Date)),e?function(t,e,n,r,o){t[r]=t[r]||[],t[r].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var i=e.getElementsByTagName(n)[0],a=e.createElement(n);a.async=!0,a.src="https://www.googletagmanager.com/gtm.js?id="+o,i.parentNode.insertBefore(a,i)}(window,document,"script","dataLayer",t):(0,r.loadScript)({src:`https://www.googletagmanager.com/gtag/js?id=${t}`,id:"google-analytics",defer:!1,async:!0}))};let o="";function i(t,e,n={},r=!0){void 0!==window.gtag&&window.gtag("event",t,{...n,currency:"USD",items:e,non_interaction:r})}function a(t,e,n){return{item_id:t.selected_variant?.sku||t.product.id?.toString()||"",item_name:[t.product.title,t.selected_variant?.title].filter((t=>!!t)).join(" "),item_category:t.product.type??"",price:t.product.price,item_brand:t.product.vendor,item_list_id:e.url,item_list_name:e.title,item_variant:t.selected_variant?.id?.toString(),index:n,quantity:t.quantity||1,affiliation:void 0,coupon:void 0,discount:void 0,location_id:void 0}}e.logGooglePageView=()=>{const{GA_ID:t,ADDITIONAL_GA:e}=window.__APP_CONFIG__.ANALYTICS;if(!t)return;const n=`${document.location.pathname}${document.location.search}`,i=window.gtag;if(i&&o!==n&&(o=n,(0,r.ccpa_dns)()&&i("set",{restricted_data_processing:!0}),i("config",t,{page_path:n}),e))for(const t of e)i("config",t,{page_path:n})},e.event=({action:t,category:e,label:n,value:r,non_interaction:o})=>{window.gtag&&window.gtag("event",t,{event_category:e,event_label:n,value:r,non_interaction:o})},e.logAddToCartGoogleAnalytics=t=>{window.__APP_CONFIG__.ANALYTICS.GA_ID&&i("add_to_cart",[a((0,r.cartItemToBentoAnalyticsItem)(t),{title:document.title,id:-1,url:window.location.toString()})],{},!1)},e.logGoogleViewContent=t=>{window.__APP_CONFIG__.ANALYTICS.GA_ID&&i("view_item",[a((0,r.cartItemToBentoAnalyticsItem)(t),{title:document.title,id:-1,url:window.location.toString()})])},e.logGoogleClickContent=(t,e,n=0)=>{window.__APP_CONFIG__.ANALYTICS.GA_ID&&i("select_content",[a(e,t,n)],{content_type:"product"})},e.logGoogleCollectionView=(t,e)=>{window.__APP_CONFIG__.ANALYTICS.GA_ID&&i("view_item_list",e.map(((e,n)=>a(e,t,n))))}},250:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadImapactRadius=function(){const{IMPACTRADIUS_ENABLED:t=!1,IMPACTRADIUS_DELAY:e=5}=window.__APP_CONFIG__.ANALYTICS;t&&(0,r.loadScriptWithDelay)({src:"//d.impactradius-event.com/A2248058-8d0a-428f-b528-d1484c8157851.js",id:"impact-radius-script",timeout:1e3*e,anonymous:!1})};const r=n(5)},248:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadIntellipse=function(){const{ANALYTICS:{INTELLIPSE_ENABLED:t=!1,INTELLIPSE_DELAY:e=10},SHOP_NAME:n}=window.__APP_CONFIG__;t&&(0,r.loadScriptWithDelay)({src:`https://bootstrap.production.intellipse.com/bootstrap.js?shop=${n}.myshopify.com`,id:"intellipse-script",timeout:1e3*e,anonymous:!1})};const r=n(5)},60:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadKlaviyoSubscribe=e.loadKlaviyo=void 0,e.initKlaviyo=function(){a()&&"undefined"!=typeof window&&(window._orlyTags||(window._orlyTags=[]),window._orlyTags.push(["addToCart",i],["viewContent",o],["loadScript",e.loadKlaviyo]))};const r=n(5);e.loadKlaviyo=()=>{const{ANALYTICS:{KLAVIYO_ID:t,KLAVIYO_DELAY:e=2},SHOP_NAME:n}=window.__APP_CONFIG__;t&&(function(){if(!window.klaviyo){window._klOnsite=window._klOnsite||[];try{window.klaviyo=new Proxy({},{get:function(t,e){return"push"===e?function(){var t;(t=window._klOnsite).push.apply(t,arguments)}:function(){for(var t=arguments.length,n=new Array(t),r=0;r{if(!a())return;const[n]=(0,r.buildProductAndVariant)(t),o=`${document.location.pathname}${document.location.search}`,i={Name:n.title,ProductID:n.id,ImageURL:n.image,URL:o,Brand:n.vendor,Price:n.price,CompareAtPrice:n.compareAtPrice??void 0},c={Name:i.Name,ProductID:i.ProductID,Handle:i.URL,Brand:i.Brand,Price:i.Price,ImageUrl:i.ImageURL,Metadata:{Brand:i.Brand,Price:i.Price,CompareAtPrice:i.CompareAtPrice},event_id:`${e}_${Date.now().toString()}`};window.klaviyo.push(["track","Viewed Product",c]);const s={Name:i.Name,ProductID:i.ProductID,Handle:i.URL,Brand:i.Brand,Price:i.Price,ImageUrl:i.ImageURL,Metadata:{Brand:i.Brand,Price:i.Price,CompareAtPrice:i.CompareAtPrice},event_id:`${e}_${Date.now().toString()}`};window.klaviyo.push(["trackViewedItem",s]),window.geq?.event("Viewed Product Reclaim",s)},i=(t,e)=>{if(!a())return;const[n,o]=(0,r.buildProductAndVariant)(t),i=(0,r.getCurrentPrice)(n,o),c=(0,r.getCartValue)(i),s={Name:n.title,ProductID:n.id,ImageURL:n.image,Handle:n.handle,Brand:n.vendor,Price:i,Properties:t.properties,$value:c,$event_id:`${e}_${Date.now().toString()}`};window.klaviyo.push(["track","Added to Cart",s]),window.geq?.addToCart(s)};function a(){const{KLAVIYO_ID:t}=window.__APP_CONFIG__.ANALYTICS;return!!t}e.loadKlaviyoSubscribe=()=>{const{KLAVIYO_DELAY:t=0}=window.__APP_CONFIG__.ANALYTICS,e={src:"//www.klaviyo.com/media/js/public/klaviyo_subscribe.js",id:"klaviyo-subscribe-script",timeout:1e3*t,anonymous:!1};(0,r.loadScriptWithDelay)(e,(()=>{window.KlaviyoSubscribe?window.KlaviyoSubscribe.attachToForms("#footer_email_signup",{hide_form_on_success:!0}):console.warn("KlaviyoSubscribe not found")}))}},245:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadFacebookSdk=function(){var t,e,n,r,o,i;t=window,e=document,n="script",t.fbq||(r=t.fbq=function(){r.callMethod?r.callMethod.apply(r,arguments):r.queue.push(arguments)},t._fbq||(t._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[],(o=e.createElement(n)).async=!0,o.src="https://connect.facebook.net/en_US/fbevents.js",(i=e.getElementsByTagName(n)[0]).parentNode.insertBefore(o,i))}},243:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadTikTokScript=function(t){!function(e,n,r){e.TiktokAnalyticsObject=r;var o=e[r]=e[r]||[];o.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],o.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadLoyaltyLion=function(t){return new Promise(((e,n)=>{if(window.loyaltylion&&(window.loyaltylion=window.lion=void 0,function(){for(const t of document.querySelectorAll("[data-lion-react-container]"))t.remove();for(const t of document.querySelectorAll("#loyaltylion"))t.remove()}()),!t.loyaltylion_token||!window.__APP_CONFIG__.ANALYTICS.LOYALTYLION_ENABLED)return console.log("LoyaltyLion wasn't loaded because it isn't enabled for this site."),void e();"function"==typeof window.requestIdleCallback?window.requestIdleCallback((()=>{o(t,e,n)})):setTimeout((()=>{o(t,e,n)}),0)}))};const r=n(247);function o({loggedIn:t,id:e,email:n,first_name:o,last_name:i,loyaltylion_has_account:a,loyaltylion_token:c,rechargeHash:s,loyaltylion_auth_token:l,date:d},u,p){try{(0,r.loadScript)(),a&&t&&n?window.loyaltylion?.init({token:c??"",customer:{id:e??"",email:n,name:`${o??""} ${i??""}`,rechargeHash:s??""},auth:{date:d??"",token:l??""}}):window.loyaltylion?.init({token:c??""}),window.loyaltylion?.on("ready",(()=>{setTimeout((()=>{u()}),0)}))}catch(t){console.error(`Could not load LoyaltyLion: ${JSON.stringify(t)}`),p(t)}}},247:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadScript=function(){!function(t,e){function n(e){var n=t.getElementsByTagName("script")[0],r=t.createElement("script");r.src=e,r.crossOrigin="",r.onload=t=>{t.target.parentNode.removeChild(t.target)},n.parentNode.insertBefore(r,n)}if(!e.isLoyaltyLion){window.loyaltylion=e,void 0===window.lion&&(window.lion=e),e.version=2,e.isLoyaltyLion=!0;var r=new Date,o=r.getFullYear().toString()+r.getMonth().toString()+r.getDate().toString();n("https://sdk.loyaltylion.net/static/2/loader.js?t="+o);var i=!1;e.init=function(t){if(i)throw new Error("Cannot call lion.init more than once");i=!0;var a=e._token=t.token;if(!a)throw new Error("Token must be supplied to lion.init");for(var c=[],s="_push configure bootstrap shutdown on removeListener authenticateCustomer".split(" "),l=0;l(window.addEventListener("unhandledrejection",i),window.addEventListener("error",i),()=>{window.removeEventListener("unhandledrejection",i),window.removeEventListener("error",i)})),[])},e.logOutsmartlyError=i;const r=n(2),o=n(5);function i(t,e){const{postLogger:n,rid:r,vid:o,startTimestamp:i,headTimestamp:a}=window.__APP_CONFIG__;if(n){const c=Math.floor(window.performance.now());n({table:"error",row:{rid:r,vid:o,timelineMark:i+c,elapsedTime:c,headTimestamp:a,source:e??location.pathname,message:"message"in t?t.message:JSON.stringify(t.reason),error:"stack"in t?t.stack:JSON.stringify(t)}})}}function a(t,e){const{postLogger:n,startTimestamp:r,rid:o,vid:i}=window.__APP_CONFIG__;if(!n)return;const a=Math.floor(window.performance.now());n({table:"outcome",row:{rid:o,vid:i,outcome:t,timelineMark:r+a,elapsedTime:a,pathname:window.location.pathname,metadata:e}})}function c(t,e){return[{key:"eventId",value:e},{key:"handle",value:t.handle},{key:"title",value:t.title},{key:"productId",value:t.id},{key:"productType",value:t.productType??"NA"},{key:"imageUrl",value:t.image??"NA"},{key:"vendor",value:t.vendor??"NA"},{key:"price",value:t.price},{key:"compareAtPrice",value:t.compareAtPrice??t.price}].filter((t=>void 0!==t.value))}function s(t){return t.selectedOptions?t.selectedOptions.map((({name:t="NA",value:e="NA"})=>({key:t,value:e}))):t.optionMap?[{key:"Color",value:t.optionMap.Color},{key:"Size",value:t.optionMap.Size}]:[]}e.logOutsmartlyPageView=t=>{const{postLogger:e,rid:n,vid:r,startTimestamp:o}=window.__APP_CONFIG__;if(!e)return;const i=Math.floor(window.performance.now());e({table:"outcome",row:{outcome:"PageView",rid:n,vid:r,timelineMark:o+i,elapsedTime:i,pathname:location.pathname,entryDepth:window.scrollY,scrollTopOnEntry:window.scrollY,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,documentHeight:0,metadata:[{key:"eventId",value:t}]}})},e.logOutsmartlyViewedProduct=(t,e)=>{const[n]=(0,o.buildProductAndVariant)(t);"undefined"!=typeof window&&a("ViewProduct",c(n,e))},e.logOutsmartlySelectedVariant=(t,e)=>{const[n,r]=(0,o.buildProductAndVariant)(t);"undefined"!=typeof window&&a("ViewProductVariant",[...c(n,e),{key:"variantId",value:r.id??""},{key:"eventId",value:e},...s(r)])}},51:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.logPinterestCollectionView=e.logAddToCartPinterest=e.logPinterestPageView=e.loadPinterest=void 0;const o=r(n(139)),i=n(5);e.loadPinterest=()=>{const{PINTEREST_ID:t}=window.__APP_CONFIG__.ANALYTICS;if(t)try{(0,o.default)(t),(new Image).src=`https://ct.pinterest.com/v3/?tid=${t}&noscript=1`}catch(t){console.error(t)}},e.logPinterestPageView=async(t,e)=>{const{PINTEREST_ID:n}=window.__APP_CONFIG__.ANALYTICS;if(!n)return;const r=await e;if(r)(new Image).src=["https://ct.pinterest.com/v3/?event=PageVisit",`&tid=${n}`,r.loggedIn&&r.hashedEmail?`&pd[em]=${r.hashedEmail}`:""].join("");else try{window.pintrk("track","checkout"),(new Image).src=`https://ct.pinterest.com/v3/?tid=${n}&event=pageview&noscript=1`}catch(t){console.error(t)}},e.logAddToCartPinterest=t=>{const{PINTEREST_ID:e}=window.__APP_CONFIG__.ANALYTICS;if(!e)return;const[n,r]=(0,i.buildProductAndVariant)(t);(new Image).src=["https://ct.pinterest.com/v3/?event=AddToCart",`&tid=${e}`,`&ed[line_items][0][product_id]=${n.id??""}`,`&ed[line_items][0][product_variant_id]=${r.id??""}`,`&ed[line_items][0][product_price]=${r.price??""}`,"&ed[line_items][0][product_quantity]=1",`&ed[line_items][0][product_name]=${window.encodeURIComponent(`${n.title??""} - ${r.title??""}`)}`].join("")},e.logPinterestCollectionView=()=>{const{PINTEREST_ID:t}=window.__APP_CONFIG__.ANALYTICS;t&&((new Image).src=["https://ct.pinterest.com/v3/?event=ViewCategory",`&tid=${t}`].join(""))}},139:t=>{"use strict";t.exports=function(t){!function(t){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var e=window.pintrk;e.queue=[],e.version="3.0";var n=document.createElement("script");n.async=!0,n.src="https://s.pinimg.com/ct/core.js";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(n,r)}}(),window.pintrk("load",t),window.pintrk("page")}},136:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initShopify=function(){"undefined"!=typeof window&&(window._orlyTags||(window._orlyTags=[]),window._orlyTags.push(["addToCart",p],["collectionView",g],["pageView",f],["viewContent",y]))};const r=n(5),o=n(241),i=n(9);function a(){const t=document.querySelector('link[rel="canonical"]')?.getAttribute("href")??"";if(t)return t.indexOf("?")>0?t:t+window.location.search;const e=window.location.href,n=e.indexOf("#");return-1===n?e:e.slice(0,n)}const c=[{pattern:/^\/$/,type:o.AnalyticsPageType.home},{pattern:/^\/products/,type:o.AnalyticsPageType.product},{pattern:/^\/collections\/?$/,type:o.AnalyticsPageType.listCollections},{pattern:/^\/collections/,type:o.AnalyticsPageType.collection},{pattern:/-policy|terms-of-service/,type:o.AnalyticsPageType.policy},{pattern:/^\/account\/login/,type:o.AnalyticsPageType.customersLogin},{pattern:/^\/account\/register/,type:o.AnalyticsPageType.customersRegister},{pattern:/^\/account\/addresses/,type:o.AnalyticsPageType.customersAddresses},{pattern:/^\/account\/reset/,type:o.AnalyticsPageType.customersResetPassword},{pattern:/^\/account\/orders/,type:o.AnalyticsPageType.customersOrder},{pattern:/^\/account/,type:o.AnalyticsPageType.customersAccount},{pattern:/^\/cart/,type:o.AnalyticsPageType.cart},{pattern:/^\/search/,type:o.AnalyticsPageType.search},{pattern:/^\/password/,type:o.AnalyticsPageType.password},{pattern:/^\/content/,type:o.AnalyticsPageType.article}];function s(){const t=window.location.pathname,e=c.find((({pattern:e})=>e.test(t)));return e?.type||o.AnalyticsPageType.page}function l(){const t=(0,r.readCookie)("cart");return t?`gid://shopify/Cart/${t}`:""}function d(){const{SHOP_ID:t}=window.__APP_CONFIG__;return`gid://shopify/Shop/${t.toString()}`}async function u(t){const e=(0,o.getClientBrowserParameters)(),n=await async function(t){const e=await t||await(0,i.loadShopifyAccount)();return e?{account:e,customerId:e.id?`gid://shopify/Customer/${e.id}`:void 0,currency:e.currency||"USD"}:{account:void 0,customerId:void 0,currency:"USD"}}(t);return{...e,...n,canonicalUrl:a(),shopId:d(),cartId:l(),shopifySalesChannel:o.ShopifySalesChannel.headless,ccpaEnforced:(0,r.ccpa_dns)(),gdprEnforced:!1,hasUserConsent:!0,analyticsAllowed:!0,marketingAllowed:!0,saleOfDataAllowed:!0}}const p=async t=>{const e={...await u(),...h(t,!0)};await(0,o.sendShopifyAnalytics)({eventName:o.AnalyticsEventName.ADD_TO_CART,payload:e})},y=async t=>{const e={...await u(),...h(t,!1),pageType:s()};await(0,o.sendShopifyAnalytics)({eventName:o.AnalyticsEventName.PRODUCT_VIEW,payload:e})},f=async(t,e)=>{const n={...await u(e),pageType:s()};await(0,o.sendShopifyAnalytics)({eventName:o.AnalyticsEventName.PAGE_VIEW,payload:n})},g=async(t,e)=>{const n=await u(),r=function(t){return{products:t.map((({product:t,quantity:e,selected_variant:n})=>({productGid:`gid://shopify/Product/${t.id?.toString()??""}`,name:t.title||n?.title||"",price:n?.price?.toFixed(2)??"0.00",quantity:e,variantGid:n?.id?`gid://shopify/ProductVariant/${n.id.toString()}`:void 0,variantName:n?.title,brand:t.vendor||"",sku:n?.sku,category:""})))}}(e),i={...n,...r,collectionHandle:t.url,collectionId:t.id.toString(),pageType:s()};await(0,o.sendShopifyAnalytics)({eventName:o.AnalyticsEventName.COLLECTION_VIEW,payload:i})};function h(t,e=!1){const[n,o]=(0,r.buildProductAndVariant)(t),i=[n.title,o.title].join(" - "),a=(0,r.getCurrentPrice)(n,o),c=(0,r.getCartValue)(a,e);return{products:[{productGid:`gid://shopify/Product/${n.id??""}`,name:i,price:a.toFixed(2),quantity:n.quantity,variantGid:o.id?`gid://shopify/ProductVariant/${o.id.toString()}`:void 0,variantName:o.title,brand:o.brand||"",sku:o.sku,category:""}],totalValue:c}}},140:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.logAddToCartSnapchat=e.logSnapchatViewContent=e.logSnapchatPageView=e.loadSnapchat=void 0;const r=n(5);e.loadSnapchat=t=>{const{SNAPCHAT_ID:e,SNAPCHAT_DELAY:n=0}=window.__APP_CONFIG__.ANALYTICS;if(e){if(!window.snaptr){const t=(...e)=>{t.handleRequest?t.handleRequest.apply(t,e):t.queue.push(e)};t.queue=[],window.snaptr=t}(0,r.loadScriptWithDelay)({src:"//sc-static.net/scevent.min.js",id:"snapchat-script",timeout:1e3*n,anonymous:!1}),window.snaptr&&window.snaptr("init",e,{user_email:t.email})}},e.logSnapchatPageView=()=>{const{SNAPCHAT_ID:t}=window.__APP_CONFIG__.ANALYTICS;t&&window.snaptr&&window.snaptr("track","PAGE_VIEW")},e.logSnapchatViewContent=t=>{const{SNAPCHAT_ID:e}=window.__APP_CONFIG__.ANALYTICS;if(!e||!window.snaptr)return;const[n,o]=(0,r.buildProductAndVariant)(t);window.snaptr("track","VIEW_CONTENT",{currency:"USD",item_category:n.id,item_ids:o.id,description:`${n.title??""} - ${o.title??""}`,price:o.price})},e.logAddToCartSnapchat=t=>{const[e,n]=(0,r.buildProductAndVariant)(t),{SNAPCHAT_ID:o}=window.__APP_CONFIG__.ANALYTICS;o&&window.snaptr&&window.snaptr("track","ADD_CART",{currency:"USD",item_category:e.id,item_ids:n.id,description:`${e.title??""} - ${n.title??""}`,price:n.price})}},242:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initTikTok=function(){if("undefined"==typeof window)return;const{TIKTOK_ID:t}=window.__APP_CONFIG__.ANALYTICS;t&&(window._orlyTags||(window._orlyTags=[]),window._orlyTags.push(["addToCart",a],["viewContent",c],["loadScript",i]))};const r=n(5),o=n(243),i=()=>{const{TIKTOK_ID:t}=window.__APP_CONFIG__.ANALYTICS;t&&void 0===window.ttq&&(0,o.loadTikTokScript)(t)},a=(t,e)=>{const[n,o]=(0,r.buildProductAndVariant)(t);try{void 0!==window.ttq&&window.ttq.track("AddToCart",...s(n,o,e))}catch(t){console.log(t)}},c=(t,e)=>{const[n,o]=(0,r.buildProductAndVariant)(t);try{void 0!==window.ttq&&window.ttq.track("ViewContent",...s(n,o,e))}catch(t){console.log(t)}};function s(t,e,n){return[{content_id:t.id,content_type:"product",content_name:`${t.title??""} - ${e.title??""}`,quantity:1,price:e.price,curency:(0,r.readCookie)("cartCurrency")??"USD"},{event_id:n}]}},5:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cartItemToBentoAnalyticsItem=e.getItemCounts=e.getCartValue=e.getCurrentPrice=e.getOldCart=e.updateCart=e.safeParse=e.normalizeCart=e.buildProductAndVariant=void 0,e.loadScript=i,e.loadScriptWithDelay=function(t,e=(()=>{})){const{src:n,id:r,useRequestIdleCallback:a=!1}=t;if(document.querySelector(`#${r}`))"function"==typeof window.requestIdleCallback?window.requestIdleCallback(e):window.setTimeout(e,0);else if(a&&"function"==typeof window.requestIdleCallback)window.requestIdleCallback((()=>{i(t,e)}));else{const r=t.timeout||window.scriptDelayTime||1e4;o[n]=window.setTimeout(i,r,t,e)}},e.readCookie=a,e.entries=function(t){return Object.entries(t)},e.callOrlyTagHooks=async function(t,...e){const n=(window._orlyTags??[]).filter((([e])=>e===t)).map((async([,n])=>{try{return await n(...e)}catch(n){const r=new Error(`callOrlyTagHooks: error in type: ${t}\nparams: ${JSON.stringify(e,void 0,2)}\nerror: ${JSON.stringify(n,Object.getOwnPropertyNames(n),2)}`);return console.error(r),r}}));await Promise.allSettled(n)},e.getCartComponents=async function(t){try{const e=t.properties._olbid;if(!e)return[t];const n=await fetch("/pages/cart-json"),r=(await n.json()).items.find((t=>Object.fromEntries(t.properties)._olbid===e));return r?c(r.item_components):[t]}catch(e){return console.log(e),[t]}},e.isShopifyCartItem=s,e.isShopifyCartError=function(t){return"object"!=typeof t||null===t?(console.log("not even an object!"),!1):"string"==typeof t.message},e.isShopifyCart=l,e.waitForShopifyY=async function(){await(0,r.loadShopifyAccount)().catch((t=>{console.error("Could not load accout before getting _shopify_y",t)}));const t=a("_shopify_y");return t||console.error("_shopify_y should be defined"),t},e.uuid=function(){const t="xxxx-4xxx-xxxx-xxxxxxxxxxxx";let e="";try{const n=window.crypto||window.msCrypto,r=new Uint16Array(31);n.getRandomValues(r);let o=0;e=t.replace(/[x]/g,(function(t){for(let t=[],e=1;e>>0}catch(e){t=(new Date).getTime()>>>0}try{e=performance.now()>>>0}catch(t){e=0}const n=Math.abs(t+e).toString(16).toLowerCase();return"00000000".substring(0,8-n.length)+n}()+"-"+e},e.cancellableFetch=function(t,e={}){const n=new AbortController,{signal:r}=n;return{response:fetch(t,{...e,signal:r}),cancel:()=>{n.abort()}}},e.sha256=async function(t){const e=(new TextEncoder).encode(t),n=await crypto.subtle.digest("SHA-256",e);return[...new Uint8Array(n)].map((t=>t.toString(16).padStart(2,"0"))).join("")},e.imagePixel=function(t){const e=new Image;e.height=1,e.width=1,e.setAttribute("style","display:none;"),e.src=t,document.body.append(e)},e.ccpa_dns=function(){return/__ccpa_dns=true/.test(document.cookie)};const r=n(9),o={};function i(t,e=(()=>{})){const{src:n,id:r,anonymous:i=!0,defer:a=!0,async:c=!1}=t;if(o[n]&&window.clearTimeout(o[n]),document.querySelector(`#${r}`))return;const s=document.createElement("script");s.src=n,s.defer=a,s.id=r,s.async=c,i&&(s.crossOrigin="anonymous"),s.addEventListener("load","function"==typeof window.requestIdleCallback?()=>window.requestIdleCallback(e):e),document.body.append(s)}function a(t){const e=decodeURIComponent(document.cookie).match(/[^\s,;=]+=[^\s,;=]+/g);if(e)for(const n of e){const[e,r]=n.split("=");if(e===t)return r}}e.buildProductAndVariant=t=>[{id:t.product_id?.toString(),handle:t.handle,title:t.product_title,tags:[],price:t.price?.toString(),compareAtPrice:t.original_price?.toString(),vendor:t.vendor,productType:t.product_type,image:t.image,quantity:t.quantity},{id:t.variant_id?.toString(),sku:t.sku,brand:t.vendor,title:t.variant_title,price:t.price?.toString(),selectedOptions:t.options_with_values}];const c=t=>t.map((t=>({...t,price:.01*t.price,original_price:.01*t.original_price,final_line_price:.01*t.final_line_price,final_price:.01*t.final_price,original_line_price:.01*t.original_line_price,line_price:.01*t.line_price,variant_title:t.variant_title||t.variant_options.join(" / ")||"Default Title"})));function s(t){const e=t;return"string"==typeof e.key&&"number"==typeof e.quantity}function l(t){if("object"!=typeof t||null===t)return console.log("not even an object!"),!1;const{items:e}=t;return Array.isArray(e)&&e.every((t=>s(t)))}e.normalizeCart=t=>({...t,items:c(t.items),total_price:.01*t.total_price,total_discount:.01*t.total_discount,original_total_price:.01*t.original_total_price,items_subtotal_price:.01*t.items_subtotal_price}),e.safeParse=t=>{try{return JSON.parse(t)}catch(e){console.error("Could not parse as JSON:",t,"\nerror:",e)}};const d="outsmartly-shopify-cart";e.updateCart=t=>{window.localStorage.setItem(d,JSON.stringify(t))},e.getOldCart=()=>{const t=window.localStorage.getItem(d)||"";if(!t||0===t.length)return;const n=(0,e.safeParse)(t);return l(n)?n:void 0},e.getCurrentPrice=(t,e)=>{const n=e?.price||t?.price;return Number.parseFloat(n||"0")},e.getCartValue=(t,n=!1)=>{const r=(0,e.getOldCart)(),o=t||0;return r?.total_price||n?o:0},e.getItemCounts=t=>{const e=new Map;for(const n of t){const t=e.get(n.id);t?t.quantity+=n.quantity:e.set(n.id,{...n})}return e},e.cartItemToBentoAnalyticsItem=t=>{const e={src:t.featured_image?.url,alt:t.featured_image?.alt,width:t.featured_image?.width,aspect_ratio:t.featured_image?.aspect_ratio};return{product:{id:t.product_id,compare_at_price:t.original_price,price:t.price,selectedOptions:[],title:t.product_title,url:t.url,vendor:t.vendor,type:t.product_type,image:e},selected_variant:{id:t.variant_id,compare_at_price:t.original_price,price:t.price,sku:t.sku,url:t.url,inventory_quantity:1,title:t.variant_title,image:e},quantity:t.quantity}}},256:(t,e,n)=>{"use strict";n.r(e),n.d(e,{CART_EVENT_TYPES:()=>d,MIDDLEWARE_TYPES:()=>p,OutsmartlyCart:()=>w,SYSTEM_EVENT_TYPES:()=>u});var r=n(104),o=n.n(r),i=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))};function a(t,e=undefined){return new Promise(((n,r)=>{!function(){var o;i(this,void 0,void 0,(function*(){try{let i;if("function"==typeof(null===(o=window.__APP_CONFIG__)||void 0===o?void 0:o.fetchCartJSON))i=yield window.__APP_CONFIG__.fetchCartJSON(t,e);else{const n=yield fetch(t,e);i=yield n.json()}"Cart Error"==i.message&&r(i),n(i)}catch(t){r(t)}}))}()}))}const c=t=>a(`/cart.json?currency=${t}`,{credentials:"include",headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"})}),s=t=>a("/cart/update.js",{method:"POST",body:JSON.stringify({updates:t}),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"}),l=t=>a("/cart/change.js",{method:"POST",body:JSON.stringify(t),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"}),d={onInit:"onInit",onAddToCart:"onAddToCart",onChangeCart:"onChangeCart",onUpdateCart:"onUpdateCart",onAddDiscount:"onAddDiscount"},u={onSyncCartStart:"onSyncCartStart",onSyncCartError:"onSyncCartError",onSyncCartSuccess:"onSyncCartSuccess"},p={onBeforeInit:"onBeforeInit",onAfterInit:"onAfterInit",onBeforeChangeCart:"onBeforeChangeCart",onAfterChangeCart:"onAfterChangeCart",onBeforeUpdateCart:"onAfterUpdateCart",onAfterUpdateCart:"onAfterUpdateCart",onBeforeAddToCart:"onBeforeAddToCart",onAfterAddToCart:"onAfterAddToCart",onBeforeAddDiscount:"onBeforeAddDiscount",onAfterAddDiscount:"onAfterAddDiscount",onAfterPageLoad:"onAfterPageLoad",onPageLoad:"onPageLoad"};class y{constructor(){this._timer=NaN,this.prevActionStateUpdateShouldBeCanceled=!1,this._clearTimer=()=>{clearTimeout(this._timer),this._timer=NaN},this.runDelayed=(t,e=1333)=>(this.prevActionStateUpdateShouldBeCanceled=!0,this._clearTimer(),new Promise(((n,r)=>{this._timer=setTimeout((()=>{return e=this,o=void 0,a=function*(){try{this._clearTimer();const e=yield t();n(e)}catch(t){r(t)}finally{this.prevActionStateUpdateShouldBeCanceled=!1}},new((i=void 0)||(i=Promise))((function(t,n){function r(t){try{s(a.next(t))}catch(t){n(t)}}function c(t){try{s(a.throw(t))}catch(t){n(t)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(r,c)}s((a=a.apply(e,o||[])).next())}));var e,o,i,a}),e)})))}}class f{constructor(t){this.logs=[],this.debugMode=!0,this.addLog=t=>{this.debugMode&&this.logs.push(Object.assign(Object.assign({},t),{timestamp:Number(new Date)}))},this.readAllLogs=t=>{this.debugMode?t?console.log("Logger.readAllLogs",this.logs.filter((e=>e.invokerName==t))):console.log("Logger.readAllLogs",this.logs):console.log("Logger.debugMode off")},this.debugMode=t}}class g{constructor(){this._cacheForCombinedPayload=new Map,this.addPayload=(t,e=!1)=>{const n=this._cacheForCombinedPayload.get(String(t.id));if(n&&e){const e=Object.assign(Object.assign({},t),{quantity:n.quantity+t.quantity});this._cacheForCombinedPayload.set(String(t.id),e)}else this._cacheForCombinedPayload.set(String(t.id),t)},this.clearPayloads=()=>{this._cacheForCombinedPayload.clear()},this.getCombinedPayload=()=>[...this._cacheForCombinedPayload.values()]}}const h=({cart:t,cleanedPayload:e})=>{const n=t.items.reduce(((t,e)=>{if("--instant-cart-placeholder"==e.handle){const n=function({quantity:t,final_price:e}){return{quantity:t,final_price:e*t,discount:0,original_price:e}}(e);return t.item_count+=n.quantity,t.total_price+=n.final_price,t.total_discount+=n.discount,t.original_total_price+=n.original_price,t}const n=function({quantity:t,final_price:e,line_level_total_discount:n,original_price:r}){return{quantity:t,final_price:e*t,discount:n,original_price:r}}(e);return t.item_count+=n.quantity,t.total_price+=n.final_price,t.total_discount+=n.discount,t.original_total_price+=n.original_price,t}),{item_count:0,total_price:0,total_discount:0,original_total_price:0});return t.item_count=n.item_count,t.total_price=n.total_price,t.total_discount=n.total_discount,t.original_total_price=n.original_total_price,{cart:t,cleanedPayload:e}};function m(t){if(!("image"in t)||!("product_title"in t))throw"A makeCartItemPlaceholder payload does not contain required fields";const e=t;return void 0!==e.selling_plan?Object.assign(Object.assign({},e),{title:e.product_title,handle:"--instant-cart-placeholder",sku:"--instant-cart-placeholder",product_type:"--instant-cart-placeholder",variant_id:Number(e.id),key:`${e.id}`,selling_plan_allocation:{selling_plan:{id:e.selling_plan}}}):Object.assign(Object.assign({},e),{title:e.product_title,handle:"--instant-cart-placeholder",sku:"--instant-cart-placeholder",product_type:"--instant-cart-placeholder",variant_id:Number(e.id),key:`${e.id}`})}const v={token:"...",note:"",attributes:{},original_total_price:0,total_price:0,total_discount:0,total_weight:0,item_count:0,items:[],requires_shipping:!0,currency:"$",items_subtotal_price:0,cart_level_discount_applications:[]};var _=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))};class w{constructor(t=!0,e=1333){this.emitter=o()(),this.middlewares=[],this.custom={},this.delay=1333,this.currencyCode="USD",this._setter=null,this._getter=null,this._newActionInvoked=!1,this._cart=v,this._delayerForAdd=new y,this._delayerForUpdate=new y,this._delayerForChange=new y,this._cacheForPayloads=new g,this.logger=null,this.connectWithState=(t,e)=>{this._setter=t,this._getter=e},this.getLastState=()=>this._cart,this.addMiddleware=(t,e)=>{this.middlewares.push({onEvent:t,action:e})},this._runAllMiddlewaresFor=(t,e,n)=>_(this,void 0,void 0,(function*(){if(n)return;const r=this.middlewares.filter((e=>e.onEvent==t)).map((({action:t})=>t));if(0!=r.length)for(const t of r)yield t(e)})),this.init=(t=!1,e)=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";e&&(this.currencyCode=e);try{yield this._runAllMiddlewaresFor(p.onBeforeInit,{ref:this},t),this._emitStart(null,"onInit");const e=yield c(this.currencyCode);this._cart=e,this._setter((()=>({cart:e}))),this._emitDone(null,"onInit"),yield this._runAllMiddlewaresFor(p.onAfterInit,{ref:this},t)}catch(t){this._emitError(t,null,"onInit")}})),this._instantAddToCart=t=>{const e=this.getLastState();if(!e)throw"No-op case - cart is not initialized";if(!this.logger)throw"No-op case - Logger not initialized";const{logger:n}=this;let r={};return{cleanedPayload:{items:t.items.map((t=>{const{cart:o,cleanedPayload:i}=function(t,e,n){const r="image"in e;if(!t)throw"A no-op problem in cart library! - cart not exist";if(!("id"in e))throw"A no-op problem in cart library! - payload dont have id";const{id:o,quantity:i,properties:a,selling_plan:c}=e,s={id:o,quantity:i,properties:a,selling_plan:c},l=t.items.findIndex(((t,e)=>n=>{const{id:r}=t,o=String(n.id)==String(r),i=n.variant_title==e,a=function(t,e){const{selling_plan_allocation:n}=e,r=void 0!==n,o=void 0!==t.selling_plan;if(!r&&!o)return!0;if(!r)return!1;if(!o)return!1;const{selling_plan:i}=n;return t.selling_plan==i.id}(t,n);return!!o&&!!i&&a})(s,e.variant_title)),d=-1==l;return n.addLog({invokerName:"instantAddSingleItem.isNewItemInCart",payload:{foundIndex:l,isNewItemInCart:d,itemIds:[...t.items.map((({key:t})=>String(t)))],cleanedPayload:s,isInInstantMode:r}}),d?r?(t.items.unshift(m(e)),n.addLog({invokerName:"instantAddSingleItem.isNewItemInCart.isInInstantMode",payload:{foundIndex:l,isNewItemInCart:d,itemIds:[...t.items.map((({key:t})=>String(t)))],cleanedPayload:s,isInInstantMode:r}}),h({cart:t,cleanedPayload:s})):h({cart:t,cleanedPayload:e}):(t.items=t.items.reduce(((t,e,n)=>(n==l&&(e.quantity=e.quantity+Number(i)),[...t,e])),[]),n.addLog({invokerName:"instantAddSingleItem.!isNewItemInCart",payload:{foundIndex:l,isNewItemInCart:d,itemIds:[...t.items.map((({variant_id:t})=>String(t)))],cleanedPayload:s,isInInstantMode:r}}),h({cart:t,cleanedPayload:s}))}(e,t,n);return this._cacheForPayloads.addPayload(i,!0),r=o,i}))},instantCart:r}},this.addToCart=(t,e=!1)=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";if(!this._getter)throw"No-op case - you should add zustand getter first";const n=Object.assign({},this._cart);this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(p.onBeforeAddToCart,{payload:t,ref:this},e),this._emitStart(t,"onAddToCart");const{instantCart:n}=this._instantAddToCart(t);this._setter((()=>({cart:n})));const r=()=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";const n=this._cacheForPayloads.getCombinedPayload();if(this._cacheForPayloads.clearPayloads(),0==n.length)return;this._newActionInvoked=!1,yield(t=>i(void 0,void 0,void 0,(function*(){return a("/cart/add.js",{method:"POST",body:JSON.stringify(t),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"})})))({items:n});const r=yield c(this.currencyCode);this._newActionInvoked||(this._cart=r,this._setter((()=>({cart:this._cart}))),this._emitDone(t,"onAddToCart"),yield this._runAllMiddlewaresFor(p.onAfterAddToCart,{payload:t,ref:this},e))}));yield this._delayerForAdd.runDelayed(r,this.delay)}catch(e){this._emitError(e,t,"onAddToCart"),this._setter((()=>({cart:n})))}})),this._instantChangeCart=t=>{const e=this.getLastState();if(!e)throw"No-op case - cart is not initialized";if(!this.logger)throw"No-op case - Logger not initialized";const{logger:n}=this,{cleanedPayload:r,cart:o}=function(t,e,n){const r="image"in e;if(!t)throw"A no-op problem in cart library! - cart not exist";if(!("id"in e))throw"A no-op problem in cart library! - payload dont have id";const{id:o,quantity:i,line:a,properties:c}=e,s={id:o,quantity:i,line:a,properties:c},l=t.items.findIndex((({key:t})=>t==String(o))),d=-1!=l;if(n.addLog({invokerName:"instantChangeSingleItem.init",payload:{foundIndex:l,isItemInCart:d,itemIds:[...t.items.map((({key:t})=>t))],cleanedPayload:s,isInInstantMode:r}}),!d)return h({cart:t,cleanedPayload:s});const u=0==i;return t.items=t.items.reduce(((t,e)=>{if(e.key==String(o)){if(u)return[...t];e.quantity=Number(i)}return[...t,e]}),[]),n.addLog({invokerName:"instantChangeSingleItem.isItemInCart",payload:{foundIndex:l,isItemInCart:d,itemIds:[...t.items.map((({key:t})=>t))],cleanedPayload:s,isInInstantMode:r,removeMode:u}}),h({cart:t,cleanedPayload:s})}(e,t,n);return{cleanedPayload:r,instantCart:o}},this.changeCart=(t,e=!1)=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(p.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onChangeCart");const{cleanedPayload:n,instantCart:r}=this._instantChangeCart(t);this._setter((()=>({cart:r}))),this._cacheForPayloads.addPayload(n,!1);const o=()=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";let n=null;const r=this._cacheForPayloads.getCombinedPayload();if(this._cacheForPayloads.clearPayloads(),this._newActionInvoked=!1,1==r.length){const[t]=r;n=yield l(t)}else{const t=r.reduce(((t,{id:e,quantity:n})=>Object.assign(Object.assign({},t),{[e]:n})),{});n=yield s(t)}this._newActionInvoked||(this._cart=n,this._setter((()=>({cart:Object.assign({},this._cart)}))),this._emitDone(t,"onChangeCart"),yield this._runAllMiddlewaresFor(p.onAfterChangeCart,{payload:t,ref:this},e))}));yield this._delayerForChange.runDelayed(o,this.delay)}catch(e){this._emitError(e,t,"onChangeCart")}})),this.changeSellingPlan=(t,e=!1)=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(p.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onChangeSellingPlan");const{quantity:n,line:r,selling_plan:o}=t,i={quantity:n,line:r,selling_plan:o},a=yield l(i);return this._cart=a,this._setter((()=>({cart:Object.assign({},this._cart)}))),this._emitDone(t,"onChangeSellingPlan"),void(yield this._runAllMiddlewaresFor(p.onAfterChangeCart,{payload:t,ref:this},e))}catch(e){this._emitError(e,t,"onChangeSellingPlan")}})),this._instantUpdateCart=t=>{const e=this.getLastState();if(!e)throw"No-op case - cart is not initialized";if(!this.logger)throw"No-op case - Logger not initialized";const{logger:n}=this;let r={};const o=Object.entries(t).reduce(((t,[o,i])=>{const{cleanedPayload:a,cart:c}=function(t,e,n,r){const o="number"!=typeof n,i=[];if(!t)throw"A no-op problem in cart library! - cart not exist";const a=t.items.findIndex((({key:t})=>t==String(e))),c=-1!=a;if(r.addLog({invokerName:"instantUpdateSingleItem.isItemInCart",payload:{foundIndex:a,isItemInCart:c,itemIds:[...t.items.map((({key:t})=>t))],isInInstantMode:o,itemExtraFields:n,id:e}}),!o){const s=n,l=0==s;return r.addLog({invokerName:"instantChangeSingleItem.!isInInstantMode",payload:{foundIndex:a,isItemInCart:c,itemIds:[...t.items.map((({key:t})=>t))],itemExtraFields:n,isInInstantMode:o,removeMode:l,id:e}}),c?(t.items=t.items.reduce(((t,n)=>{if(n.key==String(e)){if(l)return[...t];n.quantity=Number(s)}return[...t,n]}),i),r.addLog({invokerName:"instantChangeSingleItem.!isInInstantMode.isItemInCart",payload:{foundIndex:a,isItemInCart:c,itemIds:[...t.items.map((({key:t})=>t))],itemExtraFields:n,isInInstantMode:o,removeMode:l,id:e}}),h({cart:t,cleanedPayload:{[String(e)]:s}})):h({cart:t,cleanedPayload:{[String(e)]:s}})}const{quantity:s}=n,l=0==s;if(r.addLog({invokerName:"instantChangeSingleItem.isInInstantMode",payload:{foundIndex:a,isItemInCart:c,itemIds:[...t.items.map((({key:t})=>t))],itemExtraFields:n,isInInstantMode:o,removeMode:l,id:e}}),!c){const i=Object.assign({id:String(e)},n);return t.items.unshift(m(i)),r.addLog({invokerName:"instantChangeSingleItem.isInInstantMode.!isItemInCart",payload:{foundIndex:a,isItemInCart:c,itemIds:[...t.items.map((({variant_id:t})=>String(t)))],itemExtraFields:n,isInInstantMode:o,removeMode:l,id:e}}),h({cart:t,cleanedPayload:{[String(e)]:s}})}return t.items=t.items.reduce(((t,n)=>{if(n.key==String(e)){if(l)return[...t];n.quantity=Number(s)}return[...t,n]}),i),r.addLog({invokerName:"instantChangeSingleItem.isInInstantMode.isItemInCart",payload:{foundIndex:a,isItemInCart:c,itemIds:[...t.items.map((({variant_id:t})=>String(t)))],itemExtraFields:n,isInInstantMode:o,removeMode:l,id:e}}),h({cart:t,cleanedPayload:{[String(e)]:s}})}(e,o,i,n);return r=c,Object.assign(Object.assign({},t),a)}),{});return{cleanedPayload:o,instantCart:r}},this.updateCart=(t,e=!1)=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{if(yield this._runAllMiddlewaresFor(p.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onUpdateCart"),0==Object.keys(t).length)throw"updateCart payload is not valid";const{instantCart:n,cleanedPayload:r}=this._instantUpdateCart(t);this._setter((()=>({cart:n})));const o=()=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!1;const n=yield s(r);this._newActionInvoked||(this._cart=n,this._setter((()=>({cart:n}))),this._emitDone(t,"onUpdateCart"),yield this._runAllMiddlewaresFor(p.onAfterChangeCart,{payload:t,ref:this},e))}));yield this._delayerForUpdate.runDelayed(o,this.delay)}catch(e){this._emitError(e,t,"onUpdateCart")}})),this.updateCartAttributes=(t,e=!1)=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{if(yield this._runAllMiddlewaresFor(p.onBeforeChangeCart,{payload:t,ref:this},e),this._emitStart(t,"onUpdateCart"),0==Object.keys(t).length)throw"updateCart payload is not valid";if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!1;const n=yield(t=>a("/cart/update.js",{method:"POST",body:JSON.stringify({attributes:t}),headers:new Headers({"Content-Type":"application/json","x-requested-with":"XMLHttpRequest"}),credentials:"include"}))(t);if(this._newActionInvoked)return;this._cart=n,this._setter((()=>({cart:n}))),this._emitDone(t,"onUpdateCart"),yield this._runAllMiddlewaresFor(p.onAfterChangeCart,{payload:t,ref:this},e)}catch(e){this._emitError(e,t,"onUpdateCart")}})),this.addDiscount=(t,e=!1)=>_(this,void 0,void 0,(function*(){if(!this._setter)throw"No-op case - you should add zustand setter first";this._newActionInvoked=!0;try{yield this._runAllMiddlewaresFor(p.onBeforeAddDiscount,{payload:t,ref:this},e),this._emitStart(t,"onAddDiscount"),this._newActionInvoked=!1,yield(n=t,fetch(`/discount/${n}`));const r=yield c(this.currencyCode);if(this._newActionInvoked)return;this._cart=r,this._setter((()=>({cart:r}))),this._emitDone(t,"onAddDiscount"),yield this._runAllMiddlewaresFor(p.onAfterAddDiscount,{payload:t,ref:this},e)}catch(e){this._emitError(e,t,"onAddDiscount")}var n})),this.setCustom=t=>{this.custom=Object.assign(Object.assign({},this.custom),t(this.custom))},this.getCustom=t=>t(this.custom),this.applyFixesForUI=t=>{if(void 0===t)return;if(!this._setter||!this._getter)throw"OutsmartlyCart.applyFixesForUI not connected to state";const e=t=>{t.persisted&&this.init()};t.addEventListener("pageshow",(t=>{e(t)}))},this.registerOnPageLoadActions=t=>{if(void 0===t)return;if(!this._setter||!this._getter)throw"OutsmartlyCart.registerOnPageLoadActions not connected to state";const e=()=>_(this,void 0,void 0,(function*(){try{yield this._runAllMiddlewaresFor(p.onAfterPageLoad,{ref:this},!1)}catch(t){this._emitError(t,null,"onPageLoad")}}));t.document.addEventListener("DOMContentLoaded",(()=>{e(),t.__cart__=this}))},this.logger=new f(t),this.delay=e}_emitError(t,e,n){this.emitter.emit("onSyncCartError",{error:t,ref:this});const r={payload:e,error:t,ref:this};this.emitter.emit(n,r)}_emitDone(t,e){this.emitter.emit(u.onSyncCartSuccess,{payload:t,ref:this}),this.emitter.emit(e,{payload:t,ref:this})}_emitStart(t,e){this.emitter.emit(u.onSyncCartStart,{ref:this,payload:t}),this.emitter.emit(e,{payload:t,ref:this})}normalizeNativeShopifyPriceFormat(t){return Number((t/100).toFixed(2))}}},143:(t,e,n)=>{"use strict";var r=n(62),o=n(144),i=n(148),a=n(156),c=n(157);(t.exports=function(t,e){var n,o,s,l,d;return arguments.length<2||"string"!=typeof t?(l=e,e=t,t=null):l=arguments[2],r(t)?(n=c.call(t,"c"),o=c.call(t,"e"),s=c.call(t,"w")):(n=s=!0,o=!1),d={value:e,configurable:n,enumerable:o,writable:s},l?i(a(l),d):d}).gs=function(t,e,n){var s,l,d,u;return"string"!=typeof t?(d=n,n=e,e=t,t=null):d=arguments[3],r(e)?o(e)?r(n)?o(n)||(d=n,n=void 0):n=void 0:(d=e,e=n=void 0):e=void 0,r(t)?(s=c.call(t,"c"),l=c.call(t,"e")):(s=!0,l=!1),u={get:e,set:n,configurable:s,enumerable:l},d?i(a(d),u):u}},154:t=>{"use strict";t.exports=function(){}},148:(t,e,n)=>{"use strict";t.exports=n(149)()?Object.assign:n(150)},149:t=>{"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},150:(t,e,n)=>{"use strict";var r=n(151),o=n(155),i=Math.max;t.exports=function(t,e){var n,a,c,s=i(arguments.length,2);for(t=Object(o(t)),c=function(r){try{t[r]=e[r]}catch(t){n||(n=t)}},a=1;a{"use strict";var r=n(154)();t.exports=function(t){return t!==r&&null!==t}},151:(t,e,n)=>{"use strict";t.exports=n(152)()?Object.keys:n(153)},152:t=>{"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},153:(t,e,n)=>{"use strict";var r=n(42),o=Object.keys;t.exports=function(t){return o(r(t)?Object(t):t)}},156:(t,e,n)=>{"use strict";var r=n(42),o=Array.prototype.forEach,i=Object.create;t.exports=function(t){var e=i(null);return o.call(arguments,(function(t){r(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)})),e}},160:t=>{"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},155:(t,e,n)=>{"use strict";var r=n(42);t.exports=function(t){if(!r(t))throw new TypeError("Cannot use null or undefined");return t}},157:(t,e,n)=>{"use strict";t.exports=n(158)()?String.prototype.contains:n(159)},158:t=>{"use strict";var e="razdwatrzy";t.exports=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}},159:t=>{"use strict";var e=String.prototype.indexOf;t.exports=function(t){return e.call(this,t,arguments[1])>-1}},104:(t,e,n)=>{"use strict";var r,o,i,a,c,s,l,d=n(143),u=n(160),p=Function.prototype.apply,y=Function.prototype.call,f=Object.create,g=Object.defineProperty,h=Object.defineProperties,m=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return u(e),o=this,r.call(this,t,n=function(){i.call(o,t,n),p.call(e,this,arguments)}),n.__eeOnceListener__=e,this},c={on:r=function(t,e){var n;return u(e),m.call(this,"__ee__")?n=this.__ee__:(n=v.value=f(null),g(this,"__ee__",v),v.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:i=function(t,e){var n,r,o,i;if(u(e),!m.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(r=n[t]))for(i=0;o=r[i];++i)o!==e&&o.__eeOnceListener__!==e||(2===r.length?n[t]=r[i?0:1]:r.splice(i,1));else r!==e&&r.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,r,o,i;if(m.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),e=1;e{var r=n(141);function o(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function i(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}t.exports=r(o),t.exports.strict=r(i),o.proto=o((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return o(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})}))},145:(t,e,n)=>{"use strict";var r=n(146);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!r(t)}},147:(t,e,n)=>{"use strict";var r=n(62),o={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!r(t)&&hasOwnProperty.call(o,typeof t)}},144:(t,e,n)=>{"use strict";var r=n(145),o=/^\s*class[\s{/}]/,i=Function.prototype.toString;t.exports=function(t){return!!r(t)&&!o.test(i.call(t))}},146:(t,e,n)=>{"use strict";var r=n(147);t.exports=function(t){if(!r(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},62:t=>{"use strict";t.exports=function(t){return null!=t}},141:t=>{t.exports=function t(e,n){if(e&&n)return t(e)(n);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(t){r[t]=e[t]})),r;function r(){for(var t=new Array(arguments.length),n=0;n{"use strict";n.r(e),n.d(e,{default:()=>i});var r=n(3);const o="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?r.useEffect:r.useLayoutEffect;function i(t){const e="function"==typeof t?function(t){let e;const n=new Set,r=(t,r)=>{const o="function"==typeof t?t(e):t;if(o!==e){const t=e;e=r?o:Object.assign({},e,o),n.forEach((n=>n(e,t)))}},o=()=>e,i={setState:r,getState:o,subscribe:(t,r,i)=>r||i?((t,r=o,i=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let a=r(e);function c(){const n=r(e);if(!i(a,n)){const e=a;t(a=n,e)}}return n.add(c),()=>n.delete(c)})(t,r,i):(n.add(t),()=>n.delete(t)),destroy:()=>n.clear()};return e=t(r,o,i),i}(t):t,n=(t=e.getState,n=Object.is)=>{const[,i]=(0,r.useReducer)((t=>t+1),0),a=e.getState(),c=(0,r.useRef)(a),s=(0,r.useRef)(t),l=(0,r.useRef)(n),d=(0,r.useRef)(!1),u=(0,r.useRef)();let p;void 0===u.current&&(u.current=t(a));let y=!1;(c.current!==a||s.current!==t||l.current!==n||d.current)&&(p=t(a),y=!n(u.current,p)),o((()=>{y&&(u.current=p),c.current=a,s.current=t,l.current=n,d.current=!1}));const f=(0,r.useRef)(a);o((()=>{const t=()=>{try{const t=e.getState(),n=s.current(t);l.current(u.current,n)||(c.current=t,u.current=n,i())}catch(t){d.current=!0,i()}},n=e.subscribe(t);return e.getState()!==f.current&&t(),n}),[]);const g=y?p:u.current;return(0,r.useDebugValue)(g),g};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const t=[n,e];return{next(){const e=t.length<=0;return{value:t.shift(),done:e}}}},n}},241:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AddToCartButton:()=>Et,AnalyticsEventName:()=>Ot,AnalyticsPageType:()=>kt,BuyNowButton:()=>te,CartCheckoutButton:()=>ee,CartCost:()=>ae,CartLineProvider:()=>le,CartLineQuantity:()=>de,CartLineQuantityAdjustButton:()=>ue,CartProvider:()=>vt,ExternalVideo:()=>fe,IMAGE_FRAGMENT:()=>Oe,Image:()=>ke,MediaFile:()=>He,ModelViewer:()=>Ye,Money:()=>ie,ProductPrice:()=>Ke,ProductProvider:()=>At,RichText:()=>Ze,SHOPIFY_S:()=>it,SHOPIFY_STOREFRONT_ID_HEADER:()=>et,SHOPIFY_STOREFRONT_S_HEADER:()=>rt,SHOPIFY_STOREFRONT_Y_HEADER:()=>nt,SHOPIFY_Y:()=>ot,ShopPayButton:()=>en,ShopifyProvider:()=>Q,ShopifySalesChannel:()=>xt,Video:()=>Ge,createStorefrontClient:()=>Y,customerAccountApiCustomScalars:()=>ye,decodeEncodedVariant:()=>me,flattenConnection:()=>N,getAdjacentAndFirstAvailableVariants:()=>Te,getClientBrowserParameters:()=>Xt,getProductOptions:()=>Ee,getShopifyCookies:()=>lt,isOptionValueCombinationInEncodedVariant:()=>he,mapSelectedProductOptionToObject:()=>_e,parseGid:()=>Dt,parseMetafield:()=>ze,sendShopifyAnalytics:()=>Zt,storefrontApiCustomScalars:()=>pe,useCart:()=>mt,useCartLine:()=>se,useLoadScript:()=>Be,useMoney:()=>ne,useProduct:()=>It,useSelectedOptionInUrlParam:()=>sn,useShop:()=>X,useShopifyCookies:()=>un});var r,o,i=n(3),a=n(0);function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(o=r||(r={}))[o.NotStarted=0]="NotStarted",o[o.Running=1]="Running",o[o.Stopped=2]="Stopped";var s={type:"xstate.init"};function l(t){return void 0===t?[]:[].concat(t)}function d(t){return{type:"xstate.assign",assignment:t}}function u(t,e){return"string"==typeof(t="string"==typeof t&&e&&e[t]?e[t]:t)?{type:t}:"function"==typeof t?{type:t.name,exec:t}:t}function p(t){return function(e){return t===e}}function y(t){return"string"==typeof t?{type:t}:t}function f(t,e){return{value:t,context:e,actions:[],changed:!1,matches:p(t)}}function g(t,e,n){var r=e,o=!1;return[t.filter((function(t){if("xstate.assign"===t.type){o=!0;var e=Object.assign({},r);return"function"==typeof t.assignment?e=t.assignment(r,n):Object.keys(t.assignment).forEach((function(o){e[o]="function"==typeof t.assignment[o]?t.assignment[o](r,n):t.assignment[o]})),r=e,!1}return!0})),r,o]}function h(t,e){void 0===e&&(e={});var n=c(g(l(t.states[t.initial].entry).map((function(t){return u(t,e.actions)})),t.context,s),2),r=n[0],o=n[1],i={config:t,_options:e,initialState:{value:t.initial,actions:r,context:o,matches:p(t.initial)},transition:function(e,n){var r,o,a="string"==typeof e?{value:e,context:t.context}:e,s=a.value,d=a.context,h=y(n),m=t.states[s];if(m.on){var v=l(m.on[h.type]);try{for(var _=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(v),w=_.next();!w.done;w=_.next()){var C=w.value;if(void 0===C)return f(s,d);var A="string"==typeof C?{target:C}:C,I=A.target,S=A.actions,b=void 0===S?[]:S,P=A.cond,T=void 0===P?function(){return!0}:P,E=void 0===I,O=null!=I?I:s,k=t.states[O];if(T(d,h)){var x=c(g((E?l(b):[].concat(m.exit,b,k.entry).filter((function(t){return t}))).map((function(t){return u(t,i._options.actions)})),d,h),3),N=x[0],L=x[1],D=x[2],R=null!=I?I:s;return{value:R,context:L,actions:N,changed:I!==s||N.length>0||D,matches:p(R)}}}}catch(t){r={error:t}}finally{try{w&&!w.done&&(o=_.return)&&o.call(_)}finally{if(r)throw r.error}}}return f(s,d)}};return i}var m,v,_,w,C=function(t,e){return t.actions.forEach((function(n){var r=n.exec;return r&&r(t.context,e)}))},A=i.useLayoutEffect,I={exports:{}},S={},b={exports:{}},P={};var T=(w||(w=1,I.exports=function(){if(_)return S;_=1;var t=i.default,e=(v||(v=1,b.exports=function(){if(m)return P;m=1;var t=i.default,e="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},n=t.useState,r=t.useEffect,o=t.useLayoutEffect,a=t.useDebugValue;function c(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!e(t,r)}catch(t){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,e){return e()}:function(t,e){var i=e(),s=n({inst:{value:i,getSnapshot:e}}),l=s[0].inst,d=s[1];return o((function(){l.value=i,l.getSnapshot=e,c(l)&&d({inst:l})}),[t,i,e]),r((function(){return c(l)&&d({inst:l}),t((function(){c(l)&&d({inst:l})}))}),[t]),a(i),i};return P.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:s,P}()),b.exports),n="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},r=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,c=t.useMemo,s=t.useDebugValue;return S.useSyncExternalStoreWithSelector=function(t,e,i,l,d){var u=o(null);if(null===u.current){var p={hasValue:!1,value:null};u.current=p}else p=u.current;u=c((function(){function t(t){if(!a){if(a=!0,r=t,t=l(t),void 0!==d&&p.hasValue){var e=p.value;if(d(e,t))return o=e}return o=t}if(e=o,n(r,t))return e;var i=l(t);return void 0!==d&&d(e,i)?e:(r=t,o=i)}var r,o,a=!1,c=void 0===i?null:i;return[function(){return t(e())},null===c?void 0:function(){return t(c())}]}),[e,i,l,d]);var y=r(t,u[0],u[1]);return a((function(){p.hasValue=!0,p.value=y}),[y]),s(y),y},S}()),I.exports),E=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function O(t){return t}var k=function(t){var e;return t.subscribe((function(t){e=t})).unsubscribe(),e};var x=function(t,e){return!1===e.changed};function N(t){if(!t){const e=`flattenConnection(): needs a 'connection' to flatten, but received '${t??""}' instead.`;return console.error(e+" Returning an empty array"),[]}return"nodes"in t?t.nodes:"edges"in t&&Array.isArray(t.edges)?t.edges.map((t=>{if(!(null==t?void 0:t.node))throw new Error("flattenConnection(): Connection edges must contain nodes");return t.node})):[]}const L=t=>`\n mutation CartLineAdd(\n $cartId: ID!\n $lines: [CartLineInput!]!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,D=t=>`\n mutation CartCreate(\n $input: CartInput!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartCreate(input: $input) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,R=t=>`\n mutation CartLineRemove(\n $cartId: ID!\n $lines: [ID!]!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartLinesRemove(cartId: $cartId, lineIds: $lines) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,U=t=>`\n mutation CartLineUpdate(\n $cartId: ID!\n $lines: [CartLineUpdateInput!]!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,V=t=>`\n mutation CartNoteUpdate(\n $cartId: ID!\n $note: String!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,F=t=>`\n mutation CartBuyerIdentityUpdate(\n $cartId: ID!\n $buyerIdentity: CartBuyerIdentityInput!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,j=t=>`\n mutation CartAttributesUpdate(\n $attributes: [AttributeInput!]!\n $cartId: ID!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,$=t=>`\n mutation CartDiscountCodesUpdate(\n $cartId: ID!\n $discountCodes: [String!]\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n ...CartFragment\n }\n }\n }\n\n ${t}\n`,M=t=>`\n query CartQuery(\n $id: ID!\n $numCartLines: Int = 250\n $country: CountryCode = ZZ\n $language: LanguageCode\n ) @inContext(country: $country, language: $language) {\n cart(id: $id) {\n ...CartFragment\n }\n }\n\n ${t}\n`,q="\n fragment CartFragment on Cart {\n id\n checkoutUrl\n totalQuantity\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n lines(first: $numCartLines) {\n edges {\n node {\n id\n quantity\n attributes {\n key\n value\n }\n cost {\n totalAmount {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n availableForSale\n compareAtPrice {\n ...MoneyFragment\n }\n price {\n ...MoneyFragment\n }\n requiresShipping\n title\n image {\n ...ImageFragment\n }\n product {\n handle\n title\n id\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n cost {\n subtotalAmount {\n ...MoneyFragment\n }\n totalAmount {\n ...MoneyFragment\n }\n totalDutyAmount {\n ...MoneyFragment\n }\n totalTaxAmount {\n ...MoneyFragment\n }\n }\n note\n attributes {\n key\n value\n }\n discountCodes {\n code\n applicable\n }\n }\n\n fragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n }\n fragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n }\n",B="2025-01",G=t=>t.includes("mock.shop");function Y({storeDomain:t,privateStorefrontToken:e,publicStorefrontToken:n,storefrontApiVersion:r=B,contentType:o}){if(!t)throw new Error(W+"`storeDomain` is required when creating a new Storefront client in production.");r!==B&&K(`The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting.\nYou may run into unexpected errors if these versions don't match. Received version: "${r}"; expected version "${B}"`);const i=e=>{const n=(null==e?void 0:e.storeDomain)??t;return n.includes("://")?n:`https://${n}`};return{getShopifyDomain:i,getStorefrontApiUrl(t){const e=i(t),n=e+(e.endsWith("/")?"api":"/api");return G(e)?n:`${n}/${(null==t?void 0:t.storefrontApiVersion)??r}/graphql.json`},getPrivateTokenHeaders(n){if(!e&&!(null==n?void 0:n.privateStorefrontToken)&&!G(t))throw new Error(W+"You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`");return{"content-type":"graphql"===((null==n?void 0:n.contentType)??o)?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":r,"Shopify-Storefront-Private-Token":(null==n?void 0:n.privateStorefrontToken)??e??"",...(null==n?void 0:n.buyerIp)?{"Shopify-Storefront-Buyer-IP":n.buyerIp}:{}}},getPublicTokenHeaders(e){if(!n&&!(null==e?void 0:e.publicStorefrontToken)&&!G(t))throw new Error(W+"You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`");return H((null==e?void 0:e.contentType)??o??"json",r,(null==e?void 0:e.publicStorefrontToken)??n??"")}}}function H(t,e,n){return{"content-type":"graphql"===t?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":e,"X-Shopify-Storefront-Access-Token":n}}const z=new Set,W="[h2:error:createStorefrontClient] ",K=(t,e="warn")=>{z.has(t)||(console[e](`[h2:${e}:createStorefrontClient] `+t),z.add(t))},J={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:B,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl:()=>"",getPublicTokenHeaders:()=>({}),getShopifyDomain:()=>""},Z=(0,i.createContext)(J);function Q({children:t,...e}){if(!(e.countryIsoCode&&e.languageIsoCode&&e.storeDomain&&e.storefrontToken&&e.storefrontApiVersion))throw new Error("Please provide the necessary props to ''");e.storefrontApiVersion!==B&&console.warn(`: This version of Hydrogen React is built for Shopify's Storefront API version ${B}, but it looks like you're using version ${e.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const n=(0,i.useMemo)((()=>{function t(t){const n=(null==t?void 0:t.storeDomain)??e.storeDomain;return n.includes("://")?n:`https://${n}`}return{...e,getPublicTokenHeaders:t=>H(t.contentType,e.storefrontApiVersion,t.storefrontToken??e.storefrontToken),getShopifyDomain:t,getStorefrontApiUrl(n){const r=t({storeDomain:(null==n?void 0:n.storeDomain)??e.storeDomain});return`${r}${r.endsWith("/")?"":"/"}api/${(null==n?void 0:n.storefrontApiVersion)??e.storefrontApiVersion}/graphql.json`}}}),[e]);return(0,a.jsx)(Z.Provider,{value:n,children:t})}function X(){const t=(0,i.useContext)(Z);if(!t)throw new Error("'useShop()' must be a descendent of ");return t}const tt="shopifyCartId",et="Shopify-Storefront-Id",nt="Shopify-Storefront-Y",rt="Shopify-Storefront-S",ot="_shopify_y",it="_shopify_s";var at=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);const ct="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function st(){let t="";try{const e=window.crypto,n=new Uint16Array(31);e.getRandomValues(n);let r=0;t=ct.replace(/[x]/g,(t=>{const e=n[r]%16;return r++,("x"===t?e:3&e|8).toString(16)})).toUpperCase()}catch(e){t=ct.replace(/[x]/g,(t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})).toUpperCase()}return`${function(){let t=0,e=0;t=(new Date).getTime()>>>0;try{e=performance.now()>>>0}catch(t){e=0}return Math.abs(t+e).toString(16).toLowerCase().padStart(8,"0")}()}-${t}`}function lt(t){const e=function(t){let e,n,r,o,i={},a=0,c=t.split(/;\s*/g);for(;anull==t?void 0:t.cart}),"onCartActionEntry","onCartActionOptimisticUI",t],on:{RESOLVE:{target:(null==e?void 0:e.resolveTarget)||"idle",actions:[d({prevCart:t=>null==t?void 0:t.lastValidCart,cart:(t,e)=>{var n;return null==(n=null==e?void 0:e.payload)?void 0:n.cart},rawCartResult:(t,e)=>{var n;return null==(n=null==e?void 0:e.payload)?void 0:n.rawCartResult},errors:t=>{}})]},ERROR:{target:(null==e?void 0:e.errorTarget)||"error",actions:[d({prevCart:t=>null==t?void 0:t.lastValidCart,cart:t=>null==t?void 0:t.lastValidCart,errors:(t,e)=>{var n;return null==(n=null==e?void 0:e.payload)?void 0:n.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:d({prevCart:t=>{},cart:t=>{},lastValidCart:t=>{},rawCartResult:t=>{},errors:t=>{}})}},exit:["onCartActionComplete",...(null==e?void 0:e.exitActions)||[]]}}const ut={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[d({rawCartResult:(t,e)=>e.payload.cart,cart:(t,e)=>ft(e.payload.cart)})]}},pt={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function yt({numCartLines:t,onCartActionEntry:e,onCartActionOptimisticUI:n,onCartActionComplete:o,data:a,cartFragment:c,countryCode:l,languageCode:u}){const{cartFetch:f,cartCreate:g,cartLineAdd:m,cartLineUpdate:v,cartLineRemove:_,noteUpdate:w,buyerIdentityUpdate:I,cartAttributesUpdate:S,discountCodesUpdate:b}=function({numCartLines:t,cartFragment:e,countryCode:n="US",languageCode:r="EN"}){const o=function(){const{storefrontId:t,getPublicTokenHeaders:e,getStorefrontApiUrl:n}=X();return(0,i.useCallback)((({query:r,variables:o})=>{const i=e({contentType:"json"});t&&(i[et]=t);const a=lt(document.cookie);return i[nt]=a[ot],i[rt]=a[it],fetch(n(),{method:"POST",headers:i,body:JSON.stringify({query:r.toString(),variables:o})}).then((t=>t.json())).catch((t=>({data:void 0,errors:null==t?void 0:t.toString()})))}),[e,t,n])}(),a=(0,i.useCallback)((i=>o({query:M(e),variables:{id:i,numCartLines:t,country:n,language:r}})),[o,e,t,n,r]),c=(0,i.useCallback)((i=>o({query:D(e),variables:{input:i,numCartLines:t,country:n,language:r}})),[e,n,o,t,r]),s=(0,i.useCallback)(((i,a)=>o({query:L(e),variables:{cartId:i,lines:a,numCartLines:t,country:n,language:r}})),[e,n,o,t,r]),l=(0,i.useCallback)(((i,a)=>o({query:U(e),variables:{cartId:i,lines:a,numCartLines:t,country:n,language:r}})),[e,n,o,t,r]),d=(0,i.useCallback)(((i,a)=>o({query:R(e),variables:{cartId:i,lines:a,numCartLines:t,country:n,language:r}})),[e,n,o,t,r]),u=(0,i.useCallback)(((i,a)=>o({query:V(e),variables:{cartId:i,note:a,numCartLines:t,country:n,language:r}})),[o,e,t,n,r]),p=(0,i.useCallback)(((i,a)=>o({query:F(e),variables:{cartId:i,buyerIdentity:a,numCartLines:t,country:n,language:r}})),[e,n,o,t,r]),y=(0,i.useCallback)(((i,a)=>o({query:j(e),variables:{cartId:i,attributes:a,numCartLines:t,country:n,language:r}})),[e,n,o,t,r]),f=(0,i.useCallback)(((i,a)=>o({query:$(e),variables:{cartId:i,discountCodes:a,numCartLines:t,country:n,language:r}})),[e,n,o,t,r]);return(0,i.useMemo)((()=>({cartFetch:a,cartCreate:c,cartLineAdd:s,cartLineUpdate:l,cartLineRemove:d,noteUpdate:u,buyerIdentityUpdate:p,cartAttributesUpdate:y,discountCodesUpdate:f,cartFragment:e})),[a,c,s,l,d,u,p,y,f,e])}({numCartLines:t,cartFragment:c,countryCode:l,languageCode:u}),P=(0,i.useMemo)((()=>{return h({id:"Cart",initial:(t=a)?"idle":"uninitialized",context:{cart:t&&ft(t)},states:{uninitialized:{on:ut},cartCompleted:{on:ut},initializationError:{on:ut},idle:{on:{...ut,...pt}},error:{on:{...ut,...pt}},cartFetching:dt("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:dt("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:dt("cartLineRemoveAction"),cartLineUpdating:dt("cartLineUpdateAction"),cartLineAdding:dt("cartLineAddAction"),noteUpdating:dt("noteUpdateAction"),buyerIdentityUpdating:dt("buyerIdentityUpdateAction"),cartAttributesUpdating:dt("cartAttributesUpdateAction"),discountCodesUpdating:dt("discountCodesUpdateAction")}});var t}),[a]),[N,q,B]=function(t,e){var n,o,a=(0,i.useRef)(),c=E((n=function(){var n=[],o=function(t){var e=t.initialState,n=r.NotStarted,o=new Set,i={_machine:t,send:function(i){n===r.Running&&(e=t.transition(e,i),C(e,y(i)),o.forEach((function(t){return t(e)})))},subscribe:function(t){return o.add(t),t(e),{unsubscribe:function(){return o.delete(t)}}},start:function(o){if(o){var a="object"==typeof o?o:{context:t.config.context,value:o};e={value:a.value,actions:[],context:a.context,matches:p(a.value)}}else e=t.initialState;return n=r.Running,C(e,s),i},stop:function(){return n=r.Stopped,o.clear(),i},get state(){return e},get status(){return n}};return i}(h(t.config,e||t._options)),i=o.send;return o.send=function(t){o.status!==r.NotStarted?(i(t),a.current=o.state):n.push(t)},[o,n]},(o=i.useRef()).current||(o.current={v:n()}),o.current.v),2),l=c[0],d=c[1];A((function(){e&&(l._machine._options=e)}));var u=function(t){var e=(0,i.useCallback)((function(){return k(t)}),[t]),n=(0,i.useCallback)((function(e){return t.subscribe(e).unsubscribe}),[t]);return[T.useSyncExternalStoreWithSelector(n,e,e,O,x),t.send,t]}(l);return(0,i.useEffect)((function(){return l.start(a.current),d.forEach(l.send),a.current=l.state,function(){l.stop()}}),[]),u}(P,{actions:{cartFetchAction:async(t,e)=>{var n;if("CART_FETCH"!==e.type)return;const{data:r,errors:o}=await f(null==(n=null==e?void 0:e.payload)?void 0:n.cartId),i=gt(e,null==r?void 0:r.cart,o);q(i)},cartCreateAction:async(t,e)=>{var n;if("CART_CREATE"!==e.type)return;const{data:r,errors:o}=await g(null==e?void 0:e.payload),i=gt(e,null==(n=null==r?void 0:r.cartCreate)?void 0:n.cart,o);q(i)},cartLineAddAction:async(t,e)=>{var n,r;if("CARTLINE_ADD"!==e.type||!(null==(n=null==t?void 0:t.cart)?void 0:n.id))return;const{data:o,errors:i}=await m(t.cart.id,e.payload.lines),a=gt(e,null==(r=null==o?void 0:o.cartLinesAdd)?void 0:r.cart,i);q(a)},cartLineUpdateAction:async(t,e)=>{var n,r;if("CARTLINE_UPDATE"!==e.type||!(null==(n=null==t?void 0:t.cart)?void 0:n.id))return;const{data:o,errors:i}=await v(t.cart.id,e.payload.lines),a=gt(e,null==(r=null==o?void 0:o.cartLinesUpdate)?void 0:r.cart,i);q(a)},cartLineRemoveAction:async(t,e)=>{var n,r;if("CARTLINE_REMOVE"!==e.type||!(null==(n=null==t?void 0:t.cart)?void 0:n.id))return;const{data:o,errors:i}=await _(t.cart.id,e.payload.lines),a=gt(e,null==(r=null==o?void 0:o.cartLinesRemove)?void 0:r.cart,i);q(a)},noteUpdateAction:async(t,e)=>{var n,r;if("NOTE_UPDATE"!==e.type||!(null==(n=null==t?void 0:t.cart)?void 0:n.id))return;const{data:o,errors:i}=await w(t.cart.id,e.payload.note),a=gt(e,null==(r=null==o?void 0:o.cartNoteUpdate)?void 0:r.cart,i);q(a)},buyerIdentityUpdateAction:async(t,e)=>{var n,r;if("BUYER_IDENTITY_UPDATE"!==e.type||!(null==(n=null==t?void 0:t.cart)?void 0:n.id))return;const{data:o,errors:i}=await I(t.cart.id,e.payload.buyerIdentity),a=gt(e,null==(r=null==o?void 0:o.cartBuyerIdentityUpdate)?void 0:r.cart,i);q(a)},cartAttributesUpdateAction:async(t,e)=>{var n,r;if("CART_ATTRIBUTES_UPDATE"!==e.type||!(null==(n=null==t?void 0:t.cart)?void 0:n.id))return;const{data:o,errors:i}=await S(t.cart.id,e.payload.attributes),a=gt(e,null==(r=null==o?void 0:o.cartAttributesUpdate)?void 0:r.cart,i);q(a)},discountCodesUpdateAction:async(t,e)=>{var n,r;if("DISCOUNT_CODES_UPDATE"!==e.type||!(null==(n=null==t?void 0:t.cart)?void 0:n.id))return;const{data:o,errors:i}=await b(t.cart.id,e.payload.discountCodes),a=gt(e,null==(r=null==o?void 0:o.cartDiscountCodesUpdate)?void 0:r.cart,i);q(a)},...e&&{onCartActionEntry:(t,n)=>{(function(t){return"CART_CREATE"===t.type||"CARTLINE_ADD"===t.type||"CARTLINE_UPDATE"===t.type||"CARTLINE_REMOVE"===t.type||"NOTE_UPDATE"===t.type||"BUYER_IDENTITY_UPDATE"===t.type||"CART_ATTRIBUTES_UPDATE"===t.type||"DISCOUNT_CODES_UPDATE"===t.type})(n)&&e(t,n)}},...n&&{onCartActionOptimisticUI:d(((t,e)=>n(t,e)))},...o&&{onCartActionComplete:(t,e)=>{(function(t){return"RESOLVE"===t.type||"ERROR"===t.type||"CART_COMPLETED"===t.type})(e)&&o(t,e)}}}});return(0,i.useMemo)((()=>[N,q,B]),[N,q,B])}function ft(t){return{...t,lines:N(null==t?void 0:t.lines),note:t.note??void 0}}function gt(t,e,n){return n?{type:"ERROR",payload:{errors:n,cartActionEvent:t}}:e?{type:"RESOLVE",payload:{cart:ft(e),rawCartResult:e,cartActionEvent:t}}:{type:"CART_COMPLETED",payload:{cartActionEvent:t}}}const ht=(0,i.createContext)(null);function mt(){const t=(0,i.useContext)(ht);if(!t)throw new Error("Expected a Cart Context, but no Cart Context was found");return t}function vt({children:t,numCartLines:e,onCreate:n,onLineAdd:r,onLineRemove:o,onLineUpdate:c,onNoteUpdate:s,onBuyerIdentityUpdate:l,onAttributesUpdate:d,onDiscountCodesUpdate:u,onCreateComplete:p,onLineAddComplete:y,onLineRemoveComplete:f,onLineUpdateComplete:g,onNoteUpdateComplete:h,onBuyerIdentityUpdateComplete:m,onAttributesUpdateComplete:v,onDiscountCodesUpdateComplete:_,data:w,cartFragment:C=q,customerAccessToken:A,countryCode:I,languageCode:S}){var b,P,T,E,O,k,x;const N=X();if(!N)throw new Error(" needs to be a descendant of ");I=(I??N.countryIsoCode??"US").toUpperCase(),S=(S??N.languageIsoCode??"EN").toUpperCase(),I&&(I=I.toUpperCase());const[L,D]=(0,i.useState)(I),[R,U]=(0,i.useState)(A),V=(0,i.useRef)(!1);L===I&&R===A||(D(I),U(A),V.current=!1);const[F,j]=yt({numCartLines:e,data:w,cartFragment:C,countryCode:I,languageCode:S,onCartActionEntry(t,e){try{switch(e.type){case"CART_CREATE":return null==n?void 0:n();case"CARTLINE_ADD":return null==r?void 0:r();case"CARTLINE_REMOVE":return null==o?void 0:o();case"CARTLINE_UPDATE":return null==c?void 0:c();case"NOTE_UPDATE":return null==s?void 0:s();case"BUYER_IDENTITY_UPDATE":return null==l?void 0:l();case"CART_ATTRIBUTES_UPDATE":return null==d?void 0:d();case"DISCOUNT_CODES_UPDATE":return null==u?void 0:u()}}catch(t){console.error("Cart entry action failed",t)}},onCartActionOptimisticUI(t,e){var n,r,o,i;if(!t.cart)return{...t};switch(e.type){case"CARTLINE_REMOVE":return{...t,cart:{...t.cart,lines:null==(r=null==(n=null==t?void 0:t.cart)?void 0:n.lines)?void 0:r.filter((t=>(null==t?void 0:t.id)&&!e.payload.lines.includes(null==t?void 0:t.id)))}};case"CARTLINE_UPDATE":return{...t,cart:{...t.cart,lines:null==(i=null==(o=null==t?void 0:t.cart)?void 0:o.lines)?void 0:i.map((t=>{const n=e.payload.lines.find((({id:e})=>e===(null==t?void 0:t.id)));return n&&n.quantity?{...t,quantity:n.quantity}:t}))}}}return{...t}},onCartActionComplete(t,e){const n=e.payload.cartActionEvent;try{if("RESOLVE"===e.type)switch(n.type){case"CART_CREATE":return null==p?void 0:p();case"CARTLINE_ADD":return null==y?void 0:y();case"CARTLINE_REMOVE":return null==f?void 0:f();case"CARTLINE_UPDATE":return null==g?void 0:g();case"NOTE_UPDATE":return null==h?void 0:h();case"BUYER_IDENTITY_UPDATE":return function(t,e){var n,r;return!(!e.payload.buyerIdentity.countryCode||(null==(r=null==(n=t.cart)?void 0:n.buyerIdentity)?void 0:r.countryCode)===e.payload.buyerIdentity.countryCode)}(t,n)&&(V.current=!0),null==m?void 0:m();case"CART_ATTRIBUTES_UPDATE":return null==v?void 0:v();case"DISCOUNT_CODES_UPDATE":return null==_?void 0:_()}}catch(t){console.error("onCartActionComplete failed",t)}}}),$=(0,i.useRef)(!1),[M,B]=(0,i.useState)(!1),G=F.matches("cartCompleted"),Y=("idle"===F.value||"error"===F.value||"cartCompleted"===F.value)&&I!==(null==(T=null==(P=null==(b=null==F?void 0:F.context)?void 0:b.cart)?void 0:P.buyerIdentity)?void 0:T.countryCode)&&!F.context.errors,H=(0,i.useRef)(!1);(0,i.useEffect)((()=>{if(!$.current&&!H.current){if(!w&&wt("localStorage")){H.current=!0;try{const t=window.localStorage.getItem(tt);t&&j({type:"CART_FETCH",payload:{cartId:t}})}catch(t){console.warn("error fetching cartId"),console.warn(t)}}$.current=!0,B(!0)}}),[w,$,j]),(0,i.useEffect)((()=>{Y&&!V.current&&j({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:I,customerAccessToken:A}}})}),[I,A,Y,V,j]);const z=(0,i.useCallback)((t=>{if(!$.current)return console.warn("Cart isn't ready yet");j(t)}),[j]);(0,i.useEffect)((()=>{var t,e,n;if((null==(e=null==(t=null==F?void 0:F.context)?void 0:t.cart)?void 0:e.id)&&wt("localStorage"))try{window.localStorage.setItem(tt,null==(n=F.context.cart)?void 0:n.id)}catch(t){console.warn("Failed to save cartId to localStorage",t)}}),[null==(O=null==(E=null==F?void 0:F.context)?void 0:E.cart)?void 0:O.id]),(0,i.useEffect)((()=>{if(G&&wt("localStorage"))try{window.localStorage.removeItem(tt)}catch(t){console.warn("Failed to delete cartId from localStorage",t)}}),[G]);const W=(0,i.useCallback)((t=>{var e,n;I&&!(null==(e=t.buyerIdentity)?void 0:e.countryCode)&&(null==t.buyerIdentity&&(t.buyerIdentity={}),t.buyerIdentity.countryCode=I),A&&!(null==(n=t.buyerIdentity)?void 0:n.customerAccessToken)&&(null==t.buyerIdentity&&(t.buyerIdentity={}),t.buyerIdentity.customerAccessToken=A),z({type:"CART_CREATE",payload:t})}),[I,A,z]),K=function(t){const[e,n]=(0,i.useTransition)(),[r,o]=(0,i.useState)(t),a=(0,i.useRef)(!1);e&&(a.current=!0);const c=(0,i.useRef)(!1);return!e&&a.current&&(c.current=!0),(0,i.useEffect)((()=>{n((()=>{c.current||o(t)}))}),[t]),c.current?t:r}(F),J=(0,i.useMemo)((()=>{var t,e,n,r;return{...(null==(t=null==K?void 0:K.context)?void 0:t.cart)??{lines:[],attributes:[]},status:_t(K.value),error:null==(e=null==K?void 0:K.context)?void 0:e.errors,totalQuantity:(null==(r=null==(n=null==K?void 0:K.context)?void 0:n.cart)?void 0:r.totalQuantity)??0,cartCreate:W,cartReady:M,linesAdd(t){var e,n;(null==(n=null==(e=null==K?void 0:K.context)?void 0:e.cart)?void 0:n.id)?z({type:"CARTLINE_ADD",payload:{lines:t}}):W({lines:t})},linesRemove(t){z({type:"CARTLINE_REMOVE",payload:{lines:t}})},linesUpdate(t){z({type:"CARTLINE_UPDATE",payload:{lines:t}})},noteUpdate(t){z({type:"NOTE_UPDATE",payload:{note:t}})},buyerIdentityUpdate(t){z({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:t}})},cartAttributesUpdate(t){z({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:t}})},discountCodesUpdate(t){z({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:t}})},cartFragment:C}}),[W,M,null==(k=null==K?void 0:K.context)?void 0:k.cart,null==(x=null==K?void 0:K.context)?void 0:x.errors,K.value,C,z]);return(0,a.jsx)(ht.Provider,{value:J,children:t})}function _t(t){switch(t){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function wt(t){let e;try{e=window[t];const n="__storage_test__";return e.setItem(n,n),e.removeItem(n),!0}catch(t){return!(!(t instanceof DOMException)||22!==t.code&&1014!==t.code&&"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||!e||0===e.length)}}const Ct=(0,i.createContext)(null);function At({children:t,data:e,initialVariantId:n}){const r=(0,i.useMemo)((()=>N(e.variants??{})),[e.variants]);if(!(o=r)||!Array.isArray(o))throw new Error(" requires 'product.variants.nodes' or 'product.variants.edges'");var o;const c=(0,i.useMemo)((()=>function(t){const e=t.reduce(((t,e)=>{var n;if(!e.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return null==(n=null==e?void 0:e.selectedOptions)||n.forEach((e=>{t[(null==e?void 0:e.name)??""]=t[(null==e?void 0:e.name)??""]||new Set,t[(null==e?void 0:e.name)??""].add((null==e?void 0:e.value)??"")})),t}),{});return Object.keys(e).map((t=>({name:t,values:Array.from(e[t])})))}(r)),[r]),[s,l]=(0,i.useState)((()=>bt(n,r))),[d,u]=(0,i.useState)((()=>Pt(s)));(0,i.useEffect)((()=>{const t=bt(n,r);l(t),u(Pt(t))}),[n,r]);const p=(0,i.useCallback)(((t,e)=>{u((n=>{const o={...n,[t]:e};return l(St(r,o)),o}))}),[u,r]),y=(0,i.useCallback)(((t,e)=>{const n=St(r,{...d,[t]:e});return(null==n?void 0:n.availableForSale)??!0}),[d,r]),f=(0,i.useMemo)((()=>N(e.sellingPlanGroups??{}).map((t=>({...t,sellingPlans:N((null==t?void 0:t.sellingPlans)??{})})))),[e.sellingPlanGroups]),[g,h]=(0,i.useState)(void 0),m=(0,i.useMemo)((()=>{var t,e;if(s&&g){if(!(null==(t=s.sellingPlanAllocations)?void 0:t.nodes)&&!(null==(e=s.sellingPlanAllocations)?void 0:e.edges))throw new Error(": You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return N(s.sellingPlanAllocations).find((t=>{var e;return(null==(e=null==t?void 0:t.sellingPlan)?void 0:e.id)===g.id}))}}),[s,g]),v=(0,i.useMemo)((()=>({product:e,variants:r,variantsConnection:e.variants,options:c,selectedVariant:s,setSelectedVariant:l,selectedOptions:d,setSelectedOption:p,setSelectedOptions:u,isOptionInStock:y,selectedSellingPlan:g,setSelectedSellingPlan:h,selectedSellingPlanAllocation:m,sellingPlanGroups:f,sellingPlanGroupsConnection:e.sellingPlanGroups})),[e,y,c,d,g,m,s,f,p,r]);return(0,a.jsx)(Ct.Provider,{value:v,children:t})}function It(){const t=(0,i.useContext)(Ct);if(!t)throw new Error("'useProduct' must be a child of ");return t}function St(t,e){var n,r;if(t.length&&(null==(r=null==(n=null==t?void 0:t[0])?void 0:n.selectedOptions)?void 0:r.length)===Object.keys(e).length)return null==t?void 0:t.find((t=>Object.entries(e).every((([e,n])=>{var r;return null==(r=null==t?void 0:t.selectedOptions)?void 0:r.some((t=>(null==t?void 0:t.name)===e&&(null==t?void 0:t.value)===n))}))))}function bt(t,e){if(t){const n=e.find((e=>(null==e?void 0:e.id)===t));return n||console.warn(" received a 'initialVariantId' prop, but could not actually find a variant with that ID"),n}return null===t?null:void 0===t?e.find((t=>null==t?void 0:t.availableForSale))||e[0]:void 0}function Pt(t){return(null==t?void 0:t.selectedOptions)?t.selectedOptions.reduce(((t,e)=>(t[(null==e?void 0:e.name)??""]=(null==e?void 0:e.value)??"",t)),{}):{}}function Tt(t){const{as:e,onClick:n,defaultOnClick:r,children:o,buttonRef:c,...s}=t,l=(0,i.useCallback)((t=>{if(n){const e=n(t);if("boolean"==typeof e&&!1===e||(null==t?void 0:t.defaultPrevented))return}null==r||r(t)}),[r,n]),d=e||"button";return(0,a.jsx)(d,{ref:c,onClick:l,...s,children:o})}function Et(t){const[e,n]=(0,i.useState)(!1),{variantId:r,quantity:o=1,attributes:c,sellingPlanId:s,onClick:l,children:d,accessibleAddingToCartLabel:u,...p}=t,{status:y,linesAdd:f}=mt(),{selectedVariant:g}=It(),h=r??(null==g?void 0:g.id)??"",m=null===r||""===h||null===g||e||p.disabled;(0,i.useEffect)((()=>{e&&"idle"===y&&n(!1)}),[y,e]);const v=(0,i.useCallback)((()=>{n(!0),f([{quantity:o,merchandiseId:h||"",attributes:c,sellingPlanId:s}])}),[f,o,h,c,s]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Tt,{...p,disabled:m,onClick:l,defaultOnClick:v,children:d}),u?(0,a.jsx)("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive",children:e?u:null}):null]})}const Ot={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART",PAGE_VIEW_2:"PAGE_VIEW_2",COLLECTION_VIEW:"COLLECTION_VIEW",PRODUCT_VIEW:"PRODUCT_VIEW",SEARCH_VIEW:"SEARCH_VIEW"},kt={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},xt={hydrogen:"hydrogen",headless:"headless"},Nt={hydrogen:"6167201",headless:"12875497473"};function Lt(t,e){return{schema_id:t,payload:e,metadata:{event_created_at_ms:Date.now()}}}function Dt(t){const e={id:"",resource:null,resourceId:null,search:"",searchParams:new URLSearchParams,hash:""};if("string"!=typeof t)return e;try{const{search:n,searchParams:r,pathname:o,hash:i}=new URL(t),a=o.split("/"),c=a[a.length-1],s=a[a.length-2];if(!c||!s)return e;return{id:`${c}${n}${i}`||"",resource:s??null,resourceId:c||null,search:n,searchParams:r,hash:i}}catch{return e}}function Rt(t,e){return"object"!=typeof t?{}:(Object.entries(t).forEach((([t,n])=>{n&&(e[t]=n)})),e)}const Ut="trekkie_storefront_page_view/1.4",Vt="myshopify.dev";function Ft(t){const e=t,{id:n,resource:r}=Dt(e.resourceId),o=r?r.toLowerCase():void 0;return[Lt(Ut,Rt({pageType:e.pageType,customerId:parseInt(Dt(e.customerId).id||"0"),resourceType:o,resourceId:parseInt(n)},jt(e)))]}function jt(t){return{appClientId:t.shopifySalesChannel?Nt[t.shopifySalesChannel]:Nt.headless,isMerchantRequest:$t(t.url),hydrogenSubchannelId:t.storefrontId||t.hydrogenSubchannelId||"0",isPersistentCookie:t.hasUserConsent,uniqToken:t.uniqueToken,visitToken:t.visitToken,microSessionId:st(),microSessionCount:1,url:t.url,path:t.path,search:t.search,referrer:t.referrer,title:t.title,shopId:parseInt(Dt(t.shopId).id),currency:t.currency,contentLanguage:t.acceptedLanguage||"en"}}function $t(t){if("string"!=typeof t)return!1;const e=new URL(t).hostname;return-1!==e.indexOf(Vt)||"localhost"===e}const Mt="2025.1.3",qt="custom_storefront_customer_tracking/1.2",Bt="page_rendered",Gt="collection_page_rendered",Yt="product_page_rendered",Ht="product_added_to_cart",zt="search_submitted";function Wt(t){return{canonical_url:t.canonicalUrl||t.url,customer_id:parseInt(Dt(t.customerId).id||"0")}}function Kt(t){return{source:t.shopifySalesChannel||xt.headless,asset_version_id:t.assetVersionId||Mt,hydrogenSubchannelId:t.storefrontId||t.hydrogenSubchannelId||"0",is_persistent_cookie:t.hasUserConsent,deprecated_visit_token:t.visitToken,unique_token:t.uniqueToken,event_time:Date.now(),event_id:st(),event_source_url:t.url,referrer:t.referrer,user_agent:t.userAgent,navigation_type:t.navigationType,navigation_api:t.navigationApi,shop_id:parseInt(Dt(t.shopId).id),currency:t.currency,ccpa_enforced:t.ccpaEnforced||!1,gdpr_enforced:t.gdprEnforced||!1,gdpr_enforced_as_string:t.gdprEnforced?"true":"false",analytics_allowed:t.analyticsAllowed||!1,marketing_allowed:t.marketingAllowed||!1,sale_of_data_allowed:t.saleOfDataAllowed||!1}}function Jt(t){return t?t.map((t=>{const e=Rt({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(Dt(t.productGid).id),variant_id:parseInt(Dt(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:parseFloat(t.price),quantity:Number(t.quantity||0)});return JSON.stringify(e)})):[]}function Zt(t,e){const{eventName:n,payload:r}=t;if(!r.hasUserConsent)return Promise.resolve();let o=[];const i=r;return n===Ot.PAGE_VIEW?o=o.concat(Ft(i),function(t){const e=t,n=Wt(e),r=e.pageType,o=[];switch(o.push(Lt(qt,Rt({event_name:Bt,...n},Kt(e)))),r){case kt.collection:o.push(Lt(qt,Rt({event_name:Gt,...n,collection_name:e.collectionHandle,collection_id:parseInt(Dt(e.collectionId).id)},Kt(e))));break;case kt.product:o.push(Lt(qt,Rt({event_name:Yt,...n,products:Jt(e.products),total_value:e.totalValue},Kt(e))));break;case kt.search:o.push(Lt(qt,Rt({event_name:zt,...n,search_string:e.searchString},Kt(e))))}return o}(i)):n===Ot.ADD_TO_CART?o=o.concat(function(t){const e=t,n=Dt(e.cartId);return[Lt(qt,Rt({event_name:Ht,customerId:e.customerId,cart_token:(null==n?void 0:n.id)?`${n.id}`:null,total_value:e.totalValue,products:Jt(e.products),customer_id:parseInt(Dt(e.customerId).id||"0")},Kt(e)))]}(r)):n===Ot.PAGE_VIEW_2?o=o.concat(Ft(i),function(t){const e=t,n=Wt(e);return[Lt(qt,Rt({event_name:Bt,...n},Kt(e)))]}(i)):n===Ot.COLLECTION_VIEW?o=o.concat(function(t){const e=t,n=Wt(e);return[Lt(qt,Rt({event_name:Gt,...n,collection_name:e.collectionHandle,collection_id:parseInt(Dt(e.collectionId).id)},Kt(e)))]}(i)):n===Ot.PRODUCT_VIEW?o=o.concat(function(t){const e=t,n=Wt(e);return[Lt(qt,Rt({event_name:Yt,...n,products:Jt(e.products),total_value:e.totalValue},Kt(e)))]}(i)):n===Ot.SEARCH_VIEW&&(o=o.concat(function(t){const e=t,n=Wt(e);return[Lt(qt,Rt({event_name:zt,...n,search_string:e.searchString},Kt(e)))]}(i))),o.length?function(t,e){if("undefined"!=typeof window&&window.navigator&&/Chrome-Lighthouse/.test(window.navigator.userAgent))return Promise.resolve();const n={events:t,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(e?`https://${e}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(n)}).then((t=>{if(!t.ok)throw new Error("Response failed");return t.text()})).then((t=>{t&&JSON.parse(t).result.forEach((t=>{200!==t.status&&console.error(Qt,"\n\n",t.message)}))})).catch((t=>{console.error(Qt,t)}))}catch(t){return Promise.resolve()}}(o,e):Promise.resolve()}const Qt="sendShopifyAnalytics request is unsuccessful";function Xt(){if("getClientBrowserParameters","undefined"==typeof document&&(console.error("getClientBrowserParameters should only be used within the useEffect callback or event handlers"),1))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[t,e]=function(){try{let t="PerformanceNavigationTiming",e=function(){try{const t=(null==performance?void 0:performance.getEntriesByType)&&(null==performance?void 0:performance.getEntriesByType("navigation"));if(t&&t[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch(t){}}();return e||(e=function(){var t,e;try{if(PerformanceNavigation&&null!==(null==(t=null==performance?void 0:performance.navigation)?void 0:t.type)&&void 0!==(null==(e=null==performance?void 0:performance.navigation)?void 0:e.type)){const t=performance.navigation.type;switch(t){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${t}`}}}catch(t){}}(),t="performance.navigation"),e?[e,t]:["unknown","unknown"]}catch(t){}return["error","error"]}(),n=lt(document.cookie);return{uniqueToken:n[ot],visitToken:n[it],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:t,navigationApi:e}}function te(t){const{cartCreate:e,checkoutUrl:n}=mt(),[r,o]=(0,i.useState)(!1),{quantity:c,variantId:s,sellingPlanId:l,onClick:d,attributes:u,children:p,...y}=t;(0,i.useEffect)((()=>{r&&n&&(window.location.href=n)}),[r,n]);const f=(0,i.useCallback)((()=>{o(!0),e({lines:[{quantity:c??1,merchandiseId:s,attributes:u,sellingPlanId:l}]})}),[e,c,s,u,l]);return(0,a.jsx)(Tt,{disabled:r??y.disabled,...y,onClick:d,defaultOnClick:f,children:p})}function ee(t){const[e,n]=(0,i.useState)(!1),{status:r,checkoutUrl:o}=mt(),{children:c,...s}=t;return(0,i.useEffect)((()=>{e&&o&&"idle"===r&&(window.location.href=o)}),[e,r,o]),(0,a.jsx)(Tt,{...s,disabled:e||s.disabled,onClick:()=>n(!0),children:c})}function ne(t){const{countryIsoCode:e,languageIsoCode:n}=X(),r=n.includes("_")?n.replace("_","-"):`${n}-${e}`;if(!r)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to ''. 'locale' is required for 'useMoney()' to work");const o=parseFloat(t.amount),{defaultFormatter:a,nameFormatter:c,narrowSymbolFormatter:s,withoutTrailingZerosFormatter:l,withoutCurrencyFormatter:d,withoutTrailingZerosOrCurrencyFormatter:u}=(0,i.useMemo)((()=>{const e={style:"currency",currency:t.currencyCode};return{defaultFormatter:oe(r,e),nameFormatter:oe(r,{...e,currencyDisplay:"name"}),narrowSymbolFormatter:oe(r,{...e,currencyDisplay:"narrowSymbol"}),withoutTrailingZerosFormatter:oe(r,{...e,minimumFractionDigits:0,maximumFractionDigits:0}),withoutCurrencyFormatter:oe(r),withoutTrailingZerosOrCurrencyFormatter:oe(r,{minimumFractionDigits:0,maximumFractionDigits:0})}}),[t.currencyCode,r]),p=t=>"currency"===t.type,y=(0,i.useMemo)((()=>({original:()=>t,currencyCode:()=>t.currencyCode,localizedString:()=>a().format(o),parts:()=>a().formatToParts(o),withoutTrailingZeros:()=>o%1==0?l().format(o):a().format(o),withoutTrailingZerosAndCurrency:()=>o%1==0?u().format(o):d().format(o),currencyName:()=>{var e;return(null==(e=c().formatToParts(o).find(p))?void 0:e.value)??t.currencyCode},currencySymbol:()=>{var e;return(null==(e=a().formatToParts(o).find(p))?void 0:e.value)??t.currencyCode},currencyNarrowSymbol:()=>{var t;return(null==(t=s().formatToParts(o).find(p))?void 0:t.value)??""},amount:()=>a().formatToParts(o).filter((t=>["decimal","fraction","group","integer","literal"].includes(t.type))).map((t=>t.value)).join("")})),[t,o,c,a,s,d,l,u]);return(0,i.useMemo)((()=>new Proxy(y,{get:(t,e)=>{var n;return null==(n=Reflect.get(t,e))?void 0:n.call(null)}})),[y])}const re=new Map;function oe(t,e){const n=JSON.stringify([t,e]);return function(){let r=re.get(n);return r||(r=new Intl.NumberFormat(t,e),re.set(n,r)),r}}function ie({data:t,as:e,withoutCurrency:n,withoutTrailingZeros:r,measurement:o,measurementSeparator:i="/",...c}){if("string"!=typeof(s=t).amount||!s.amount||"string"!=typeof s.currencyCode||!s.currencyCode)throw new Error(" needs a valid 'data' prop that has 'amount' and 'currencyCode'");var s;const l=ne(t),d=e??"div";let u=l.localizedString;return(n||r)&&(u=n&&!r?l.amount:!n&&r?l.withoutTrailingZeros:l.withoutTrailingZerosAndCurrency),(0,a.jsxs)(d,{...c,children:[u,o&&o.referenceUnit&&(0,a.jsxs)(a.Fragment,{children:[i,o.referenceUnit]})]})}function ae(t){const{cost:e}=mt(),{amountType:n="total",children:r,...o}=t;let i;return"total"==n?i=null==e?void 0:e.totalAmount:"subtotal"==n?i=null==e?void 0:e.subtotalAmount:"tax"==n?i=null==e?void 0:e.totalTaxAmount:"duty"==n&&(i=null==e?void 0:e.totalDutyAmount),null==i?null:(0,a.jsx)(ie,{...o,data:i,children:r})}const ce=(0,i.createContext)(null);function se(){const t=(0,i.useContext)(ce);if(null==t)throw new Error("Expected a cart line context but none was found");return t}function le({children:t,line:e}){return(0,a.jsx)(ce.Provider,{value:e,children:t})}function de(t){const e=se(),{as:n,...r}=t,o=n||"span";return(0,a.jsx)(o,{...r,children:e.quantity})}function ue(t){const{status:e,linesRemove:n,linesUpdate:r}=mt(),o=se(),{children:c,adjust:s,onClick:l,...d}=t,u=(0,i.useCallback)((()=>{if("remove"===s)return void n([(null==o?void 0:o.id)??""]);const t="decrease"===s?((null==o?void 0:o.quantity)??0)-1:((null==o?void 0:o.quantity)??0)+1;if(t<=0)return void n([(null==o?void 0:o.id)??""]);const e={id:(null==o?void 0:o.id)??"",quantity:t,attributes:(null==o?void 0:o.attributes)??[]};r([e])}),[s,null==o?void 0:o.attributes,null==o?void 0:o.id,null==o?void 0:o.quantity,n,r]),p=d.disabled;return(0,a.jsx)(Tt,{...d,onClick:l,defaultOnClick:u,disabled:void 0!==p?p:"idle"!==e,children:c})}const pe={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"},ye={DateTime:"string",Decimal:"string",HTML:"string",ISO8601DateTime:"string",URL:"string",UnsignedInt64:"string"},fe=(0,i.forwardRef)(((t,e)=>{const{data:n,options:r,id:o=n.id,frameBorder:i="0",allow:c="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:s=!0,loading:l="lazy",...d}=t;if(!n.embedUrl)throw new Error(" requires the 'embedUrl' property");let u=n.embedUrl;if(r){const t=new URL(n.embedUrl);for(const[e,n]of Object.entries(r))void 0!==n&&t.searchParams.set(e,n.toString());u=t.toString()}return(0,a.jsx)("iframe",{...d,id:o??n.embedUrl,title:n.alt??n.id??"external video",frameBorder:i,allow:c,allowFullScreen:s,src:u,loading:l,ref:e})})),ge={OPTION:":",END_OF_PREFIX:",",SEQUENCE_GAP:" ",RANGE:"-"},he=(()=>{const t=new Map;return function(e,n){var r;if(0===e.length)return!1;if(!t.has(n)){const e=new Set;for(const t of me(n)){e.add(t.join(","));for(let n=0;nt.replace(/^v1_/,"");function _e(t){return Object.assign({},...t.map((t=>({[t.name]:t.value}))))}function we(t){return JSON.stringify(_e(t))}function Ce(t){return Array.isArray(t)?JSON.stringify(Object.assign({},...t.map((t=>({[t.name]:t.value}))))):JSON.stringify(t)}const Ae=["options","selectedOrFirstAvailableVariant","adjacentVariants"],Ie=["handle","encodedVariantExistence","encodedVariantAvailability"];function Se(t){return console.error(`[h2:error:getProductOptions] product.${t} is missing. Make sure you query for this field from the Storefront API.`),!1}function be(t,e=!1){var n;let r=!0;const o=Object.keys(t);if((e?[...Ae,...Ie]:Ae).forEach((t=>{o.includes(t)||(r=Se(t))})),t.options){const o=null==t?void 0:t.options[0];if(e&&!(null==o?void 0:o.name)&&(r=Se("options.name")),null==(n=null==t?void 0:t.options[0])?void 0:n.optionValues){let n=t.options[0].optionValues[0];e&&!(null==n?void 0:n.name)&&(r=Se("options.optionValues.name")),n=t.options[0].optionValues.filter((t=>!!(null==t?void 0:t.firstSelectableVariant)))[0],(null==n?void 0:n.firstSelectableVariant)&&(r=Pe(n.firstSelectableVariant,"options.optionValues.firstSelectableVariant",r,e))}else r=Se("options.optionValues")}return t.selectedOrFirstAvailableVariant&&(r=Pe(t.selectedOrFirstAvailableVariant,"selectedOrFirstAvailableVariant",r,e)),t.adjacentVariants&&t.adjacentVariants[0]&&(r=Pe(t.adjacentVariants[0],"adjacentVariants",r,e)),r?t:{}}function Pe(t,e,n,r){var o;let i=n;if(r&&!(null==(o=t.product)?void 0:o.handle)&&(i=Se(`${e}.product.handle`)),t.selectedOptions){const n=t.selectedOptions[0];(null==n?void 0:n.name)||(i=Se(`${e}.selectedOptions.name`)),(null==n?void 0:n.value)||(i=Se(`${e}.selectedOptions.value`))}else i=Se(`${e}.selectedOptions`);return i}function Te(t){const e=be(t);if(!e.options)return[];const n={};e.options.map((t=>{var e;null==(e=t.optionValues)||e.map((t=>{if(t.firstSelectableVariant){const e=we(t.firstSelectableVariant.selectedOptions);n[e]=t.firstSelectableVariant}}))})),e.adjacentVariants.map((t=>{const e=we(t.selectedOptions);n[e]=t}));const r=e.selectedOrFirstAvailableVariant;if(r){const t=we(r.selectedOptions);n[t]=r}return Object.values(n)}function Ee(t){const e=be(t,!0);if(!e.options)return[];const{options:n,selectedOrFirstAvailableVariant:r,adjacentVariants:o,encodedVariantExistence:i,encodedVariantAvailability:a,handle:c}=e,s=null==r?void 0:r.selectedOptions.map((t=>t.name)),l=n.filter((t=>s&&s.indexOf(t.name)>=0)),d=function(t){return Object.assign({},...t.map((t=>({[t.name]:Object.assign({},...(null==t?void 0:t.optionValues)?t.optionValues.map(((t,e)=>({[t.name]:e}))):[])}))))}(n),u=function(t){return Object.assign({},...t.map((t=>({[Ce(t.selectedOptions||[])]:t}))))}(r?[r,...o]:o),p=_e(r?r.selectedOptions:[]),y=l.map(((t,e)=>({...t,optionValues:t.optionValues.map((n=>{var r;const o={...p};o[t.name]=n.name;const s=Ce(o||[]),l=function(t,e){return Object.keys(t).map((n=>e[n]?e[n][t[n]]:null)).filter((t=>null!==t))}(o||[],d),y=l.slice(0,e+1),f=he(y,i||""),g=he(y,a||""),h=u[s]||n.firstSelectableVariant;let m={};h&&(m=_e(h.selectedOptions||[]));const v=new URLSearchParams(m),_=(null==(r=null==h?void 0:h.product)?void 0:r.handle)||c;return{...n,variant:h,handle:_,variantUriQuery:v.toString(),selected:p[t.name]===n.name,exists:f,available:g,isDifferentProduct:_!==c}}))})));return y}const Oe="#graphql\n fragment Image on Image {\n altText\n url\n width\n height\n }\n",ke=i.forwardRef((({alt:t,aspectRatio:e,crop:n="center",data:r,decoding:o="async",height:c="auto",loader:s=De,loading:l="lazy",sizes:d,src:u,srcSetOptions:p={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:y="100%",...f},g)=>{const h=i.useMemo((()=>{const t=(null==r?void 0:r.width)&&(null==r?void 0:r.height)?null==r?void 0:r.width:void 0,e=(null==r?void 0:r.width)&&(null==r?void 0:r.height)?null==r?void 0:r.height:void 0;return{width:t,height:e,unitsMatch:Boolean(Re(t,e))}}),[r]),m=i.useMemo((()=>{const n=Ue((y||"100%").toString()),o=`${n.number}${n.unit}`,i=null==c,a=i?null:Ue(c.toString()),s=a?`${a.number}${a.unit}`:"";return{width:o,height:i?"auto":s,src:u||(null==r?void 0:r.url),alt:(null==r?void 0:r.altText)&&!t?null==r?void 0:r.altText:t||"",aspectRatio:e||(h.unitsMatch?[Ve(h.width),Ve(h.height)].join("/"):void 0)}}),[y,c,u,r,t,e,h,null==f?void 0:f.key]),{intervals:v,startingWidth:_,incrementSize:w,placeholderWidth:C}=p,A=i.useMemo((()=>function(t="100%",e,n,r){const o=Array.from({length:e},((t,e)=>e*r+n)),i=Array.from({length:3},((e,n)=>(n+1)*(Ve(t)??0)));return Fe(t)?i:o}(y,v,_,w)),[y,v,_,w]);return Fe(m.width)?(0,a.jsx)(xe,{aspectRatio:e,crop:n,decoding:o,height:c,imageWidths:A,loader:s,loading:l,normalizedProps:m,passthroughProps:f,ref:g,width:y,data:r}):(0,a.jsx)(Ne,{aspectRatio:e,crop:n,decoding:o,imageWidths:A,loader:s,loading:l,normalizedProps:m,passthroughProps:f,placeholderWidth:C,ref:g,sizes:d,data:r})})),xe=i.forwardRef((({aspectRatio:t,crop:e,decoding:n,height:r,imageWidths:o,loader:c=De,loading:s,normalizedProps:l,passthroughProps:d,width:u,data:p},y)=>{const f=i.useMemo((()=>{const n=Ve(u),i=Ve(r),a=t||(Re(l.width,l.height)?[n,i].join("/"):l.aspectRatio?l.aspectRatio:void 0),s=void 0===o?void 0:Me(o,a,e,{width:(null==p?void 0:p.width)??void 0,height:(null==p?void 0:p.height)??void 0}),d=i||(a&&n?n*($e(a)??1):void 0);return{width:n,aspectRatio:a,height:d,srcSet:je(l.src,s,c),src:c({src:l.src,width:n,height:d,crop:"auto"===l.height?void 0:e})}}),[t,e,p,r,o,c,l,u]);return(0,a.jsx)("img",{ref:y,alt:l.alt,decoding:n,height:f.height,loading:s,src:f.src,srcSet:f.srcSet,width:f.width,style:{aspectRatio:f.aspectRatio,...d.style},...d})})),Ne=i.forwardRef((({crop:t,decoding:e,imageWidths:n,loader:r=De,loading:o,normalizedProps:c,passthroughProps:s,placeholderWidth:l,sizes:d,data:u},p)=>{const y=i.useMemo((()=>{const e=void 0===n?void 0:Me(n,c.aspectRatio,t,{width:(null==u?void 0:u.width)??void 0,height:(null==u?void 0:u.height)??void 0}),o=c.aspectRatio&&l?l*($e(c.aspectRatio)??1):void 0;return{placeholderHeight:o,srcSet:je(c.src,e,r),src:r({src:c.src,width:l,height:o,crop:t})}}),[t,u,n,r,c,l]);return(0,a.jsx)("img",{ref:p,alt:c.alt,decoding:e,height:y.placeholderHeight,loading:o,sizes:d,src:y.src,srcSet:y.srcSet,width:l,...s,style:{width:c.width,aspectRatio:c.aspectRatio,...s.style}})})),Le="https://placeholder.shopify.com";function De({src:t,width:e,height:n,crop:r}){if(!t)return"";const o=new URL(t,Le);return e&&o.searchParams.append("width",Math.round(e).toString()),n&&o.searchParams.append("height",Math.round(n).toString()),r&&o.searchParams.append("crop",r),o.href.replace(Le,"")}function Re(t="100%",e="auto"){return Ue(t.toString()).unit===Ue(e.toString()).unit}function Ue(t){const e=t.replace(/[0-9.]/g,""),n=parseFloat(t.replace(e,""));return{unit:""===e?void 0===n?"auto":"px":e,number:n}}function Ve(t){if(void 0===t)return;const{unit:e,number:n}=Ue(t.toString());switch(e){case"em":case"rem":return 16*n;case"px":case"":return n;default:return}}function Fe(t){return"number"==typeof t||/\d(px|em|rem)$/.test(t)}function je(t,e,n=De){return t?0!==(null==e?void 0:e.length)&&e?e.map(((r,o)=>`${n({src:t,width:r.width,height:r.height,crop:r.crop})} ${3===e.length?`${o+1}x`:`${r.width??0}w`}`)).join(", "):t:""}function $e(t){if(!t)return;const[e,n]=t.split("/");return 1/(Number(e)/Number(n))}function Me(t,e,n="center",r){if(t)return t.map((t=>({width:t,height:e?t*($e(e)??1):void 0,crop:n}))).filter((({width:t,height:e})=>!((null==r?void 0:r.width)&&t>r.width||(null==r?void 0:r.height)&&e&&e>r.height)))}const qe={};function Be(t,e){const[n,r]=(0,i.useState)("loading");return(0,i.useEffect)((()=>{(function(t,e){const n=qe[t];if(n)return n;const r=new Promise(((n,r)=>{const o=document.createElement("script");(null==e?void 0:e.module)?o.type="module":o.type="text/javascript",o.src=t,o.onload=()=>{n(!0)},o.onerror=()=>{r(!1)},"head"===(null==e?void 0:e.in)?document.head.appendChild(o):document.body.appendChild(o);const i=null==e?void 0:e.attributes;i&&Object.keys(i).forEach((t=>{o.setAttribute(t,i[t])}))}));return qe[t]=r,r})(t,e).then((()=>r("done"))).catch((()=>r("error")))}),[t]),n}const Ge=(0,i.forwardRef)(((t,e)=>{var n;const{data:r,previewImageOptions:o,id:c=r.id,playsInline:s=!0,controls:l=!0,sourceProps:d={},...u}=t,p=De({src:(null==(n=r.previewImage)?void 0:n.url)??"",...o});if(!r.sources)throw new Error("