{"version":3,"file":"Product_selection_store.oWpOpHce.mjs","names":["create"],"sources":["https:/framerusercontent.com/modules/Vu8sM3DwKDdSi2bltsPi/Uam6NjjQgBdbM2uxwvNZ/Parse_shopify_data.js","https:/framerusercontent.com/modules/8l7kldZFdo4Q33wHQBGB/yNIABzdTP3fu4mWtyAdp/Product_selection_store.js"],"sourcesContent":["export const parseShopifyData=shopifyData=>{const parsedShopifyData=shopifyData?JSON.parse(shopifyData):EXAMPLE_DATA;return parsedShopifyData;};const EXAMPLE_DATA={id:\"15176683880773\",variants:[{id:\"55218501157189\",title:\"Variant Title\",price:{amount:\"99\",currencyCode:\"USD\"},priceByMarket:{US:{amount:\"99\",currencyCode:\"USD\"},GB:{amount:\"79\",currencyCode:\"GBP\"},CA:{amount:\"129\",currencyCode:\"CAD\"},EU:{amount:\"89\",currencyCode:\"EUR\"},AU:{amount:\"139\",currencyCode:\"AUD\"}},compareAtPriceByMarket:{US:{amount:\"120\",currencyCode:\"USD\"},GB:{amount:\"95\",currencyCode:\"GBP\"},CA:{amount:\"155\",currencyCode:\"CAD\"},EU:{amount:\"109\",currencyCode:\"EUR\"},AU:{amount:\"169\",currencyCode:\"AUD\"}},weight:0,weightUnit:\"KILOGRAMS\",availableForSale:true,sku:\"sku-untracked-1\",image:{id:\"gid://shopify/ProductImage/77445152801093\",url:\"https://cdn.shopify.com/s/files/1/0967/3896/7877/files/snowboard_purple_hydrogen.png?v=1753365380\",altText:\"Top and bottom view of a snowboard. The top view shows a centred hexagonal logo for Hydrogen that\\n          appears to radiate outwards, as well as some overlapping hexagons at the bottom. The bottom view shows an\\n          abstract angular grid in purples.\",width:3097,height:3908}}]};\nexport const __FramerMetadata__ = {\"exports\":{\"parseShopifyData\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Parse_shopify_data.map","import{create}from\"https://framerusercontent.com/modules/ieMSnIJVCiFKJmsg1OmM/KWFJj6n258MVreTmJoNk/Zustand.js\";const sanitizeQuantity=value=>{if(!Number.isFinite(value))return 1;const rounded=Math.floor(value);return Math.max(1,rounded);};export const useProductSelectionStore=create((set,get)=>({quantitiesByVariantId:{},selectedVariantByProductId:{},getQuantity:variantId=>{const value=get().quantitiesByVariantId[variantId];return typeof value===\"number\"?value:1;},setQuantity:(variantId,quantity)=>{const next=sanitizeQuantity(quantity);set(state=>({quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:next}}));},increment:(variantId,step=1)=>{set(state=>{const current=state.quantitiesByVariantId[variantId]??1;const next=sanitizeQuantity(current+step);return{quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:next}};});},decrement:(variantId,step=1)=>{set(state=>{const current=state.quantitiesByVariantId[variantId]??1;const next=sanitizeQuantity(current-step);return{quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:next}};});},resetQuantity:variantId=>{set(state=>({quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:1}}));},getSelectedVariant:(productId,variants)=>{const selectedVariantId=get().selectedVariantByProductId[productId];if(selectedVariantId&&variants.some(v=>v.id===selectedVariantId)){return selectedVariantId;}// Default to first variant if no selection or invalid selection\n    return variants[0]?.id||\"\";},setSelectedVariant:(productId,variantId)=>{set(state=>({selectedVariantByProductId:{...state.selectedVariantByProductId,[productId]:variantId}}));},clearAll:()=>set({quantitiesByVariantId:{},selectedVariantByProductId:{}})}));\nexport const __FramerMetadata__ = {\"exports\":{\"useProductSelectionStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Product_selection_store.map"],"mappings":"+HAAa,EAAiB,GAAsC,EAAY,KAAK,MAAM,EAAY,CAAC,EAA8C,EAAa,CAAC,GAAG,iBAAiB,SAAS,CAAC,CAAC,GAAG,iBAAiB,MAAM,gBAAgB,MAAM,CAAC,OAAO,KAAK,aAAa,MAAM,CAAC,cAAc,CAAC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