function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}var t,n="dahlia",r="https://js.stripe.com",o="".concat(r,"/").concat(n,"/stripe.js"),i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,s=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,c="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",a=function(e){return i.test(e)||s.test(e)},u=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(o).concat(t);var r=document.head||document.body;if(!r)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(n),n},l=null,p=null,d=null,f=function(e){return null!==l?l:(l=new Promise(function(t,n){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(c),window.Stripe)t(window.Stripe);else try{var o=function(){for(var e=document.querySelectorAll('script[src^="'.concat(r,'"]')),t=0;t<e.length;t++){var n=e[t];if(a(n.src))return n}return null}();if(o&&e)console.warn(c);else if(o){if(o&&null!==d&&null!==p){var i;o.removeEventListener("load",d),o.removeEventListener("error",p),null===(i=o.parentNode)||void 0===i||i.removeChild(o),o=u(e)}}else o=u(e);d=function(e,t){return function(){window.Stripe?e(window.Stripe):t(new Error("Stripe.js not available"))}}(t,n),p=function(e){return function(t){e(new Error("Failed to load Stripe.js",{cause:t}))}}(n),o.addEventListener("load",d),o.addEventListener("error",p)}catch(s){return void n(s)}else t(null)})).catch(function(e){return l=null,Promise.reject(e)})},m=!1,v=function(){return t||(t=f(null).catch(function(e){return t=null,Promise.reject(e)}))};Promise.resolve().then(function(){return v()}).catch(function(e){m||console.warn(e)});var w=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];m=!0;var i=Date.now();return v().then(function(t){return function(t,r,o){if(null===t)return null;var i=r[0];if("string"!=typeof i)throw new Error("Expected publishable key to be of type string, got type ".concat(e(i)," instead."));var s=i.match(/^pk_test/),c=function(e){return 3===e?"v3":e}(t.version),a=n;s&&c!==a&&console.warn("Stripe.js@".concat(c," was loaded on the page, but @stripe/stripe-js@").concat("9.0.0"," expected Stripe.js@").concat(a,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var u=t.apply(void 0,r);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"9.0.0",startTime:t})}(u,o),u}(t,r,i)})};export{w as loadStripe};