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