import{r as s,h as i,F as t}from"./p-e97fde0a.js";import{a as e}from"./p-6b5d827f.js";import{a as r}from"./p-566c9487.js";import{s as o}from"./p-fab02ef6.js";import{s as n}from"./p-53e7f7d7.js";import{o as a}from"./p-393cb717.js";import{f as d}from"./p-ff10bfbf.js";import"./p-30eb50ff.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 l=(s=[],i,t)=>{var e;return((e=(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||e===void 0?void 0:e.processor_data)||{}};const c="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=c;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}cannotShipToLocation(){var s,i;return((s=n===null||n===void 0?void 0:n.checkout)===null||s===void 0?void 0:s.selected_shipping_choice_required)&&!((i=n.checkout)===null||i===void 0?void 0:i.selected_shipping_choice)}renderPayPalButton(s){const{client_id:t,account_id:o,merchant_initiated_enabled:a}=l(r(),"paypal",n.mode);if(!t&&!o)return null;return i("sc-paypal-buttons",{buttons:s,busy:d()||e(),mode:n.mode,order:n.checkout,merchantInitiated:a,"currency-code":n.currencyCode,"client-id":t,"merchant-id":o,label:"checkout",color:"blue"})}render(){var s;if(this.cannotShipToLocation()||e("OUT_OF_STOCK")){return i("sc-button",{type:this.type,size:this.size,full:this.full,loading:this.loading||this.paying,disabled:true},!!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 r=(s=n.checkout)===null||s===void 0?void 0:s.payment_method_required;return i(t,null,r&&o.id==="paypal"&&!(o===null||o===void 0?void 0:o.method)&&this.renderPayPalButton(["paypal"]),r&&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)&&r,submit:true,type:this.type,size:this.size,full:this.full,loading:this.loading||this.paying,disabled:this.loading||this.paying||d()||e()||this.cannotShipToLocation()},!!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"))))}};a(u,["loading","paying","processors","processor","currencyCode","order"],false);u.style=p;export{u as sc_order_submit};
//# sourceMappingURL=p-011df22a.entry.js.map