{"version":3,"file":"walley-checkout-loader.js","sources":["../../../language/src/function/isFunction.ts","../../../language/src/function/callOptionalFunction.ts","../../../language/src/type/isNull.ts","../../../language/src/type/isUndefined.ts","../../../language/src/type/isDefined.ts","../../../language/src/object/isObject.ts","../../../language/src/object/isPlainObject.ts","../../../language/src/string/isEmptyString.ts","../../../language/src/string/isString.ts","../../../language/src/string/isNonEmptyString.ts","../../../language/src/string/isWhitespaceString.ts","../../../language/src/string/isNonWhitespaceString.ts","../../../language/src/string/isUndefinedOrNull.ts","../../../language/src/string/isUndefinedNullOrWhitespace.ts","../../../language/src/string/removeWhitespace.ts","../../../language/src/number/isNumber.ts","../../../language/src/number/isValidNumber.ts","../../../language/src/number/getDecimalSeparator.ts","../../../language/src/number/stringToNumber.ts","../../../language/src/number/parseNumber.ts","../../../language/src/number/toNumber.ts","../../../language/src/string/truncateString.ts","../../../language/src/object/getObjectEntries.ts","../../../language/src/object/getPlainObjectEntries.ts","../../../language/src/object/isEmptyObject.ts","../../../language/src/object/isEmptyPlainObject.ts","../../../language/src/object/isEmptyValue.ts","../../../language/src/object/isNonEmptyValue.ts","../../../language/src/number/toHexadecimal.ts","../../../language/src/utils/createRandomId.ts","../../../language/src/utils/jsonParse.ts","../../../language/src/utils/jsonStringify.ts","../../../language/src/object/toObject.ts","../../../language/src/error/isError.ts","../../../language/src/error/isErrorLike.ts","../../../language/src/event/isErrorEvent.ts","../../../language/src/event/isEvent.ts","../../../language/src/error/toErrorLike.ts","../../../language/src/object/toPlainObject.ts","../../../language/src/object/withoutEmptyValues.ts","../../../language/src/type/isEmpty.ts","../../../language/src/type/isNonEmpty.ts","../../../language/src/type/isSet.ts","../../../language/src/array/arrayFilterNonNullable.ts","../../../language/src/array/arrayFrom.ts","../../../language/src/array/isArray.ts","../../../language/src/array/isEmptyArray.ts","../../../language/src/array/isNonEmptyArray.ts","../../../language/src/boolean/stringToBoolean.ts","../../../language/src/date/isDate.ts","../../../language/src/enum/isEnum.ts","../../../language/src/enum/toEnum.ts","../../../language/src/promise/isPromise.ts","../../../language/src/uri/appendUriQuery.ts","../../../language/src/uri/concatUri.ts","../../../language/src/uri/ensureUriEndingSlash.ts","../../../language/src/uri/isUri.ts","../../../language/src/uri/toUri.ts","../../../language/src/uri/getUriOrigin.ts","../../../language/src/uri/removeUriQuery.ts","../../../domain/src/integration/IntegrationName.ts","../../../domain/src/integration/createIntegrationId.ts","../../../domain/src/integration/toIntegrationId.ts","../../../domain/src/locale/Country.ts","../../../domain/src/locale/toCountry.ts","../../../domain/src/log/LogLevel.ts","../../../domain/src/log/logLevels.ts","../../../domain/src/log/isLogLevelAbove.ts","../../../domain/src/log/normalizeLogProperty.ts","../../../domain/src/log/normalizeLogProperties.ts","../../../domain/src/log/normalizeMessageTemplateParameters.ts","../../../domain/src/log/renderMessageTemplateParameter.ts","../../../domain/src/log/renderMessageTemplate.ts","../../../../node_modules/stackframe/stackframe.js","../../../../node_modules/error-stack-parser/error-stack-parser.js","../../../../node_modules/stack-generator/stack-generator.js","../../../../node_modules/stacktrace-gps/node_modules/source-map/lib/util.js","../../../../node_modules/stacktrace-gps/node_modules/source-map/lib/binary-search.js","../../../../node_modules/stacktrace-gps/node_modules/source-map/lib/array-set.js","../../../../node_modules/stacktrace-gps/node_modules/source-map/lib/base64.js","../../../../node_modules/stacktrace-gps/node_modules/source-map/lib/base64-vlq.js","../../../../node_modules/stacktrace-gps/node_modules/source-map/lib/quick-sort.js","../../../../node_modules/stacktrace-gps/node_modules/source-map/lib/source-map-consumer.js","../../../../node_modules/stacktrace-gps/stacktrace-gps.js","../../../../node_modules/stacktrace-js/stacktrace.js","../../../domain/src/log/resolveErrorStack.ts","../../../domain/src/log/isLogLevel.ts","../../../domain/src/log/toLogLevel.ts","../../../domain/src/message/MerchantEventType.ts","../../../domain/src/message/MessageType.ts","../../../domain/src/token/parseToken.ts","../../../domain/src/token/isBitSetInToken.ts","../../../domain/src/token/toToken.ts","../../../interaction/src/http/HttpError.ts","../../../interaction/src/http/http.ts","../../../interaction/src/http/httpPost.ts","../../../interaction/src/api/getApiRequestOptions.ts","../../../interaction/src/api/apiPostRaw.ts","../../../interaction/src/dom/setElementAttributes.ts","../../../interaction/src/dom/createElement.ts","../../../interaction/src/dom/createDivElement.ts","../../../interaction/src/dom/createIframeElement.ts","../../../interaction/src/dom/dispatchEvent.ts","../../../interaction/src/dom/getAttribute.ts","../../../interaction/src/dom/getDocumentLanguage.ts","../../../interaction/src/dom/getElementById.ts","../../../interaction/src/dom/getElementsByTagName.ts","../../../interaction/src/dom/getLocationUri.ts","../../../interaction/src/dom/insertElement.ts","../../../interaction/src/dom/postMessage.ts","../../../interaction/src/dom/querySelector.ts","../../../interaction/src/dom/querySelectorAll.ts","../../../interaction/src/dom/redirect.ts","../../../interaction/src/dom/removeElementAttribute.ts","../../../interaction/src/dom/setElementAttribute.ts","../../../interaction/src/dom/setElementHeight.ts","../../../interaction/src/integration/constants.ts","../../../interaction/src/integration/createIntegrationIframe.ts","../../../interaction/src/integration/createIntegrationSpinner.ts","../../../interaction/src/integration/getClientUri.ts","../../../interaction/src/integration/getIntegrationSelector.ts","../../../interaction/src/integration/getIntegrationIframeSelector.ts","../../../interaction/src/integration/getIntegrationIframe.ts","../../../interaction/src/integration/getUnsupportedFeatures.ts","../../../interaction/src/integration/isBrowserSupported.ts","../../../interaction/src/message/sendMessage.ts","../../../interaction/src/integration/getIntegrationIframes.ts","../../../interaction/src/integration/message/sendMessageToIntegrationIframes.ts","../../../interaction/src/integration/message/sendResume.ts","../../../interaction/src/integration/message/sendSuspend.ts","../../../interaction/src/integration/registerIntegrationErrorHandler.ts","../../../interaction/src/message/parseMessage.ts","../../../interaction/src/integration/isValidOrigin.ts","../../../interaction/src/integration/message/handleBroadcastMessage.ts","../../../interaction/src/integration/removeIntegrationSpinner.ts","../../../interaction/src/integration/message/handleHeightSetMessaget.ts","../../../interaction/src/integration/getIntegrationModalIframe.ts","../../../interaction/src/integration/modalOpenClassName.ts","../../../interaction/src/integration/removeIntegrationModalIframe.ts","../../../interaction/src/integration/message/handleHideModalMessage.ts","../../../interaction/src/integration/setElementLocked.ts","../../../interaction/src/integration/message/handleMerchantEventMessage.ts","../../../interaction/src/integration/message/handleOldMerchantEventMessage.ts","../../../interaction/src/integration/message/handleOnBeforePaymentMessage.ts","../../../interaction/src/integration/message/sendQueuedMessageToIntegrationIframes.ts","../../../interaction/src/integration/message/handleReadyMessage.ts","../../../interaction/src/integration/message/handleRedirectMessage.ts","../../../interaction/src/integration/message/handleRelayMessage.ts","../../../interaction/src/storage/MemoryStorage.ts","../../../interaction/src/storage/getStorage.ts","../../../interaction/src/storage/isStorageAvailable.ts","../../../interaction/src/storage/getStorageItem.ts","../../../interaction/src/storage/getStorageData.ts","../../../interaction/src/storage/removeStorageItem.ts","../../../interaction/src/storage/setStorageItem.ts","../../../interaction/src/storage/setStorageData.ts","../../../interaction/src/integration/getWalleyStorage.ts","../../../interaction/src/integration/getIntegrationUri.ts","../../../interaction/src/integration/getMaxZIndex.ts","../../../interaction/src/integration/appendIntegrationModalIframe.ts","../../../interaction/src/integration/message/handleShowModalMessage.ts","../../../interaction/src/integration/setWalleyStorage.ts","../../../interaction/src/integration/message/handleStoreParameterMessage.ts","../../../interaction/src/integration/message/getHandleMessageFunction.ts","../../../interaction/src/integration/registerIntegrationMessageHandler.ts","../../../interaction/src/integration/createIntegrationContent.ts","../../../interaction/src/integration/insertIntegrationContent.ts","../../../interaction/src/integration/renderCheckout.ts","../../../interaction/src/log/createLogContext.ts","../../../interaction/src/log/logClient.ts","../../../interaction/src/log/createLog.ts","../../src/helpers/getAllScripts.ts","../../src/helpers/isLoaderScriptSrc.ts","../../src/helpers/isLoaderScript.ts","../../src/helpers/getAllLoaderScripts.ts","../../src/helpers/getTokenAttribute.ts","../../src/helpers/sendUpdate.ts","../../src/helpers/createCollectorCheckoutApi.ts","../../src/helpers/createCollectorGlobal.ts","../../src/helpers/createWalleyCheckoutApi.ts","../../src/helpers/createWalleyCheckoutState.ts","../../src/helpers/createWalleyGlobal.ts","../../src/helpers/getConfigOrThrowException.ts","../../src/helpers/getLoaderScriptData.ts","../../src/helpers/loaderScriptAttributesToInitData.ts","../../src/helpers/initLoaderScript.ts","../../src/index.ts"],"sourcesContent":["export const isFunction = (\r\n value: T | undefined\r\n): value is T extends (...args: unknown[]) => unknown ? T : undefined =>\r\n typeof value === 'function';\r\n","import { isFunction } from './isFunction';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ntype GenericFunction = (...args: any[]) => any;\r\n\r\nexport const callOptionalFunction = (\r\n func: T | undefined,\r\n ...args: Parameters\r\n): ReturnType | undefined => (isFunction(func) ? func(...args) : undefined);\r\n","export const isNull = (value: unknown): value is null => value === null;\r\n","export const isUndefined = (value: unknown): value is undefined =>\r\n value === undefined;\r\n","import { isNull } from './isNull';\r\nimport { isUndefined } from './isUndefined';\r\n\r\nexport const isDefined = (value: T): value is NonNullable =>\r\n !(isUndefined(value) || isNull(value));\r\n","import { PlainObject } from './PlainObject';\r\n\r\nexport const isObject = (value: unknown): value is object & PlainObject =>\r\n !!value && typeof value === 'object';\r\n","import { PlainObject } from './PlainObject';\r\nimport { isObject } from './isObject';\r\n\r\nexport const isPlainObject = (\r\n value: unknown\r\n): value is T => {\r\n if (!isObject(value)) {\r\n return false;\r\n }\r\n\r\n const prototype = Object.getPrototypeOf(value);\r\n\r\n return (\r\n (prototype === null ||\r\n prototype === Object.prototype ||\r\n Object.getPrototypeOf(prototype) === null) &&\r\n !(Symbol.toStringTag in value) &&\r\n !(Symbol.iterator in value)\r\n );\r\n};\r\n","export const isEmptyString = (value: unknown): value is string => value === '';\r\n","export const isString = (value: unknown): value is string =>\r\n typeof value === 'string';\r\n","import { isEmptyString } from './isEmptyString';\r\nimport { isString } from './isString';\r\n\r\nexport const isNonEmptyString = (value: unknown): value is string =>\r\n isString(value) && !isEmptyString(value);\r\n","import { isEmptyString } from './isEmptyString';\r\nimport { isString } from './isString';\r\n\r\nexport const isWhitespaceString = (value: unknown): value is string =>\r\n isString(value) && isEmptyString(value.trim());\r\n","import { isString } from './isString';\r\nimport { isWhitespaceString } from './isWhitespaceString';\r\n\r\nexport const isNonWhitespaceString = (value: unknown): value is string =>\r\n isString(value) && !isWhitespaceString(value);\r\n","export const isUndefinedOrNull = (value: unknown): value is undefined | null =>\r\n value === undefined || value === null;\r\n","import { isUndefinedOrNull } from './isUndefinedOrNull';\r\nimport { isWhitespaceString } from './isWhitespaceString';\r\n\r\nexport const isUndefinedNullOrWhitespace = (\r\n value: unknown\r\n): value is undefined | null | string =>\r\n isUndefinedOrNull(value) || isWhitespaceString(value);\r\n","export const removeWhitespace = (value: T | undefined) =>\r\n value?.replace(/\\s/g, '') || '';\r\n","export const isNumber = (value: unknown): value is number =>\r\n typeof value === 'number';\r\n","import { isNumber } from './isNumber';\r\n\r\nexport const isValidNumber = (value: unknown): value is number =>\r\n isNumber(value) &&\r\n !Number.isNaN(value) &&\r\n value < Infinity &&\r\n value > -Infinity;\r\n","export const getDecimalSeparator = (\r\n locale: string | undefined,\r\n fallback: string\r\n) => {\r\n try {\r\n return (\r\n Intl.NumberFormat(locale)\r\n .formatToParts(1.1)\r\n .find(part => part.type === 'decimal')?.value ?? fallback\r\n );\r\n } catch {\r\n return fallback;\r\n }\r\n};\r\n","import { removeWhitespace } from '../string';\r\nimport { getDecimalSeparator } from './getDecimalSeparator';\r\n\r\nconst decimalSeparator = '.';\r\n\r\nexport const stringToNumber = (value: string, locale: string | undefined) => {\r\n const cleanValue = removeWhitespace(\r\n value\r\n .replace(\r\n getDecimalSeparator(locale, decimalSeparator),\r\n decimalSeparator\r\n )\r\n .replace('−', '-')\r\n );\r\n\r\n if (!/^-?\\d+(\\.\\d+)?$/.test(cleanValue)) {\r\n return undefined;\r\n }\r\n\r\n return parseFloat(cleanValue);\r\n};\r\n","import { stringToNumber } from './stringToNumber';\r\n\r\nexport const parseNumber = (value: unknown, locale: string | undefined) => {\r\n switch (typeof value) {\r\n case 'string':\r\n return stringToNumber(value, locale);\r\n default:\r\n return undefined;\r\n }\r\n};\r\n","import { isNumber } from './isNumber';\r\nimport { isValidNumber } from './isValidNumber';\r\nimport { parseNumber } from './parseNumber';\r\n\r\nexport const toNumber = (value: unknown, locale?: string) => {\r\n const number = isNumber(value) ? value : parseNumber(value, locale);\r\n return isValidNumber(number) ? number : undefined;\r\n};\r\n","export const truncateString = (value: string, maxLength: number) =>\r\n value && value.length > maxLength && maxLength > 0\r\n ? `${value.substring(0, maxLength - 1)}…`\r\n : value;\r\n","import { ObjectType } from './ObjectType';\r\n\r\nexport const getObjectEntries = (obj: ObjectType) =>\r\n Object.entries(obj).filter(([_, value]) => value !== undefined);\r\n","import { PlainObject } from './PlainObject';\r\n\r\nexport const getPlainObjectEntries = (obj: PlainObject) =>\r\n Object.entries(obj).filter(([_, value]) => value !== undefined);\r\n","import { ObjectType } from './ObjectType';\r\nimport { getObjectEntries } from './getObjectEntries';\r\nimport { isPlainObject } from './isPlainObject';\r\n\r\nexport const isEmptyObject = (\r\n value: unknown\r\n): value is Partial =>\r\n isPlainObject(value) && getObjectEntries(value).length === 0;\r\n","import { PlainObject } from './PlainObject';\r\nimport { getPlainObjectEntries } from './getPlainObjectEntries';\r\nimport { isPlainObject } from './isPlainObject';\r\n\r\nexport const isEmptyPlainObject = (\r\n value: unknown\r\n): value is Partial =>\r\n isPlainObject(value) && getPlainObjectEntries(value).length === 0;\r\n","import { isEmptyArray } from '../array';\r\nimport { isUndefinedNullOrWhitespace } from '../string';\r\nimport { isEmptyObject } from './isEmptyObject';\r\n\r\nexport const isEmptyValue = (value: unknown): boolean =>\r\n isUndefinedNullOrWhitespace(value) ||\r\n isEmptyArray(value) ||\r\n isEmptyObject(value);\r\n","import { isEmptyValue } from './isEmptyValue';\r\n\r\nexport const isNonEmptyValue = (value: T): value is NonNullable =>\r\n !isEmptyValue(value);\r\n","export const toHexadecimal = (value: number) => value.toString(16);\r\n","import { toHexadecimal } from '../number/toHexadecimal';\r\n\r\nconst createRandomNumber = (): number => {\r\n try {\r\n return window.crypto.getRandomValues(new Uint32Array(1))[0];\r\n } catch {\r\n return Date.now();\r\n }\r\n};\r\n\r\nexport const createRandomId = (): string => toHexadecimal(createRandomNumber());\r\n","import { DeepPartial } from '../object';\r\n\r\nexport const jsonParse = (\r\n value: string | undefined | null,\r\n throwError?: boolean\r\n): DeepPartial | undefined => {\r\n try {\r\n return value ? (JSON.parse(value) as DeepPartial) : undefined;\r\n } catch (error) {\r\n if (throwError) {\r\n throw error;\r\n }\r\n return undefined;\r\n }\r\n};\r\n","import { isArray } from '../array';\r\nimport { isEmptyValue } from '../object';\r\nimport { isObject } from '../object/isObject';\r\n\r\nconst safeAccess = (\r\n value: Record,\r\n key: string,\r\n throwError: boolean | undefined\r\n) => {\r\n try {\r\n const prop = value[key];\r\n\r\n if (prop === window) {\r\n return '[WINDOW]';\r\n }\r\n\r\n if ('Node' in window && prop instanceof Node) {\r\n return `[${prop.nodeName || 'NODE'}]`;\r\n }\r\n\r\n return prop;\r\n } catch (error) {\r\n if (throwError) {\r\n throw error;\r\n }\r\n return error?.toString();\r\n }\r\n};\r\n\r\nexport const jsonStringify = (\r\n objectValue: unknown,\r\n format?: boolean,\r\n throwError?: boolean\r\n) => {\r\n const seen: unknown[] = [];\r\n\r\n return JSON.stringify(\r\n objectValue,\r\n (_, value) => {\r\n if (isEmptyValue(value)) {\r\n return undefined;\r\n }\r\n\r\n if (!isObject(value)) {\r\n return value;\r\n }\r\n\r\n if (seen.indexOf(value) !== -1) {\r\n return undefined;\r\n }\r\n\r\n seen.push(value);\r\n\r\n if (isArray(value)) {\r\n return value;\r\n }\r\n\r\n if (value instanceof Error) {\r\n return {\r\n ...value,\r\n name: value.name,\r\n message: value.message,\r\n stack: value.stack,\r\n };\r\n }\r\n\r\n return Object.keys(value).reduce(\r\n (result, key) => {\r\n result[key] = safeAccess(value, key, throwError);\r\n return result;\r\n },\r\n {} as Record\r\n );\r\n },\r\n format ? ' ' : undefined\r\n );\r\n};\r\n","import { isString } from '../string';\r\nimport { jsonParse } from '../utils';\r\nimport { DeepPartialObject } from './DeepPartialObject';\r\nimport { isObject } from './isObject';\r\n\r\nexport const toObject = (\r\n value: unknown\r\n): DeepPartialObject | undefined => {\r\n if (isObject(value)) {\r\n return value as DeepPartialObject;\r\n }\r\n\r\n if (isString(value)) {\r\n const parsed = jsonParse(value);\r\n\r\n if (isObject(parsed)) {\r\n return parsed;\r\n }\r\n }\r\n\r\n return undefined;\r\n};\r\n","export const isError = (value: unknown): value is Error =>\r\n value instanceof Error;\r\n","import { isObject } from '../object';\r\nimport { isString } from '../string';\r\nimport { ErrorLike } from './ErrorLike';\r\nimport { isError } from './isError';\r\n\r\nexport const isErrorLike = (value: unknown): value is ErrorLike =>\r\n isError(value) ||\r\n (isObject(value) && isString(value.name) && isString(value.message));\r\n","export const isErrorEvent = (value: unknown): value is ErrorEvent =>\r\n 'ErrorEvent' in window && value instanceof window.ErrorEvent;\r\n","export const isEvent = (value: unknown): value is Event =>\r\n value instanceof Event;\r\n","import { isErrorEvent } from '../event';\r\nimport { toPlainObject } from '../object';\r\nimport { isString } from '../string';\r\nimport { jsonStringify } from '../utils';\r\nimport { ErrorLike } from './ErrorLike';\r\nimport { isErrorLike } from './isErrorLike';\r\n\r\nexport const toErrorLike = (error: unknown): ErrorLike | undefined => {\r\n if (!error) {\r\n return undefined;\r\n }\r\n\r\n if (isErrorLike(error)) {\r\n return error;\r\n }\r\n\r\n if (isErrorEvent(error) && isErrorLike(error.error)) {\r\n return error.error;\r\n }\r\n\r\n if (isString(error)) {\r\n return {\r\n message: error,\r\n name: 'ErrorString',\r\n };\r\n }\r\n\r\n const plainError = toPlainObject(error);\r\n\r\n return {\r\n message: 'An unexpected error object',\r\n name: 'UnexpectedError',\r\n ...plainError,\r\n data: plainError ? undefined : jsonStringify(error),\r\n };\r\n};\r\n","import { toErrorLike } from '../error';\r\nimport { isFunction } from '../function';\r\nimport { PlainObject } from './PlainObject';\r\nimport { isObject } from './isObject';\r\nimport { isPlainObject } from './isPlainObject';\r\nimport { toObject } from './toObject';\r\n\r\nconst toPlainObjectValue = (value: unknown) => {\r\n if (isFunction(value)) {\r\n return undefined;\r\n }\r\n\r\n if (isObject(value)) {\r\n return toPlainObject(value);\r\n }\r\n\r\n return value;\r\n};\r\n\r\nconst toPlainObjectInner = (obj: object) => {\r\n const plainObj: Record = {};\r\n\r\n for (const key in obj) {\r\n try {\r\n plainObj[key.toString()] = toPlainObjectValue(\r\n obj[key as keyof typeof obj]\r\n );\r\n } catch (err) {\r\n plainObj[key.toString()] = toErrorLike(err)?.message;\r\n }\r\n }\r\n\r\n return plainObj;\r\n};\r\n\r\nexport const toPlainObject = (value: unknown): PlainObject | undefined => {\r\n const obj = toObject(value);\r\n\r\n if (!obj) {\r\n return undefined;\r\n }\r\n\r\n if (isPlainObject(obj)) {\r\n return obj;\r\n }\r\n\r\n return toPlainObjectInner(obj);\r\n};\r\n","import { DeepPartial } from './DeepPartial';\r\nimport { DeepPartialObject } from './DeepPartialObject';\r\nimport { isEmptyObject } from './isEmptyObject';\r\nimport { isEmptyValue } from './isEmptyValue';\r\nimport { isNonEmptyValue } from './isNonEmptyValue';\r\nimport { isPlainObject } from './isPlainObject';\r\n\r\n/**\r\n * Recursively removes properties with empty values from an object.\r\n *\r\n * @template T - The type of the input object.\r\n * @param {T | undefined} obj - The object from which to remove empty values.\r\n * @returns {DeepPartial | undefined} - A new object with empty values removed, or `undefined` if the input object is empty.\r\n *\r\n * @remarks\r\n * - An empty value is defined by the `isEmptyValue` function.\r\n * - A plain object is determined by the `isPlainObject` function.\r\n * - Non-empty values are determined by the `isNonEmptyValue` function.\r\n * - The result is a deep partial of the input object type.\r\n */\r\nexport const withoutEmptyValues = (\r\n obj: T | undefined\r\n): DeepPartial | undefined => {\r\n if (isEmptyValue(obj)) {\r\n return undefined;\r\n }\r\n\r\n if (!isPlainObject(obj)) {\r\n return obj as DeepPartial;\r\n }\r\n\r\n type KeyType = keyof typeof obj;\r\n\r\n const result = Object.keys(obj).reduce(\r\n (acc: DeepPartialObject, k: KeyType) => {\r\n const property = obj[k as KeyType] as unknown;\r\n const propertyValue = isPlainObject(property)\r\n ? withoutEmptyValues(property)\r\n : property;\r\n\r\n if (isNonEmptyValue(propertyValue)) {\r\n return { ...acc, [k]: propertyValue };\r\n }\r\n return acc;\r\n },\r\n {} as DeepPartialObject\r\n ) as DeepPartial;\r\n\r\n return !isEmptyObject(result) ? result : undefined;\r\n};\r\n","import { isEmptyArray } from '../array';\r\nimport { isEmptyPlainObject } from '../object';\r\nimport { isEmptyString } from '../string';\r\nimport { isDefined } from './isDefined';\r\n\r\nexport const isEmpty = (value: unknown) =>\r\n !isDefined(value) ||\r\n isEmptyString(value) ||\r\n isEmptyArray(value) ||\r\n isEmptyPlainObject(value);\r\n","import { isEmpty } from './isEmpty';\r\n\r\nexport const isNonEmpty = (value: T): value is NonNullable =>\r\n !isEmpty(value);\r\n","import { isNonEmptyString } from '../string';\r\nimport { isDefined } from './isDefined';\r\n\r\nexport const isSet = (value: T): value is NonNullable =>\r\n isDefined(value) && isNonEmptyString(value);\r\n","import { callOptionalFunction } from '../function';\r\nimport { isDefined } from '../type';\r\n\r\nexport const arrayFilterNonNullable = (\r\n array: (T | undefined | null)[] | undefined,\r\n predicate?: (item: NonNullable) => boolean\r\n): NonNullable[] =>\r\n (array?.filter(\r\n item =>\r\n isDefined(item) && (callOptionalFunction(predicate, item) ?? true)\r\n ) as NonNullable[]) ?? [];\r\n","export const arrayFrom = (value: ArrayLike) => Array.from(value);\r\n","export const isArray = (value: unknown): value is unknown[] =>\r\n Array.isArray(value);\r\n","import { isArray } from './isArray';\r\n\r\nexport const isEmptyArray = (value: T): value is NonNullable =>\r\n isArray(value) && value.length === 0;\r\n","import { isArray } from './isArray';\r\n\r\nexport const isNonEmptyArray = (\r\n value: T\r\n): value is NonNullable => isArray(value) && value.length > 0;\r\n","export const stringToBoolean = (value: string | undefined) => {\r\n switch (value?.toLowerCase()) {\r\n case 'false':\r\n return false;\r\n case 'true':\r\n return true;\r\n default:\r\n return undefined;\r\n }\r\n};\r\n","export const isDate = (value: unknown): value is Date => value instanceof Date;\r\n","import { Enum } from './Enum';\r\n\r\nexport const isEnum = (\r\n enumType: Enum,\r\n value: unknown\r\n): value is T => Object.keys(enumType).some(key => enumType[key] === value);\r\n","import { Enum } from './Enum';\r\nimport { isEnum } from './isEnum';\r\n\r\nexport const toEnum = (\r\n enumType: Enum,\r\n value: unknown\r\n) => (isEnum(enumType, value) ? value : undefined);\r\n","import { isFunction } from '../function';\r\nimport { isObject } from '../object';\r\n\r\nexport const isPromise = (\r\n value: T | undefined\r\n): value is T extends Promise ? T : undefined =>\r\n isObject(value) && isFunction(value.then) && isFunction(value.catch);\r\n","import { isObject } from '../object';\r\nimport { isNonWhitespaceString } from '../string';\r\nimport { jsonStringify } from '../utils';\r\n\r\nconst appendUriQueryValue = (\r\n target: T,\r\n key: string,\r\n value: unknown\r\n): T => {\r\n const serializedValue = isObject(value)\r\n ? jsonStringify(value)\r\n : value?.toString();\r\n\r\n const [path, query] = (target ?? '').split('?');\r\n\r\n const separator = query ? '&' : '';\r\n\r\n return isNonWhitespaceString(serializedValue)\r\n ? (`${path ?? ''}?${query ?? ''}${separator}${encodeURIComponent(\r\n key\r\n )}=${encodeURIComponent(serializedValue)}` as T)\r\n : target;\r\n};\r\n\r\nexport const appendUriQuery = (\r\n target: T,\r\n query: Record\r\n): T =>\r\n Object.entries(query).reduce(\r\n (result, [key, value]) => appendUriQueryValue(result, key, value),\r\n target\r\n );\r\n","import { arrayFilterNonNullable } from '../array';\r\n\r\nexport const concatUri = (\r\n uri: T,\r\n ...uriParts: (string | undefined)[]\r\n): T =>\r\n arrayFilterNonNullable([uri, ...uriParts], i => !!i)\r\n .map(u => u.replace(/(^\\/|\\/$)/g, ''))\r\n .join('/') as T;\r\n","import { Uri } from './Uri';\r\n\r\nexport const ensureUriEndingSlash = (uri: Uri): Uri =>\r\n !uri.endsWith('/') ? `${uri}/` : uri;\r\n","import { isString } from '../string';\r\nimport { Uri } from './Uri';\r\n\r\nexport const isUri = (value: unknown): value is Uri =>\r\n isString(value) && /^\\w+:(\\/?\\/?)[^\\s]+$/i.test(value);\r\n","import { Uri } from './Uri';\r\nimport { isUri } from './isUri';\r\n\r\nexport const toUri = (value: unknown): Uri | undefined =>\r\n isUri(value) ? value : undefined;\r\n","import { toUri } from './toUri';\r\n\r\nexport const getUriOrigin = (uri: T) => {\r\n try {\r\n const url = new URL(toUri(uri) ?? '');\r\n return toUri(url.origin);\r\n } catch {\r\n return undefined;\r\n }\r\n};\r\n","import { Uri } from './Uri';\r\nimport { isUri } from './isUri';\r\n\r\nexport const removeUriQuery = (uri: Uri | undefined): Uri | undefined =>\r\n isUri(uri) ? (uri.split(/[?#]/)[0] as Uri) : undefined;\r\n","import { PaymentMethodName } from '../payment-methods';\r\n\r\nexport const IntegrationNameUnknown = 'Unknown';\r\nexport const IntegrationNameCheckoutV2 = 'CheckoutV2';\r\nexport const IntegrationNameWidgetPartPayment = 'WidgetPartPayment';\r\nexport const IntegrationNameModal = 'Modal';\r\nexport const IntegrationNameSpinner = 'Spinner';\r\nexport const IntegrationNameSdk = 'Sdk';\r\nexport const IntegrationNameLoader = 'Loader';\r\nexport const IntegrationNameB2cHeadless = 'B2cHeadless';\r\nexport const IntegrationNameDemo = 'Demo';\r\n\r\nexport type IntegrationName =\r\n | typeof IntegrationNameUnknown\r\n | typeof IntegrationNameCheckoutV2\r\n | typeof IntegrationNameWidgetPartPayment\r\n | typeof IntegrationNameModal\r\n | typeof IntegrationNameSpinner\r\n | typeof IntegrationNameSdk\r\n | typeof IntegrationNameLoader\r\n | typeof IntegrationNameB2cHeadless\r\n | typeof IntegrationNameDemo\r\n | `Payment${PaymentMethodName}`;\r\n","import { createRandomId } from '@walley/language';\r\nimport { IntegrationId } from './IntegrationId';\r\nimport { IntegrationName } from './IntegrationName';\r\n\r\nexport const createIntegrationId = (name: IntegrationName): IntegrationId =>\r\n `${name}-${createRandomId()}`;\r\n","import { isString } from '@walley/language';\r\nimport { IntegrationId } from './IntegrationId';\r\nimport { IntegrationName } from './IntegrationName';\r\n\r\nexport const toIntegrationId = (\r\n value: unknown,\r\n integrationName?: IntegrationName\r\n): IntegrationId | undefined => {\r\n if (!isString(value)) {\r\n return undefined;\r\n }\r\n\r\n const [_, name, id] = value.match(/^(\\w+)-(\\w+)$/) ?? [];\r\n\r\n if (!name || !id) {\r\n return undefined;\r\n }\r\n\r\n if (integrationName && name !== integrationName) {\r\n return undefined;\r\n }\r\n\r\n return value as IntegrationId;\r\n};\r\n","export enum Country {\r\n Sweden = 'SE',\r\n Norway = 'NO',\r\n Finland = 'FI',\r\n Denmark = 'DK',\r\n Germany = 'DE',\r\n Europe = 'EU',\r\n}\r\n","import { toEnum } from '@walley/language';\r\nimport { Country } from './Country';\r\n\r\nexport const toCountry = (value: unknown): Country | undefined =>\r\n toEnum(Country, value);\r\n","// export const LogLevelDebug = 'debug';\r\n// export const LogLevelInformation = 'information';\r\n// export const LogLevelWarning = 'warning';\r\n// export const LogLevelError = 'error';\r\n// export const LogLevelFatal = 'fatal';\r\n\r\n// export type LogLevel =\r\n// | typeof LogLevelDebug\r\n// | typeof LogLevelInformation\r\n// | typeof LogLevelWarning\r\n// | typeof LogLevelError\r\n// | typeof LogLevelFatal;\r\n\r\nexport enum LogLevel {\r\n Debug = 'debug',\r\n Information = 'information',\r\n Warning = 'warning',\r\n Error = 'error',\r\n Fatal = 'fatal',\r\n}\r\n","import { LogLevel } from './LogLevel';\r\n\r\nexport const logLevels: LogLevel[] = Object.values(LogLevel);\r\n","import { LogLevel } from './LogLevel';\r\nimport { logLevels } from './logLevels';\r\n\r\nexport const isLogLevelAbove = (\r\n currentLogLevel: LogLevel,\r\n minLogLevel: LogLevel\r\n) => logLevels.indexOf(currentLogLevel) >= logLevels.indexOf(minLogLevel);\r\n","import { jsonStringify } from '@walley/language';\r\n\r\nexport const normalizeLogProperty = (value: unknown) => {\r\n switch (typeof value) {\r\n case 'function':\r\n case 'bigint':\r\n case 'symbol':\r\n return value.toString();\r\n case 'object':\r\n return jsonStringify(value);\r\n default:\r\n return value;\r\n }\r\n};\r\n","import { normalizeLogProperty } from './normalizeLogProperty';\r\n\r\nexport const normalizeLogProperties = >(\r\n properties: T | undefined\r\n): T | undefined => {\r\n return properties\r\n ? Object.entries(properties).reduce(\r\n (result, [key, value]) => ({\r\n ...result,\r\n [key]: normalizeLogProperty(value),\r\n }),\r\n {} as T\r\n )\r\n : undefined;\r\n};\r\n","import { normalizeLogProperty } from './normalizeLogProperty';\r\n\r\nexport const normalizeMessageTemplateParameters = (\r\n values: unknown[] | undefined\r\n) => values?.map(normalizeLogProperty);\r\n","import {\r\n isArray,\r\n isDate,\r\n isEmptyString,\r\n isEvent,\r\n isPlainObject,\r\n isString,\r\n jsonStringify,\r\n} from '@walley/language';\r\n\r\nexport const renderMessageTemplateParameter = (\r\n value: unknown,\r\n quoteString = true\r\n): string => {\r\n if (value === undefined) {\r\n return '[undefined]';\r\n }\r\n\r\n if (value === null) {\r\n return '[null]';\r\n }\r\n\r\n if (isEmptyString(value)) {\r\n return '[empty string]';\r\n }\r\n\r\n if (isString(value)) {\r\n return quoteString ? `\"${value}\"` : value;\r\n }\r\n\r\n if (isDate(value)) {\r\n return value.toISOString();\r\n }\r\n\r\n if (isEvent(value)) {\r\n return `[Event ${value.type}]`;\r\n }\r\n\r\n if (isArray(value)) {\r\n return `[${value\r\n .map(v => renderMessageTemplateParameter(v))\r\n .join(', ')}]`;\r\n }\r\n\r\n if (isPlainObject(value)) {\r\n return jsonStringify(value);\r\n }\r\n\r\n return String(value);\r\n};\r\n","import { renderMessageTemplateParameter } from './renderMessageTemplateParameter';\r\n\r\nexport const renderMessageTemplate = (\r\n messageTemplate: string,\r\n messageTemplateParameters?: unknown[]\r\n): string => {\r\n const renderedMessageTemplate = renderMessageTemplateParameter(\r\n messageTemplate,\r\n false\r\n );\r\n\r\n return messageTemplateParameters\r\n ? messageTemplateParameters.reduce(\r\n (renderedMessage, messageTemplateParameter) =>\r\n renderedMessage.replace(\r\n /\\{\\w+\\}/,\r\n renderMessageTemplateParameter(messageTemplateParameter)\r\n ),\r\n renderedMessageTemplate\r\n )\r\n : renderedMessageTemplate;\r\n};\r\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stackframe', [], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.StackFrame = factory();\n }\n}(this, function() {\n 'use strict';\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n\n function _getter(p) {\n return function() {\n return this[p];\n };\n }\n\n var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];\n var numericProps = ['columnNumber', 'lineNumber'];\n var stringProps = ['fileName', 'functionName', 'source'];\n var arrayProps = ['args'];\n var objectProps = ['evalOrigin'];\n\n var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);\n\n function StackFrame(obj) {\n if (!obj) return;\n for (var i = 0; i < props.length; i++) {\n if (obj[props[i]] !== undefined) {\n this['set' + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n\n StackFrame.prototype = {\n getArgs: function() {\n return this.args;\n },\n setArgs: function(v) {\n if (Object.prototype.toString.call(v) !== '[object Array]') {\n throw new TypeError('Args must be an Array');\n }\n this.args = v;\n },\n\n getEvalOrigin: function() {\n return this.evalOrigin;\n },\n setEvalOrigin: function(v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError('Eval Origin must be an Object or StackFrame');\n }\n },\n\n toString: function() {\n var fileName = this.getFileName() || '';\n var lineNumber = this.getLineNumber() || '';\n var columnNumber = this.getColumnNumber() || '';\n var functionName = this.getFunctionName() || '';\n if (this.getIsEval()) {\n if (fileName) {\n return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return '[eval]:' + lineNumber + ':' + columnNumber;\n }\n if (functionName) {\n return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return fileName + ':' + lineNumber + ':' + columnNumber;\n }\n };\n\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf('(');\n var argsEndIndex = str.lastIndexOf(')');\n\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');\n var locationString = str.substring(argsEndIndex + 1);\n\n if (locationString.indexOf('@') === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, '');\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype['set' + _capitalize(booleanProps[i])] = (function(p) {\n return function(v) {\n this[p] = Boolean(v);\n };\n })(booleanProps[i]);\n }\n\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype['set' + _capitalize(numericProps[j])] = (function(p) {\n return function(v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + ' must be a Number');\n }\n this[p] = Number(v);\n };\n })(numericProps[j]);\n }\n\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype['set' + _capitalize(stringProps[k])] = (function(p) {\n return function(v) {\n this[p] = String(v);\n };\n })(stringProps[k]);\n }\n\n return StackFrame;\n}));\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('error-stack-parser', ['stackframe'], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory(require('stackframe'));\n } else {\n root.ErrorStackParser = factory(root.StackFrame);\n }\n}(this, function ErrorStackParser(StackFrame) {\n 'use strict';\n\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^()]*)|(,.*$)/g, '');\n }\n var sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').replace(/^.*?\\s+/, '');\n\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;\n\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);\n var functionName = location && sanitizedLine || undefined;\n var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g, ':$1');\n }\n\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\n\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split('\\n');\n var result = [];\n\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n\n return result;\n },\n\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split('\\n');\n var result = [];\n\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n })\n );\n }\n }\n\n return result;\n },\n\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n\n return filtered.map(function(line) {\n var tokens = line.split('@');\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = (tokens.shift() || '');\n var functionName = functionCall\n .replace(//, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^(]+\\(([^)]*)\\)$/, '$1');\n }\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\n undefined : argsRaw.split(',');\n\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n}));\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stack-generator', ['stackframe'], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory(require('stackframe'));\n } else {\n root.StackGenerator = factory(root.StackFrame);\n }\n}(this, function(StackFrame) {\n return {\n backtrace: function StackGenerator$$backtrace(opts) {\n var stack = [];\n var maxStackSize = 10;\n\n if (typeof opts === 'object' && typeof opts.maxStackSize === 'number') {\n maxStackSize = opts.maxStackSize;\n }\n\n var curr = arguments.callee;\n while (curr && stack.length < maxStackSize && curr['arguments']) {\n // Allow V8 optimizations\n var args = new Array(curr['arguments'].length);\n for (var i = 0; i < args.length; ++i) {\n args[i] = curr['arguments'][i];\n }\n if (/function(?:\\s+([\\w$]+))+\\s*\\(/.test(curr.toString())) {\n stack.push(new StackFrame({functionName: RegExp.$1 || undefined, args: args}));\n } else {\n stack.push(new StackFrame({args: args}));\n }\n\n try {\n curr = curr.caller;\n } catch (e) {\n break;\n }\n }\n return stack;\n }\n };\n}));\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nfunction normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n}\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = util.toSetString(aStr);\n var isDuplicate = has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n this._set[sStr] = idx;\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap)\n : new BasicSourceMapConsumer(sourceMap);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n if (source != null && sourceRoot != null) {\n source = util.join(sourceRoot, source);\n }\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: Optional. the column number in the original source.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n if (this.sourceRoot != null) {\n needle.source = util.relative(this.sourceRoot, needle.source);\n }\n if (!this._sources.has(needle.source)) {\n return [];\n }\n needle.source = this._sources.indexOf(needle.source);\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The only parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._sources.toArray().map(function (s) {\n return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;\n }, this);\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n if (this.sourceRoot != null) {\n source = util.join(this.sourceRoot, source);\n }\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n if (this.sourceRoot != null) {\n aSource = util.relative(this.sourceRoot, aSource);\n }\n\n if (this._sources.has(aSource)) {\n return this.sourcesContent[this._sources.indexOf(aSource)];\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + aSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n if (this.sourceRoot != null) {\n source = util.relative(this.sourceRoot, source);\n }\n if (!this._sources.has(source)) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n source = this._sources.indexOf(source);\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The only parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'))\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n if (section.consumer.sourceRoot !== null) {\n source = util.join(section.consumer.sourceRoot, source);\n }\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stacktrace-gps', ['source-map', 'stackframe'], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory(require('source-map/lib/source-map-consumer'), require('stackframe'));\n } else {\n root.StackTraceGPS = factory(root.SourceMap || root.sourceMap, root.StackFrame);\n }\n}(this, function(SourceMap, StackFrame) {\n 'use strict';\n\n /**\n * Make a X-Domain request to url and callback.\n *\n * @param {String} url\n * @returns {Promise} with response text if fulfilled\n */\n function _xdr(url) {\n return new Promise(function(resolve, reject) {\n var req = new XMLHttpRequest();\n req.open('get', url);\n req.onerror = reject;\n req.onreadystatechange = function onreadystatechange() {\n if (req.readyState === 4) {\n if ((req.status >= 200 && req.status < 300) ||\n (url.substr(0, 7) === 'file://' && req.responseText)) {\n resolve(req.responseText);\n } else {\n reject(new Error('HTTP status: ' + req.status + ' retrieving ' + url));\n }\n }\n };\n req.send();\n });\n\n }\n\n /**\n * Convert a Base64-encoded string into its original representation.\n * Used for inline sourcemaps.\n *\n * @param {String} b64str Base-64 encoded string\n * @returns {String} original representation of the base64-encoded string.\n */\n function _atob(b64str) {\n if (typeof window !== 'undefined' && window.atob) {\n return window.atob(b64str);\n } else {\n throw new Error('You must supply a polyfill for window.atob in this environment');\n }\n }\n\n function _parseJson(string) {\n if (typeof JSON !== 'undefined' && JSON.parse) {\n return JSON.parse(string);\n } else {\n throw new Error('You must supply a polyfill for JSON.parse in this environment');\n }\n }\n\n function _findFunctionName(source, lineNumber/*, columnNumber*/) {\n var syntaxes = [\n // {name} = function ({args}) TODO args capture\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*function\\b/,\n // function {name}({args}) m[1]=name m[2]=args\n /function\\s+([^('\"`]*?)\\s*\\(([^)]*)\\)/,\n // {name} = eval()\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*(?:eval|new Function)\\b/,\n // fn_name() {\n /\\b(?!(?:if|for|switch|while|with|catch)\\b)(?:(?:static)\\s+)?(\\S+)\\s*\\(.*?\\)\\s*\\{/,\n // {name} = () => {\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*\\(.*?\\)\\s*=>/\n ];\n var lines = source.split('\\n');\n\n // Walk backwards in the source lines until we find the line which matches one of the patterns above\n var code = '';\n var maxLines = Math.min(lineNumber, 20);\n for (var i = 0; i < maxLines; ++i) {\n // lineNo is 1-based, source[] is 0-based\n var line = lines[lineNumber - i - 1];\n var commentPos = line.indexOf('//');\n if (commentPos >= 0) {\n line = line.substr(0, commentPos);\n }\n\n if (line) {\n code = line + code;\n var len = syntaxes.length;\n for (var index = 0; index < len; index++) {\n var m = syntaxes[index].exec(code);\n if (m && m[1]) {\n return m[1];\n }\n }\n }\n }\n return undefined;\n }\n\n function _ensureSupportedEnvironment() {\n if (typeof Object.defineProperty !== 'function' || typeof Object.create !== 'function') {\n throw new Error('Unable to consume source maps in older browsers');\n }\n }\n\n function _ensureStackFrameIsLegit(stackframe) {\n if (typeof stackframe !== 'object') {\n throw new TypeError('Given StackFrame is not an object');\n } else if (typeof stackframe.fileName !== 'string') {\n throw new TypeError('Given file name is not a String');\n } else if (typeof stackframe.lineNumber !== 'number' ||\n stackframe.lineNumber % 1 !== 0 ||\n stackframe.lineNumber < 1) {\n throw new TypeError('Given line number must be a positive integer');\n } else if (typeof stackframe.columnNumber !== 'number' ||\n stackframe.columnNumber % 1 !== 0 ||\n stackframe.columnNumber < 0) {\n throw new TypeError('Given column number must be a non-negative integer');\n }\n return true;\n }\n\n function _findSourceMappingURL(source) {\n var sourceMappingUrlRegExp = /\\/\\/[#@] ?sourceMappingURL=([^\\s'\"]+)\\s*$/mg;\n var lastSourceMappingUrl;\n var matchSourceMappingUrl;\n // eslint-disable-next-line no-cond-assign\n while (matchSourceMappingUrl = sourceMappingUrlRegExp.exec(source)) {\n lastSourceMappingUrl = matchSourceMappingUrl[1];\n }\n if (lastSourceMappingUrl) {\n return lastSourceMappingUrl;\n } else {\n throw new Error('sourceMappingURL not found');\n }\n }\n\n function _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache) {\n return new Promise(function(resolve, reject) {\n var loc = sourceMapConsumer.originalPositionFor({\n line: stackframe.lineNumber,\n column: stackframe.columnNumber\n });\n\n if (loc.source) {\n // cache mapped sources\n var mappedSource = sourceMapConsumer.sourceContentFor(loc.source);\n if (mappedSource) {\n sourceCache[loc.source] = mappedSource;\n }\n\n resolve(\n // given stackframe and source location, update stackframe\n new StackFrame({\n functionName: loc.name || stackframe.functionName,\n args: stackframe.args,\n fileName: loc.source,\n lineNumber: loc.line,\n columnNumber: loc.column\n }));\n } else {\n reject(new Error('Could not get original source for given stackframe and source map'));\n }\n });\n }\n\n /**\n * @constructor\n * @param {Object} opts\n * opts.sourceCache = {url: \"Source String\"} => preload source cache\n * opts.sourceMapConsumerCache = {/path/file.js.map: SourceMapConsumer}\n * opts.offline = True to prevent network requests.\n * Best effort without sources or source maps.\n * opts.ajax = Promise returning function to make X-Domain requests\n */\n return function StackTraceGPS(opts) {\n if (!(this instanceof StackTraceGPS)) {\n return new StackTraceGPS(opts);\n }\n opts = opts || {};\n\n this.sourceCache = opts.sourceCache || {};\n this.sourceMapConsumerCache = opts.sourceMapConsumerCache || {};\n\n this.ajax = opts.ajax || _xdr;\n\n this._atob = opts.atob || _atob;\n\n this._get = function _get(location) {\n return new Promise(function(resolve, reject) {\n var isDataUrl = location.substr(0, 5) === 'data:';\n if (this.sourceCache[location]) {\n resolve(this.sourceCache[location]);\n } else if (opts.offline && !isDataUrl) {\n reject(new Error('Cannot make network requests in offline mode'));\n } else {\n if (isDataUrl) {\n // data URLs can have parameters.\n // see http://tools.ietf.org/html/rfc2397\n var supportedEncodingRegexp =\n /^data:application\\/json;([\\w=:\"-]+;)*base64,/;\n var match = location.match(supportedEncodingRegexp);\n if (match) {\n var sourceMapStart = match[0].length;\n var encodedSource = location.substr(sourceMapStart);\n var source = this._atob(encodedSource);\n this.sourceCache[location] = source;\n resolve(source);\n } else {\n reject(new Error('The encoding of the inline sourcemap is not supported'));\n }\n } else {\n var xhrPromise = this.ajax(location, {method: 'get'});\n // Cache the Promise to prevent duplicate in-flight requests\n this.sourceCache[location] = xhrPromise;\n xhrPromise.then(resolve, reject);\n }\n }\n }.bind(this));\n };\n\n /**\n * Creating SourceMapConsumers is expensive, so this wraps the creation of a\n * SourceMapConsumer in a per-instance cache.\n *\n * @param {String} sourceMappingURL = URL to fetch source map from\n * @param {String} defaultSourceRoot = Default source root for source map if undefined\n * @returns {Promise} that resolves a SourceMapConsumer\n */\n this._getSourceMapConsumer = function _getSourceMapConsumer(sourceMappingURL, defaultSourceRoot) {\n return new Promise(function(resolve) {\n if (this.sourceMapConsumerCache[sourceMappingURL]) {\n resolve(this.sourceMapConsumerCache[sourceMappingURL]);\n } else {\n var sourceMapConsumerPromise = new Promise(function(resolve, reject) {\n return this._get(sourceMappingURL).then(function(sourceMapSource) {\n if (typeof sourceMapSource === 'string') {\n sourceMapSource = _parseJson(sourceMapSource.replace(/^\\)\\]\\}'/, ''));\n }\n if (typeof sourceMapSource.sourceRoot === 'undefined') {\n sourceMapSource.sourceRoot = defaultSourceRoot;\n }\n\n resolve(new SourceMap.SourceMapConsumer(sourceMapSource));\n }).catch(reject);\n }.bind(this));\n this.sourceMapConsumerCache[sourceMappingURL] = sourceMapConsumerPromise;\n resolve(sourceMapConsumerPromise);\n }\n }.bind(this));\n };\n\n /**\n * Given a StackFrame, enhance function name and use source maps for a\n * better StackFrame.\n *\n * @param {StackFrame} stackframe object\n * @returns {Promise} that resolves with with source-mapped StackFrame\n */\n this.pinpoint = function StackTraceGPS$$pinpoint(stackframe) {\n return new Promise(function(resolve, reject) {\n this.getMappedLocation(stackframe).then(function(mappedStackFrame) {\n function resolveMappedStackFrame() {\n resolve(mappedStackFrame);\n }\n\n this.findFunctionName(mappedStackFrame)\n .then(resolve, resolveMappedStackFrame)\n // eslint-disable-next-line no-unexpected-multiline\n ['catch'](resolveMappedStackFrame);\n }.bind(this), reject);\n }.bind(this));\n };\n\n /**\n * Given a StackFrame, guess function name from location information.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.findFunctionName = function StackTraceGPS$$findFunctionName(stackframe) {\n return new Promise(function(resolve, reject) {\n _ensureStackFrameIsLegit(stackframe);\n this._get(stackframe.fileName).then(function getSourceCallback(source) {\n var lineNumber = stackframe.lineNumber;\n var columnNumber = stackframe.columnNumber;\n var guessedFunctionName = _findFunctionName(source, lineNumber, columnNumber);\n // Only replace functionName if we found something\n if (guessedFunctionName) {\n resolve(new StackFrame({\n functionName: guessedFunctionName,\n args: stackframe.args,\n fileName: stackframe.fileName,\n lineNumber: lineNumber,\n columnNumber: columnNumber\n }));\n } else {\n resolve(stackframe);\n }\n }, reject)['catch'](reject);\n }.bind(this));\n };\n\n /**\n * Given a StackFrame, seek source-mapped location and return new enhanced StackFrame.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.getMappedLocation = function StackTraceGPS$$getMappedLocation(stackframe) {\n return new Promise(function(resolve, reject) {\n _ensureSupportedEnvironment();\n _ensureStackFrameIsLegit(stackframe);\n\n var sourceCache = this.sourceCache;\n var fileName = stackframe.fileName;\n this._get(fileName).then(function(source) {\n var sourceMappingURL = _findSourceMappingURL(source);\n var isDataUrl = sourceMappingURL.substr(0, 5) === 'data:';\n var defaultSourceRoot = fileName.substring(0, fileName.lastIndexOf('/') + 1);\n\n if (sourceMappingURL[0] !== '/' && !isDataUrl && !(/^https?:\\/\\/|^\\/\\//i).test(sourceMappingURL)) {\n sourceMappingURL = defaultSourceRoot + sourceMappingURL;\n }\n\n return this._getSourceMapConsumer(sourceMappingURL, defaultSourceRoot)\n .then(function(sourceMapConsumer) {\n return _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache)\n .then(resolve)['catch'](function() {\n resolve(stackframe);\n });\n });\n }.bind(this), reject)['catch'](reject);\n }.bind(this));\n };\n };\n}));\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stacktrace', ['error-stack-parser', 'stack-generator', 'stacktrace-gps'], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory(require('error-stack-parser'), require('stack-generator'), require('stacktrace-gps'));\n } else {\n root.StackTrace = factory(root.ErrorStackParser, root.StackGenerator, root.StackTraceGPS);\n }\n}(this, function StackTrace(ErrorStackParser, StackGenerator, StackTraceGPS) {\n var _options = {\n filter: function(stackframe) {\n // Filter out stackframes for this library by default\n return (stackframe.functionName || '').indexOf('StackTrace$$') === -1 &&\n (stackframe.functionName || '').indexOf('ErrorStackParser$$') === -1 &&\n (stackframe.functionName || '').indexOf('StackTraceGPS$$') === -1 &&\n (stackframe.functionName || '').indexOf('StackGenerator$$') === -1;\n },\n sourceCache: {}\n };\n\n var _generateError = function StackTrace$$GenerateError() {\n try {\n // Error must be thrown to get stack in IE\n throw new Error();\n } catch (err) {\n return err;\n }\n };\n\n /**\n * Merge 2 given Objects. If a conflict occurs the second object wins.\n * Does not do deep merges.\n *\n * @param {Object} first base object\n * @param {Object} second overrides\n * @returns {Object} merged first and second\n * @private\n */\n function _merge(first, second) {\n var target = {};\n\n [first, second].forEach(function(obj) {\n for (var prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n target[prop] = obj[prop];\n }\n }\n return target;\n });\n\n return target;\n }\n\n function _isShapedLikeParsableError(err) {\n return err.stack || err['opera#sourceloc'];\n }\n\n function _filtered(stackframes, filter) {\n if (typeof filter === 'function') {\n return stackframes.filter(filter);\n }\n return stackframes;\n }\n\n return {\n /**\n * Get a backtrace from invocation point.\n *\n * @param {Object} opts\n * @returns {Array} of StackFrame\n */\n get: function StackTrace$$get(opts) {\n var err = _generateError();\n return _isShapedLikeParsableError(err) ? this.fromError(err, opts) : this.generateArtificially(opts);\n },\n\n /**\n * Get a backtrace from invocation point.\n * IMPORTANT: Does not handle source maps or guess function names!\n *\n * @param {Object} opts\n * @returns {Array} of StackFrame\n */\n getSync: function StackTrace$$getSync(opts) {\n opts = _merge(_options, opts);\n var err = _generateError();\n var stack = _isShapedLikeParsableError(err) ? ErrorStackParser.parse(err) : StackGenerator.backtrace(opts);\n return _filtered(stack, opts.filter);\n },\n\n /**\n * Given an error object, parse it.\n *\n * @param {Error} error object\n * @param {Object} opts\n * @returns {Promise} for Array[StackFrame}\n */\n fromError: function StackTrace$$fromError(error, opts) {\n opts = _merge(_options, opts);\n var gps = new StackTraceGPS(opts);\n return new Promise(function(resolve) {\n var stackframes = _filtered(ErrorStackParser.parse(error), opts.filter);\n resolve(Promise.all(stackframes.map(function(sf) {\n return new Promise(function(resolve) {\n function resolveOriginal() {\n resolve(sf);\n }\n\n gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);\n });\n })));\n }.bind(this));\n },\n\n /**\n * Use StackGenerator to generate a backtrace.\n *\n * @param {Object} opts\n * @returns {Promise} of Array[StackFrame]\n */\n generateArtificially: function StackTrace$$generateArtificially(opts) {\n opts = _merge(_options, opts);\n var stackFrames = StackGenerator.backtrace(opts);\n if (typeof opts.filter === 'function') {\n stackFrames = stackFrames.filter(opts.filter);\n }\n return Promise.resolve(stackFrames);\n },\n\n /**\n * Given a function, wrap it such that invocations trigger a callback that\n * is called with a stack trace.\n *\n * @param {Function} fn to be instrumented\n * @param {Function} callback function to call with a stack trace on invocation\n * @param {Function} errback optional function to call with error if unable to get stack trace.\n * @param {Object} thisArg optional context object (e.g. window)\n */\n instrument: function StackTrace$$instrument(fn, callback, errback, thisArg) {\n if (typeof fn !== 'function') {\n throw new Error('Cannot instrument non-function object');\n } else if (typeof fn.__stacktraceOriginalFn === 'function') {\n // Already instrumented, return given Function\n return fn;\n }\n\n var instrumented = function StackTrace$$instrumented() {\n try {\n this.get().then(callback, errback)['catch'](errback);\n return fn.apply(thisArg || this, arguments);\n } catch (e) {\n if (_isShapedLikeParsableError(e)) {\n this.fromError(e).then(callback, errback)['catch'](errback);\n }\n throw e;\n }\n }.bind(this);\n instrumented.__stacktraceOriginalFn = fn;\n\n return instrumented;\n },\n\n /**\n * Given a function that has been instrumented,\n * revert the function to it's original (non-instrumented) state.\n *\n * @param {Function} fn to de-instrument\n */\n deinstrument: function StackTrace$$deinstrument(fn) {\n if (typeof fn !== 'function') {\n throw new Error('Cannot de-instrument non-function object');\n } else if (typeof fn.__stacktraceOriginalFn === 'function') {\n return fn.__stacktraceOriginalFn;\n } else {\n // Function not instrumented, return original\n return fn;\n }\n },\n\n /**\n * Given an error message and Array of StackFrames, serialize and POST to given URL.\n *\n * @param {Array} stackframes\n * @param {String} url\n * @param {String} errorMsg\n * @param {Object} requestOptions\n */\n report: function StackTrace$$report(stackframes, url, errorMsg, requestOptions) {\n return new Promise(function(resolve, reject) {\n var req = new XMLHttpRequest();\n req.onerror = reject;\n req.onreadystatechange = function onreadystatechange() {\n if (req.readyState === 4) {\n if (req.status >= 200 && req.status < 400) {\n resolve(req.responseText);\n } else {\n reject(new Error('POST to ' + url + ' failed with status: ' + req.status));\n }\n }\n };\n req.open('post', url);\n\n // Set request headers\n req.setRequestHeader('Content-Type', 'application/json');\n if (requestOptions && typeof requestOptions.headers === 'object') {\n var headers = requestOptions.headers;\n for (var header in headers) {\n if (Object.prototype.hasOwnProperty.call(headers, header)) {\n req.setRequestHeader(header, headers[header]);\n }\n }\n }\n\n var reportPayload = {stack: stackframes};\n if (errorMsg !== undefined && errorMsg !== null) {\n reportPayload.message = errorMsg;\n }\n\n req.send(JSON.stringify(reportPayload));\n });\n }\n };\n}));\n","import { StackFrame, fromError } from 'stacktrace-js';\r\nimport { renderMessageTemplateParameter } from './renderMessageTemplateParameter';\r\n\r\nconst formatStackFrame = (frame: StackFrame): string => {\r\n const functionName =\r\n frame.getFunctionName()?.trim() || (frame.getIsEval() ? '[eval]' : '');\r\n const fileName =\r\n frame.getFileName()?.trim() || (frame.getIsNative() ? '[native]' : '');\r\n const lineNumber = frame.getLineNumber() || 0;\r\n const columnNumber = frame.getColumnNumber() || 0;\r\n\r\n return `at ${functionName || '?'}${\r\n fileName\r\n ? ` (${fileName}${\r\n lineNumber ? `:${lineNumber}:${columnNumber}` : ''\r\n })`\r\n : ''\r\n }`;\r\n};\r\n\r\n// Shoud we handle loader and checkout differently? Do we want to include this in loader script at all? (pass in a function callback to createLog instead)\r\nexport const resolveErrorStack = async (\r\n exception: Error\r\n): Promise => {\r\n try {\r\n const stackFrames = await fromError(exception);\r\n const resolvedStack = stackFrames\r\n .map(frame => formatStackFrame(frame))\r\n .join('\\n');\r\n return (\r\n resolvedStack +\r\n (exception.stack !== resolvedStack\r\n ? `\\nOriginal stack:\\n${renderMessageTemplateParameter(\r\n exception.stack,\r\n false\r\n )}`\r\n : '')\r\n );\r\n } catch (_error) {\r\n // do nothing\r\n }\r\n\r\n return exception.stack || undefined; // Ensure undefined and not null or empty string;\r\n};\r\n","import { LogLevel } from './LogLevel';\r\nimport { logLevels } from './logLevels';\r\n\r\nexport const isLogLevel = (value: unknown): value is LogLevel =>\r\n logLevels.some(logLevel => logLevel === value);\r\n","import { LogLevel } from './LogLevel';\r\nimport { isLogLevel } from './isLogLevel';\r\n\r\nexport const toLogLevel = (value: unknown): LogLevel | undefined =>\r\n isLogLevel(value) ? value : undefined;\r\n","export enum MerchantEventType {\r\n CustomerUpdated = 'CustomerUpdated',\r\n Locked = 'Locked',\r\n Unlocked = 'Unlocked',\r\n Resumed = 'Resumed',\r\n ShippingUpdated = 'ShippingUpdated',\r\n PurchaseCompleted = 'PurchaseCompleted',\r\n PaymentAborted = 'PaymentAborted',\r\n CrmUpdated = 'CrmUpdated',\r\n OrderValidationFailed = 'OrderValidationFailed',\r\n Metric = 'Metric',\r\n}\r\n","export enum MessageType {\r\n Relay = 'relay',\r\n Broadcast = 'broadcast',\r\n MerchantEvent = 'merchant-event',\r\n HeightSet = 'height-set',\r\n Redirect = 'redirect',\r\n RedirectFail = 'redirect-fail',\r\n Update = 'update',\r\n LanguagePref = 'language-pref',\r\n TrustlyCancel = 'trustly-cancel',\r\n TrustlyLoadTimeout = 'trustly-load-timeout',\r\n TrustlySetAccount = 'trustly-set-account',\r\n PaymentIqLoadTimeout = 'paymentiq-load-timeout',\r\n PaymentIqCancel = 'paymentiq-cancel',\r\n SubmitCommitmentId = 'submit-commitment-id',\r\n CancelCommitmentIdInput = 'cancel-commitment-id-input',\r\n SwedishBankIdCancel = 'swedish-bank-id-cancel',\r\n PaymentIqCardValidateForm = 'paymentiq-card-validate-form',\r\n PaymentIqCardFormValidationError = 'paymentiq-card-validation-error',\r\n PaymentIqCardFormValidated = 'paymentiq-card-validated',\r\n PaymentIqCardFormLoaded = 'paymentiq-card-form-loaded',\r\n PaymentIqCardValuesChanged = 'paymentiq-card-values-changed',\r\n PaymentIqCardResult = 'paymentiq-card-verification-result',\r\n PaymentIqCardCancel = 'paymentiq-card-verification-cancel',\r\n PaymentStatus = 'payment-status',\r\n PaymentMethodSelected = 'payment-method-selected',\r\n PaymentOptionSelected = 'payment-option-selected',\r\n ShowModal = 'modal',\r\n HideModal = 'hide-modal',\r\n ModalLoaded = 'modal-loaded',\r\n ModalShown = 'modal-shown',\r\n AbortHideModal = 'abort-hide-modal',\r\n ModalLoadError = 'modal-load-error',\r\n HideModalInState = 'hide-modal-in-state',\r\n StoreParameter = 'StoreParameter',\r\n Locked = 'locked',\r\n Unlocked = 'unlocked',\r\n Resumed = 'resumed',\r\n CrmUpdated = 'crm-updated',\r\n CustomerUpdated = 'customer-updated',\r\n ShippingUpdated = 'shipping-updated',\r\n MerchantValidationFailed = 'merchant-validation-failed',\r\n PurchaseCompleted = 'purchase-completed',\r\n PaymentAborted = 'payment-aborted',\r\n DeliverySet = 'delivery-set',\r\n DeliveryCancel = 'delivery-cancel',\r\n DeliveryError = 'delivery-error',\r\n DeliveryChoices = 'delivery-choices',\r\n DeliveryModalLoaded = 'delivery-choices-modal-loaded',\r\n KalpSet = 'kalp-set',\r\n KalpApproved = 'kalp-approved',\r\n KalpCancel = 'kalp-cancel',\r\n KalpError = 'kalp-error',\r\n WidgetLoaded = 'widget-loaded',\r\n SwishCancel = 'swish-cancel',\r\n Suspend = 'suspend',\r\n Resume = 'resume',\r\n BeginPayment = 'begin-payment',\r\n PrivateAddressSubmit = 'b2c-address-submit',\r\n PrivateAddressCancel = 'b2c-address-cancel',\r\n PrivateAddressError = 'b2c-address-error',\r\n BusinessInvoiceEmailSubmit = 'b2b-invoice-email-submit',\r\n BusinessInvoiceEmailCancel = 'b2b-invoice-email-cancel',\r\n BusinessInvoiceEmailError = 'b2b-invoice-email-error',\r\n BusinessDeliveryAddressSubmit = 'b2b-delivery-address-submit',\r\n BusinessDeliveryAddressCancel = 'b2b-delivery-address-cancel',\r\n BusinessDeliveryAddressError = 'b2b-delivery-address-error',\r\n BusinessInvoiceAddressSubmit = 'b2b-invoice-address-submit',\r\n BusinessInvoiceAddressCancel = 'b2b-invoice-address-cancel',\r\n BusinessInvoiceAddressError = 'b2b-invoice-address-error',\r\n BusinessEditBuyerModalSubmit = 'b2b-edit-buyer-modal-submit',\r\n BusinessEditBuyerModalError = 'b2b-edit-buyer-modal-error',\r\n OnBeforePayment = 'on-before-payment-request',\r\n OnBeforePaymentError = 'on-before-payment-error',\r\n OnBeforePaymentSuccess = 'on-before-payment-success',\r\n GetExistingEngagementFromEmailAndPhone = 'get-existing-engagement-from-email-and-phone',\r\n UpdateIdentificationData = 'update-identification-data',\r\n FindEngagementByRegistrationNumber = 'find-engagement-by-registration-number',\r\n SaveAddress = 'save-address',\r\n RememberCustomer = 'remember-customer',\r\n ResetCustomerIdentificationState = 'reset-customer-identification-state',\r\n SwapCustomerComplement = 'swap-customer-complement',\r\n SimplifiedTermsClose = 'simplified-terms-close',\r\n IdpCancel = 'idp-cancel',\r\n IdpRedirect = 'idp-redirect',\r\n SelectInstallmentPaymentMethodOption = 'SelectInstallmentPaymentMethodOption',\r\n Ready = 'ready',\r\n NoticeClose = 'notice-close',\r\n ApplyTestData = 'apply-test-data',\r\n AgreementCancel = 'agreement-cancel',\r\n Metric = 'metric',\r\n}\r\n","import { isString } from '@walley/language';\r\nimport { toCountry } from '../locale';\r\nimport { PublicToken } from './PublicToken';\r\nimport { Token } from './Token';\r\nimport { WidgetToken } from './WidgetToken';\r\n\r\nconst tokenPattern = /\\b(public|widget)-([A-Z]{2})-(\\w+)/;\r\n\r\nexport const parseToken = (token: Token | string | undefined) => {\r\n if (!isString(token)) {\r\n return {};\r\n }\r\n\r\n const [result, type, countryCode, ref] = token.match(tokenPattern) ?? [];\r\n\r\n return result\r\n ? {\r\n token: result as Token,\r\n publicToken:\r\n type === 'public' ? (result as PublicToken) : undefined,\r\n widgetToken:\r\n type === 'widget' ? (result as WidgetToken) : undefined,\r\n type,\r\n country: toCountry(countryCode),\r\n ref,\r\n }\r\n : {};\r\n};\r\n","import { Token } from './Token';\r\nimport { parseToken } from './parseToken';\r\n\r\nexport const isBitSetInToken = (\r\n token: Token,\r\n position: number,\r\n bitmask: number,\r\n defaultValue?: boolean\r\n) => {\r\n const { ref } = parseToken(token);\r\n\r\n if (!ref || ref.length <= position) {\r\n return defaultValue;\r\n }\r\n\r\n return (parseInt(ref.charAt(position), 16) & bitmask) === bitmask;\r\n};\r\n","import { parseToken } from './parseToken';\r\n\r\nexport const toToken = (value: unknown) => parseToken(value as string).token;\r\n","export class HttpError extends Error {\r\n constructor(\r\n message: string,\r\n public httpMethod: string,\r\n public requestUri: string,\r\n public statusCode: number,\r\n public logged?: boolean,\r\n public connectionError?: Error\r\n ) {\r\n super(message);\r\n this.name = 'HttpError';\r\n // Set the prototype explicitly.\r\n Object.setPrototypeOf(this, HttpError.prototype);\r\n }\r\n}\r\n","import { Fetch } from './Fetch';\r\nimport { HttpError } from './HttpError';\r\nimport { HttpOptions } from './HttpOptions';\r\n\r\nconst defaultTimeout = 30_000;\r\nconst defaultFetch: Fetch =\r\n 'fetch' in window ? window.fetch : () => Promise.reject();\r\n\r\ndeclare global {\r\n interface RequestInit {\r\n timeout?: number;\r\n }\r\n}\r\n\r\nexport const http = async (\r\n {\r\n timeout: optionTimeout,\r\n uri,\r\n method,\r\n body,\r\n headers,\r\n keepalive,\r\n }: HttpOptions,\r\n fetch: Fetch = defaultFetch\r\n) => {\r\n const controller = new AbortController();\r\n\r\n const timeout = optionTimeout ?? defaultTimeout;\r\n\r\n const id = setTimeout(() => {\r\n controller.abort(\r\n new HttpError(\r\n `Request timed out after ${timeout} ms`,\r\n method,\r\n uri,\r\n 0\r\n )\r\n );\r\n }, timeout);\r\n\r\n const result = await fetch(uri, {\r\n method,\r\n body,\r\n headers,\r\n keepalive,\r\n signal: controller.signal,\r\n timeout,\r\n });\r\n\r\n clearTimeout(id);\r\n\r\n return result;\r\n};\r\n","import { isDefined, jsonStringify } from '@walley/language';\r\nimport { Fetch } from './Fetch';\r\nimport { HttpPostOptions } from './HttpPostOptions';\r\nimport { http } from './http';\r\n\r\nexport const httpPost = <\r\n T extends Record = Record,\r\n>(\r\n options: HttpPostOptions,\r\n fetch?: Fetch\r\n) => {\r\n const defaultHeaders: HeadersInit = {};\r\n\r\n if (isDefined(options.body)) {\r\n defaultHeaders['Content-Type'] = 'application/json';\r\n }\r\n\r\n return http(\r\n {\r\n ...options,\r\n headers: {\r\n ...defaultHeaders,\r\n ...options.headers,\r\n },\r\n method: 'POST',\r\n body: jsonStringify(options.body) ?? '{}',\r\n },\r\n fetch\r\n );\r\n};\r\n","import { concatUri, withoutEmptyValues } from '@walley/language';\r\nimport { ApiDeletePayload } from './ApiDeletePayload';\r\nimport { ApiGetPayload } from './ApiGetPayload';\r\nimport { ApiPostPayload } from './ApiPostPayload';\r\n\r\ntype Payload =\r\n | ApiGetPayload\r\n | ApiPostPayload>\r\n | ApiDeletePayload;\r\n\r\nexport const getApiRequestOptions = ({\r\n overrides,\r\n apiHost,\r\n path,\r\n timeout,\r\n publicToken,\r\n paymentToken,\r\n isPayLink,\r\n isWebView,\r\n keepalive,\r\n}: Payload) => ({\r\n uri: concatUri(overrides?.apiHost ?? apiHost, path),\r\n headers: withoutEmptyValues({\r\n Authorization: publicToken,\r\n paymenttoken: paymentToken,\r\n PayLink: isPayLink?.toString(),\r\n WebView: isWebView?.toString(),\r\n }) as HeadersInit,\r\n timeout: overrides?.timeout ?? timeout,\r\n keepalive,\r\n});\r\n","import { httpPost } from '../http';\r\nimport { ApiPostPayload } from './ApiPostPayload';\r\nimport { getApiRequestOptions } from './getApiRequestOptions';\r\n\r\nexport const apiPostRaw = async >(\r\n payload: Omit, 'setCheckoutState'>\r\n) =>\r\n httpPost({\r\n ...getApiRequestOptions(payload),\r\n body: payload.body,\r\n });\r\n","import { DeepPartial, isPlainObject } from '@walley/language';\r\n\r\nexport const setElementAttributes = (\r\n element: T,\r\n attributes: DeepPartial\r\n) => {\r\n Object.entries(attributes)\r\n .filter(([_, value]) => value !== undefined)\r\n .forEach(([key, value]) => {\r\n if (isPlainObject(value)) {\r\n Object.assign(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n element[key as keyof T] as any,\r\n value\r\n );\r\n } else {\r\n Object.assign(element, { [key]: value });\r\n }\r\n });\r\n};\r\n","import { DeepPartial } from '@walley/language';\r\nimport { setElementAttributes } from './setElementAttributes';\r\n\r\nexport const createElement = (\r\n type: K,\r\n attributes?: DeepPartial\r\n): HTMLElementTagNameMap[K] => {\r\n const element = document.createElement(type);\r\n\r\n if (attributes) {\r\n setElementAttributes(element, attributes);\r\n }\r\n\r\n return element;\r\n};\r\n","import { DeepPartial } from '@walley/language';\r\nimport { createElement } from './createElement';\r\n\r\nexport const createDivElement = (attributes?: DeepPartial) =>\r\n createElement('div', attributes);\r\n","import { DeepPartial } from '@walley/language';\r\nimport { createElement } from './createElement';\r\n\r\nexport const createIframeElement = (\r\n attributes?: DeepPartial\r\n) => createElement('iframe', attributes);\r\n","export const dispatchEvent = (type: string, detail?: T) =>\r\n document.dispatchEvent(\r\n new CustomEvent(type, {\r\n detail,\r\n })\r\n );\r\n","import { isNonEmpty } from '@walley/language';\r\n\r\nexport const getAttribute = (element: HTMLElement, ...names: string[]) =>\r\n element\r\n ? names?.reduce(\r\n (value, name) =>\r\n isNonEmpty(value)\r\n ? value.toString()\r\n : element.getAttribute(name) || undefined,\r\n undefined\r\n )\r\n : undefined;\r\n","export const getDocumentLanguage = () => document.documentElement.lang;\r\n","export const getElementById = (id: string) => {\r\n const element = document.getElementById(id);\r\n\r\n return element ? (element as T) : undefined;\r\n};\r\n","import { arrayFrom } from '@walley/language';\r\n\r\nexport const getElementsByTagName = (\r\n qualifiedName: K\r\n) =>\r\n arrayFrom(\r\n document.getElementsByTagName(qualifiedName)\r\n );\r\n","import { Uri } from '@walley/language';\r\n\r\nexport const getLocationUri = () => window.location.toString() as Uri;\r\n","export const insertElement = (element: HTMLElement, container: Element) =>\r\n container.appendChild(element);\r\n","export const postMessage = (\r\n message: T,\r\n targetOrigin: string,\r\n targetWindow: Window\r\n) => targetWindow.postMessage(message, targetOrigin);\r\n","import { isString } from '@walley/language';\r\n\r\nexport const querySelector = (\r\n selector: string | undefined\r\n) =>\r\n isString(selector)\r\n ? document.querySelector(selector) || undefined\r\n : undefined;\r\n","import { arrayFrom, isString } from '@walley/language';\r\n\r\nexport const querySelectorAll = (\r\n selector: string | undefined\r\n) =>\r\n isString(selector)\r\n ? arrayFrom(document.querySelectorAll(selector)) || []\r\n : [];\r\n","import { Uri } from '@walley/language';\r\n\r\nexport const redirect = (uri: Uri) =>\r\n (window.top ?? window).location.replace(uri);\r\n","export const removeElementAttribute = (\r\n element: T,\r\n name: string\r\n): unknown => element.removeAttribute(name);\r\n","export const setElementAttribute = (\r\n element: T,\r\n name: string,\r\n value: string\r\n) => element.setAttribute(name, value);\r\n","import { setElementAttribute } from './setElementAttribute';\r\n\r\nexport const setElementHeight = (\r\n element: T,\r\n height: number\r\n) => setElementAttribute(element, 'height', height.toString());\r\n","export const IFRAME_ID_PREFIX = 'collector-checkout-iframe';\r\n\r\nexport const VARIANT_B2C = 'b2c';\r\nexport const VARIANT_B2B = 'b2b';\r\nexport const VARIANT_WIDGET = 'widget';\r\n\r\nexport const PADDING = 20;\r\nexport const IFRAME_DEFAULT_HEIGHT = 240;\r\n\r\nexport const SPINNER_SUFFIX = 'spinner';\r\nexport const ANIMATION_DELAY = 400;\r\n\r\nexport const EVENT_PREFIXES = ['collectorCheckout', 'walleyCheckout'];\r\n\r\nexport const WALLEY_STORAGE_KEY = 'walley';\r\n","import { IntegrationName, Token, createIntegrationId } from '@walley/domain';\r\nimport {\r\n DeepPartial,\r\n Uri,\r\n appendUriQuery,\r\n callOptionalFunction,\r\n} from '@walley/language';\r\nimport { createIframeElement } from '../dom';\r\nimport { IFRAME_ID_PREFIX } from './constants';\r\n\r\nexport const createIntegrationIframe = (\r\n token: Token | undefined,\r\n title: string,\r\n attributes: DeepPartial,\r\n name: IntegrationName,\r\n src: Uri\r\n): HTMLIFrameElement => {\r\n const integrationId = createIntegrationId(name);\r\n const iframe = createIframeElement({\r\n title,\r\n className: IFRAME_ID_PREFIX,\r\n width: '100%',\r\n height: '0',\r\n style: {\r\n border: 'none',\r\n background: 'transparent',\r\n width: '1em',\r\n minWidth: '100%',\r\n overflow: 'auto hidden',\r\n display: 'block',\r\n },\r\n src: appendUriQuery(src, { integrationId }),\r\n // Obsolete but seemingly necessary scrolling and frameBorder below...\r\n scrolling: 'no',\r\n frameBorder: '0',\r\n ...attributes,\r\n dataset: {\r\n ...attributes?.dataset,\r\n walley: 'true',\r\n token,\r\n id: integrationId,\r\n name,\r\n },\r\n onload: (event: Event) => {\r\n callOptionalFunction(\r\n attributes?.onload as (event: Event) => void,\r\n event\r\n );\r\n },\r\n });\r\n\r\n return iframe;\r\n};\r\n","import { IntegrationNameSpinner, createIntegrationId } from '@walley/domain';\r\nimport { createDivElement } from '../dom';\r\nimport { ANIMATION_DELAY } from './constants';\r\n\r\nexport const createIntegrationSpinner = (target: HTMLElement) => {\r\n const height = 'height' in target ? target.height : target.clientHeight;\r\n const spinner = createDivElement({\r\n dataset: {\r\n walley: 'true',\r\n token: target.dataset.token,\r\n id: createIntegrationId(IntegrationNameSpinner),\r\n name: IntegrationNameSpinner,\r\n },\r\n style: {\r\n position: 'relative',\r\n },\r\n });\r\n const inner = createDivElement({\r\n style: {\r\n pointerEvents: 'none',\r\n position: 'absolute',\r\n width: '100%',\r\n zIndex: '-1',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n opacity: '.5',\r\n minHeight: `${height}px`,\r\n gap: '.5rem',\r\n },\r\n });\r\n\r\n const createDot = () =>\r\n createDivElement({\r\n style: {\r\n background: 'black',\r\n borderRadius: '100%',\r\n height: '1rem',\r\n width: '1rem',\r\n opacity: '.5',\r\n transition: '.2s',\r\n },\r\n });\r\n\r\n const dots = [0, 1, 2].map(() => {\r\n const dot = createDot();\r\n inner.append(dot);\r\n return dot;\r\n });\r\n\r\n spinner.appendChild(inner);\r\n\r\n let index = -1;\r\n\r\n const animateLoader = (delay: number) => {\r\n if (spinner.isConnected) {\r\n const currentDot = dots[index];\r\n if (currentDot) {\r\n currentDot.style.opacity = '.5';\r\n }\r\n index = (index + 1) % dots.length;\r\n dots[index].style.opacity = '1';\r\n }\r\n\r\n if (spinner.isConnected || index === -1) {\r\n setTimeout(animateLoader, delay || ANIMATION_DELAY);\r\n }\r\n };\r\n\r\n animateLoader(ANIMATION_DELAY / 2);\r\n\r\n return spinner;\r\n};\r\n","import {\r\n DeepPartial,\r\n Uri,\r\n concatUri,\r\n ensureUriEndingSlash,\r\n} from '@walley/language';\r\nimport { IntegrationOverrides } from './IntegrationOverrides';\r\n\r\nexport const getClientUri = (\r\n clientHost: Uri,\r\n path: string,\r\n overrides: DeepPartial | undefined\r\n): Uri =>\r\n ensureUriEndingSlash(\r\n (overrides?.clientUris ? overrides.clientUris[path] : undefined) ||\r\n `${concatUri(clientHost, path)}`\r\n );\r\n","import { IntegrationId, IntegrationName, Token } from '@walley/domain';\r\n\r\nexport type IntegrationSelectorFilter = {\r\n integrationId?: IntegrationId;\r\n token?: Token;\r\n integrationName?: IntegrationName;\r\n};\r\n\r\nexport const getIntegrationSelector = (\r\n name: K,\r\n { integrationId, integrationName, token }: IntegrationSelectorFilter\r\n): string =>\r\n [\r\n `${name}[data-walley=true]`,\r\n integrationId && `[data-id=${integrationId}]`,\r\n token && `[data-token=${token}]`,\r\n integrationName && `[data-name=${integrationName}]`,\r\n ]\r\n .filter(Boolean)\r\n .join('');\r\n","import {\r\n IntegrationSelectorFilter,\r\n getIntegrationSelector,\r\n} from './getIntegrationSelector';\r\n\r\nexport const getIntegrationIframeSelector = (\r\n filter: IntegrationSelectorFilter\r\n): string => getIntegrationSelector('iframe', filter);\r\n","import { querySelector } from '../dom';\r\nimport { getIntegrationIframeSelector } from './getIntegrationIframeSelector';\r\nimport { IntegrationSelectorFilter } from './getIntegrationSelector';\r\n\r\nexport const getIntegrationIframe = (filter: IntegrationSelectorFilter) =>\r\n querySelector(getIntegrationIframeSelector(filter));\r\n","const missingFor = (target: object) => (key: string) => !(key in target);\r\n\r\nconst withTarget = (targetName: string) => (key: string) =>\r\n `${targetName}.${key}`;\r\n\r\nexport const getUnsupportedFeatures = () =>\r\n new Array()\r\n .concat(\r\n [\r\n 'JSON',\r\n 'postMessage',\r\n 'addEventListener',\r\n 'Intl',\r\n 'fetch',\r\n 'Promise',\r\n 'AbortController',\r\n 'history',\r\n 'location',\r\n 'console',\r\n 'URL',\r\n 'MutationObserver',\r\n ].filter(missingFor(window))\r\n )\r\n .concat(\r\n [\r\n 'querySelector',\r\n 'querySelectorAll',\r\n 'activeElement',\r\n 'head',\r\n 'body',\r\n ]\r\n .filter(missingFor(document))\r\n .map(withTarget('document'))\r\n )\r\n .concat(\r\n ['origin', 'search', 'href', 'hostname']\r\n .filter(missingFor(window.location))\r\n .map(withTarget('location'))\r\n )\r\n .concat(\r\n ['replaceState']\r\n .filter(missingFor(window.history))\r\n .map(withTarget('history'))\r\n )\r\n .concat(\r\n ['createObjectURL'] // For swish qr\r\n .filter(missingFor(window.URL))\r\n .map(withTarget('URL'))\r\n )\r\n .concat(['isArray'].filter(missingFor(Array)).map(withTarget('Array')))\r\n .concat(\r\n ['includes']\r\n .filter(missingFor(Array.prototype))\r\n .map(withTarget('Array'))\r\n )\r\n .concat(\r\n ['trim', 'includes']\r\n .filter(missingFor(String.prototype))\r\n .map(withTarget('String'))\r\n )\r\n .concat(window.navigator.userAgent !== 'UNSUPPORTED' ? [] : ['TEST']);\r\n","import { getUnsupportedFeatures } from './getUnsupportedFeatures';\r\n\r\nexport const isBrowserSupported = () => getUnsupportedFeatures().length === 0;\r\n","import { Message, SendMessagePayload } from '@walley/domain';\r\nimport { postMessage } from '../dom';\r\n\r\nexport const sendMessage = ({\r\n type,\r\n token,\r\n value,\r\n sourceId,\r\n targetId,\r\n targetOrigin,\r\n targetWindow,\r\n}: SendMessagePayload) =>\r\n postMessage(\r\n {\r\n type,\r\n sourceId,\r\n targetId,\r\n token,\r\n value,\r\n },\r\n targetOrigin,\r\n targetWindow\r\n );\r\n","import { querySelectorAll } from '../dom';\r\nimport { getIntegrationIframeSelector } from './getIntegrationIframeSelector';\r\nimport { IntegrationSelectorFilter } from './getIntegrationSelector';\r\n\r\nexport const getIntegrationIframes = (filter: IntegrationSelectorFilter) =>\r\n querySelectorAll(getIntegrationIframeSelector(filter));\r\n","/* eslint-disable no-underscore-dangle */\r\nimport { IntegrationId, Message, toToken } from '@walley/domain';\r\nimport { getUriOrigin, toErrorLike } from '@walley/language';\r\nimport { sendMessage } from '../../message/sendMessage';\r\nimport { getIntegrationIframes } from '../getIntegrationIframes';\r\nimport { HandleMessageContext } from './HandleMessageContext';\r\n\r\nconst moduleName = 'sendMessageToIntegrationIframe';\r\n\r\nexport type SendMessageToIntegrationIframeContext = Pick<\r\n HandleMessageContext,\r\n 'log' | 'walley'\r\n>;\r\n\r\nexport const sendMessageToIntegrationIframes = (\r\n message: Omit & { sourceId?: IntegrationId },\r\n context: SendMessageToIntegrationIframeContext\r\n) => {\r\n const { token, type, value, sourceId: messageSourceId, targetId } = message;\r\n const { log, walley } = context;\r\n\r\n getIntegrationIframes({ token }).forEach(iframe => {\r\n const iframeToken = toToken(iframe.dataset.token);\r\n\r\n if (\r\n (token && iframeToken !== token) ||\r\n !iframe.src ||\r\n iframe.src === 'about:blank' ||\r\n !iframe.contentWindow ||\r\n iframe.dataset.id === messageSourceId\r\n ) {\r\n return;\r\n }\r\n\r\n const targetWindow = iframe.contentWindow;\r\n const sourceId = messageSourceId || walley.checkout._state.id;\r\n const integrationId = iframe.dataset.id as IntegrationId | undefined;\r\n\r\n if (iframe.dataset.ready) {\r\n try {\r\n log.debug({\r\n messageTemplate:\r\n 'Sending message {MessageType} with value {Message} to iframe {Name}',\r\n messageTemplateParameters: [type, value, integrationId],\r\n moduleName,\r\n properties: {\r\n publicToken: iframeToken,\r\n },\r\n allowDuplicates: true,\r\n });\r\n\r\n sendMessage({\r\n type,\r\n token: iframeToken,\r\n sourceId,\r\n targetId,\r\n value,\r\n targetOrigin: getUriOrigin(iframe.src) ?? '*',\r\n targetWindow,\r\n });\r\n } catch (exception) {\r\n log.warn({\r\n messageTemplate:\r\n 'Failed to send message {MessageType} to iframe: {ExceptionMessage}',\r\n messageTemplateParameters: [\r\n type,\r\n toErrorLike(exception)?.message,\r\n ],\r\n properties: {\r\n publicToken: iframeToken,\r\n },\r\n moduleName,\r\n });\r\n }\r\n } else if (integrationId) {\r\n log.debug({\r\n messageTemplate:\r\n 'Queue message {MessageType} with value {Message} to iframe {Name}',\r\n messageTemplateParameters: [type, value, integrationId],\r\n moduleName,\r\n properties: {\r\n publicToken: iframeToken,\r\n },\r\n allowDuplicates: true,\r\n });\r\n\r\n // eslint-disable-next-line no-multi-assign\r\n const queuedMessages = (walley.checkout._state.queuedMessages =\r\n walley.checkout._state.queuedMessages ?? {});\r\n\r\n if (!(integrationId in queuedMessages)) {\r\n queuedMessages[integrationId] = [];\r\n }\r\n\r\n queuedMessages[integrationId].push({\r\n ...message,\r\n targetId: integrationId,\r\n sourceId,\r\n });\r\n }\r\n });\r\n};\r\n","import { MessageType, Token } from '@walley/domain';\r\nimport {\r\n SendMessageToIntegrationIframeContext,\r\n sendMessageToIntegrationIframes,\r\n} from './sendMessageToIntegrationIframes';\r\n\r\nexport const sendResume = (\r\n token: Token | undefined,\r\n context: SendMessageToIntegrationIframeContext\r\n) =>\r\n sendMessageToIntegrationIframes(\r\n { token, type: MessageType.Resume },\r\n context\r\n );\r\n","import { MessageType, Token } from '@walley/domain';\r\nimport {\r\n SendMessageToIntegrationIframeContext,\r\n sendMessageToIntegrationIframes,\r\n} from './sendMessageToIntegrationIframes';\r\n\r\nexport const sendSuspend = (\r\n token: Token | undefined,\r\n context: SendMessageToIntegrationIframeContext\r\n) =>\r\n sendMessageToIntegrationIframes(\r\n {\r\n token,\r\n type: MessageType.Suspend,\r\n },\r\n context\r\n );\r\n","/* eslint-disable no-underscore-dangle */\r\nimport { Log, LogLevel, LogProperties, WalleyGlobal } from '@walley/domain';\r\nimport { callOptionalFunction, truncateString } from '@walley/language';\r\n\r\ntype Context = {\r\n walley: WalleyGlobal;\r\n log: Log;\r\n isInternalScript: (src: string) => boolean;\r\n logPropertiesEnricher: () => LogProperties;\r\n};\r\nexport const registerIntegrationErrorHandler = ({\r\n walley,\r\n log,\r\n isInternalScript,\r\n logPropertiesEnricher,\r\n}: Context) => {\r\n callOptionalFunction(walley.checkout._state.unregisterErrorHandler);\r\n\r\n const onWindowError = (event: ErrorEvent) => {\r\n if (!event) {\r\n return;\r\n }\r\n\r\n const requestUri = event.filename;\r\n\r\n const exception = event.error || {\r\n name: 'EventError',\r\n message: event.message,\r\n stack: requestUri\r\n ? `${requestUri}:${event.lineno}:${event.colno}`\r\n : undefined,\r\n };\r\n\r\n const internalError = isInternalScript(requestUri);\r\n const logLevel = internalError ? LogLevel.Error : LogLevel.Information;\r\n\r\n log.log(logLevel, {\r\n messageTemplate: internalError\r\n ? '{ExceptionMessage}'\r\n : \"An error on merchant's site occurred: {ExceptionMessage}\",\r\n messageTemplateParameters: [\r\n truncateString(\r\n exception.message || 'Unknown error occurred',\r\n 1000\r\n ),\r\n ],\r\n properties: {\r\n requestUri,\r\n ...logPropertiesEnricher(),\r\n },\r\n exception,\r\n moduleName: 'registerIntegrationErrorHandler',\r\n functionName: 'onWindowError',\r\n });\r\n };\r\n\r\n window.addEventListener('error', onWindowError);\r\n\r\n walley.checkout._state.unregisterErrorHandler = () => {\r\n window.removeEventListener('error', onWindowError);\r\n walley.checkout._state.unregisterErrorHandler = undefined;\r\n };\r\n};\r\n","import {\r\n Message,\r\n MessageType,\r\n MessageValue,\r\n toIntegrationId,\r\n toToken,\r\n} from '@walley/domain';\r\nimport { isObject, isString } from '@walley/language';\r\n\r\nexport const parseMessage = (message: unknown): Message | undefined => {\r\n if (!isObject(message)) {\r\n return undefined;\r\n }\r\n\r\n const { type, value } = message;\r\n const sourceId = toIntegrationId(message.sourceId);\r\n const targetId = toIntegrationId(message.targetId);\r\n const token = toToken(message.token);\r\n\r\n if (!isString(type) || !sourceId) {\r\n return undefined;\r\n }\r\n\r\n return {\r\n type: type as MessageType, // To be able to log invaid types we cannot take toEnum\r\n value: value as MessageValue,\r\n token: toToken(token),\r\n sourceId,\r\n targetId,\r\n };\r\n};\r\n","import { Uri, isUri } from '@walley/language';\r\n\r\nexport const isValidOrigin = (origin: string, clientHost: Uri) =>\r\n isUri(origin) &&\r\n (origin === clientHost || origin.startsWith('http://localhost:'));\r\n","import { Message } from '@walley/domain';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\nimport { sendMessageToIntegrationIframes } from './sendMessageToIntegrationIframes';\r\n\r\nexport const handleBroadcastMessage: HandleMessageFunction = (\r\n message,\r\n context\r\n) =>\r\n sendMessageToIntegrationIframes(\r\n {\r\n ...(message.value as Message),\r\n token: undefined,\r\n sourceId: message.sourceId,\r\n },\r\n context\r\n );\r\n","import { IntegrationNameSpinner, Token } from '@walley/domain';\r\nimport { querySelector } from '../dom';\r\nimport { getIntegrationSelector } from './getIntegrationSelector';\r\n\r\nexport const removeIntegrationSpinner = (token?: Token) =>\r\n (token\r\n ? querySelector(\r\n getIntegrationSelector('div', {\r\n token,\r\n integrationName: IntegrationNameSpinner,\r\n })\r\n )\r\n : undefined\r\n )?.remove();\r\n","import { toNumber } from '@walley/language';\r\nimport { setElementHeight } from '../../dom';\r\nimport { removeIntegrationSpinner } from '../removeIntegrationSpinner';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\n\r\nexport const handleHeightSetMessage: HandleMessageFunction = (\r\n message,\r\n context\r\n) => {\r\n const { iframe } = context;\r\n const { token, value } = message;\r\n\r\n setElementHeight(iframe, toNumber(value) ?? 0);\r\n\r\n removeIntegrationSpinner(token);\r\n};\r\n","import { IntegrationNameModal } from '@walley/domain';\r\nimport { getIntegrationIframe } from './getIntegrationIframe';\r\n\r\nexport const getIntegrationModalIframe = () =>\r\n getIntegrationIframe({ integrationName: IntegrationNameModal });\r\n","export const modalOpenClassName = 'walley-checkout-modal-open';\r\n","import { getIntegrationModalIframe } from './getIntegrationModalIframe';\r\nimport { modalOpenClassName } from './modalOpenClassName';\r\n\r\nexport const removeIntegrationModalIframe = (iframe?: HTMLIFrameElement) => {\r\n const modalIframe = iframe ?? getIntegrationModalIframe();\r\n modalIframe?.parentElement?.remove(); // Remove wrapper\r\n document.body.classList.remove(modalOpenClassName);\r\n};\r\n","import { getIntegrationModalIframe } from '../getIntegrationModalIframe';\r\nimport { removeIntegrationModalIframe } from '../removeIntegrationModalIframe';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\n\r\nexport const handleHideModalMessage: HandleMessageFunction = () => {\r\n const iframe = getIntegrationModalIframe();\r\n\r\n removeIntegrationModalIframe(iframe);\r\n};\r\n","import { removeElementAttribute, setElementAttribute } from '../dom';\r\n\r\nconst lockedAttributeName = 'data-locked';\r\n\r\nexport const setElementLocked = (element: HTMLElement, locked: boolean) => {\r\n if (locked) {\r\n setElementAttribute(element, lockedAttributeName, 'true');\r\n } else {\r\n removeElementAttribute(element, lockedAttributeName);\r\n }\r\n};\r\n","import { MerchantEvent, MerchantEventType, PublicToken } from '@walley/domain';\r\nimport { toObject } from '@walley/language';\r\nimport { dispatchEvent } from '../../dom';\r\nimport { EVENT_PREFIXES } from '../constants';\r\nimport { removeIntegrationModalIframe } from '../removeIntegrationModalIframe';\r\nimport { setElementLocked } from '../setElementLocked';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\n\r\nexport const handleMerchantEventMessage: HandleMessageFunction = (\r\n { value, token },\r\n { iframe, log, walley }\r\n) => {\r\n const event = toObject(value);\r\n\r\n if (!event?.type) return;\r\n\r\n switch (event.type) {\r\n case MerchantEventType.Locked:\r\n setElementLocked(iframe, true);\r\n break;\r\n case MerchantEventType.Unlocked:\r\n setElementLocked(iframe, false);\r\n break;\r\n case MerchantEventType.PurchaseCompleted:\r\n case MerchantEventType.PaymentAborted:\r\n removeIntegrationModalIframe();\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const { type, payload } = event;\r\n\r\n log.info({\r\n messageTemplate:\r\n 'Dispatching event {EventType} with payload {CustomData}',\r\n messageTemplateParameters: [type, payload],\r\n moduleName: 'handleMerchantEventMessage',\r\n properties: {\r\n publicToken: token,\r\n },\r\n });\r\n\r\n // eslint-disable-next-line no-underscore-dangle\r\n walley.checkout._state.activeEvent = {\r\n publicToken: token as PublicToken,\r\n eventType: type,\r\n };\r\n\r\n EVENT_PREFIXES.forEach(prefix => {\r\n dispatchEvent(prefix + type, { token, payload });\r\n });\r\n\r\n // eslint-disable-next-line no-underscore-dangle\r\n walley.checkout._state.activeEvent = undefined;\r\n};\r\n","import { MerchantEventType, Message, MessageType } from '@walley/domain';\r\nimport { toObject } from '@walley/language';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\nimport { handleMerchantEventMessage } from './handleMerchantEventMessage';\r\n\r\nconst getType = ({ type }: Message): MerchantEventType | undefined => {\r\n switch (type) {\r\n case MessageType.CustomerUpdated:\r\n return MerchantEventType.CustomerUpdated;\r\n case MessageType.Locked:\r\n return MerchantEventType.Locked;\r\n case MessageType.Unlocked:\r\n return MerchantEventType.Unlocked;\r\n case MessageType.Resumed:\r\n return MerchantEventType.Resumed;\r\n case MessageType.ShippingUpdated:\r\n return MerchantEventType.ShippingUpdated;\r\n case MessageType.PurchaseCompleted:\r\n return MerchantEventType.PurchaseCompleted;\r\n case MessageType.PaymentAborted:\r\n return MerchantEventType.PaymentAborted;\r\n case MessageType.CrmUpdated:\r\n return MerchantEventType.CrmUpdated;\r\n case MessageType.MerchantValidationFailed:\r\n return MerchantEventType.OrderValidationFailed;\r\n case MessageType.Metric:\r\n return MerchantEventType.Metric;\r\n default:\r\n return undefined;\r\n }\r\n};\r\n\r\nexport const handleOldMerchantEventMessage: HandleMessageFunction = (\r\n message,\r\n context\r\n) =>\r\n handleMerchantEventMessage(\r\n {\r\n ...message,\r\n value: {\r\n type: getType(message),\r\n payload: toObject(message.value),\r\n },\r\n },\r\n context\r\n );\r\n","/* eslint-disable no-underscore-dangle */\r\nimport {\r\n LogEntry,\r\n MessageLogEntry,\r\n MessageType,\r\n MessageValue,\r\n} from '@walley/domain';\r\nimport {\r\n ErrorLike,\r\n isFunction,\r\n isPromise,\r\n toErrorLike,\r\n toObject,\r\n} from '@walley/language';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\nimport { sendMessageToIntegrationIframes } from './sendMessageToIntegrationIframes';\r\n\r\nexport const handleOnBeforePaymentMessage: HandleMessageFunction = (\r\n message,\r\n context\r\n) => {\r\n const sendResponse = (\r\n type: MessageType,\r\n payload?: T\r\n ) =>\r\n sendMessageToIntegrationIframes(\r\n {\r\n ...message,\r\n targetId: message.sourceId,\r\n sourceId: undefined,\r\n type,\r\n value: payload,\r\n },\r\n context\r\n );\r\n\r\n const sendErrorResponse = (error?: ErrorLike) =>\r\n sendResponse(\r\n MessageType.OnBeforePaymentError,\r\n error\r\n ? ({\r\n ...toObject(error),\r\n // Need to override here because props on error is not\r\n // picked up by Object.keys\r\n message: error?.message,\r\n name: error?.name,\r\n stack: error?.stack,\r\n cause: error?.cause,\r\n } as MessageValue)\r\n : undefined\r\n );\r\n\r\n const sendSuccessResponse = () =>\r\n sendResponse(MessageType.OnBeforePaymentSuccess);\r\n\r\n const logOnBeforePayment = (entry: Partial) => {\r\n context.log.info({\r\n ...entry,\r\n messageTemplate: `onBeforePayment: ${\r\n (entry as MessageLogEntry).messageTemplate\r\n }`,\r\n moduleName: 'handleOnBeforePaymentRequest',\r\n properties: {\r\n ...entry.properties,\r\n publicToken: message.token,\r\n },\r\n });\r\n };\r\n\r\n const { onBeforePayment } = context.walley.checkout._state;\r\n\r\n if (!isFunction(onBeforePayment)) {\r\n logOnBeforePayment({\r\n messageTemplate:\r\n 'No callback registered (returning success to iframe)',\r\n });\r\n sendSuccessResponse();\r\n return;\r\n }\r\n\r\n let promise;\r\n\r\n try {\r\n promise = onBeforePayment();\r\n } catch (exception) {\r\n logOnBeforePayment({\r\n messageTemplate:\r\n 'Exception when calling callback (returning error to iframe): {ExceptionMessage}',\r\n messageTemplateParameters: [toErrorLike(exception)?.message],\r\n exception,\r\n });\r\n sendErrorResponse();\r\n return;\r\n }\r\n\r\n // Quick check that a promise was returned.\r\n if (!isPromise(promise)) {\r\n logOnBeforePayment({\r\n messageTemplate:\r\n 'Callback did not return a promise (returning error to iframe)',\r\n });\r\n sendErrorResponse();\r\n return;\r\n }\r\n\r\n try {\r\n promise\r\n .then(() => {\r\n sendResponse(MessageType.OnBeforePaymentSuccess);\r\n })\r\n .catch(err => {\r\n sendErrorResponse(err);\r\n });\r\n } catch {\r\n sendErrorResponse();\r\n }\r\n};\r\n","import { IntegrationId } from '@walley/domain';\r\nimport {\r\n SendMessageToIntegrationIframeContext,\r\n sendMessageToIntegrationIframes,\r\n} from './sendMessageToIntegrationIframes';\r\n\r\nexport const sendQueuedMessageToIntegrationIframes = (\r\n integrationId: IntegrationId,\r\n context: SendMessageToIntegrationIframeContext\r\n) => {\r\n // eslint-disable-next-line no-underscore-dangle\r\n const { queuedMessages } = context.walley.checkout._state;\r\n\r\n if (integrationId && queuedMessages && integrationId in queuedMessages) {\r\n while (queuedMessages[integrationId].length) {\r\n const queuedMessage = queuedMessages[integrationId].shift();\r\n if (queuedMessage?.type) {\r\n sendMessageToIntegrationIframes(queuedMessage, context);\r\n }\r\n }\r\n }\r\n};\r\n","import { getIntegrationIframe } from '../getIntegrationIframe';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\nimport { sendQueuedMessageToIntegrationIframes } from './sendQueuedMessageToIntegrationIframes';\r\n\r\nexport const handleReadyMessage: HandleMessageFunction = (message, context) => {\r\n const { sourceId: integrationId } = message;\r\n const iframe = getIntegrationIframe({ integrationId });\r\n if (iframe) {\r\n iframe.dataset.ready = 'true';\r\n }\r\n sendQueuedMessageToIntegrationIframes(integrationId, context);\r\n};\r\n","import { toObject, toUri } from '@walley/language';\r\nimport { redirect } from '../../dom/redirect';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\n\r\nexport const handleRedirectMessage: HandleMessageFunction = (\r\n { token, value },\r\n { log }\r\n) => {\r\n const options = toObject<{ url: string }>(value);\r\n\r\n const uri = toUri(options?.url);\r\n\r\n if (!uri) {\r\n return;\r\n }\r\n\r\n log.info({\r\n messageTemplate: 'Redirecting to {RequestUri}',\r\n messageTemplateParameters: [uri],\r\n moduleName: 'handleRedirectMessage',\r\n properties: { publicToken: token },\r\n });\r\n\r\n redirect(uri);\r\n};\r\n","import { Message } from '@walley/domain';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\nimport { sendMessageToIntegrationIframes } from './sendMessageToIntegrationIframes';\r\n\r\nexport const handleRelayMessage: HandleMessageFunction = (message, context) => {\r\n if (!message.token) return;\r\n\r\n sendMessageToIntegrationIframes(\r\n {\r\n ...(message.value as Message),\r\n sourceId: message.sourceId,\r\n token: message.token,\r\n },\r\n context\r\n );\r\n};\r\n","import { ClientStorage } from './ClientStorage';\r\n\r\nexport class MemoryStorage implements ClientStorage {\r\n private storage: Record;\r\n\r\n constructor(initial?: Record) {\r\n this.storage = initial ?? {};\r\n }\r\n\r\n getItem(key: string) {\r\n return this.storage[key] ?? null;\r\n }\r\n\r\n setItem(key: string, value: string) {\r\n this.storage[key] = value;\r\n }\r\n\r\n removeItem(key: string) {\r\n delete this.storage[key];\r\n }\r\n\r\n key(index: number) {\r\n return this.keys[index];\r\n }\r\n\r\n clear() {\r\n this.keys.forEach(key => this.removeItem(key));\r\n }\r\n\r\n get length() {\r\n return this.keys.length;\r\n }\r\n\r\n private get keys() {\r\n return Object.keys(this.storage);\r\n }\r\n}\r\n","import { ClientStorage } from './ClientStorage';\r\nimport { MemoryStorage } from './MemoryStorage';\r\nimport { isStorageAvailable } from './isStorageAvailable';\r\n\r\nconst clientStorage: ClientStorage = isStorageAvailable('localStorage')\r\n ? window.localStorage\r\n : new MemoryStorage();\r\n\r\nexport const getStorage = (storage?: ClientStorage): ClientStorage =>\r\n storage ?? clientStorage;\r\n","import { isString } from '@walley/language';\r\n\r\nexport const isStorageAvailable = (\r\n storage: Storage | 'localStorage' | 'sessionStorage',\r\n parent: Window & typeof globalThis = window\r\n): boolean => {\r\n try {\r\n const target = isString(storage) ? parent[storage] : storage;\r\n const test = '__test';\r\n target.setItem(test, test);\r\n const result = target.getItem(test);\r\n target.removeItem(test);\r\n return result === test;\r\n } catch {\r\n return false;\r\n }\r\n};\r\n","import { ClientStorage } from './ClientStorage';\r\nimport { getStorage } from './getStorage';\r\n\r\nexport const getStorageItem = (\r\n key: string,\r\n storage?: ClientStorage\r\n): T | undefined => (getStorage(storage).getItem(key) as T) || undefined;\r\n","import { ClientStorage } from './ClientStorage';\r\nimport { StorageData } from './StorageData';\r\nimport { getStorageItem } from './getStorageItem';\r\n\r\nexport const getStorageData = (\r\n key: string,\r\n storage?: ClientStorage\r\n): T | undefined => {\r\n const rawData = getStorageItem(key, storage);\r\n return rawData ? (JSON.parse(rawData) as T) || undefined : undefined;\r\n};\r\n","import { ClientStorage } from './ClientStorage';\r\nimport { getStorage } from './getStorage';\r\n\r\nexport const removeStorageItem = (key: string, storage?: ClientStorage) =>\r\n getStorage(storage).removeItem(key);\r\n","import { ClientStorage } from './ClientStorage';\r\nimport { getStorage } from './getStorage';\r\nimport { removeStorageItem } from './removeStorageItem';\r\n\r\nexport const setStorageItem = (\r\n key: string,\r\n value: string | undefined,\r\n storage?: ClientStorage\r\n) => {\r\n if (value) {\r\n getStorage(storage).setItem(key, value);\r\n } else {\r\n removeStorageItem(key, storage);\r\n }\r\n};\r\n","import { DeepPartial, jsonStringify } from '@walley/language';\r\nimport { ClientStorage } from './ClientStorage';\r\nimport { StorageData } from './StorageData';\r\nimport { setStorageItem } from './setStorageItem';\r\n\r\nexport const setStorageData = (\r\n key: string,\r\n value: T | DeepPartial | undefined,\r\n storage?: ClientStorage\r\n): void => setStorageItem(key, jsonStringify(value), storage);\r\n","import { getStorageData } from '../storage';\r\nimport { WALLEY_STORAGE_KEY } from './constants';\r\n\r\nexport const getWalleyStorage = () => {\r\n try {\r\n return getStorageData(WALLEY_STORAGE_KEY) ?? {};\r\n } catch {\r\n return {};\r\n }\r\n};\r\n","import { isBitSetInToken, parseToken } from '@walley/domain';\r\nimport { DeepPartial, Uri, appendUriQuery, concatUri } from '@walley/language';\r\nimport { getLocationUri } from '../dom';\r\nimport { InitIntegrationData } from './InitIntegrationData';\r\nimport { IntegrationOverrides } from './IntegrationOverrides';\r\nimport { VARIANT_B2B, VARIANT_B2C, VARIANT_WIDGET } from './constants';\r\nimport { getClientUri } from './getClientUri';\r\nimport { getWalleyStorage } from './getWalleyStorage';\r\n\r\nconst getVariantPath = (data: InitIntegrationData) => {\r\n if (data.widget) {\r\n return concatUri(VARIANT_WIDGET, encodeURIComponent(data.widget));\r\n }\r\n\r\n if (!data.token) return '';\r\n\r\n return isBitSetInToken(data.token, 0, 1) ? VARIANT_B2B : VARIANT_B2C;\r\n};\r\n\r\n// Used when making changes that could break integration between loader and\r\n// other parts during rollout. Could be something like this:\r\n// ({\r\n// onBeforePayment: true,\r\n// });\r\n// This is passed to the integration so the integration knows what features are\r\n// available in this version of the loader so that integration can adapt to it.\r\nconst getFeatures = () => undefined;\r\n\r\nconst getWidgetClientUri = (\r\n clientHost: Uri,\r\n path: string,\r\n overrides: DeepPartial | undefined\r\n) => {\r\n const pathParts = path.split('/');\r\n const name = pathParts.shift() || '';\r\n return concatUri(getClientUri(clientHost, name, overrides), ...pathParts);\r\n};\r\n\r\nexport const getIntegrationUri = (data: InitIntegrationData) => {\r\n const path = concatUri(getVariantPath(data), data.token);\r\n\r\n const clientUri = getWidgetClientUri(data.clientHost, path, data.overrides);\r\n\r\n return appendUriQuery(clientUri, {\r\n data: data.data,\r\n lang: data.lang\r\n ? `${data.lang.split('-')[0]}-${parseToken(data.token)?.country}`\r\n : undefined,\r\n parentUrl: getLocationUri(),\r\n debug: data.debug,\r\n payLink: data.payLink,\r\n rememberMeOptOut: data.rememberMeOptOut,\r\n showCart: data.showCart,\r\n webView: data.webView,\r\n actionColor: data.actionColor,\r\n actionTextColor: data.actionTextColor,\r\n amount: data.amount,\r\n overrides: data.overrides,\r\n pollRetries: data.pollRetries,\r\n pollWaitTime: data.pollWaitTime,\r\n features: getFeatures(),\r\n ...getWalleyStorage(),\r\n });\r\n};\r\n","export const getMaxZIndex = (): string =>\r\n (\r\n 2147483647 +\r\n (document.body.classList.contains('walley-checkout-modal-overlay')\r\n ? -1\r\n : 0)\r\n ).toString();\r\n","import { IntegrationNameModal } from '@walley/domain';\r\nimport { DeepPartial, Uri } from '@walley/language';\r\nimport { createDivElement } from '../dom';\r\nimport { InitIntegrationModalData } from './InitIntegrationModalData';\r\nimport { createIntegrationIframe } from './createIntegrationIframe';\r\nimport { getIntegrationUri } from './getIntegrationUri';\r\nimport { getMaxZIndex } from './getMaxZIndex';\r\nimport { modalOpenClassName } from './modalOpenClassName';\r\n\r\nexport const appendIntegrationModalIframe = (\r\n clientHost: Uri,\r\n data: DeepPartial,\r\n onload: () => void\r\n): HTMLIFrameElement => {\r\n const initData = {\r\n clientHost,\r\n ...data,\r\n };\r\n\r\n const iframe = createIntegrationIframe(\r\n data.token,\r\n `Walley Modal - ${data.widget}`,\r\n {\r\n onload,\r\n style: {\r\n position: 'fixed',\r\n top: '0',\r\n left: '0',\r\n height: '100%',\r\n width: '100%',\r\n zIndex: getMaxZIndex(),\r\n border: 'none',\r\n },\r\n dataset: {\r\n modal: data.widget,\r\n },\r\n },\r\n IntegrationNameModal,\r\n getIntegrationUri(initData)\r\n );\r\n\r\n const wrapper = createDivElement();\r\n wrapper.appendChild(iframe);\r\n document.body.appendChild(wrapper);\r\n document.body.classList.add(modalOpenClassName);\r\n\r\n return iframe;\r\n};\r\n","import { MessageType } from '@walley/domain';\r\nimport { DeepPartial } from '@walley/language';\r\nimport { InitIntegrationModalData } from '../InitIntegrationModalData';\r\nimport { appendIntegrationModalIframe } from '../appendIntegrationModalIframe';\r\nimport { getIntegrationModalIframe } from '../getIntegrationModalIframe';\r\nimport { removeIntegrationModalIframe } from '../removeIntegrationModalIframe';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\nimport { sendMessageToIntegrationIframes } from './sendMessageToIntegrationIframes';\r\n\r\nexport const handleShowModalMessage: HandleMessageFunction = (\r\n { token, value, sourceId },\r\n context\r\n) => {\r\n if (!token) return;\r\n\r\n const data = value as DeepPartial;\r\n\r\n const sendModalShown = () => {\r\n sendMessageToIntegrationIframes(\r\n {\r\n type: MessageType.ModalShown,\r\n value: data?.widget,\r\n targetId: sourceId,\r\n },\r\n context\r\n );\r\n };\r\n\r\n const existingIframe = getIntegrationModalIframe();\r\n\r\n if (existingIframe) {\r\n if (\r\n existingIframe.dataset.modal === data?.widget &&\r\n existingIframe.dataset.token === data?.token\r\n ) {\r\n existingIframe.focus();\r\n sendModalShown();\r\n return;\r\n }\r\n\r\n removeIntegrationModalIframe(existingIframe);\r\n }\r\n\r\n const iframe = appendIntegrationModalIframe(\r\n context.clientHost,\r\n data,\r\n sendModalShown\r\n );\r\n\r\n iframe.focus();\r\n};\r\n","import { setStorageData } from '../storage';\r\nimport { StorageData } from '../storage/StorageData';\r\nimport { WALLEY_STORAGE_KEY } from './constants';\r\n\r\nexport const setWalleyStorage = (value: StorageData) => {\r\n setStorageData(WALLEY_STORAGE_KEY, value);\r\n};\r\n","import { Message } from '@walley/domain';\r\nimport { toObject } from '@walley/language';\r\nimport { StorageValue } from '../../storage/StorageValue';\r\nimport { getWalleyStorage } from '../getWalleyStorage';\r\nimport { setWalleyStorage } from '../setWalleyStorage';\r\n\r\nexport const handleStoreParameterMessage = (message: Message) => {\r\n const walleyStorage = getWalleyStorage();\r\n const payload = toObject<{\r\n key: string;\r\n value: StorageValue;\r\n }>(message.value);\r\n\r\n if (payload?.key) {\r\n setWalleyStorage({\r\n ...walleyStorage,\r\n [payload.key]: payload.value,\r\n });\r\n }\r\n};\r\n","import { MessageType } from '@walley/domain';\r\nimport { HandleMessageFunction } from './HandleMessageFunction';\r\nimport { handleBroadcastMessage } from './handleBroadcastMessage';\r\nimport { handleHeightSetMessage } from './handleHeightSetMessaget';\r\nimport { handleHideModalMessage } from './handleHideModalMessage';\r\nimport { handleMerchantEventMessage } from './handleMerchantEventMessage';\r\nimport { handleOldMerchantEventMessage } from './handleOldMerchantEventMessage';\r\nimport { handleOnBeforePaymentMessage } from './handleOnBeforePaymentMessage';\r\nimport { handleReadyMessage } from './handleReadyMessage';\r\nimport { handleRedirectMessage } from './handleRedirectMessage';\r\nimport { handleRelayMessage } from './handleRelayMessage';\r\nimport { handleShowModalMessage } from './handleShowModalMessage';\r\nimport { handleStoreParameterMessage } from './handleStoreParameterMessage';\r\n\r\nconst handleNoopMessage: HandleMessageFunction = () => undefined;\r\n\r\nexport const getHandleMessageFunction = (\r\n type: MessageType\r\n): HandleMessageFunction | undefined => {\r\n switch (type) {\r\n case MessageType.Relay:\r\n return handleRelayMessage;\r\n case MessageType.Broadcast:\r\n return handleBroadcastMessage;\r\n case MessageType.ShowModal:\r\n return handleShowModalMessage;\r\n case MessageType.HideModal:\r\n return handleHideModalMessage;\r\n case MessageType.HeightSet:\r\n return handleHeightSetMessage;\r\n case MessageType.MerchantEvent:\r\n return handleMerchantEventMessage;\r\n case MessageType.CustomerUpdated:\r\n case MessageType.Locked:\r\n case MessageType.Unlocked:\r\n case MessageType.Resumed:\r\n case MessageType.ShippingUpdated:\r\n case MessageType.PurchaseCompleted:\r\n case MessageType.PaymentAborted:\r\n case MessageType.CrmUpdated:\r\n case MessageType.MerchantValidationFailed:\r\n case MessageType.Metric:\r\n return handleOldMerchantEventMessage;\r\n case MessageType.StoreParameter:\r\n return handleStoreParameterMessage;\r\n case MessageType.Redirect:\r\n return handleRedirectMessage;\r\n case MessageType.OnBeforePayment:\r\n return handleOnBeforePaymentMessage;\r\n case MessageType.LanguagePref:\r\n return handleNoopMessage; // To avaid logging of unhandled message, only used for paylink\r\n case MessageType.Ready:\r\n return handleReadyMessage;\r\n default:\r\n return undefined;\r\n }\r\n};\r\n","/* eslint-disable no-underscore-dangle */\r\nimport { IntegrationId, Log, LogLevel, WalleyGlobal } from '@walley/domain';\r\nimport {\r\n Uri,\r\n callOptionalFunction,\r\n isObject,\r\n jsonStringify,\r\n} from '@walley/language';\r\nimport { parseMessage } from '../message/parseMessage';\r\nimport { getIntegrationIframe } from './getIntegrationIframe';\r\nimport { isValidOrigin } from './isValidOrigin';\r\nimport { getHandleMessageFunction } from './message/getHandleMessageFunction';\r\n\r\ntype Context = {\r\n clientHost: Uri;\r\n log: Log;\r\n walley: WalleyGlobal;\r\n};\r\n\r\nconst getDemoIframe = (sourceId: IntegrationId) =>\r\n sourceId.startsWith('Demo-') ? document.createElement('iframe') : undefined;\r\n\r\nexport const registerIntegrationMessageHandler = ({\r\n clientHost,\r\n log,\r\n walley,\r\n}: Context) => {\r\n callOptionalFunction(walley.checkout._state.unregisterMessageHandler);\r\n\r\n const onWindowMessage = (event: MessageEvent) => {\r\n if (!isObject(event)) {\r\n return;\r\n }\r\n\r\n if (!isValidOrigin(event.origin, clientHost)) {\r\n return;\r\n }\r\n\r\n const message = parseMessage(event.data);\r\n\r\n if (!message) {\r\n return;\r\n }\r\n\r\n const { sourceId, value, type } = message;\r\n const iframe =\r\n getDemoIframe(sourceId) ??\r\n getIntegrationIframe({ integrationId: sourceId });\r\n\r\n const logOnMessage = (messageTemplate: string, logLevel: LogLevel) => {\r\n log.log(logLevel, {\r\n messageTemplate,\r\n messageTemplateParameters: [\r\n type,\r\n isObject(value) ? jsonStringify(value) : value,\r\n sourceId,\r\n ],\r\n moduleName: 'registerIntegrationMessageHandler',\r\n functionName: 'onWindowMessage',\r\n properties: {\r\n publicToken: message.token,\r\n },\r\n });\r\n };\r\n\r\n if (!iframe) {\r\n logOnMessage(\r\n 'Received {MessageType} with value {Message} from iframe {Name} but iframe could not be found',\r\n LogLevel.Information\r\n );\r\n return;\r\n }\r\n\r\n logOnMessage(\r\n 'Received {MessageType} with value {Message} from iframe {Name}',\r\n LogLevel.Debug\r\n );\r\n\r\n const context = {\r\n clientHost,\r\n iframe,\r\n log,\r\n walley,\r\n };\r\n\r\n const handleMessage = getHandleMessageFunction(type);\r\n\r\n if (!handleMessage) {\r\n logOnMessage(\r\n 'Received unhandled {MessageType} with value {Message} from iframe {Name}',\r\n LogLevel.Warning\r\n );\r\n return;\r\n }\r\n\r\n handleMessage(message, context);\r\n };\r\n\r\n window.addEventListener('message', onWindowMessage);\r\n\r\n walley.checkout._state.unregisterMessageHandler = () => {\r\n window.removeEventListener('message', onWindowMessage);\r\n walley.checkout._state.unregisterMessageHandler = undefined;\r\n };\r\n};\r\n","import {\r\n IntegrationName,\r\n IntegrationNameCheckoutV2,\r\n IntegrationNameWidgetPartPayment,\r\n Log,\r\n createIntegrationId,\r\n} from '@walley/domain';\r\nimport { isNonEmptyArray, jsonStringify } from '@walley/language';\r\nimport { createDivElement, setElementHeight } from '../dom';\r\nimport { InitIntegrationData } from './InitIntegrationData';\r\nimport { IFRAME_DEFAULT_HEIGHT, PADDING } from './constants';\r\nimport { createIntegrationIframe } from './createIntegrationIframe';\r\nimport { getIntegrationUri } from './getIntegrationUri';\r\nimport { getUnsupportedFeatures } from './getUnsupportedFeatures';\r\nimport { removeIntegrationSpinner } from './removeIntegrationSpinner';\r\n\r\nconst noPaddingCssText = () =>\r\n ` margin-left:-${PADDING}px;margin-right:-${PADDING}px;min-width:calc(100% + ${\r\n 2 * PADDING\r\n }px);`;\r\n\r\nconst getIntegrationName = (data: InitIntegrationData): IntegrationName =>\r\n data.widget ? IntegrationNameWidgetPartPayment : IntegrationNameCheckoutV2;\r\n\r\nconst createIframe = (data: InitIntegrationData) => {\r\n const iframeElement = createIntegrationIframe(\r\n data.token,\r\n 'Walley Checkout',\r\n {\r\n onload: () => {\r\n removeIntegrationSpinner(data.token);\r\n },\r\n },\r\n getIntegrationName(data),\r\n getIntegrationUri(data)\r\n );\r\n\r\n if (!data.widget && !data.headless) {\r\n setElementHeight(iframeElement, IFRAME_DEFAULT_HEIGHT);\r\n }\r\n\r\n if (!data.padding) {\r\n iframeElement.style.cssText += noPaddingCssText();\r\n }\r\n\r\n return iframeElement;\r\n};\r\n\r\nconst createNotSupportedDiv = (data: InitIntegrationData) => {\r\n const div = createDivElement({\r\n style: { padding: `${PADDING}px` },\r\n textContent:\r\n 'Unfortunately your browser is not supported. Try switching to a more modern browser such as Google Chrome, Microsoft Edge or Mozilla Firefox.',\r\n dataset: {\r\n walley: 'true',\r\n token: data.token,\r\n id: createIntegrationId(getIntegrationName(data)),\r\n },\r\n });\r\n\r\n if (data.widget) {\r\n div.style.display = 'none';\r\n }\r\n\r\n if (!data.padding) {\r\n div.style.cssText += noPaddingCssText();\r\n }\r\n\r\n return div;\r\n};\r\n\r\nconst moduleName = 'createIntegrationContent';\r\n\r\nexport const createIntegrationContent = (\r\n data: InitIntegrationData,\r\n log: Log\r\n): HTMLElement => {\r\n const unsupportedFeatures = getUnsupportedFeatures();\r\n\r\n if (isNonEmptyArray(unsupportedFeatures)) {\r\n log.warn({\r\n messageTemplate: 'Browser not supported',\r\n properties: {\r\n name: unsupportedFeatures[0],\r\n customData: unsupportedFeatures.join(', '),\r\n publicToken: data.token,\r\n },\r\n moduleName,\r\n });\r\n\r\n return createNotSupportedDiv(data);\r\n }\r\n\r\n const iframe = createIframe(data);\r\n\r\n log.info({\r\n messageTemplate: 'Loading instance {Name}',\r\n messageTemplateParameters: [iframe.dataset.id],\r\n properties: {\r\n customData: jsonStringify(data),\r\n publicToken: data.token,\r\n },\r\n moduleName,\r\n });\r\n\r\n if (data.token && data.overrides?.apiHost) {\r\n log.overrideApiHost(data.token, data.overrides.apiHost);\r\n }\r\n\r\n return iframe;\r\n};\r\n","import { getElementById, insertElement } from '../dom';\r\nimport { InitIntegrationData } from './InitIntegrationData';\r\n\r\nexport const insertIntegrationContent = (\r\n content: HTMLElement,\r\n { data, script }: { data: InitIntegrationData; script: HTMLScriptElement }\r\n) => {\r\n const { containerId } = data;\r\n\r\n const container = containerId ? getElementById(containerId) : undefined;\r\n\r\n if (container) {\r\n insertElement(content, container);\r\n return;\r\n }\r\n\r\n if (script.parentNode) {\r\n script.parentNode.insertBefore(content, script);\r\n return;\r\n }\r\n\r\n insertElement(content, document.body);\r\n};\r\n","import { Log } from '@walley/domain';\r\nimport { InitIntegrationData } from './InitIntegrationData';\r\nimport { createIntegrationContent } from './createIntegrationContent';\r\nimport { createIntegrationSpinner } from './createIntegrationSpinner';\r\nimport { insertIntegrationContent } from './insertIntegrationContent';\r\nimport { removeIntegrationSpinner } from './removeIntegrationSpinner';\r\n\r\nexport const renderCheckout = ({\r\n data,\r\n log,\r\n script,\r\n}: {\r\n data: InitIntegrationData;\r\n log: Log;\r\n script: HTMLScriptElement;\r\n}) => {\r\n const content = createIntegrationContent(data, log);\r\n\r\n removeIntegrationSpinner(data.token);\r\n\r\n if (!data.widget && !data.headless) {\r\n insertIntegrationContent(createIntegrationSpinner(content), {\r\n data,\r\n script,\r\n });\r\n }\r\n\r\n insertIntegrationContent(content, {\r\n data,\r\n script,\r\n });\r\n};\r\n","import { LogConfig, LogContext } from '@walley/domain';\r\n\r\nexport const createLogContext = (config: LogConfig): LogContext => ({\r\n enricher: undefined,\r\n apiHostOverrides: {},\r\n sequenceNumber: 0,\r\n duplicateMessageCount: 0,\r\n lastLogString: '',\r\n lastLogToken: undefined,\r\n lastLogTimestamp: 0,\r\n config,\r\n});\r\n","import {\r\n LogConsole,\r\n LogLevel,\r\n LogMessageTemplate,\r\n isLogLevelAbove,\r\n renderMessageTemplate,\r\n} from '@walley/domain';\r\n\r\ntype ClientLogEntry = {\r\n level: LogLevel;\r\n exception?: Error;\r\n} & LogMessageTemplate;\r\n\r\ntype ClientLogConfig = {\r\n logLevelClient: LogLevel;\r\n prefix?: string;\r\n console: LogConsole;\r\n};\r\n\r\nexport const logClient = (\r\n logEntry: ClientLogEntry,\r\n { logLevelClient, prefix, console }: ClientLogConfig\r\n) => {\r\n const { level, messageTemplate, messageTemplateParameters, exception } =\r\n logEntry;\r\n\r\n if (!isLogLevelAbove(level, logLevelClient)) {\r\n return;\r\n }\r\n\r\n const message = `[${prefix ?? level}] ${renderMessageTemplate(\r\n messageTemplate,\r\n messageTemplateParameters\r\n )}`;\r\n\r\n switch (level) {\r\n case LogLevel.Fatal:\r\n case LogLevel.Error:\r\n console.error(message);\r\n break;\r\n case LogLevel.Warning:\r\n console.warn(message);\r\n break;\r\n case LogLevel.Information:\r\n console.info(message);\r\n break;\r\n case LogLevel.Debug:\r\n console.debug(message);\r\n break;\r\n default:\r\n console.log(message);\r\n break;\r\n }\r\n\r\n if (exception && isLogLevelAbove(LogLevel.Debug, logLevelClient)) {\r\n console.debug('[debug] Logged exception', exception);\r\n }\r\n};\r\n","import {\r\n EventLogEntry,\r\n ExceptionLogEntry,\r\n Log,\r\n LogConfig,\r\n LogContext,\r\n LogEntry,\r\n LogLevel,\r\n LogProperties,\r\n MessageLogEntry,\r\n PublicToken,\r\n Token,\r\n isLogLevelAbove,\r\n normalizeLogProperties,\r\n normalizeMessageTemplateParameters,\r\n renderMessageTemplate,\r\n renderMessageTemplateParameter,\r\n resolveErrorStack,\r\n toToken,\r\n} from '@walley/domain';\r\nimport {\r\n Uri,\r\n callOptionalFunction,\r\n isNonEmptyString,\r\n isSet,\r\n toErrorLike,\r\n truncateString,\r\n withoutEmptyValues,\r\n} from '@walley/language';\r\nimport { ApiPostPayload } from '../api/ApiPostPayload';\r\nimport { apiPostRaw } from '../api/apiPostRaw';\r\nimport { PostEventRequest } from './PostEventRequest';\r\nimport { PostLogRequest } from './PostLogRequest';\r\nimport { createLogContext } from './createLogContext';\r\nimport { logClient } from './logClient';\r\n\r\nconst unknownErrorName = 'UnknownError';\r\nconst unknownErrorMessage = 'Unknown error occurred';\r\nconst logTimeout = 100_000;\r\nconst duplicateLogSlidingTimeout = 1_000;\r\n\r\nconst resolveException = async (\r\n entry: Partial\r\n): Promise => {\r\n const exception = toErrorLike(entry.exception);\r\n return exception\r\n ? {\r\n ...exception,\r\n message: truncateString(\r\n exception.message?.trim() || unknownErrorMessage,\r\n 1000\r\n ),\r\n name: exception.name?.trim() || unknownErrorName,\r\n stack: await resolveErrorStack(exception),\r\n cause: exception.cause,\r\n }\r\n : undefined;\r\n};\r\n\r\nconst getMessageTemplate = (\r\n { messageTemplate, messageTemplateParameters }: Partial,\r\n exception?: Error\r\n) =>\r\n !isSet(messageTemplate) && isNonEmptyString(exception?.message)\r\n ? {\r\n messageTemplate: '{ExceptionMessage}',\r\n messageTemplateParameters: [exception?.message],\r\n }\r\n : {\r\n messageTemplate: renderMessageTemplateParameter(\r\n messageTemplate,\r\n false\r\n ),\r\n messageTemplateParameters,\r\n };\r\n\r\nconst post = async (payload: ApiPostPayload>) => {\r\n const body = withoutEmptyValues(payload.body);\r\n\r\n if (!body) {\r\n return;\r\n }\r\n\r\n try {\r\n // Could have been better to use navigator.sendBeacon but it was blocked by uBlock\r\n const response = await apiPostRaw({\r\n ...payload,\r\n path: `checkout/${payload.path}`,\r\n body,\r\n timeout: logTimeout,\r\n keepalive: true,\r\n });\r\n\r\n await response.text(); // Only to avoid pipe error in chromium when not reading stream to end\r\n } catch {\r\n // Do nothing as we don't actually care\r\n }\r\n};\r\n\r\nconst getRequestPayload = (request: PostLogRequest | PostEventRequest) => ({\r\n body: {\r\n ...request,\r\n messageTemplateParameters: normalizeMessageTemplateParameters(\r\n request.messageTemplateParameters\r\n ),\r\n properties: normalizeLogProperties(request.properties),\r\n },\r\n publicToken: request.properties?.publicToken as PublicToken | undefined,\r\n isWebView: request.properties?.isWebView,\r\n isPayLink: request.properties?.isPayLink,\r\n});\r\n\r\nconst logServerInternal = (apiHost: Uri, postLogRequest: PostLogRequest) => {\r\n post({\r\n ...getRequestPayload(postLogRequest),\r\n apiHost,\r\n path: 'log',\r\n });\r\n};\r\n\r\nconst getSourceContext = (\r\n sourceSystem: string,\r\n ...parts: (string | undefined)[]\r\n) =>\r\n [sourceSystem, ...parts]\r\n .map(v => v?.trim())\r\n .filter(v => v)\r\n .join('.') || undefined;\r\n\r\nconst getLogProperties = (\r\n context: LogContext,\r\n moduleName: string,\r\n functionName?: string,\r\n properties?: LogProperties\r\n): LogProperties => {\r\n context.sequenceNumber += 1;\r\n\r\n const {\r\n version,\r\n commit,\r\n machineName,\r\n sourceSystem,\r\n country,\r\n isPayLink,\r\n isWebView,\r\n parentUrl,\r\n token,\r\n } = context.config;\r\n\r\n return {\r\n clientLogSequence: context.sequenceNumber,\r\n clientTimestamp: new Date().toISOString(),\r\n sourceSystemInformationalVersion: version,\r\n gitCommitHash: commit,\r\n machineName,\r\n referrer: window.location?.href,\r\n sourceSystem,\r\n countryCode: country,\r\n isPayLink,\r\n isWebView,\r\n parent: parentUrl,\r\n publicToken: token,\r\n sourceContext: getSourceContext(sourceSystem, moduleName, functionName),\r\n ...callOptionalFunction(context.enricher),\r\n ...properties,\r\n };\r\n};\r\n\r\nconst getApiHost = ({\r\n config: { apiHost },\r\n apiHostOverrides,\r\n lastLogToken,\r\n}: LogContext) => {\r\n return (\r\n (lastLogToken ? apiHostOverrides[lastLogToken] : undefined) || apiHost\r\n );\r\n};\r\n\r\nconst logDuplicateLogRequests = (context: LogContext) => {\r\n const { logLevelClient, console } = context.config;\r\n if (context.duplicateMessageCount > 0) {\r\n const postLogRequest: PostLogRequest = {\r\n level: LogLevel.Information,\r\n messageTemplate: 'Did not send {Count} duplicate(s) of:\\n{Message}',\r\n messageTemplateParameters: [\r\n context.duplicateMessageCount,\r\n context.lastLogString.split('|')[2],\r\n ],\r\n properties: getLogProperties(\r\n context,\r\n 'logService',\r\n 'logDuplicateLogRequests'\r\n ),\r\n };\r\n\r\n context.duplicateMessageCount = 0;\r\n\r\n logClient(postLogRequest, { logLevelClient, console });\r\n logServerInternal(getApiHost(context), postLogRequest);\r\n }\r\n};\r\n\r\nconst renderLogString = (postLogRequest: PostLogRequest): string => {\r\n const message = renderMessageTemplate(\r\n postLogRequest.messageTemplate,\r\n postLogRequest.messageTemplateParameters\r\n );\r\n const exception = postLogRequest.exception\r\n ? `${postLogRequest.exception.name}: ${postLogRequest.exception.message}\\n${postLogRequest.exception.stack}`\r\n : '';\r\n\r\n return [\r\n postLogRequest.level,\r\n postLogRequest.properties?.sourceContext,\r\n message,\r\n exception,\r\n ].join('|');\r\n};\r\n\r\nconst isDuplicateLogRequest = (\r\n context: LogContext,\r\n postLogRequest: PostLogRequest\r\n): boolean => {\r\n const logString = renderLogString(postLogRequest);\r\n const timestamp = Date.now();\r\n\r\n if (\r\n context.lastLogString === logString &&\r\n timestamp - context.lastLogTimestamp < duplicateLogSlidingTimeout\r\n ) {\r\n context.duplicateMessageCount += 1;\r\n context.lastLogTimestamp = timestamp; // Make sliding timeout\r\n return true;\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst logServer = (\r\n context: LogContext,\r\n postLogRequest: PostLogRequest,\r\n allowDuplicates: boolean\r\n) => {\r\n const { logLevelServer } = context.config;\r\n if (\r\n !isLogLevelAbove(postLogRequest.level, logLevelServer) ||\r\n (!allowDuplicates && isDuplicateLogRequest(context, postLogRequest))\r\n ) {\r\n return;\r\n }\r\n\r\n logDuplicateLogRequests(context);\r\n\r\n context.lastLogString = renderLogString(postLogRequest);\r\n context.lastLogTimestamp = Date.now();\r\n context.lastLogToken = toToken(postLogRequest.properties?.publicToken);\r\n\r\n logServerInternal(getApiHost(context), postLogRequest);\r\n};\r\n\r\nconst log = async (\r\n context: LogContext,\r\n level: LogLevel,\r\n entry: LogEntry\r\n): Promise => {\r\n const { logLevelClient, console } = context.config;\r\n const {\r\n properties,\r\n moduleName,\r\n functionName,\r\n skipServerLogging,\r\n allowDuplicates,\r\n } = entry;\r\n\r\n const exception = await resolveException(entry);\r\n\r\n const postLogRequest: PostLogRequest = {\r\n level: level ?? LogLevel.Information,\r\n ...getMessageTemplate(entry, exception),\r\n properties: getLogProperties(\r\n context,\r\n moduleName,\r\n functionName,\r\n properties\r\n ),\r\n exception,\r\n };\r\n\r\n logClient(postLogRequest, { logLevelClient, console });\r\n\r\n if (skipServerLogging) {\r\n return;\r\n }\r\n\r\n logServer(context, postLogRequest, allowDuplicates === true);\r\n};\r\n\r\nconst createLogFunction =\r\n (context: LogContext, logLevel: LogLevel) => (entry: LogEntry) =>\r\n log(context, logLevel, entry);\r\n\r\nconst event = (context: LogContext, eventLog: EventLogEntry): void => {\r\n const { logLevelClient, apiHost, console } = context.config;\r\n const {\r\n type,\r\n messageTemplate,\r\n messageTemplateParameters,\r\n properties,\r\n moduleName,\r\n functionName,\r\n } = eventLog;\r\n\r\n const postEventRequest: PostEventRequest = {\r\n type,\r\n messageTemplate,\r\n messageTemplateParameters,\r\n properties: getLogProperties(\r\n context,\r\n moduleName,\r\n functionName,\r\n properties\r\n ),\r\n };\r\n\r\n logClient(\r\n {\r\n level: LogLevel.Information,\r\n messageTemplate: `${type} - ${messageTemplate}`,\r\n messageTemplateParameters,\r\n },\r\n {\r\n logLevelClient,\r\n prefix: 'event',\r\n console,\r\n }\r\n );\r\n\r\n post({\r\n ...getRequestPayload(postEventRequest),\r\n apiHost,\r\n path: 'event',\r\n });\r\n};\r\n\r\nexport const createLog = (config: LogConfig): Log => {\r\n const context = createLogContext(config);\r\n\r\n return {\r\n log: (level: LogLevel, entry: LogEntry) => log(context, level, entry),\r\n debug: createLogFunction(context, LogLevel.Debug),\r\n info: createLogFunction(context, LogLevel.Information),\r\n warn: createLogFunction(context, LogLevel.Warning),\r\n error: createLogFunction(context, LogLevel.Error),\r\n fatal: createLogFunction(context, LogLevel.Fatal),\r\n event: (eventLog: EventLogEntry) => event(context, eventLog),\r\n registerLogEnricher: (enricher: () => LogProperties) => {\r\n context.enricher = enricher;\r\n },\r\n overrideApiHost: (token: Token, apiHost: Uri) => {\r\n context.apiHostOverrides[token] = apiHost;\r\n },\r\n };\r\n};\r\n","import { getElementsByTagName } from '@walley/interaction';\r\n\r\nexport const getAllScripts = () => getElementsByTagName('script');\r\n","import { removeUriQuery, toUri } from '@walley/language';\r\n\r\nexport const isLoaderScriptSrc = (src: string) =>\r\n /\\/(walley|collector)-checkout-loader\\.js$/i.test(\r\n removeUriQuery(toUri(src)) ?? ''\r\n );\r\n","import { isLoaderScriptSrc } from './isLoaderScriptSrc';\r\n\r\nexport const isLoaderScript = (script: HTMLScriptElement) =>\r\n !!script && isLoaderScriptSrc(script.src);\r\n","import { getAllScripts } from './getAllScripts';\r\nimport { isLoaderScript } from './isLoaderScript';\r\n\r\nexport const getAllLoaderScripts = () => getAllScripts().filter(isLoaderScript);\r\n","import { getAttribute } from '@walley/interaction';\r\n\r\nexport const getTokenAttribute = (script: HTMLScriptElement) =>\r\n getAttribute(script, 'data-token', 'token');\r\n","import { MessageType, toToken } from '@walley/domain';\r\nimport {\r\n SendMessageToIntegrationIframeContext,\r\n getAttribute,\r\n sendMessageToIntegrationIframes,\r\n} from '@walley/interaction';\r\nimport { isEmpty, toNumber } from '@walley/language';\r\nimport { getAllLoaderScripts } from './getAllLoaderScripts';\r\nimport { getTokenAttribute } from './getTokenAttribute';\r\n\r\nexport const sendUpdate = (\r\n loaderContext: SendMessageToIntegrationIframeContext\r\n) =>\r\n getAllLoaderScripts().forEach(script => {\r\n const token = toToken(getTokenAttribute(script));\r\n const amount = toNumber(getAttribute(script, 'data-amount'));\r\n\r\n if (isEmpty(token) || isEmpty(amount)) {\r\n return;\r\n }\r\n\r\n sendMessageToIntegrationIframes(\r\n {\r\n token,\r\n type: MessageType.Update,\r\n value: {\r\n amount,\r\n },\r\n },\r\n loaderContext\r\n );\r\n });\r\n","import { CollectorCheckoutApi, Log, Token, WalleyGlobal } from '@walley/domain';\r\nimport { sendResume, sendSuspend } from '@walley/interaction';\r\nimport { Uri } from '@walley/language';\r\nimport { sendUpdate } from './sendUpdate';\r\n\r\ntype CreateCollectorCheckoutApiPayload = {\r\n clientHost: Uri;\r\n log: Log;\r\n walley: WalleyGlobal;\r\n init: () => void;\r\n};\r\n\r\nexport const createCollectorCheckoutApi = ({\r\n clientHost,\r\n log,\r\n walley,\r\n init,\r\n}: CreateCollectorCheckoutApiPayload): CollectorCheckoutApi => {\r\n const loaderContext = { clientHost, log, walley };\r\n\r\n const update = () => sendUpdate(loaderContext);\r\n const suspend = (token?: Token) => sendSuspend(token, loaderContext);\r\n const resume = (token?: Token) => sendResume(token, loaderContext);\r\n\r\n return {\r\n init,\r\n suspend,\r\n resume,\r\n update,\r\n };\r\n};\r\n","import { CollectorGlobal, Log, WalleyGlobal } from '@walley/domain';\r\nimport { Uri } from '@walley/language';\r\nimport { createCollectorCheckoutApi } from './createCollectorCheckoutApi';\r\n\r\ntype Context = {\r\n clientHost: Uri;\r\n log: Log;\r\n init: () => void;\r\n walley: WalleyGlobal;\r\n};\r\n\r\nexport const createCollectorGlobal = ({\r\n clientHost,\r\n log,\r\n init,\r\n walley,\r\n}: Context): CollectorGlobal => {\r\n const collector = window.collector ?? {};\r\n const checkout = collector.checkout ?? {};\r\n checkout.api =\r\n collector.checkout?.api ??\r\n createCollectorCheckoutApi({\r\n clientHost,\r\n log,\r\n walley,\r\n init,\r\n });\r\n\r\n collector.checkout = checkout;\r\n window.collector = collector;\r\n\r\n return collector;\r\n};\r\n","import { Log, Token, WalleyCheckoutApi, WalleyGlobal } from '@walley/domain';\r\nimport { sendResume, sendSuspend } from '@walley/interaction';\r\nimport { Uri, isFunction } from '@walley/language';\r\nimport { sendUpdate } from './sendUpdate';\r\n\r\ntype CreateWalleyCheckoutApiPayload = {\r\n clientHost: Uri;\r\n log: Log;\r\n walley: WalleyGlobal;\r\n};\r\n\r\nexport const createWalleyCheckoutApi = ({\r\n clientHost,\r\n log,\r\n walley,\r\n}: CreateWalleyCheckoutApiPayload): WalleyCheckoutApi => {\r\n const loaderContext = { clientHost, log, walley };\r\n\r\n const update = () => sendUpdate(loaderContext);\r\n const suspend = (token?: Token) => sendSuspend(token, loaderContext);\r\n const resume = (token?: Token) => sendResume(token, loaderContext);\r\n\r\n const onBeforePayment = (callback?: () => Promise) => {\r\n const logSetOnBeforePayment = (message: string) => {\r\n log.info({\r\n messageTemplate: `onBeforePayment: ${message}`,\r\n moduleName: 'index',\r\n functionName: 'onBeforePayment',\r\n });\r\n };\r\n\r\n if (callback && !isFunction(callback)) {\r\n const message = 'The provided callback must be a function';\r\n logSetOnBeforePayment(message);\r\n throw new Error(message);\r\n }\r\n\r\n logSetOnBeforePayment(\r\n `Setting callback to ${callback ? 'a function' : 'null'}`\r\n );\r\n\r\n // eslint-disable-next-line no-underscore-dangle\r\n walley.checkout._state.onBeforePayment = callback;\r\n };\r\n\r\n return {\r\n suspend,\r\n resume,\r\n update,\r\n onBeforePayment,\r\n };\r\n};\r\n","import {\r\n IntegrationName,\r\n WalleyCheckoutState,\r\n createIntegrationId,\r\n} from '@walley/domain';\r\n\r\nexport const createWalleyCheckoutState = (\r\n name: IntegrationName\r\n): WalleyCheckoutState =>\r\n ({\r\n initiated: false,\r\n id: createIntegrationId(name),\r\n }) satisfies WalleyCheckoutState;\r\n","/* eslint-disable no-underscore-dangle */\r\nimport {\r\n IntegrationNameLoader,\r\n Log,\r\n Version,\r\n WalleyGlobal,\r\n} from '@walley/domain';\r\nimport { Uri } from '@walley/language';\r\nimport { createWalleyCheckoutApi } from './createWalleyCheckoutApi';\r\nimport { createWalleyCheckoutState } from './createWalleyCheckoutState';\r\n\r\ntype Context = {\r\n version: Version;\r\n clientHost: Uri;\r\n log: Log;\r\n};\r\n\r\nexport const createWalleyGlobal = ({\r\n version,\r\n clientHost,\r\n log,\r\n}: Context): WalleyGlobal => {\r\n const walley = window.walley ?? {};\r\n const loader = walley.loader ?? {\r\n version,\r\n };\r\n\r\n const checkout = walley.checkout ?? {};\r\n checkout.api =\r\n walley.checkout?.api ??\r\n createWalleyCheckoutApi({ clientHost, log, walley });\r\n checkout._state =\r\n checkout._state ?? createWalleyCheckoutState(IntegrationNameLoader);\r\n\r\n walley.loader = loader;\r\n walley.checkout = checkout;\r\n window.walley = walley;\r\n\r\n return walley;\r\n};\r\n","import { Version, toLogLevel } from '@walley/domain';\r\nimport { jsonStringify, toUri } from '@walley/language';\r\n\r\nexport const getConfigOrThrowException = () => {\r\n const apiHost = toUri(import.meta.env.WALLEY_API_HOST);\r\n const clientHost = toUri(import.meta.env.WALLEY_CLIENT_HOST);\r\n const commit = import.meta.env.WALLEY_COMMIT;\r\n const logLevelClient = toLogLevel(import.meta.env.WALLEY_LOG_LEVEL_CLIENT);\r\n const logLevelServer = toLogLevel(import.meta.env.WALLEY_LOG_LEVEL_SERVER);\r\n const version = import.meta.env.WALLEY_VERSION as Version;\r\n\r\n if (!(apiHost && clientHost && logLevelClient && logLevelServer)) {\r\n throw new Error(\r\n `Misconfigured ${jsonStringify({\r\n apiHost,\r\n clientHost,\r\n logLevelClient,\r\n logLevelServer,\r\n })}`\r\n );\r\n }\r\n\r\n return {\r\n apiHost,\r\n clientHost,\r\n commit,\r\n logLevelClient,\r\n logLevelServer,\r\n version,\r\n };\r\n};\r\n","import { getAttribute } from '@walley/interaction';\r\nimport { LoaderScriptAttributes } from './LoaderScriptAttributes';\r\nimport { getTokenAttribute } from './getTokenAttribute';\r\n\r\nexport const loaderAttributeInitialized = 'data-initialized';\r\n\r\nexport const getLoaderScriptAttributes = (\r\n script: HTMLScriptElement\r\n): LoaderScriptAttributes => ({\r\n token: getTokenAttribute(script),\r\n version: getAttribute(script, 'data-version'),\r\n lang: getAttribute(script, 'data-lang', 'lang'),\r\n widget: getAttribute(script, 'data-widget'),\r\n debug: getAttribute(script, 'data-debug'),\r\n rememberMeOptOut: getAttribute(script, 'data-remember-me-opt-out'),\r\n containerId: getAttribute(script, 'data-container-id'),\r\n padding: getAttribute(script, 'data-padding'),\r\n actionColor: getAttribute(script, 'data-action-color'),\r\n actionTextColor: getAttribute(script, 'data-action-text-color'),\r\n amount: getAttribute(script, 'data-amount'),\r\n payLink: getAttribute(script, 'data-paylink'),\r\n showCart: getAttribute(script, 'data-showcart'),\r\n headless: getAttribute(script, 'data-headless'),\r\n webView: getAttribute(script, 'data-webview'),\r\n initialized: getAttribute(script, loaderAttributeInitialized),\r\n overrides: getAttribute(script, 'data-overrides'),\r\n pollRetries: getAttribute(script, 'data-poll-retries'),\r\n pollWaitTime: getAttribute(script, 'data-poll-wait-time'),\r\n});\r\n","import { toToken } from '@walley/domain';\r\nimport {\r\n InitIntegrationData,\r\n IntegrationOverrides,\r\n getDocumentLanguage,\r\n} from '@walley/interaction';\r\nimport {\r\n Uri,\r\n isNonWhitespaceString,\r\n jsonParse,\r\n stringToBoolean,\r\n toNumber,\r\n} from '@walley/language';\r\nimport { LoaderScriptAttributes } from './LoaderScriptAttributes';\r\n\r\nexport const loaderScriptAttributesToInitData = (\r\n attributes: LoaderScriptAttributes,\r\n clientHost: Uri\r\n): InitIntegrationData | undefined => {\r\n const token = toToken(attributes.token);\r\n return token\r\n ? {\r\n token,\r\n padding: attributes.padding !== 'none',\r\n containerId: isNonWhitespaceString(attributes.containerId)\r\n ? attributes.containerId\r\n : undefined,\r\n widget: attributes.widget,\r\n version: attributes.version,\r\n lang: attributes.lang || getDocumentLanguage(),\r\n headless: stringToBoolean(attributes.headless),\r\n debug: stringToBoolean(attributes.debug),\r\n payLink: stringToBoolean(attributes.payLink),\r\n rememberMeOptOut: stringToBoolean(attributes.rememberMeOptOut),\r\n showCart: stringToBoolean(attributes.showCart),\r\n webView: stringToBoolean(attributes.webView),\r\n actionColor: attributes.actionColor,\r\n actionTextColor: attributes.actionTextColor,\r\n amount: toNumber(attributes.amount),\r\n clientHost,\r\n overrides: jsonParse(attributes.overrides),\r\n pollRetries: toNumber(attributes.pollRetries),\r\n pollWaitTime: toNumber(attributes.pollWaitTime),\r\n }\r\n : undefined;\r\n};\r\n","import { Log } from '@walley/domain';\r\nimport { renderCheckout, setElementAttribute } from '@walley/interaction';\r\nimport { Uri } from '@walley/language';\r\nimport {\r\n getLoaderScriptAttributes,\r\n loaderAttributeInitialized,\r\n} from './getLoaderScriptData';\r\nimport { loaderScriptAttributesToInitData } from './loaderScriptAttributesToInitData';\r\n\r\nexport const initLoaderScript = (\r\n script: HTMLScriptElement,\r\n clientHost: Uri,\r\n log: Log\r\n) => {\r\n const attributes = getLoaderScriptAttributes(script);\r\n const data = loaderScriptAttributesToInitData(attributes, clientHost);\r\n\r\n if (attributes.initialized) {\r\n return;\r\n }\r\n\r\n if (!data?.token) {\r\n log.info({\r\n moduleName: 'initLoaderScript',\r\n messageTemplate: 'Token {PublicToken} is invalid',\r\n messageTemplateParameters: [attributes.token],\r\n });\r\n return;\r\n }\r\n\r\n renderCheckout({ data, log, script });\r\n\r\n setElementAttribute(script, loaderAttributeInitialized, 'true');\r\n};\r\n","/* eslint-disable no-underscore-dangle */\r\n\r\nimport { toToken } from '@walley/domain';\r\nimport {\r\n createLog,\r\n isBrowserSupported,\r\n registerIntegrationErrorHandler,\r\n registerIntegrationMessageHandler,\r\n} from '@walley/interaction';\r\nimport 'unfetch/polyfill';\r\nimport { createCollectorGlobal } from './helpers/createCollectorGlobal';\r\nimport { createWalleyGlobal } from './helpers/createWalleyGlobal';\r\nimport { getAllLoaderScripts } from './helpers/getAllLoaderScripts';\r\nimport { getConfigOrThrowException } from './helpers/getConfigOrThrowException';\r\nimport { getTokenAttribute } from './helpers/getTokenAttribute';\r\nimport { initLoaderScript } from './helpers/initLoaderScript';\r\nimport { isLoaderScriptSrc } from './helpers/isLoaderScriptSrc';\r\n\r\nconst { apiHost, clientHost, commit, logLevelClient, logLevelServer, version } =\r\n getConfigOrThrowException();\r\n\r\nconst log = createLog({\r\n sourceSystem: 'Walley.Checkout.Loader',\r\n apiHost,\r\n commit,\r\n logLevelClient,\r\n logLevelServer,\r\n version,\r\n console,\r\n});\r\n\r\nconst init = () =>\r\n getAllLoaderScripts()\r\n .reverse()\r\n .forEach(script => initLoaderScript(script, clientHost, log));\r\n\r\nconst walley = createWalleyGlobal({ version, clientHost, log });\r\ncreateCollectorGlobal({ clientHost, log, init, walley });\r\nconst { checkout } = walley;\r\n\r\nif (!checkout._state.initiated && isBrowserSupported()) {\r\n registerIntegrationMessageHandler({\r\n walley,\r\n clientHost,\r\n log,\r\n });\r\n registerIntegrationErrorHandler({\r\n walley,\r\n log,\r\n isInternalScript: isLoaderScriptSrc,\r\n logPropertiesEnricher: () => ({\r\n publicToken: getAllLoaderScripts()\r\n .map(script => toToken(getTokenAttribute(script)))\r\n .filter(token => token)\r\n .join(' or '),\r\n ...checkout._state.activeEvent,\r\n }),\r\n });\r\n checkout._state.initiated = true;\r\n}\r\n\r\ninit();\r\n"],"names":["isFunction","value","callOptionalFunction","func","args","isNull","isUndefined","isDefined","isObject","isPlainObject","prototype","isEmptyString","isString","isNonEmptyString","isWhitespaceString","isNonWhitespaceString","isUndefinedOrNull","isUndefinedNullOrWhitespace","removeWhitespace","isNumber","isValidNumber","getDecimalSeparator","locale","fallback","_a","part","decimalSeparator","stringToNumber","cleanValue","parseNumber","toNumber","number","truncateString","maxLength","getObjectEntries","obj","_","getPlainObjectEntries","isEmptyObject","isEmptyPlainObject","isEmptyValue","isEmptyArray","isNonEmptyValue","toHexadecimal","createRandomNumber","createRandomId","jsonParse","throwError","safeAccess","key","prop","error","jsonStringify","objectValue","format","seen","isArray","result","toObject","parsed","isError","isErrorLike","isErrorEvent","isEvent","toErrorLike","plainError","toPlainObject","toPlainObjectValue","toPlainObjectInner","plainObj","err","withoutEmptyValues","acc","k","property","propertyValue","isEmpty","isNonEmpty","isSet","arrayFilterNonNullable","array","predicate","item","arrayFrom","isNonEmptyArray","stringToBoolean","isDate","isEnum","enumType","toEnum","isPromise","appendUriQueryValue","target","serializedValue","path","query","separator","appendUriQuery","concatUri","uri","uriParts","i","u","ensureUriEndingSlash","isUri","toUri","getUriOrigin","url","removeUriQuery","IntegrationNameCheckoutV2","IntegrationNameWidgetPartPayment","IntegrationNameModal","IntegrationNameSpinner","IntegrationNameLoader","createIntegrationId","name","toIntegrationId","integrationName","id","Country","toCountry","LogLevel","logLevels","isLogLevelAbove","currentLogLevel","minLogLevel","normalizeLogProperty","normalizeLogProperties","properties","normalizeMessageTemplateParameters","values","renderMessageTemplateParameter","quoteString","v","renderMessageTemplate","messageTemplate","messageTemplateParameters","renderedMessageTemplate","renderedMessage","messageTemplateParameter","root","factory","module","this","_isNumber","n","_capitalize","str","_getter","p","booleanProps","numericProps","stringProps","arrayProps","objectProps","props","StackFrame","fileName","lineNumber","columnNumber","functionName","argsStartIndex","argsEndIndex","locationString","parts","j","require$$0","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","urlLike","regExp","filtered","line","sanitizedLine","location","locationParts","functionNameRegex","matches","e","lineRE","lines","len","match","tokens","functionCall","argsRaw","opts","stack","maxStackSize","curr","getArg","aArgs","aName","aDefaultValue","exports","urlRegexp","dataUrlRegexp","urlParse","aUrl","urlGenerate","aParsedUrl","normalize","aPath","isAbsolute","up","join","aRoot","aPathUrl","aRootUrl","joined","relative","level","index","supportsNullProto","identity","s","toSetString","aStr","isProtoString","fromSetString","length","compareByOriginalPositions","mappingA","mappingB","onlyCompareOriginal","cmp","compareByGeneratedPositionsDeflated","onlyCompareGenerated","strcmp","aStr1","aStr2","compareByGeneratedPositionsInflated","recursiveSearch","aLow","aHigh","aNeedle","aHaystack","aCompare","aBias","mid","util","has","ArraySet","aArray","aAllowDuplicates","set","sStr","isDuplicate","idx","aIdx","arraySet","intToCharMap","base64","charCode","bigA","bigZ","littleA","littleZ","zero","nine","plus","slash","littleOffset","numberOffset","VLQ_BASE_SHIFT","VLQ_BASE","VLQ_BASE_MASK","VLQ_CONTINUATION_BIT","toVLQSigned","aValue","fromVLQSigned","isNegative","shifted","base64Vlq","encoded","digit","vlq","aIndex","aOutParam","strLen","shift","continuation","swap","ary","x","y","temp","randomIntInRange","low","high","doQuickSort","comparator","r","pivotIndex","pivot","q","quickSort","binarySearch","require$$1","require$$2","base64VLQ","require$$3","require$$4","SourceMapConsumer","aSourceMap","sourceMap","IndexedSourceMapConsumer","BasicSourceMapConsumer","c","aSourceRoot","aCallback","aContext","aOrder","context","order","mappings","sourceRoot","mapping","source","needle","originalLine","originalColumn","sourceMapConsumer","version","sources","names","sourcesContent","file","smc","generatedMappings","destGeneratedMappings","destOriginalMappings","srcMapping","destMapping","Mapping","generatedLine","previousGeneratedColumn","previousOriginalLine","previousOriginalColumn","previousSource","previousName","cachedSegments","originalMappings","segment","end","aMappings","aLineName","aColumnName","aComparator","nextMapping","sc","aSource","nullOnMissing","fileUriAbsPath","sections","lastOffset","offset","offsetLine","offsetColumn","sectionIndex","section","content","generatedPosition","ret","sectionMappings","adjustedMapping","SourceMap","_xdr","resolve","reject","req","_atob","b64str","_parseJson","string","_findFunctionName","syntaxes","code","maxLines","commentPos","m","_ensureSupportedEnvironment","_ensureStackFrameIsLegit","stackframe","_findSourceMappingURL","sourceMappingUrlRegExp","lastSourceMappingUrl","matchSourceMappingUrl","_extractLocationInfoFromSourceMapSource","sourceCache","loc","mappedSource","StackTraceGPS","isDataUrl","supportedEncodingRegexp","sourceMapStart","encodedSource","xhrPromise","sourceMappingURL","defaultSourceRoot","sourceMapConsumerPromise","sourceMapSource","mappedStackFrame","resolveMappedStackFrame","guessedFunctionName","ErrorStackParser","StackGenerator","_options","_generateError","_merge","first","second","_isShapedLikeParsableError","_filtered","stackframes","filter","gps","sf","resolveOriginal","stackFrames","fn","callback","errback","thisArg","instrumented","errorMsg","requestOptions","headers","header","reportPayload","formatStackFrame","frame","_b","resolveErrorStack","exception","resolvedStack","fromError","isLogLevel","logLevel","toLogLevel","MerchantEventType","MessageType","tokenPattern","parseToken","token","type","countryCode","ref","isBitSetInToken","position","bitmask","defaultValue","toToken","HttpError","message","httpMethod","requestUri","statusCode","logged","connectionError","defaultTimeout","defaultFetch","http","optionTimeout","method","body","keepalive","fetch","controller","timeout","httpPost","options","defaultHeaders","getApiRequestOptions","overrides","apiHost","publicToken","paymentToken","isPayLink","isWebView","apiPostRaw","payload","setElementAttributes","element","attributes","createElement","createDivElement","createIframeElement","dispatchEvent","detail","getAttribute","getDocumentLanguage","getElementById","getElementsByTagName","qualifiedName","getLocationUri","insertElement","container","postMessage","targetOrigin","targetWindow","querySelector","selector","querySelectorAll","redirect","removeElementAttribute","setElementAttribute","setElementHeight","height","IFRAME_ID_PREFIX","VARIANT_B2C","VARIANT_B2B","VARIANT_WIDGET","PADDING","IFRAME_DEFAULT_HEIGHT","ANIMATION_DELAY","EVENT_PREFIXES","WALLEY_STORAGE_KEY","createIntegrationIframe","title","src","integrationId","event","createIntegrationSpinner","spinner","inner","createDot","dots","dot","animateLoader","delay","currentDot","getClientUri","clientHost","getIntegrationSelector","getIntegrationIframeSelector","getIntegrationIframe","missingFor","withTarget","targetName","getUnsupportedFeatures","isBrowserSupported","sendMessage","sourceId","targetId","getIntegrationIframes","moduleName","sendMessageToIntegrationIframes","messageSourceId","log","walley","iframe","iframeToken","queuedMessages","sendResume","sendSuspend","registerIntegrationErrorHandler","isInternalScript","logPropertiesEnricher","onWindowError","internalError","parseMessage","isValidOrigin","origin","handleBroadcastMessage","removeIntegrationSpinner","handleHeightSetMessage","getIntegrationModalIframe","modalOpenClassName","removeIntegrationModalIframe","modalIframe","handleHideModalMessage","lockedAttributeName","setElementLocked","locked","handleMerchantEventMessage","prefix","getType","handleOldMerchantEventMessage","handleOnBeforePaymentMessage","sendResponse","sendErrorResponse","sendSuccessResponse","logOnBeforePayment","entry","onBeforePayment","promise","sendQueuedMessageToIntegrationIframes","queuedMessage","handleReadyMessage","handleRedirectMessage","handleRelayMessage","MemoryStorage","initial","clientStorage","storage","parent","test","getStorage","getStorageItem","getStorageData","rawData","removeStorageItem","setStorageItem","setStorageData","getWalleyStorage","getVariantPath","data","getFeatures","getWidgetClientUri","pathParts","getIntegrationUri","clientUri","getMaxZIndex","appendIntegrationModalIframe","onload","initData","wrapper","handleShowModalMessage","sendModalShown","existingIframe","setWalleyStorage","handleStoreParameterMessage","walleyStorage","handleNoopMessage","getHandleMessageFunction","getDemoIframe","registerIntegrationMessageHandler","onWindowMessage","logOnMessage","handleMessage","noPaddingCssText","getIntegrationName","createIframe","iframeElement","createNotSupportedDiv","div","createIntegrationContent","unsupportedFeatures","insertIntegrationContent","script","containerId","renderCheckout","createLogContext","config","logClient","logEntry","logLevelClient","console","unknownErrorName","unknownErrorMessage","logTimeout","duplicateLogSlidingTimeout","resolveException","getMessageTemplate","post","getRequestPayload","request","_c","logServerInternal","postLogRequest","getSourceContext","sourceSystem","getLogProperties","commit","machineName","country","parentUrl","getApiHost","apiHostOverrides","lastLogToken","logDuplicateLogRequests","renderLogString","isDuplicateLogRequest","logString","timestamp","logServer","allowDuplicates","logLevelServer","skipServerLogging","createLogFunction","eventLog","postEventRequest","createLog","enricher","getAllScripts","isLoaderScriptSrc","isLoaderScript","getAllLoaderScripts","getTokenAttribute","sendUpdate","loaderContext","amount","createCollectorCheckoutApi","init","createCollectorGlobal","collector","checkout","createWalleyCheckoutApi","logSetOnBeforePayment","createWalleyCheckoutState","createWalleyGlobal","loader","getConfigOrThrowException","loaderAttributeInitialized","getLoaderScriptAttributes","loaderScriptAttributesToInitData","initLoaderScript"],"mappings":"CAAO,UAAA,CAAA,aAAA,MAAMA,EACTC,GAEA,OAAOA,GAAU,WCERC,EAAuB,CAChCC,KACGC,IAC0BJ,EAAWG,CAAI,EAAIA,EAAK,GAAGC,CAAI,EAAI,OCRvDC,GAAUJ,GAAkCA,IAAU,KCAtDK,GAAeL,GACxBA,IAAU,OCEDM,EAAgBN,GACzB,EAAEK,GAAYL,CAAK,GAAKI,GAAOJ,CAAK,GCF3BO,EAAYP,GACrB,CAAC,CAACA,GAAS,OAAOA,GAAU,SCAnBQ,EACTR,GACa,CACT,GAAA,CAACO,EAASP,CAAK,EACR,MAAA,GAGL,MAAAS,EAAY,OAAO,eAAeT,CAAK,EAE7C,OACKS,IAAc,MACXA,IAAc,OAAO,WACrB,OAAO,eAAeA,CAAS,IAAM,OACzC,EAAE,OAAO,eAAeT,IACxB,EAAE,OAAO,YAAYA,EAE7B,ECnBaU,EAAiBV,GAAoCA,IAAU,GCA/DW,EAAYX,GACrB,OAAO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