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