{"version":3,"sources":["webpack:///C:/a/3/s/Cognito.Web.Client/node_modules/.pnpm/@paypal+paypal-js@7.0.0/node_modules/@paypal/paypal-js/dist/esm/paypal-js.js"],"names":["objectToQueryString","params","queryString","Object","keys","forEach","key","length","createScriptElement","url","attributes","newScript","document","createElement","src","setAttribute","loadScript","options","PromisePonyfill","Promise","validateArguments","resolve","_a","sdkBaseUrl","optionsWithStringIndex","filter","reduce","accumulator","value","toString","replace","match","indexOfMatch","toLowerCase","substring","dataAttributes","queryParams","indexOf","concat","processOptions","namespace","existingWindowNamespace","getPayPalWindowNamespace","currentScript","querySelector","nextScript","currentScriptClone","cloneNode","dataset","uidAuto","isExactMatch","findScript","Error","reject","onSuccess","onError","onerror","onload","head","insertBefore","firstElementChild","insertScriptElement","defaultError","loadCustomScript","then","newWindowNamespace","window"],"mappings":"+FAwFA,SAASA,EAAoBC,GACzB,IAAIC,EAAc,GAMlB,OALAC,OAAOC,KAAKH,GAAQI,SAAQ,SAAUC,GACP,IAAvBJ,EAAYK,SACZL,GAAe,KACnBA,GAAeI,EAAM,IAAML,EAAOK,MAE/BJ,EAEX,SAASM,EAAoBC,EAAKC,QACX,IAAfA,IAAyBA,EAAa,IAC1C,IAAIC,EAAYC,SAASC,cAAc,UAQvC,OAPAF,EAAUG,IAAML,EAChBN,OAAOC,KAAKM,GAAYL,SAAQ,SAAUC,GACtCK,EAAUI,aAAaT,EAAKI,EAAWJ,IAC3B,mBAARA,GACAK,EAAUI,aAAa,QAASL,EAAW,sBAG5CC,EAUX,SAASK,EAAWC,EAASC,GAIzB,QAHwB,IAApBA,IAA8BA,EAAkBC,SACpDC,EAAkBH,EAASC,GAEH,oBAAbN,SACP,OAAOM,EAAgBG,QAAQ,MACnC,IAAIC,EA9ER,SAAwBL,GACpB,IAAIM,EAAa,gCACbN,EAAQM,aACRA,EAAaN,EAAQM,kBACdN,EAAQM,YAEnB,IAAIC,EAAyBP,EACzBK,EAAKnB,OAAOC,KAAKoB,GAChBC,QAAO,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abcb8779a337e.js","sourcesContent":["/*!\n * paypal-js v7.0.0 (2023-08-16T16:58:51.809Z)\n * Copyright 2020-present, PayPal, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction findScript(url, attributes) {\n var currentScript = document.querySelector(\"script[src=\\\"\".concat(url, \"\\\"]\"));\n if (currentScript === null)\n return null;\n var nextScript = createScriptElement(url, attributes);\n // ignore the data-uid-auto attribute that gets auto-assigned to every script tag\n var currentScriptClone = currentScript.cloneNode();\n delete currentScriptClone.dataset.uidAuto;\n // check if the new script has the same number of data attributes\n if (Object.keys(currentScriptClone.dataset).length !==\n Object.keys(nextScript.dataset).length) {\n return null;\n }\n var isExactMatch = true;\n // check if the data attribute values are the same\n Object.keys(currentScriptClone.dataset).forEach(function (key) {\n if (currentScriptClone.dataset[key] !== nextScript.dataset[key]) {\n isExactMatch = false;\n }\n });\n return isExactMatch ? currentScript : null;\n}\nfunction insertScriptElement(_a) {\n var url = _a.url, attributes = _a.attributes, onSuccess = _a.onSuccess, onError = _a.onError;\n var newScript = createScriptElement(url, attributes);\n newScript.onerror = onError;\n newScript.onload = onSuccess;\n document.head.insertBefore(newScript, document.head.firstElementChild);\n}\nfunction processOptions(options) {\n var sdkBaseUrl = \"https://www.paypal.com/sdk/js\";\n if (options.sdkBaseUrl) {\n sdkBaseUrl = options.sdkBaseUrl;\n delete options.sdkBaseUrl;\n }\n var optionsWithStringIndex = options;\n var _a = Object.keys(optionsWithStringIndex)\n .filter(function (key) {\n return (typeof optionsWithStringIndex[key] !== \"undefined\" &&\n optionsWithStringIndex[key] !== null &&\n optionsWithStringIndex[key] !== \"\");\n })\n .reduce(function (accumulator, key) {\n var value = optionsWithStringIndex[key].toString();\n key = camelCaseToKebabCase(key);\n if (key.substring(0, 4) === \"data\") {\n accumulator.dataAttributes[key] = value;\n }\n else {\n accumulator.queryParams[key] = value;\n }\n return accumulator;\n }, {\n queryParams: {},\n dataAttributes: {},\n }), queryParams = _a.queryParams, dataAttributes = _a.dataAttributes;\n if (queryParams[\"merchant-id\"] &&\n queryParams[\"merchant-id\"].indexOf(\",\") !== -1) {\n dataAttributes[\"data-merchant-id\"] = queryParams[\"merchant-id\"];\n queryParams[\"merchant-id\"] = \"*\";\n }\n return {\n url: \"\".concat(sdkBaseUrl, \"?\").concat(objectToQueryString(queryParams)),\n dataAttributes: dataAttributes,\n };\n}\nfunction camelCaseToKebabCase(str) {\n var replacer = function (match, indexOfMatch) {\n return (indexOfMatch ? \"-\" : \"\") + match.toLowerCase();\n };\n return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, replacer);\n}\nfunction objectToQueryString(params) {\n var queryString = \"\";\n Object.keys(params).forEach(function (key) {\n if (queryString.length !== 0)\n queryString += \"&\";\n queryString += key + \"=\" + params[key];\n });\n return queryString;\n}\nfunction createScriptElement(url, attributes) {\n if (attributes === void 0) { attributes = {}; }\n var newScript = document.createElement(\"script\");\n newScript.src = url;\n Object.keys(attributes).forEach(function (key) {\n newScript.setAttribute(key, attributes[key]);\n if (key === \"data-csp-nonce\") {\n newScript.setAttribute(\"nonce\", attributes[\"data-csp-nonce\"]);\n }\n });\n return newScript;\n}\n\n/**\n * Load the Paypal JS SDK script asynchronously.\n *\n * @param {Object} options - used to configure query parameters and data attributes for the JS SDK.\n * @param {PromiseConstructor} [PromisePonyfill=window.Promise] - optional Promise Constructor ponyfill.\n * @return {Promise} paypalObject - reference to the global window PayPal object.\n */\nfunction loadScript(options, PromisePonyfill) {\n if (PromisePonyfill === void 0) { PromisePonyfill = Promise; }\n validateArguments(options, PromisePonyfill);\n // resolve with null when running in Node or Deno\n if (typeof document === \"undefined\")\n return PromisePonyfill.resolve(null);\n var _a = processOptions(options), url = _a.url, dataAttributes = _a.dataAttributes;\n var namespace = dataAttributes[\"data-namespace\"] || \"paypal\";\n var existingWindowNamespace = getPayPalWindowNamespace(namespace);\n // resolve with the existing global paypal namespace when a script with the same params already exists\n if (findScript(url, dataAttributes) && existingWindowNamespace) {\n return PromisePonyfill.resolve(existingWindowNamespace);\n }\n return loadCustomScript({\n url: url,\n attributes: dataAttributes,\n }, PromisePonyfill).then(function () {\n var newWindowNamespace = getPayPalWindowNamespace(namespace);\n if (newWindowNamespace) {\n return newWindowNamespace;\n }\n throw new Error(\"The window.\".concat(namespace, \" global variable is not available.\"));\n });\n}\n/**\n * Load a custom script asynchronously.\n *\n * @param {Object} options - used to set the script url and attributes.\n * @param {PromiseConstructor} [PromisePonyfill=window.Promise] - optional Promise Constructor ponyfill.\n * @return {Promise} returns a promise to indicate if the script was successfully loaded.\n */\nfunction loadCustomScript(options, PromisePonyfill) {\n if (PromisePonyfill === void 0) { PromisePonyfill = Promise; }\n validateArguments(options, PromisePonyfill);\n var url = options.url, attributes = options.attributes;\n if (typeof url !== \"string\" || url.length === 0) {\n throw new Error(\"Invalid url.\");\n }\n if (typeof attributes !== \"undefined\" && typeof attributes !== \"object\") {\n throw new Error(\"Expected attributes to be an object.\");\n }\n return new PromisePonyfill(function (resolve, reject) {\n // resolve with undefined when running in Node or Deno\n if (typeof document === \"undefined\")\n return resolve();\n insertScriptElement({\n url: url,\n attributes: attributes,\n onSuccess: function () { return resolve(); },\n onError: function () {\n var defaultError = new Error(\"The script \\\"\".concat(url, \"\\\" failed to load. Check the HTTP status code and response body in DevTools to learn more.\"));\n return reject(defaultError);\n },\n });\n });\n}\nfunction getPayPalWindowNamespace(namespace) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return window[namespace];\n}\nfunction validateArguments(options, PromisePonyfill) {\n if (typeof options !== \"object\" || options === null) {\n throw new Error(\"Expected an options object.\");\n }\n if (typeof PromisePonyfill !== \"undefined\" &&\n typeof PromisePonyfill !== \"function\") {\n throw new Error(\"Expected PromisePonyfill to be a function.\");\n }\n}\n\n// replaced with the package.json version at build time\nvar version = \"7.0.0\";\n\nexport { loadCustomScript, loadScript, version };\n"],"sourceRoot":""}