@lockerverse/sdk 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ const e=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,t=globalThis,n=`10.69.0`;function r(){return i(t),t}function i(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.69.0`,t[n]=t[`10.69.0`]||{}}function a(e,r,i=t){let a=i.__SENTRY__=i.__SENTRY__||{},o=a[n]=a[`10.69.0`]||{};return o[e]||(o[e]=r())}const o={};function s(e){if(!(`console`in t))return e();let n=t.console,r={},i=Object.keys(o);i.forEach(e=>{let t=o[e];r[e]=n[e],n[e]=t});try{return e()}finally{i.forEach(e=>{n[e]=r[e]})}}function c(){h().enabled=!0}function l(){h().enabled=!1}function u(){return h().enabled}function d(...e){m(`log`,...e)}function f(...e){m(`warn`,...e)}function p(...e){m(`error`,...e)}function m(n,...r){e&&u()&&s(()=>{t.console[n](`Sentry Logger [${n}]:`,...r)})}function h(){return e?a(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}const g={enable:c,disable:l,isEnabled:u,log:d,warn:f,error:p},ee=/\(error: (.*)\)/,te=/captureMessage|captureException/;function ne(...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(`
2
+ `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=ee.test(n)?n.replace(ee,`$1`):n;if(!o.includes(`Error: `)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=50+r)break}}return re(i.slice(r))}}function re(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(_(t).function||``)&&t.pop(),t.reverse(),te.test(_(t).function||``)&&(t.pop(),te.test(_(t).function||``)&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||_(t).filename,function:e.function||`?`}))}function _(e){return e[e.length-1]||{}}const ie=`<anonymous>`;function ae(e){try{return!e||typeof e!=`function`?ie:e.name||ie}catch{return ie}}const oe=Object.prototype.toString;function v(e){switch(oe.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return me(e,Error)}}function y(e,t){return oe.call(e)===`[object ${t}]`}function se(e){return y(e,`ErrorEvent`)}function ce(e){return y(e,`DOMError`)}function le(e){return y(e,`DOMException`)}function b(e){return y(e,`String`)}function ue(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function de(e){return e===null||ue(e)||typeof e!=`object`&&typeof e!=`function`}function x(e){return y(e,`Object`)}function fe(e){return typeof e==`object`&&!!e}function S(e){return typeof Event<`u`&&me(e,Event)}function pe(e){return y(e,`RegExp`)}function C(e){return!!(e?.then&&typeof e.then==`function`)}function me(e,t){try{return e instanceof t}catch{return!1}}function he(t,n,r){try{Object.defineProperty(t,n,{value:r,writable:!0,configurable:!0})}catch{e&&g.log(`Failed to add non-enumerable property "${String(n)}" to object`,t)}}function ge(e){if(v(e))return{message:e.message,name:e.name,stack:e.stack,..._e(e)};if(S(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},..._e(e)}}return e}function _e(e){return fe(e)?Object.fromEntries(Object.entries(e)):{}}function ve(e){let t=Object.keys(ge(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}let w;function T(e){if(w!==void 0)return w?w(e):e();let n=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),r=t;return n in r&&typeof r[n]==`function`?(w=r[n],w(e)):(w=null,e())}function E(){return T(()=>Math.random())}function D(){return T(()=>Date.now())}const ye=Symbol.for(`sentry.skipNormalization`),be=Symbol.for(`sentry.overrideNormalizationDepth`);function xe(e){return!!e[ye]}function Se(e){let t=e[be];return typeof t==`number`?t:void 0}function O(e,t=100,n=1/0){try{return k(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ce(e,t=3,n=102400){let r=O(e,t);return De(r)>n?Ce(e,t-1,n):r}function k(e,t,n=1/0,r=1/0,i=Oe()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=we(e,t);if(!s.startsWith(`[object `))return s;if(xe(t))return t;let c=Se(t),l=c===void 0?n:c;if(l===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let u=t;if(u&&typeof u.toJSON==`function`)try{return k(``,u.toJSON(),l-1,r,i)}catch{}let d=Array.isArray(t)?[]:{},f=0,p=ge(t);for(let e in p){if(!Object.prototype.hasOwnProperty.call(p,e))continue;if(f>=r){d[e]=`[MaxProperties ~]`;break}let t=p[e];d[e]=k(e,t,l-1,r,i),f++}return o(t),d}function we(e,t){try{return typeof global<`u`&&t===global?`[Global]`:typeof t==`number`&&!Number.isFinite(t)?`[${t}]`:typeof t==`function`?`[Function: ${ae(t)}]`:typeof t==`symbol`?`[${String(t)}]`:typeof t==`bigint`?`[BigInt: ${String(t)}]`:`[object ${Te(t)}]`}catch(e){return`**non-serializable** (${e})`}}function Te(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Ee(e){return~-encodeURI(e).split(/%..|./).length}function De(e){return Ee(JSON.stringify(e))}function Oe(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function A(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function j(e,t,n=!1){return b(e)?pe(t)?t.test(e):b(t)?n?e===t:e.includes(t):typeof t==`function`&&t(e):!1}function ke(){let e=t;return e.crypto||e.msCrypto}let Ae;function je(){return E()*16}function M(e=ke()){try{if(e?.randomUUID)return T(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Ae||=`10000000100040008000100000000000`,Ae.replace(/[018]/g,e=>(e^(je()&15)>>e/4).toString(16))}function Me(e){return e.exception?.values?.[0]}function Ne(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 N(e,t){let n=Me(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?.data,...t.data};n.mechanism.data=e}}function Pe(e){if(Fe(e))return!0;try{he(e,`__sentry_captured__`,!0)}catch{}return!1}function Fe(e){try{return e.__sentry_captured__}catch{}}const Ie=1e3;function P(){return D()/Ie}function Le(){let{performance:e}=t;if(!e?.now||!e.timeOrigin)return P;let n=e.timeOrigin;return()=>(n+T(()=>e.now()))/Ie}let Re;function ze(){return(Re??=Le())()}function F(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||ze(),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:M()),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 I(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=I(r[e],t[e],n-1));return r}function Be(){return M()}function Ve(){return M().substring(16)}function He(e){try{let n=t.WeakRef;if(typeof n==`function`)return new n(e)}catch{}return e}function Ue(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}const We=`_sentrySpan`;function Ge(e,t){t?he(e,We,He(t)):delete e[We]}function Ke(e){return Ue(e[We])}var L=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Be(),sampleRand:E()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Ge(e,Ke(this)),e}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&&F(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],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 n=typeof e==`function`?e(this):e,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof t?n.getScopeData():x(n)?e:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...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),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Ge(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Be(),sampleRand:E()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:100;if(n<=0)return this;let r={timestamp:P(),...e,message:e.message?A(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),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,attributes:this._attributes,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:Ke(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=I(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(t,n){let r=n?.event_id||M();if(!this._client)return e&&g.warn(`No client configured on scope - will not capture exception!`),r;let i=Error(`Sentry syntheticException`);return this._client.captureException(t,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureMessage(t,n,r){let i=r?.event_id||M();if(!this._client)return e&&g.warn(`No client configured on scope - will not capture message!`),i;let a=r?.syntheticException??Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:a,...r,event_id:i},this),i}captureEvent(t,n){let r=t.event_id||n?.event_id||M();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(e&&g.warn(`No client configured on scope - will not capture event!`),r)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function qe(){return a(`defaultCurrentScope`,()=>new L)}function Je(){return a(`defaultIsolationScope`,()=>new L)}const Ye=e=>e instanceof Promise&&!e[Xe],Xe=Symbol(`chained PromiseLike`),Ze=(e,t,n)=>{let r=e.then(e=>(t(e),e),e=>{throw n(e),e});return Ye(r)&&Ye(e)?r:Qe(e,r)},Qe=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i==`function`?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[Xe]:!0}),t};var $e=class{constructor(e,t){let n;n=e||new L;let r;r=t||new L,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 C(n)?Ze(n,()=>this._popScope(),()=>this._popScope()):(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 R(){let e=i(r());return e.stack=e.stack||new $e(qe(),Je())}function et(e){return R().withScope(e)}function tt(e,t){let n=R();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function nt(e){return R().withScope(()=>e(R().getIsolationScope()))}function rt(){return{withIsolationScope:nt,withScope:et,withSetScope:tt,withSetIsolationScope:(e,t)=>nt(t),getCurrentScope:()=>R().getScope(),getIsolationScope:()=>R().getIsolationScope()}}function it(e){let t=i(e);return t.acs?t.acs:rt()}function at(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).includes(`value`)}function ot(e,t){let{value:n,unit:r}=at(e)?e:{value:e,unit:void 0},i=ct(n),a=r&&typeof r==`string`?{unit:r}:{};if(i)return{...i,...a};if(!t||t===`skip-undefined`&&n===void 0)return;let o=``;try{o=JSON.stringify(n)??``}catch{}return{value:o,type:`string`,...a}}function st(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let e=ot(i,t);e&&(n[r]=e)}return n}function ct(e){if(Array.isArray(e))return{value:e,type:`array`};let t=typeof e==`string`?`string`:typeof e==`boolean`?`boolean`:typeof e==`number`&&!Number.isNaN(e)?Number.isInteger(e)?`integer`:`double`:null;if(t)return{value:e,type:t}}function lt(){return it(r()).getCurrentScope()}function ut(){return it(r()).getIsolationScope()}function dt(){return a(`globalScope`,()=>new L)}function ft(){return lt().getClient()}function pt(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Ve()};return n&&(i.parent_span_id=n),i}function mt(e){let t=e;return{scope:t._sentryScope,isolationScope:Ue(t._sentryIsolationScope)}}function ht(e){let t=gt(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.startsWith(`sentry-`)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function gt(e){if(!(!e||!b(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=_t(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):_t(e)}function _t(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const vt=/^o(\d+)\./,yt=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function bt(e){return e===`http`||e===`https`}function z(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function xt(e){let t=yt.exec(e);if(!t){s(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,c=``]=t.slice(1),l=``,u=c,d=u.split(`/`);if(d.length>1&&(l=d.slice(0,-1).join(`/`),u=d.pop()),u){let e=u.match(/^\d+/);e&&(u=e[0])}return St({host:a,pass:i,path:l,projectId:u,port:o,protocol:n,publicKey:r})}function St(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Ct(t){if(!e)return!0;let{port:n,projectId:r,protocol:i}=t;return[`protocol`,`publicKey`,`host`,`projectId`].find(e=>!t[e]&&(g.error(`Invalid Sentry Dsn: ${e} missing`),!0))?!1:r.match(/^\d+$/)?bt(i)?n&&isNaN(parseInt(n,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${n}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function wt(e){return e.match(vt)?.[1]}function Tt(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=wt(n)),r}function Et(e){let t=typeof e==`string`?xt(e):St(e);if(!(!t||!Ct(t)))return t}function Dt(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}let Ot=!1;function kt(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Nt(e).parent_span_id,a=mt(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Ve():t,trace_id:n}}function At(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function jt(e){return typeof e==`number`?Mt(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Mt(e.getTime()):ze()}function Mt(e){return e>9999999999?e/1e3:e}function Nt(e){if(Lt(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(It(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:Pt(e),start_timestamp:jt(i),timestamp:jt(o)||void 0,status:zt(s),op:r[`sentry.op`],origin:r[`sentry.origin`],links:At(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Pt(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function Ft(e){return{...e,attributes:st(e.attributes),links:e.links?.map(e=>({...e,attributes:st(e.attributes)}))}}function It(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Lt(e){return typeof e.getSpanJSON==`function`}function Rt(e){let{traceFlags:t}=e.spanContext();return t===1}function zt(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}const Bt=Vt;function Vt(e){return e._sentryRootSpan||e}function Ht(){Ot||=(s(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}function Ut(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||ft()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Wt(e){g.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Gt(t,n){if(!n?.length)return!1;for(let r of n){if(Jt(r)){if(t.description&&j(t.description,r))return e&&Wt(t),!0;continue}let n=!!r.attributes&&Object.keys(r.attributes).length>0;if(!r.name&&!r.op&&!n)continue;let i=!r.name||t.description&&j(t.description,r.name),a=!r.op||t.op&&j(t.op,r.op),o=!r.attributes||Object.entries(r.attributes).every(([e,n])=>Kt(t.attributes?.[e],n));if(i&&a&&o)return e&&Wt(t),!0}return!1}function Kt(e,t){return typeof e==`string`&&(typeof t==`string`||t instanceof RegExp)?j(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function qt(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function Jt(e){return typeof e==`string`||e instanceof RegExp}const Yt=Symbol.for(`sentry.nonRecordingSpan`);function Xt(e){return!!e&&e[Yt]===!0}function Zt(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e,org_id:Tt(t)};return t.emit(`createDsc`,i),i}function Qt(e,t){let n=t.getPropagationContext();return n.dsc||Zt(n.traceId,e)}function $t(e){let t=ft();if(!t)return{};let n=Bt(e),r=Nt(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n._frozenDsc;if(c)return s(c);let l=Xt(n),u=l&&n.dropReason===`ignored`;if(l&&(!Ut(t.getOptions())||u)){let e=mt(n).scope;if(e){let n={...Qt(t,e)};return u&&(n.sampled=`false`),s(n)}}let d=a?.get(`sentry.dsc`),f=d&&ht(d);if(f)return s(f);let p=Zt(e.spanContext().traceId,t),m=i[`sentry.source`]??i[`sentry.segment.name.source`],h=r.description;return m!==`url`&&h&&(p.transaction=h),Ut()&&(p.sampled=String(Rt(n)),p.sample_rand=a?.get(`sentry.sample_rand`)??mt(n).scope?.getPropagationContext().sampleRand.toString()),s(p),t.emit(`createDsc`,p,n),p}function en(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}function B(e,t=[]){return[e,t]}function tn(e,t){let[n,r]=e;return[n,[...r,t]]}function nn(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function rn(e,t){return nn(e,(e,n)=>t.includes(n))}function an(e){let n=i(t);return n.encodePolyfill?n.encodePolyfill(e):new TextEncoder().encode(e)}function on(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[an(r),e]:r.push(typeof e==`string`?an(e):e)}for(let e of n){let[t,n]=e;if(i(`
3
+ ${JSON.stringify(t)}
4
+ `),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(O(n))}i(e)}}return typeof r==`string`?r:sn(r)}function sn(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function cn(e){let t=typeof e.data==`string`?an(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const ln={sessions:`session`,event:`error`,client_report:`internal`,user_report:`default`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,raw_security:`security`,log:`log_item`,trace_metric:`metric`};function un(e){return e in ln}function dn(e){return un(e)?ln[e]:e}function fn(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function pn(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(D()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:z(r)},...i&&{trace:i}}}function mn(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function hn(e,t,n,r){let i=fn(n);return B({sent_at:new Date(D()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:z(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function gn(e,t,n,r){let i=fn(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;mn(e,n?.sdk);let o=pn(e,i,r,t);return delete e.sdkProcessingMetadata,B(o,[[{type:a},e]])}function _n(e){return e.getOptions().traceLifecycle===`stream`}function vn(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;xn(e,t),r&&wn(e,r),Tn(e,n),Sn(e,i),Cn(e,a)}function yn(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;V(e,`extra`,n),V(e,`tags`,r),V(e,`attributes`,i),V(e,`user`,a),V(e,`contexts`,o),e.sdkProcessingMetadata=I(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function V(e,t,n){e[t]=I(e[t],n,1)}function bn(e,t){let n=dt().getScopeData();return e&&yn(n,e.getScopeData()),t&&yn(n,t.getScopeData()),n}function xn(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function Sn(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Cn(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function wn(e,t){e.contexts={trace:kt(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:$t(t),...e.sdkProcessingMetadata};let n=Nt(Bt(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Tn(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function H(e){return new En(t=>{t(e)})}function U(e){return new En((t,n)=>{n(e)})}var En=class e{constructor(e){this._state=0,this._handlers=[],this._runExecutor(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)})})}_executeHandlers(){if(this._state===0)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===1&&e[1](this._value),this._state===2&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===0){if(C(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}};function Dn(e,t,n,r=0){try{let i=W(t,n,e,r);return C(i)?i:H(i)}catch(e){return U(e)}}function W(t,n,r,i){let a=r[i];if(!t||!a)return t;let o=a({...t},n);return e&&o===null&&g.log(`Event processor "${a.id||`?`}" dropped event`),C(o)?o.then(e=>W(e,n,r,i+1)):W(o,n,r,i+1)}let G,On,kn,K;function An(e){let n=t._sentryDebugIds,r=t._debugIds;if(!n&&!r)return{};let i=n?Object.keys(n):[],a=r?Object.keys(r):[];if(K&&i.length===On&&a.length===kn)return K;On=i.length,kn=a.length,K={},G||={};let o=(t,n)=>{for(let r of t){let t=n[r],i=G?.[r];if(i&&K&&t)K[i[0]]=t,G&&(G[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&K&&G){K[i]=t,G[r]=[i,t];break}}}}};return n&&o(i,n),r&&o(a,r),K}function jn(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||M(),timestamp:t.timestamp||P()},l=n.integrations||e.integrations.map(e=>e.name);Mn(c,e),Fn(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Nn(c,e.stackParser);let u=Ln(r,n.captureContext);n.mechanism&&N(c,n.mechanism);let d=i?i.getEventProcessors():[],f=bn(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),vn(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?H(c):Dn(m,c,n)).then(e=>(e&&Pn(e),typeof o==`number`&&o>0?In(e,o,s):e))}function Mn(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=A(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=A(e.value,a)})}function Nn(e,t){let n=An(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Pn(e){let t={};if(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)})}),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 Fn(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function In(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:O(e.data,t,n)}}))},...e.user&&{user:O(e.user,t,n)},...e.contexts&&{contexts:O(e.contexts,t,n)},...e.extra&&{extra:O(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=O(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:O(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=O(e.contexts.flags,3,n)),r}function Ln(e,t){if(!t)return e;let n=e?e.clone():new L;return n.update(t),n}function Rn(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}function zn(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Bn(e){return`${zn(e)}${e.projectId}/envelope/`}function Vn(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function Hn(e,t,n){return t||`${Bn(e)}?${Vn(e,n)}`}const Un=[];function Wn(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&Kn(e,t,n)}),n}function Gn(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Kn(t,n,r){if(r[n.name]){e&&g.log(`Integration skipped because it was already installed: ${n.name}`);return}if(r[n.name]=n,!Un.includes(n.name)&&typeof n.setupOnce==`function`&&(n.setupOnce(),Un.push(n.name)),n.setup&&typeof n.setup==`function`&&n.setup(t),typeof n.preprocessEvent==`function`){let e=n.preprocessEvent.bind(n);t.on(`preprocessEvent`,(n,r)=>e(n,r,t))}if(typeof n.processEvent==`function`){let e=n.processEvent.bind(n),r=Object.assign((n,r)=>e(n,r,t),{id:n.name});t.addEventProcessor(r)}[`processSpan`,`processSegmentSpan`].forEach(e=>{let r=n[e];typeof r==`function`&&t.on(e,e=>r.call(n,e,t))}),e&&g.log(`Integration installed: ${n.name}`)}function qn(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function Jn(){
5
+ /*! __SENTRY_SDK_SOURCE__ */
6
+ return`npm`}function Yn(){return!qn()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function Xn(){return typeof window<`u`&&(!Yn()||Zn())}function Zn(){return t.process?.type===`renderer`}function Qn(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...Xn()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function $n(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=z(r)),B(a,[Qn(e,i)])}function er(e,t){let n=t??tr(e)??[];if(n.length===0)return;let r=e.getOptions(),i=$n(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);nr().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function tr(e){return nr().get(e)}function nr(){return a(`clientToLogBufferMap`,()=>new WeakMap)}function rr(e,t){let n=t?`auto`:`never`;return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{version:2,...Xn()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function ir(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=z(r)),B(a,[rr(e,i)])}function ar(e,t){let n=t??or(e)??[];if(n.length===0)return;let r=e.getOptions(),i=ir(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);sr().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function or(e){return sr().get(e)}function sr(){return a(`clientToMetricBufferMap`,()=>new WeakMap)}function cr(e){return Ft({trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||``,start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status===`ok`||e.status===`cancelled`?`ok`:`error`,is_segment:!1,attributes:{...e.data},links:e.links})}function lr(e,t){if(e.type!==`transaction`||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||_n(t))return;let n=[],r=[];for(let t of e.spans)t.op?.startsWith(`gen_ai.`)?n.push(cr(t)):r.push(t);if(n.length===0)return;e.spans=r;let i=t.getDataCollectionOptions().userInfo?`auto`:`never`;return[{type:`span`,item_count:n.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...Xn()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}const ur=Symbol.for(`SentryBufferFullError`);function dr(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return U(ur);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return H(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>Rn(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}function fr(e,t=D()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}function pr(e,t){return e[t]||e.all||0}function mr(e,t,n=D()){return pr(e,t)>n}function hr(e,{statusCode:t,headers:n},r=D()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+fr(o,r):t===429&&(i.all=r+6e4);return i}function gr(t,n,r=dr(t.bufferSize||64)){let i={},a=e=>r.drain(e);function o(a){let o=[];if(nn(a,(e,n)=>{let r=dn(n);mr(i,r)?t.recordDroppedEvent(`ratelimit_backoff`,r):o.push(e)}),o.length===0)return Promise.resolve({});let s=B(a[0],o),c=n=>{if(rn(s,[`client_report`])){e&&g.warn(`Dropping client report. Will not send outcomes (reason: ${n}).`);return}nn(s,(e,r)=>{t.recordDroppedEvent(n,dn(r))})};return r.add(()=>n({body:on(s)}).then(t=>t.statusCode===413?(e&&g.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),c(`send_error`),t):(e&&t.statusCode!==void 0&&(t.statusCode<200||t.statusCode>=300)&&g.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),i=hr(i,t),t),t=>{throw c(`network_error`),e&&g.error(`Encountered error running transport request:`,t),t})).then(e=>e,t=>{if(t===ur)return e&&g.error(`Skipped sending event because buffer is full.`),c(`queue_overflow`),Promise.resolve({});throw t})}return{send:o,flush:a}}function _r(e,t,n){let r=[{type:`client_report`},{timestamp:n||P(),discarded_events:e}];return B(t?{dsn:t}:{},[r])}function vr(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function yr(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[`sentry.profile_id`],exclusive_time:o?.[`sentry.exclusive_time`],measurements:e.measurements,is_segment:!0}}function br(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}const q=[`forwarded`,`-ip`,`remote-`,`via`,`-user`];function xr(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:q},httpHeaders:{request:{deny:q},response:{deny:q}},httpBodies:[],urlQueryParams:{deny:q},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}const Sr={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:5};function Cr(e){let t=e.dataCollection==null?xr(e.sendDefaultPii):Sr,n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:n.httpHeaders?.request??t.httpHeaders.request,response:n.httpHeaders?.response??t.httpHeaders.response},httpBodies:n.httpBodies??t.httpBodies,urlQueryParams:n.urlQueryParams??n.queryParams??t.urlQueryParams,graphQL:{document:n.graphQL?.document??t.graphQL.document,variables:n.graphQL?.variables??t.graphQL.variables},genAI:{inputs:n.genAI?.inputs??t.genAI.inputs,outputs:n.genAI?.outputs??t.genAI.outputs},databaseQueryData:n.databaseQueryData??t.databaseQueryData,stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}const wr=`Not capturing exception because it's already been captured.`,Tr=`Discarded session because of missing or non-string release`,Er=Symbol.for(`SentryInternalError`),Dr=Symbol.for(`SentryDoNotSendEventError`);function J(e){return{message:e,[Er]:!0}}function Or(e){return{message:e,[Dr]:!0}}function kr(e){return fe(e)&&Er in e}function Ar(e){return fe(e)&&Dr in e}function jr(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{if(a+=r(t),a>=8e5)i(e);else if(!s){let t=e.getOptions()._flushInterval??5e3;t>0&&(s=!0,o=Rn(setTimeout(()=>{i(e)},t)))}}),e.on(`flush`,()=>{i(e)})}var Mr=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=dr(t.transportOptions?.bufferSize??64),this._dataCollection=Cr(t),t.dsn?this._dsn=Et(t.dsn):e&&g.warn(`No DSN provided, client will not send events.`),this._dsn){let e=Hn(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:e})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&jr(this,`afterCaptureLog`,`flushLogs`,zr,er),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&jr(this,`afterCaptureMetric`,`flushMetrics`,Rr,ar)}captureException(t,n,r){let i=M();if(Pe(t))return e&&g.log(wr),i;let a={event_id:i,...n};return this._process(()=>this.eventFromException(t,a).then(e=>this._captureEvent(e,a,r)).then(e=>e),`error`),a.event_id}captureMessage(e,t,n,r){let i={event_id:M(),...n},a=ue(e)?e:String(e),o=de(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(t,n,r){let i=M();if(n?.originalException&&Pe(n.originalException))return e&&g.log(wr),i;let a={event_id:i,...n},o=t.sdkProcessingMetadata||{},s=o.capturedSpanScope,c=o.capturedSpanIsolationScope,l=Nr(t.type);return this._process(()=>this._captureEvent(t,a,s||r,c),l),a.event_id}captureSession(e){this.sendSession(e),F(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(this.emit(`flush`),!t)return!0;let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),Kn(this,e,this._integrations),t||Gn(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=lr(e,this),r=gn(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])r=tn(r,cn(e));n&&(r=tn(r,n)),this.sendEnvelope(r).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(t){let{release:n,environment:r=`production`}=this._options;if(`aggregates`in t){let i=t.attrs||{};if(!i.release&&!n){e&&g.warn(Tr);return}i.release=i.release||n,i.environment=i.environment||r,t.attrs=i}else{if(!t.release&&!n){e&&g.warn(Tr);return}t.release=t.release||n,t.environment=t.environment||r}this.emit(`beforeSendSession`,t);let i=hn(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){let i=`${t}:${n}`;e&&g.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:``}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(t){if(this.emit(`beforeEnvelope`,t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(t){return e&&g.error(`Error while sending envelope:`,t),{}}return e&&g.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Wn(this,e),Gn(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(F(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=this.getIntegrationNames();return!t.integrations&&a.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),jn(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...pt(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Qt(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(t,n={},r=lt(),i=ut()){return e&&Ir(t)&&g.log(`Captured error event \`${vr(t)[0]||`<unknown>`}\``),this._processEvent(t,n,r,i).then(e=>e.event_id,t=>{e&&(Ar(t)?g.log(t.message):kr(t)?g.warn(t.message):g.warn(t))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Lr(e),s=Ir(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Dt(a);if(s&&typeof l==`number`&&E()>l)return this.recordDroppedEvent(`sample_rate`,`error`),U(Or(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=Nr(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Or("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:Pr(Fr(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Or(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw Ar(e)||kr(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),J(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
7
+ Reason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===ur&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){e&&g.log(`Flushing outcomes...`);let t=this._clearOutcomes();if(t.length===0){e&&g.log(`No outcomes to send`);return}if(!this._dsn){e&&g.log(`No dsn provided, will not send outcomes`);return}e&&g.log(`Sending outcomes:`,t);let n=_r(t,this._options.tunnel&&z(this._dsn));this.sendEnvelope(n)}};function Nr(e){return e===`replay_event`?`replay`:e||`error`}function Pr(e,t){let n=`${t} must return \`null\` or a valid event.`;if(C(e))return e.then(e=>{if(!x(e)&&e!==null)throw J(n);return e},e=>{throw J(`${t} rejected with ${e}`)});if(!x(e)&&e!==null)throw J(n);return e}function Fr(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!en(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(Ir(c)&&i)return i(c,r);if(Lr(c)){if(s||o){let t=yr(c);if(o?.length&&Gt({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){let e=s(t);e?c=I(n,br(e)):Ht()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&Gt({description:e.description,op:e.op,attributes:e.data},o)){qt(n,e);continue}if(s){let n=s(e);n?t.push(n):(Ht(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function Ir(e){return e.type===void 0}function Lr(e){return e.type===`transaction`}function Rr(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Br(e.attributes)}function zr(e){let t=0;return e.message&&(t+=e.message.length*2),t+Br(e.attributes)}function Br(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Vr(e[0]):de(e)?t+=Vr(e):t+=100}),t}function Vr(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Hr(e){`aggregates`in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:`{{auto}}`}):e.ipAddress===void 0&&(e.ipAddress=`{{auto}}`)}function Ur(e,t,r=[t],i=`npm`){let a=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};a.name||(a.name=`sentry.javascript.${t}`,a.packages=r.map(e=>({name:`${i}:@sentry/${e}`,version:n})),a.version=n)}function Wr(e){return v(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Gr(e){return Wr(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Kr(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}const Y=t;function qr(e,t){let n=Z(e,t),r={type:$r(t),value:ei(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===``&&(r.value=`Unrecoverable error caught`),r}function Jr(e,t,n,r){let i=ft()?.getOptions().normalizeDepth,a=si(t),o={__serialized__:Ce(t,i)};if(a)return{exception:{values:[qr(e,a)]},extra:o};let s={exception:{values:[{type:S(t)?t.constructor.name:r?`UnhandledRejection`:`Error`,value:ai(t,{isUnhandledRejection:r})}]},extra:o};if(n){let t=Z(e,n);t.length&&(s.exception.values[0].stacktrace={frames:t})}return s}function X(e,t){return{exception:{values:[qr(e,t)]}}}function Z(e,t){let n=t.stacktrace||t.stack||``,r=Xr(t),i=Zr(t);try{return e(n,r,i)}catch{}return[]}const Yr=/Minified React error #\d+;/i;function Xr(e){return e&&Yr.test(e.message)?1:0}function Zr(e){return typeof e.framesToPop==`number`?e.framesToPop:0}function Qr(e){return typeof WebAssembly<`u`&&WebAssembly.Exception!==void 0&&e instanceof WebAssembly.Exception}function $r(e){let t=e?.name;return!t&&Qr(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:`WebAssembly.Exception`:t}function ei(e){let t=e?.message;return Qr(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:`wasm exception`:t?t.error&&typeof t.error.message==`string`?Gr(t.error):Gr(e):`No error message`}function ti(e,t,n,r){let i=ri(e,t,n?.syntheticException||void 0,r);return N(i),i.level=`error`,n?.event_id&&(i.event_id=n.event_id),H(i)}function ni(e,t,n=`info`,r,i){let a=ii(e,t,r?.syntheticException||void 0,i);return a.level=n,r?.event_id&&(a.event_id=r.event_id),H(a)}function ri(e,t,n,r,i){let a;if(se(t)&&t.error)return X(e,t.error);if(ce(t)||le(t)){let i=t;if(`stack`in t){a=X(e,t);let i=a.exception?.values?.[0];if(r&&n&&i&&!i.stacktrace){let t=Z(e,n);t.length&&(i.stacktrace={frames:t},N(a,{synthetic:!0}))}}else{let t=i.name||(ce(i)?`DOMError`:`DOMException`),o=i.message?`${t}: ${i.message}`:t;a=ii(e,o,n,r),Ne(a,o)}return`code`in i&&(a.tags={...a.tags,"DOMException.code":`${i.code}`}),a}return v(t)?X(e,t):x(t)||S(t)?(a=Jr(e,t,n,i),N(a,{synthetic:!0}),a):(a=ii(e,t,n,r),Ne(a,`${t}`,void 0),N(a,{synthetic:!0}),a)}function ii(e,t,n,r){let i={};if(r&&n){let r=Z(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),N(i,{synthetic:!0})}if(ue(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function ai(e,{isUnhandledRejection:t}){let n=ve(e),r=t?`promise rejection`:`exception`;return se(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:S(e)?`Event \`${oi(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function oi(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function si(e){return Object.values(e).find(e=>e instanceof Error)}var ci=class extends Mr{constructor(e){let t=li(e);Ur(t,`browser`,[`browser`],Y.SENTRY_SDK_SOURCE||Jn()),super(t);let{userInfo:n}=this.getDataCollectionOptions();t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:n?`auto`:`never`,...t._metadata.sdk.settings});let{sendClientReports:r}=this._options;Y.document&&Y.document.addEventListener(`visibilitychange`,()=>{Y.document.visibilityState===`hidden`&&(r&&this._flushOutcomes(),queueMicrotask(()=>{this.flush()}))}),n&&this.on(`beforeSendSession`,Hr)}eventFromException(e,t){return ti(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t=`info`,n){return ni(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||`javascript`,super._prepareEvent(e,t,n,r)}};function li(e){return{release:typeof __SENTRY_RELEASE__==`string`?__SENTRY_RELEASE__:Y.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const ui=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Q=t,$={};function di(e){let t=$[e];if(t)return t;let n=Q[e];if(Kr(n))return $[e]=n.bind(Q);let r=Q.document;if(r&&typeof r.createElement==`function`)try{let t=r.createElement(`iframe`);t.hidden=!0,r.head.appendChild(t);let i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){ui&&g.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n&&($[e]=n.bind(Q))}function fi(e){$[e]=void 0}function pi(e,t=di(`fetch`)){let n=0,r=0;async function i(i){let a=i.body.length;n+=a,r++;let o={body:i.body,method:`POST`,referrerPolicy:`strict-origin`,headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{let n=await t(e.url,o);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get(`X-Sentry-Rate-Limits`),"retry-after":n.headers.get(`Retry-After`)}}}catch(e){throw fi(`fetch`),e}finally{n-=a,r--}}return gr(e,i,dr(e.bufferSize||40))}function mi(e,t,n,r){let i={filename:e,function:t===`<anonymous>`?`?`:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const hi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,gi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_i=/\((\S*)(?::(\d+))(?::(\d+))\)/,vi=/at (.+?) ?\(data:(.+?),/,yi=[30,e=>{let t=e.match(vi);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};let n=hi.exec(e);if(n){let[,e,t,r]=n;return mi(e,`?`,+t,+r)}let r=gi.exec(e);if(r){if(r[2]?.indexOf(`eval`)===0){let e=_i.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,t]=Ci(r[1]||`?`,r[2]);return mi(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],bi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Si=ne(yi,[50,e=>{let t=bi.exec(e);if(t){if(t[3]&&t[3].indexOf(` > eval`)>-1){let e=xi.exec(t[3]);e&&(t[1]=t[1]||`eval`,t[3]=e[1],t[4]=e[2],t[5]=``)}let e=t[3],n=t[1]||`?`;return[n,e]=Ci(n,e),mi(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Ci=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?`?`:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},wi=new Map;function Ti(e){if(!e)return e;try{let t=new URL(e);return t.username=``,t.password=``,t.search=``,t.hash=``,t.toString()}catch{return e.replace(/[?#][^\s)]*/g,``)}}function Ei(e){Reflect.deleteProperty(e,`breadcrumbs`),Reflect.deleteProperty(e,`request`),Reflect.deleteProperty(e,`user`);for(let t of e.exception?.values??[])for(let e of t.stacktrace?.frames??[]){let t=Ti(e.filename);t&&(e.filename=t)}return e}function Di(e,t,n){let r=`${t}:${e}`,i=wi.get(r);if(i)return i;let a=new ci({beforeSend:Ei,dsn:e,environment:t,integrations:[],release:`@lockerverse/sdk@${n}`,sendDefaultPii:!1,stackParser:Si,transport:pi});return a.init(),wi.set(r,a),a}function Oi({context:e,contextName:t,dsn:n,environment:r,error:i}){try{let a=new L;a.setClient(Di(n,r,i.sdkVersion)),a.setTags({"sdk.code":i.code,"sdk.operation":i.operation,"sdk.version":i.sdkVersion,source:`lockerverse-sdk`}),a.setContext(t,e),a.captureException(i)}catch{}}export{Oi as captureSdkError};
8
+ //# sourceMappingURL=telemetry.js.map