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