{"version":3,"sources":["webpack:///./node_modules/@stripe/stripe-js/dist/index.mjs"],"names":["stripePromise","RELEASE_TRAIN","runtimeVersionToUrlVersion","version","ORIGIN","STRIPE_JS_URL","concat","V3_URL_REGEX","STRIPE_JS_URL_REGEX","EXISTING_SCRIPT_MESSAGE","isStripeJSURL","url","test","findScript","scripts","document","querySelectorAll","i","length","script","src","injectScript","params","queryString","advancedFraudSignals","createElement","headOrBody","head","body","Error","appendChild","registerWrapper","stripe","startTime","_registerWrapper","name","stripePromise$1","onErrorListener","onLoadListener","onError","reject","cause","onLoad","resolve","window","Stripe","loadScript","Promise","console","warn","_script$parentNode","removeEventListener","parentNode","removeChild","addEventListener","error","initStripe","maybeStripe","args","pk","isTestKey","match","expectedVersion","apply","undefined","loadCalled","getStripePromise","then","loadStripe","_len","arguments","Array","_key","Date","now"],"mappings":"oKAAA,IA6JIA,EA7JAC,EAAgB,KAEhBC,EAA6B,SAAoCC,GACnE,OAAmB,IAAZA,EAAgB,KAAOA,GAG5BC,EAAS,wBACTC,EAAgB,GAAGC,OAAOF,EAAQ,OAClCG,EAAe,4CACfC,EAAsB,8DACtBC,EAA0B,mJAE1BC,EAAgB,SAAuBC,GACzC,OAAOJ,EAAaK,KAAKD,IAAQH,EAAoBI,KAAKD,IAGxDE,EAAa,WAGf,IAFA,IAAIC,EAAUC,SAASC,iBAAiB,gBAAiBV,OAAOF,EAAQ,OAE/Da,EAAI,EAAGA,EAAIH,EAAQI,OAAQD,IAAK,CACvC,IAAIE,EAASL,EAAQG,GAErB,GAAKP,EAAcS,EAAOC,KAI1B,OAAOD,EAGT,OAAO,MAGLE,EAAe,SAAsBC,GACvC,IAAIC,EAAcD,IAAWA,EAAOE,qBAAuB,8BAAgC,GACvFL,EAASJ,SAASU,cAAc,UACpCN,EAAOC,IAAM,GAAGd,OAAOD,GAAeC,OAAOiB,GAC7C,IAAIG,EAAaX,SAASY,MAAQZ,SAASa,KAE3C,IAAKF,EACH,MAAM,IAAIG,MAAM,+EA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,GAAoB,OAAhBwB,EACF,OAAO,KAGT,IAAIE,EAAKD,EAAK,GACVE,EAAYD,EAAGE,MAAM,YAErB1D,EAAUD,EAA2BuD,EAAYtD,SACjD2D,EAAkB7D,EAElB2D,GAAazD,IAAY2D,GAC3Bd,QAAQC,KAAK,aAAa3C,OAAOH,EAAS,mDAAmDG,OAAO,SAAU,wBAAwBA,OAAOwD,EAAiB,yHAGhK,IAAI9B,EAASyB,EAAYM,WAAMC,EAAWN,GAE1C,OADA3B,EAAgBC,EAAQC,GACjBD,GAILiC,GAAa,EAEbC,EAAmB,WACrB,OAAIlE,IAIJA,EAAgB8C,EAAW,MAAM,UAAS,SAAUS,GAGlD,OADAvD,EAAgB,KACT+C,QAAQP,OAAOe,MAEjBvD,IAKT+C,QAAQJ,UAAUwB,MAAK,WACrB,OAAOD,OACN,UAAS,SAAUX,GACfU,GACHjB,QAAQC,KAAKM,MAGjB,IAAIa,EAAa,WACf,IAAK,IAAIC,EAAOC,UAAUpD,OAAQwC,EAAO,IAAIa,MAAMF,GAAOG,EAAO,EAAGA,EAAOH,EAAMG,IAC/Ed,EAAKc,GAAQF,UAAUE,GAGzBP,GAAa,EACb,IAAIhC,EAAYwC,KAAKC,MAErB,OAAOR,IAAmBC,MAAK,SAAUV,GACvC,OAAOD,EAAWC,EAAaC,EAAMzB","file":"js/chunk-2d0cbe0a.6c4ce8e0.js","sourcesContent":["var RELEASE_TRAIN = 'v3';\n\nvar runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {\n return version === 3 ? 'v3' : version;\n};\n\nvar ORIGIN = 'https://js.stripe.com';\nvar STRIPE_JS_URL = \"\".concat(ORIGIN, \"/v3\") ;\nvar V3_URL_REGEX = /^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/;\nvar STRIPE_JS_URL_REGEX = /^https:\\/\\/js\\.stripe\\.com\\/(v3|[a-z]+)\\/stripe\\.js(\\?.*)?$/;\nvar EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';\n\nvar isStripeJSURL = function isStripeJSURL(url) {\n return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);\n};\n\nvar findScript = function findScript() {\n var scripts = document.querySelectorAll(\"script[src^=\\\"\".concat(ORIGIN, \"\\\"]\"));\n\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i];\n\n if (!isStripeJSURL(script.src)) {\n continue;\n }\n\n return script;\n }\n\n return null;\n};\n\nvar injectScript = function injectScript(params) {\n var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';\n var script = document.createElement('script');\n script.src = \"\".concat(STRIPE_JS_URL).concat(queryString);\n var headOrBody = document.head || document.body;\n\n if (!headOrBody) {\n throw new Error('Expected document.body not to be null. Stripe.js requires a element.');\n }\n\n headOrBody.appendChild(script);\n return script;\n};\n\nvar registerWrapper = function registerWrapper(stripe, startTime) {\n if (!stripe || !stripe._registerWrapper) {\n return;\n }\n\n stripe._registerWrapper({\n name: 'stripe-js',\n version: \"5.10.0\",\n startTime: startTime\n });\n};\n\nvar stripePromise$1 = null;\nvar onErrorListener = null;\nvar onLoadListener = null;\n\nvar onError = function onError(reject) {\n return function (cause) {\n reject(new Error('Failed to load Stripe.js', {\n cause: cause\n }));\n };\n};\n\nvar onLoad = function onLoad(resolve, reject) {\n return function () {\n if (window.Stripe) {\n resolve(window.Stripe);\n } else {\n reject(new Error('Stripe.js not available'));\n }\n };\n};\n\nvar loadScript = function loadScript(params) {\n // Ensure that we only attempt to load Stripe.js at most once\n if (stripePromise$1 !== null) {\n return stripePromise$1;\n }\n\n stripePromise$1 = new Promise(function (resolve, reject) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n // Resolve to null when imported server side. This makes the module\n // safe to import in an isomorphic code base.\n resolve(null);\n return;\n }\n\n if (window.Stripe && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n }\n\n if (window.Stripe) {\n resolve(window.Stripe);\n return;\n }\n\n try {\n var script = findScript();\n\n if (script && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n } else if (!script) {\n script = injectScript(params);\n } else if (script && onLoadListener !== null && onErrorListener !== null) {\n var _script$parentNode;\n\n // remove event listeners\n script.removeEventListener('load', onLoadListener);\n script.removeEventListener('error', onErrorListener); // if script exists, but we are reloading due to an error,\n // reload script to trigger 'load' event\n\n (_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);\n script = injectScript(params);\n }\n\n onLoadListener = onLoad(resolve, reject);\n onErrorListener = onError(reject);\n script.addEventListener('load', onLoadListener);\n script.addEventListener('error', onErrorListener);\n } catch (error) {\n reject(error);\n return;\n }\n }); // Resets stripePromise on error\n\n return stripePromise$1[\"catch\"](function (error) {\n stripePromise$1 = null;\n return Promise.reject(error);\n });\n};\nvar initStripe = function initStripe(maybeStripe, args, startTime) {\n if (maybeStripe === null) {\n return null;\n }\n\n var pk = args[0];\n var isTestKey = pk.match(/^pk_test/); // @ts-expect-error this is not publicly typed\n\n var version = runtimeVersionToUrlVersion(maybeStripe.version);\n var expectedVersion = RELEASE_TRAIN;\n\n if (isTestKey && version !== expectedVersion) {\n console.warn(\"Stripe.js@\".concat(version, \" was loaded on the page, but @stripe/stripe-js@\").concat(\"5.10.0\", \" expected Stripe.js@\").concat(expectedVersion, \". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning\"));\n }\n\n var stripe = maybeStripe.apply(undefined, args);\n registerWrapper(stripe, startTime);\n return stripe;\n}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\nvar stripePromise;\nvar loadCalled = false;\n\nvar getStripePromise = function getStripePromise() {\n if (stripePromise) {\n return stripePromise;\n }\n\n stripePromise = loadScript(null)[\"catch\"](function (error) {\n // clear cache on error\n stripePromise = null;\n return Promise.reject(error);\n });\n return stripePromise;\n}; // Execute our own script injection after a tick to give users time to do their\n// own script injection.\n\n\nPromise.resolve().then(function () {\n return getStripePromise();\n})[\"catch\"](function (error) {\n if (!loadCalled) {\n console.warn(error);\n }\n});\nvar loadStripe = function loadStripe() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n loadCalled = true;\n var startTime = Date.now(); // if previous attempts are unsuccessful, will re-load script\n\n return getStripePromise().then(function (maybeStripe) {\n return initStripe(maybeStripe, args, startTime);\n });\n};\n\nexport { loadStripe };\n"],"sourceRoot":""}