import{r as a,a as A,F as I,j as h}from"./index.1ec44e23.js";import"./ef11f8a9.js";import"./2d3554bc.js";import"./616890f5.js";import{u as v}from"./75d11d91.js";import{u as k}from"./c0ec5803.js";import{BaseButton as w}from"./ff692d55.js";function T(f){var m;const[t,i]=a.exports.useState(!1),{variantId:e,quantity:o=1,attributes:n,sellingPlanId:d,onClick:b,children:g,accessibleAddingToCartLabel:l,...c}=f,{status:u,linesAdd:p}=v(),{selectedVariant:s}=k(),r=(m=e!=null?e:s==null?void 0:s.id)!=null?m:"",x=e===null||r===""||s===null||t||c.disabled;a.exports.useEffect(()=>{t&&u==="idle"&&i(!1)},[u,t]);const C=a.exports.useCallback(()=>{i(!0),p([{quantity:o,merchandiseId:r,attributes:n,sellingPlanId:d}])},[p,o,r,n,d]);return A(I,{children:[h(w,{...c,disabled:x,onClick:b,defaultOnClick:C,children:g}),l?h("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:t?l:null}):null]})}export{T as A}; //# sourceMappingURL=70628a73.js.map