import{r as s,h as i,F as t}from"./p-e97fde0a.js";import{a as r}from"./p-2f193d80.js";import{a as e}from"./p-566c9487.js";import{s as o}from"./p-4cae87fc.js";import{s as a}from"./p-53e7f7d7.js";import{o as n}from"./p-393cb717.js";import{f as l}from"./p-ff10bfbf.js";import"./p-2805073a.js";import"./p-401e165e.js";import"./p-93127aa7.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-d3366af3.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-4df6e0c5.js";const c=(s=[],i,t)=>{var r;return((r=(s||[]).find((s=>(s===null||s===void 0?void 0:s.processor_type)===i&&(s===null||s===void 0?void 0:s.live_mode)===!!(t==="live"))))===null||r===void 0?void 0:r.processor_data)||{}};const d="sc-order-submit{display:block;width:auto;display:grid;gap:var(--sc-form-row-spacing)}.sc-secure-notice{display:flex;justify-content:center}";const p=d;const u=class{constructor(i){s(this,i);this.loading=undefined;this.paying=undefined;this.type="primary";this.size="medium";this.full=true;this.icon=undefined;this.showTotal=undefined;this.processors=undefined;this.order=undefined;this.currencyCode="usd";this.processor=undefined;this.secureNoticeText=undefined;this.secureNotice=true;this.backgroundColor="";this.textColor=""}cannotShipToLocation(){var s,i;return((s=a===null||a===void 0?void 0:a.checkout)===null||s===void 0?void 0:s.selected_shipping_choice_required)&&!((i=a.checkout)===null||i===void 0?void 0:i.selected_shipping_choice)}renderPayPalButton(s){const{client_id:t,account_id:o,merchant_initiated_enabled:n}=c(e(),"paypal",a.mode);if(!t&&!o)return null;return i("sc-paypal-buttons",{buttons:s,busy:l()||r(),mode:a.mode,order:a.checkout,merchantInitiated:n,"currency-code":a.currencyCode,"client-id":t,"merchant-id":o,label:"checkout",color:"blue"})}render(){var s;if(this.cannotShipToLocation()||r("OUT_OF_STOCK")){return i("sc-button",{type:this.type,size:this.size,full:this.full,loading:this.loading||this.paying,disabled:true,style:{"--sc-color-primary-text":this.textColor,"--sc-color-primary-500":this.backgroundColor}},!!this.icon&&i("sc-icon",{name:this.icon,slot:"prefix","aria-hidden":"true"}),i("slot",null,wp.i18n.__("Purchase","surecart")),this.showTotal&&i("span",null," ",i("sc-total",null)),i("sc-visually-hidden",null," ",wp.i18n.__("Press enter to purchase","surecart")))}const e=(s=a.checkout)===null||s===void 0?void 0:s.payment_method_required;return i(t,null,e&&o.id==="paypal"&&!(o===null||o===void 0?void 0:o.method)&&this.renderPayPalButton(["paypal"]),e&&o.id==="paypal"&&(o===null||o===void 0?void 0:o.method)==="card"&&this.renderPayPalButton(["card"]),i("sc-button",{hidden:["paypal","paypal-card"].includes(o.id)&&e,submit:true,type:this.type,size:this.size,full:this.full,loading:this.loading||this.paying,disabled:this.loading||this.paying||l()||r()||this.cannotShipToLocation(),style:{"--sc-color-primary-text":this.textColor,"--sc-color-primary-500":this.backgroundColor}},!!this.icon&&i("sc-icon",{name:this.icon,slot:"prefix","aria-hidden":"true"}),i("slot",null,wp.i18n.__("Purchase","surecart")),this.showTotal&&i("span",null," ",i("sc-total",null)),i("sc-visually-hidden",null," ",wp.i18n.__("Press enter to purchase","surecart"))),this.secureNotice&&location.protocol==="https:"&&i("div",{class:"sc-secure-notice"},i("sc-secure-notice",null,this.secureNoticeText||wp.i18n.__("This is a secure, encrypted payment.","surecart"))))}};n(u,["loading","paying","processors","processor","currencyCode","order"],false);u.style=p;export{u as sc_order_submit};
//# sourceMappingURL=p-0058c6e2.entry.js.map