UNPKG

chromatic

Version:

Automate visual testing across browsers. Gather UI feedback. Versioned documentation.

12 lines (11 loc) • 2.4 MB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9bd8abc2-1d1b-516a-b4bb-1b5d8d2ff57f")}catch(e){}}(); const require_chunk$2=require(`./chunk-gGpyby2o.cjs`),require_main$2=require(`./main-YTS_kgLz.cjs`),require_src$6=require(`./src-C0CbP6lv.cjs`),require_meow=require(`./meow-BJmmmeH9.cjs`),require_execa=require(`./execa-BYysbdaH.cjs`),require_readStatsFile=require(`./readStatsFile-BZQOIcua.cjs`);let fs=require(`fs`);fs=require_chunk$2.a(fs);let path=require(`path`);path=require_chunk$2.a(path);let os=require(`os`);os=require_chunk$2.a(os);let crypto=require(`crypto`);crypto=require_chunk$2.a(crypto);let semver=require(`semver`);semver=require_chunk$2.a(semver);let util=require(`util`),child_process=require(`child_process`),node_readline=require(`node:readline`);const DEBUG_BUILD$1=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,SDK_VERSION=`8.55.1`,GLOBAL_OBJ=globalThis;function getGlobalSingleton(e,t,n){let r=n||GLOBAL_OBJ,i=r.__SENTRY__=r.__SENTRY__||{},a=i[SDK_VERSION]=i[`8.55.1`]||{};return a[e]||(a[e]=t())}const DEBUG_BUILD=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,PREFIX=`Sentry Logger `,CONSOLE_LEVELS=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],originalConsoleMethods={};function consoleSandbox(e){if(!(`console`in GLOBAL_OBJ))return e();let t=GLOBAL_OBJ.console,n={},r=Object.keys(originalConsoleMethods);r.forEach(e=>{let r=originalConsoleMethods[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function makeLogger(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return DEBUG_BUILD?CONSOLE_LEVELS.forEach(n=>{t[n]=(...t)=>{e&&consoleSandbox(()=>{GLOBAL_OBJ.console[n](`${PREFIX}[${n}]:`,...t)})}}):CONSOLE_LEVELS.forEach(e=>{t[e]=()=>void 0}),t}const logger=getGlobalSingleton(`logger`,makeLogger),STACKTRACE_FRAME_LIMIT=50,UNKNOWN_FUNCTION=`?`,WEBPACK_ERROR_REGEXP=/\(error: (.*)\)/,STRIP_FRAME_REGEXP=/captureMessage|captureException/;function createStackParser(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(` `);for(let e=n;e<a.length;e++){let n=a[e];if(n.length>1024)continue;let o=WEBPACK_ERROR_REGEXP.test(n)?n.replace(WEBPACK_ERROR_REGEXP,`$1`):n;if(!o.match(/\S*Error: /)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=STACKTRACE_FRAME_LIMIT+r)break}}return stripSentryFramesAndReverse(i.slice(r))}}function stackParserFromStackParserOptions(e){return Array.isArray(e)?createStackParser(...e):e}function stripSentryFramesAndReverse(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(getLastStackFrame(t).function||``)&&t.pop(),t.reverse(),STRIP_FRAME_REGEXP.test(getLastStackFrame(t).function||``)&&(t.pop(),STRIP_FRAME_REGEXP.test(getLastStackFrame(t).function||``)&&t.pop()),t.slice(0,STACKTRACE_FRAME_LIMIT).map(e=>({...e,filename:e.filename||getLastStackFrame(t).filename,function:e.function||`?`}))}function getLastStackFrame(e){return e[e.length-1]||{}}const defaultFunctionName=`<anonymous>`;function getFunctionName(e){try{return!e||typeof e!=`function`?defaultFunctionName:e.name||defaultFunctionName}catch{return defaultFunctionName}}function getMainCarrier(){return getSentryCarrier(GLOBAL_OBJ),GLOBAL_OBJ}function getSentryCarrier(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`8.55.1`,t[SDK_VERSION]=t[`8.55.1`]||{}}const objectToString=Object.prototype.toString;function isError(e){switch(objectToString.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return isInstanceOf(e,Error)}}function isBuiltin(e,t){return objectToString.call(e)===`[object ${t}]`}function isErrorEvent(e){return isBuiltin(e,`ErrorEvent`)}function isString(e){return isBuiltin(e,`String`)}function isParameterizedString(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function isPrimitive(e){return e===null||isParameterizedString(e)||typeof e!=`object`&&typeof e!=`function`}function isPlainObject(e){return isBuiltin(e,`Object`)}function isEvent(e){return typeof Event<`u`&&isInstanceOf(e,Event)}function isElement(e){return typeof Element<`u`&&isInstanceOf(e,Element)}function isRegExp(e){return isBuiltin(e,`RegExp`)}function isThenable(e){return!!(e&&e.then&&typeof e.then==`function`)}function isSyntheticEvent(e){return isPlainObject(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function isInstanceOf(e,t){try{return e instanceof t}catch{return!1}}function isVueViewModel(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue))}const WINDOW=GLOBAL_OBJ,DEFAULT_MAX_STRING_LENGTH=80;function htmlTreeAsString(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=5,i=[],a=0,o=0,s=` > `,c=3,l,u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||DEFAULT_MAX_STRING_LENGTH;for(;n&&a++<5&&(l=_htmlElementAsString(n,u),!(l===`html`||a>1&&o+i.length*3+l.length>=d));)i.push(l),o+=l.length,n=n.parentNode;return i.reverse().join(` > `)}catch{return`<unknown>`}}function _htmlElementAsString(e,t){let n=e,r=[];if(!n||!n.tagName)return``;if(WINDOW.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let i=t&&t.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i&&i.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let e=n.className;if(e&&isString(e)){let t=e.split(/\s+/);for(let e of t)r.push(`.${e}`)}}for(let e of[`aria-label`,`type`,`name`,`title`,`alt`]){let t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join(``)}function truncate(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function snipLine(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,r);return a>r-5&&(a=r),a===r&&(i=Math.max(a-140,0)),n=n.slice(i,a),i>0&&(n=`'{snip} ${n}`),a<r&&(n+=` {snip}`),n}function isMatchingPattern(e,t,n=!1){return isString(e)?isRegExp(t)?t.test(e):isString(t)?n?e===t:e.includes(t):!1:!1}function stringMatchesSomePattern(e,t=[],n=!1){return t.some(t=>isMatchingPattern(e,t,n))}function fill(e,t,n){if(!(t in e))return;let r=e[t],i=n(r);typeof i==`function`&&markFunctionWrapped(i,r);try{e[t]=i}catch{DEBUG_BUILD&&logger.log(`Failed to replace method "${t}" in object`,e)}}function addNonEnumerableProperty(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{DEBUG_BUILD&&logger.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function markFunctionWrapped(e,t){try{e.prototype=t.prototype=t.prototype||{},addNonEnumerableProperty(e,`__sentry_original__`,t)}catch{}}function getOriginalFunction(e){return e.__sentry_original__}function convertToPlainObject(e){if(isError(e))return{message:e.message,name:e.name,stack:e.stack,...getOwnProperties(e)};if(isEvent(e)){let t={type:e.type,target:serializeEventTarget(e.target),currentTarget:serializeEventTarget(e.currentTarget),...getOwnProperties(e)};return typeof CustomEvent<`u`&&isInstanceOf(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function serializeEventTarget(e){try{return isElement(e)?htmlTreeAsString(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function getOwnProperties(e){if(typeof e==`object`&&e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function extractExceptionKeysForMessage(e,t=40){let n=Object.keys(convertToPlainObject(e));n.sort();let r=n[0];if(!r)return`[object has no keys]`;if(r.length>=t)return truncate(r,t);for(let e=n.length;e>0;e--){let r=n.slice(0,e).join(`, `);if(!(r.length>t))return e===n.length?r:truncate(r,t)}return``}function dropUndefinedKeys(e){return _dropUndefinedKeys(e,new Map)}function _dropUndefinedKeys(e,t){if(isPojo(e)){let n=t.get(e);if(n!==void 0)return n;let r={};t.set(e,r);for(let n of Object.getOwnPropertyNames(e))e[n]!==void 0&&(r[n]=_dropUndefinedKeys(e[n],t));return r}if(Array.isArray(e)){let n=t.get(e);if(n!==void 0)return n;let r=[];return t.set(e,r),e.forEach(e=>{r.push(_dropUndefinedKeys(e,t))}),r}return e}function isPojo(e){if(!isPlainObject(e))return!1;try{let t=Object.getPrototypeOf(e).constructor.name;return!t||t===`Object`}catch{return!0}}const ONE_SECOND_IN_MS=1e3;function dateTimestampInSeconds(){return Date.now()/ONE_SECOND_IN_MS}function createUnixTimestampInSecondsFunc(){let{performance:e}=GLOBAL_OBJ;if(!e||!e.now)return dateTimestampInSeconds;let t=Date.now()-e.now(),n=e.timeOrigin==null?t:e.timeOrigin;return()=>(n+e.now())/ONE_SECOND_IN_MS}const timestampInSeconds=createUnixTimestampInSecondsFunc();let _browserPerformanceTimeOriginMode;const browserPerformanceTimeOrigin=(()=>{let{performance:e}=GLOBAL_OBJ;if(!e||!e.now)return;let t=3600*1e3,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,a=i<t,o=e.timing&&e.timing.navigationStart,s=typeof o==`number`?Math.abs(o+n-r):t;return a||s<t?i<=s?e.timeOrigin:o:r})();function uuid4(){let e=GLOBAL_OBJ,t=e.crypto||e.msCrypto,n=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,``);t&&t.getRandomValues&&(n=()=>{let e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return`10000000100040008000100000000000`.replace(/[018]/g,e=>(e^(n()&15)>>e/4).toString(16))}function getFirstException(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function getEventDescription(e){let{message:t,event_id:n}=e;if(t)return t;let r=getFirstException(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function addExceptionTypeValue(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function addExceptionMechanism(e,t){let n=getFirstException(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i&&i.data,...t.data};n.mechanism.data=e}}const 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-]+)*))?$/;function _parseInt(e){return parseInt(e||``,10)}function parseSemver(e){let t=e.match(SEMVER_REGEXP)||[],n=_parseInt(t[1]),r=_parseInt(t[2]),i=_parseInt(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function checkOrSetAlreadyCaught(e){if(isAlreadyCaptured(e))return!0;try{addNonEnumerableProperty(e,`__sentry_captured__`,!0)}catch{}return!1}function isAlreadyCaptured(e){try{return e.__sentry_captured__}catch{}}var States;(function(e){let t=0;e[e.PENDING=0]=`PENDING`;let n=1;e[e.RESOLVED=1]=`RESOLVED`;let r=2;e[e.REJECTED=2]=`REJECTED`})(States||={});function resolvedSyncPromise(e){return new SyncPromise(t=>{t(e)})}function rejectedSyncPromise(e){return new SyncPromise((t,n)=>{n(e)})}var SyncPromise=class e{constructor(t){e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),this._state=States.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(e){this._reject(e)}}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}__init(){this._resolve=e=>{this._setResult(States.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(States.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===States.PENDING){if(isThenable(t)){t.then(this._resolve,this._reject);return}this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===States.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===States.RESOLVED&&e[1](this._value),this._state===States.REJECTED&&e[2](this._value),!0)})}}};function makeSession(e){let t=timestampInSeconds(),n={sid:uuid4(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>sessionToJSON(n)};return e&&updateSession(n,e),n}function updateSession(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||timestampInSeconds(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:uuid4()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function closeSession(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),updateSession(e,n)}function sessionToJSON(e){return dropUndefinedKeys({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}function generateTraceId(){return uuid4()}function generateSpanId(){return uuid4().substring(16)}function merge(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&t&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=merge(r[e],t[e],n-1));return r}const SCOPE_SPAN_FIELD=`_sentrySpan`;function _setSpanForScope(e,t){t?addNonEnumerableProperty(e,SCOPE_SPAN_FIELD,t):delete e[SCOPE_SPAN_FIELD]}function _getSpanForScope(e){return e[SCOPE_SPAN_FIELD]}const DEFAULT_MAX_BREADCRUMBS=100;var ScopeClass=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:generateTraceId(),spanId:generateSpanId()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,_setSpanForScope(t,_getSpanForScope(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&updateSession(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let t=typeof e==`function`?e(this):e,[n,r]=t instanceof Scope?[t.getScopeData(),t.getRequestSession()]:isPlainObject(t)?[e,e.requestSession]:[],{tags:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,_setSpanForScope(this,void 0),this._attachments=[],this.setPropagationContext({traceId:generateTraceId()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:DEFAULT_MAX_BREADCRUMBS;if(n<=0)return this;let r={timestamp:dateTimestampInSeconds(),...e};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client&&this._client.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}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)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=merge(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:generateSpanId(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t&&t.event_id?t.event_id:uuid4();if(!this._client)return logger.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n&&n.event_id?n.event_id:uuid4();if(!this._client)return logger.warn(`No client configured on scope - will not capture message!`),r;let i=Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=t&&t.event_id?t.event_id:uuid4();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(logger.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};const Scope=ScopeClass;function getDefaultCurrentScope(){return getGlobalSingleton(`defaultCurrentScope`,()=>new Scope)}function getDefaultIsolationScope(){return getGlobalSingleton(`defaultIsolationScope`,()=>new Scope)}var AsyncContextStack=class{constructor(e,t){let n;n=e||new Scope;let r;r=t||new Scope,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return isThenable(n)?n.then(e=>(this._popScope(),e),e=>{throw this._popScope(),e}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function getAsyncContextStack(){let e=getSentryCarrier(getMainCarrier());return e.stack=e.stack||new AsyncContextStack(getDefaultCurrentScope(),getDefaultIsolationScope())}function withScope$1(e){return getAsyncContextStack().withScope(e)}function withSetScope(e,t){let n=getAsyncContextStack();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function withIsolationScope$1(e){return getAsyncContextStack().withScope(()=>e(getAsyncContextStack().getIsolationScope()))}function getStackAsyncContextStrategy(){return{withIsolationScope:withIsolationScope$1,withScope:withScope$1,withSetScope,withSetIsolationScope:(e,t)=>withIsolationScope$1(t),getCurrentScope:()=>getAsyncContextStack().getScope(),getIsolationScope:()=>getAsyncContextStack().getIsolationScope()}}function setAsyncContextStrategy(e){let t=getSentryCarrier(getMainCarrier());t.acs=e}function getAsyncContextStrategy(e){let t=getSentryCarrier(e);return t.acs?t.acs:getStackAsyncContextStrategy()}function getCurrentScope(){return getAsyncContextStrategy(getMainCarrier()).getCurrentScope()}function getIsolationScope(){return getAsyncContextStrategy(getMainCarrier()).getIsolationScope()}function getGlobalScope(){return getGlobalSingleton(`globalScope`,()=>new Scope)}function withScope(...e){let t=getAsyncContextStrategy(getMainCarrier());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function withIsolationScope(...e){let t=getAsyncContextStrategy(getMainCarrier());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function getClient(){return getCurrentScope().getClient()}function getTraceContextFromScope(e){let{traceId:t,spanId:n,parentSpanId:r}=e.getPropagationContext();return dropUndefinedKeys({trace_id:t,span_id:n,parent_span_id:r})}const METRICS_SPAN_FIELD=`_sentryMetrics`;function getMetricSummaryJsonForSpan(e){let t=e[METRICS_SPAN_FIELD];if(!t)return;let n={};for(let[,[e,r]]of t)(n[e]||(n[e]=[])).push(dropUndefinedKeys(r));return n}const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE=`sentry.source`,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE=`sentry.sample_rate`,SEMANTIC_ATTRIBUTE_SENTRY_OP=`sentry.op`,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN=`sentry.origin`,SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT=`sentry.measurement_unit`,SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE=`sentry.measurement_value`,SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME=`sentry.custom_span_name`,SEMANTIC_ATTRIBUTE_PROFILE_ID=`sentry.profile_id`,SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME=`sentry.exclusive_time`,SEMANTIC_ATTRIBUTE_CACHE_HIT=`cache.hit`,SEMANTIC_ATTRIBUTE_CACHE_KEY=`cache.key`,SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE=`cache.item_size`,SPAN_STATUS_OK=1,SPAN_STATUS_ERROR=2;function getSpanStatusFromHttpCode(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:`unauthenticated`};case 403:return{code:2,message:`permission_denied`};case 404:return{code:2,message:`not_found`};case 409:return{code:2,message:`already_exists`};case 413:return{code:2,message:`failed_precondition`};case 429:return{code:2,message:`resource_exhausted`};case 499:return{code:2,message:`cancelled`};default:return{code:2,message:`invalid_argument`}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:`unimplemented`};case 503:return{code:2,message:`unavailable`};case 504:return{code:2,message:`deadline_exceeded`};default:return{code:2,message:`internal_error`}}return{code:2,message:`unknown_error`}}const SENTRY_BAGGAGE_KEY_PREFIX=`sentry-`,SENTRY_BAGGAGE_KEY_PREFIX_REGEX=/^sentry-/,MAX_BAGGAGE_STRING_LENGTH=8192;function baggageHeaderToDynamicSamplingContext(e){let t=parseBaggageHeader(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function dynamicSamplingContextToSentryBaggageHeader(e){if(e)return objectToBaggageHeader(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`${SENTRY_BAGGAGE_KEY_PREFIX}${t}`]=n),e),{}))}function parseBaggageHeader(e){if(!(!e||!isString(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=baggageHeaderToObject(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):baggageHeaderToObject(e)}function baggageHeaderToObject(e){return e.split(`,`).map(e=>e.split(`=`).map(e=>decodeURIComponent(e.trim()))).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function objectToBaggageHeader(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(DEBUG_BUILD&&logger.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}const TRACEPARENT_REGEXP=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function extractTraceparentData(e){if(!e)return;let t=e.match(TRACEPARENT_REGEXP);if(!t)return;let n;return t[3]===`1`?n=!0:t[3]===`0`&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function propagationContextFromHeaders(e,t){let n=extractTraceparentData(e),r=baggageHeaderToDynamicSamplingContext(t);if(!n||!n.traceId)return{traceId:generateTraceId(),spanId:generateSpanId()};let{traceId:i,parentSpanId:a,parentSampled:o}=n;return{traceId:i,parentSpanId:a,spanId:generateSpanId(),sampled:o,dsc:r||{}}}function generateSentryTraceHeader(e=generateTraceId(),t=generateSpanId(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}const TRACE_FLAG_SAMPLED=1;let hasShownSpanDropWarning=!1;function spanToTransactionTraceContext(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:a,status:o,origin:s}=spanToJSON(e);return dropUndefinedKeys({parent_span_id:a,span_id:t,trace_id:n,data:r,op:i,status:o,origin:s})}function spanToTraceContext(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext();return dropUndefinedKeys({parent_span_id:r?t:spanToJSON(e).parent_span_id,span_id:r?generateSpanId():t,trace_id:n})}function spanToTraceHeader(e){let{traceId:t,spanId:n}=e.spanContext();return generateSentryTraceHeader(t,n,spanIsSampled(e))}function spanTimeInputToSeconds(e){return typeof e==`number`?ensureTimestampInSeconds(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ensureTimestampInSeconds(e.getTime()):timestampInSeconds()}function ensureTimestampInSeconds(e){return e>9999999999?e/1e3:e}function spanToJSON(e){if(spanIsSentrySpan(e))return e.getSpanJSON();try{let{spanId:t,traceId:n}=e.spanContext();if(spanIsOpenTelemetrySdkTraceBaseSpan(e)){let{attributes:r,startTime:i,name:a,endTime:o,parentSpanId:s,status:c}=e;return dropUndefinedKeys({span_id:t,trace_id:n,data:r,description:a,parent_span_id:s,start_timestamp:spanTimeInputToSeconds(i),timestamp:spanTimeInputToSeconds(o)||void 0,status:getStatusMessage(c),op:r[SEMANTIC_ATTRIBUTE_SENTRY_OP],origin:r[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN],_metrics_summary:getMetricSummaryJsonForSpan(e)})}return{span_id:t,trace_id:n}}catch{return{}}}function spanIsOpenTelemetrySdkTraceBaseSpan(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function spanIsSentrySpan(e){return typeof e.getSpanJSON==`function`}function spanIsSampled(e){let{traceFlags:t}=e.spanContext();return t===1}function getStatusMessage(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`unknown_error`}const CHILD_SPANS_FIELD=`_sentryChildSpans`,ROOT_SPAN_FIELD=`_sentryRootSpan`;function addChildSpanToSpan(e,t){addNonEnumerableProperty(t,ROOT_SPAN_FIELD,e[ROOT_SPAN_FIELD]||e),e[CHILD_SPANS_FIELD]?e[CHILD_SPANS_FIELD].add(t):addNonEnumerableProperty(e,CHILD_SPANS_FIELD,new Set([t]))}function getSpanDescendants(e){let t=new Set;function n(e){if(!t.has(e)&&spanIsSampled(e)){t.add(e);let r=e[CHILD_SPANS_FIELD]?Array.from(e[CHILD_SPANS_FIELD]):[];for(let e of r)n(e)}}return n(e),Array.from(t)}function getRootSpan(e){return e[ROOT_SPAN_FIELD]||e}function getActiveSpan(){let e=getAsyncContextStrategy(getMainCarrier());return e.getActiveSpan?e.getActiveSpan():_getSpanForScope(getCurrentScope())}function showSpanDropWarning(){hasShownSpanDropWarning||=(consoleSandbox(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),!0)}function hasTracingEnabled(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=getClient(),n=e||t&&t.getOptions();return!!n&&(n.enableTracing||`tracesSampleRate`in n||`tracesSampler`in n)}const DEFAULT_ENVIRONMENT=`production`,FROZEN_DSC_FIELD=`_frozenDsc`;function freezeDscOnSpan(e,t){addNonEnumerableProperty(e,FROZEN_DSC_FIELD,t)}function getDynamicSamplingContextFromClient(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i=dropUndefinedKeys({environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e});return t.emit(`createDsc`,i),i}function getDynamicSamplingContextFromScope(e,t){let n=t.getPropagationContext();return n.dsc||getDynamicSamplingContextFromClient(n.traceId,e)}function getDynamicSamplingContextFromSpan(e){let t=getClient();if(!t)return{};let n=getRootSpan(e),r=n[FROZEN_DSC_FIELD];if(r)return r;let i=n.spanContext().traceState,a=i&&i.get(`sentry.dsc`),o=a&&baggageHeaderToDynamicSamplingContext(a);if(o)return o;let s=getDynamicSamplingContextFromClient(e.spanContext().traceId,t),c=spanToJSON(n),l=c.data||{},u=l[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];u!=null&&(s.sample_rate=`${u}`);let d=l[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE],f=c.description;return d!==`url`&&f&&(s.transaction=f),hasTracingEnabled()&&(s.sampled=String(spanIsSampled(n))),t.emit(`createDsc`,s,n),s}function memoBuilder(){let e=typeof WeakSet==`function`,t=e?new WeakSet:[];function n(n){if(e)return t.has(n)?!0:(t.add(n),!1);for(let e=0;e<t.length;e++)if(t[e]===n)return!0;return t.push(n),!1}function r(n){if(e)t.delete(n);else for(let e=0;e<t.length;e++)if(t[e]===n){t.splice(e,1);break}}return[n,r]}function normalize(e,t=100,n=1/0){try{return visit(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function normalizeToSize(e,t=3,n=100*1024){let r=normalize(e,t);return jsonSize(r)>n?normalizeToSize(e,t-1,n):r}function visit(e,t,n=1/0,r=1/0,i=memoBuilder()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=stringifyValue(e,t);if(!s.startsWith(`[object `))return s;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__==`number`?t.__sentry_override_normalization_depth__:n;if(c===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let l=t;if(l&&typeof l.toJSON==`function`)try{return visit(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=convertToPlainObject(t);for(let e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(d>=r){u[e]=`[MaxProperties ~]`;break}let t=f[e];u[e]=visit(e,t,c-1,r,i),d++}return o(t),u}function stringifyValue(e,t){try{if(e===`domain`&&t&&typeof t==`object`&&t._events)return`[Domain]`;if(e===`domainEmitter`)return`[DomainEmitter]`;if(typeof global<`u`&&t===global)return`[Global]`;if(typeof window<`u`&&t===window)return`[Window]`;if(typeof document<`u`&&t===document)return`[Document]`;if(isVueViewModel(t))return`[VueViewModel]`;if(isSyntheticEvent(t))return`[SyntheticEvent]`;if(typeof t==`number`&&!Number.isFinite(t))return`[${t}]`;if(typeof t==`function`)return`[Function: ${getFunctionName(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=getConstructorName(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function getConstructorName(e){let t=Object.getPrototypeOf(e);return t?t.constructor.name:`null prototype`}function utf8Length(e){return~-encodeURI(e).split(/%..|./).length}function jsonSize(e){return utf8Length(JSON.stringify(e))}function notifyEventProcessors(e,t,n,r=0){return new SyncPromise((i,a)=>{let o=e[r];if(t===null||typeof o!=`function`)i(t);else{let s=o({...t},n);DEBUG_BUILD$1&&o.id&&s===null&&logger.log(`Event processor "${o.id}" dropped event`),isThenable(s)?s.then(t=>notifyEventProcessors(e,t,n,r+1).then(i)).then(null,a):notifyEventProcessors(e,s,n,r+1).then(i).then(null,a)}})}let parsedStackResults,lastKeysCount,cachedFilenameDebugIds;function getFilenameToDebugIdMap(e){let t=GLOBAL_OBJ._sentryDebugIds;if(!t)return{};let n=Object.keys(t);return cachedFilenameDebugIds&&n.length===lastKeysCount?cachedFilenameDebugIds:(lastKeysCount=n.length,cachedFilenameDebugIds=n.reduce((n,r)=>{parsedStackResults||={};let i=parsedStackResults[r];if(i)n[i[0]]=i[1];else{let i=e(r);for(let e=i.length-1;e>=0;e--){let a=i[e],o=a&&a.filename,s=t[r];if(o&&s){n[o]=s,parsedStackResults[r]=[o,s];break}}}return n},{}),cachedFilenameDebugIds)}function applyScopeDataToEvent(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;applyDataToEvent(e,t),r&&applySpanToEvent(e,r),applyFingerprintToEvent(e,n),applyBreadcrumbsToEvent(e,i),applySdkMetadataToEvent(e,a)}function mergeScopeData(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:f,transactionName:p,span:m}=t;mergeAndOverwriteScopeData(e,`extra`,n),mergeAndOverwriteScopeData(e,`tags`,r),mergeAndOverwriteScopeData(e,`user`,i),mergeAndOverwriteScopeData(e,`contexts`,a),e.sdkProcessingMetadata=merge(e.sdkProcessingMetadata,s,2),o&&(e.level=o),p&&(e.transactionName=p),m&&(e.span=m),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...f}}function mergeAndOverwriteScopeData(e,t,n){e[t]=merge(e[t],n,1)}function applyDataToEvent(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t,c=dropUndefinedKeys(n);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});let l=dropUndefinedKeys(r);l&&Object.keys(l).length&&(e.tags={...l,...e.tags});let u=dropUndefinedKeys(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});let d=dropUndefinedKeys(a);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function applyBreadcrumbsToEvent(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function applySdkMetadataToEvent(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function applySpanToEvent(e,t){e.contexts={trace:spanToTraceContext(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:getDynamicSamplingContextFromSpan(t),...e.sdkProcessingMetadata};let n=spanToJSON(getRootSpan(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function applyFingerprintToEvent(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}function prepareEvent(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||uuid4(),timestamp:t.timestamp||dateTimestampInSeconds()},l=n.integrations||e.integrations.map(e=>e.name);applyClientOptions(c,e),applyIntegrationsMetadata(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&applyDebugIds(c,e.stackParser);let u=getFinalScope(r,n.captureContext);n.mechanism&&addExceptionMechanism(c,n.mechanism);let d=i?i.getEventProcessors():[],f=getGlobalScope().getScopeData();a&&mergeScopeData(f,a.getScopeData()),u&&mergeScopeData(f,u.getScopeData());let p=[...n.attachments||[],...f.attachments];return p.length&&(n.attachments=p),applyScopeDataToEvent(c,f),notifyEventProcessors([...d,...f.eventProcessors],c,n).then(e=>(e&&applyDebugMeta(e),typeof o==`number`&&o>0?normalizeEvent(e,o,s):e))}function applyClientOptions(e,t){let{environment:n,release:r,dist:i,maxValueLength:a=250}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i),e.message&&=truncate(e.message,a);let o=e.exception&&e.exception.values&&e.exception.values[0];o&&o.value&&(o.value=truncate(o.value,a));let s=e.request;s&&s.url&&(s.url=truncate(s.url,a))}function applyDebugIds(e,t){let n=getFilenameToDebugIdMap(t);try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{n&&e.filename&&(e.debug_id=n[e.filename])})})}catch{}}function applyDebugMeta(e){let t={};try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function applyIntegrationsMetadata(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function normalizeEvent(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:normalize(e.data,t,n)}}))},...e.user&&{user:normalize(e.user,t,n)},...e.contexts&&{contexts:normalize(e.contexts,t,n)},...e.extra&&{extra:normalize(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=normalize(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:normalize(e.data,t,n)}}))),e.contexts&&e.contexts.flags&&r.contexts&&(r.contexts.flags=normalize(e.contexts.flags,3,n)),r}function getFinalScope(e,t){if(!t)return e;let n=e?e.clone():new Scope;return n.update(t),n}function parseEventHintOrCaptureContext(e){if(e)return hintIsScopeOrFunction(e)||hintIsScopeContext(e)?{captureContext:e}:e}function hintIsScopeOrFunction(e){return e instanceof Scope||typeof e==`function`}const captureContextKeys=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`requestSession`,`propagationContext`];function hintIsScopeContext(e){return Object.keys(e).some(e=>captureContextKeys.includes(e))}function captureException(e,t){return getCurrentScope().captureException(e,parseEventHintOrCaptureContext(t))}function captureEvent(e,t){return getCurrentScope().captureEvent(e,t)}function setContext(e,t){getIsolationScope().setContext(e,t)}function setTag(e,t){getIsolationScope().setTag(e,t)}async function flush(e){let t=getClient();return t?t.flush(e):(DEBUG_BUILD$1&&logger.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}function isEnabled(){let e=getClient();return!!e&&e.getOptions().enabled!==!1&&!!e.getTransport()}function startSession(e){let t=getClient(),n=getIsolationScope(),r=getCurrentScope(),{release:i,environment:a=DEFAULT_ENVIRONMENT}=t&&t.getOptions()||{},{userAgent:o}=GLOBAL_OBJ.navigator||{},s=makeSession({release:i,environment:a,user:r.getUser()||n.getUser(),...o&&{userAgent:o},...e}),c=n.getSession();return c&&c.status===`ok`&&updateSession(c,{status:`exited`}),endSession(),n.setSession(s),r.setSession(s),s}function endSession(){let e=getIsolationScope(),t=getCurrentScope(),n=t.getSession()||e.getSession();n&&closeSession(n),_sendSessionUpdate(),e.setSession(),t.setSession()}function _sendSessionUpdate(){let e=getIsolationScope(),t=getCurrentScope(),n=getClient(),r=t.getSession()||e.getSession();r&&n&&n.captureSession(r)}function rng(){return poolPtr>rnds8Pool.length-16&&(crypto.default.randomFillSync(rnds8Pool),poolPtr=0),rnds8Pool.slice(poolPtr,poolPtr+=16)}var rnds8Pool,poolPtr,init_rng=require_chunk$2.n((()=>{rnds8Pool=new Uint8Array(256),poolPtr=rnds8Pool.length})),regex_default,init_regex=require_chunk$2.n((()=>{regex_default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}));function validate(e){return typeof e==`string`&&regex_default.test(e)}var init_validate=require_chunk$2.n((()=>{init_regex()}));function stringify(e,t=0){let n=(byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+`-`+byteToHex[e[t+4]]+byteToHex[e[t+5]]+`-`+byteToHex[e[t+6]]+byteToHex[e[t+7]]+`-`+byteToHex[e[t+8]]+byteToHex[e[t+9]]+`-`+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]).toLowerCase();if(!validate(n))throw TypeError(`Stringified UUID is invalid`);return n}var byteToHex,init_stringify=require_chunk$2.n((()=>{init_validate(),byteToHex=[];for(let e=0;e<256;++e)byteToHex.push((e+256).toString(16).substr(1))}));function v1(e,t,n){let r=t&&n||0,i=t||Array(16);e||={};let a=e.node||_nodeId,o=e.clockseq===void 0?_clockseq:e.clockseq;if(a==null||o==null){let t=e.random||(e.rng||rng)();a??=_nodeId=[t[0]|1,t[1],t[2],t[3],t[4],t[5]],o??=_clockseq=(t[6]<<8|t[7])&16383}let s=e.msecs===void 0?Date.now():e.msecs,c=e.nsecs===void 0?_lastNSecs+1:e.nsecs,l=s-_lastMSecs+(c-_lastNSecs)/1e4;if(l<0&&e.clockseq===void 0&&(o=o+1&16383),(l<0||s>_lastMSecs)&&e.nsecs===void 0&&(c=0),c>=1e4)throw Error(`uuid.v1(): Can't create more than 10M uuids/sec`);_lastMSecs=s,_lastNSecs=c,_clockseq=o,s+=0xb1d069b5400;let u=((s&268435455)*1e4+c)%4294967296;i[r++]=u>>>24&255,i[r++]=u>>>16&255,i[r++]=u>>>8&255,i[r++]=u&255;let d=s/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=d&255,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=o>>>8|128,i[r++]=o&255;for(let e=0;e<6;++e)i[r+e]=a[e];return t||stringify(i)}var _nodeId,_clockseq,_lastMSecs,_lastNSecs,init_v1=require_chunk$2.n((()=>{init_rng(),init_stringify(),_lastMSecs=0,_lastNSecs=0}));function parse(e){if(!validate(e))throw TypeError(`Invalid UUID`);let t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=t&255,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=t&255,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=t&255,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=t&255,n}var init_parse=require_chunk$2.n((()=>{init_validate()}));function stringToBytes(e){e=unescape(encodeURIComponent(e));let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}function v35_default(e,t,n){function r(e,r,i,a){if(typeof e==`string`&&(e=stringToBytes(e)),typeof r==`string`&&(r=parse(r)),r.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let o=new Uint8Array(16+e.length);if(o.set(r),o.set(e,r.length),o=n(o),o[6]=o[6]&15|t,o[8]=o[8]&63|128,i){a||=0;for(let e=0;e<16;++e)i[a+e]=o[e];return i}return stringify(o)}try{r.name=e}catch{}return r.DNS=DNS,r.URL=URL$3,r}var DNS,URL$3,init_v35=require_chunk$2.n((()=>{init_stringify(),init_parse(),DNS=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`,URL$3=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`}));function md5(e){return Array.isArray(e)?e=Buffer.from(e):typeof e==`string`&&(e=Buffer.from(e,`utf8`)),crypto.default.createHash(`md5`).update(e).digest()}var init_md5=require_chunk$2.n((()=>{})),v3,init_v3=require_chunk$2.n((()=>{init_v35(),init_md5(),v3=v35_default(`v3`,48,md5)}));function v4(e,t,n){e||={};let r=e.random||(e.rng||rng)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n||=0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return stringify(r)}var init_v4=require_chunk$2.n((()=>{init_rng(),init_stringify()}));function sha1(e){return Array.isArray(e)?e=Buffer.from(e):typeof e==`string`&&(e=Buffer.from(e,`utf8`)),crypto.default.createHash(`sha1`).update(e).digest()}var init_sha1=require_chunk$2.n((()=>{})),v5,init_v5=require_chunk$2.n((()=>{init_v35(),init_sha1(),v5=v35_default(`v5`,80,sha1)})),nil_default,init_nil=require_chunk$2.n((()=>{nil_default=`00000000-0000-0000-0000-000000000000`}));function version(e){if(!validate(e))throw TypeError(`Invalid UUID`);return parseInt(e.substr(14,1),16)}var init_version=require_chunk$2.n((()=>{init_validate()})),esm_node_exports=require_chunk$2.r({NIL:()=>nil_default,parse:()=>parse,stringify:()=>stringify,v1:()=>v1,v3:()=>v3,v4:()=>v4,v5:()=>v5,validate:()=>validate,version:()=>version}),init_esm_node=require_chunk$2.n((()=>{init_v1(),init_v3(),init_v4(),init_v5(),init_nil(),init_version(),init_validate(),init_stringify(),init_parse()})),import_dist$2=require_meow.l(),import_source=require_chunk$2.a(require_meow.u()),link_default=e=>import_source.default.cyan(e),require_yocto_queue=require_chunk$2.t(((e,t)=>{var n=class{constructor(e){this.value=e,this.next=void 0}};t.exports=class{constructor(){this.clear()}enqueue(e){let t=new n(e);this._head?(this._tail.next=t,this._tail=t):(this._head=t,this._tail=t),this._size++}dequeue(){let e=this._head;if(e)return this._head=this._head.next,this._size--,e.value}clear(){this._head=void 0,this._tail=void 0,this._size=0}get size(){return this._size}*[Symbol.iterator](){let e=this._head;for(;e;)yield e.value,e=e.next}}})),require_p_limit$1=require_chunk$2.t(((e,t)=>{let n=require_yocto_queue();t.exports=e=>{if(!((Number.isInteger(e)||e===1/0)&&e>0))throw TypeError("Expected `concurrency` to be a number from 1 and up");let t=new n,r=0,i=()=>{r--,t.size>0&&t.dequeue()()},a=async(e,t,...n)=>{r++;let a=(async()=>e(...n))();t(a);try{await a}catch{}i()},o=(n,i,...o)=>{t.enqueue(a.bind(null,n,i,...o)),(async()=>{await Promise.resolve(),r<e&&t.size>0&&t.dequeue()()})()},s=(e,...t)=>new Promise(n=>{o(e,n,...t)});return Object.defineProperties(s,{activeCount:{get:()=>r},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}}),s}})),require_tmp=require_chunk$2.t(((e,t)=>{ /*! * Tmp * * Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu> * * MIT Licensed */ let n=require(`fs`),r=require(`os`),i=require(`path`),a=require(`crypto`),o={fs:n.constants,os:r.constants},s=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,c=/XXXXXX/,l=3,u=(o.O_CREAT||o.fs.O_CREAT)|(o.O_EXCL||o.fs.O_EXCL)|(o.O_RDWR||o.fs.O_RDWR),d=r.platform()===`win32`,f=o.EBADF||o.os.errno.EBADF,p=o.ENOENT||o.os.errno.ENOENT,m=448,h=384,g=`exit`,_=[],v=n.rmdirSync.bind(n),y=!1;function b(e,t){return n.rm(e,{recursive:!0},t)}function x(e){return n.rmSync(e,{recursive:!0})}function S(e,t){let r=I(e,t),i=r[0],a=r[1];U(i,function(e,t){if(e)return a(e);let r=t.tries;(function e(){try{let i=z(t);n.stat(i,function(t){if(!t)return r-- >0?e():a(Error(`Could not get a unique tmp filename, max tries reached `+i));a(null,i)})}catch(e){a(e)}})()})}function C(e){let t=I(e)[0],r=W(t),i=r.tries;do{let e=z(r);try{n.statSync(e)}catch{return e}}while(i-- >0);throw Error(`Could not get a unique tmp filename, max tries reached`)}function w(e,t){let r=I(e,t),i=r[0],a=r[1];S(i,function(e,t){if(e)return a(e);n.open(t,u,i.mode||384,function(e,r){if(e)return a(e);if(i.discardDescriptor)return n.close(r,function(e){return a(e,t,void 0,A(t,-1,i,!1))});a(null,t,r,A(t,i.discardDescriptor||i.detachDescriptor?-1:r,i,!1))})})}function T(e){let t=I(e)[0],r=t.discardDescriptor||t.detachDescriptor,i=C(t),a=n.openSync(i,u,t.mode||384);return t.discardDescriptor&&(n.closeSync(a),a=void 0),{name:i,fd:a,removeCallback:A(i,r?-1:a,t,!0)}}function E(e,t){let r=I(e,t),i=r[0],a=r[1];S(i,function(e,t){if(e)return a(e);n.mkdir(t,i.mode||448,function(e){if(e)return a(e);a(null,t,j(t,i,!1))})})}function D(e){let t=I(e)[0],r=C(t);return n.mkdirSync(r,t.mode||448),{name:r,removeCallback:j(r,t,!0)}}function O(e,t){let r=function(e){if(e&&!K(e))return t(e);t()};0<=e[0]?n.close(e[0],function(){n.unlink(e[1],r)}):n.unlink(e[1],r)}function k(e){let t=null;try{0<=e[0]&&n.closeSync(e[0])}catch(e){if(!G(e)&&!K(e))throw e}finally{try{n.unlinkSync(e[1])}catch(e){K(e)||(t=e)}}if(t!==null)throw t}function A(e,t,n,r){let i=M(k,[t,e],r),a=M(O,[t,e],r,i);return n.keep||_.unshift(i),r?i:a}function j(e,t,r){let i=t.unsafeCleanup?b:n.rmdir.bind(n),a=M(t.unsafeCleanup?x:v,e,r),o=M(i,e,r,a);return t.keep||_.unshift(a),r?a:o}function M(e,t,n,r){let i=!1;return function a(o){if(!i){let s=r||a,c=_.indexOf(s);return c>=0&&_.splice(c,1),i=!0,n||e===v||e===x?e(t):e(t,o||function(){})}}}function N(){if(y)for(;_.length;)try{_[0]()}catch{}}function P(e){let t=[],n=null;try{n=a.randomBytes(e)}catch{n=a.pseudoRandomBytes(e)}for(let r=0;r<e;r++)t.push(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[n[r]%62]);return t.join(``)}function F(e){return e===void 0}function I(e,t){if(typeof e==`function`)return[{},e];if(F(e))return[{},t];let n={};for(let t of Object.getOwnPropertyNames(e))n[t]=e[t];return[n,t]}function L(e,t,r){let a=i.isAbsolute(e)?e:i.join(t,e);n.stat(a,function(e){e?n.realpath(i.dirname(a),function(e,t){if(e)return r(e);r(null,i.join(t,i.basename(a)))}):n.realpath(a,r)})}function R(e,t){let r=i.isAbsolute(e)?e:i.join(t,e);try{return n.statSync(r),n.realpathSync(r)}catch{let e=n.realpathSync(i.dirname(r));return