"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[21],{30:function(t,e,r){var n=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(t);a(0,d.isPreOrderVariant)(t))),y=e.every((t=>t.availableForSale));y||m||(m={backgroundColor:"#666",color:"#999"});const P=(0,u.useMemo)((()=>{const t=(0,d.getPreOrderMessage)(...e);return null==e?void 0:e.map((e=>{var{addToCartProperties:r={}}=e,a=n(e,["addToCartProperties"]);const s=a.compareAtPrice?100*parseFloat(a.compareAtPrice):void 0;return{id:null==a?void 0:a.variantId,quantity:"number"==typeof r._item_quantity?r._item_quantity:1,properties:Object.assign(Object.assign({_compareRetail:s},r),{Shipping:t,_olpre:t&&"preorder"})}}))}),[e]),S=(0,c.useIsHydrated)();return(0,s.jsx)(l.Fragment,{children:(0,s.jsx)("form",{class:[i.default.container,"small"===f?i.default.small:""].join(" "),action:`/cart/add?return_to=${encodeURIComponent(`${r}?variant=${null==O?void 0:O.variantId}&viewcart=true`)}`,method:"POST",children:(0,s.jsx)("button",{type:"submit",disabled:!S||h.status===o.Status.updating||!y,class:[i.default.addButton,"small"===f?i.default.small:"",g?i.default.outlined:""].join(" "),style:m,onClick:t=>{t.preventDefault(),y?a({items:P}):console.error("Not available for sale")},children:(0,s.jsx)(p,{selectedVariant:O,showPriceOnButton:b,isUpdating:(P.length>1&&`${null==O?void 0:O.variantId}_bundle`===h.variantId||(null==O?void 0:O.variantId)===h.variantId)&&h.status===o.Status.updating,isPreorder:x,isSoldOut:!y,buttonSubText:v,buttonMessage:j})})})})};const s=r(0),i=a(r(43)),o=r(14),l=r(0),d=r(9),u=r(3),c=r(20);function p({isUpdating:t,isPreorder:e,isSoldOut:r,selectedVariant:n,showPriceOnButton:a,buttonSubText:o,buttonMessage:d}){if(r)return(0,s.jsx)("span",{children:"Sold Out"});if(t)return(0,s.jsx)("span",{children:"Adding..."});const u=null!=d?d:e?"Pre-Order Now":"Add to Cart";if(a&&(null==n?void 0:n.price)){const t=n.compareAtPrice?parseInt(n.compareAtPrice):null,e=parseInt(n.price);return(0,s.jsxs)(l.Fragment,{children:[null!==t&&t>e?(0,s.jsxs)("span",{children:[u," –"," ",(0,s.jsxs)("span",{class:i.default.linethrough,children:["$",t]})," $",e]}):(0,s.jsxs)("span",{children:[u," – $",e]}),o&&(0,s.jsx)("div",{class:i.default.estimatedShipDate,children:o})]})}return(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)("span",{children:u}),o&&(0,s.jsx)("div",{class:i.default.estimatedShipDate,children:o})]})}}}]);