UNPKG

com.hikky.heliodorlib

Version:

This is the library for Vket Cloud SDK.

1,589 lines (1,562 loc) 1.12 MB
"use strict"; (() => { // node_modules/@sentry/core/build/esm/debug-build.js var DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; // node_modules/@sentry/core/build/esm/utils-hoist/version.js var SDK_VERSION = "9.16.1"; // node_modules/@sentry/core/build/esm/utils-hoist/worldwide.js var GLOBAL_OBJ = globalThis; // node_modules/@sentry/core/build/esm/carrier.js function getMainCarrier() { getSentryCarrier(GLOBAL_OBJ); return GLOBAL_OBJ; } function getSentryCarrier(carrier) { const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {}; __SENTRY__.version = __SENTRY__.version || SDK_VERSION; return __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; } function getGlobalSingleton(name, creator, obj = GLOBAL_OBJ) { const __SENTRY__ = obj.__SENTRY__ = obj.__SENTRY__ || {}; const carrier = __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; return carrier[name] || (carrier[name] = creator()); } // node_modules/@sentry/core/build/esm/utils-hoist/is.js var objectToString = Object.prototype.toString; function isError(wat) { switch (objectToString.call(wat)) { case "[object Error]": case "[object Exception]": case "[object DOMException]": case "[object WebAssembly.Exception]": return true; default: return isInstanceOf(wat, Error); } } function isBuiltin(wat, className) { return objectToString.call(wat) === `[object ${className}]`; } function isErrorEvent(wat) { return isBuiltin(wat, "ErrorEvent"); } function isDOMError(wat) { return isBuiltin(wat, "DOMError"); } function isDOMException(wat) { return isBuiltin(wat, "DOMException"); } function isString(wat) { return isBuiltin(wat, "String"); } function isParameterizedString(wat) { return typeof wat === "object" && wat !== null && "__sentry_template_string__" in wat && "__sentry_template_values__" in wat; } function isPrimitive(wat) { return wat === null || isParameterizedString(wat) || typeof wat !== "object" && typeof wat !== "function"; } function isPlainObject(wat) { return isBuiltin(wat, "Object"); } function isEvent(wat) { return typeof Event !== "undefined" && isInstanceOf(wat, Event); } function isElement(wat) { return typeof Element !== "undefined" && isInstanceOf(wat, Element); } function isRegExp(wat) { return isBuiltin(wat, "RegExp"); } function isThenable(wat) { return Boolean(wat?.then && typeof wat.then === "function"); } function isSyntheticEvent(wat) { return isPlainObject(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat; } function isInstanceOf(wat, base) { try { return wat instanceof base; } catch (_e2) { return false; } } function isVueViewModel(wat) { return !!(typeof wat === "object" && wat !== null && (wat.__isVue || wat._isVue)); } function isRequest(request) { return typeof Request !== "undefined" && isInstanceOf(request, Request); } // node_modules/@sentry/core/build/esm/utils-hoist/browser.js var WINDOW = GLOBAL_OBJ; var DEFAULT_MAX_STRING_LENGTH = 80; function htmlTreeAsString(elem, options = {}) { if (!elem) { return "<unknown>"; } try { let currentElem = elem; const MAX_TRAVERSE_HEIGHT = 5; const out = []; let height = 0; let len = 0; const separator = " > "; const sepLength = separator.length; let nextStr; const keyAttrs = Array.isArray(options) ? options : options.keyAttrs; const maxStringLength = !Array.isArray(options) && options.maxStringLength || DEFAULT_MAX_STRING_LENGTH; while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) { nextStr = _htmlElementAsString(currentElem, keyAttrs); if (nextStr === "html" || height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength) { break; } out.push(nextStr); len += nextStr.length; currentElem = currentElem.parentNode; } return out.reverse().join(separator); } catch (_oO) { return "<unknown>"; } } function _htmlElementAsString(el, keyAttrs) { const elem = el; const out = []; if (!elem?.tagName) { return ""; } if (WINDOW.HTMLElement) { if (elem instanceof HTMLElement && elem.dataset) { if (elem.dataset["sentryComponent"]) { return elem.dataset["sentryComponent"]; } if (elem.dataset["sentryElement"]) { return elem.dataset["sentryElement"]; } } } out.push(elem.tagName.toLowerCase()); const keyAttrPairs = keyAttrs?.length ? keyAttrs.filter((keyAttr) => elem.getAttribute(keyAttr)).map((keyAttr) => [keyAttr, elem.getAttribute(keyAttr)]) : null; if (keyAttrPairs?.length) { keyAttrPairs.forEach((keyAttrPair) => { out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`); }); } else { if (elem.id) { out.push(`#${elem.id}`); } const className = elem.className; if (className && isString(className)) { const classes = className.split(/\s+/); for (const c2 of classes) { out.push(`.${c2}`); } } } const allowedAttrs = ["aria-label", "type", "name", "title", "alt"]; for (const k2 of allowedAttrs) { const attr = elem.getAttribute(k2); if (attr) { out.push(`[${k2}="${attr}"]`); } } return out.join(""); } function getLocationHref() { try { return WINDOW.document.location.href; } catch (oO) { return ""; } } function getComponentName(elem) { if (!WINDOW.HTMLElement) { return null; } let currentElem = elem; const MAX_TRAVERSE_HEIGHT = 5; for (let i2 = 0; i2 < MAX_TRAVERSE_HEIGHT; i2++) { if (!currentElem) { return null; } if (currentElem instanceof HTMLElement) { if (currentElem.dataset["sentryComponent"]) { return currentElem.dataset["sentryComponent"]; } if (currentElem.dataset["sentryElement"]) { return currentElem.dataset["sentryElement"]; } } currentElem = currentElem.parentNode; } return null; } // node_modules/@sentry/core/build/esm/utils-hoist/debug-build.js var DEBUG_BUILD2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; // node_modules/@sentry/core/build/esm/utils-hoist/logger.js var PREFIX = "Sentry Logger "; var CONSOLE_LEVELS = [ "debug", "info", "warn", "error", "log", "assert", "trace" ]; var originalConsoleMethods = {}; function consoleSandbox(callback) { if (!("console" in GLOBAL_OBJ)) { return callback(); } const console2 = GLOBAL_OBJ.console; const wrappedFuncs = {}; const wrappedLevels = Object.keys(originalConsoleMethods); wrappedLevels.forEach((level) => { const originalConsoleMethod = originalConsoleMethods[level]; wrappedFuncs[level] = console2[level]; console2[level] = originalConsoleMethod; }); try { return callback(); } finally { wrappedLevels.forEach((level) => { console2[level] = wrappedFuncs[level]; }); } } function makeLogger() { let enabled = false; const logger2 = { enable: () => { enabled = true; }, disable: () => { enabled = false; }, isEnabled: () => enabled }; if (DEBUG_BUILD2) { CONSOLE_LEVELS.forEach((name) => { logger2[name] = (...args) => { if (enabled) { consoleSandbox(() => { GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args); }); } }; }); } else { CONSOLE_LEVELS.forEach((name) => { logger2[name] = () => void 0; }); } return logger2; } var logger = getGlobalSingleton("logger", makeLogger); // node_modules/@sentry/core/build/esm/utils-hoist/string.js function truncate(str, max = 0) { if (typeof str !== "string" || max === 0) { return str; } return str.length <= max ? str : `${str.slice(0, max)}...`; } function safeJoin(input, delimiter) { if (!Array.isArray(input)) { return ""; } const output = []; for (let i2 = 0; i2 < input.length; i2++) { const value = input[i2]; try { if (isVueViewModel(value)) { output.push("[VueViewModel]"); } else { output.push(String(value)); } } catch (e2) { output.push("[value cannot be serialized]"); } } return output.join(delimiter); } function isMatchingPattern(value, pattern, requireExactStringMatch = false) { if (!isString(value)) { return false; } if (isRegExp(pattern)) { return pattern.test(value); } if (isString(pattern)) { return requireExactStringMatch ? value === pattern : value.includes(pattern); } return false; } function stringMatchesSomePattern(testString, patterns = [], requireExactStringMatch = false) { return patterns.some((pattern) => isMatchingPattern(testString, pattern, requireExactStringMatch)); } // node_modules/@sentry/core/build/esm/utils-hoist/object.js function fill(source, name, replacementFactory) { if (!(name in source)) { return; } const original = source[name]; if (typeof original !== "function") { return; } const wrapped = replacementFactory(original); if (typeof wrapped === "function") { markFunctionWrapped(wrapped, original); } try { source[name] = wrapped; } catch { DEBUG_BUILD2 && logger.log(`Failed to replace method "${name}" in object`, source); } } function addNonEnumerableProperty(obj, name, value) { try { Object.defineProperty(obj, name, { // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it value, writable: true, configurable: true }); } catch (o_O) { DEBUG_BUILD2 && logger.log(`Failed to add non-enumerable property "${name}" to object`, obj); } } function markFunctionWrapped(wrapped, original) { try { const proto = original.prototype || {}; wrapped.prototype = original.prototype = proto; addNonEnumerableProperty(wrapped, "__sentry_original__", original); } catch (o_O) { } } function getOriginalFunction(func) { return func.__sentry_original__; } function convertToPlainObject(value) { if (isError(value)) { return { message: value.message, name: value.name, stack: value.stack, ...getOwnProperties(value) }; } else if (isEvent(value)) { const newObj = { type: value.type, target: serializeEventTarget(value.target), currentTarget: serializeEventTarget(value.currentTarget), ...getOwnProperties(value) }; if (typeof CustomEvent !== "undefined" && isInstanceOf(value, CustomEvent)) { newObj.detail = value.detail; } return newObj; } else { return value; } } function serializeEventTarget(target) { try { return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target); } catch (_oO) { return "<unknown>"; } } function getOwnProperties(obj) { if (typeof obj === "object" && obj !== null) { const extractedProps = {}; for (const property in obj) { if (Object.prototype.hasOwnProperty.call(obj, property)) { extractedProps[property] = obj[property]; } } return extractedProps; } else { return {}; } } function extractExceptionKeysForMessage(exception, maxLength = 40) { const keys = Object.keys(convertToPlainObject(exception)); keys.sort(); const firstKey = keys[0]; if (!firstKey) { return "[object has no keys]"; } if (firstKey.length >= maxLength) { return truncate(firstKey, maxLength); } for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) { const serialized = keys.slice(0, includedKeys).join(", "); if (serialized.length > maxLength) { continue; } if (includedKeys === keys.length) { return serialized; } return truncate(serialized, maxLength); } return ""; } // node_modules/@sentry/core/build/esm/utils-hoist/misc.js function getCrypto() { const gbl = GLOBAL_OBJ; return gbl.crypto || gbl.msCrypto; } function uuid4(crypto = getCrypto()) { let getRandomByte = () => Math.random() * 16; try { if (crypto?.randomUUID) { return crypto.randomUUID().replace(/-/g, ""); } if (crypto?.getRandomValues) { getRandomByte = () => { const typedArray = new Uint8Array(1); crypto.getRandomValues(typedArray); return typedArray[0]; }; } } catch (_2) { } return ("10000000100040008000" + 1e11).replace( /[018]/g, (c2) => ( // eslint-disable-next-line no-bitwise (c2 ^ (getRandomByte() & 15) >> c2 / 4).toString(16) ) ); } function getFirstException(event) { return event.exception?.values?.[0]; } function getEventDescription(event) { const { message, event_id: eventId } = event; if (message) { return message; } const firstException = getFirstException(event); if (firstException) { if (firstException.type && firstException.value) { return `${firstException.type}: ${firstException.value}`; } return firstException.type || firstException.value || eventId || "<unknown>"; } return eventId || "<unknown>"; } function addExceptionTypeValue(event, value, type) { const exception = event.exception = event.exception || {}; const values = exception.values = exception.values || []; const firstException = values[0] = values[0] || {}; if (!firstException.value) { firstException.value = value || ""; } if (!firstException.type) { firstException.type = type || "Error"; } } function addExceptionMechanism(event, newMechanism) { const firstException = getFirstException(event); if (!firstException) { return; } const defaultMechanism = { type: "generic", handled: true }; const currentMechanism = firstException.mechanism; firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism }; if (newMechanism && "data" in newMechanism) { const mergedData = { ...currentMechanism?.data, ...newMechanism.data }; firstException.mechanism.data = mergedData; } } function checkOrSetAlreadyCaught(exception) { if (isAlreadyCaptured(exception)) { return true; } try { addNonEnumerableProperty(exception, "__sentry_captured__", true); } catch (err) { } return false; } function isAlreadyCaptured(exception) { try { return exception.__sentry_captured__; } catch { } } // node_modules/@sentry/core/build/esm/utils-hoist/time.js var ONE_SECOND_IN_MS = 1e3; function dateTimestampInSeconds() { return Date.now() / ONE_SECOND_IN_MS; } function createUnixTimestampInSecondsFunc() { const { performance: performance2 } = GLOBAL_OBJ; if (!performance2?.now) { return dateTimestampInSeconds; } const approxStartingTimeOrigin = Date.now() - performance2.now(); const timeOrigin = performance2.timeOrigin == void 0 ? approxStartingTimeOrigin : performance2.timeOrigin; return () => { return (timeOrigin + performance2.now()) / ONE_SECOND_IN_MS; }; } var timestampInSeconds = createUnixTimestampInSecondsFunc(); var cachedTimeOrigin; function getBrowserTimeOrigin() { const { performance: performance2 } = GLOBAL_OBJ; if (!performance2?.now) { return [void 0, "none"]; } const threshold = 3600 * 1e3; const performanceNow = performance2.now(); const dateNow = Date.now(); const timeOriginDelta = performance2.timeOrigin ? Math.abs(performance2.timeOrigin + performanceNow - dateNow) : threshold; const timeOriginIsReliable = timeOriginDelta < threshold; const navigationStart = performance2.timing?.navigationStart; const hasNavigationStart = typeof navigationStart === "number"; const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold; const navigationStartIsReliable = navigationStartDelta < threshold; if (timeOriginIsReliable || navigationStartIsReliable) { if (timeOriginDelta <= navigationStartDelta) { return [performance2.timeOrigin, "timeOrigin"]; } else { return [navigationStart, "navigationStart"]; } } return [dateNow, "dateNow"]; } function browserPerformanceTimeOrigin() { if (!cachedTimeOrigin) { cachedTimeOrigin = getBrowserTimeOrigin(); } return cachedTimeOrigin[0]; } // node_modules/@sentry/core/build/esm/session.js function makeSession(context) { const startingTime = timestampInSeconds(); const session = { sid: uuid4(), init: true, timestamp: startingTime, started: startingTime, duration: 0, status: "ok", errors: 0, ignoreDuration: false, toJSON: () => sessionToJSON(session) }; if (context) { updateSession(session, context); } return session; } function updateSession(session, context = {}) { if (context.user) { if (!session.ipAddress && context.user.ip_address) { session.ipAddress = context.user.ip_address; } if (!session.did && !context.did) { session.did = context.user.id || context.user.email || context.user.username; } } session.timestamp = context.timestamp || timestampInSeconds(); if (context.abnormal_mechanism) { session.abnormal_mechanism = context.abnormal_mechanism; } if (context.ignoreDuration) { session.ignoreDuration = context.ignoreDuration; } if (context.sid) { session.sid = context.sid.length === 32 ? context.sid : uuid4(); } if (context.init !== void 0) { session.init = context.init; } if (!session.did && context.did) { session.did = `${context.did}`; } if (typeof context.started === "number") { session.started = context.started; } if (session.ignoreDuration) { session.duration = void 0; } else if (typeof context.duration === "number") { session.duration = context.duration; } else { const duration = session.timestamp - session.started; session.duration = duration >= 0 ? duration : 0; } if (context.release) { session.release = context.release; } if (context.environment) { session.environment = context.environment; } if (!session.ipAddress && context.ipAddress) { session.ipAddress = context.ipAddress; } if (!session.userAgent && context.userAgent) { session.userAgent = context.userAgent; } if (typeof context.errors === "number") { session.errors = context.errors; } if (context.status) { session.status = context.status; } } function closeSession(session, status2) { let context = {}; if (status2) { context = { status: status2 }; } else if (session.status === "ok") { context = { status: "exited" }; } updateSession(session, context); } function sessionToJSON(session) { return { sid: `${session.sid}`, init: session.init, // Make sure that sec is converted to ms for date constructor started: new Date(session.started * 1e3).toISOString(), timestamp: new Date(session.timestamp * 1e3).toISOString(), status: session.status, errors: session.errors, did: typeof session.did === "number" || typeof session.did === "string" ? `${session.did}` : void 0, duration: session.duration, abnormal_mechanism: session.abnormal_mechanism, attrs: { release: session.release, environment: session.environment, ip_address: session.ipAddress, user_agent: session.userAgent } }; } // node_modules/@sentry/core/build/esm/utils/merge.js function merge(initialObj, mergeObj, levels = 2) { if (!mergeObj || typeof mergeObj !== "object" || levels <= 0) { return mergeObj; } if (initialObj && Object.keys(mergeObj).length === 0) { return initialObj; } const output = { ...initialObj }; for (const key in mergeObj) { if (Object.prototype.hasOwnProperty.call(mergeObj, key)) { output[key] = merge(output[key], mergeObj[key], levels - 1); } } return output; } // node_modules/@sentry/core/build/esm/utils/spanOnScope.js var SCOPE_SPAN_FIELD = "_sentrySpan"; function _setSpanForScope(scope, span) { if (span) { addNonEnumerableProperty(scope, SCOPE_SPAN_FIELD, span); } else { delete scope[SCOPE_SPAN_FIELD]; } } function _getSpanForScope(scope) { return scope[SCOPE_SPAN_FIELD]; } // node_modules/@sentry/core/build/esm/utils-hoist/propagationContext.js function generateTraceId() { return uuid4(); } function generateSpanId() { return uuid4().substring(16); } // node_modules/@sentry/core/build/esm/scope.js var DEFAULT_MAX_BREADCRUMBS = 100; var Scope = class _Scope { /** Flag if notifying is happening. */ /** Callback for client to receive scope changes. */ /** Callback list that will be called during event processing. */ /** Array of breadcrumbs. */ /** User */ /** Tags */ /** Extra */ /** Contexts */ /** Attachments */ /** Propagation Context for distributed tracing */ /** * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get * sent to Sentry */ /** Fingerprint */ /** Severity */ /** * Transaction Name * * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects. * It's purpose is to assign a transaction to the scope that's added to non-transaction events. */ /** Session */ /** The client on this scope */ /** Contains the last event id of a captured event. */ // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method. constructor() { this._notifyingListeners = false; this._scopeListeners = []; this._eventProcessors = []; this._breadcrumbs = []; this._attachments = []; this._user = {}; this._tags = {}; this._extra = {}; this._contexts = {}; this._sdkProcessingMetadata = {}; this._propagationContext = { traceId: generateTraceId(), sampleRand: Math.random() }; } /** * Clone all data from this scope into a new scope. */ clone() { const newScope = new _Scope(); newScope._breadcrumbs = [...this._breadcrumbs]; newScope._tags = { ...this._tags }; newScope._extra = { ...this._extra }; newScope._contexts = { ...this._contexts }; if (this._contexts.flags) { newScope._contexts.flags = { values: [...this._contexts.flags.values] }; } newScope._user = this._user; newScope._level = this._level; newScope._session = this._session; newScope._transactionName = this._transactionName; newScope._fingerprint = this._fingerprint; newScope._eventProcessors = [...this._eventProcessors]; newScope._attachments = [...this._attachments]; newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }; newScope._propagationContext = { ...this._propagationContext }; newScope._client = this._client; newScope._lastEventId = this._lastEventId; _setSpanForScope(newScope, _getSpanForScope(this)); return newScope; } /** * Update the client assigned to this scope. * Note that not every scope will have a client assigned - isolation scopes & the global scope will generally not have a client, * as well as manually created scopes. */ setClient(client) { this._client = client; } /** * Set the ID of the last captured error event. * This is generally only captured on the isolation scope. */ setLastEventId(lastEventId2) { this._lastEventId = lastEventId2; } /** * Get the client assigned to this scope. */ getClient() { return this._client; } /** * Get the ID of the last captured error event. * This is generally only available on the isolation scope. */ lastEventId() { return this._lastEventId; } /** * @inheritDoc */ addScopeListener(callback) { this._scopeListeners.push(callback); } /** * Add an event processor that will be called before an event is sent. */ addEventProcessor(callback) { this._eventProcessors.push(callback); return this; } /** * Set the user for this scope. * Set to `null` to unset the user. */ setUser(user) { this._user = user || { email: void 0, id: void 0, ip_address: void 0, username: void 0 }; if (this._session) { updateSession(this._session, { user }); } this._notifyScopeListeners(); return this; } /** * Get the user from this scope. */ getUser() { return this._user; } /** * Set an object that will be merged into existing tags on the scope, * and will be sent as tags data with the event. */ setTags(tags) { this._tags = { ...this._tags, ...tags }; this._notifyScopeListeners(); return this; } /** * Set a single tag that will be sent as tags data with the event. */ setTag(key, value) { this._tags = { ...this._tags, [key]: value }; this._notifyScopeListeners(); return this; } /** * Set an object that will be merged into existing extra on the scope, * and will be sent as extra data with the event. */ setExtras(extras) { this._extra = { ...this._extra, ...extras }; this._notifyScopeListeners(); return this; } /** * Set a single key:value extra entry that will be sent as extra data with the event. */ setExtra(key, extra) { this._extra = { ...this._extra, [key]: extra }; this._notifyScopeListeners(); return this; } /** * Sets the fingerprint on the scope to send with the events. * @param {string[]} fingerprint Fingerprint to group events in Sentry. */ setFingerprint(fingerprint) { this._fingerprint = fingerprint; this._notifyScopeListeners(); return this; } /** * Sets the level on the scope for future events. */ setLevel(level) { this._level = level; this._notifyScopeListeners(); return this; } /** * Sets the transaction name on the scope so that the name of e.g. taken server route or * the page location is attached to future events. * * IMPORTANT: Calling this function does NOT change the name of the currently active * root span. If you want to change the name of the active root span, use * `Sentry.updateSpanName(rootSpan, 'new name')` instead. * * By default, the SDK updates the scope's transaction name automatically on sensible * occasions, such as a page navigation or when handling a new request on the server. */ setTransactionName(name) { this._transactionName = name; this._notifyScopeListeners(); return this; } /** * Sets context data with the given name. * Data passed as context will be normalized. You can also pass `null` to unset the context. * Note that context data will not be merged - calling `setContext` will overwrite an existing context with the same key. */ setContext(key, context) { if (context === null) { delete this._contexts[key]; } else { this._contexts[key] = context; } this._notifyScopeListeners(); return this; } /** * Set the session for the scope. */ setSession(session) { if (!session) { delete this._session; } else { this._session = session; } this._notifyScopeListeners(); return this; } /** * Get the session from the scope. */ getSession() { return this._session; } /** * Updates the scope with provided data. Can work in three variations: * - plain object containing updatable attributes * - Scope instance that'll extract the attributes from * - callback function that'll receive the current scope as an argument and allow for modifications */ update(captureContext) { if (!captureContext) { return this; } const scopeToMerge = typeof captureContext === "function" ? captureContext(this) : captureContext; const scopeInstance = scopeToMerge instanceof _Scope ? scopeToMerge.getScopeData() : isPlainObject(scopeToMerge) ? captureContext : void 0; const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {}; this._tags = { ...this._tags, ...tags }; this._extra = { ...this._extra, ...extra }; this._contexts = { ...this._contexts, ...contexts }; if (user && Object.keys(user).length) { this._user = user; } if (level) { this._level = level; } if (fingerprint.length) { this._fingerprint = fingerprint; } if (propagationContext) { this._propagationContext = propagationContext; } return this; } /** * Clears the current scope and resets its properties. * Note: The client will not be cleared. */ clear() { this._breadcrumbs = []; this._tags = {}; this._extra = {}; this._user = {}; this._contexts = {}; this._level = void 0; this._transactionName = void 0; this._fingerprint = void 0; this._session = void 0; _setSpanForScope(this, void 0); this._attachments = []; this.setPropagationContext({ traceId: generateTraceId(), sampleRand: Math.random() }); this._notifyScopeListeners(); return this; } /** * Adds a breadcrumb to the scope. * By default, the last 100 breadcrumbs are kept. */ addBreadcrumb(breadcrumb, maxBreadcrumbs) { const maxCrumbs = typeof maxBreadcrumbs === "number" ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS; if (maxCrumbs <= 0) { return this; } const mergedBreadcrumb = { timestamp: dateTimestampInSeconds(), ...breadcrumb, // Breadcrumb messages can theoretically be infinitely large and they're held in memory so we truncate them not to leak (too much) memory message: breadcrumb.message ? truncate(breadcrumb.message, 2048) : breadcrumb.message }; this._breadcrumbs.push(mergedBreadcrumb); if (this._breadcrumbs.length > maxCrumbs) { this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs); this._client?.recordDroppedEvent("buffer_overflow", "log_item"); } this._notifyScopeListeners(); return this; } /** * Get the last breadcrumb of the scope. */ getLastBreadcrumb() { return this._breadcrumbs[this._breadcrumbs.length - 1]; } /** * Clear all breadcrumbs from the scope. */ clearBreadcrumbs() { this._breadcrumbs = []; this._notifyScopeListeners(); return this; } /** * Add an attachment to the scope. */ addAttachment(attachment) { this._attachments.push(attachment); return this; } /** * Clear all attachments from the scope. */ clearAttachments() { this._attachments = []; return this; } /** * Get the data of this scope, which should be applied to an event during processing. */ getScopeData() { return { breadcrumbs: this._breadcrumbs, attachments: this._attachments, contexts: this._contexts, tags: this._tags, extra: this._extra, user: this._user, level: this._level, fingerprint: this._fingerprint || [], eventProcessors: this._eventProcessors, propagationContext: this._propagationContext, sdkProcessingMetadata: this._sdkProcessingMetadata, transactionName: this._transactionName, span: _getSpanForScope(this) }; } /** * Add data which will be accessible during event processing but won't get sent to Sentry. */ setSDKProcessingMetadata(newData) { this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2); return this; } /** * Add propagation context to the scope, used for distributed tracing */ setPropagationContext(context) { this._propagationContext = context; return this; } /** * Get propagation context from the scope, used for distributed tracing */ getPropagationContext() { return this._propagationContext; } /** * Capture an exception for this scope. * * @returns {string} The id of the captured Sentry event. */ captureException(exception, hint) { const eventId = hint?.event_id || uuid4(); if (!this._client) { logger.warn("No client configured on scope - will not capture exception!"); return eventId; } const syntheticException = new Error("Sentry syntheticException"); this._client.captureException( exception, { originalException: exception, syntheticException, ...hint, event_id: eventId }, this ); return eventId; } /** * Capture a message for this scope. * * @returns {string} The id of the captured message. */ captureMessage(message, level, hint) { const eventId = hint?.event_id || uuid4(); if (!this._client) { logger.warn("No client configured on scope - will not capture message!"); return eventId; } const syntheticException = new Error(message); this._client.captureMessage( message, level, { originalException: message, syntheticException, ...hint, event_id: eventId }, this ); return eventId; } /** * Capture a Sentry event for this scope. * * @returns {string} The id of the captured event. */ captureEvent(event, hint) { const eventId = hint?.event_id || uuid4(); if (!this._client) { logger.warn("No client configured on scope - will not capture event!"); return eventId; } this._client.captureEvent(event, { ...hint, event_id: eventId }, this); return eventId; } /** * This will be called on every set call. */ _notifyScopeListeners() { if (!this._notifyingListeners) { this._notifyingListeners = true; this._scopeListeners.forEach((callback) => { callback(this); }); this._notifyingListeners = false; } } }; // node_modules/@sentry/core/build/esm/defaultScopes.js function getDefaultCurrentScope() { return getGlobalSingleton("defaultCurrentScope", () => new Scope()); } function getDefaultIsolationScope() { return getGlobalSingleton("defaultIsolationScope", () => new Scope()); } // node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js var AsyncContextStack = class { constructor(scope, isolationScope) { let assignedScope; if (!scope) { assignedScope = new Scope(); } else { assignedScope = scope; } let assignedIsolationScope; if (!isolationScope) { assignedIsolationScope = new Scope(); } else { assignedIsolationScope = isolationScope; } this._stack = [{ scope: assignedScope }]; this._isolationScope = assignedIsolationScope; } /** * Fork a scope for the stack. */ withScope(callback) { const scope = this._pushScope(); let maybePromiseResult; try { maybePromiseResult = callback(scope); } catch (e2) { this._popScope(); throw e2; } if (isThenable(maybePromiseResult)) { return maybePromiseResult.then( (res) => { this._popScope(); return res; }, (e2) => { this._popScope(); throw e2; } ); } this._popScope(); return maybePromiseResult; } /** * Get the client of the stack. */ getClient() { return this.getStackTop().client; } /** * Returns the scope of the top stack. */ getScope() { return this.getStackTop().scope; } /** * Get the isolation scope for the stack. */ getIsolationScope() { return this._isolationScope; } /** * Returns the topmost scope layer in the order domain > local > process. */ getStackTop() { return this._stack[this._stack.length - 1]; } /** * Push a scope to the stack. */ _pushScope() { const scope = this.getScope().clone(); this._stack.push({ client: this.getClient(), scope }); return scope; } /** * Pop a scope from the stack. */ _popScope() { if (this._stack.length <= 1) return false; return !!this._stack.pop(); } }; function getAsyncContextStack() { const registry = getMainCarrier(); const sentry = getSentryCarrier(registry); return sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()); } function withScope(callback) { return getAsyncContextStack().withScope(callback); } function withSetScope(scope, callback) { const stack = getAsyncContextStack(); return stack.withScope(() => { stack.getStackTop().scope = scope; return callback(scope); }); } function withIsolationScope(callback) { return getAsyncContextStack().withScope(() => { return callback(getAsyncContextStack().getIsolationScope()); }); } function getStackAsyncContextStrategy() { return { withIsolationScope, withScope, withSetScope, withSetIsolationScope: (_isolationScope, callback) => { return withIsolationScope(callback); }, getCurrentScope: () => getAsyncContextStack().getScope(), getIsolationScope: () => getAsyncContextStack().getIsolationScope() }; } // node_modules/@sentry/core/build/esm/asyncContext/index.js function getAsyncContextStrategy(carrier) { const sentry = getSentryCarrier(carrier); if (sentry.acs) { return sentry.acs; } return getStackAsyncContextStrategy(); } // node_modules/@sentry/core/build/esm/currentScopes.js function getCurrentScope() { const carrier = getMainCarrier(); const acs = getAsyncContextStrategy(carrier); return acs.getCurrentScope(); } function getIsolationScope() { const carrier = getMainCarrier(); const acs = getAsyncContextStrategy(carrier); return acs.getIsolationScope(); } function getGlobalScope() { return getGlobalSingleton("globalScope", () => new Scope()); } function withScope2(...rest) { const carrier = getMainCarrier(); const acs = getAsyncContextStrategy(carrier); if (rest.length === 2) { const [scope, callback] = rest; if (!scope) { return acs.withScope(callback); } return acs.withSetScope(scope, callback); } return acs.withScope(rest[0]); } function getClient() { return getCurrentScope().getClient(); } function getTraceContextFromScope(scope) { const propagationContext = scope.getPropagationContext(); const { traceId, parentSpanId, propagationSpanId } = propagationContext; const traceContext = { trace_id: traceId, span_id: propagationSpanId || generateSpanId() }; if (parentSpanId) { traceContext.parent_span_id = parentSpanId; } return traceContext; } // node_modules/@sentry/core/build/esm/semanticAttributes.js var SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source"; var SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = "sentry.sample_rate"; var SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE = "sentry.previous_trace_sample_rate"; var SEMANTIC_ATTRIBUTE_SENTRY_OP = "sentry.op"; var SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = "sentry.origin"; var SEMANTIC_ATTRIBUTE_PROFILE_ID = "sentry.profile_id"; var SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = "sentry.exclusive_time"; // node_modules/@sentry/core/build/esm/tracing/spanstatus.js var SPAN_STATUS_UNSET = 0; var SPAN_STATUS_OK = 1; // node_modules/@sentry/core/build/esm/tracing/utils.js var SCOPE_ON_START_SPAN_FIELD = "_sentryScope"; var ISOLATION_SCOPE_ON_START_SPAN_FIELD = "_sentryIsolationScope"; function getCapturedScopesOnSpan(span) { return { scope: span[SCOPE_ON_START_SPAN_FIELD], isolationScope: span[ISOLATION_SCOPE_ON_START_SPAN_FIELD] }; } // node_modules/@sentry/core/build/esm/utils/parseSampleRate.js function parseSampleRate(sampleRate) { if (typeof sampleRate === "boolean") { return Number(sampleRate); } const rate = typeof sampleRate === "string" ? parseFloat(sampleRate) : sampleRate; if (typeof rate !== "number" || isNaN(rate) || rate < 0 || rate > 1) { return void 0; } return rate; } // node_modules/@sentry/core/build/esm/utils-hoist/baggage.js var SENTRY_BAGGAGE_KEY_PREFIX = "sentry-"; var SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/; function baggageHeaderToDynamicSamplingContext(baggageHeader) { const baggageObject = parseBaggageHeader(baggageHeader); if (!baggageObject) { return void 0; } const dynamicSamplingContext = Object.entries(baggageObject).reduce((acc, [key, value]) => { if (key.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)) { const nonPrefixedKey = key.slice(SENTRY_BAGGAGE_KEY_PREFIX.length); acc[nonPrefixedKey] = value; } return acc; }, {}); if (Object.keys(dynamicSamplingContext).length > 0) { return dynamicSamplingContext; } else { return void 0; } } function parseBaggageHeader(baggageHeader) { if (!baggageHeader || !isString(baggageHeader) && !Array.isArray(baggageHeader)) { return void 0; } if (Array.isArray(baggageHeader)) { return baggageHeader.reduce((acc, curr) => { const currBaggageObject = baggageHeaderToObject(curr); Object.entries(currBaggageObject).forEach(([key, value]) => { acc[key] = value; }); return acc; }, {}); } return baggageHeaderToObject(baggageHeader); } function baggageHeaderToObject(baggageHeader) { return baggageHeader.split(",").map((baggageEntry) => baggageEntry.split("=").map((keyOrValue) => decodeURIComponent(keyOrValue.trim()))).reduce((acc, [key, value]) => { if (key && value) { acc[key] = value; } return acc; }, {}); } // node_modules/@sentry/core/build/esm/utils/spanUtils.js var TRACE_FLAG_SAMPLED = 1; var hasShownSpanDropWarning = false; function spanToTraceContext(span) { const { spanId, traceId: trace_id, isRemote } = span.spanContext(); const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id; const scope = getCapturedScopesOnSpan(span).scope; const span_id = isRemote ? scope?.getPropagationContext().propagationSpanId || generateSpanId() : spanId; return { parent_span_id, span_id, trace_id }; } function convertSpanLinksForEnvelope(links) { if (links && links.length > 0) { return links.map(({ context: { spanId, traceId, traceFlags, ...restContext }, attributes }) => ({ span_id: spanId, trace_id: traceId, sampled: traceFlags === TRACE_FLAG_SAMPLED, attributes, ...restContext })); } else { return void 0; } } function spanTimeInputToSeconds(input) { if (typeof input === "number") { return ensureTimestampInSeconds(input); } if (Array.isArray(input)) { return input[0] + input[1] / 1e9; } if (input instanceof Date) { return ensureTimestampInSeconds(input.getTime()); } return timestampInSeconds(); } function ensureTimestampInSeconds(timestamp) { const isMs = timestamp > 9999999999; return isMs ? timestamp / 1e3 : timestamp; } function spanToJSON(span) { if (spanIsSentrySpan(span)) { return span.getSpanJSON(); } const { spanId: span_id, traceId: trace_id } = span.spanContext(); if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) { const { attributes, startTime, name, endTime, parentSpanId, status: status2, links } = span; return { span_id, trace_id, data: attributes, description: name, parent_span_id: parentSpanId, start_timestamp: spanTimeInputToSeconds(startTime), // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time timestamp: spanTimeInputToSeconds(endTime) || void 0, status: getStatusMessage(status2), op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], links: convertSpanLinksForEnvelope(links) }; } return { span_id, trace_id, start_timestamp: 0, data: {} }; } function spanIsOpenTelemetrySdkTraceBaseSpan(span) { const castSpan = span; return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status; } function spanIsSentrySpan(span) { return typeof span.getSpanJSON === "function"; } function spanIsSampled(span) { const { traceFlags } = span.spanContext(); return traceFlags === TRACE_FLAG_SAMPLED; } function getStatusMessage(status2) { if (!status2 || status2.code === SPAN_STATUS_UNSET) { return void 0; } if (status2.code === SPAN_STATUS_OK) { return "ok"; } return status2.message || "unknown_error"; } var ROOT_SPAN_FIELD = "_sentryRootSpan"; function getRootSpan(span) { return span[ROOT_SPAN_FIELD] || span; } function getActiveSpan() { const carrier = getMainCarrier(); const acs = getAsyncContextStrategy(carrier); if (acs.getActiveSpan) { return acs.getActiveSpan(); } return _getSpanForScope(getCurrentScope()); } function showSpanDropWarning() { if (!hasShownSpanDropWarning) { consoleSandbox(() => { console.warn( "[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly." ); }); hasShownSpanDropWarning = true; } } // node_modules/@sentry/core/build/esm/utils-hoist/stacktrace.js var STACKTRACE_FRAME_LIMIT = 50; var UNKNOWN_FUNCTION = "?"; var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/; var STRIP_FRAME_REGEXP = /captureMessage|captureException/; function createStackParser(...parsers) { const sortedParsers = parsers.sort((a2, b2) => a2[0] - b2[0]).map((p2) => p2[1]); return (stack, skipFirstLines = 0, framesToPop = 0) => { const frames = []; const lines = stack.split("\n"); for (let i2 = skipFirstLines; i2 < lines.length; i2++) { const line = lines[i2]; if (line.length > 1024) { continue; } const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, "$1") : line; if (cleanedLine.match(/\S*Error: /)) { continue; } for (const parser of sortedParsers) { const frame = parser(cleanedLine); if (frame) { frames.push(frame); break; } } if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) { break; } } return stripSentryFramesAndReverse(frames.slice(framesToPop)); }; } function stackParserFromStackParserOptions(stackParser) { if (Array.isArray(stackParser)) { return createStackParser(...stackParser); } return stackParser; } function stripSentryFramesAndReverse(stack) { if (!stack.length) { return []; } const localStack = Array.from(stack); if (/sentryWrapped/.test(getLastStackFrame(localStack).function || "")) { localStack.pop(); } localStack.reverse(); if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { localStack.pop(); if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { localStack.pop(); } } return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => ({ ...frame, filename: frame.filename || getLastStackFrame(localStack).filename, function: frame.function || UNKNOWN_FUNCTION })); } function getLastStackFrame(arr) { return arr[arr.length - 1] || {}; } var defaultFunctionName = "<anonymous>"; function ge