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OsC,EAAW,sBAAlB,iBAAO,EAA2BwD,oBAAlC,aAAO,EAAyC9F,QAAQ,KAAM6F,EACjE,EAEYE,EAAU,WACnB,OAAOzD,EAAW,eAAe0D,IACpC,EAEYC,EAAoB,0BAAM,UAAA3D,EAAW,sBAAX,mBAA2B4D,gBAA3B,eAAqC1M,QAAS,CAApD","sources":["webpack://wcPPCP/webpack/bootstrap","webpack://wcPPCP/webpack/runtime/compat get default export","webpack://wcPPCP/webpack/runtime/define property getters","webpack://wcPPCP/webpack/runtime/hasOwnProperty shorthand","webpack://wcPPCP/webpack/runtime/make namespace object","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/slicedToArray.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","webpack://wcPPCP/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://wcPPCP/external window \"lodash\"","webpack://wcPPCP/external window \"jQuery\"","webpack://wcPPCP/external window [\"wp\",\"hooks\"]","webpack://wcPPCP/./node_modules/@paypal/paypal-js/dist/esm/paypal-js.js","webpack://wcPPCP/./assets/js/ppcp/utils.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export default function _arrayLikeToArray(arr, len) {\n  if (len == null || len > arr.length) len = arr.length;\n\n  for (var i = 0, arr2 = new Array(len); i < len; i++) {\n    arr2[i] = arr[i];\n  }\n\n  return arr2;\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n  return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n  if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n  var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n  if (_i == null) return;\n  var _arr = [];\n  var _n = true;\n  var _d = false;\n\n  var _s, _e;\n\n  try {\n    for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n      _arr.push(_s.value);\n\n      if (i && _arr.length === i) break;\n    }\n  } catch (err) {\n    _d = true;\n    _e = err;\n  } finally {\n    try {\n      if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n    } finally {\n      if (_d) throw _e;\n    }\n  }\n\n  return _arr;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n  if (!o) return;\n  if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n  var n = Object.prototype.toString.call(o).slice(8, -1);\n  if (n === \"Object\" && o.constructor) n = o.constructor.name;\n  if (n === \"Map\" || n === \"Set\") return Array.from(o);\n  if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n  throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n  if (source == null) return {};\n  var target = objectWithoutPropertiesLoose(source, excluded);\n  var key, i;\n\n  if (Object.getOwnPropertySymbols) {\n    var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n    for (i = 0; i < sourceSymbolKeys.length; i++) {\n      key = sourceSymbolKeys[i];\n      if (excluded.indexOf(key) >= 0) continue;\n      if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n      target[key] = source[key];\n    }\n  }\n\n  return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n  if (source == null) return {};\n  var target = {};\n  var sourceKeys = Object.keys(source);\n  var key, i;\n\n  for (i = 0; i < sourceKeys.length; i++) {\n    key = sourceKeys[i];\n    if (excluded.indexOf(key) >= 0) continue;\n    target[key] = source[key];\n  }\n\n  return target;\n}","export default function _defineProperty(obj, key, value) {\n  if (key in obj) {\n    Object.defineProperty(obj, key, {\n      value: value,\n      enumerable: true,\n      configurable: true,\n      writable: true\n    });\n  } else {\n    obj[key] = value;\n  }\n\n  return obj;\n}","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"lodash\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"jQuery\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"hooks\"];","/*!\n * paypal-js v5.1.1 (2022-08-03T17:21:59.218Z)\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    processMerchantID(options);\n    var _a = Object.keys(options)\n        .filter(function (key) {\n        return (typeof options[key] !== \"undefined\" &&\n            options[key] !== null &&\n            options[key] !== \"\");\n    })\n        .reduce(function (accumulator, key) {\n        var value = options[key].toString();\n        if (key.substring(0, 5) === \"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    return {\n        url: \"\".concat(sdkBaseURL, \"?\").concat(objectToQueryString(queryParams)),\n        dataAttributes: dataAttributes,\n    };\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}\n/**\n * Parse the error message code received from the server during the script load.\n * This function search for the occurrence of this specific string \"/* Original Error:\".\n *\n * @param message the received error response from the server\n * @returns the content of the message if the string string was found.\n *          The whole message otherwise\n */\nfunction parseErrorMessage(message) {\n    var originalErrorText = message.split(\"/* Original Error:\")[1];\n    return originalErrorText\n        ? originalErrorText.replace(/\\n/g, \"\").replace(\"*/\", \"\").trim()\n        : message;\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}\nfunction processMerchantID(options) {\n    var merchantID = options[\"merchant-id\"], dataMerchantID = options[\"data-merchant-id\"];\n    var newMerchantID = \"\";\n    var newDataMerchantID = \"\";\n    if (Array.isArray(merchantID)) {\n        if (merchantID.length > 1) {\n            newMerchantID = \"*\";\n            newDataMerchantID = merchantID.toString();\n        }\n        else {\n            newMerchantID = merchantID.toString();\n        }\n    }\n    else if (typeof merchantID === \"string\" && merchantID.length > 0) {\n        newMerchantID = merchantID;\n    }\n    else if (typeof dataMerchantID === \"string\" &&\n        dataMerchantID.length > 0) {\n        newMerchantID = \"*\";\n        newDataMerchantID = dataMerchantID;\n    }\n    options[\"merchant-id\"] = newMerchantID;\n    options[\"data-merchant-id\"] = newDataMerchantID;\n    return options;\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<Object>} paypalObject - reference to the global window PayPal object.\n */\nfunction loadScript(options, PromisePonyfill) {\n    if (PromisePonyfill === void 0) { PromisePonyfill = getDefaultPromiseImplementation(); }\n    validateArguments(options, PromisePonyfill);\n    // resolve with null when running in Node\n    if (typeof window === \"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<void>} returns a promise to indicate if the script was successfully loaded.\n */\nfunction loadCustomScript(options, PromisePonyfill) {\n    if (PromisePonyfill === void 0) { PromisePonyfill = getDefaultPromiseImplementation(); }\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\n        if (typeof window === \"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.\"));\n                if (!window.fetch) {\n                    return reject(defaultError);\n                }\n                // Fetch the error reason from the response body for validation errors\n                return fetch(url)\n                    .then(function (response) {\n                    if (response.status === 200) {\n                        reject(defaultError);\n                    }\n                    return response.text();\n                })\n                    .then(function (message) {\n                    var parseMessage = parseErrorMessage(message);\n                    reject(new Error(parseMessage));\n                })\n                    .catch(function (err) {\n                    reject(err);\n                });\n            },\n        });\n    });\n}\nfunction getDefaultPromiseImplementation() {\n    if (typeof Promise === \"undefined\") {\n        throw new Error(\"Promise is undefined. To resolve the issue, use a Promise polyfill.\");\n    }\n    return Promise;\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 = \"5.1.1\";\n\nexport { loadCustomScript, loadScript, version };\n","import {isEqual, isEmpty} from 'lodash';\nimport $ from 'jquery';\nimport {defaultHooks} from \"@wordpress/hooks\";\nimport {loadScript} from '@paypal/paypal-js';\n\nlet urlParams = {};\n\nlet isLoading = false;\n\nconst fields = new Map();\n\nlet locales = null;\n\nexport const SHIPPING_OPTION_REGEX = /^([\\w]+)\\:(.+)$/;\n\nconst ADDRESS_MAPPING = {\n    address_1: 'address_line_1|line1',\n    address_2: 'address_line_2|line2',\n    state: 'admin_area_1|state',\n    city: 'admin_area_2|city',\n    postcode: 'postal_code',\n    country: 'country_code'\n};\n\nconst INTERMEDIATE_ADDRESS_MAPPING = {\n    city: 'city',\n    state: 'state',\n    postal_code: 'postcode',\n    country_code: 'country'\n}\n\n//export const hooks = createHooks();\n\nconst removeScriptById = (id) => {\n    const element = document.getElementById(id);\n    if (element) {\n        element.remove();\n    }\n}\n\nconst hasPayPalScript = (id) => {\n    const element = document.getElementById(id);\n    return !!element;\n}\n\nexport const loadPayPalSdk = (params = null) => {\n    return new Promise((resolve, reject) => {\n\n        // params may have changed so reload script¬\n        if (params && !isEmpty(params) && !isEqual(params, urlParams)) {\n            urlParams = params;\n            if (window.paypal) {\n                // cleanup\n                defaultHooks.doAction('paypalInstanceCleanup', window.paypal);\n            }\n            isLoading = true;\n            loadScript({...params}).then(paypal => {\n                resolve(paypal);\n                defaultHooks.doAction('paypalInstanceCreated', paypal, urlParams);\n            }).catch(error => {\n                console.log(error);\n                const msg = error?.message?.toLowerCase() || null;\n                let response;\n                if (msg) {\n                    if (msg.includes('locale')) {\n                        const {locale, ...newParams} = params;\n                        return loadPayPalSdk(newParams).then(paypal => {\n                            resolve(paypal);\n                        });\n                    } else if (msg.includes('client-id not recognized')) {\n                        response = {code: 'invalid_client_id'};\n                    } else if (msg.includes('invalid query value for client-id')) {\n                        response = {code: 'invalid_client_id'};\n                    } else if (msg.includes('invalid query value for currency')) {\n                        //response = {code: 'unsupported_currency', message: getErrorMessage({code: 'invalid_currency'}).replace('%', urlParams.currency)};\n                    }\n                }\n                defaultHooks.doAction('paypalLoadError');\n                reject(response);\n            }).finally(() => {\n                isLoading = false;\n            })\n        } else {\n            if (window.paypal && !isLoading) {\n                resolve(window.paypal);\n            } else {\n                defaultHooks.addAction('paypalInstanceCreated', 'wcPPCP', (paypal) => {\n                    resolve(paypal);\n                });\n                defaultHooks.addAction('paypalLoadError', 'wcPPCP', () => {\n                    reject();\n                })\n            }\n        }\n    })\n}\n\nexport const getSetting = (key) => {\n    if (typeof window.wcPPCPSettings !== 'undefined') {\n        return window.wcPPCPSettings[key] || {};\n    }\n    return {};\n}\n\nexport const setSetting = (key, value) => {\n    if (typeof window.wcPPCPSettings !== 'undefined') {\n        return window.wcPPCPSettings[key] = value;\n    }\n}\n\nexport const getPayPalQueryParams = () => getSetting('queryParams');\n\nexport const getFieldValue = (key, prefix = 'billing') => {\n    if (key.substring(0, 'shipping'.length) != 'shipping' && key.substring(0, 'billing'.length) != 'billing') {\n        key = `${prefix}_${key}`;\n    }\n    if ($(`[name=\"${key}\"]`).length) {\n        return $(`[name=\"${key}\"]`).val();\n    }\n    return fields.get(key);\n}\n\nexport const fieldsToJson = () => {\n    const json = {};\n    fields.forEach((value, key) => {\n        json[key] = value;\n    });\n    return json;\n}\n\nexport const setFieldValue = (key, value, prefix = 'billing') => {\n    if (!!prefix && key.substring(0, 'shipping'.length) != 'shipping' && key.substring(0, 'billing'.length) != 'billing') {\n        key = `${prefix}_${key}`;\n    }\n    fields.set(key, value);\n    if ($(`[name=\"${key}\"]`).length) {\n        $(`[name=\"${key}\"]`).val(value);\n    }\n}\n\nexport const getErrorMessage = (error) => {\n    const messages = getSetting('errorMessages');\n    if (typeof error == 'string') {\n        return error;\n    }\n    if (error?.code && messages?.[error.code]) {\n        return messages[error.code];\n    }\n    if (error?.message) {\n        return error.message;\n    }\n}\n\nexport const submitErrorMessage = (error, container, context = 'checkout') => {\n    if (error?.message?.toLowerCase()?.match(/detected popup close|window is closed/)) {\n        return;\n    }\n    let msg = getErrorMessage(error);\n    let classes = 'woocommerce-NoticeGroup';\n    const $container = $(container);\n    if (context == 'checkout') {\n        classes += ' woocommerce-NoticeGroup-checkout';\n    }\n    if (Array.isArray(error)) {\n        msg = '<div class=\"' + classes + '\"><ul class=\"woocommerce-error\"><li>' + error.join('</li><li>') + '</li></ul></div>';\n    } else if (typeof error === 'string' && /<[^>]*>/.test(error)) {\n        msg = '<div class=\"' + classes + '\">' + error + '</div>';\n    } else {\n        msg = '<div class=\"' + classes + '\"><ul class=\"woocommerce-error\"><li>' + msg + '</li></ul></div>';\n    }\n    $('.woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message').remove();\n    $container.prepend(msg);\n    if ($.scroll_to_notices) {\n        $.scroll_to_notices($container);\n    } else {\n        $('html, body').animate({\n            scrollTop: $container.offset().top - 100\n        }, 1000);\n    }\n}\n\nexport const isValidAddress = (address, exclude = []) => {\n    let i18n_params = typeof wc_address_i18n_params == 'undefined' ? getSetting('i18n') : wc_address_i18n_params;\n    if (isEmpty(address)) {\n        return false;\n    }\n    if (!locales) {\n        locales = JSON.parse(i18n_params.locale.replace(/&quot;/g, '\"'));\n    }\n    if (!address.country || isEmpty(address)) {\n        return false;\n    }\n    let locale = locales?.[address.country] ? locales[address.country] : locales['default'];\n    locale = $.extend(true, {}, locales['default'], locale);\n    const entries = Object.entries(locale).filter(([key, value]) => !exclude.includes(key));\n    locale = Object.fromEntries(entries);\n    for (let key in locale) {\n        if (locale[key]?.required) {\n            const value = address?.[key] || null;\n            if (!value || !value?.trim()) {\n                return false;\n            }\n        }\n    }\n    return true;\n}\n\n/**\n * Converts a WC cart address to a PayPal formatted address\n */\nexport const convertCartAddressToPayPal = (address) => {\n    const newAddress = {};\n    for (let key in address) {\n        if (ADDRESS_MAPPING?.[key]) {\n            if (ADDRESS_MAPPING[key].includes('|')) {\n                const [k1, k2] = ADDRESS_MAPPING[key].split('|');\n                newAddress[k1] = address[key];\n            } else {\n                newAddress[ADDRESS_MAPPING[key]] = address[key];\n            }\n        }\n    }\n    return newAddress;\n}\n\nexport const convertPayPalAddressToCart = (address, intermediate = false) => {\n    let mappings = {};\n    if (intermediate) {\n        mappings = INTERMEDIATE_ADDRESS_MAPPING;\n    } else {\n        mappings = Object.fromEntries(Object.entries(ADDRESS_MAPPING).map(([key, key2]) => [key2, key]));\n    }\n    const newAddress = {};\n    for (let key in mappings) {\n        if (key.includes('|')) {\n            const keys = key.split('|');\n            for (let k1 of keys) {\n                if (address.hasOwnProperty(k1)) {\n                    newAddress[mappings[key]] = address[k1];\n                    break;\n                } else {\n                    newAddress[mappings[key]] = '';\n                }\n            }\n        } else {\n            if (address.hasOwnProperty(key)) {\n                newAddress[mappings[key]] = address[key];\n            } else {\n                newAddress[mappings[key]] = '';\n            }\n        }\n    }\n    return newAddress;\n}\n\nexport const isValidFieldValue = (value) => {\n    value = value?.trim();\n    return !!value;\n}\n\nexport const isValid = key => {\n    return isValidFieldValue(getFieldValue(key));\n}\n\n/**\n * Given a formatted shipping method, extract it into the WC format.\n * @param selectedMethod\n */\nexport const extractShippingMethod = (selectedMethod) => {\n    const matches = selectedMethod.match(SHIPPING_OPTION_REGEX);\n    if (matches) {\n        const {1: packageId, 2: method} = matches;\n        return {[packageId]: method};\n    }\n    return null;\n}\n\nexport const extractFullName = (name) => {\n    name = name.trim();\n    const firstName = name.split(' ').slice(0, -1).join(' ');\n    const lastName = name.split(' ').pop();\n    return [firstName, lastName];\n}\n\n/**\n * Returns a rest route in ajax form given a route key\n * @param route\n * @returns {*|null}\n */\nexport const getRestRoute = (route) => {\n    return getSetting('generalData')?.restRoutes?.[route]?.url || null;\n}\n\n/**\n * Returns a rest route in ajax form given a route path.\n * @param path\n * @returns {*}\n */\nexport const getRestPath = (path) => {\n    path = path.replace(/^\\//, '');\n    return getSetting('generalData')?.ajaxRestPath?.replace('%s', path);\n}\n\nexport const getPage = () => {\n    return getSetting('generalData').page;\n}\n\nexport const isPluginConnected = () => getSetting('generalData')?.clientId?.length > 0;"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","_arrayLikeToArray","arr","len","length","i","arr2","Array","_slicedToArray","isArray","_i","iterator","_s","_e","_arr","_n","_d","next","done","push","err","minLen","n","toString","slice","constructor","name","from","test","TypeError","_objectWithoutProperties","source","excluded","target","sourceKeys","keys","indexOf","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","_defineProperty","configurable","writable","window","createScriptElement","url","attributes","newScript","document","createElement","src","forEach","setAttribute","loadScript","options","PromisePonyfill","getDefaultPromiseImplementation","validateArguments","resolve","_a","sdkBaseURL","merchantID","dataMerchantID","newMerchantID","newDataMerchantID","processMerchantID","params","queryString","filter","reduce","accumulator","substring","dataAttributes","queryParams","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","fetch","then","response","status","text","message","parseMessage","originalErrorText","split","replace","trim","parseErrorMessage","catch","loadCustomScript","newWindowNamespace","Promise","urlParams","isLoading","fields","Map","locales","SHIPPING_OPTION_REGEX","ADDRESS_MAPPING","address_1","address_2","state","city","postcode","country","INTERMEDIATE_ADDRESS_MAPPING","postal_code","country_code","loadPayPalSdk","isEmpty","isEqual","paypal","defaultHooks","error","console","log","msg","toLowerCase","includes","locale","newParams","code","finally","getSetting","wcPPCPSettings","setSetting","getPayPalQueryParams","getFieldValue","prefix","$","val","fieldsToJson","json","setFieldValue","set","getErrorMessage","messages","submitErrorMessage","container","context","match","classes","$container","join","remove","prepend","animate","scrollTop","offset","top","isValidAddress","address","exclude","i18n_params","wc_address_i18n_params","JSON","parse","entries","fromEntries","required","convertCartAddressToPayPal","newAddress","k1","convertPayPalAddressToCart","intermediate","mappings","map","isValidFieldValue","isValid","extractShippingMethod","selectedMethod","matches","extractFullName","pop","getRestRoute","route","restRoutes","getRestPath","path","ajaxRestPath","getPage","page","isPluginConnected","clientId"],"sourceRoot":""}