1 | {"version":3,"file":"bundle.es6.min.js","sources":["../../types/src/loglevel.ts","../../types/src/session.ts","../../types/src/severity.ts","../../types/src/status.ts","../../utils/src/is.ts","../../utils/src/browser.ts","../../utils/src/polyfill.ts","../../utils/src/error.ts","../../utils/src/dsn.ts","../../utils/src/memo.ts","../../utils/src/stacktrace.ts","../../utils/src/string.ts","../../utils/src/object.ts","../../utils/src/node.ts","../../utils/src/misc.ts","../../utils/src/logger.ts","../../utils/src/supports.ts","../../utils/src/instrument.ts","../../utils/src/syncpromise.ts","../../utils/src/promisebuffer.ts","../../utils/src/time.ts","../../hub/src/scope.ts","../../hub/src/session.ts","../../hub/src/hub.ts","../../minimal/src/index.ts","../../core/src/api.ts","../../core/src/integration.ts","../../core/src/baseclient.ts","../../core/src/transports/noop.ts","../../core/src/basebackend.ts","../../core/src/request.ts","../../core/src/integrations/functiontostring.ts","../../core/src/integrations/inboundfilters.ts","../src/tracekit.ts","../src/parsers.ts","../src/eventbuilder.ts","../src/transports/base.ts","../src/transports/fetch.ts","../src/transports/xhr.ts","../src/backend.ts","../src/helpers.ts","../src/integrations/globalhandlers.ts","../src/integrations/trycatch.ts","../src/integrations/breadcrumbs.ts","../src/integrations/linkederrors.ts","../src/integrations/useragent.ts","../src/version.ts","../src/client.ts","../src/sdk.ts","../src/index.ts","../../core/src/sdk.ts"],"sourcesContent":["/** Console logging verbosity for the SDK. */\nexport enum LogLevel {\n /** No logs will be generated. */\n None = 0,\n /** Only SDK internal errors will be logged. */\n Error = 1,\n /** Information useful for debugging the SDK will be logged. */\n Debug = 2,\n /** All SDK actions will be logged. */\n Verbose = 3,\n}\n","import { User } from './user';\n\n/**\n * @inheritdoc\n */\nexport interface Session extends SessionContext {\n /** JSDoc */\n update(context?: SessionContext): void;\n\n /** JSDoc */\n close(status?: SessionStatus): void;\n\n /** JSDoc */\n toJSON(): {\n init: boolean;\n sid: string;\n did?: string;\n timestamp: string;\n started: string;\n duration: number;\n status: SessionStatus;\n errors: number;\n attrs?: {\n release?: string;\n environment?: string;\n user_agent?: string;\n ip_address?: string;\n };\n };\n}\n\n/**\n * Session Context\n */\nexport interface SessionContext {\n sid?: string;\n did?: string;\n timestamp?: number;\n started?: number;\n duration?: number;\n status?: SessionStatus;\n release?: string;\n environment?: string;\n userAgent?: string;\n ipAddress?: string;\n errors?: number;\n user?: User | null;\n}\n\n/**\n * Session Status\n */\nexport enum SessionStatus {\n /** JSDoc */\n Ok = 'ok',\n /** JSDoc */\n Exited = 'exited',\n /** JSDoc */\n Crashed = 'crashed',\n /** JSDoc */\n Abnormal = 'abnormal',\n}\n","/** JSDoc */\n// eslint-disable-next-line import/export\nexport enum Severity {\n /** JSDoc */\n Fatal = 'fatal',\n /** JSDoc */\n Error = 'error',\n /** JSDoc */\n Warning = 'warning',\n /** JSDoc */\n Log = 'log',\n /** JSDoc */\n Info = 'info',\n /** JSDoc */\n Debug = 'debug',\n /** JSDoc */\n Critical = 'critical',\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace Severity {\n /**\n * Converts a string-based level into a {@link Severity}.\n *\n * @param level string representation of Severity\n * @returns Severity\n */\n export function fromString(level: string): Severity {\n switch (level) {\n case 'debug':\n return Severity.Debug;\n case 'info':\n return Severity.Info;\n case 'warn':\n case 'warning':\n return Severity.Warning;\n case 'error':\n return Severity.Error;\n case 'fatal':\n return Severity.Fatal;\n case 'critical':\n return Severity.Critical;\n case 'log':\n default:\n return Severity.Log;\n }\n }\n}\n","/** The status of an event. */\n// eslint-disable-next-line import/export\nexport enum Status {\n /** The status could not be determined. */\n Unknown = 'unknown',\n /** The event was skipped due to configuration or callbacks. */\n Skipped = 'skipped',\n /** The event was sent to Sentry successfully. */\n Success = 'success',\n /** The client is currently rate limited and will try again later. */\n RateLimit = 'rate_limit',\n /** The event could not be processed. */\n Invalid = 'invalid',\n /** A server-side error ocurred during submission. */\n Failed = 'failed',\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace Status {\n /**\n * Converts a HTTP status code into a {@link Status}.\n *\n * @param code The HTTP response status code.\n * @returns The send status or {@link Status.Unknown}.\n */\n export function fromHttpCode(code: number): Status {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n\n if (code === 429) {\n return Status.RateLimit;\n }\n\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n\n if (code >= 500) {\n return Status.Failed;\n }\n\n return Status.Unknown;\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/**\n * Checks whether given value's type is one of a few Error or Error-like\n * {@link isError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isError(wat: any): boolean {\n switch (Object.prototype.toString.call(wat)) {\n case '[object Error]':\n return true;\n case '[object Exception]':\n return true;\n case '[object DOMException]':\n return true;\n default:\n return isInstanceOf(wat, Error);\n }\n}\n\n/**\n * Checks whether given value's type is ErrorEvent\n * {@link isErrorEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isErrorEvent(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object ErrorEvent]';\n}\n\n/**\n * Checks whether given value's type is DOMError\n * {@link isDOMError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMError(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object DOMError]';\n}\n\n/**\n * Checks whether given value's type is DOMException\n * {@link isDOMException}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMException(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object DOMException]';\n}\n\n/**\n * Checks whether given value's type is a string\n * {@link isString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isString(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object String]';\n}\n\n/**\n * Checks whether given value's is a primitive (undefined, null, number, boolean, string)\n * {@link isPrimitive}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPrimitive(wat: any): boolean {\n return wat === null || (typeof wat !== 'object' && typeof wat !== 'function');\n}\n\n/**\n * Checks whether given value's type is an object literal\n * {@link isPlainObject}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPlainObject(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object Object]';\n}\n\n/**\n * Checks whether given value's type is an Event instance\n * {@link isEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isEvent(wat: any): boolean {\n return typeof Event !== 'undefined' && isInstanceOf(wat, Event);\n}\n\n/**\n * Checks whether given value's type is an Element instance\n * {@link isElement}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isElement(wat: any): boolean {\n return typeof Element !== 'undefined' && isInstanceOf(wat, Element);\n}\n\n/**\n * Checks whether given value's type is an regexp\n * {@link isRegExp}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isRegExp(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object RegExp]';\n}\n\n/**\n * Checks whether given value has a then function.\n * @param wat A value to be checked.\n */\nexport function isThenable(wat: any): boolean {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return Boolean(wat && wat.then && typeof wat.then === 'function');\n}\n\n/**\n * Checks whether given value's type is a SyntheticEvent\n * {@link isSyntheticEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isSyntheticEvent(wat: any): boolean {\n return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;\n}\n/**\n * Checks whether given value's type is an instance of provided constructor.\n * {@link isInstanceOf}.\n *\n * @param wat A value to be checked.\n * @param base A constructor to be used in a check.\n * @returns A boolean representing the result.\n */\nexport function isInstanceOf(wat: any, base: any): boolean {\n try {\n return wat instanceof base;\n } catch (_e) {\n return false;\n }\n}\n","import { isString } from './is';\n\n/**\n * Given a child DOM element, returns a query-selector statement describing that\n * and its ancestors\n * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nexport function htmlTreeAsString(elem: unknown): string {\n type SimpleNode = {\n parentNode: SimpleNode;\n } | null;\n\n // try/catch both:\n // - accessing event.target (see getsentry/raven-js#838, #768)\n // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly\n // - can throw an exception in some circumstances.\n try {\n let currentElem = elem as SimpleNode;\n const MAX_TRAVERSE_HEIGHT = 5;\n const MAX_OUTPUT_LEN = 80;\n const out = [];\n let height = 0;\n let len = 0;\n const separator = ' > ';\n const sepLength = separator.length;\n let nextStr;\n\n // eslint-disable-next-line no-plusplus\n while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = _htmlElementAsString(currentElem);\n // bail out if\n // - nextStr is the 'html' element\n // - the length of the string that would be created exceeds MAX_OUTPUT_LEN\n // (ignore this limit if we are on the first iteration)\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {\n break;\n }\n\n out.push(nextStr);\n\n len += nextStr.length;\n currentElem = currentElem.parentNode;\n }\n\n return out.reverse().join(separator);\n } catch (_oO) {\n return '<unknown>';\n }\n}\n\n/**\n * Returns a simple, query-selector representation of a DOM element\n * e.g. [HTMLElement] => input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nfunction _htmlElementAsString(el: unknown): string {\n const elem = el as {\n tagName?: string;\n id?: string;\n className?: string;\n getAttribute(key: string): string;\n };\n\n const out = [];\n let className;\n let classes;\n let key;\n let attr;\n let i;\n\n if (!elem || !elem.tagName) {\n return '';\n }\n\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push(`#${elem.id}`);\n }\n\n // eslint-disable-next-line prefer-const\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push(`.${classes[i]}`);\n }\n }\n const allowedAttrs = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < allowedAttrs.length; i++) {\n key = allowedAttrs[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push(`[${key}=\"${attr}\"]`);\n }\n }\n return out.join('');\n}\n","export const setPrototypeOf =\n Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);\n\n/**\n * setPrototypeOf polyfill using __proto__\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction setProtoOf<TTarget extends object, TProto>(obj: TTarget, proto: TProto): TTarget & TProto {\n // @ts-ignore __proto__ does not exist on obj\n obj.__proto__ = proto;\n return obj as TTarget & TProto;\n}\n\n/**\n * setPrototypeOf polyfill using mixin\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction mixinProperties<TTarget extends object, TProto>(obj: TTarget, proto: TProto): TTarget & TProto {\n for (const prop in proto) {\n // eslint-disable-next-line no-prototype-builtins\n if (!obj.hasOwnProperty(prop)) {\n // @ts-ignore typescript complains about indexing so we remove\n obj[prop] = proto[prop];\n }\n }\n\n return obj as TTarget & TProto;\n}\n","import { setPrototypeOf } from './polyfill';\n\n/** An error emitted by Sentry SDKs and related utilities. */\nexport class SentryError extends Error {\n /** Display name of this error instance. */\n public name: string;\n\n public constructor(public message: string) {\n super(message);\n\n this.name = new.target.prototype.constructor.name;\n setPrototypeOf(this, new.target.prototype);\n }\n}\n","import { DsnComponents, DsnLike, DsnProtocol } from '@sentry/types';\n\nimport { SentryError } from './error';\n\n/** Regular expression used to parse a Dsn. */\nconst DSN_REGEX = /^(?:(\\w+):)\\/\\/(?:(\\w+)(?::(\\w+))?@)([\\w.-]+)(?::(\\d+))?\\/(.+)/;\n\n/** Error message */\nconst ERROR_MESSAGE = 'Invalid Dsn';\n\n/** The Sentry Dsn, identifying a Sentry instance and project. */\nexport class Dsn implements DsnComponents {\n /** Protocol used to connect to Sentry. */\n public protocol!: DsnProtocol;\n /** Public authorization key. */\n public user!: string;\n /** Private authorization key (deprecated, optional). */\n public pass!: string;\n /** Hostname of the Sentry instance. */\n public host!: string;\n /** Port of the Sentry instance. */\n public port!: string;\n /** Path */\n public path!: string;\n /** Project ID */\n public projectId!: string;\n\n /** Creates a new Dsn component */\n public constructor(from: DsnLike) {\n if (typeof from === 'string') {\n this._fromString(from);\n } else {\n this._fromComponents(from);\n }\n\n this._validate();\n }\n\n /**\n * Renders the string representation of this Dsn.\n *\n * By default, this will render the public representation without the password\n * component. To get the deprecated private representation, set `withPassword`\n * to true.\n *\n * @param withPassword When set to true, the password will be included.\n */\n public toString(withPassword: boolean = false): string {\n const { host, path, pass, port, projectId, protocol, user } = this;\n return (\n `${protocol}://${user}${withPassword && pass ? `:${pass}` : ''}` +\n `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`\n );\n }\n\n /** Parses a string into this Dsn. */\n private _fromString(str: string): void {\n const match = DSN_REGEX.exec(str);\n\n if (!match) {\n throw new SentryError(ERROR_MESSAGE);\n }\n\n const [protocol, user, pass = '', host, port = '', lastPath] = match.slice(1);\n let path = '';\n let projectId = lastPath;\n\n const split = projectId.split('/');\n if (split.length > 1) {\n path = split.slice(0, -1).join('/');\n projectId = split.pop() as string;\n }\n\n if (projectId) {\n const projectMatch = projectId.match(/^\\d+/);\n if (projectMatch) {\n projectId = projectMatch[0];\n }\n }\n\n this._fromComponents({ host, pass, path, projectId, port, protocol: protocol as DsnProtocol, user });\n }\n\n /** Maps Dsn components into this instance. */\n private _fromComponents(components: DsnComponents): void {\n this.protocol = components.protocol;\n this.user = components.user;\n this.pass = components.pass || '';\n this.host = components.host;\n this.port = components.port || '';\n this.path = components.path || '';\n this.projectId = components.projectId;\n }\n\n /** Validates this Dsn and throws on error. */\n private _validate(): void {\n ['protocol', 'user', 'host', 'projectId'].forEach(component => {\n if (!this[component as keyof DsnComponents]) {\n throw new SentryError(`${ERROR_MESSAGE}: ${component} missing`);\n }\n });\n\n if (!this.projectId.match(/^\\d+$/)) {\n throw new SentryError(`${ERROR_MESSAGE}: Invalid projectId ${this.projectId}`);\n }\n\n if (this.protocol !== 'http' && this.protocol !== 'https') {\n throw new SentryError(`${ERROR_MESSAGE}: Invalid protocol ${this.protocol}`);\n }\n\n if (this.port && isNaN(parseInt(this.port, 10))) {\n throw new SentryError(`${ERROR_MESSAGE}: Invalid port ${this.port}`);\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/**\n * Memo class used for decycle json objects. Uses WeakSet if available otherwise array.\n */\nexport class Memo {\n /** Determines if WeakSet is available */\n private readonly _hasWeakSet: boolean;\n /** Either WeakSet or Array */\n private readonly _inner: any;\n\n public constructor() {\n this._hasWeakSet = typeof WeakSet === 'function';\n this._inner = this._hasWeakSet ? new WeakSet() : [];\n }\n\n /**\n * Sets obj to remember.\n * @param obj Object to remember\n */\n public memoize(obj: any): boolean {\n if (this._hasWeakSet) {\n if (this._inner.has(obj)) {\n return true;\n }\n this._inner.add(obj);\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < this._inner.length; i++) {\n const value = this._inner[i];\n if (value === obj) {\n return true;\n }\n }\n this._inner.push(obj);\n return false;\n }\n\n /**\n * Removes object from internal storage.\n * @param obj Object to forget\n */\n public unmemoize(obj: any): void {\n if (this._hasWeakSet) {\n this._inner.delete(obj);\n } else {\n for (let i = 0; i < this._inner.length; i++) {\n if (this._inner[i] === obj) {\n this._inner.splice(i, 1);\n break;\n }\n }\n }\n }\n}\n","const defaultFunctionName = '<anonymous>';\n\n/**\n * Safely extract function name from itself\n */\nexport function getFunctionName(fn: unknown): string {\n try {\n if (!fn || typeof fn !== 'function') {\n return defaultFunctionName;\n }\n return fn.name || defaultFunctionName;\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n return defaultFunctionName;\n }\n}\n","import { isRegExp, isString } from './is';\n\n/**\n * Truncates given string to the maximum characters count\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nexport function truncate(str: string, max: number = 0): string {\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : `${str.substr(0, max)}...`;\n}\n\n/**\n * This is basically just `trim_line` from\n * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nexport function snipLine(line: string, colno: number): string {\n let newLine = line;\n const ll = newLine.length;\n if (ll <= 150) {\n return newLine;\n }\n if (colno > ll) {\n // eslint-disable-next-line no-param-reassign\n colno = ll;\n }\n\n let start = Math.max(colno - 60, 0);\n if (start < 5) {\n start = 0;\n }\n\n let end = Math.min(start + 140, ll);\n if (end > ll - 5) {\n end = ll;\n }\n if (end === ll) {\n start = Math.max(end - 140, 0);\n }\n\n newLine = newLine.slice(start, end);\n if (start > 0) {\n newLine = `'{snip} ${newLine}`;\n }\n if (end < ll) {\n newLine += ' {snip}';\n }\n\n return newLine;\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns Joined values\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function safeJoin(input: any[], delimiter?: string): string {\n if (!Array.isArray(input)) {\n return '';\n }\n\n const output = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.length; i++) {\n const value = input[i];\n try {\n output.push(String(value));\n } catch (e) {\n output.push('[value cannot be serialized]');\n }\n }\n\n return output.join(delimiter);\n}\n\n/**\n * Checks if the value matches a regex or includes the string\n * @param value The string value to be checked against\n * @param pattern Either a regex or a string that must be contained in value\n */\nexport function isMatchingPattern(value: string, pattern: RegExp | string): boolean {\n if (!isString(value)) {\n return false;\n }\n\n if (isRegExp(pattern)) {\n return (pattern as RegExp).test(value);\n }\n if (typeof pattern === 'string') {\n return value.indexOf(pattern) !== -1;\n }\n return false;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExtendedError, WrappedFunction } from '@sentry/types';\n\nimport { htmlTreeAsString } from './browser';\nimport { isElement, isError, isEvent, isInstanceOf, isPlainObject, isPrimitive, isSyntheticEvent } from './is';\nimport { Memo } from './memo';\nimport { getFunctionName } from './stacktrace';\nimport { truncate } from './string';\n\n/**\n * Wrap a given object method with a higher-order function\n *\n * @param source An object that contains a method to be wrapped.\n * @param name A name of method to be wrapped.\n * @param replacement A function that should be used to wrap a given method.\n * @returns void\n */\nexport function fill(source: { [key: string]: any }, name: string, replacement: (...args: any[]) => any): void {\n if (!(name in source)) {\n return;\n }\n\n const original = source[name] as () => any;\n const wrapped = replacement(original) as WrappedFunction;\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n try {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __sentry_original__: {\n enumerable: false,\n value: original,\n },\n });\n } catch (_Oo) {\n // This can throw if multiple fill happens on a global object like XMLHttpRequest\n // Fixes https://github.com/getsentry/sentry-javascript/issues/2043\n }\n }\n\n source[name] = wrapped;\n}\n\n/**\n * Encodes given object into url-friendly format\n *\n * @param object An object that contains serializable values\n * @returns string Encoded\n */\nexport function urlEncode(object: { [key: string]: any }): string {\n return Object.keys(object)\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`)\n .join('&');\n}\n\n/**\n * Transforms any object into an object literal with all it's attributes\n * attached to it.\n *\n * @param value Initial source that we have to transform in order to be usable by the serializer\n */\nfunction getWalkSource(\n value: any,\n): {\n [key: string]: any;\n} {\n if (isError(value)) {\n const error = value as ExtendedError;\n const err: {\n [key: string]: any;\n stack: string | undefined;\n message: string;\n name: string;\n } = {\n message: error.message,\n name: error.name,\n stack: error.stack,\n };\n\n for (const i in error) {\n if (Object.prototype.hasOwnProperty.call(error, i)) {\n err[i] = error[i];\n }\n }\n\n return err;\n }\n\n if (isEvent(value)) {\n /**\n * Event-like interface that's usable in browser and node\n */\n interface SimpleEvent {\n [key: string]: unknown;\n type: string;\n target?: unknown;\n currentTarget?: unknown;\n }\n\n const event = value as SimpleEvent;\n\n const source: {\n [key: string]: any;\n } = {};\n\n source.type = event.type;\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n source.target = isElement(event.target)\n ? htmlTreeAsString(event.target)\n : Object.prototype.toString.call(event.target);\n } catch (_oO) {\n source.target = '<unknown>';\n }\n\n try {\n source.currentTarget = isElement(event.currentTarget)\n ? htmlTreeAsString(event.currentTarget)\n : Object.prototype.toString.call(event.currentTarget);\n } catch (_oO) {\n source.currentTarget = '<unknown>';\n }\n\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n source.detail = event.detail;\n }\n\n for (const i in event) {\n if (Object.prototype.hasOwnProperty.call(event, i)) {\n source[i] = event;\n }\n }\n\n return source;\n }\n\n return value as {\n [key: string]: any;\n };\n}\n\n/** Calculates bytes size of input string */\nfunction utf8Length(value: string): number {\n // eslint-disable-next-line no-bitwise\n return ~-encodeURI(value).split(/%..|./).length;\n}\n\n/** Calculates bytes size of input object */\nfunction jsonSize(value: any): number {\n return utf8Length(JSON.stringify(value));\n}\n\n/** JSDoc */\nexport function normalizeToSize<T>(\n object: { [key: string]: any },\n // Default Node.js REPL depth\n depth: number = 3,\n // 100kB, as 200kB is max payload size, so half sounds reasonable\n maxSize: number = 100 * 1024,\n): T {\n const serialized = normalize(object, depth);\n\n if (jsonSize(serialized) > maxSize) {\n return normalizeToSize(object, depth - 1, maxSize);\n }\n\n return serialized as T;\n}\n\n/** Transforms any input value into a string form, either primitive value or a type of the input */\nfunction serializeValue(value: any): any {\n const type = Object.prototype.toString.call(value);\n\n // Node.js REPL notation\n if (typeof value === 'string') {\n return value;\n }\n if (type === '[object Object]') {\n return '[Object]';\n }\n if (type === '[object Array]') {\n return '[Array]';\n }\n\n const normalized = normalizeValue(value);\n return isPrimitive(normalized) ? normalized : type;\n}\n\n/**\n * normalizeValue()\n *\n * Takes unserializable input and make it serializable friendly\n *\n * - translates undefined/NaN values to \"[undefined]\"/\"[NaN]\" respectively,\n * - serializes Error objects\n * - filter global objects\n */\nfunction normalizeValue<T>(value: T, key?: any): T | string {\n if (key === 'domain' && value && typeof value === 'object' && ((value as unknown) as { _events: any })._events) {\n return '[Domain]';\n }\n\n if (key === 'domainEmitter') {\n return '[DomainEmitter]';\n }\n\n if (typeof (global as any) !== 'undefined' && (value as unknown) === global) {\n return '[Global]';\n }\n\n if (typeof (window as any) !== 'undefined' && (value as unknown) === window) {\n return '[Window]';\n }\n\n if (typeof (document as any) !== 'undefined' && (value as unknown) === document) {\n return '[Document]';\n }\n\n // React's SyntheticEvent thingy\n if (isSyntheticEvent(value)) {\n return '[SyntheticEvent]';\n }\n\n if (typeof value === 'number' && value !== value) {\n return '[NaN]';\n }\n\n if (value === void 0) {\n return '[undefined]';\n }\n\n if (typeof value === 'function') {\n return `[Function: ${getFunctionName(value)}]`;\n }\n\n return value;\n}\n\n/**\n * Walks an object to perform a normalization on it\n *\n * @param key of object that's walked in current iteration\n * @param value object to be walked\n * @param depth Optional number indicating how deep should walking be performed\n * @param memo Optional Memo class handling decycling\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function walk(key: string, value: any, depth: number = +Infinity, memo: Memo = new Memo()): any {\n // If we reach the maximum depth, serialize whatever has left\n if (depth === 0) {\n return serializeValue(value);\n }\n\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // If value implements `toJSON` method, call it and return early\n if (value !== null && value !== undefined && typeof value.toJSON === 'function') {\n return value.toJSON();\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n // If normalized value is a primitive, there are no branches left to walk, so we can just bail out, as theres no point in going down that branch any further\n const normalized = normalizeValue(value, key);\n if (isPrimitive(normalized)) {\n return normalized;\n }\n\n // Create source that we will use for next itterations, either objectified error object (Error type with extracted keys:value pairs) or the input itself\n const source = getWalkSource(value);\n\n // Create an accumulator that will act as a parent for all future itterations of that branch\n const acc = Array.isArray(value) ? [] : {};\n\n // If we already walked that branch, bail out, as it's circular reference\n if (memo.memoize(value)) {\n return '[Circular ~]';\n }\n\n // Walk all keys of the source\n for (const innerKey in source) {\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\n if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {\n continue;\n }\n // Recursively walk through all the child nodes\n (acc as { [key: string]: any })[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);\n }\n\n // Once walked through all the branches, remove the parent from memo storage\n memo.unmemoize(value);\n\n // Return accumulated values\n return acc;\n}\n\n/**\n * normalize()\n *\n * - Creates a copy to prevent original input mutation\n * - Skip non-enumerablers\n * - Calls `toJSON` if implemented\n * - Removes circular references\n * - Translates non-serializeable values (undefined/NaN/Functions) to serializable format\n * - Translates known global objects/Classes to a string representations\n * - Takes care of Error objects serialization\n * - Optionally limit depth of final output\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function normalize(input: any, depth?: number): any {\n try {\n return JSON.parse(JSON.stringify(input, (key: string, value: any) => walk(key, value, depth)));\n } catch (_oO) {\n return '**non-serializable**';\n }\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function extractExceptionKeysForMessage(exception: any, maxLength: number = 40): string {\n const keys = Object.keys(getWalkSource(exception));\n keys.sort();\n\n if (!keys.length) {\n return '[object has no keys]';\n }\n\n if (keys[0].length >= maxLength) {\n return truncate(keys[0], maxLength);\n }\n\n for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) {\n const serialized = keys.slice(0, includedKeys).join(', ');\n if (serialized.length > maxLength) {\n continue;\n }\n if (includedKeys === keys.length) {\n return serialized;\n }\n return truncate(serialized, maxLength);\n }\n\n return '';\n}\n\n/**\n * Given any object, return the new object with removed keys that value was `undefined`.\n * Works recursively on objects and arrays.\n */\nexport function dropUndefinedKeys<T>(val: T): T {\n if (isPlainObject(val)) {\n const obj = val as { [key: string]: any };\n const rv: { [key: string]: any } = {};\n for (const key of Object.keys(obj)) {\n if (typeof obj[key] !== 'undefined') {\n rv[key] = dropUndefinedKeys(obj[key]);\n }\n }\n return rv as T;\n }\n\n if (Array.isArray(val)) {\n return val.map(dropUndefinedKeys) as any;\n }\n\n return val;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExtractedNodeRequestData } from '@sentry/types';\n\nimport { isString } from './is';\nimport { normalize } from './object';\n\n/**\n * Checks whether we're in the Node.js or Browser environment\n *\n * @returns Answer to given question\n */\nexport function isNodeEnv(): boolean {\n return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';\n}\n\n/**\n * Requires a module which is protected against bundler minification.\n *\n * @param request The module path to resolve\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function dynamicRequire(mod: any, request: string): any {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return mod.require(request);\n}\n\n/** Default request keys that'll be used to extract data from the request */\nconst DEFAULT_REQUEST_KEYS = ['cookies', 'data', 'headers', 'method', 'query_string', 'url'];\n\n/**\n * Normalizes data from the request object, accounting for framework differences.\n *\n * @param req The request object from which to extract data\n * @param keys An optional array of keys to include in the normalized data. Defaults to DEFAULT_REQUEST_KEYS if not\n * provided.\n * @returns An object containing normalized request data\n */\nexport function extractNodeRequestData(\n req: { [key: string]: any },\n keys: string[] = DEFAULT_REQUEST_KEYS,\n): ExtractedNodeRequestData {\n // make sure we can safely use dynamicRequire below\n if (!isNodeEnv()) {\n throw new Error(\"Can't get node request data outside of a node environment\");\n }\n\n const requestData: { [key: string]: any } = {};\n\n // headers:\n // node, express: req.headers\n // koa: req.header\n const headers = (req.headers || req.header || {}) as {\n host?: string;\n cookie?: string;\n };\n // method:\n // node, express, koa: req.method\n const method = req.method;\n // host:\n // express: req.hostname in > 4 and req.host in < 4\n // koa: req.host\n // node: req.headers.host\n const host = req.hostname || req.host || headers.host || '<no host>';\n // protocol:\n // node: <n/a>\n // express, koa: req.protocol\n const protocol =\n req.protocol === 'https' || req.secure || ((req.socket || {}) as { encrypted?: boolean }).encrypted\n ? 'https'\n : 'http';\n // url (including path and query string):\n // node, express: req.originalUrl\n // koa: req.url\n const originalUrl = (req.originalUrl || req.url || '') as string;\n // absolute url\n const absoluteUrl = `${protocol}://${host}${originalUrl}`;\n\n keys.forEach(key => {\n switch (key) {\n case 'headers':\n requestData.headers = headers;\n break;\n case 'method':\n requestData.method = method;\n break;\n case 'url':\n requestData.url = absoluteUrl;\n break;\n case 'cookies':\n // cookies:\n // node, express, koa: req.headers.cookie\n // vercel, sails.js, express (w/ cookie middleware): req.cookies\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n requestData.cookies = req.cookies || dynamicRequire(module, 'cookie').parse(headers.cookie || '');\n break;\n case 'query_string':\n // query string:\n // node: req.url (raw)\n // express, koa: req.query\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n requestData.query_string = dynamicRequire(module, 'url').parse(originalUrl || '', false).query;\n break;\n case 'data':\n if (method === 'GET' || method === 'HEAD') {\n break;\n }\n // body data:\n // node, express, koa: req.body\n if (req.body !== undefined) {\n requestData.data = isString(req.body) ? req.body : JSON.stringify(normalize(req.body));\n }\n break;\n default:\n if ({}.hasOwnProperty.call(req, key)) {\n requestData[key] = (req as { [key: string]: any })[key];\n }\n }\n });\n\n return requestData;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Event, Integration, StackFrame, WrappedFunction } from '@sentry/types';\n\nimport { isNodeEnv } from './node';\nimport { snipLine } from './string';\n\n/** Internal */\ninterface SentryGlobal {\n Sentry?: {\n Integrations?: Integration[];\n };\n SENTRY_ENVIRONMENT?: string;\n SENTRY_DSN?: string;\n SENTRY_RELEASE?: {\n id?: string;\n };\n __SENTRY__: {\n globalEventProcessors: any;\n hub: any;\n logger: any;\n };\n}\n\nconst fallbackGlobalObject = {};\n\n/**\n * Safely get global scope object\n *\n * @returns Global scope object\n */\nexport function getGlobalObject<T>(): T & SentryGlobal {\n return (isNodeEnv()\n ? global\n : typeof window !== 'undefined'\n ? window\n : typeof self !== 'undefined'\n ? self\n : fallbackGlobalObject) as T & SentryGlobal;\n}\n\n/**\n * Extended Window interface that allows for Crypto API usage in IE browsers\n */\ninterface MsCryptoWindow extends Window {\n msCrypto?: Crypto;\n}\n\n/**\n * UUID4 generator\n *\n * @returns string Generated UUID4.\n */\nexport function uuid4(): string {\n const global = getGlobalObject() as MsCryptoWindow;\n const crypto = global.crypto || global.msCrypto;\n\n if (!(crypto === void 0) && crypto.getRandomValues) {\n // Use window.crypto API if available\n const arr = new Uint16Array(8);\n crypto.getRandomValues(arr);\n\n // set 4 in byte 7\n // eslint-disable-next-line no-bitwise\n arr[3] = (arr[3] & 0xfff) | 0x4000;\n // set 2 most significant bits of byte 9 to '10'\n // eslint-disable-next-line no-bitwise\n arr[4] = (arr[4] & 0x3fff) | 0x8000;\n\n const pad = (num: number): string => {\n let v = num.toString(16);\n while (v.length < 4) {\n v = `0${v}`;\n }\n return v;\n };\n\n return (\n pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) + pad(arr[5]) + pad(arr[6]) + pad(arr[7])\n );\n }\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, c => {\n // eslint-disable-next-line no-bitwise\n const r = (Math.random() * 16) | 0;\n // eslint-disable-next-line no-bitwise\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Parses string form of URL into an object\n * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B\n * // intentionally using regex and not <a/> href parsing trick because React Native and other\n * // environments where DOM might not be available\n * @returns parsed URL object\n */\nexport function parseUrl(\n url: string,\n): {\n host?: string;\n path?: string;\n protocol?: string;\n relative?: string;\n} {\n if (!url) {\n return {};\n }\n\n const match = url.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\n\n if (!match) {\n return {};\n }\n\n // coerce to undefined values to empty string so we don't get 'undefined'\n const query = match[6] || '';\n const fragment = match[8] || '';\n return {\n host: match[4],\n path: match[5],\n protocol: match[2],\n relative: match[5] + query + fragment, // everything minus origin\n };\n}\n\n/**\n * Extracts either message or type+value from an event that can be used for user-facing logs\n * @returns event's description\n */\nexport function getEventDescription(event: Event): string {\n if (event.message) {\n return event.message;\n }\n if (event.exception && event.exception.values && event.exception.values[0]) {\n const exception = event.exception.values[0];\n\n if (exception.type && exception.value) {\n return `${exception.type}: ${exception.value}`;\n }\n return exception.type || exception.value || event.event_id || '<unknown>';\n }\n return event.event_id || '<unknown>';\n}\n\n/** JSDoc */\ninterface ExtensibleConsole extends Console {\n [key: string]: any;\n}\n\n/** JSDoc */\nexport function consoleSandbox(callback: () => any): any {\n const global = getGlobalObject<Window>();\n const levels = ['debug', 'info', 'warn', 'error', 'log', 'assert'];\n\n if (!('console' in global)) {\n return callback();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalConsole = (global as any).console as ExtensibleConsole;\n const wrappedLevels: { [key: string]: any } = {};\n\n // Restore all wrapped console methods\n levels.forEach(level => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (level in (global as any).console && (originalConsole[level] as WrappedFunction).__sentry_original__) {\n wrappedLevels[level] = originalConsole[level] as WrappedFunction;\n originalConsole[level] = (originalConsole[level] as WrappedFunction).__sentry_original__;\n }\n });\n\n // Perform callback manipulations\n const result = callback();\n\n // Revert restoration to wrapped state\n Object.keys(wrappedLevels).forEach(level => {\n originalConsole[level] = wrappedLevels[level];\n });\n\n return result;\n}\n\n/**\n * Adds exception values, type and value to an synthetic Exception.\n * @param event The event to modify.\n * @param value Value of the exception.\n * @param type Type of the exception.\n * @hidden\n */\nexport function addExceptionTypeValue(event: Event, value?: string, type?: string): void {\n event.exception = event.exception || {};\n event.exception.values = event.exception.values || [];\n event.exception.values[0] = event.exception.values[0] || {};\n event.exception.values[0].value = event.exception.values[0].value || value || '';\n event.exception.values[0].type = event.exception.values[0].type || type || 'Error';\n}\n\n/**\n * Adds exception mechanism to a given event.\n * @param event The event to modify.\n * @param mechanism Mechanism of the mechanism.\n * @hidden\n */\nexport function addExceptionMechanism(\n event: Event,\n mechanism: {\n [key: string]: any;\n } = {},\n): void {\n // TODO: Use real type with `keyof Mechanism` thingy and maybe make it better?\n try {\n // @ts-ignore Type 'Mechanism | {}' is not assignable to type 'Mechanism | undefined'\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception!.values![0].mechanism = event.exception!.values![0].mechanism || {};\n Object.keys(mechanism).forEach(key => {\n // @ts-ignore Mechanism has no index signature\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception!.values![0].mechanism[key] = mechanism[key];\n });\n } catch (_oO) {\n // no-empty\n }\n}\n\n/**\n * A safe form of location.href\n */\nexport function getLocationHref(): string {\n try {\n return document.location.href;\n } catch (oO) {\n return '';\n }\n}\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\n/**\n * Represents Semantic Versioning object\n */\ninterface SemVer {\n major?: number;\n minor?: number;\n patch?: number;\n prerelease?: string;\n buildmetadata?: string;\n}\n\n/**\n * Parses input into a SemVer interface\n * @param input string representation of a semver version\n */\nexport function parseSemver(input: string): SemVer {\n const match = input.match(SEMVER_REGEXP) || [];\n const major = parseInt(match[1], 10);\n const minor = parseInt(match[2], 10);\n const patch = parseInt(match[3], 10);\n return {\n buildmetadata: match[5],\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n };\n}\n\nconst defaultRetryAfter = 60 * 1000; // 60 seconds\n\n/**\n * Extracts Retry-After value from the request header or returns default value\n * @param now current unix timestamp\n * @param header string representation of 'Retry-After' header\n */\nexport function parseRetryAfterHeader(now: number, header?: string | number | null): number {\n if (!header) {\n return defaultRetryAfter;\n }\n\n const headerDelay = parseInt(`${header}`, 10);\n if (!isNaN(headerDelay)) {\n return headerDelay * 1000;\n }\n\n const headerDate = Date.parse(`${header}`);\n if (!isNaN(headerDate)) {\n return headerDate - now;\n }\n\n return defaultRetryAfter;\n}\n\n/**\n * This function adds context (pre/post/line) lines to the provided frame\n *\n * @param lines string[] containing all lines\n * @param frame StackFrame that will be mutated\n * @param linesOfContext number of context lines we want to add pre/post\n */\nexport function addContextToFrame(lines: string[], frame: StackFrame, linesOfContext: number = 5): void {\n const lineno = frame.lineno || 0;\n const maxLines = lines.length;\n const sourceLine = Math.max(Math.min(maxLines, lineno - 1), 0);\n\n frame.pre_context = lines\n .slice(Math.max(0, sourceLine - linesOfContext), sourceLine)\n .map((line: string) => snipLine(line, 0));\n\n frame.context_line = snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0);\n\n frame.post_context = lines\n .slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext)\n .map((line: string) => snipLine(line, 0));\n}\n\n/**\n * Strip the query string and fragment off of a given URL or path (if present)\n *\n * @param urlPath Full URL or path, including possible query string and/or fragment\n * @returns URL or path without query string or fragment\n */\nexport function stripUrlQueryAndFragment(urlPath: string): string {\n // eslint-disable-next-line no-useless-escape\n return urlPath.split(/[\\?#]/, 1)[0];\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { consoleSandbox, getGlobalObject } from './misc';\n\n// TODO: Implement different loggers for different environments\nconst global = getGlobalObject<Window | NodeJS.Global>();\n\n/** Prefix for logging strings */\nconst PREFIX = 'Sentry Logger ';\n\n/** JSDoc */\nclass Logger {\n /** JSDoc */\n private _enabled: boolean;\n\n /** JSDoc */\n public constructor() {\n this._enabled = false;\n }\n\n /** JSDoc */\n public disable(): void {\n this._enabled = false;\n }\n\n /** JSDoc */\n public enable(): void {\n this._enabled = true;\n }\n\n /** JSDoc */\n public log(...args: any[]): void {\n if (!this._enabled) {\n return;\n }\n consoleSandbox(() => {\n global.console.log(`${PREFIX}[Log]: ${args.join(' ')}`);\n });\n }\n\n /** JSDoc */\n public warn(...args: any[]): void {\n if (!this._enabled) {\n return;\n }\n consoleSandbox(() => {\n global.console.warn(`${PREFIX}[Warn]: ${args.join(' ')}`);\n });\n }\n\n /** JSDoc */\n public error(...args: any[]): void {\n if (!this._enabled) {\n return;\n }\n consoleSandbox(() => {\n global.console.error(`${PREFIX}[Error]: ${args.join(' ')}`);\n });\n }\n}\n\n// Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used\nglobal.__SENTRY__ = global.__SENTRY__ || {};\nconst logger = (global.__SENTRY__.logger as Logger) || (global.__SENTRY__.logger = new Logger());\n\nexport { logger };\n","import { logger } from './logger';\nimport { getGlobalObject } from './misc';\n\n/**\n * Tells whether current environment supports ErrorEvent objects\n * {@link supportsErrorEvent}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsErrorEvent(): boolean {\n try {\n new ErrorEvent('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMError objects\n * {@link supportsDOMError}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsDOMError(): boolean {\n try {\n // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError':\n // 1 argument required, but only 0 present.\n // @ts-ignore It really needs 1 argument, not 0.\n new DOMError('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMException objects\n * {@link supportsDOMException}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsDOMException(): boolean {\n try {\n new DOMException('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports Fetch API\n * {@link supportsFetch}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsFetch(): boolean {\n if (!('fetch' in getGlobalObject<Window>())) {\n return false;\n }\n\n try {\n new Headers();\n new Request('');\n new Response();\n return true;\n } catch (e) {\n return false;\n }\n}\n/**\n * isNativeFetch checks if the given function is a native implementation of fetch()\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isNativeFetch(func: Function): boolean {\n return func && /^function fetch\\(\\)\\s+\\{\\s+\\[native code\\]\\s+\\}$/.test(func.toString());\n}\n\n/**\n * Tells whether current environment supports Fetch API natively\n * {@link supportsNativeFetch}.\n *\n * @returns true if `window.fetch` is natively implemented, false otherwise\n */\nexport function supportsNativeFetch(): boolean {\n if (!supportsFetch()) {\n return false;\n }\n\n const global = getGlobalObject<Window>();\n\n // Fast path to avoid DOM I/O\n // eslint-disable-next-line @typescript-eslint/unbound-method\n if (isNativeFetch(global.fetch)) {\n return true;\n }\n\n // window.fetch is implemented, but is polyfilled or already wrapped (e.g: by a chrome extension)\n // so create a \"pure\" iframe to see if that has native fetch\n let result = false;\n const doc = global.document;\n // eslint-disable-next-line deprecation/deprecation\n if (doc && typeof (doc.createElement as unknown) === `function`) {\n try {\n const sandbox = doc.createElement('iframe');\n sandbox.hidden = true;\n doc.head.appendChild(sandbox);\n if (sandbox.contentWindow && sandbox.contentWindow.fetch) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n result = isNativeFetch(sandbox.contentWindow.fetch);\n }\n doc.head.removeChild(sandbox);\n } catch (err) {\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);\n }\n }\n\n return result;\n}\n\n/**\n * Tells whether current environment supports ReportingObserver API\n * {@link supportsReportingObserver}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsReportingObserver(): boolean {\n return 'ReportingObserver' in getGlobalObject();\n}\n\n/**\n * Tells whether current environment supports Referrer Policy API\n * {@link supportsReferrerPolicy}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsReferrerPolicy(): boolean {\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n\n if (!supportsFetch()) {\n return false;\n }\n\n try {\n new Request('_', {\n referrerPolicy: 'origin' as ReferrerPolicy,\n });\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports History API\n * {@link supportsHistory}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsHistory(): boolean {\n // NOTE: in Chrome App environment, touching history.pushState, *even inside\n // a try/catch block*, will cause Chrome to output an error to console.error\n // borrowed from: https://github.com/angular/angular.js/pull/13945/files\n const global = getGlobalObject<Window>();\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const chrome = (global as any).chrome;\n const isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n const hasHistoryApi = 'history' in global && !!global.history.pushState && !!global.history.replaceState;\n\n return !isChromePackagedApp && hasHistoryApi;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport { WrappedFunction } from '@sentry/types';\n\nimport { isInstanceOf, isString } from './is';\nimport { logger } from './logger';\nimport { getGlobalObject } from './misc';\nimport { fill } from './object';\nimport { getFunctionName } from './stacktrace';\nimport { supportsHistory, supportsNativeFetch } from './supports';\n\nconst global = getGlobalObject<Window>();\n\n/** Object describing handler that will be triggered for a given `type` of instrumentation */\ninterface InstrumentHandler {\n type: InstrumentHandlerType;\n callback: InstrumentHandlerCallback;\n}\ntype InstrumentHandlerType =\n | 'console'\n | 'dom'\n | 'fetch'\n | 'history'\n | 'sentry'\n | 'xhr'\n | 'error'\n | 'unhandledrejection';\ntype InstrumentHandlerCallback = (data: any) => void;\n\n/**\n * Instrument native APIs to call handlers that can be used to create breadcrumbs, APM spans etc.\n * - Console API\n * - Fetch API\n * - XHR API\n * - History API\n * - DOM API (click/typing)\n * - Error API\n * - UnhandledRejection API\n */\n\nconst handlers: { [key in InstrumentHandlerType]?: InstrumentHandlerCallback[] } = {};\nconst instrumented: { [key in InstrumentHandlerType]?: boolean } = {};\n\n/** Instruments given API */\nfunction instrument(type: InstrumentHandlerType): void {\n if (instrumented[type]) {\n return;\n }\n\n instrumented[type] = true;\n\n switch (type) {\n case 'console':\n instrumentConsole();\n break;\n case 'dom':\n instrumentDOM();\n break;\n case 'xhr':\n instrumentXHR();\n break;\n case 'fetch':\n instrumentFetch();\n break;\n case 'history':\n instrumentHistory();\n break;\n case 'error':\n instrumentError();\n break;\n case 'unhandledrejection':\n instrumentUnhandledRejection();\n break;\n default:\n logger.warn('unknown instrumentation type:', type);\n }\n}\n\n/**\n * Add handler that will be called when given type of instrumentation triggers.\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addInstrumentationHandler(handler: InstrumentHandler): void {\n if (!handler || typeof handler.type !== 'string' || typeof handler.callback !== 'function') {\n return;\n }\n handlers[handler.type] = handlers[handler.type] || [];\n (handlers[handler.type] as InstrumentHandlerCallback[]).push(handler.callback);\n instrument(handler.type);\n}\n\n/** JSDoc */\nfunction triggerHandlers(type: InstrumentHandlerType, data: any): void {\n if (!type || !handlers[type]) {\n return;\n }\n\n for (const handler of handlers[type] || []) {\n try {\n handler(data);\n } catch (e) {\n logger.error(\n `Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(\n handler,\n )}\\nError: ${e}`,\n );\n }\n }\n}\n\n/** JSDoc */\nfunction instrumentConsole(): void {\n if (!('console' in global)) {\n return;\n }\n\n ['debug', 'info', 'warn', 'error', 'log', 'assert'].forEach(function(level: string): void {\n if (!(level in global.console)) {\n return;\n }\n\n fill(global.console, level, function(originalConsoleLevel: () => any): Function {\n return function(...args: any[]): void {\n triggerHandlers('console', { args, level });\n\n // this fails for some browsers. :(\n if (originalConsoleLevel) {\n Function.prototype.apply.call(originalConsoleLevel, global.console, args);\n }\n };\n });\n });\n}\n\n/** JSDoc */\nfunction instrumentFetch(): void {\n if (!supportsNativeFetch()) {\n return;\n }\n\n fill(global, 'fetch', function(originalFetch: () => void): () => void {\n return function(...args: any[]): void {\n const handlerData = {\n args,\n fetchData: {\n method: getFetchMethod(args),\n url: getFetchUrl(args),\n },\n startTimestamp: Date.now(),\n };\n\n triggerHandlers('fetch', {\n ...handlerData,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return originalFetch.apply(global, args).then(\n (response: Response) => {\n triggerHandlers('fetch', {\n ...handlerData,\n endTimestamp: Date.now(),\n response,\n });\n return response;\n },\n (error: Error) => {\n triggerHandlers('fetch', {\n ...handlerData,\n endTimestamp: Date.now(),\n error,\n });\n // NOTE: If you are a Sentry user, and you are seeing this stack frame,\n // it means the sentry.javascript SDK caught an error invoking your application code.\n // This is expected behavior and NOT indicative of a bug with sentry.javascript.\n throw error;\n },\n );\n };\n });\n}\n\ntype XHRSendInput = null | Blob | BufferSource | FormData | URLSearchParams | string;\n\n/** JSDoc */\ninterface SentryWrappedXMLHttpRequest extends XMLHttpRequest {\n [key: string]: any;\n __sentry_xhr__?: {\n method?: string;\n url?: string;\n status_code?: number;\n body?: XHRSendInput;\n };\n}\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/** Extract `method` from fetch call arguments */\nfunction getFetchMethod(fetchArgs: any[] = []): string {\n if ('Request' in global && isInstanceOf(fetchArgs[0], Request) && fetchArgs[0].method) {\n return String(fetchArgs[0].method).toUpperCase();\n }\n if (fetchArgs[1] && fetchArgs[1].method) {\n return String(fetchArgs[1].method).toUpperCase();\n }\n return 'GET';\n}\n\n/** Extract `url` from fetch call arguments */\nfunction getFetchUrl(fetchArgs: any[] = []): string {\n if (typeof fetchArgs[0] === 'string') {\n return fetchArgs[0];\n }\n if ('Request' in global && isInstanceOf(fetchArgs[0], Request)) {\n return fetchArgs[0].url;\n }\n return String(fetchArgs[0]);\n}\n/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n/** JSDoc */\nfunction instrumentXHR(): void {\n if (!('XMLHttpRequest' in global)) {\n return;\n }\n\n // Poor man's implementation of ES6 `Map`, tracking and keeping in sync key and value separately.\n const requestKeys: XMLHttpRequest[] = [];\n const requestValues: Array<any>[] = [];\n const xhrproto = XMLHttpRequest.prototype;\n\n fill(xhrproto, 'open', function(originalOpen: () => void): () => void {\n return function(this: SentryWrappedXMLHttpRequest, ...args: any[]): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const xhr = this;\n const url = args[1];\n xhr.__sentry_xhr__ = {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n method: isString(args[0]) ? args[0].toUpperCase() : args[0],\n url: args[1],\n };\n\n // if Sentry key appears in URL, don't capture it as a request\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (isString(url) && xhr.__sentry_xhr__.method === 'POST' && url.match(/sentry_key/)) {\n xhr.__sentry_own_request__ = true;\n }\n\n const onreadystatechangeHandler = function(): void {\n if (xhr.readyState === 4) {\n try {\n // touching statusCode in some platforms throws\n // an exception\n if (xhr.__sentry_xhr__) {\n xhr.__sentry_xhr__.status_code = xhr.status;\n }\n } catch (e) {\n /* do nothing */\n }\n\n try {\n const requestPos = requestKeys.indexOf(xhr);\n if (requestPos !== -1) {\n // Make sure to pop both key and value to keep it in sync.\n requestKeys.splice(requestPos);\n const args = requestValues.splice(requestPos)[0];\n if (xhr.__sentry_xhr__ && args[0] !== undefined) {\n xhr.__sentry_xhr__.body = args[0] as XHRSendInput;\n }\n }\n } catch (e) {\n /* do nothing */\n }\n\n triggerHandlers('xhr', {\n args,\n endTimestamp: Date.now(),\n startTimestamp: Date.now(),\n xhr,\n });\n }\n };\n\n if ('onreadystatechange' in xhr && typeof xhr.onreadystatechange === 'function') {\n fill(xhr, 'onreadystatechange', function(original: WrappedFunction): Function {\n return function(...readyStateArgs: any[]): void {\n onreadystatechangeHandler();\n return original.apply(xhr, readyStateArgs);\n };\n });\n } else {\n xhr.addEventListener('readystatechange', onreadystatechangeHandler);\n }\n\n return originalOpen.apply(xhr, args);\n };\n });\n\n fill(xhrproto, 'send', function(originalSend: () => void): () => void {\n return function(this: SentryWrappedXMLHttpRequest, ...args: any[]): void {\n requestKeys.push(this);\n requestValues.push(args);\n\n triggerHandlers('xhr', {\n args,\n startTimestamp: Date.now(),\n xhr: this,\n });\n\n return originalSend.apply(this, args);\n };\n });\n}\n\nlet lastHref: string;\n\n/** JSDoc */\nfunction instrumentHistory(): void {\n if (!supportsHistory()) {\n return;\n }\n\n const oldOnPopState = global.onpopstate;\n global.onpopstate = function(this: WindowEventHandlers, ...args: any[]): any {\n const to = global.location.href;\n // keep track of the current URL state, as we always receive only the updated state\n const from = lastHref;\n lastHref = to;\n triggerHandlers('history', {\n from,\n to,\n });\n if (oldOnPopState) {\n return oldOnPopState.apply(this, args);\n }\n };\n\n /** @hidden */\n function historyReplacementFunction(originalHistoryFunction: () => void): () => void {\n return function(this: History, ...args: any[]): void {\n const url = args.length > 2 ? args[2] : undefined;\n if (url) {\n // coerce to string (this is what pushState does)\n const from = lastHref;\n const to = String(url);\n // keep track of the current URL state, as we always receive only the updated state\n lastHref = to;\n triggerHandlers('history', {\n from,\n to,\n });\n }\n return originalHistoryFunction.apply(this, args);\n };\n }\n\n fill(global.history, 'pushState', historyReplacementFunction);\n fill(global.history, 'replaceState', historyReplacementFunction);\n}\n\n/** JSDoc */\nfunction instrumentDOM(): void {\n if (!('document' in global)) {\n return;\n }\n\n // Capture breadcrumbs from any click that is unhandled / bubbled up all the way\n // to the document. Do this before we instrument addEventListener.\n global.document.addEventListener('click', domEventHandler('click', triggerHandlers.bind(null, 'dom')), false);\n global.document.addEventListener('keypress', keypressEventHandler(triggerHandlers.bind(null, 'dom')), false);\n\n // After hooking into document bubbled up click and keypresses events, we also hook into user handled click & keypresses.\n ['EventTarget', 'Node'].forEach((target: string) => {\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n const proto = (global as any)[target] && (global as any)[target].prototype;\n\n // eslint-disable-next-line no-prototype-builtins\n if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {\n return;\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n fill(proto, 'addEventListener', function(\n original: () => void,\n ): (\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) => void {\n return function(\n this: any,\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): (eventName: string, fn: EventListenerOrEventListenerObject, capture?: boolean, secure?: boolean) => void {\n if (fn && (fn as EventListenerObject).handleEvent) {\n if (eventName === 'click') {\n fill(fn, 'handleEvent', function(innerOriginal: () => void): (caughtEvent: Event) => void {\n return function(this: any, event: Event): (event: Event) => void {\n domEventHandler('click', triggerHandlers.bind(null, 'dom'))(event);\n return innerOriginal.call(this, event);\n };\n });\n }\n if (eventName === 'keypress') {\n fill(fn, 'handleEvent', function(innerOriginal: () => void): (caughtEvent: Event) => void {\n return function(this: any, event: Event): (event: Event) => void {\n keypressEventHandler(triggerHandlers.bind(null, 'dom'))(event);\n return innerOriginal.call(this, event);\n };\n });\n }\n } else {\n if (eventName === 'click') {\n domEventHandler('click', triggerHandlers.bind(null, 'dom'), true)(this);\n }\n if (eventName === 'keypress') {\n keypressEventHandler(triggerHandlers.bind(null, 'dom'))(this);\n }\n }\n\n return original.call(this, eventName, fn, options);\n };\n });\n\n fill(proto, 'removeEventListener', function(\n original: () => void,\n ): (\n this: any,\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ) => () => void {\n return function(\n this: any,\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): () => void {\n try {\n original.call(this, eventName, ((fn as unknown) as WrappedFunction).__sentry_wrapped__, options);\n } catch (e) {\n // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments\n }\n return original.call(this, eventName, fn, options);\n };\n });\n });\n}\n\nconst debounceDuration: number = 1000;\nlet debounceTimer: number = 0;\nlet keypressTimeout: number | undefined;\nlet lastCapturedEvent: Event | undefined;\n\n/**\n * Wraps addEventListener to capture UI breadcrumbs\n * @param name the event name (e.g. \"click\")\n * @param handler function that will be triggered\n * @param debounce decides whether it should wait till another event loop\n * @returns wrapped breadcrumb events handler\n * @hidden\n */\nfunction domEventHandler(name: string, handler: Function, debounce: boolean = false): (event: Event) => void {\n return (event: Event): void => {\n // reset keypress timeout; e.g. triggering a 'click' after\n // a 'keypress' will reset the keypress debounce so that a new\n // set of keypresses can be recorded\n keypressTimeout = undefined;\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors). Ignore if we've\n // already captured the event.\n if (!event || lastCapturedEvent === event) {\n return;\n }\n\n lastCapturedEvent = event;\n\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n\n if (debounce) {\n debounceTimer = setTimeout(() => {\n handler({ event, name });\n });\n } else {\n handler({ event, name });\n }\n };\n}\n\n/**\n * Wraps addEventListener to capture keypress UI events\n * @param handler function that will be triggered\n * @returns wrapped keypress events handler\n * @hidden\n */\nfunction keypressEventHandler(handler: Function): (event: Event) => void {\n // TODO: if somehow user switches keypress target before\n // debounce timeout is triggered, we will only capture\n // a single breadcrumb from the FIRST target (acceptable?)\n return (event: Event): void => {\n let target;\n\n try {\n target = event.target;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n\n const tagName = target && (target as HTMLElement).tagName;\n\n // only consider keypress events on actual input elements\n // this will disregard keypresses targeting body (e.g. tabbing\n // through elements, hotkeys, etc)\n if (!tagName || (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !(target as HTMLElement).isContentEditable)) {\n return;\n }\n\n // record first keypress in a series, but ignore subsequent\n // keypresses until debounce clears\n if (!keypressTimeout) {\n domEventHandler('input', handler)(event);\n }\n clearTimeout(keypressTimeout);\n\n keypressTimeout = (setTimeout(() => {\n keypressTimeout = undefined;\n }, debounceDuration) as any) as number;\n };\n}\n\nlet _oldOnErrorHandler: OnErrorEventHandler = null;\n/** JSDoc */\nfunction instrumentError(): void {\n _oldOnErrorHandler = global.onerror;\n\n global.onerror = function(msg: any, url: any, line: any, column: any, error: any): boolean {\n triggerHandlers('error', {\n column,\n error,\n line,\n msg,\n url,\n });\n\n if (_oldOnErrorHandler) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnErrorHandler.apply(this, arguments);\n }\n\n return false;\n };\n}\n\nlet _oldOnUnhandledRejectionHandler: ((e: any) => void) | null = null;\n/** JSDoc */\nfunction instrumentUnhandledRejection(): void {\n _oldOnUnhandledRejectionHandler = global.onunhandledrejection;\n\n global.onunhandledrejection = function(e: any): boolean {\n triggerHandlers('unhandledrejection', e);\n\n if (_oldOnUnhandledRejectionHandler) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnUnhandledRejectionHandler.apply(this, arguments);\n }\n\n return true;\n };\n}\n","/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/typedef */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isThenable } from './is';\n\n/** SyncPromise internal states */\nenum States {\n /** Pending */\n PENDING = 'PENDING',\n /** Resolved / OK */\n RESOLVED = 'RESOLVED',\n /** Rejected / Error */\n REJECTED = 'REJECTED',\n}\n\n/**\n * Thenable class that behaves like a Promise and follows it's interface\n * but is not async internally\n */\nclass SyncPromise<T> implements PromiseLike<T> {\n private _state: States = States.PENDING;\n private _handlers: Array<{\n done: boolean;\n onfulfilled?: ((value: T) => T | PromiseLike<T>) | null;\n onrejected?: ((reason: any) => any) | null;\n }> = [];\n private _value: any;\n\n public constructor(\n executor: (resolve: (value?: T | PromiseLike<T> | null) => void, reject: (reason?: any) => void) => void,\n ) {\n try {\n executor(this._resolve, this._reject);\n } catch (e) {\n this._reject(e);\n }\n }\n\n /** JSDoc */\n public static resolve<T>(value: T | PromiseLike<T>): PromiseLike<T> {\n return new SyncPromise(resolve => {\n resolve(value);\n });\n }\n\n /** JSDoc */\n public static reject<T = never>(reason?: any): PromiseLike<T> {\n return new SyncPromise((_, reject) => {\n reject(reason);\n });\n }\n\n /** JSDoc */\n public static all<U = any>(collection: Array<U | PromiseLike<U>>): PromiseLike<U[]> {\n return new SyncPromise<U[]>((resolve, reject) => {\n if (!Array.isArray(collection)) {\n reject(new TypeError(`Promise.all requires an array as input.`));\n return;\n }\n\n if (collection.length === 0) {\n resolve([]);\n return;\n }\n\n let counter = collection.length;\n const resolvedCollection: U[] = [];\n\n collection.forEach((item, index) => {\n SyncPromise.resolve(item)\n .then(value => {\n resolvedCollection[index] = value;\n counter -= 1;\n\n if (counter !== 0) {\n return;\n }\n resolve(resolvedCollection);\n })\n .then(null, reject);\n });\n });\n }\n\n /** JSDoc */\n public then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,\n ): PromiseLike<TResult1 | TResult2> {\n return new SyncPromise((resolve, reject) => {\n this._attachHandler({\n done: false,\n onfulfilled: result => {\n if (!onfulfilled) {\n // TODO: ¯\\_(ツ)_/¯\n // TODO: FIXME\n resolve(result as any);\n return;\n }\n try {\n resolve(onfulfilled(result));\n return;\n } catch (e) {\n reject(e);\n return;\n }\n },\n onrejected: reason => {\n if (!onrejected) {\n reject(reason);\n return;\n }\n try {\n resolve(onrejected(reason));\n return;\n } catch (e) {\n reject(e);\n return;\n }\n },\n });\n });\n }\n\n /** JSDoc */\n public catch<TResult = never>(\n onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,\n ): PromiseLike<T | TResult> {\n return this.then(val => val, onrejected);\n }\n\n /** JSDoc */\n public finally<TResult>(onfinally?: (() => void) | null): PromiseLike<TResult> {\n return new SyncPromise<TResult>((resolve, reject) => {\n let val: TResult | any;\n let isRejected: boolean;\n\n return this.then(\n value => {\n isRejected = false;\n val = value;\n if (onfinally) {\n onfinally();\n }\n },\n reason => {\n isRejected = true;\n val = reason;\n if (onfinally) {\n onfinally();\n }\n },\n ).then(() => {\n if (isRejected) {\n reject(val);\n return;\n }\n\n resolve((val as unknown) as any);\n });\n });\n }\n\n /** JSDoc */\n public toString(): string {\n return '[object SyncPromise]';\n }\n\n /** JSDoc */\n private readonly _resolve = (value?: T | PromiseLike<T> | null) => {\n this._setResult(States.RESOLVED, value);\n };\n\n /** JSDoc */\n private readonly _reject = (reason?: any) => {\n this._setResult(States.REJECTED, reason);\n };\n\n /** JSDoc */\n private readonly _setResult = (state: States, value?: T | PromiseLike<T> | any) => {\n if (this._state !== States.PENDING) {\n return;\n }\n\n if (isThenable(value)) {\n (value as PromiseLike<T>).then(this._resolve, this._reject);\n return;\n }\n\n this._state = state;\n this._value = value;\n\n this._executeHandlers();\n };\n\n // TODO: FIXME\n /** JSDoc */\n private readonly _attachHandler = (handler: {\n /** JSDoc */\n done: boolean;\n /** JSDoc */\n onfulfilled?(value: T): any;\n /** JSDoc */\n onrejected?(reason: any): any;\n }) => {\n this._handlers = this._handlers.concat(handler);\n this._executeHandlers();\n };\n\n /** JSDoc */\n private readonly _executeHandlers = () => {\n if (this._state === States.PENDING) {\n return;\n }\n\n const cachedHandlers = this._handlers.slice();\n this._handlers = [];\n\n cachedHandlers.forEach(handler => {\n if (handler.done) {\n return;\n }\n\n if (this._state === States.RESOLVED) {\n if (handler.onfulfilled) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n handler.onfulfilled((this._value as unknown) as any);\n }\n }\n\n if (this._state === States.REJECTED) {\n if (handler.onrejected) {\n handler.onrejected(this._value);\n }\n }\n\n handler.done = true;\n });\n };\n}\n\nexport { SyncPromise };\n","import { SentryError } from './error';\nimport { SyncPromise } from './syncpromise';\n\n/** A simple queue that holds promises. */\nexport class PromiseBuffer<T> {\n /** Internal set of queued Promises */\n private readonly _buffer: Array<PromiseLike<T>> = [];\n\n public constructor(protected _limit?: number) {}\n\n /**\n * Says if the buffer is ready to take more requests\n */\n public isReady(): boolean {\n return this._limit === undefined || this.length() < this._limit;\n }\n\n /**\n * Add a promise to the queue.\n *\n * @param task Can be any PromiseLike<T>\n * @returns The original promise.\n */\n public add(task: PromiseLike<T>): PromiseLike<T> {\n if (!this.isReady()) {\n return SyncPromise.reject(new SentryError('Not adding Promise due to buffer limit reached.'));\n }\n if (this._buffer.indexOf(task) === -1) {\n this._buffer.push(task);\n }\n task\n .then(() => this.remove(task))\n .then(null, () =>\n this.remove(task).then(null, () => {\n // We have to add this catch here otherwise we have an unhandledPromiseRejection\n // because it's a new Promise chain.\n }),\n );\n return task;\n }\n\n /**\n * Remove a promise to the queue.\n *\n * @param task Can be any PromiseLike<T>\n * @returns Removed promise.\n */\n public remove(task: PromiseLike<T>): PromiseLike<T> {\n const removedTask = this._buffer.splice(this._buffer.indexOf(task), 1)[0];\n return removedTask;\n }\n\n /**\n * This function returns the number of unresolved promises in the queue.\n */\n public length(): number {\n return this._buffer.length;\n }\n\n /**\n * This will drain the whole queue, returns true if queue is empty or drained.\n * If timeout is provided and the queue takes longer to drain, the promise still resolves but with false.\n *\n * @param timeout Number in ms to wait until it resolves with false.\n */\n public drain(timeout?: number): PromiseLike<boolean> {\n return new SyncPromise<boolean>(resolve => {\n const capturedSetTimeout = setTimeout(() => {\n if (timeout && timeout > 0) {\n resolve(false);\n }\n }, timeout);\n SyncPromise.all(this._buffer)\n .then(() => {\n clearTimeout(capturedSetTimeout);\n resolve(true);\n })\n .then(null, () => {\n resolve(true);\n });\n });\n }\n}\n","import { getGlobalObject } from './misc';\nimport { dynamicRequire, isNodeEnv } from './node';\n\n/**\n * An object that can return the current timestamp in seconds since the UNIX epoch.\n */\ninterface TimestampSource {\n nowSeconds(): number;\n}\n\n/**\n * A TimestampSource implementation for environments that do not support the Performance Web API natively.\n *\n * Note that this TimestampSource does not use a monotonic clock. A call to `nowSeconds` may return a timestamp earlier\n * than a previously returned value. We do not try to emulate a monotonic behavior in order to facilitate debugging. It\n * is more obvious to explain \"why does my span have negative duration\" than \"why my spans have zero duration\".\n */\nconst dateTimestampSource: TimestampSource = {\n nowSeconds: () => Date.now() / 1000,\n};\n\n/**\n * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}\n * for accessing a high resolution monotonic clock.\n */\ninterface Performance {\n /**\n * The millisecond timestamp at which measurement began, measured in Unix time.\n */\n timeOrigin: number;\n /**\n * Returns the current millisecond timestamp, where 0 represents the start of measurement.\n */\n now(): number;\n}\n\n/**\n * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not\n * support the API.\n *\n * Wrapping the native API works around differences in behavior from different browsers.\n */\nfunction getBrowserPerformance(): Performance | undefined {\n const { performance } = getGlobalObject<Window>();\n if (!performance || !performance.now) {\n return undefined;\n }\n\n // Replace performance.timeOrigin with our own timeOrigin based on Date.now().\n //\n // This is a partial workaround for browsers reporting performance.timeOrigin such that performance.timeOrigin +\n // performance.now() gives a date arbitrarily in the past.\n //\n // Additionally, computing timeOrigin in this way fills the gap for browsers where performance.timeOrigin is\n // undefined.\n //\n // The assumption that performance.timeOrigin + performance.now() ~= Date.now() is flawed, but we depend on it to\n // interact with data coming out of performance entries.\n //\n // Note that despite recommendations against it in the spec, browsers implement the Performance API with a clock that\n // might stop when the computer is asleep (and perhaps under other circumstances). Such behavior causes\n // performance.timeOrigin + performance.now() to have an arbitrary skew over Date.now(). In laptop computers, we have\n // observed skews that can be as long as days, weeks or months.\n //\n // See https://github.com/getsentry/sentry-javascript/issues/2590.\n //\n // BUG: despite our best intentions, this workaround has its limitations. It mostly addresses timings of pageload\n // transactions, but ignores the skew built up over time that can aversely affect timestamps of navigation\n // transactions of long-lived web pages.\n const timeOrigin = Date.now() - performance.now();\n\n return {\n now: () => performance.now(),\n timeOrigin,\n };\n}\n\n/**\n * Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't\n * implement the API.\n */\nfunction getNodePerformance(): Performance | undefined {\n try {\n const perfHooks = dynamicRequire(module, 'perf_hooks') as { performance: Performance };\n return perfHooks.performance;\n } catch (_) {\n return undefined;\n }\n}\n\n/**\n * The Performance API implementation for the current platform, if available.\n */\nconst platformPerformance: Performance | undefined = isNodeEnv() ? getNodePerformance() : getBrowserPerformance();\n\nconst timestampSource: TimestampSource =\n platformPerformance === undefined\n ? dateTimestampSource\n : {\n nowSeconds: () => (platformPerformance.timeOrigin + platformPerformance.now()) / 1000,\n };\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using the Date API.\n */\nexport const dateTimestampInSeconds = dateTimestampSource.nowSeconds.bind(dateTimestampSource);\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the\n * availability of the Performance API.\n *\n * See `usingPerformanceAPI` to test whether the Performance API is used.\n *\n * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is\n * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The\n * skew can grow to arbitrary amounts like days, weeks or months.\n * See https://github.com/getsentry/sentry-javascript/issues/2590.\n */\nexport const timestampInSeconds = timestampSource.nowSeconds.bind(timestampSource);\n\n// Re-exported with an old name for backwards-compatibility.\nexport const timestampWithMs = timestampInSeconds;\n\n/**\n * A boolean that is true when timestampInSeconds uses the Performance API to produce monotonic timestamps.\n */\nexport const usingPerformanceAPI = platformPerformance !== undefined;\n\n/**\n * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the\n * performance API is available.\n */\nexport const browserPerformanceTimeOrigin = ((): number | undefined => {\n const { performance } = getGlobalObject<Window>();\n if (!performance) {\n return undefined;\n }\n if (performance.timeOrigin) {\n return performance.timeOrigin;\n }\n // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin\n // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.\n // Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always\n // a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the\n // Date API.\n // eslint-disable-next-line deprecation/deprecation\n return (performance.timing && performance.timing.navigationStart) || Date.now();\n})();\n","/* eslint-disable max-lines */\nimport {\n Breadcrumb,\n CaptureContext,\n Context,\n Contexts,\n Event,\n EventHint,\n EventProcessor,\n Extra,\n Extras,\n Scope as ScopeInterface,\n ScopeContext,\n Severity,\n Span,\n Transaction,\n User,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, getGlobalObject, isPlainObject, isThenable, SyncPromise } from '@sentry/utils';\n\nimport { Session } from './session';\n\n/**\n * Holds additional event information. {@link Scope.applyToEvent} will be\n * called by the client before an event will be sent.\n */\nexport class Scope implements ScopeInterface {\n /** Flag if notifiying is happening. */\n protected _notifyingListeners: boolean = false;\n\n /** Callback for client to receive scope changes. */\n protected _scopeListeners: Array<(scope: Scope) => void> = [];\n\n /** Callback list that will be called after {@link applyToEvent}. */\n protected _eventProcessors: EventProcessor[] = [];\n\n /** Array of breadcrumbs. */\n protected _breadcrumbs: Breadcrumb[] = [];\n\n /** User */\n protected _user: User = {};\n\n /** Tags */\n protected _tags: { [key: string]: string } = {};\n\n /** Extra */\n protected _extra: Extras = {};\n\n /** Contexts */\n protected _contexts: Contexts = {};\n\n /** Fingerprint */\n protected _fingerprint?: string[];\n\n /** Severity */\n protected _level?: Severity;\n\n /** Transaction Name */\n protected _transactionName?: string;\n\n /** Span */\n protected _span?: Span;\n\n /** Session */\n protected _session?: Session;\n\n /**\n * Inherit values from the parent scope.\n * @param scope to clone.\n */\n public static clone(scope?: Scope): Scope {\n const newScope = new Scope();\n if (scope) {\n newScope._breadcrumbs = [...scope._breadcrumbs];\n newScope._tags = { ...scope._tags };\n newScope._extra = { ...scope._extra };\n newScope._contexts = { ...scope._contexts };\n newScope._user = scope._user;\n newScope._level = scope._level;\n newScope._span = scope._span;\n newScope._session = scope._session;\n newScope._transactionName = scope._transactionName;\n newScope._fingerprint = scope._fingerprint;\n newScope._eventProcessors = [...scope._eventProcessors];\n }\n return newScope;\n }\n\n /**\n * Add internal on change listener. Used for sub SDKs that need to store the scope.\n * @hidden\n */\n public addScopeListener(callback: (scope: Scope) => void): void {\n this._scopeListeners.push(callback);\n }\n\n /**\n * @inheritDoc\n */\n public addEventProcessor(callback: EventProcessor): this {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setUser(user: User | null): this {\n this._user = user || {};\n if (this._session) {\n this._session.update({ user });\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getUser(): User | undefined {\n return this._user;\n }\n\n /**\n * @inheritDoc\n */\n public setTags(tags: { [key: string]: string }): this {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setTag(key: string, value: string): this {\n this._tags = { ...this._tags, [key]: value };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setExtras(extras: Extras): this {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setExtra(key: string, extra: Extra): this {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setFingerprint(fingerprint: string[]): this {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setLevel(level: Severity): this {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setTransactionName(name?: string): this {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Can be removed in major version.\n * @deprecated in favor of {@link this.setTransactionName}\n */\n public setTransaction(name?: string): this {\n return this.setTransactionName(name);\n }\n\n /**\n * @inheritDoc\n */\n public setContext(key: string, context: Context | null): this {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts = { ...this._contexts, [key]: context };\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setSpan(span?: Span): this {\n this._span = span;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getSpan(): Span | undefined {\n return this._span;\n }\n\n /**\n * @inheritDoc\n */\n public getTransaction(): Transaction | undefined {\n // often, this span will be a transaction, but it's not guaranteed to be\n const span = this.getSpan() as undefined | (Span & { spanRecorder: { spans: Span[] } });\n\n // try it the new way first\n if (span?.transaction) {\n return span?.transaction;\n }\n\n // fallback to the old way (known bug: this only finds transactions with sampled = true)\n if (span?.spanRecorder?.spans[0]) {\n return span.spanRecorder.spans[0] as Transaction;\n }\n\n // neither way found a transaction\n return undefined;\n }\n\n /**\n * @inheritDoc\n */\n public setSession(session?: Session): this {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getSession(): Session | undefined {\n return this._session;\n }\n\n /**\n * @inheritDoc\n */\n public update(captureContext?: CaptureContext): this {\n if (!captureContext) {\n return this;\n }\n\n if (typeof captureContext === 'function') {\n const updatedScope = (captureContext as <T>(scope: T) => T)(this);\n return updatedScope instanceof Scope ? updatedScope : this;\n }\n\n if (captureContext instanceof Scope) {\n this._tags = { ...this._tags, ...captureContext._tags };\n this._extra = { ...this._extra, ...captureContext._extra };\n this._contexts = { ...this._contexts, ...captureContext._contexts };\n if (captureContext._user && Object.keys(captureContext._user).length) {\n this._user = captureContext._user;\n }\n if (captureContext._level) {\n this._level = captureContext._level;\n }\n if (captureContext._fingerprint) {\n this._fingerprint = captureContext._fingerprint;\n }\n } else if (isPlainObject(captureContext)) {\n // eslint-disable-next-line no-param-reassign\n captureContext = captureContext as ScopeContext;\n this._tags = { ...this._tags, ...captureContext.tags };\n this._extra = { ...this._extra, ...captureContext.extra };\n this._contexts = { ...this._contexts, ...captureContext.contexts };\n if (captureContext.user) {\n this._user = captureContext.user;\n }\n if (captureContext.level) {\n this._level = captureContext.level;\n }\n if (captureContext.fingerprint) {\n this._fingerprint = captureContext.fingerprint;\n }\n }\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public clear(): this {\n this._breadcrumbs = [];\n this._tags = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._span = undefined;\n this._session = undefined;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const mergedBreadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n };\n\n this._breadcrumbs =\n maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0\n ? [...this._breadcrumbs, mergedBreadcrumb].slice(-maxBreadcrumbs)\n : [...this._breadcrumbs, mergedBreadcrumb];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public clearBreadcrumbs(): this {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Applies the current context and fingerprint to the event.\n * Note that breadcrumbs will be added by the client.\n * Also if the event has already breadcrumbs on it, we do not merge them.\n * @param event Event\n * @param hint May contain additional informartion about the original exception.\n * @hidden\n */\n public applyToEvent(event: Event, hint?: EventHint): PromiseLike<Event | null> {\n if (this._extra && Object.keys(this._extra).length) {\n event.extra = { ...this._extra, ...event.extra };\n }\n if (this._tags && Object.keys(this._tags).length) {\n event.tags = { ...this._tags, ...event.tags };\n }\n if (this._user && Object.keys(this._user).length) {\n event.user = { ...this._user, ...event.user };\n }\n if (this._contexts && Object.keys(this._contexts).length) {\n event.contexts = { ...this._contexts, ...event.contexts };\n }\n if (this._level) {\n event.level = this._level;\n }\n if (this._transactionName) {\n event.transaction = this._transactionName;\n }\n // We want to set the trace context for normal events only if there isn't already\n // a trace context on the event. There is a product feature in place where we link\n // errors with transaction and it relys on that.\n if (this._span) {\n event.contexts = { trace: this._span.getTraceContext(), ...event.contexts };\n const transactionName = this._span.transaction?.name;\n if (transactionName) {\n event.tags = { transaction: transactionName, ...event.tags };\n }\n }\n\n this._applyFingerprint(event);\n\n event.breadcrumbs = [...(event.breadcrumbs || []), ...this._breadcrumbs];\n event.breadcrumbs = event.breadcrumbs.length > 0 ? event.breadcrumbs : undefined;\n\n return this._notifyEventProcessors([...getGlobalEventProcessors(), ...this._eventProcessors], event, hint);\n }\n\n /**\n * This will be called after {@link applyToEvent} is finished.\n */\n protected _notifyEventProcessors(\n processors: EventProcessor[],\n event: Event | null,\n hint?: EventHint,\n index: number = 0,\n ): PromiseLike<Event | null> {\n return new SyncPromise<Event | null>((resolve, reject) => {\n const processor = processors[index];\n if (event === null || typeof processor !== 'function') {\n resolve(event);\n } else {\n const result = processor({ ...event }, hint) as Event | null;\n if (isThenable(result)) {\n (result as PromiseLike<Event | null>)\n .then(final => this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve))\n .then(null, reject);\n } else {\n this._notifyEventProcessors(processors, result, hint, index + 1)\n .then(resolve)\n .then(null, reject);\n }\n }\n });\n }\n\n /**\n * This will be called on every set call.\n */\n protected _notifyScopeListeners(): void {\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n setTimeout(() => {\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n });\n }\n }\n\n /**\n * Applies fingerprint from the scope to the event if there's one,\n * uses message if there's one instead or get rid of empty fingerprint\n */\n private _applyFingerprint(event: Event): void {\n // Make sure it's an array first and we actually have something in place\n event.fingerprint = event.fingerprint\n ? Array.isArray(event.fingerprint)\n ? event.fingerprint\n : [event.fingerprint]\n : [];\n\n // If we have something on the scope, then merge it with event\n if (this._fingerprint) {\n event.fingerprint = event.fingerprint.concat(this._fingerprint);\n }\n\n // If we have no data at all, remove empty array default\n if (event.fingerprint && !event.fingerprint.length) {\n delete event.fingerprint;\n }\n }\n}\n\n/**\n * Retruns the global event processors.\n */\nfunction getGlobalEventProcessors(): EventProcessor[] {\n /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n const global = getGlobalObject<any>();\n global.__SENTRY__ = global.__SENTRY__ || {};\n global.__SENTRY__.globalEventProcessors = global.__SENTRY__.globalEventProcessors || [];\n return global.__SENTRY__.globalEventProcessors;\n /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n}\n\n/**\n * Add a EventProcessor to be kept globally.\n * @param callback EventProcessor to add\n */\nexport function addGlobalEventProcessor(callback: EventProcessor): void {\n getGlobalEventProcessors().push(callback);\n}\n","import { Session as SessionInterface, SessionContext, SessionStatus } from '@sentry/types';\nimport { dropUndefinedKeys, uuid4 } from '@sentry/utils';\n\n/**\n * @inheritdoc\n */\nexport class Session implements SessionInterface {\n public userAgent?: string;\n public errors: number = 0;\n public release?: string;\n public sid: string = uuid4();\n public did?: string;\n public timestamp: number = Date.now();\n public started: number = Date.now();\n public duration: number = 0;\n public status: SessionStatus = SessionStatus.Ok;\n public environment?: string;\n public ipAddress?: string;\n\n constructor(context?: Omit<SessionContext, 'started' | 'status'>) {\n if (context) {\n this.update(context);\n }\n }\n\n /** JSDoc */\n // eslint-disable-next-line complexity\n update(context: SessionContext = {}): void {\n if (context.user) {\n if (context.user.ip_address) {\n this.ipAddress = context.user.ip_address;\n }\n\n if (!context.did) {\n this.did = context.user.id || context.user.email || context.user.username;\n }\n }\n\n this.timestamp = context.timestamp || Date.now();\n\n if (context.sid) {\n // Good enough uuid validation. — Kamil\n this.sid = context.sid.length === 32 ? context.sid : uuid4();\n }\n if (context.did) {\n this.did = `${context.did}`;\n }\n if (typeof context.started === 'number') {\n this.started = context.started;\n }\n if (typeof context.duration === 'number') {\n this.duration = context.duration;\n } else {\n this.duration = this.timestamp - this.started;\n }\n if (context.release) {\n this.release = context.release;\n }\n if (context.environment) {\n this.environment = context.environment;\n }\n if (context.ipAddress) {\n this.ipAddress = context.ipAddress;\n }\n if (context.userAgent) {\n this.userAgent = context.userAgent;\n }\n if (typeof context.errors === 'number') {\n this.errors = context.errors;\n }\n if (context.status) {\n this.status = context.status;\n }\n }\n\n /** JSDoc */\n close(status?: Exclude<SessionStatus, SessionStatus.Ok>): void {\n if (status) {\n this.update({ status });\n } else if (this.status === SessionStatus.Ok) {\n this.update({ status: SessionStatus.Exited });\n } else {\n this.update();\n }\n }\n\n /** JSDoc */\n toJSON(): {\n init: boolean;\n sid: string;\n did?: string;\n timestamp: string;\n started: string;\n duration: number;\n status: SessionStatus;\n errors: number;\n attrs?: {\n release?: string;\n environment?: string;\n user_agent?: string;\n ip_address?: string;\n };\n } {\n return dropUndefinedKeys({\n sid: `${this.sid}`,\n init: true,\n started: new Date(this.started).toISOString(),\n timestamp: new Date(this.timestamp).toISOString(),\n status: this.status,\n errors: this.errors,\n did: typeof this.did === 'number' || typeof this.did === 'string' ? `${this.did}` : undefined,\n duration: this.duration,\n attrs: dropUndefinedKeys({\n release: this.release,\n environment: this.environment,\n ip_address: this.ipAddress,\n user_agent: this.userAgent,\n }),\n });\n }\n}\n","/* eslint-disable max-lines */\nimport {\n Breadcrumb,\n BreadcrumbHint,\n Client,\n CustomSamplingContext,\n Event,\n EventHint,\n Extra,\n Extras,\n Hub as HubInterface,\n Integration,\n IntegrationClass,\n SessionContext,\n Severity,\n Span,\n SpanContext,\n Transaction,\n TransactionContext,\n User,\n} from '@sentry/types';\nimport { consoleSandbox, dateTimestampInSeconds, getGlobalObject, isNodeEnv, logger, uuid4 } from '@sentry/utils';\n\nimport { Carrier, DomainAsCarrier, Layer } from './interfaces';\nimport { Scope } from './scope';\nimport { Session } from './session';\n\n/**\n * API compatibility version of this hub.\n *\n * WARNING: This number should only be increased when the global interface\n * changes and new methods are introduced.\n *\n * @hidden\n */\nexport const API_VERSION = 3;\n\n/**\n * Default maximum number of breadcrumbs added to an event. Can be overwritten\n * with {@link Options.maxBreadcrumbs}.\n */\nconst DEFAULT_BREADCRUMBS = 100;\n\n/**\n * Absolute maximum number of breadcrumbs added to an event. The\n * `maxBreadcrumbs` option cannot be higher than this value.\n */\nconst MAX_BREADCRUMBS = 100;\n\n/**\n * @inheritDoc\n */\nexport class Hub implements HubInterface {\n /** Is a {@link Layer}[] containing the client and scope */\n private readonly _stack: Layer[] = [{}];\n\n /** Contains the last event id of a captured event. */\n private _lastEventId?: string;\n\n /**\n * Creates a new instance of the hub, will push one {@link Layer} into the\n * internal stack on creation.\n *\n * @param client bound to the hub.\n * @param scope bound to the hub.\n * @param version number, higher number means higher priority.\n */\n public constructor(client?: Client, scope: Scope = new Scope(), private readonly _version: number = API_VERSION) {\n this.getStackTop().scope = scope;\n this.bindClient(client);\n }\n\n /**\n * @inheritDoc\n */\n public isOlderThan(version: number): boolean {\n return this._version < version;\n }\n\n /**\n * @inheritDoc\n */\n public bindClient(client?: Client): void {\n const top = this.getStackTop();\n top.client = client;\n if (client && client.setupIntegrations) {\n client.setupIntegrations();\n }\n }\n\n /**\n * @inheritDoc\n */\n public pushScope(): Scope {\n // We want to clone the content of prev scope\n const scope = Scope.clone(this.getScope());\n this.getStack().push({\n client: this.getClient(),\n scope,\n });\n return scope;\n }\n\n /**\n * @inheritDoc\n */\n public popScope(): boolean {\n if (this.getStack().length <= 1) return false;\n return !!this.getStack().pop();\n }\n\n /**\n * @inheritDoc\n */\n public withScope(callback: (scope: Scope) => void): void {\n const scope = this.pushScope();\n try {\n callback(scope);\n } finally {\n this.popScope();\n }\n }\n\n /**\n * @inheritDoc\n */\n public getClient<C extends Client>(): C | undefined {\n return this.getStackTop().client as C;\n }\n\n /** Returns the scope of the top stack. */\n public getScope(): Scope | undefined {\n return this.getStackTop().scope;\n }\n\n /** Returns the scope stack for domains or the process. */\n public getStack(): Layer[] {\n return this._stack;\n }\n\n /** Returns the topmost scope layer in the order domain > local > process. */\n public getStackTop(): Layer {\n return this._stack[this._stack.length - 1];\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public captureException(exception: any, hint?: EventHint): string {\n const eventId = (this._lastEventId = uuid4());\n let finalHint = hint;\n\n // If there's no explicit hint provided, mimick the same thing that would happen\n // in the minimal itself to create a consistent behavior.\n // We don't do this in the client, as it's the lowest level API, and doing this,\n // would prevent user from having full control over direct calls.\n if (!hint) {\n let syntheticException: Error;\n try {\n throw new Error('Sentry syntheticException');\n } catch (exception) {\n syntheticException = exception as Error;\n }\n finalHint = {\n originalException: exception,\n syntheticException,\n };\n }\n\n this._invokeClient('captureException', exception, {\n ...finalHint,\n event_id: eventId,\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureMessage(message: string, level?: Severity, hint?: EventHint): string {\n const eventId = (this._lastEventId = uuid4());\n let finalHint = hint;\n\n // If there's no explicit hint provided, mimick the same thing that would happen\n // in the minimal itself to create a consistent behavior.\n // We don't do this in the client, as it's the lowest level API, and doing this,\n // would prevent user from having full control over direct calls.\n if (!hint) {\n let syntheticException: Error;\n try {\n throw new Error(message);\n } catch (exception) {\n syntheticException = exception as Error;\n }\n finalHint = {\n originalException: message,\n syntheticException,\n };\n }\n\n this._invokeClient('captureMessage', message, level, {\n ...finalHint,\n event_id: eventId,\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureEvent(event: Event, hint?: EventHint): string {\n const eventId = (this._lastEventId = uuid4());\n this._invokeClient('captureEvent', event, {\n ...hint,\n event_id: eventId,\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public lastEventId(): string | undefined {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void {\n const { scope, client } = this.getStackTop();\n\n if (!scope || !client) return;\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } =\n (client.getOptions && client.getOptions()) || {};\n\n if (maxBreadcrumbs <= 0) return;\n\n const timestamp = dateTimestampInSeconds();\n const mergedBreadcrumb = { timestamp, ...breadcrumb };\n const finalBreadcrumb = beforeBreadcrumb\n ? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) as Breadcrumb | null)\n : mergedBreadcrumb;\n\n if (finalBreadcrumb === null) return;\n\n scope.addBreadcrumb(finalBreadcrumb, Math.min(maxBreadcrumbs, MAX_BREADCRUMBS));\n }\n\n /**\n * @inheritDoc\n */\n public setUser(user: User | null): void {\n const scope = this.getScope();\n if (scope) scope.setUser(user);\n }\n\n /**\n * @inheritDoc\n */\n public setTags(tags: { [key: string]: string }): void {\n const scope = this.getScope();\n if (scope) scope.setTags(tags);\n }\n\n /**\n * @inheritDoc\n */\n public setExtras(extras: Extras): void {\n const scope = this.getScope();\n if (scope) scope.setExtras(extras);\n }\n\n /**\n * @inheritDoc\n */\n public setTag(key: string, value: string): void {\n const scope = this.getScope();\n if (scope) scope.setTag(key, value);\n }\n\n /**\n * @inheritDoc\n */\n public setExtra(key: string, extra: Extra): void {\n const scope = this.getScope();\n if (scope) scope.setExtra(key, extra);\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setContext(name: string, context: { [key: string]: any } | null): void {\n const scope = this.getScope();\n if (scope) scope.setContext(name, context);\n }\n\n /**\n * @inheritDoc\n */\n public configureScope(callback: (scope: Scope) => void): void {\n const { scope, client } = this.getStackTop();\n if (scope && client) {\n callback(scope);\n }\n }\n\n /**\n * @inheritDoc\n */\n public run(callback: (hub: Hub) => void): void {\n const oldHub = makeMain(this);\n try {\n callback(this);\n } finally {\n makeMain(oldHub);\n }\n }\n\n /**\n * @inheritDoc\n */\n public getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {\n const client = this.getClient();\n if (!client) return null;\n try {\n return client.getIntegration(integration);\n } catch (_oO) {\n logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);\n return null;\n }\n }\n\n /**\n * @inheritDoc\n */\n public startSpan(context: SpanContext): Span {\n return this._callExtensionMethod('startSpan', context);\n }\n\n /**\n * @inheritDoc\n */\n public startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): Transaction {\n return this._callExtensionMethod('startTransaction', context, customSamplingContext);\n }\n\n /**\n * @inheritDoc\n */\n public traceHeaders(): { [key: string]: string } {\n return this._callExtensionMethod<{ [key: string]: string }>('traceHeaders');\n }\n\n /**\n * @inheritDoc\n */\n public startSession(context?: SessionContext): Session {\n // End existing session if there's one\n this.endSession();\n\n const { scope, client } = this.getStackTop();\n const { release, environment } = (client && client.getOptions()) || {};\n const session = new Session({\n release,\n environment,\n ...(scope && { user: scope.getUser() }),\n ...context,\n });\n if (scope) {\n scope.setSession(session);\n }\n return session;\n }\n\n /**\n * @inheritDoc\n */\n public endSession(): void {\n const { scope, client } = this.getStackTop();\n if (!scope) return;\n\n const session = scope.getSession && scope.getSession();\n if (session) {\n session.close();\n if (client && client.captureSession) {\n client.captureSession(session);\n }\n scope.setSession();\n }\n }\n\n /**\n * Internal helper function to call a method on the top client if it exists.\n *\n * @param method The method to call on the client.\n * @param args Arguments to pass to the client function.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _invokeClient<M extends keyof Client>(method: M, ...args: any[]): void {\n const { scope, client } = this.getStackTop();\n if (client && client[method]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n (client as any)[method](...args, scope);\n }\n }\n\n /**\n * Calls global extension method and binding current instance to the function call\n */\n // @ts-ignore Function lacks ending return statement and return type does not include 'undefined'. ts(2366)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _callExtensionMethod<T>(method: string, ...args: any[]): T {\n const carrier = getMainCarrier();\n const sentry = carrier.__SENTRY__;\n if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') {\n return sentry.extensions[method].apply(this, args);\n }\n logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);\n }\n}\n\n/** Returns the global shim registry. */\nexport function getMainCarrier(): Carrier {\n const carrier = getGlobalObject();\n carrier.__SENTRY__ = carrier.__SENTRY__ || {\n extensions: {},\n hub: undefined,\n };\n return carrier;\n}\n\n/**\n * Replaces the current main hub with the passed one on the global object\n *\n * @returns The old replaced hub\n */\nexport function makeMain(hub: Hub): Hub {\n const registry = getMainCarrier();\n const oldHub = getHubFromCarrier(registry);\n setHubOnCarrier(registry, hub);\n return oldHub;\n}\n\n/**\n * Returns the default hub instance.\n *\n * If a hub is already registered in the global carrier but this module\n * contains a more recent version, it replaces the registered version.\n * Otherwise, the currently registered hub will be returned.\n */\nexport function getCurrentHub(): Hub {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n\n // If there's no hub, or its an old API, assign a new one\n if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(API_VERSION)) {\n setHubOnCarrier(registry, new Hub());\n }\n\n // Prefer domains over global if they are there (applicable only to Node environment)\n if (isNodeEnv()) {\n return getHubFromActiveDomain(registry);\n }\n // Return hub that lives on a global object\n return getHubFromCarrier(registry);\n}\n\n/**\n * Returns the active domain, if one exists\n *\n * @returns The domain, or undefined if there is no active domain\n */\nexport function getActiveDomain(): DomainAsCarrier | undefined {\n const sentry = getMainCarrier().__SENTRY__;\n\n return sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active;\n}\n\n/**\n * Try to read the hub from an active domain, and fallback to the registry if one doesn't exist\n * @returns discovered hub\n */\nfunction getHubFromActiveDomain(registry: Carrier): Hub {\n try {\n const activeDomain = getActiveDomain();\n\n // If there's no active domain, just return global hub\n if (!activeDomain) {\n return getHubFromCarrier(registry);\n }\n\n // If there's no hub on current domain, or it's an old API, assign a new one\n if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(API_VERSION)) {\n const registryHubTopStack = getHubFromCarrier(registry).getStackTop();\n setHubOnCarrier(activeDomain, new Hub(registryHubTopStack.client, Scope.clone(registryHubTopStack.scope)));\n }\n\n // Return hub that lives on a domain\n return getHubFromCarrier(activeDomain);\n } catch (_Oo) {\n // Return hub that lives on a global object\n return getHubFromCarrier(registry);\n }\n}\n\n/**\n * This will tell whether a carrier has a hub on it or not\n * @param carrier object\n */\nfunction hasHubOnCarrier(carrier: Carrier): boolean {\n return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);\n}\n\n/**\n * This will create a new {@link Hub} and add to the passed object on\n * __SENTRY__.hub.\n * @param carrier object\n * @hidden\n */\nexport function getHubFromCarrier(carrier: Carrier): Hub {\n if (carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub) return carrier.__SENTRY__.hub;\n carrier.__SENTRY__ = carrier.__SENTRY__ || {};\n carrier.__SENTRY__.hub = new Hub();\n return carrier.__SENTRY__.hub;\n}\n\n/**\n * This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute\n * @param carrier object\n * @param hub Hub\n */\nexport function setHubOnCarrier(carrier: Carrier, hub: Hub): boolean {\n if (!carrier) return false;\n carrier.__SENTRY__ = carrier.__SENTRY__ || {};\n carrier.__SENTRY__.hub = hub;\n return true;\n}\n","import { getCurrentHub, Hub, Scope } from '@sentry/hub';\nimport {\n Breadcrumb,\n CaptureContext,\n CustomSamplingContext,\n Event,\n Extra,\n Extras,\n Severity,\n Transaction,\n TransactionContext,\n User,\n} from '@sentry/types';\n\n/**\n * This calls a function on the current hub.\n * @param method function to call on hub.\n * @param args to pass to function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction callOnHub<T>(method: string, ...args: any[]): T {\n const hub = getCurrentHub();\n if (hub && hub[method as keyof Hub]) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (hub[method as keyof Hub] as any)(...args);\n }\n throw new Error(`No hub defined or ${method} was not found on the hub, please open a bug report.`);\n}\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception An exception-like object.\n * @returns The generated eventId.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\nexport function captureException(exception: any, captureContext?: CaptureContext): string {\n let syntheticException: Error;\n try {\n throw new Error('Sentry syntheticException');\n } catch (exception) {\n syntheticException = exception as Error;\n }\n return callOnHub('captureException', exception, {\n captureContext,\n originalException: exception,\n syntheticException,\n });\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param level Define the level of the message.\n * @returns The generated eventId.\n */\nexport function captureMessage(message: string, captureContext?: CaptureContext | Severity): string {\n let syntheticException: Error;\n try {\n throw new Error(message);\n } catch (exception) {\n syntheticException = exception as Error;\n }\n\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const context = typeof captureContext !== 'string' ? { captureContext } : undefined;\n\n return callOnHub('captureMessage', message, level, {\n originalException: message,\n syntheticException,\n ...context,\n });\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @returns The generated eventId.\n */\nexport function captureEvent(event: Event): string {\n return callOnHub('captureEvent', event);\n}\n\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n */\nexport function configureScope(callback: (scope: Scope) => void): void {\n callOnHub<void>('configureScope', callback);\n}\n\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n *\n * @param breadcrumb The breadcrumb to record.\n */\nexport function addBreadcrumb(breadcrumb: Breadcrumb): void {\n callOnHub<void>('addBreadcrumb', breadcrumb);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function setContext(name: string, context: { [key: string]: any } | null): void {\n callOnHub<void>('setContext', name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nexport function setExtras(extras: Extras): void {\n callOnHub<void>('setExtras', extras);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nexport function setTags(tags: { [key: string]: string }): void {\n callOnHub<void>('setTags', tags);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nexport function setExtra(key: string, extra: Extra): void {\n callOnHub<void>('setExtra', key, extra);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n * @param key String key of tag\n * @param value String value of tag\n */\nexport function setTag(key: string, value: string): void {\n callOnHub<void>('setTag', key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nexport function setUser(user: User | null): void {\n callOnHub<void>('setUser', user);\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope(callback: (scope: Scope) => void): void {\n callOnHub<void>('withScope', callback);\n}\n\n/**\n * Calls a function on the latest client. Use this with caution, it's meant as\n * in \"internal\" helper so we don't need to expose every possible function in\n * the shim. It is not guaranteed that the client actually implements the\n * function.\n *\n * @param method The method to call on the client/client.\n * @param args Arguments to pass to the client/fontend.\n * @hidden\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function _callOnClient(method: string, ...args: any[]): void {\n callOnHub<void>('_invokeClient', method, ...args);\n}\n\n/**\n * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.\n *\n * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a\n * new child span within the transaction or any span, call the respective `.startChild()` method.\n *\n * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.\n *\n * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its\n * finished child spans will be sent to Sentry.\n *\n * @param context Properties of the new `Transaction`.\n * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent\n * default values). See {@link Options.tracesSampler}.\n *\n * @returns The transaction which was just started\n */\nexport function startTransaction(\n context: TransactionContext,\n customSamplingContext?: CustomSamplingContext,\n): Transaction {\n return callOnHub('startTransaction', { ...context }, customSamplingContext);\n}\n","import { DsnLike } from '@sentry/types';\nimport { Dsn, urlEncode } from '@sentry/utils';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Helper class to provide urls to different Sentry endpoints. */\nexport class API {\n /** The internally used Dsn object. */\n private readonly _dsnObject: Dsn;\n /** Create a new instance of API */\n public constructor(public dsn: DsnLike) {\n this._dsnObject = new Dsn(dsn);\n }\n\n /** Returns the Dsn object. */\n public getDsn(): Dsn {\n return this._dsnObject;\n }\n\n /** Returns the prefix to construct Sentry ingestion API endpoints. */\n public getBaseApiEndpoint(): string {\n const dsn = this._dsnObject;\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n }\n\n /** Returns the store endpoint URL. */\n public getStoreEndpoint(): string {\n return this._getIngestEndpoint('store');\n }\n\n /**\n * Returns the store endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\n public getStoreEndpointWithUrlEncodedAuth(): string {\n return `${this.getStoreEndpoint()}?${this._encodedAuth()}`;\n }\n\n /**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\n public getEnvelopeEndpointWithUrlEncodedAuth(): string {\n return `${this._getEnvelopeEndpoint()}?${this._encodedAuth()}`;\n }\n\n /** Returns only the path component for the store endpoint. */\n public getStoreEndpointPath(): string {\n const dsn = this._dsnObject;\n return `${dsn.path ? `/${dsn.path}` : ''}/api/${dsn.projectId}/store/`;\n }\n\n /**\n * Returns an object that can be used in request headers.\n * This is needed for node and the old /store endpoint in sentry\n */\n public getRequestHeaders(clientName: string, clientVersion: string): { [key: string]: string } {\n const dsn = this._dsnObject;\n const header = [`Sentry sentry_version=${SENTRY_API_VERSION}`];\n header.push(`sentry_client=${clientName}/${clientVersion}`);\n header.push(`sentry_key=${dsn.user}`);\n if (dsn.pass) {\n header.push(`sentry_secret=${dsn.pass}`);\n }\n return {\n 'Content-Type': 'application/json',\n 'X-Sentry-Auth': header.join(', '),\n };\n }\n\n /** Returns the url to the report dialog endpoint. */\n public getReportDialogEndpoint(\n dialogOptions: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n user?: { name?: string; email?: string };\n } = {},\n ): string {\n const dsn = this._dsnObject;\n const endpoint = `${this.getBaseApiEndpoint()}embed/error-page/`;\n\n const encodedOptions = [];\n encodedOptions.push(`dsn=${dsn.toString()}`);\n for (const key in dialogOptions) {\n if (key === 'user') {\n if (!dialogOptions.user) {\n continue;\n }\n if (dialogOptions.user.name) {\n encodedOptions.push(`name=${encodeURIComponent(dialogOptions.user.name)}`);\n }\n if (dialogOptions.user.email) {\n encodedOptions.push(`email=${encodeURIComponent(dialogOptions.user.email)}`);\n }\n } else {\n encodedOptions.push(`${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] as string)}`);\n }\n }\n if (encodedOptions.length) {\n return `${endpoint}?${encodedOptions.join('&')}`;\n }\n\n return endpoint;\n }\n\n /** Returns the envelope endpoint URL. */\n private _getEnvelopeEndpoint(): string {\n return this._getIngestEndpoint('envelope');\n }\n\n /** Returns the ingest API endpoint for target. */\n private _getIngestEndpoint(target: 'store' | 'envelope'): string {\n const base = this.getBaseApiEndpoint();\n const dsn = this._dsnObject;\n return `${base}${dsn.projectId}/${target}/`;\n }\n\n /** Returns a URL-encoded string with auth config suitable for a query string. */\n private _encodedAuth(): string {\n const dsn = this._dsnObject;\n const auth = {\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n sentry_key: dsn.user,\n sentry_version: SENTRY_API_VERSION,\n };\n return urlEncode(auth);\n }\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/hub';\nimport { Integration, Options } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nexport const installedIntegrations: string[] = [];\n\n/** Map of integrations assigned to a client */\nexport interface IntegrationIndex {\n [key: string]: Integration;\n}\n\n/** Gets integration to install */\nexport function getIntegrationsToSetup(options: Options): Integration[] {\n const defaultIntegrations = (options.defaultIntegrations && [...options.defaultIntegrations]) || [];\n const userIntegrations = options.integrations;\n let integrations: Integration[] = [];\n if (Array.isArray(userIntegrations)) {\n const userIntegrationsNames = userIntegrations.map(i => i.name);\n const pickedIntegrationsNames: string[] = [];\n\n // Leave only unique default integrations, that were not overridden with provided user integrations\n defaultIntegrations.forEach(defaultIntegration => {\n if (\n userIntegrationsNames.indexOf(defaultIntegration.name) === -1 &&\n pickedIntegrationsNames.indexOf(defaultIntegration.name) === -1\n ) {\n integrations.push(defaultIntegration);\n pickedIntegrationsNames.push(defaultIntegration.name);\n }\n });\n\n // Don't add same user integration twice\n userIntegrations.forEach(userIntegration => {\n if (pickedIntegrationsNames.indexOf(userIntegration.name) === -1) {\n integrations.push(userIntegration);\n pickedIntegrationsNames.push(userIntegration.name);\n }\n });\n } else if (typeof userIntegrations === 'function') {\n integrations = userIntegrations(defaultIntegrations);\n integrations = Array.isArray(integrations) ? integrations : [integrations];\n } else {\n integrations = [...defaultIntegrations];\n }\n\n // Make sure that if present, `Debug` integration will always run last\n const integrationsNames = integrations.map(i => i.name);\n const alwaysLastToRun = 'Debug';\n if (integrationsNames.indexOf(alwaysLastToRun) !== -1) {\n integrations.push(...integrations.splice(integrationsNames.indexOf(alwaysLastToRun), 1));\n }\n\n return integrations;\n}\n\n/** Setup given integration */\nexport function setupIntegration(integration: Integration): void {\n if (installedIntegrations.indexOf(integration.name) !== -1) {\n return;\n }\n integration.setupOnce(addGlobalEventProcessor, getCurrentHub);\n installedIntegrations.push(integration.name);\n logger.log(`Integration installed: ${integration.name}`);\n}\n\n/**\n * Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default\n * integrations are added unless they were already provided before.\n * @param integrations array of integration instances\n * @param withDefault should enable default integrations\n */\nexport function setupIntegrations<O extends Options>(options: O): IntegrationIndex {\n const integrations: IntegrationIndex = {};\n getIntegrationsToSetup(options).forEach(integration => {\n integrations[integration.name] = integration;\n setupIntegration(integration);\n });\n return integrations;\n}\n","/* eslint-disable max-lines */\nimport { Scope, Session } from '@sentry/hub';\nimport {\n Client,\n Event,\n EventHint,\n Integration,\n IntegrationClass,\n Options,\n SessionStatus,\n Severity,\n} from '@sentry/types';\nimport {\n dateTimestampInSeconds,\n Dsn,\n isPrimitive,\n isThenable,\n logger,\n normalize,\n SentryError,\n SyncPromise,\n truncate,\n uuid4,\n} from '@sentry/utils';\n\nimport { Backend, BackendClass } from './basebackend';\nimport { IntegrationIndex, setupIntegrations } from './integration';\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding backend constructor and options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}. Also, the Backend instance is available via\n * {@link Client.getBackend}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event via the backend, it is passed through\n * {@link BaseClient.prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient<NodeBackend, NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(NodeBackend, options);\n * }\n *\n * // ...\n * }\n */\nexport abstract class BaseClient<B extends Backend, O extends Options> implements Client<O> {\n /**\n * The backend used to physically interact in the environment. Usually, this\n * will correspond to the client. When composing SDKs, however, the Backend\n * from the root SDK will be used.\n */\n protected readonly _backend: B;\n\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n protected readonly _dsn?: Dsn;\n\n /** Array of used integrations. */\n protected _integrations: IntegrationIndex = {};\n\n /** Number of call being processed */\n protected _processing: number = 0;\n\n /**\n * Initializes this client instance.\n *\n * @param backendClass A constructor function to create the backend.\n * @param options Options for the client.\n */\n protected constructor(backendClass: BackendClass<B, O>, options: O) {\n this._backend = new backendClass(options);\n this._options = options;\n\n if (options.dsn) {\n this._dsn = new Dsn(options.dsn);\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n\n this._process(\n this._getBackend()\n .eventFromException(exception, hint)\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureMessage(message: string, level?: Severity, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n\n const promisedEvent = isPrimitive(message)\n ? this._getBackend().eventFromMessage(`${message}`, level, hint)\n : this._getBackend().eventFromException(message, hint);\n\n this._process(\n promisedEvent\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n\n this._process(\n this._captureEvent(event, hint, scope).then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureSession(session: Session): void {\n if (!session.release) {\n logger.warn('Discarded session because of missing release');\n } else {\n this._sendSession(session);\n }\n }\n\n /**\n * @inheritDoc\n */\n public getDsn(): Dsn | undefined {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n public getOptions(): O {\n return this._options;\n }\n\n /**\n * @inheritDoc\n */\n public flush(timeout?: number): PromiseLike<boolean> {\n return this._isClientProcessing(timeout).then(ready => {\n return this._getBackend()\n .getTransport()\n .close(timeout)\n .then(transportFlushed => ready && transportFlushed);\n });\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n return result;\n });\n }\n\n /**\n * Sets up the integrations\n */\n public setupIntegrations(): void {\n if (this._isEnabled()) {\n this._integrations = setupIntegrations(this._options);\n }\n }\n\n /**\n * @inheritDoc\n */\n public getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {\n try {\n return (this._integrations[integration.id] as T) || null;\n } catch (_oO) {\n logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /** Updates existing session based on the provided event */\n protected _updateSessionFromEvent(session: Session, event: Event): void {\n let crashed = false;\n let errored = false;\n let userAgent;\n const exceptions = event.exception && event.exception.values;\n\n if (exceptions) {\n errored = true;\n\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n const user = event.user;\n if (!session.userAgent) {\n const headers = event.request ? event.request.headers : {};\n for (const key in headers) {\n if (key.toLowerCase() === 'user-agent') {\n userAgent = headers[key];\n break;\n }\n }\n }\n\n session.update({\n ...(crashed && { status: SessionStatus.Crashed }),\n user,\n userAgent,\n errors: session.errors + Number(errored || crashed),\n });\n }\n\n /** Deliver captured session to Sentry */\n protected _sendSession(session: Session): void {\n this._getBackend().sendSession(session);\n }\n\n /** Waits for the client to be done with processing. */\n protected _isClientProcessing(timeout?: number): PromiseLike<boolean> {\n return new SyncPromise(resolve => {\n let ticked: number = 0;\n const tick: number = 1;\n\n const interval = setInterval(() => {\n if (this._processing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n\n /** Returns the current backend. */\n protected _getBackend(): B {\n return this._backend;\n }\n\n /** Determines whether this SDK is enabled and a valid Dsn is present. */\n protected _isEnabled(): boolean {\n return this.getOptions().enabled !== false && this._dsn !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n const { normalizeDepth = 3 } = this.getOptions();\n const prepared: Event = {\n ...event,\n event_id: event.event_id || (hint && hint.event_id ? hint.event_id : uuid4()),\n timestamp: event.timestamp || dateTimestampInSeconds(),\n };\n\n this._applyClientOptions(prepared);\n this._applyIntegrationsMetadata(prepared);\n\n // If we have scope given to us, use it as the base for further modifications.\n // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.\n let finalScope = scope;\n if (hint && hint.captureContext) {\n finalScope = Scope.clone(finalScope).update(hint.captureContext);\n }\n\n // We prepare the result here with a resolved Event.\n let result = SyncPromise.resolve<Event | null>(prepared);\n\n // This should be the last thing called, since we want that\n // {@link Hub.addEventProcessor} gets the finished prepared event.\n if (finalScope) {\n // In case we have a hub we reassign it.\n result = finalScope.applyToEvent(prepared, hint);\n }\n\n return result.then(evt => {\n if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {\n return this._normalizeEvent(evt, normalizeDepth);\n }\n return evt;\n });\n }\n\n /**\n * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.\n * Normalized keys:\n * - `breadcrumbs.data`\n * - `user`\n * - `contexts`\n * - `extra`\n * @param event Event\n * @returns Normalized event\n */\n protected _normalizeEvent(event: Event | null, depth: number): Event | null {\n if (!event) {\n return null;\n }\n\n const normalized = {\n ...event,\n ...(event.breadcrumbs && {\n breadcrumbs: event.breadcrumbs.map(b => ({\n ...b,\n ...(b.data && {\n data: normalize(b.data, depth),\n }),\n })),\n }),\n ...(event.user && {\n user: normalize(event.user, depth),\n }),\n ...(event.contexts && {\n contexts: normalize(event.contexts, depth),\n }),\n ...(event.extra && {\n extra: normalize(event.extra, depth),\n }),\n };\n // event.contexts.trace stores information about a Transaction. Similarly,\n // event.spans[] stores information about child Spans. Given that a\n // Transaction is conceptually a Span, normalization should apply to both\n // Transactions and Spans consistently.\n // For now the decision is to skip normalization of Transactions and Spans,\n // so this block overwrites the normalized event to add back the original\n // Transaction information prior to normalization.\n if (event.contexts && event.contexts.trace) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n normalized.contexts.trace = event.contexts.trace;\n }\n return normalized;\n }\n\n /**\n * Enhances event using the client configuration.\n * It takes care of all \"static\" values like environment, release and `dist`,\n * as well as truncating overly long values.\n * @param event event instance to be enhanced\n */\n protected _applyClientOptions(event: Event): void {\n const options = this.getOptions();\n const { environment, release, dist, maxValueLength = 250 } = options;\n\n if (!('environment' in event)) {\n event.environment = 'environment' in options ? environment : 'production';\n }\n\n if (event.release === undefined && release !== undefined) {\n event.release = release;\n }\n\n if (event.dist === undefined && dist !== undefined) {\n event.dist = dist;\n }\n\n if (event.message) {\n event.message = truncate(event.message, maxValueLength);\n }\n\n const exception = event.exception && event.exception.values && event.exception.values[0];\n if (exception && exception.value) {\n exception.value = truncate(exception.value, maxValueLength);\n }\n\n const request = event.request;\n if (request && request.url) {\n request.url = truncate(request.url, maxValueLength);\n }\n }\n\n /**\n * This function adds all used integrations to the SDK info in the event.\n * @param sdkInfo The sdkInfo of the event that will be filled with all integrations.\n */\n protected _applyIntegrationsMetadata(event: Event): void {\n const sdkInfo = event.sdk;\n const integrationsArray = Object.keys(this._integrations);\n if (sdkInfo && integrationsArray.length > 0) {\n sdkInfo.integrations = integrationsArray;\n }\n }\n\n /**\n * Tells the backend to send this event\n * @param event The Sentry event to send\n */\n protected _sendEvent(event: Event): void {\n this._getBackend().sendEvent(event);\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n protected _captureEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<string | undefined> {\n return this._processEvent(event, hint, scope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n logger.error(reason);\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n protected _processEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<Event> {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { beforeSend, sampleRate } = this.getOptions();\n\n if (!this._isEnabled()) {\n return SyncPromise.reject(new SentryError('SDK not enabled, will not send event.'));\n }\n\n const isTransaction = event.type === 'transaction';\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n return SyncPromise.reject(new SentryError('This event has been sampled, will not send event.'));\n }\n\n return this._prepareEvent(event, scope, hint)\n .then(prepared => {\n if (prepared === null) {\n throw new SentryError('An event processor returned null, will not send event.');\n }\n\n const isInternalException = hint && hint.data && (hint.data as { __sentry__: boolean }).__sentry__ === true;\n if (isInternalException || isTransaction || !beforeSend) {\n return prepared;\n }\n\n const beforeSendResult = beforeSend(prepared, hint);\n if (typeof beforeSendResult === 'undefined') {\n throw new SentryError('`beforeSend` method has to return `null` or a valid event.');\n } else if (isThenable(beforeSendResult)) {\n return (beforeSendResult as PromiseLike<Event | null>).then(\n event => event,\n e => {\n throw new SentryError(`beforeSend rejected with ${e}`);\n },\n );\n }\n return beforeSendResult;\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n throw new SentryError('`beforeSend` returned `null`, will not send event.');\n }\n\n const session = scope && scope.getSession && scope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n this._sendEvent(processedEvent);\n return processedEvent;\n })\n .then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason as Error,\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n protected _process<T>(promise: PromiseLike<T>): void {\n this._processing += 1;\n promise.then(\n value => {\n this._processing -= 1;\n return value;\n },\n reason => {\n this._processing -= 1;\n return reason;\n },\n );\n }\n}\n","import { Event, Response, Status, Transport } from '@sentry/types';\nimport { SyncPromise } from '@sentry/utils';\n\n/** Noop transport */\nexport class NoopTransport implements Transport {\n /**\n * @inheritDoc\n */\n public sendEvent(_: Event): PromiseLike<Response> {\n return SyncPromise.resolve({\n reason: `NoopTransport: Event has been skipped because no Dsn is configured.`,\n status: Status.Skipped,\n });\n }\n\n /**\n * @inheritDoc\n */\n public close(_?: number): PromiseLike<boolean> {\n return SyncPromise.resolve(true);\n }\n}\n","import { Event, EventHint, Options, Session, Severity, Transport } from '@sentry/types';\nimport { logger, SentryError } from '@sentry/utils';\n\nimport { NoopTransport } from './transports/noop';\n\n/**\n * Internal platform-dependent Sentry SDK Backend.\n *\n * While {@link Client} contains business logic specific to an SDK, the\n * Backend offers platform specific implementations for low-level operations.\n * These are persisting and loading information, sending events, and hooking\n * into the environment.\n *\n * Backends receive a handle to the Client in their constructor. When a\n * Backend automatically generates events, it must pass them to\n * the Client for validation and processing first.\n *\n * Usually, the Client will be of corresponding type, e.g. NodeBackend\n * receives NodeClient. However, higher-level SDKs can choose to instantiate\n * multiple Backends and delegate tasks between them. In this case, an event\n * generated by one backend might very well be sent by another one.\n *\n * The client also provides access to options via {@link Client.getOptions}.\n * @hidden\n */\nexport interface Backend {\n /** Creates a {@link Event} from an exception. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;\n\n /** Creates a {@link Event} from a plain message. */\n eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;\n\n /** Submits the event to Sentry */\n sendEvent(event: Event): void;\n\n /** Submits the session to Sentry */\n sendSession(session: Session): void;\n\n /**\n * Returns the transport that is used by the backend.\n * Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.\n *\n * @returns The transport.\n */\n getTransport(): Transport;\n}\n\n/**\n * A class object that can instantiate Backend objects.\n * @hidden\n */\nexport type BackendClass<B extends Backend, O extends Options> = new (options: O) => B;\n\n/**\n * This is the base implemention of a Backend.\n * @hidden\n */\nexport abstract class BaseBackend<O extends Options> implements Backend {\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** Cached transport used internally. */\n protected _transport: Transport;\n\n /** Creates a new backend instance. */\n public constructor(options: O) {\n this._options = options;\n if (!this._options.dsn) {\n logger.warn('No DSN provided, backend will not do anything.');\n }\n this._transport = this._setupTransport();\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public eventFromException(_exception: any, _hint?: EventHint): PromiseLike<Event> {\n throw new SentryError('Backend has to implement `eventFromException` method');\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(_message: string, _level?: Severity, _hint?: EventHint): PromiseLike<Event> {\n throw new SentryError('Backend has to implement `eventFromMessage` method');\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): void {\n this._transport.sendEvent(event).then(null, reason => {\n logger.error(`Error while sending event: ${reason}`);\n });\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): void {\n if (!this._transport.sendSession) {\n logger.warn(\"Dropping session because custom transport doesn't implement sendSession\");\n return;\n }\n\n this._transport.sendSession(session).then(null, reason => {\n logger.error(`Error while sending session: ${reason}`);\n });\n }\n\n /**\n * @inheritDoc\n */\n public getTransport(): Transport {\n return this._transport;\n }\n\n /**\n * Sets up the transport so it can be used later to send requests.\n */\n protected _setupTransport(): Transport {\n return new NoopTransport();\n }\n}\n","import { Event, SentryRequest, Session } from '@sentry/types';\n\nimport { API } from './api';\n\n/** Creates a SentryRequest from an event. */\nexport function sessionToSentryRequest(session: Session, api: API): SentryRequest {\n const envelopeHeaders = JSON.stringify({\n sent_at: new Date().toISOString(),\n });\n const itemHeaders = JSON.stringify({\n type: 'session',\n });\n\n return {\n body: `${envelopeHeaders}\\n${itemHeaders}\\n${JSON.stringify(session)}`,\n type: 'session',\n url: api.getEnvelopeEndpointWithUrlEncodedAuth(),\n };\n}\n\n/** Creates a SentryRequest from an event. */\nexport function eventToSentryRequest(event: Event, api: API): SentryRequest {\n const useEnvelope = event.type === 'transaction';\n\n const req: SentryRequest = {\n body: JSON.stringify(event),\n type: event.type || 'event',\n url: useEnvelope ? api.getEnvelopeEndpointWithUrlEncodedAuth() : api.getStoreEndpointWithUrlEncodedAuth(),\n };\n\n // https://develop.sentry.dev/sdk/envelopes/\n\n // Since we don't need to manipulate envelopes nor store them, there is no\n // exported concept of an Envelope with operations including serialization and\n // deserialization. Instead, we only implement a minimal subset of the spec to\n // serialize events inline here.\n if (useEnvelope) {\n const envelopeHeaders = JSON.stringify({\n event_id: event.event_id,\n // We need to add * 1000 since we divide it by 1000 by default but JS works with ms precision\n // The reason we use timestampWithMs here is that all clocks across the SDK use the same clock\n sent_at: new Date().toISOString(),\n });\n const itemHeaders = JSON.stringify({\n type: event.type,\n // The content-type is assumed to be 'application/json' and not part of\n // the current spec for transaction items, so we don't bloat the request\n // body with it.\n //\n // content_type: 'application/json',\n //\n // The length is optional. It must be the number of bytes in req.Body\n // encoded as UTF-8. Since the server can figure this out and would\n // otherwise refuse events that report the length incorrectly, we decided\n // not to send the length to avoid problems related to reporting the wrong\n // size and to reduce request body size.\n //\n // length: new TextEncoder().encode(req.body).length,\n });\n // The trailing newline is optional. We intentionally don't send it to avoid\n // sending unnecessary bytes.\n //\n // const envelope = `${envelopeHeaders}\\n${itemHeaders}\\n${req.body}\\n`;\n const envelope = `${envelopeHeaders}\\n${itemHeaders}\\n${req.body}`;\n req.body = envelope;\n }\n\n return req;\n}\n","import { Integration, WrappedFunction } from '@sentry/types';\n\nlet originalFunctionToString: () => void;\n\n/** Patch toString calls to return proper name for wrapped functions */\nexport class FunctionToString implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'FunctionToString';\n\n /**\n * @inheritDoc\n */\n public name: string = FunctionToString.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n originalFunctionToString = Function.prototype.toString;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Function.prototype.toString = function(this: WrappedFunction, ...args: any[]): string {\n const context = this.__sentry_original__ || this;\n return originalFunctionToString.apply(context, args);\n };\n }\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/hub';\nimport { Event, Integration } from '@sentry/types';\nimport { getEventDescription, isMatchingPattern, logger } from '@sentry/utils';\n\n// \"Script error.\" is hard coded into browsers for errors that it can't read.\n// this is the result of a script being pulled in from an external domain and CORS.\nconst DEFAULT_IGNORE_ERRORS = [/^Script error\\.?$/, /^Javascript error: Script error\\.? on line 0$/];\n\n/** JSDoc */\ninterface InboundFiltersOptions {\n allowUrls: Array<string | RegExp>;\n denyUrls: Array<string | RegExp>;\n ignoreErrors: Array<string | RegExp>;\n ignoreInternal: boolean;\n\n /** @deprecated use {@link InboundFiltersOptions.allowUrls} instead. */\n whitelistUrls: Array<string | RegExp>;\n /** @deprecated use {@link InboundFiltersOptions.denyUrls} instead. */\n blacklistUrls: Array<string | RegExp>;\n}\n\n/** Inbound filters configurable by the user */\nexport class InboundFilters implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'InboundFilters';\n\n /**\n * @inheritDoc\n */\n public name: string = InboundFilters.id;\n\n public constructor(private readonly _options: Partial<InboundFiltersOptions> = {}) {}\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n const hub = getCurrentHub();\n if (!hub) {\n return event;\n }\n const self = hub.getIntegration(InboundFilters);\n if (self) {\n const client = hub.getClient();\n const clientOptions = client ? client.getOptions() : {};\n const options = self._mergeOptions(clientOptions);\n if (self._shouldDropEvent(event, options)) {\n return null;\n }\n }\n return event;\n });\n }\n\n /** JSDoc */\n private _shouldDropEvent(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n if (this._isSentryError(event, options)) {\n logger.warn(`Event dropped due to being internal Sentry Error.\\nEvent: ${getEventDescription(event)}`);\n return true;\n }\n if (this._isIgnoredError(event, options)) {\n logger.warn(\n `Event dropped due to being matched by \\`ignoreErrors\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n if (this._isDeniedUrl(event, options)) {\n logger.warn(\n `Event dropped due to being matched by \\`denyUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${this._getEventFilterUrl(event)}`,\n );\n return true;\n }\n if (!this._isAllowedUrl(event, options)) {\n logger.warn(\n `Event dropped due to not being matched by \\`allowUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${this._getEventFilterUrl(event)}`,\n );\n return true;\n }\n return false;\n }\n\n /** JSDoc */\n private _isSentryError(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n if (!options.ignoreInternal) {\n return false;\n }\n\n try {\n return (\n (event &&\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].type === 'SentryError') ||\n false\n );\n } catch (_oO) {\n return false;\n }\n }\n\n /** JSDoc */\n private _isIgnoredError(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n if (!options.ignoreErrors || !options.ignoreErrors.length) {\n return false;\n }\n\n return this._getPossibleEventMessages(event).some(message =>\n // Not sure why TypeScript complains here...\n (options.ignoreErrors as Array<RegExp | string>).some(pattern => isMatchingPattern(message, pattern)),\n );\n }\n\n /** JSDoc */\n private _isDeniedUrl(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n // TODO: Use Glob instead?\n if (!options.denyUrls || !options.denyUrls.length) {\n return false;\n }\n const url = this._getEventFilterUrl(event);\n return !url ? false : options.denyUrls.some(pattern => isMatchingPattern(url, pattern));\n }\n\n /** JSDoc */\n private _isAllowedUrl(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n // TODO: Use Glob instead?\n if (!options.allowUrls || !options.allowUrls.length) {\n return true;\n }\n const url = this._getEventFilterUrl(event);\n return !url ? true : options.allowUrls.some(pattern => isMatchingPattern(url, pattern));\n }\n\n /** JSDoc */\n private _mergeOptions(clientOptions: Partial<InboundFiltersOptions> = {}): Partial<InboundFiltersOptions> {\n return {\n allowUrls: [\n // eslint-disable-next-line deprecation/deprecation\n ...(this._options.whitelistUrls || []),\n ...(this._options.allowUrls || []),\n // eslint-disable-next-line deprecation/deprecation\n ...(clientOptions.whitelistUrls || []),\n ...(clientOptions.allowUrls || []),\n ],\n denyUrls: [\n // eslint-disable-next-line deprecation/deprecation\n ...(this._options.blacklistUrls || []),\n ...(this._options.denyUrls || []),\n // eslint-disable-next-line deprecation/deprecation\n ...(clientOptions.blacklistUrls || []),\n ...(clientOptions.denyUrls || []),\n ],\n ignoreErrors: [\n ...(this._options.ignoreErrors || []),\n ...(clientOptions.ignoreErrors || []),\n ...DEFAULT_IGNORE_ERRORS,\n ],\n ignoreInternal: typeof this._options.ignoreInternal !== 'undefined' ? this._options.ignoreInternal : true,\n };\n }\n\n /** JSDoc */\n private _getPossibleEventMessages(event: Event): string[] {\n if (event.message) {\n return [event.message];\n }\n if (event.exception) {\n try {\n const { type = '', value = '' } = (event.exception.values && event.exception.values[0]) || {};\n return [`${value}`, `${type}: ${value}`];\n } catch (oO) {\n logger.error(`Cannot extract message for event ${getEventDescription(event)}`);\n return [];\n }\n }\n return [];\n }\n\n /** JSDoc */\n private _getEventFilterUrl(event: Event): string | null {\n try {\n if (event.stacktrace) {\n const frames = event.stacktrace.frames;\n return (frames && frames[frames.length - 1].filename) || null;\n }\n if (event.exception) {\n const frames =\n event.exception.values && event.exception.values[0].stacktrace && event.exception.values[0].stacktrace.frames;\n return (frames && frames[frames.length - 1].filename) || null;\n }\n return null;\n } catch (oO) {\n logger.error(`Cannot extract url for event ${getEventDescription(event)}`);\n return null;\n }\n }\n}\n","/**\n * This was originally forked from https://github.com/occ/TraceKit, but has since been\n * largely modified and is now maintained as part of Sentry JS SDK.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n/**\n * An object representing a single stack frame.\n * {Object} StackFrame\n * {string} url The JavaScript or HTML file URL.\n * {string} func The function name, or empty for anonymous functions (if guessing did not work).\n * {string[]?} args The arguments passed to the function, if known.\n * {number=} line The line number, if known.\n * {number=} column The column number, if known.\n * {string[]} context An array of source code lines; the middle element corresponds to the correct line#.\n */\nexport interface StackFrame {\n url: string;\n func: string;\n args: string[];\n line: number | null;\n column: number | null;\n}\n\n/**\n * An object representing a JavaScript stack trace.\n * {Object} StackTrace\n * {string} name The name of the thrown exception.\n * {string} message The exception error message.\n * {TraceKit.StackFrame[]} stack An array of stack frames.\n */\nexport interface StackTrace {\n name: string;\n message: string;\n mechanism?: string;\n stack: StackFrame[];\n failed?: boolean;\n}\n\n// global reference to slice\nconst UNKNOWN_FUNCTION = '?';\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\nconst chrome = /^\\s*at (?:(.*?) ?\\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\\/).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\n// gecko regex: `(?:bundle|\\d+\\.js)`: `bundle` is for react native, `\\d+\\.js` also but specifically for ram bundles because it\n// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js\n// We need this specific case for now because we want no other regex to match.\nconst gecko = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js))(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst winjs = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\nconst geckoEval = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\nconst chromeEval = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\n/** JSDoc */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\nexport function computeStackTrace(ex: any): StackTrace {\n let stack = null;\n let popSize = 0;\n\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n popSize = ex.framesToPop;\n } else if (reactMinifiedRegexp.test(ex.message)) {\n popSize = 1;\n }\n }\n\n try {\n // This must be tried first because Opera 10 *destroys*\n // its stacktrace property if you try to access the stack\n // property first!!\n stack = computeStackTraceFromStacktraceProp(ex);\n if (stack) {\n return popFrames(stack, popSize);\n }\n } catch (e) {\n // no-empty\n }\n\n try {\n stack = computeStackTraceFromStackProp(ex);\n if (stack) {\n return popFrames(stack, popSize);\n }\n } catch (e) {\n // no-empty\n }\n\n return {\n message: extractMessage(ex),\n name: ex && ex.name,\n stack: [],\n failed: true,\n };\n}\n\n/** JSDoc */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, complexity\nfunction computeStackTraceFromStackProp(ex: any): StackTrace | null {\n if (!ex || !ex.stack) {\n return null;\n }\n\n const stack = [];\n const lines = ex.stack.split('\\n');\n let isEval;\n let submatch;\n let parts;\n let element;\n\n for (let i = 0; i < lines.length; ++i) {\n if ((parts = chrome.exec(lines[i]))) {\n const isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n if (isEval && (submatch = chromeEval.exec(parts[2]))) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n parts[3] = submatch[2]; // line\n parts[4] = submatch[3]; // column\n }\n element = {\n // working with the regexp above is super painful. it is quite a hack, but just stripping the `address at `\n // prefix here seems like the quickest solution for now.\n url: parts[2] && parts[2].indexOf('address at ') === 0 ? parts[2].substr('address at '.length) : parts[2],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: isNative ? [parts[2]] : [],\n line: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null,\n };\n } else if ((parts = winjs.exec(lines[i]))) {\n element = {\n url: parts[2],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: [],\n line: +parts[3],\n column: parts[4] ? +parts[4] : null,\n };\n } else if ((parts = gecko.exec(lines[i]))) {\n isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval && (submatch = geckoEval.exec(parts[3]))) {\n // throw out eval line/column and use top-most line number\n parts[1] = parts[1] || `eval`;\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = ''; // no column when eval\n } else if (i === 0 && !parts[5] && ex.columnNumber !== void 0) {\n // FireFox uses this awesome columnNumber property for its top frame\n // Also note, Firefox's column number is 0-based and everything else expects 1-based,\n // so adding 1\n // NOTE: this hack doesn't work if top-most frame is eval\n stack[0].column = (ex.columnNumber as number) + 1;\n }\n element = {\n url: parts[3],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: parts[2] ? parts[2].split(',') : [],\n line: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null,\n };\n } else {\n continue;\n }\n\n if (!element.func && element.line) {\n element.func = UNKNOWN_FUNCTION;\n }\n\n stack.push(element);\n }\n\n if (!stack.length) {\n return null;\n }\n\n return {\n message: extractMessage(ex),\n name: ex.name,\n stack,\n };\n}\n\n/** JSDoc */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction computeStackTraceFromStacktraceProp(ex: any): StackTrace | null {\n if (!ex || !ex.stacktrace) {\n return null;\n }\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace;\n const opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i;\n const opera11Regex = / line (\\d+), column (\\d+)\\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\\((.*)\\))? in (.*):\\s*$/i;\n const lines = stacktrace.split('\\n');\n const stack = [];\n let parts;\n\n for (let line = 0; line < lines.length; line += 2) {\n let element = null;\n if ((parts = opera10Regex.exec(lines[line]))) {\n element = {\n url: parts[2],\n func: parts[3],\n args: [],\n line: +parts[1],\n column: null,\n };\n } else if ((parts = opera11Regex.exec(lines[line]))) {\n element = {\n url: parts[6],\n func: parts[3] || parts[4],\n args: parts[5] ? parts[5].split(',') : [],\n line: +parts[1],\n column: +parts[2],\n };\n }\n\n if (element) {\n if (!element.func && element.line) {\n element.func = UNKNOWN_FUNCTION;\n }\n stack.push(element);\n }\n }\n\n if (!stack.length) {\n return null;\n }\n\n return {\n message: extractMessage(ex),\n name: ex.name,\n stack,\n };\n}\n\n/** Remove N number of frames from the stack */\nfunction popFrames(stacktrace: StackTrace, popSize: number): StackTrace {\n try {\n return {\n ...stacktrace,\n stack: stacktrace.stack.slice(popSize),\n };\n } catch (e) {\n return stacktrace;\n }\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction extractMessage(ex: any): string {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n","import { Event, Exception, StackFrame } from '@sentry/types';\nimport { extractExceptionKeysForMessage, isEvent, normalizeToSize } from '@sentry/utils';\n\nimport { computeStackTrace, StackFrame as TraceKitStackFrame, StackTrace as TraceKitStackTrace } from './tracekit';\n\nconst STACKTRACE_LIMIT = 50;\n\n/**\n * This function creates an exception from an TraceKitStackTrace\n * @param stacktrace TraceKitStackTrace that will be converted to an exception\n * @hidden\n */\nexport function exceptionFromStacktrace(stacktrace: TraceKitStackTrace): Exception {\n const frames = prepareFramesForEvent(stacktrace.stack);\n\n const exception: Exception = {\n type: stacktrace.name,\n value: stacktrace.message,\n };\n\n if (frames && frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\n/**\n * @hidden\n */\nexport function eventFromPlainObject(\n exception: Record<string, unknown>,\n syntheticException?: Error,\n rejection?: boolean,\n): Event {\n const event: Event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',\n value: `Non-Error ${\n rejection ? 'promise rejection' : 'exception'\n } captured with keys: ${extractExceptionKeysForMessage(exception)}`,\n },\n ],\n },\n extra: {\n __serialized__: normalizeToSize(exception),\n },\n };\n\n if (syntheticException) {\n const stacktrace = computeStackTrace(syntheticException);\n const frames = prepareFramesForEvent(stacktrace.stack);\n event.stacktrace = {\n frames,\n };\n }\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromStacktrace(stacktrace: TraceKitStackTrace): Event {\n const exception = exceptionFromStacktrace(stacktrace);\n\n return {\n exception: {\n values: [exception],\n },\n };\n}\n\n/**\n * @hidden\n */\nexport function prepareFramesForEvent(stack: TraceKitStackFrame[]): StackFrame[] {\n if (!stack || !stack.length) {\n return [];\n }\n\n let localStack = stack;\n\n const firstFrameFunction = localStack[0].func || '';\n const lastFrameFunction = localStack[localStack.length - 1].func || '';\n\n // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)\n if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {\n localStack = localStack.slice(1);\n }\n\n // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)\n if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {\n localStack = localStack.slice(0, -1);\n }\n\n // The frame where the crash happened, should be the last entry in the array\n return localStack\n .slice(0, STACKTRACE_LIMIT)\n .map(\n (frame: TraceKitStackFrame): StackFrame => ({\n colno: frame.column === null ? undefined : frame.column,\n filename: frame.url || localStack[0].url,\n function: frame.func || '?',\n in_app: true,\n lineno: frame.line === null ? undefined : frame.line,\n }),\n )\n .reverse();\n}\n","import { Event, EventHint, Options, Severity } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isPlainObject,\n SyncPromise,\n} from '@sentry/utils';\n\nimport { eventFromPlainObject, eventFromStacktrace, prepareFramesForEvent } from './parsers';\nimport { computeStackTrace } from './tracekit';\n\n/**\n * Builds and Event from a Exception\n * @hidden\n */\nexport function eventFromException(options: Options, exception: unknown, hint?: EventHint): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, {\n attachStacktrace: options.attachStacktrace,\n });\n addExceptionMechanism(event, {\n handled: true,\n type: 'generic',\n });\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return SyncPromise.resolve(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n options: Options,\n message: string,\n level: Severity = Severity.Info,\n hint?: EventHint,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, {\n attachStacktrace: options.attachStacktrace,\n });\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return SyncPromise.resolve(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n exception: unknown,\n syntheticException?: Error,\n options: {\n rejection?: boolean;\n attachStacktrace?: boolean;\n } = {},\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception as ErrorEvent) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n // eslint-disable-next-line no-param-reassign\n exception = errorEvent.error;\n event = eventFromStacktrace(computeStackTrace(exception as Error));\n return event;\n }\n if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {\n // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)\n // then we just extract the name, code, and message, as they don't provide anything else\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n const domException = exception as DOMException;\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n\n event = eventFromString(message, syntheticException, options);\n addExceptionTypeValue(event, message);\n if ('code' in domException) {\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception as Error)) {\n // we have a real Error object, do nothing\n event = eventFromStacktrace(computeStackTrace(exception as Error));\n return event;\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it is plain Object or Event, serialize it manually and extract options\n // This will allow us to group events based on top-level keys\n // which is much better than creating new group when any key/value change\n const objectException = exception as Record<string, unknown>;\n event = eventFromPlainObject(objectException, syntheticException, options.rejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n event = eventFromString(exception as string, syntheticException, options);\n addExceptionTypeValue(event, `${exception}`, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromString(\n input: string,\n syntheticException?: Error,\n options: {\n attachStacktrace?: boolean;\n } = {},\n): Event {\n const event: Event = {\n message: input,\n };\n\n if (options.attachStacktrace && syntheticException) {\n const stacktrace = computeStackTrace(syntheticException);\n const frames = prepareFramesForEvent(stacktrace.stack);\n event.stacktrace = {\n frames,\n };\n }\n\n return event;\n}\n","import { API } from '@sentry/core';\nimport {\n Event,\n Response as SentryResponse,\n SentryRequestType,\n Status,\n Transport,\n TransportOptions,\n} from '@sentry/types';\nimport { logger, parseRetryAfterHeader, PromiseBuffer, SentryError } from '@sentry/utils';\n\n/** Base Transport class implementation */\nexport abstract class BaseTransport implements Transport {\n /**\n * @deprecated\n */\n public url: string;\n\n /** Helper to get Sentry API endpoints. */\n protected readonly _api: API;\n\n /** A simple buffer holding all requests. */\n protected readonly _buffer: PromiseBuffer<SentryResponse> = new PromiseBuffer(30);\n\n /** Locks transport after receiving rate limits in a response */\n protected readonly _rateLimits: Record<string, Date> = {};\n\n public constructor(public options: TransportOptions) {\n this._api = new API(this.options.dsn);\n // eslint-disable-next-line deprecation/deprecation\n this.url = this._api.getStoreEndpointWithUrlEncodedAuth();\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(_: Event): PromiseLike<SentryResponse> {\n throw new SentryError('Transport Class has to implement `sendEvent` method');\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this._buffer.drain(timeout);\n }\n\n /**\n * Handle Sentry repsonse for promise-based transports.\n */\n protected _handleResponse({\n requestType,\n response,\n headers,\n resolve,\n reject,\n }: {\n requestType: SentryRequestType;\n response: Response | XMLHttpRequest;\n headers: Record<string, string | null>;\n resolve: (value?: SentryResponse | PromiseLike<SentryResponse> | null | undefined) => void;\n reject: (reason?: unknown) => void;\n }): void {\n const status = Status.fromHttpCode(response.status);\n /**\n * \"The name is case-insensitive.\"\n * https://developer.mozilla.org/en-US/docs/Web/API/Headers/get\n */\n const limited = this._handleRateLimit(headers);\n if (limited) logger.warn(`Too many requests, backing off till: ${this._disabledUntil(requestType)}`);\n\n if (status === Status.Success) {\n resolve({ status });\n return;\n }\n\n reject(response);\n }\n\n /**\n * Gets the time that given category is disabled until for rate limiting\n */\n protected _disabledUntil(category: string): Date {\n return this._rateLimits[category] || this._rateLimits.all;\n }\n\n /**\n * Checks if a category is rate limited\n */\n protected _isRateLimited(category: string): boolean {\n return this._disabledUntil(category) > new Date(Date.now());\n }\n\n /**\n * Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.\n */\n protected _handleRateLimit(headers: Record<string, string | null>): boolean {\n const now = Date.now();\n const rlHeader = headers['x-sentry-rate-limits'];\n const raHeader = headers['retry-after'];\n\n if (rlHeader) {\n for (const limit of rlHeader.trim().split(',')) {\n const parameters = limit.split(':', 2);\n const headerDelay = parseInt(parameters[0], 10);\n const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default\n for (const category of parameters[1].split(';')) {\n this._rateLimits[category || 'all'] = new Date(now + delay);\n }\n }\n return true;\n } else if (raHeader) {\n this._rateLimits.all = new Date(now + parseRetryAfterHeader(now, raHeader));\n return true;\n }\n return false;\n }\n}\n","import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { getGlobalObject, supportsReferrerPolicy, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\nconst global = getGlobalObject<Window>();\n\n/** `fetch` based transport */\nexport class FetchTransport extends BaseTransport {\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<Response> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<Response> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n if (this._isRateLimited(sentryRequest.type)) {\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n reason: `Transport locked till ${this._disabledUntil(sentryRequest.type)} due to too many requests.`,\n status: 429,\n });\n }\n\n const options: RequestInit = {\n body: sentryRequest.body,\n method: 'POST',\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n referrerPolicy: (supportsReferrerPolicy() ? 'origin' : '') as ReferrerPolicy,\n };\n if (this.options.fetchParameters !== undefined) {\n Object.assign(options, this.options.fetchParameters);\n }\n if (this.options.headers !== undefined) {\n options.headers = this.options.headers;\n }\n\n return this._buffer.add(\n new SyncPromise<Response>((resolve, reject) => {\n global\n .fetch(sentryRequest.url, options)\n .then(response => {\n const headers = {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response, headers, resolve, reject });\n })\n .catch(reject);\n }),\n );\n }\n}\n","import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<Response> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<Response> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n if (this._isRateLimited(sentryRequest.type)) {\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n reason: `Transport locked till ${this._disabledUntil(sentryRequest.type)} due to too many requests.`,\n status: 429,\n });\n }\n\n return this._buffer.add(\n new SyncPromise<Response>((resolve, reject) => {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = (): void => {\n if (request.readyState === 4) {\n const headers = {\n 'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': request.getResponseHeader('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response: request, headers, resolve, reject });\n }\n };\n\n request.open('POST', sentryRequest.url);\n for (const header in this.options.headers) {\n if (this.options.headers.hasOwnProperty(header)) {\n request.setRequestHeader(header, this.options.headers[header]);\n }\n }\n request.send(sentryRequest.body);\n }),\n );\n }\n}\n","import { BaseBackend } from '@sentry/core';\nimport { Event, EventHint, Options, Severity, Transport } from '@sentry/types';\nimport { supportsFetch } from '@sentry/utils';\n\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { FetchTransport, XHRTransport } from './transports';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see BrowserClient for more information.\n */\nexport interface BrowserOptions extends Options {\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.denyUrls}.\n * By default, all errors will be sent.\n */\n allowUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To allow certain errors instead, use {@link Options.allowUrls}.\n * By default, all errors will be sent.\n */\n denyUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.allowUrls} instead. */\n whitelistUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.denyUrls} instead. */\n blacklistUrls?: Array<string | RegExp>;\n\n /**\n * A flag enabling Sessions Tracking feature.\n * By default Sessions Tracking is disabled.\n */\n autoSessionTracking?: boolean;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class BrowserBackend extends BaseBackend<BrowserOptions> {\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(this._options, exception, hint);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options, message, level, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn,\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n if (supportsFetch()) {\n return new FetchTransport(transportOptions);\n }\n return new XHRTransport(transportOptions);\n }\n}\n","import { API, captureException, withScope } from '@sentry/core';\nimport { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport { addExceptionMechanism, addExceptionTypeValue, logger } from '@sentry/utils';\n\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError += 1;\n setTimeout(() => {\n ignoreOnError -= 1;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap(\n fn: WrappedFunction,\n options: {\n mechanism?: Mechanism;\n } = {},\n before?: WrappedFunction,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // We don't wanna wrap it twice\n if (fn.__sentry__) {\n return fn;\n }\n\n // If this has already been wrapped in the past, return that wrapped function\n if (fn.__sentry_wrapped__) {\n return fn.__sentry_wrapped__;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n /* eslint-disable prefer-rest-params */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sentryWrapped: WrappedFunction = function(this: any): void {\n const args = Array.prototype.slice.call(arguments);\n\n try {\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const wrappedArguments = args.map((arg: any) => wrap(arg, options));\n\n if (fn.handleEvent) {\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return fn.handleEvent.apply(this, wrappedArguments);\n }\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope((scope: Scope) => {\n scope.addEventProcessor((event: SentryEvent) => {\n const processedEvent = { ...event };\n\n if (options.mechanism) {\n addExceptionTypeValue(processedEvent, undefined, undefined);\n addExceptionMechanism(processedEvent, options.mechanism);\n }\n\n processedEvent.extra = {\n ...processedEvent.extra,\n arguments: args,\n };\n\n return processedEvent;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n /* eslint-enable prefer-rest-params */\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) {} // eslint-disable-line no-empty\n\n fn.prototype = fn.prototype || {};\n sentryWrapped.prototype = fn.prototype;\n\n Object.defineProperty(fn, '__sentry_wrapped__', {\n enumerable: false,\n value: sentryWrapped,\n });\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n Object.defineProperties(sentryWrapped, {\n __sentry__: {\n enumerable: false,\n value: true,\n },\n __sentry_original__: {\n enumerable: false,\n value: fn,\n },\n });\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') as PropertyDescriptor;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n // eslint-disable-next-line no-empty\n } catch (_oO) {}\n\n return sentryWrapped;\n}\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * Injects the Report Dialog script\n * @hidden\n */\nexport function injectReportDialog(options: ReportDialogOptions = {}): void {\n if (!options.eventId) {\n logger.error(`Missing eventId option in showReportDialog call`);\n return;\n }\n if (!options.dsn) {\n logger.error(`Missing dsn option in showReportDialog call`);\n return;\n }\n\n const script = document.createElement('script');\n script.async = true;\n script.src = new API(options.dsn).getReportDialogEndpoint(options);\n\n if (options.onLoad) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n script.onload = options.onLoad;\n }\n\n (document.head || document.body).appendChild(script);\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport { getCurrentHub } from '@sentry/core';\nimport { Event, Integration, Severity } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addInstrumentationHandler,\n getLocationHref,\n isErrorEvent,\n isPrimitive,\n isString,\n logger,\n} from '@sentry/utils';\n\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\n/** JSDoc */\ninterface GlobalHandlersIntegrations {\n onerror: boolean;\n onunhandledrejection: boolean;\n}\n\n/** Global handlers */\nexport class GlobalHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'GlobalHandlers';\n\n /**\n * @inheritDoc\n */\n public name: string = GlobalHandlers.id;\n\n /** JSDoc */\n private readonly _options: GlobalHandlersIntegrations;\n\n /** JSDoc */\n private _onErrorHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onUnhandledRejectionHandlerInstalled: boolean = false;\n\n /** JSDoc */\n public constructor(options?: GlobalHandlersIntegrations) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n }\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n Error.stackTraceLimit = 50;\n\n if (this._options.onerror) {\n logger.log('Global Handler attached: onerror');\n this._installGlobalOnErrorHandler();\n }\n\n if (this._options.onunhandledrejection) {\n logger.log('Global Handler attached: onunhandledrejection');\n this._installGlobalOnUnhandledRejectionHandler();\n }\n }\n\n /** JSDoc */\n private _installGlobalOnErrorHandler(): void {\n if (this._onErrorHandlerInstalled) {\n return;\n }\n\n addInstrumentationHandler({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback: (data: { msg: any; url: any; line: any; column: any; error: any }) => {\n const error = data.error;\n const currentHub = getCurrentHub();\n const hasIntegration = currentHub.getIntegration(GlobalHandlers);\n const isFailedOwnDelivery = error && error.__sentry_own_request__ === true;\n\n if (!hasIntegration || shouldIgnoreOnError() || isFailedOwnDelivery) {\n return;\n }\n\n const client = currentHub.getClient();\n const event = isPrimitive(error)\n ? this._eventFromIncompleteOnError(data.msg, data.url, data.line, data.column)\n : this._enhanceEventWithInitialFrame(\n eventFromUnknownInput(error, undefined, {\n attachStacktrace: client && client.getOptions().attachStacktrace,\n rejection: false,\n }),\n data.url,\n data.line,\n data.column,\n );\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n\n currentHub.captureEvent(event, {\n originalException: error,\n });\n },\n type: 'error',\n });\n\n this._onErrorHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnUnhandledRejectionHandler(): void {\n if (this._onUnhandledRejectionHandlerInstalled) {\n return;\n }\n\n addInstrumentationHandler({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback: (e: any) => {\n let error = e;\n\n // dig the object of the rejection out of known event types\n try {\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in e) {\n error = e.reason;\n }\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n else if ('detail' in e && 'reason' in e.detail) {\n error = e.detail.reason;\n }\n } catch (_oO) {\n // no-empty\n }\n\n const currentHub = getCurrentHub();\n const hasIntegration = currentHub.getIntegration(GlobalHandlers);\n const isFailedOwnDelivery = error && error.__sentry_own_request__ === true;\n\n if (!hasIntegration || shouldIgnoreOnError() || isFailedOwnDelivery) {\n return true;\n }\n\n const client = currentHub.getClient();\n const event = isPrimitive(error)\n ? this._eventFromIncompleteRejection(error)\n : eventFromUnknownInput(error, undefined, {\n attachStacktrace: client && client.getOptions().attachStacktrace,\n rejection: true,\n });\n\n event.level = Severity.Error;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onunhandledrejection',\n });\n\n currentHub.captureEvent(event, {\n originalException: error,\n });\n\n return;\n },\n type: 'unhandledrejection',\n });\n\n this._onUnhandledRejectionHandlerInstalled = true;\n }\n\n /**\n * This function creates a stack from an old, error-less onerror handler.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _eventFromIncompleteOnError(msg: any, url: any, line: any, column: any): Event {\n const ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;\n\n // If 'message' is ErrorEvent, get real message from inside\n let message = isErrorEvent(msg) ? msg.message : msg;\n let name;\n\n if (isString(message)) {\n const groups = message.match(ERROR_TYPES_RE);\n if (groups) {\n name = groups[1];\n message = groups[2];\n }\n }\n\n const event = {\n exception: {\n values: [\n {\n type: name || 'Error',\n value: message,\n },\n ],\n },\n };\n\n return this._enhanceEventWithInitialFrame(event, url, line, column);\n }\n\n /**\n * This function creates an Event from an TraceKitStackTrace that has part of it missing.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _eventFromIncompleteRejection(error: any): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n value: `Non-Error promise rejection captured with value: ${error}`,\n },\n ],\n },\n };\n }\n\n /** JSDoc */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _enhanceEventWithInitialFrame(event: Event, url: any, line: any, column: any): Event {\n event.exception = event.exception || {};\n event.exception.values = event.exception.values || [];\n event.exception.values[0] = event.exception.values[0] || {};\n event.exception.values[0].stacktrace = event.exception.values[0].stacktrace || {};\n event.exception.values[0].stacktrace.frames = event.exception.values[0].stacktrace.frames || [];\n\n const colno = isNaN(parseInt(column, 10)) ? undefined : column;\n const lineno = isNaN(parseInt(line, 10)) ? undefined : line;\n const filename = isString(url) && url.length > 0 ? url : getLocationHref();\n\n if (event.exception.values[0].stacktrace.frames.length === 0) {\n event.exception.values[0].stacktrace.frames.push({\n colno,\n filename,\n function: '?',\n in_app: true,\n lineno,\n });\n }\n\n return event;\n }\n}\n","import { Integration, WrappedFunction } from '@sentry/types';\nimport { fill, getFunctionName, getGlobalObject } from '@sentry/utils';\n\nimport { wrap } from '../helpers';\n\nconst DEFAULT_EVENT_TARGET = [\n 'EventTarget',\n 'Window',\n 'Node',\n 'ApplicationCache',\n 'AudioTrackList',\n 'ChannelMergerNode',\n 'CryptoOperation',\n 'EventSource',\n 'FileReader',\n 'HTMLUnknownElement',\n 'IDBDatabase',\n 'IDBRequest',\n 'IDBTransaction',\n 'KeyOperation',\n 'MediaController',\n 'MessagePort',\n 'ModalWindow',\n 'Notification',\n 'SVGElementInstance',\n 'Screen',\n 'TextTrack',\n 'TextTrackCue',\n 'TextTrackList',\n 'WebSocket',\n 'WebSocketWorker',\n 'Worker',\n 'XMLHttpRequest',\n 'XMLHttpRequestEventTarget',\n 'XMLHttpRequestUpload',\n];\n\ntype XMLHttpRequestProp = 'onload' | 'onerror' | 'onprogress' | 'onreadystatechange';\n\n/** JSDoc */\ninterface TryCatchOptions {\n setTimeout: boolean;\n setInterval: boolean;\n requestAnimationFrame: boolean;\n XMLHttpRequest: boolean;\n eventTarget: boolean | string[];\n}\n\n/** Wrap timer functions and event targets to catch errors and provide better meta data */\nexport class TryCatch implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'TryCatch';\n\n /**\n * @inheritDoc\n */\n public name: string = TryCatch.id;\n\n /** JSDoc */\n private readonly _options: TryCatchOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<TryCatchOptions>) {\n this._options = {\n XMLHttpRequest: true,\n eventTarget: true,\n requestAnimationFrame: true,\n setInterval: true,\n setTimeout: true,\n ...options,\n };\n }\n\n /**\n * Wrap timer functions and event targets to catch errors\n * and provide better metadata.\n */\n public setupOnce(): void {\n const global = getGlobalObject();\n\n if (this._options.setTimeout) {\n fill(global, 'setTimeout', this._wrapTimeFunction.bind(this));\n }\n\n if (this._options.setInterval) {\n fill(global, 'setInterval', this._wrapTimeFunction.bind(this));\n }\n\n if (this._options.requestAnimationFrame) {\n fill(global, 'requestAnimationFrame', this._wrapRAF.bind(this));\n }\n\n if (this._options.XMLHttpRequest && 'XMLHttpRequest' in global) {\n fill(XMLHttpRequest.prototype, 'send', this._wrapXHR.bind(this));\n }\n\n if (this._options.eventTarget) {\n const eventTarget = Array.isArray(this._options.eventTarget) ? this._options.eventTarget : DEFAULT_EVENT_TARGET;\n eventTarget.forEach(this._wrapEventTarget.bind(this));\n }\n }\n\n /** JSDoc */\n private _wrapTimeFunction(original: () => void): () => number {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function(this: any, ...args: any[]): number {\n const originalCallback = args[0];\n args[0] = wrap(originalCallback, {\n mechanism: {\n data: { function: getFunctionName(original) },\n handled: true,\n type: 'instrument',\n },\n });\n return original.apply(this, args);\n };\n }\n\n /** JSDoc */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _wrapRAF(original: any): (callback: () => void) => any {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function(this: any, callback: () => void): () => void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return original.call(\n this,\n wrap(callback, {\n mechanism: {\n data: {\n function: 'requestAnimationFrame',\n handler: getFunctionName(original),\n },\n handled: true,\n type: 'instrument',\n },\n }),\n );\n };\n }\n\n /** JSDoc */\n private _wrapEventTarget(target: string): void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const global = getGlobalObject() as { [key: string]: any };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const proto = global[target] && global[target].prototype;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {\n return;\n }\n\n fill(proto, 'addEventListener', function(\n original: () => void,\n ): (eventName: string, fn: EventListenerObject, options?: boolean | AddEventListenerOptions) => void {\n return function(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this: any,\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): (eventName: string, fn: EventListenerObject, capture?: boolean, secure?: boolean) => void {\n try {\n if (typeof fn.handleEvent === 'function') {\n fn.handleEvent = wrap(fn.handleEvent.bind(fn), {\n mechanism: {\n data: {\n function: 'handleEvent',\n handler: getFunctionName(fn),\n target,\n },\n handled: true,\n type: 'instrument',\n },\n });\n }\n } catch (err) {\n // can sometimes get 'Permission denied to access property \"handle Event'\n }\n\n return original.call(\n this,\n eventName,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrap((fn as any) as WrappedFunction, {\n mechanism: {\n data: {\n function: 'addEventListener',\n handler: getFunctionName(fn),\n target,\n },\n handled: true,\n type: 'instrument',\n },\n }),\n options,\n );\n };\n });\n\n fill(proto, 'removeEventListener', function(\n originalRemoveEventListener: () => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): (this: any, eventName: string, fn: EventListenerObject, options?: boolean | EventListenerOptions) => () => void {\n return function(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this: any,\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | EventListenerOptions,\n ): () => void {\n /**\n * There are 2 possible scenarios here:\n *\n * 1. Someone passes a callback, which was attached prior to Sentry initialization, or by using unmodified\n * method, eg. `document.addEventListener.call(el, name, handler). In this case, we treat this function\n * as a pass-through, and call original `removeEventListener` with it.\n *\n * 2. Someone passes a callback, which was attached after Sentry was initialized, which means that it was using\n * our wrapped version of `addEventListener`, which internally calls `wrap` helper.\n * This helper \"wraps\" whole callback inside a try/catch statement, and attached appropriate metadata to it,\n * in order for us to make a distinction between wrapped/non-wrapped functions possible.\n * If a function was wrapped, it has additional property of `__sentry_wrapped__`, holding the handler.\n *\n * When someone adds a handler prior to initialization, and then do it again, but after,\n * then we have to detach both of them. Otherwise, if we'd detach only wrapped one, it'd be impossible\n * to get rid of the initial handler and it'd stick there forever.\n */\n const wrappedEventHandler = (fn as unknown) as WrappedFunction;\n try {\n const originalEventHandler = wrappedEventHandler?.__sentry_wrapped__;\n if (originalEventHandler) {\n originalRemoveEventListener.call(this, eventName, originalEventHandler, options);\n }\n } catch (e) {\n // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments\n }\n return originalRemoveEventListener.call(this, eventName, wrappedEventHandler, options);\n };\n });\n }\n\n /** JSDoc */\n private _wrapXHR(originalSend: () => void): () => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function(this: XMLHttpRequest, ...args: any[]): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const xhr = this;\n const xmlHttpRequestProps: XMLHttpRequestProp[] = ['onload', 'onerror', 'onprogress', 'onreadystatechange'];\n\n xmlHttpRequestProps.forEach(prop => {\n if (prop in xhr && typeof xhr[prop] === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fill(xhr, prop, function(original: WrappedFunction): () => any {\n const wrapOptions = {\n mechanism: {\n data: {\n function: prop,\n handler: getFunctionName(original),\n },\n handled: true,\n type: 'instrument',\n },\n };\n\n // If Instrument integration has been called before TryCatch, get the name of original function\n if (original.__sentry_original__) {\n wrapOptions.mechanism.data.handler = getFunctionName(original.__sentry_original__);\n }\n\n // Otherwise wrap directly\n return wrap(original, wrapOptions);\n });\n }\n });\n\n return originalSend.apply(this, args);\n };\n }\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable max-lines */\nimport { getCurrentHub } from '@sentry/core';\nimport { Event, Integration, Severity } from '@sentry/types';\nimport {\n addInstrumentationHandler,\n getEventDescription,\n getGlobalObject,\n htmlTreeAsString,\n parseUrl,\n safeJoin,\n} from '@sentry/utils';\n\n/** JSDoc */\ninterface BreadcrumbsOptions {\n console: boolean;\n dom: boolean;\n fetch: boolean;\n history: boolean;\n sentry: boolean;\n xhr: boolean;\n}\n\n/**\n * Default Breadcrumbs instrumentations\n * TODO: Deprecated - with v6, this will be renamed to `Instrument`\n */\nexport class Breadcrumbs implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Breadcrumbs';\n\n /**\n * @inheritDoc\n */\n public name: string = Breadcrumbs.id;\n\n /** JSDoc */\n private readonly _options: BreadcrumbsOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<BreadcrumbsOptions>) {\n this._options = {\n console: true,\n dom: true,\n fetch: true,\n history: true,\n sentry: true,\n xhr: true,\n ...options,\n };\n }\n\n /**\n * Create a breadcrumb of `sentry` from the events themselves\n */\n public addSentryBreadcrumb(event: Event): void {\n if (!this._options.sentry) {\n return;\n }\n getCurrentHub().addBreadcrumb(\n {\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event),\n },\n {\n event,\n },\n );\n }\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - Console API\n * - DOM API (click/typing)\n * - XMLHttpRequest API\n * - Fetch API\n * - History API\n */\n public setupOnce(): void {\n if (this._options.console) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._consoleBreadcrumb(...args);\n },\n type: 'console',\n });\n }\n if (this._options.dom) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._domBreadcrumb(...args);\n },\n type: 'dom',\n });\n }\n if (this._options.xhr) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._xhrBreadcrumb(...args);\n },\n type: 'xhr',\n });\n }\n if (this._options.fetch) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._fetchBreadcrumb(...args);\n },\n type: 'fetch',\n });\n }\n if (this._options.history) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._historyBreadcrumb(...args);\n },\n type: 'history',\n });\n }\n }\n\n /**\n * Creates breadcrumbs from console API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _consoleBreadcrumb(handlerData: { [key: string]: any }): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: Severity.fromString(handlerData.level),\n message: safeJoin(handlerData.args, ' '),\n };\n\n if (handlerData.level === 'assert') {\n if (handlerData.args[0] === false) {\n breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;\n breadcrumb.data.arguments = handlerData.args.slice(1);\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n getCurrentHub().addBreadcrumb(breadcrumb, {\n input: handlerData.args,\n level: handlerData.level,\n });\n }\n\n /**\n * Creates breadcrumbs from DOM API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _domBreadcrumb(handlerData: { [key: string]: any }): void {\n let target;\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = handlerData.event.target\n ? htmlTreeAsString(handlerData.event.target as Node)\n : htmlTreeAsString((handlerData.event as unknown) as Node);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${handlerData.name}`,\n message: target,\n },\n {\n event: handlerData.event,\n name: handlerData.name,\n },\n );\n }\n\n /**\n * Creates breadcrumbs from XHR API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _xhrBreadcrumb(handlerData: { [key: string]: any }): void {\n if (handlerData.endTimestamp) {\n // We only capture complete, non-sentry requests\n if (handlerData.xhr.__sentry_own_request__) {\n return;\n }\n\n const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {};\n\n getCurrentHub().addBreadcrumb(\n {\n category: 'xhr',\n data: {\n method,\n url,\n status_code,\n },\n type: 'http',\n },\n {\n xhr: handlerData.xhr,\n input: body,\n },\n );\n\n return;\n }\n }\n\n /**\n * Creates breadcrumbs from fetch API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _fetchBreadcrumb(handlerData: { [key: string]: any }): void {\n // We only capture complete fetch requests\n if (!handlerData.endTimestamp) {\n return;\n }\n\n if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {\n // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)\n return;\n }\n\n if (handlerData.error) {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: handlerData.fetchData,\n level: Severity.Error,\n type: 'http',\n },\n {\n data: handlerData.error,\n input: handlerData.args,\n },\n );\n } else {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: {\n ...handlerData.fetchData,\n status_code: handlerData.response.status,\n },\n type: 'http',\n },\n {\n input: handlerData.args,\n response: handlerData.response,\n },\n );\n }\n }\n\n /**\n * Creates breadcrumbs from history API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _historyBreadcrumb(handlerData: { [key: string]: any }): void {\n const global = getGlobalObject<Window>();\n let from = handlerData.from;\n let to = handlerData.to;\n const parsedLoc = parseUrl(global.location.href);\n let parsedFrom = parseUrl(from);\n const parsedTo = parseUrl(to);\n\n // Initial pushState doesn't provide `from` information\n if (!parsedFrom.path) {\n parsedFrom = parsedLoc;\n }\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {\n to = parsedTo.relative;\n }\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {\n from = parsedFrom.relative;\n }\n\n getCurrentHub().addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to,\n },\n });\n }\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport { Event, EventHint, Exception, ExtendedError, Integration } from '@sentry/types';\nimport { isInstanceOf } from '@sentry/utils';\n\nimport { exceptionFromStacktrace } from '../parsers';\nimport { computeStackTrace } from '../tracekit';\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\n/** Adds SDK info to an event. */\nexport class LinkedErrors implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'LinkedErrors';\n\n /**\n * @inheritDoc\n */\n public readonly name: string = LinkedErrors.id;\n\n /**\n * @inheritDoc\n */\n private readonly _key: string;\n\n /**\n * @inheritDoc\n */\n private readonly _limit: number;\n\n /**\n * @inheritDoc\n */\n public constructor(options: { key?: string; limit?: number } = {}) {\n this._key = options.key || DEFAULT_KEY;\n this._limit = options.limit || DEFAULT_LIMIT;\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(LinkedErrors);\n if (self) {\n return self._handler(event, hint);\n }\n return event;\n });\n }\n\n /**\n * @inheritDoc\n */\n private _handler(event: Event, hint?: EventHint): Event | null {\n if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {\n return event;\n }\n const linkedErrors = this._walkErrorTree(hint.originalException as ExtendedError, this._key);\n event.exception.values = [...linkedErrors, ...event.exception.values];\n return event;\n }\n\n /**\n * @inheritDoc\n */\n private _walkErrorTree(error: ExtendedError, key: string, stack: Exception[] = []): Exception[] {\n if (!isInstanceOf(error[key], Error) || stack.length + 1 >= this._limit) {\n return stack;\n }\n const stacktrace = computeStackTrace(error[key]);\n const exception = exceptionFromStacktrace(stacktrace);\n return this._walkErrorTree(error[key], key, [exception, ...stack]);\n }\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport { Event, Integration } from '@sentry/types';\nimport { getGlobalObject } from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\n\n/** UserAgent */\nexport class UserAgent implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'UserAgent';\n\n /**\n * @inheritDoc\n */\n public name: string = UserAgent.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n if (getCurrentHub().getIntegration(UserAgent)) {\n // if none of the information we want exists, don't bother\n if (!global.navigator && !global.location && !global.document) {\n return event;\n }\n\n // grab as much info as exists and add it to the event\n const url = event.request?.url || global.location?.href;\n const { referrer } = global.document || {};\n const { userAgent } = global.navigator || {};\n\n const headers = {\n ...event.request?.headers,\n ...(referrer && { Referer: referrer }),\n ...(userAgent && { 'User-Agent': userAgent }),\n };\n const request = { ...(url && { url }), headers };\n\n return { ...event, request };\n }\n return event;\n });\n }\n}\n","export const SDK_NAME = 'sentry.javascript.browser';\nexport const SDK_VERSION = '5.27.4';\n","import { BaseClient, Scope } from '@sentry/core';\nimport { Event, EventHint } from '@sentry/types';\nimport { getGlobalObject, logger } from '@sentry/utils';\n\nimport { BrowserBackend, BrowserOptions } from './backend';\nimport { injectReportDialog, ReportDialogOptions } from './helpers';\nimport { Breadcrumbs } from './integrations';\nimport { SDK_NAME, SDK_VERSION } from './version';\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserOptions = {}) {\n super(BrowserBackend, options);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n const document = getGlobalObject<Window>().document;\n if (!document) {\n return;\n }\n\n if (!this._isEnabled()) {\n logger.error('Trying to call showReportDialog with Sentry Client disabled');\n return;\n }\n\n injectReportDialog({\n ...options,\n dsn: options.dsn || this.getDsn(),\n });\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n event.sdk = {\n ...event.sdk,\n name: SDK_NAME,\n packages: [\n ...((event.sdk && event.sdk.packages) || []),\n {\n name: 'npm:@sentry/browser',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _sendEvent(event: Event): void {\n const integration = this.getIntegration(Breadcrumbs);\n if (integration) {\n integration.addSentryBreadcrumb(event);\n }\n super._sendEvent(event);\n }\n}\n","import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@sentry/core';\nimport { getGlobalObject, SyncPromise } from '@sentry/utils';\n\nimport { BrowserOptions } from './backend';\nimport { BrowserClient } from './client';\nimport { ReportDialogOptions, wrap as internalWrap } from './helpers';\nimport { Breadcrumbs, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations';\n\nexport const defaultIntegrations = [\n new CoreIntegrations.InboundFilters(),\n new CoreIntegrations.FunctionToString(),\n new TryCatch(),\n new Breadcrumbs(),\n new GlobalHandlers(),\n new LinkedErrors(),\n new UserAgent(),\n];\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { configureScope } from '@sentry/browser';\n * configureScope((scope: Scope) => {\n * scope.setExtra({ battery: 0.7 });\n * scope.setTag({ user_mode: 'admin' });\n * scope.setUser({ id: '4711' });\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(options: BrowserOptions = {}): void {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = defaultIntegrations;\n }\n if (options.release === undefined) {\n const window = getGlobalObject<Window>();\n // This supports the variable that sentry-webpack-plugin injects\n if (window.SENTRY_RELEASE && window.SENTRY_RELEASE.id) {\n options.release = window.SENTRY_RELEASE.id;\n }\n }\n if (options.autoSessionTracking === undefined) {\n options.autoSessionTracking = false;\n }\n\n initAndBind(BrowserClient, options);\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n}\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n if (!options.eventId) {\n options.eventId = getCurrentHub().lastEventId();\n }\n const client = getCurrentHub().getClient<BrowserClient>();\n if (client) {\n client.showReportDialog(options);\n }\n}\n\n/**\n * This is the getter for lastEventId.\n *\n * @returns The last event id of a captured event.\n */\nexport function lastEventId(): string | undefined {\n return getCurrentHub().lastEventId();\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function flush(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<BrowserClient>();\n if (client) {\n return client.flush(timeout);\n }\n return SyncPromise.reject(false);\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function close(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<BrowserClient>();\n if (client) {\n return client.close(timeout);\n }\n return SyncPromise.reject(false);\n}\n\n/**\n * Wrap code within a try/catch block so the SDK is able to capture errors.\n *\n * @param fn A function to wrap.\n *\n * @returns The result of wrapped function call.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function wrap(fn: (...args: any) => any): any {\n return internalWrap(fn)();\n}\n\n/**\n * Enable automatic Session Tracking for the initial page load.\n */\nfunction startSessionTracking(): void {\n const window = getGlobalObject<Window>();\n const hub = getCurrentHub();\n\n /**\n * We should be using `Promise.all([windowLoaded, firstContentfulPaint])` here,\n * but, as always, it's not available in the IE10-11. Thanks IE.\n */\n let loadResolved = document.readyState === 'complete';\n let fcpResolved = false;\n const possiblyEndSession = (): void => {\n if (fcpResolved && loadResolved) {\n hub.endSession();\n }\n };\n const resolveWindowLoaded = (): void => {\n loadResolved = true;\n possiblyEndSession();\n window.removeEventListener('load', resolveWindowLoaded);\n };\n\n hub.startSession();\n\n if (!loadResolved) {\n // IE doesn't support `{ once: true }` for event listeners, so we have to manually\n // attach and then detach it once completed.\n window.addEventListener('load', resolveWindowLoaded);\n }\n\n try {\n const po = new PerformanceObserver((entryList, po) => {\n entryList.getEntries().forEach(entry => {\n if (entry.name === 'first-contentful-paint' && entry.startTime < firstHiddenTime) {\n po.disconnect();\n fcpResolved = true;\n possiblyEndSession();\n }\n });\n });\n\n // There's no need to even attach this listener if `PerformanceObserver` constructor will fail,\n // so we do it below here.\n let firstHiddenTime = document.visibilityState === 'hidden' ? 0 : Infinity;\n document.addEventListener(\n 'visibilitychange',\n event => {\n firstHiddenTime = Math.min(firstHiddenTime, event.timeStamp);\n },\n { once: true },\n );\n\n po.observe({\n type: 'paint',\n buffered: true,\n });\n } catch (e) {\n fcpResolved = true;\n possiblyEndSession();\n }\n}\n","export * from './exports';\n\nimport { Integrations as CoreIntegrations } from '@sentry/core';\nimport { getGlobalObject } from '@sentry/utils';\n\nimport * as BrowserIntegrations from './integrations';\nimport * as Transports from './transports';\n\nlet windowIntegrations = {};\n\n// This block is needed to add compatibility with the integrations packages when used with a CDN\nconst _window = getGlobalObject<Window>();\nif (_window.Sentry && _window.Sentry.Integrations) {\n windowIntegrations = _window.Sentry.Integrations;\n}\n\nconst INTEGRATIONS = {\n ...windowIntegrations,\n ...CoreIntegrations,\n ...BrowserIntegrations,\n};\n\nexport { INTEGRATIONS as Integrations, Transports };\n","import { getCurrentHub } from '@sentry/hub';\nimport { Client, Options } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\n/** A class object that can instantiate Client objects. */\nexport type ClientClass<F extends Client, O extends Options> = new (options: O) => F;\n\n/**\n * Internal function to create a new SDK client instance. The client is\n * installed and then bound to the current scope.\n *\n * @param clientClass The client class to instantiate.\n * @param options Options to pass to the client.\n */\nexport function initAndBind<F extends Client, O extends Options>(clientClass: ClientClass<F, O>, options: O): void {\n if (options.debug === true) {\n logger.enable();\n }\n const hub = getCurrentHub();\n const client = new clientClass(options);\n hub.bindClient(client);\n}\n"],"names":["LogLevel","SessionStatus","Severity","Status","isError","wat","Object","prototype","toString","call","isInstanceOf","Error","isErrorEvent","isDOMError","isString","isPrimitive","isPlainObject","isEvent","Event","isElement","Element","isThenable","Boolean","then","base","_e","htmlTreeAsString","elem","currentElem","MAX_TRAVERSE_HEIGHT","MAX_OUTPUT_LEN","out","height","len","separator","sepLength","length","nextStr","_htmlElementAsString","push","parentNode","reverse","join","_oO","el","className","classes","key","attr","i","tagName","toLowerCase","id","split","allowedAttrs","getAttribute","level","Debug","Info","Warning","Fatal","Critical","Log","code","Success","RateLimit","Invalid","Failed","Unknown","setPrototypeOf","__proto__","Array","obj","proto","prop","hasOwnProperty","SentryError","[object Object]","message","super","this","name","constructor","DSN_REGEX","ERROR_MESSAGE","Dsn","from","_fromString","_fromComponents","_validate","withPassword","host","path","pass","port","projectId","protocol","user","str","match","exec","lastPath","slice","pop","projectMatch","components","forEach","component","isNaN","parseInt","Memo","_hasWeakSet","WeakSet","_inner","has","add","delete","splice","defaultFunctionName","getFunctionName","fn","e","truncate","max","substr","safeJoin","input","delimiter","isArray","output","value","String","isMatchingPattern","pattern","test","indexOf","fill","source","replacement","original","wrapped","defineProperties","__sentry_original__","enumerable","_Oo","getWalkSource","error","err","stack","event","type","target","currentTarget","CustomEvent","detail","jsonSize","encodeURI","utf8Length","JSON","stringify","normalizeToSize","object","depth","maxSize","serialized","normalize","normalizeValue","_events","global","window","document","walk","Infinity","memo","normalized","serializeValue","toJSON","acc","memoize","innerKey","unmemoize","parse","extractExceptionKeysForMessage","exception","maxLength","keys","sort","includedKeys","dropUndefinedKeys","val","rv","map","isNodeEnv","process","fallbackGlobalObject","getGlobalObject","self","uuid4","crypto","msCrypto","getRandomValues","arr","Uint16Array","pad","num","v","replace","c","r","Math","random","parseUrl","url","query","fragment","relative","getEventDescription","values","event_id","consoleSandbox","callback","originalConsole","console","wrappedLevels","result","addExceptionTypeValue","addExceptionMechanism","mechanism","defaultRetryAfter","PREFIX","__SENTRY__","logger","_enabled","args","log","warn","supportsFetch","Headers","Request","Response","isNativeFetch","func","supportsReferrerPolicy","referrerPolicy","handlers","instrumented","instrument","originalConsoleLevel","triggerHandlers","Function","apply","instrumentConsole","addEventListener","domEventHandler","bind","keypressEventHandler","eventName","options","handleEvent","innerOriginal","__sentry_wrapped__","instrumentDOM","requestKeys","requestValues","xhrproto","XMLHttpRequest","originalOpen","xhr","__sentry_xhr__","method","toUpperCase","__sentry_own_request__","onreadystatechangeHandler","readyState","status_code","status","requestPos","undefined","body","endTimestamp","Date","now","startTimestamp","onreadystatechange","readyStateArgs","originalSend","instrumentXHR","fetch","doc","createElement","sandbox","hidden","head","appendChild","contentWindow","removeChild","supportsNativeFetch","originalFetch","handlerData","fetchData","getFetchMethod","getFetchUrl","response","instrumentFetch","chrome","isChromePackagedApp","app","runtime","hasHistoryApi","history","pushState","replaceState","supportsHistory","oldOnPopState","onpopstate","historyReplacementFunction","originalHistoryFunction","lastHref","to","location","href","instrumentHistory","_oldOnErrorHandler","onerror","msg","line","column","arguments","_oldOnUnhandledRejectionHandler","onunhandledrejection","addInstrumentationHandler","handler","data","fetchArgs","debounceDuration","keypressTimeout","lastCapturedEvent","debounceTimer","debounce","clearTimeout","setTimeout","isContentEditable","States","SyncPromise","executor","PENDING","_setResult","RESOLVED","reason","REJECTED","state","_state","_resolve","_reject","_value","_executeHandlers","_handlers","concat","cachedHandlers","done","onfulfilled","onrejected","resolve","_","reject","collection","TypeError","counter","resolvedCollection","item","index","_attachHandler","onfinally","isRejected","PromiseBuffer","_limit","task","isReady","_buffer","remove","timeout","capturedSetTimeout","all","dateTimestampSource","nowSeconds","platformPerformance","mod","module","request","require","performance","getNodePerformance","timeOrigin","getBrowserPerformance","timestampSource","dateTimestampInSeconds","timing","navigationStart","Scope","scope","newScope","_breadcrumbs","_tags","_extra","_contexts","_user","_level","_span","_session","_transactionName","_fingerprint","_eventProcessors","_scopeListeners","update","_notifyScopeListeners","tags","extras","extra","fingerprint","setTransactionName","context","span","getSpan","transaction","spanRecorder","spans","session","captureContext","updatedScope","contexts","breadcrumb","maxBreadcrumbs","mergedBreadcrumb","timestamp","hint","trace","getTraceContext","transactionName","_applyFingerprint","breadcrumbs","_notifyEventProcessors","getGlobalEventProcessors","processors","processor","final","_notifyingListeners","globalEventProcessors","addGlobalEventProcessor","Session","Ok","ip_address","ipAddress","did","email","username","sid","started","duration","release","environment","userAgent","errors","Exited","init","toISOString","attrs","user_agent","API_VERSION","DEFAULT_BREADCRUMBS","MAX_BREADCRUMBS","Hub","client","_version","getStackTop","bindClient","version","setupIntegrations","clone","getScope","getStack","getClient","pushScope","popScope","_stack","eventId","_lastEventId","finalHint","syntheticException","originalException","_invokeClient","beforeBreadcrumb","getOptions","finalBreadcrumb","addBreadcrumb","min","setUser","setTags","setExtras","setTag","setExtra","setContext","oldHub","makeMain","integration","getIntegration","_callExtensionMethod","customSamplingContext","endSession","getUser","setSession","getSession","close","captureSession","sentry","getMainCarrier","extensions","carrier","hub","registry","getHubFromCarrier","setHubOnCarrier","getCurrentHub","hasHubOnCarrier","isOlderThan","activeDomain","domain","active","getActiveDomain","registryHubTopStack","getHubFromActiveDomain","callOnHub","captureException","withScope","SENTRY_API_VERSION","API","dsn","_dsnObject","_getIngestEndpoint","getStoreEndpoint","_encodedAuth","_getEnvelopeEndpoint","clientName","clientVersion","header","Content-Type","X-Sentry-Auth","dialogOptions","endpoint","getBaseApiEndpoint","encodedOptions","encodeURIComponent","auth","sentry_key","sentry_version","installedIntegrations","integrations","defaultIntegrations","userIntegrations","userIntegrationsNames","pickedIntegrationsNames","defaultIntegration","userIntegration","integrationsNames","getIntegrationsToSetup","setupOnce","setupIntegration","BaseClient","backendClass","_backend","_options","_dsn","_process","_getBackend","eventFromException","_captureEvent","promisedEvent","eventFromMessage","_sendSession","_isClientProcessing","ready","getTransport","transportFlushed","flush","enabled","_isEnabled","_integrations","crashed","errored","exceptions","ex","handled","headers","Crashed","Number","sendSession","ticked","interval","setInterval","_processing","clearInterval","normalizeDepth","prepared","_applyClientOptions","_applyIntegrationsMetadata","finalScope","applyToEvent","evt","_normalizeEvent","b","dist","maxValueLength","sdkInfo","sdk","integrationsArray","sendEvent","_processEvent","finalEvent","beforeSend","sampleRate","isTransaction","_prepareEvent","__sentry__","beforeSendResult","processedEvent","_updateSessionFromEvent","_sendEvent","promise","NoopTransport","Skipped","BaseBackend","_transport","_setupTransport","_exception","_hint","_message","sessionToSentryRequest","api","sent_at","getEnvelopeEndpointWithUrlEncodedAuth","eventToSentryRequest","useEnvelope","req","getStoreEndpointWithUrlEncodedAuth","envelope","originalFunctionToString","FunctionToString","DEFAULT_IGNORE_ERRORS","InboundFilters","clientOptions","_mergeOptions","_shouldDropEvent","_isSentryError","_isIgnoredError","_isDeniedUrl","_getEventFilterUrl","_isAllowedUrl","ignoreInternal","ignoreErrors","_getPossibleEventMessages","some","denyUrls","allowUrls","whitelistUrls","blacklistUrls","oO","stacktrace","frames","filename","UNKNOWN_FUNCTION","gecko","winjs","geckoEval","chromeEval","reactMinifiedRegexp","computeStackTrace","popSize","framesToPop","opera10Regex","opera11Regex","lines","parts","element","extractMessage","computeStackTraceFromStacktraceProp","popFrames","isEval","submatch","isNative","columnNumber","computeStackTraceFromStackProp","failed","STACKTRACE_LIMIT","exceptionFromStacktrace","prepareFramesForEvent","eventFromStacktrace","localStack","firstFrameFunction","lastFrameFunction","frame","colno","function","in_app","lineno","eventFromUnknownInput","attachStacktrace","eventFromString","domException","DOMException.code","rejection","__serialized__","eventFromPlainObject","synthetic","BaseTransport","_api","drain","requestType","fromHttpCode","_handleRateLimit","_disabledUntil","category","_rateLimits","rlHeader","raHeader","limit","trim","parameters","headerDelay","delay","headerDate","parseRetryAfterHeader","FetchTransport","_sendRequest","sentryRequest","originalPayload","_isRateLimited","Promise","fetchParameters","assign","x-sentry-rate-limits","get","retry-after","_handleResponse","catch","XHRTransport","getResponseHeader","open","setRequestHeader","send","BrowserBackend","transportOptions","transport","ignoreOnError","shouldIgnoreOnError","wrap","before","sentryWrapped","wrappedArguments","arg","addEventProcessor","property","defineProperty","getOwnPropertyDescriptor","configurable","injectReportDialog","script","async","src","getReportDialogEndpoint","onLoad","onload","GlobalHandlers","stackTraceLimit","_installGlobalOnErrorHandler","_installGlobalOnUnhandledRejectionHandler","_onErrorHandlerInstalled","currentHub","hasIntegration","isFailedOwnDelivery","_eventFromIncompleteOnError","_enhanceEventWithInitialFrame","captureEvent","_onUnhandledRejectionHandlerInstalled","_eventFromIncompleteRejection","ERROR_TYPES_RE","groups","getLocationHref","DEFAULT_EVENT_TARGET","TryCatch","eventTarget","requestAnimationFrame","_wrapTimeFunction","_wrapRAF","_wrapXHR","_wrapEventTarget","originalCallback","originalRemoveEventListener","wrappedEventHandler","originalEventHandler","wrapOptions","Breadcrumbs","dom","_consoleBreadcrumb","_domBreadcrumb","_xhrBreadcrumb","_fetchBreadcrumb","_historyBreadcrumb","fromString","parsedLoc","parsedFrom","parsedTo","DEFAULT_KEY","DEFAULT_LIMIT","LinkedErrors","_key","_handler","linkedErrors","_walkErrorTree","UserAgent","navigator","referrer","Referer","User-Agent","SDK_NAME","SDK_VERSION","BrowserClient","getDsn","platform","packages","addSentryBreadcrumb","CoreIntegrations.InboundFilters","CoreIntegrations.FunctionToString","windowIntegrations","_window","Sentry","Integrations","INTEGRATIONS","CoreIntegrations","BrowserIntegrations","SENTRY_RELEASE","autoSessionTracking","clientClass","debug","enable","initAndBind","loadResolved","fcpResolved","possiblyEndSession","resolveWindowLoaded","removeEventListener","startSession","po","PerformanceObserver","entryList","getEntries","entry","startTime","firstHiddenTime","disconnect","visibilityState","timeStamp","once","observe","buffered","startSessionTracking","lastEventId","showReportDialog","internalWrap"],"mappings":";uBACA,IAAYA,ECmDAC,EClDAC,ECAAC,WCOIC,EAAQC,GACtB,OAAQC,OAAOC,UAAUC,SAASC,KAAKJ,IACrC,IAAK,iBAEL,IAAK,qBAEL,IAAK,wBACH,OAAO,EACT,QACE,OAAOK,EAAaL,EAAKM,iBAWfC,EAAaP,GAC3B,MAA+C,wBAAxCC,OAAOC,UAAUC,SAASC,KAAKJ,YAUxBQ,EAAWR,GACzB,MAA+C,sBAAxCC,OAAOC,UAAUC,SAASC,KAAKJ,YAqBxBS,EAAST,GACvB,MAA+C,oBAAxCC,OAAOC,UAAUC,SAASC,KAAKJ,YAUxBU,EAAYV,GAC1B,OAAe,OAARA,GAAgC,iBAARA,GAAmC,mBAARA,WAU5CW,EAAcX,GAC5B,MAA+C,oBAAxCC,OAAOC,UAAUC,SAASC,KAAKJ,YAUxBY,EAAQZ,GACtB,MAAwB,oBAAVa,OAAyBR,EAAaL,EAAKa,gBAU3CC,EAAUd,GACxB,MAA0B,oBAAZe,SAA2BV,EAAaL,EAAKe,kBAkB7CC,EAAWhB,GAEzB,OAAOiB,QAAQjB,GAAOA,EAAIkB,MAA4B,mBAAblB,EAAIkB,eAqB/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