import{r as o,h as t,H as i,a as s}from"./p-9add63ef.js";import{s as a}from"./p-fff99551.js";import"./p-2b28ea49.js";import"./p-dd24e53c.js";import"./p-f2d66ed2.js";import"./p-b28405ea.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-31faf2b8.js";import"./p-610295e2.js";import"./p-7ec75b85.js";import"./p-e2e1fe1f.js";import"./p-fb28f84f.js";import"./p-efd935a6.js";import"./p-78468e45.js";import"./p-de31ba85.js";import"./p-8dccb656.js";import"./p-259c3935.js";const e="sc-product-donation-custom-amount sc-price-input sc-button{margin-right:-10px !important}.sc-product-donation-custom-amount sc-button{opacity:0;visibility:hidden;transition:opacity var(--sc-transition-fast) ease-in-out, visibility var(--sc-transition-fast) ease-in-out}.sc-product-donation-custom-amount--has-value sc-button{opacity:1;visibility:visible}";const n=e;const r=class{constructor(t){o(this,t);this.productId=undefined;this.value=undefined}state(){return a[this.productId]}updateState(o){a[this.productId]={...a[this.productId],...o}}render(){var o,s,a,e,n,r,c,d,p,u;const l=!!((o=this.state())===null||o===void 0?void 0:o.custom_amount);return t(i,{key:"015a29b7e1b5527e24acfe6e4364c4a27257aee5",class:{"sc-product-donation-custom-amount":true,"sc-product-donation-custom-amount--has-value":!!this.value}},t("sc-choice-container",{key:"f674a889e7f90d4a7fc98c0165c65ae93b03902e",value:`${(s=this.state())===null||s===void 0?void 0:s.custom_amount}`,"show-control":"false",checked:l,onClick:()=>this.priceInput.triggerFocus(),onKeyDown:()=>{this.priceInput.triggerFocus()},role:"button"},t("sc-visually-hidden",{key:"2af6694f96eb5e490b076522b7f50561bd667271"},wp.i18n.__("Enter a custom amount.","surecart")),t("sc-price-input",{key:"0a22f2caa43754ae4d3f65e28a2310fb7be506bb",ref:o=>this.priceInput=o,currencyCode:((e=(a=this.state())===null||a===void 0?void 0:a.selectedPrice)===null||e===void 0?void 0:e.currency)||((n=window===null||window===void 0?void 0:window.scData)===null||n===void 0?void 0:n.currency)||"usd",showCode:false,showLabel:false,value:`${((r=this.state())===null||r===void 0?void 0:r.custom_amount)||""}`,onScChange:o=>this.updateState({ad_hoc_amount:null,custom_amount:o.target.value}),min:(d=(c=this.state())===null||c===void 0?void 0:c.selectedPrice)===null||d===void 0?void 0:d.ad_hoc_min_amount,max:(u=(p=this.state())===null||p===void 0?void 0:p.selectedPrice)===null||u===void 0?void 0:u.ad_hoc_max_amount,style:{"--sc-input-border-color-focus":"var(--sc-input-border-color-hover)","--sc-focus-ring-color-primary":"transparent"}})))}get el(){return s(this)}};r.style=n;export{r as sc_product_donation_custom_amount};
//# sourceMappingURL=p-40873d4c.entry.js.map