function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = ["./DPULm1xj.js","./MhFXtLHF.js","./BO9AmBA3.js","./swiper-vue.CKaSHkdz.css","./BmsEUx_s.js","./entry.Che8293Z.css","./BasicLabel.B_SY1GJM.css","./mJxKCZNa.js","./_P4PyUnV.js","./3BiMtf7m.js","./Blx3Uc3i.js","./n1IWZ_S-.js","./BJnyr3hP.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } import{A as $,w as j,av as F,r as J,c as K,_ as Q,y as Z,E as ee}from"./BmsEUx_s.js";import{ab as te,k as ae,ag as oe,a as R,l as se,w as ie,G as V,H as q,I as ne,a3 as re,V as ce,u as n,X as le,a9 as ue,x as de}from"./BO9AmBA3.js";import{u as pe,a as fe}from"./piUVYGVq.js";import{u as ve}from"./UWnfKqQJ.js";const me=()=>{const i=$("currentCartProduct");return{updateCurrentProduct:t=>{i.value=te(t)},currentProduct:i}},_e=de(()=>Z(()=>import("./DPULm1xj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url).then(i=>i.default||i)),ye=1e3,Te=ae({__name:"ProductCardAddToCartButton",props:{product:{},selectedChild:{},isCrossSellingItem:{type:Boolean},quantity:{default:1},theme:{},disableable:{type:Boolean},fullWidth:{type:Boolean},status:{},color:{},size:{},controller:{},tight:{type:Boolean},blockEvent:{type:Boolean}},setup(i){var k;const{codeErrorsNotification:_}=pe(),t=i,{sessionContext:p}=j();(k=p.value)==null||k.shippingLocation.country.iso;const{product:r,selectedChild:y,controller:f}=oe(t),C=ve(),{open:D}=fe(),c=R(),a=R(),l=se(()=>(r==null?void 0:r.value.childCount)===0?r:y),{addToCart:X,isInCart:G,quantity:h}=F(l.value),{startLoading:H,endLoading:U}=J(),{t:o}=K(),{updateCurrentProduct:W}=me(),Y=async()=>{var s,v,u,d,P,T,b,E,B,w,I,S,g,A,L,M,x,z,N,O;if(t.blockEvent)(s=f.value)==null||s.open();else if(t.status)if(t.status==="instock"){t.isCrossSellingItem||W(n(l.value)),H(),a.value=o("product.adding"),h.value=t.quantity,await X();const e=l.value;{const m=ee();m==null||m.trackEvent({event:"add_to_cart",ecommerce:{value:(u=(v=e.value)==null?void 0:v.calculatedPrice)==null?void 0:u.totalPrice,currency:p.value.currency.isoCode,items:[{item_id:(d=e.value)==null?void 0:d.id,item_name:(P=e.value)==null?void 0:P.name,affiliation:"yt-industries",currency:p.value.currency.isoCode,discount:(b=(T=e==null?void 0:e.value)==null?void 0:T.calculatedPrice)!=null&&b.listPrice?((B=(E=e==null?void 0:e.value)==null?void 0:E.calculatedPrice)==null?void 0:B.listPrice.discount)*-1:0,index:0,item_brand:"yt-industries",item_category:(S=(I=(w=e.value)==null?void 0:w.seoCategory)==null?void 0:I.translated)==null?void 0:S.name,item_list_name:"Related products",price:(A=(g=e==null?void 0:e.value)==null?void 0:g.calculatedPrice)!=null&&A.listPrice?(x=(M=(L=e==null?void 0:e.value)==null?void 0:L.calculatedPrice)==null?void 0:M.listPrice)==null?void 0:x.price:(N=(z=e==null?void 0:e.value)==null?void 0:z.calculatedPrice)==null?void 0:N.totalPrice,quantity:h.value}]}})}U(),_(),D(),G.value&&(a.value=o("product.added"),t.isCrossSellingItem||setTimeout(()=>{a.value=o("product.addToCart")},ye))}else t.status==="notifyme"?C.open():t.status==="outofstock"||!t.status?a.value=o("product.price.outOfStock"):f&&((O=f.value)==null||O.open())};return ie(()=>{if(t.status)switch(t.status){case"instock":c.value=!1,a.value=o("product.addToCart");break;case"notifyme":c.value=!1,a.value=o("product.notifyMe");break;case"outofstock":c.value=!0,a.value=o("product.price.outOfStock")}else a.value=o("general.loading")}),(s,v)=>{const u=_e,d=Q;return V(),q(d,{theme:s.theme,"full-width":!0,"data-testid":"add-to-cart-button",tight:s.tight,disabled:n(c),onClick:ue(Y,["stop","prevent"]),"aria-label":n(a)},{default:ne(()=>[re(ce(n(a))+" ",1),n(y)&&s.status==="notifyme"?(V(),q(u,{key:0,controller:n(C),product:n(l),color:s.color,size:s.size},null,8,["controller","product","color","size"])):le("",!0)]),_:1},8,["theme","tight","disabled","aria-label"])}}});export{Te as _,me as u};