2 lines
29 KiB
JavaScript
2 lines
29 KiB
JavaScript
function bn(){let t=arguments[0];for(let e=1,n=arguments.length;e<n;e++)t=arguments[e](t);return t}const y=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,h=globalThis,A="10.28.0";function P(){return B(h),h}function B(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||A,e[A]=e[A]||{}}function M(t,e,n=h){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[A]=r[A]||{};return s[t]||(s[t]=e())}const In=["debug","info","warn","error","log","assert","trace"],jt="Sentry Logger ",Q={};function z(t){if(!("console"in h))return t();const e=h.console,n={},r=Object.keys(Q);r.forEach(s=>{const i=Q[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function $t(){Y().enabled=!0}function Ut(){Y().enabled=!1}function yt(){return Y().enabled}function Gt(...t){K("log",...t)}function Vt(...t){K("warn",...t)}function vt(...t){K("error",...t)}function K(t,...e){y&&yt()&&z(()=>{h.console[t](`${jt}[${t}]:`,...e)})}function Y(){return y?M("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const m={enable:$t,disable:Ut,isEnabled:yt,log:Gt,warn:Vt,error:vt},Et=50,Bt="?",tt=/\(error: (.*)\)/,et=/captureMessage|captureException/;function Tn(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],o=n.split(`
|
|
`);for(let a=r;a<o.length;a++){let c=o[a];c.length>1024&&(c=c.slice(0,1024));const u=tt.test(c)?c.replace(tt,"$1"):c;if(!u.match(/\S*Error: /)){for(const p of e){const f=p(u);if(f){i.push(f);break}}if(i.length>=Et+s)break}}return zt(i.slice(s))}}function zt(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(O(e).function||"")&&e.pop(),e.reverse(),et.test(O(e).function||"")&&(e.pop(),et.test(O(e).function||"")&&e.pop()),e.slice(0,Et).map(n=>({...n,filename:n.filename||O(e).filename,function:n.function||Bt}))}function O(t){return t[t.length-1]||{}}const F="<anonymous>";function Kt(t){try{return!t||typeof t!="function"?F:t.name||F}catch{return F}}function xn(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function bt(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const It=Object.prototype.toString;function Yt(t){switch(It.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return D(t,Error)}}function C(t,e){return It.call(t)===`[object ${e}]`}function Cn(t){return C(t,"ErrorEvent")}function An(t){return C(t,"DOMError")}function Nn(t){return C(t,"DOMException")}function k(t){return C(t,"String")}function Ht(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Dn(t){return t===null||Ht(t)||typeof t!="object"&&typeof t!="function"}function Tt(t){return C(t,"Object")}function Wt(t){return typeof Event<"u"&&D(t,Event)}function Xt(t){return typeof Element<"u"&&D(t,Element)}function Jt(t){return C(t,"RegExp")}function L(t){return!!(t?.then&&typeof t.then=="function")}function qt(t){return Tt(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function D(t,e){try{return t instanceof e}catch{return!1}}function xt(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}function On(t){return typeof Request<"u"&&D(t,Request)}const H=h,Zt=80;function Qt(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,s=[];let i=0,o=0;const a=" > ",c=a.length;let u;const p=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Zt;for(;n&&i++<r&&(u=te(n,p),!(u==="html"||i>1&&o+s.length*c+u.length>=f));)s.push(u),o+=u.length,n=n.parentNode;return s.reverse().join(a)}catch{return"<unknown>"}}function te(t,e){const n=t,r=[];if(!n?.tagName)return"";if(H.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());const s=e?.length?e.filter(o=>n.getAttribute(o)).map(o=>[o,n.getAttribute(o)]):null;if(s?.length)s.forEach(o=>{r.push(`[${o[0]}="${o[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const o=n.className;if(o&&k(o)){const a=o.split(/\s+/);for(const c of a)r.push(`.${c}`)}}const i=["aria-label","type","name","title","alt"];for(const o of i){const a=n.getAttribute(o);a&&r.push(`[${o}="${a}"]`)}return r.join("")}function Rn(){try{return H.document.location.href}catch{return""}}function kn(t){if(!H.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function Pn(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const s=n(r);typeof s=="function"&&ee(s,r);try{t[e]=s}catch{y&&m.log(`Failed to replace method "${e}" in object`,t)}}function W(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{y&&m.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ee(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,W(t,"__sentry_original__",e)}catch{}}function Mn(t){return t.__sentry_original__}function Ct(t){if(Yt(t))return{message:t.message,name:t.name,stack:t.stack,...rt(t)};if(Wt(t)){const e={type:t.type,target:nt(t.target),currentTarget:nt(t.currentTarget),...rt(t)};return typeof CustomEvent<"u"&&D(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function nt(t){try{return Xt(t)?Qt(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function rt(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function Ln(t){const e=Object.keys(Ct(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}function U(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function wn(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const s=t[r];try{xt(s)?n.push(bt(s)):n.push(String(s))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Fn(t,e,n=!1){return k(t)?Jt(e)?e.test(t):k(e)?n?t===e:t.includes(e):!1:!1}function ne(){const t=h;return t.crypto||t.msCrypto}let j;function re(){return Math.random()*16}function T(t=ne()){try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"")}catch{}return j||(j="10000000100040008000"+1e11),j.replace(/[018]/g,e=>(e^(re()&15)>>e/4).toString(16))}function At(t){return t.exception?.values?.[0]}function jn(t){const{message:e,event_id:n}=t;if(e)return e;const r=At(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function $n(t,e,n){const r=t.exception=t.exception||{},s=r.values=r.values||[],i=s[0]=s[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function se(t,e){const n=At(t);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism={...r,...s,...e},e&&"data"in e){const i={...s?.data,...e.data};n.mechanism.data=i}}function Un(t){if(ie(t))return!0;try{W(t,"__sentry_captured__",!0)}catch{}return!1}function ie(t){try{return t.__sentry_captured__}catch{}}const Nt=1e3;function X(){return Date.now()/Nt}function oe(){const{performance:t}=h;if(!t?.now||!t.timeOrigin)return X;const e=t.timeOrigin;return()=>(e+t.now())/Nt}let st;function Dt(){return(st??(st=oe()))()}function ae(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Dt(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:T()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function w(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=w(r[s],e[s],n-1));return r}function it(){return T()}function Ot(){return T().substring(16)}const G="_sentrySpan";function ot(t,e){e?W(t,G,e):delete t[G]}function at(t){return t[G]}const ce=100;class S{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:it(),sampleRand:Math.random()}}clone(){const e=new S;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,ot(e,at(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&&ae(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}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,n){return this._extra={...this._extra,[e]:n},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,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,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;const n=typeof e=="function"?e(this):e,r=n instanceof S?n.getScopeData():Tt(n)?e:void 0,{tags:s,attributes:i,extra:o,user:a,contexts:c,level:u,fingerprint:p=[],propagationContext:f}=r||{};return this._tags={...this._tags,...s},this._attributes={...this._attributes,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),p.length&&(this._fingerprint=p),f&&(this._propagationContext=f),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,ot(this,void 0),this._attachments=[],this.setPropagationContext({traceId:it(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:ce;if(r<=0)return this;const s={timestamp:X(),...e,message:e.message?U(e.message,2048):e.message};return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),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:at(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=w(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n?.event_id||T();if(!this._client)return y&&m.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:s,...n,event_id:r},this),r}captureMessage(e,n,r){const s=r?.event_id||T();if(!this._client)return y&&m.warn("No client configured on scope - will not capture message!"),s;const i=r?.syntheticException??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...r,event_id:s},this),s}captureEvent(e,n){const r=n?.event_id||T();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(y&&m.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function ue(){return M("defaultCurrentScope",()=>new S)}function fe(){return M("defaultIsolationScope",()=>new S)}class pe{constructor(e,n){let r;e?r=e:r=new S;let s;n?s=n:s=new S,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(s){throw this._popScope(),s}return L(r)?r.then(s=>(this._popScope(),s),s=>{throw this._popScope(),s}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const 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 x(){const t=P(),e=B(t);return e.stack=e.stack||new pe(ue(),fe())}function le(t){return x().withScope(t)}function de(t,e){const n=x();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function ct(t){return x().withScope(()=>t(x().getIsolationScope()))}function _e(){return{withIsolationScope:ct,withScope:le,withSetScope:de,withSetIsolationScope:(t,e)=>ct(e),getCurrentScope:()=>x().getScope(),getIsolationScope:()=>x().getIsolationScope()}}function J(t){const e=B(t);return e.acs?e.acs:_e()}function q(){const t=P();return J(t).getCurrentScope()}function Gn(){const t=P();return J(t).getIsolationScope()}function he(){return M("globalScope",()=>new S)}function Vn(...t){const e=P(),n=J(e);if(t.length===2){const[r,s]=t;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(t[0])}function Rt(){return q().getClient()}function vn(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=e,i={trace_id:n,span_id:s||Ot()};return r&&(i.parent_span_id=r),i}const ge="sentry.source",me="sentry.sample_rate",Se="sentry.previous_trace_sample_rate",ye="sentry.op",Ee="sentry.origin",Bn="sentry.profile_id",zn="sentry.exclusive_time",be=0,Ie=1,Te="_sentryScope",xe="_sentryIsolationScope";function Ce(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function kt(t){const e=t;return{scope:e[Te],isolationScope:Ce(e[xe])}}const Ae="sentry-",Ne=/^sentry-/;function De(t){const e=Oe(t);if(!e)return;const n=Object.entries(e).reduce((r,[s,i])=>{if(s.match(Ne)){const o=s.slice(Ae.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function Oe(t){if(!(!t||!k(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=ut(n);return Object.entries(r).forEach(([s,i])=>{e[s]=i}),e},{}):ut(t)}function ut(t){return t.split(",").map(e=>{const n=e.indexOf("=");if(n===-1)return[];const r=e.slice(0,n),s=e.slice(n+1);return[r,s].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}const Re=/^o(\d+)\./,ke=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Pe(t){return t==="http"||t==="https"}function Kn(t,e=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function Me(t){const e=ke.exec(t);if(!e){z(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,s="",i="",o="",a=""]=e.slice(1);let c="",u=a;const p=u.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),u=p.pop()),u){const f=u.match(/^\d+/);f&&(u=f[0])}return Pt({host:i,pass:s,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function Pt(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Le(t){if(!y)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(m.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?Pe(r)?e&&isNaN(parseInt(e,10))?(m.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(m.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(m.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function we(t){return t.match(Re)?.[1]}function Fe(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=we(n)),r}function Yn(t){const e=typeof t=="string"?Me(t):Pt(t);if(!(!e||!Le(e)))return e}const Mt=1;let ft=!1;function je(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),s=r?e:Z(t).parent_span_id,i=kt(t).scope,o=r?i?.getPropagationContext().propagationSpanId||Ot():e;return{parent_span_id:s,span_id:o,trace_id:n}}function $e(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...s},attributes:i})=>({span_id:e,trace_id:n,sampled:r===Mt,attributes:i,...s}))}function pt(t){return typeof t=="number"?lt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?lt(t.getTime()):Dt()}function lt(t){return t>9999999999?t/1e3:t}function Z(t){if(Ge(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(Ue(t)){const{attributes:r,startTime:s,name:i,endTime:o,status:a,links:c}=t,u="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:i,parent_span_id:u,start_timestamp:pt(s),timestamp:pt(o)||void 0,status:ve(a),op:r[ye],origin:r[Ee],links:$e(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Ue(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Ge(t){return typeof t.getSpanJSON=="function"}function Ve(t){const{traceFlags:e}=t.spanContext();return e===Mt}function ve(t){if(!(!t||t.code===be))return t.code===Ie?"ok":t.message||"internal_error"}const Be="_sentryRootSpan";function Lt(t){return t[Be]||t}function Hn(){ft||(z(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),ft=!0)}function ze(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=Rt()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const wt="production",Ke="_frozenDsc";function Ft(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},s={environment:n.environment||wt,release:n.release,public_key:r,trace_id:t,org_id:Fe(e)};return e.emit("createDsc",s),s}function Wn(t,e){const n=e.getPropagationContext();return n.dsc||Ft(n.traceId,t)}function Ye(t){const e=Rt();if(!e)return{};const n=Lt(t),r=Z(n),s=r.data,i=n.spanContext().traceState,o=i?.get("sentry.sample_rate")??s[me]??s[Se];function a(_){return(typeof o=="number"||typeof o=="string")&&(_.sample_rate=`${o}`),_}const c=n[Ke];if(c)return a(c);const u=i?.get("sentry.dsc"),p=u&&De(u);if(p)return a(p);const f=Ft(t.spanContext().traceId,e),l=s[ge],d=r.description;return l!=="url"&&d&&(f.transaction=d),ze()&&(f.sampled=String(Ve(n)),f.sample_rand=i?.get("sentry.sample_rand")??kt(n).scope?.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,n),f}const dt=globalThis||void 0||self;function b(t,e=100,n=1/0){try{return V("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function He(t,e=3,n=100*1024){const r=b(t,e);return qe(r)>n?He(t,e-1,n):r}function V(t,e,n=1/0,r=1/0,s=Ze()){const[i,o]=s;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=We(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(i(e))return"[Circular ~]";const u=e;if(u&&typeof u.toJSON=="function")try{const d=u.toJSON();return V("",d,c-1,r,s)}catch{}const p=Array.isArray(e)?[]:{};let f=0;const l=Ct(e);for(const d in l){if(!Object.prototype.hasOwnProperty.call(l,d))continue;if(f>=r){p[d]="[MaxProperties ~]";break}const _=l[d];p[d]=V(d,_,c-1,r,s),f++}return o(e),p}function We(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof dt<"u"&&e===dt)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(xt(e))return bt(e);if(qt(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Kt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=Xe(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Xe(t){const e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function Je(t){return~-encodeURI(t).split(/%..|./).length}function qe(t){return Je(JSON.stringify(t))}function Ze(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}const $=0,_t=1,ht=2;function Qe(t){return new N(e=>{e(t)})}function tn(t){return new N((e,n)=>{n(t)})}class N{constructor(e){this._state=$,this._handlers=[],this._runExecutor(e)}then(e,n){return new N((r,s)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new N((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,e&&e()},o=>{i=!0,s=o,e&&e()}).then(()=>{if(i){r(s);return}n(s)})})}_executeHandlers(){if(this._state===$)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===_t&&n[1](this._value),this._state===ht&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(i,o)=>{if(this._state===$){if(L(o)){o.then(r,s);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(_t,i)},s=i=>{n(ht,i)};try{e(r,s)}catch(i){s(i)}}}function en(t,e,n,r=0){try{const s=v(e,n,t,r);return L(s)?s:Qe(s)}catch(s){return tn(s)}}function v(t,e,n,r){const s=n[r];if(!t||!s)return t;const i=s({...t},e);return y&&i===null&&m.log(`Event processor "${s.id||"?"}" dropped event`),L(i)?i.then(o=>v(o,e,n,r+1)):v(i,e,n,r+1)}function nn(t,e){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=e;rn(t,e),r&&an(t,r),cn(t,n),sn(t,s),on(t,i)}function gt(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:p,attachments:f,propagationContext:l,transactionName:d,span:_}=e;R(t,"extra",n),R(t,"tags",r),R(t,"user",s),R(t,"contexts",i),t.sdkProcessingMetadata=w(t.sdkProcessingMetadata,a,2),o&&(t.level=o),d&&(t.transactionName=d),_&&(t.span=_),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),p.length&&(t.eventProcessors=[...t.eventProcessors,...p]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,...l}}function R(t,e,n){t[e]=w(t[e],n,1)}function rn(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(s).length&&(t.user={...s,...t.user}),Object.keys(i).length&&(t.contexts={...i,...t.contexts}),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function sn(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function on(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function an(t,e){t.contexts={trace:je(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ye(e),...t.sdkProcessingMetadata};const n=Lt(e),r=Z(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function cn(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}let I,mt,St,E;function un(t){const e=h._sentryDebugIds,n=h._debugIds;if(!e&&!n)return{};const r=e?Object.keys(e):[],s=n?Object.keys(n):[];if(E&&r.length===mt&&s.length===St)return E;mt=r.length,St=s.length,E={},I||(I={});const i=(o,a)=>{for(const c of o){const u=a[c],p=I?.[c];if(p&&E&&u)E[p[0]]=u,I&&(I[c]=[p[0],u]);else if(u){const f=t(c);for(let l=f.length-1;l>=0;l--){const _=f[l]?.filename;if(_&&E&&I){E[_]=u,I[c]=[_,u];break}}}}};return e&&i(r,e),n&&i(s,n),E}function Xn(t,e,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||T(),timestamp:e.timestamp||X()},u=n.integrations||t.integrations.map(g=>g.name);fn(c,t),dn(c,u),s&&s.emit("applyFrameMetadata",e),e.type===void 0&&pn(c,t.stackParser);const p=hn(r,n.captureContext);n.mechanism&&se(c,n.mechanism);const f=s?s.getEventProcessors():[],l=he().getScopeData();if(i){const g=i.getScopeData();gt(l,g)}if(p){const g=p.getScopeData();gt(l,g)}const d=[...n.attachments||[],...l.attachments];d.length&&(n.attachments=d),nn(c,l);const _=[...f,...l.eventProcessors];return en(_,c,n).then(g=>(g&&ln(g),typeof o=="number"&&o>0?_n(g,o,a):g))}function fn(t,e){const{environment:n,release:r,dist:s,maxValueLength:i}=e;t.environment=t.environment||n||wt,!t.release&&r&&(t.release=r),!t.dist&&s&&(t.dist=s);const o=t.request;o?.url&&i&&(o.url=U(o.url,i)),i&&t.exception?.values?.forEach(a=>{a.value&&(a.value=U(a.value,i))})}function pn(t,e){const n=un(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(s=>{s.filename&&(s.debug_id=n[s.filename])})})}function ln(t){const e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(s=>{s.debug_id&&(s.abs_path?e[s.abs_path]=s.debug_id:s.filename&&(e[s.filename]=s.debug_id),delete s.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([r,s])=>{n.push({type:"sourcemap",code_file:r,debug_id:s})})}function dn(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function _n(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(s=>({...s,...s.data&&{data:b(s.data,e,n)}}))},...t.user&&{user:b(t.user,e,n)},...t.contexts&&{contexts:b(t.contexts,e,n)},...t.extra&&{extra:b(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=b(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(s=>({...s,...s.data&&{data:b(s.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=b(t.contexts.flags,3,n)),r}function hn(t,e){if(!e)return t;const n=t?t.clone():new S;return n.update(e),n}function gn(t){if(t)return mn(t)?{captureContext:t}:yn(t)?{captureContext:t}:t}function mn(t){return t instanceof S||typeof t=="function"}const Sn=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function yn(t){return Object.keys(t).some(e=>Sn.includes(e))}function Jn(t,e){return q().captureException(t,gn(e))}function qn(t,e){return q().captureEvent(t,e)}export{Wt as $,Tt as A,A as B,Rt as C,y as D,z as E,Mn as F,h as G,D as H,In as I,Pn as J,Q as K,Vn as L,se as M,wn as N,Jn as O,xn as P,Dt as Q,Yt as R,zn as S,W as T,On as U,Rn as V,ee as W,$n as X,Cn as Y,An as Z,Nn as _,Kn as a,He as a0,Ln as a1,k as a2,Tn as a3,Bt as a4,jn as a5,Qt as a6,kn as a7,qn as a8,bn as a9,B as b,M as c,m as d,tn as e,X as f,Kt as g,Bn as h,Fn as i,Un as j,ae as k,wt as l,Yn as m,b as n,vn as o,Xn as p,Wn as q,Qe as r,q as s,Gn as t,T as u,Ht as v,Dn as w,Hn as x,w as y,L as z};
|