const RAZORPAY_CHECKOUT_SCRIPT_URL="https://checkout.razorpay.com/v1/checkout.js";let razorpayInstance=null,loadPromise=null;const loadRazorpay=()=>razorpayInstance?Promise.resolve(razorpayInstance):loadPromise||(loadPromise=new Promise(((o,a)=>{const r=document.createElement("script");r.src=RAZORPAY_CHECKOUT_SCRIPT_URL,r.async=!0,r.onload=()=>{razorpayInstance=window.Razorpay,o(razorpayInstance)},r.onerror=()=>{loadPromise=null,a(new Error(wp.i18n.__("Failed to load Razorpay script.","surecart")))},document.head.appendChild(r)})),loadPromise);export{loadRazorpay as l};