1import{e as P,g as d}from"/build/_shared/chunk-WYWTJVVI.js";import{a as l}from"/build/_shared/chunk-RZLDKGLN.js";import{a as p}from"/build/_shared/chunk-FONEQPGK.js";import{a as v}from"/build/_shared/chunk-DEVQKMWM.js";import{a as x}from"/build/_shared/chunk-H6S7FWVP.js";import{d as f}from"/build/_shared/chunk-T36URGAI.js";var y=f(x());var F=()=>{let o=(0,y.useContext)(v),{user:c}=(0,y.useContext)(l);return{updateCart:({product:t,quantity:i,type:a,cart:r,context:u,variant:e})=>{var n,C;p({event:"dataLayerCartClear",ecommerce:{cart:null}}),p({event:a==="add"?"addToCart":"removeFromCart",ecommerce:{currencyCode:o==null?void 0:o.currency,[a]:{products:[d({product:{...t,quantity:i},variant:t&&"variant"in t?t.variant:e})],...P({satelliteKey:o==null?void 0:o.key,productKey:(t==null?void 0:t.key)||void 0,userId:c==null?void 0:c.id})},cart:{products:(n=r==null?void 0:r.lineItems)==null?void 0:n.map(s=>d({product:s,variant:s==null?void 0:s.variant})),totalPrice:{amount:(r.total.centAmount/100).toFixed(2),currency:r.total.currencyCode},totalQuantity:((C=r.lineItems)==null?void 0:C.reduce((s,m)=>((m==null?void 0:m.quantity)||1)+s,0))||0},context:{action:a,...u}}})},pushCartItems:t=>{var i,a,r,u;p({event:"cartItems",ecommerce:{currencyCode:o==null?void 0:o.currency,cart:{products:(i=t==null?void 0:t.lineItems)==null?void 0:i.map(e=>d({product:e,variant:e==null?void 0:e.variant})),totalPrice:{amount:(a=t==null?void 0:t.total)!=null&&a.centAmount?(t.total.centAmount/100).toFixed(2):"0.00",currency:(r=t==null?void 0:t.total)==null?void 0:r.currencyCode},totalQuantity:((u=t.lineItems)==null?void 0:u.reduce((e,n)=>((n==null?void 0:n.quantity)||1)+e,0))||0}}})}}};export{F as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.