@sentry/node 8.0.0-alpha.8 → 8.0.0-alpha.9

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.
@@ -1,2 +1,2 @@
1
- /*! @sentry/node 8.0.0-alpha.8 (ea3908a) | https://github.com/getsentry/sentry-javascript */
2
- import{Session as t}from"inspector";import{workerData as n,parentPort as e}from"worker_threads";import{posix as r,sep as o}from"path";import*as i from"node:http";import*as s from"node:https";import{Readable as c}from"stream";import{createGzip as u}from"zlib";import*as a from"net";import*as f from"tls";import*as h from"http";const l=Object.prototype.toString;function p(t,n){return l.call(t)===`[object ${n}]`}function d(t){return p(t,"Object")}function g(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function y(t,n){try{return t instanceof n}catch(t){return!1}}const m=globalThis;function v(t,n,e){const r=e||m,o=r.__SENTRY__=r.__SENTRY__||{};return o[t]||(o[t]=n())}const b=m,w=80;function _(t,n){const e=t,r=[];let o,i,s,c,u;if(!e||!e.tagName)return"";if(b.HTMLElement&&e instanceof HTMLElement&&e.dataset){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}r.push(e.tagName.toLowerCase());const a=n&&n.length?n.filter((t=>e.getAttribute(t))).map((t=>[t,e.getAttribute(t)])):null;if(a&&a.length)a.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else if(e.id&&r.push(`#${e.id}`),o=e.className,o&&p(o,"String"))for(i=o.split(/\s+/),u=0;u<i.length;u++)r.push(`.${i[u]}`);const f=["aria-label","type","name","title","alt"];for(u=0;u<f.length;u++)s=f[u],c=e.getAttribute(s),c&&r.push(`[${s}="${c}"]`);return r.join("")}const S="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,E=["debug","info","warn","error","log","assert","trace"],$={};function x(t){if(!("console"in m))return t();const n=m.console,e={},r=Object.keys($);r.forEach((t=>{const r=$[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}const A=function(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return S?E.forEach((e=>{n[e]=(...n)=>{t&&x((()=>{m.console[e](`Sentry Logger [${e}]:`,...n)}))}})):E.forEach((t=>{n[t]=()=>{}})),n}();function C(t,n=!1){const{host:e,path:r,pass:o,port:i,projectId:s,protocol:c,publicKey:u}=t;return`${c}://${u}${n&&o?`:${o}`:""}@${e}${i?`:${i}`:""}/${r?`${r}/`:r}${s}`}class N extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}const k=50,D="?",T=/captureMessage|captureException/;const O="<anonymous>";function R(t){if(function(t){switch(l.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return y(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...I(t)};if(n=t,"undefined"!=typeof Event&&y(n,Event)){const n={type:t.type,target:j(t.target),currentTarget:j(t.currentTarget),...I(t)};return"undefined"!=typeof CustomEvent&&y(t,CustomEvent)&&(n.detail=t.detail),n}return t;var n}function j(t){try{return n=t,"undefined"!=typeof Element&&y(n,Element)?function(t,n={}){if(!t)return"<unknown>";try{let e=t;const r=5,o=[];let i=0,s=0;const c=" > ",u=c.length;let a;const f=Array.isArray(n)?n:n.keyAttrs,h=!Array.isArray(n)&&n.maxStringLength||w;for(;e&&i++<r&&(a=_(e,f),!("html"===a||i>1&&s+o.length*u+a.length>=h));)o.push(a),s+=a.length,e=e.parentNode;return o.reverse().join(c)}catch(t){return"<unknown>"}}(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}var n}function I(t){if("object"==typeof t&&null!==t){const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}return{}}function P(t){return U(t,new Map)}function U(t,n){if(function(t){if(!d(t))return!1;try{const n=Object.getPrototypeOf(t).constructor.name;return!n||"Object"===n}catch(t){return!0}}(t)){const e=n.get(t);if(void 0!==e)return e;const r={};n.set(t,r);for(const e of Object.keys(t))void 0!==t[e]&&(r[e]=U(t[e],n));return r}if(Array.isArray(t)){const e=n.get(t);if(void 0!==e)return e;const r=[];return n.set(t,r),t.forEach((t=>{r.push(U(t,n))})),r}return t}function L(){const t=m,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function M(t,n=100,e=1/0){try{return B("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function B(t,n,e=1/0,r=1/0,o=function(){const t="function"==typeof WeakSet,n=t?new WeakSet:[];return[function(e){if(t)return!!n.has(e)||(n.add(e),!1);for(let t=0;t<n.length;t++)if(n[t]===e)return!0;return n.push(e),!1},function(e){if(t)n.delete(e);else for(let t=0;t<n.length;t++)if(n[t]===e){n.splice(t,1);break}}]}()){const[i,s]=o;if(null==n||["number","boolean","string"].includes(typeof n)&&!Number.isNaN(n))return n;const c=function(t,n){try{if("domain"===t&&n&&"object"==typeof n&&n.t)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&n===global)return"[Global]";if("undefined"!=typeof window&&n===window)return"[Window]";if("undefined"!=typeof document&&n===document)return"[Document]";if("object"==typeof(e=n)&&null!==e&&(e.__isVue||e.o))return"[VueViewModel]";if(function(t){return d(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(n))return"[SyntheticEvent]";if("number"==typeof n&&n!=n)return"[NaN]";if("function"==typeof n)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||O}catch(t){return O}}(n)}]`;if("symbol"==typeof n)return`[${String(n)}]`;if("bigint"==typeof n)return`[BigInt: ${String(n)}]`;const r=function(t){const n=Object.getPrototypeOf(t);return n?n.constructor.name:"null prototype"}(n);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var e}(t,n);if(!c.startsWith("[object "))return c;if(n.__sentry_skip_normalization__)return n;const u="number"==typeof n.__sentry_override_normalization_depth__?n.__sentry_override_normalization_depth__:e;if(0===u)return c.replace("object ","");if(i(n))return"[Circular ~]";const a=n;if(a&&"function"==typeof a.toJSON)try{return B("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const l=R(n);for(const t in l){if(!Object.prototype.hasOwnProperty.call(l,t))continue;if(h>=r){f[t]="[MaxProperties ~]";break}const n=l[t];f[t]=B(t,n,u-1,r,o),h++}return s(n),f}function G(t,n){const e=n.replace(/\\/g,"/").replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");let r=t;try{r=decodeURI(t)}catch(t){}return r.replace(/\\/g,"/").replace(/webpack:\/?/g,"").replace(new RegExp(`(file://)?/*${e}/*`,"ig"),"app:///")}const H=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function J(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=H.exec(n);return e?e.slice(1):[]}(t),e=n[0];let r=n[1];return e||r?(r&&(r=r.slice(0,r.length-1)),e+r):"."}var z;function W(t){return new F((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(z||(z={}));class F{constructor(t){F.prototype.__init.call(this),F.prototype.__init2.call(this),F.prototype.__init3.call(this),F.prototype.__init4.call(this),this.i=z.PENDING,this.u=[];try{t(this.h,this.l)}catch(t){this.l(t)}}then(t,n){return new F(((e,r)=>{this.u.push([!1,n=>{if(t)try{e(t(n))}catch(t){r(t)}else e(n)},t=>{if(n)try{e(n(t))}catch(t){r(t)}else r(t)}]),this.p()}))}catch(t){return this.then((t=>t),t)}finally(t){return new F(((n,e)=>{let r,o;return this.then((n=>{o=!1,r=n,t&&t()}),(n=>{o=!0,r=n,t&&t()})).then((()=>{o?e(r):n(r)}))}))}__init(){this.h=t=>{this.m(z.RESOLVED,t)}}__init2(){this.l=t=>{this.m(z.REJECTED,t)}}__init3(){this.m=(t,n)=>{this.i===z.PENDING&&(g(n)?n.then(this.h,this.l):(this.i=t,this.v=n,this.p()))}}__init4(){this.p=()=>{if(this.i===z.PENDING)return;const t=this.u.slice();this.u=[],t.forEach((t=>{t[0]||(this.i===z.RESOLVED&&t[1](this.v),this.i===z.REJECTED&&t[2](this.v),t[0]=!0)}))}}}function K(t){const n=[];function e(t){return n.splice(n.indexOf(t),1)[0]}return{$:n,add:function(r){if(!(void 0===t||n.length<t))return o=new N("Not adding Promise because buffer limit was reached."),new F(((t,n)=>{n(o)}));var o;const i=r();return-1===n.indexOf(i)&&n.push(i),i.then((()=>e(i))).then(null,(()=>e(i).then(null,(()=>{})))),i},drain:function(t){return new F(((e,r)=>{let o=n.length;if(!o)return e(!0);const i=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{W(t).then((()=>{--o||(clearTimeout(i),e(!0))}),r)}))}))}}}function V(t,n=!1){return!(n||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==t&&!t.includes("node_modules/")}const Y=1e3;function q(){return Date.now()/Y}const Z=function(){const{performance:t}=m;if(!t||!t.now)return q;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/Y}();function Q(t,n=[]){return[t,n]}function X(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function tt(t){return m.__SENTRY__&&m.__SENTRY__.encodePolyfill?m.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function nt(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[tt(r),t]:r.push("string"==typeof t?tt(t):t)}for(const t of e){const[n,e]=t;if(o(`\n${JSON.stringify(n)}\n`),"string"==typeof e||e instanceof Uint8Array)o(e);else{let t;try{t=JSON.stringify(e)}catch(n){t=JSON.stringify(M(e))}o(t)}}return"string"==typeof r?r:function(t){const n=t.reduce(((t,n)=>t+n.length),0),e=new Uint8Array(n);let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}(r)}(()=>{const{performance:t}=m;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,i=o<n,s=t.timing&&t.timing.navigationStart,c="number"==typeof s?Math.abs(s+e-r):n;(i||c<n)&&(o<=c&&t.timeOrigin)})();const et={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",statsd:"statsd"};function rt(t){return et[t]}function ot(t){if(!t||!t.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}const it=6e4;function st(t,{statusCode:n,headers:e},r=Date.now()){const o={...t},i=e&&e["x-sentry-rate-limits"],s=e&&e["retry-after"];if(i)for(const t of i.trim().split(",")){const[n,e]=t.split(":",2),i=parseInt(n,10),s=1e3*(isNaN(i)?60:i);if(e)for(const t of e.split(";"))o[t]=r+s;else o.all=r+s}else s?o.all=r+function(t,n=Date.now()){const e=parseInt(`${t}`,10);if(!isNaN(e))return 1e3*e;const r=Date.parse(`${t}`);return isNaN(r)?it:r-n}(s,r):429===n&&(o.all=r+6e4);return o}const ct="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function ut(){return at(m),m}function at(t){return t.__SENTRY__||(t.__SENTRY__={extensions:{}}),t.__SENTRY__}const ft="production";function ht(t){const n=Z(),e={sid:L(),init:!0,timestamp:n,started:n,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return P({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(e)};return t&&lt(e,t),e}function lt(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),t.did||n.did||(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||Z(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:L()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}const pt="_sentrySpan";function dt(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){S&&A.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,pt,n):delete t[pt]}function gt(t){return t[pt]}class yt{constructor(){this._=!1,this.S=[],this.A=[],this.C=[],this.N=[],this.k={},this.D={},this.T={},this.O={},this.R={},this.j=mt()}clone(){const t=new yt;return t.C=[...this.C],t.D={...this.D},t.T={...this.T},t.O={...this.O},t.k=this.k,t.I=this.I,t.P=this.P,t.U=this.U,t.L=this.L,t.A=[...this.A],t.M=this.M,t.N=[...this.N],t.R={...this.R},t.j={...this.j},t.B=this.B,dt(t,gt(this)),t}setClient(t){this.B=t}getClient(){return this.B}addScopeListener(t){this.S.push(t)}addEventProcessor(t){return this.A.push(t),this}setUser(t){return this.k=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.P&&lt(this.P,{user:t}),this.G(),this}getUser(){return this.k}getRequestSession(){return this.M}setRequestSession(t){return this.M=t,this}setTags(t){return this.D={...this.D,...t},this.G(),this}setTag(t,n){return this.D={...this.D,[t]:n},this.G(),this}setExtras(t){return this.T={...this.T,...t},this.G(),this}setExtra(t,n){return this.T={...this.T,[t]:n},this.G(),this}setFingerprint(t){return this.L=t,this.G(),this}setLevel(t){return this.I=t,this.G(),this}setTransactionName(t){return this.U=t,this.G(),this}setContext(t,n){return null===n?delete this.O[t]:this.O[t]=n,this.G(),this}setSession(t){return t?this.P=t:delete this.P,this.G(),this}getSession(){return this.P}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof yt?[n.getScopeData(),n.getRequestSession()]:d(n)?[t,t.requestSession]:[],{tags:o,extra:i,user:s,contexts:c,level:u,fingerprint:a=[],propagationContext:f}=e||{};return this.D={...this.D,...o},this.T={...this.T,...i},this.O={...this.O,...c},s&&Object.keys(s).length&&(this.k=s),u&&(this.I=u),a.length&&(this.L=a),f&&(this.j=f),r&&(this.M=r),this}clear(){return this.C=[],this.D={},this.T={},this.k={},this.O={},this.I=void 0,this.U=void 0,this.L=void 0,this.M=void 0,this.P=void 0,dt(this,void 0),this.N=[],this.j=mt(),this.G(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:q(),...t},o=this.C;return o.push(r),this.C=o.length>e?o.slice(-e):o,this.G(),this}getLastBreadcrumb(){return this.C[this.C.length-1]}clearBreadcrumbs(){return this.C=[],this.G(),this}addAttachment(t){return this.N.push(t),this}clearAttachments(){return this.N=[],this}getScopeData(){return{breadcrumbs:this.C,attachments:this.N,contexts:this.O,tags:this.D,extra:this.T,user:this.k,level:this.I,fingerprint:this.L||[],eventProcessors:this.A,propagationContext:this.j,sdkProcessingMetadata:this.R,transactionName:this.U,span:gt(this)}}setSDKProcessingMetadata(t){return this.R={...this.R,...t},this}setPropagationContext(t){return this.j=t,this}getPropagationContext(){return this.j}captureException(t,n){const e=n&&n.event_id?n.event_id:L();if(!this.B)return A.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.B.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:L();if(!this.B)return A.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.B.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:L();return this.B?(this.B.captureEvent(t,{...n,event_id:e},this),e):(A.warn("No client configured on scope - will not capture event!"),e)}G(){this._||(this._=!0,this.S.forEach((t=>{t(this)})),this._=!1)}}function mt(){return{traceId:L(),spanId:L().substring(16)}}const vt=parseFloat("8.0.0-alpha.8"),bt=100;class wt{constructor(t,n,e,r=vt){let o,i;this.H=r,n?o=n:(o=new yt,o.setClient(t)),e?i=e:(i=new yt,i.setClient(t)),this.J=[{scope:o}],t&&this.bindClient(t),this.W=i}bindClient(t){const n=this.getStackTop();n.client=t,n.scope.setClient(t),t&&t.init()}withScope(t){const n=this.F();let e;try{e=t(n)}catch(t){throw this.K(),t}return g(e)?e.then((t=>(this.K(),t)),(t=>{throw this.K(),t})):(this.K(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.W}getStack(){return this.J}getStackTop(){return this.J[this.J.length-1]}captureException(t,n){const e=n&&n.event_id?n.event_id:L(),r=new Error("Sentry syntheticException");return this.getScope().captureException(t,{originalException:t,syntheticException:r,...n,event_id:e}),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:L(),o=new Error(t);return this.getScope().captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r}),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:L();return this.getScope().captureEvent(t,{...n,event_id:e}),e}addBreadcrumb(t,n){const{client:e}=this.getStackTop();if(!e)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:o=bt}=e.getOptions&&e.getOptions()||{};if(o<=0)return;const i={timestamp:q(),...t},s=r?x((()=>r(i,n))):i;null!==s&&(e.emit("beforeAddBreadcrumb",s,n),this.getIsolationScope().addBreadcrumb(s,o))}setUser(t){this.getIsolationScope().setUser(t)}setTags(t){this.getIsolationScope().setTags(t)}setExtras(t){this.getIsolationScope().setExtras(t)}setTag(t,n){this.getIsolationScope().setTag(t,n)}setExtra(t,n){this.getIsolationScope().setExtra(t,n)}setContext(t,n){this.getIsolationScope().setContext(t,n)}getIntegration(t){const n=this.getClient();if(!n)return null;try{return n.getIntegrationByName(t.id)||null}catch(n){return ct&&A.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}captureSession(t=!1){if(t)return this.endSession();this.V()}endSession(){const t=this.getStackTop().scope,n=t.getSession();n&&function(t,n){let e={};n?e={status:n}:"ok"===t.status&&(e={status:"exited"}),lt(t,e)}(n),this.V(),t.setSession()}startSession(t){const{scope:n,client:e}=this.getStackTop(),{release:r,environment:o=ft}=e&&e.getOptions()||{},{userAgent:i}=m.navigator||{},s=ht({release:r,environment:o,user:n.getUser(),...i&&{userAgent:i},...t}),c=n.getSession&&n.getSession();return c&&"ok"===c.status&&lt(c,{status:"exited"}),this.endSession(),n.setSession(s),s}V(){const{scope:t,client:n}=this.getStackTop(),e=t.getSession();e&&n&&n.captureSession&&n.captureSession(e)}F(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}K(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}}function _t(){const t=at(ut());return t.hub||(t.hub=new wt(void 0,v("defaultCurrentScope",(()=>new yt)),v("defaultIsolationScope",(()=>new yt)))),t.hub}function St(t){const n=at(t);return n.acs?n.acs:{getCurrentHub:_t,withIsolationScope:xt,withScope:Et,withSetScope:$t,withSetIsolationScope:(t,n)=>xt(n),getCurrentScope:()=>_t().getScope(),getIsolationScope:()=>_t().getIsolationScope()}}function Et(t){return _t().withScope(t)}function $t(t,n){const e=_t();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function xt(t){return _t().withScope((()=>t(_t().getIsolationScope())))}function At(){return St(ut()).getCurrentScope().getClient()}const Ct="sentry.source",Nt="sentry.sample_rate",kt="sentry.op",Dt="sentry.origin",Tt=0,Ot=1,Rt=1;function jt(t){const{spanId:n,traceId:e}=t.spanContext(),{data:r,op:o,parent_span_id:i,status:s,origin:c}=Ut(t);return P({data:r,op:o,parent_span_id:i,span_id:n,status:s,trace_id:e,origin:c})}function It(t){return"number"==typeof t?Pt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Pt(t.getTime()):Z()}function Pt(t){return t>9999999999?t/1e3:t}function Ut(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{const{spanId:n,traceId:e}=t.spanContext();if(function(t){const n=t;return!!(n.attributes&&n.startTime&&n.name&&n.endTime&&n.status)}(t)){const{attributes:r,startTime:o,name:i,endTime:s,parentSpanId:c,status:u}=t;return P({span_id:n,trace_id:e,data:r,description:i,parent_span_id:c,start_timestamp:It(o),timestamp:It(s)||void 0,status:Lt(u),op:r[kt],origin:r[Dt],Y:void 0})}return{span_id:n,trace_id:e}}catch(t){return{}}}function Lt(t){if(t&&t.code!==Tt)return t.code===Ot?"ok":t.message||"unknown_error"}const Mt="_sentryRootSpan";function Bt(t){return t[Mt]||t}const Gt="_frozenDsc";function Ht(t){const n=At();if(!n)return{};const e=function(t,n){const e=n.getOptions(),{publicKey:r}=n.getDsn()||{},o=P({environment:e.environment||ft,release:e.release,public_key:r,trace_id:t});return n.emit("createDsc",o),o}(Ut(t).trace_id||"",n),r=Bt(t);if(!r)return e;const o=r[Gt];if(o)return o;const i=Ut(r),s=i.data||{},c=s[Nt];null!=c&&(e.sample_rate=`${c}`);const u=s[Ct];return u&&"url"!==u&&(e.transaction=i.description),e.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===Rt}(r)),n.emit("createDsc",e),e}function Jt(t,n,e,r){const o=ot(e),i=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,n){n&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||n.name,t.sdk.version=t.sdk.version||n.version,t.sdk.integrations=[...t.sdk.integrations||[],...n.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...n.packages||[]])}(t,e&&e.sdk);const s=function(t,n,e,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&r&&{dsn:C(r)},...o&&{trace:P({...o})}}}(t,o,r,n);delete t.sdkProcessingMetadata;return Q(s,[[{type:i},t]])}function zt(t,n){const{fingerprint:e,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=n;!function(t,n){const{extra:e,tags:r,user:o,contexts:i,level:s,transactionName:c}=n,u=P(e);u&&Object.keys(u).length&&(t.extra={...u,...t.extra});const a=P(r);a&&Object.keys(a).length&&(t.tags={...a,...t.tags});const f=P(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=P(i);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts});s&&(t.level=s);c&&"transaction"!==t.type&&(t.transaction=c)}(t,n),r&&function(t,n){t.contexts={trace:jt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ht(n),...t.sdkProcessingMetadata};const e=Bt(n),r=Ut(e).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,n){t.fingerprint=t.fingerprint?function(t){return Array.isArray(t)?t:[t]}(t.fingerprint):[],n&&(t.fingerprint=t.fingerprint.concat(n));t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}(t,e),function(t,n){const e=[...t.breadcrumbs||[],...n];t.breadcrumbs=e.length?e:void 0}(t,o),function(t,n){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...n}}(t,i)}const Wt="7";function Ft(t,n){return e={sentry_key:t.publicKey,sentry_version:Wt,...n&&{sentry_client:`${n.name}/${n.version}`}},Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&");var e}const Kt=30;function Vt(t,n,e=K(t.bufferSize||Kt)){let r={};return{send:function(o){const i=[];if(X(o,((n,e)=>{const o=rt(e);if(function(t,n,e=Date.now()){return function(t,n){return t[n]||t.all||0}(t,n)>e}(r,o)){const r=Yt(n,e);t.recordDroppedEvent("ratelimit_backoff",o,r)}else i.push(n)})),0===i.length)return W({});const s=Q(o[0],i),c=n=>{X(s,((e,r)=>{const o=Yt(e,r);t.recordDroppedEvent(n,rt(r),o)}))};return e.add((()=>n({body:nt(s)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&ct&&A.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=st(r,t),t)),(t=>{throw c("network_error"),t})))).then((t=>t),(t=>{if(t instanceof N)return ct&&A.error("Skipped sending event because buffer is full."),c("queue_overflow"),W({});throw t}))},flush:t=>e.drain(t)}}function Yt(t,n){if("event"===n||"transaction"===n)return Array.isArray(t)?t[1]:void 0}var qt="object"==typeof globalThis?globalThis:global,Zt="1.7.0",Qt=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var Xt=function(t){var n=new Set([t]),e=new Set,r=t.match(Qt);if(!r)return function(){return!1};var o=+r[1],i=+r[2],s=+r[3];if(null!=r[4])return function(n){return n===t};function c(t){return e.add(t),!1}function u(t){return n.add(t),!0}return function(t){if(n.has(t))return!0;if(e.has(t))return!1;var r=t.match(Qt);if(!r)return c(t);var a=+r[1],f=+r[2],h=+r[3];return null!=r[4]||o!==a?c(t):0===o?i===f&&s<=h?u(t):c(t):i<=f?u(t):c(t)}}(Zt),tn=Zt.split(".")[0],nn=Symbol.for("opentelemetry.js.api."+tn),en=qt;function rn(t,n,e,r){var o;void 0===r&&(r=!1);var i=en[nn]=null!==(o=en[nn])&&void 0!==o?o:{version:Zt};if(!r&&i[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return e.error(s.stack||s.message),!1}if(i.version!==Zt){s=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+t+" does not match previously registered API v"+Zt);return e.error(s.stack||s.message),!1}return i[t]=n,e.debug("@opentelemetry/api: Registered a global for "+t+" v"+Zt+"."),!0}function on(t){var n,e,r=null===(n=en[nn])||void 0===n?void 0:n.version;if(r&&Xt(r))return null===(e=en[nn])||void 0===e?void 0:e[t]}function sn(t,n){n.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+Zt+".");var e=en[nn];e&&delete e[t]}var cn,un=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},an=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},fn=function(){function t(t){this.q=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("debug",this.q,t)},t.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("error",this.q,t)},t.prototype.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("info",this.q,t)},t.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("warn",this.q,t)},t.prototype.verbose=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("verbose",this.q,t)},t}();function hn(t,n,e){var r=on("diag");if(r)return e.unshift(n),r[t].apply(r,an([],un(e),!1))}!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(cn||(cn={}));var ln=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},pn=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},dn=function(){function t(){function t(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=on("diag");if(r)return r[t].apply(r,pn([],ln(n),!1))}}var n=this;n.setLogger=function(t,e){var r,o,i;if(void 0===e&&(e={logLevel:cn.INFO}),t===n){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error(null!==(r=s.stack)&&void 0!==r?r:s.message),!1}"number"==typeof e&&(e={logLevel:e});var c=on("diag"),u=function(t,n){function e(e,r){var o=n[e];return"function"==typeof o&&t>=r?o.bind(n):function(){}}return t<cn.NONE?t=cn.NONE:t>cn.ALL&&(t=cn.ALL),n=n||{},{error:e("error",cn.ERROR),warn:e("warn",cn.WARN),info:e("info",cn.INFO),debug:e("debug",cn.DEBUG),verbose:e("verbose",cn.VERBOSE)}}(null!==(o=e.logLevel)&&void 0!==o?o:cn.INFO,t);if(c&&!e.suppressOverrideMessage){var a=null!==(i=(new Error).stack)&&void 0!==i?i:"<failed to generate stacktrace>";c.warn("Current logger will be overwritten from "+a),u.warn("Current logger will overwrite one already registered from "+a)}return rn("diag",u,n,!0)},n.disable=function(){sn("diag",n)},n.createComponentLogger=function(t){return new fn(t)},n.verbose=t("verbose"),n.debug=t("debug"),n.info=t("info"),n.warn=t("warn"),n.error=t("error")}return t.instance=function(){return this.Z||(this.Z=new t),this.Z},t}();var gn,yn=function t(n){var e=this;e.X=n?new Map(n):new Map,e.getValue=function(t){return e.X.get(t)},e.setValue=function(n,r){var o=new t(e.X);return o.X.set(n,r),o},e.deleteValue=function(n){var r=new t(e.X);return r.X.delete(n),r}},mn=new yn,vn=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},bn=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},wn=function(){function t(){}return t.prototype.active=function(){return mn},t.prototype.with=function(t,n,e){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];return n.call.apply(n,bn([e],vn(r),!1))},t.prototype.bind=function(t,n){return n},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),_n=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Sn=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},En="context",$n=new wn,xn=function(){function t(){}return t.getInstance=function(){return this.Z||(this.Z=new t),this.Z},t.prototype.setGlobalContextManager=function(t){return rn(En,t,dn.instance())},t.prototype.active=function(){return this.tt().active()},t.prototype.with=function(t,n,e){for(var r,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(r=this.tt()).with.apply(r,Sn([t,n,e],_n(o),!1))},t.prototype.bind=function(t,n){return this.tt().bind(t,n)},t.prototype.tt=function(){return on(En)||$n},t.prototype.disable=function(){this.tt().disable(),sn(En,dn.instance())},t}(),An=xn.getInstance(),Cn=(gn="OpenTelemetry SDK Context Key SUPPRESS_TRACING",Symbol.for(gn));function Nn(t,n){return null!=t?t:n()}const kn=Symbol("AgentBaseInternalState");class Dn extends h.Agent{constructor(t){super(t),this[kn]={}}isSecureEndpoint(t){if(t){if("boolean"==typeof t.secureEndpoint)return t.secureEndpoint;if("string"==typeof t.protocol)return"https:"===t.protocol}const{stack:n}=new Error;return"string"==typeof n&&n.split("\n").some((t=>-1!==t.indexOf("(https.js:")||-1!==t.indexOf("node:https:")))}createSocket(t,n,e){const r={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then((()=>this.connect(t,r))).then((o=>{if(o instanceof h.Agent)return o.addRequest(t,r);this[kn].currentSocket=o,super.createSocket(t,n,e)}),e)}createConnection(){const t=this[kn].currentSocket;if(this[kn].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return Nn(this[kn].defaultPort,(()=>"https:"===this.protocol?443:80))}set defaultPort(t){this[kn]&&(this[kn].defaultPort=t)}get protocol(){return Nn(this[kn].protocol,(()=>this.isSecureEndpoint()?"https:":"http:"))}set protocol(t){this[kn]&&(this[kn].protocol=t)}}function Tn(...t){A.log("[https-proxy-agent:parse-proxy-response]",...t)}function On(t){return new Promise(((n,e)=>{let r=0;const o=[];function i(){const c=t.read();c?function(c){o.push(c),r+=c.length;const u=Buffer.concat(o,r),a=u.indexOf("\r\n\r\n");if(-1===a)return Tn("have not received end of HTTP headers yet..."),void i();const f=u.slice(0,a).toString("ascii").split("\r\n"),h=f.shift();if(!h)return t.destroy(),e(new Error("No header received from proxy CONNECT response"));const l=h.split(" "),p=+l[1],d=l.slice(2).join(" "),g={};for(const n of f){if(!n)continue;const r=n.indexOf(":");if(-1===r)return t.destroy(),e(new Error(`Invalid header from proxy CONNECT response: "${n}"`));const o=n.slice(0,r).toLowerCase(),i=n.slice(r+1).trimStart(),s=g[o];"string"==typeof s?g[o]=[s,i]:Array.isArray(s)?s.push(i):g[o]=i}Tn("got proxy server response: %o %o",h,g),s(),n({connect:{statusCode:p,statusText:d,headers:g},buffered:u})}(c):t.once("readable",i)}function s(){t.removeListener("end",c),t.removeListener("error",u),t.removeListener("readable",i)}function c(){s(),Tn("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){s(),Tn("onerror %o",t),e(t)}t.on("error",u),t.on("end",c),i()}))}function Rn(...t){A.log("[https-proxy-agent]",...t)}class jn extends Dn{static __initStatic(){this.protocols=["http","https"]}constructor(t,n){var e,r;super(n),this.options={},this.proxy="string"==typeof t?new URL(t):t,this.proxyHeaders=(e=function(t){let n,e=t[0],r=1;for(;r<t.length;){const o=t[r],i=t[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==e)return;"access"===o||"optionalAccess"===o?(n=e,e=i(e)):"call"!==o&&"optionalCall"!==o||(e=i(((...t)=>e.call(n,...t))),n=void 0)}return e}([n,"optionalAccess",t=>t.headers]),r=()=>({}),null!=e?e:r()),Rn("Creating new HttpsProxyAgent instance: %o",this.proxy.href);const o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):"https:"===this.proxy.protocol?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?Pn(n,"headers"):null,host:o,port:i}}async connect(t,n){const{proxy:e}=this;if(!n.host)throw new TypeError('No "host" provided');let r;if("https:"===e.protocol){Rn("Creating `tls.Socket`: %o",this.connectOpts);const t=this.connectOpts.servername||this.connectOpts.host;r=f.connect({...this.connectOpts,servername:t&&a.isIP(t)?void 0:t})}else Rn("Creating `net.Socket`: %o",this.connectOpts),r=a.connect(this.connectOpts);const o="function"==typeof this.proxyHeaders?this.proxyHeaders():{...this.proxyHeaders},i=a.isIPv6(n.host)?`[${n.host}]`:n.host;let s=`CONNECT ${i}:${n.port} HTTP/1.1\r\n`;if(e.username||e.password){const t=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(t).toString("base64")}`}o.Host=`${i}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const t of Object.keys(o))s+=`${t}: ${o[t]}\r\n`;const c=On(r);r.write(`${s}\r\n`);const{connect:u,buffered:h}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),200===u.statusCode){if(t.once("socket",In),n.secureEndpoint){Rn("Upgrading socket connection to TLS");const t=n.servername||n.host;return f.connect({...Pn(n,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const l=new a.Socket({writable:!1});return l.readable=!0,t.once("socket",(t=>{Rn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),l}}function In(t){t.resume()}function Pn(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}function Un(t,n){return null!=t?t:n()}jn.__initStatic();const Ln=32768;function Mn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Bn(t){let n,e=t[0],r=1;for(;r<t.length;){const o=t[r],i=t[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==e)return;"access"===o||"optionalAccess"===o?(n=e,e=i(e)):"call"!==o&&"optionalCall"!==o||(e=i(((...t)=>e.call(n,...t))),n=void 0)}return e}const Gn=n;let Hn,Jn=!1;function zn(t){Gn.debug&&console.log(`[ANR Worker] ${t}`)}var Wn,Fn,Kn;const Vn=function(t){let n;try{n=new URL(t.url)}catch(n){return x((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),Vt(t,(()=>Promise.resolve({})))}const e="https:"===n.protocol,r=function(t,n){const{no_proxy:e}=process.env;return e&&e.split(",").some((n=>t.host.endsWith(n)||t.hostname.endsWith(n)))?void 0:n}(n,t.proxy||(e?process.env.https_proxy:void 0)||process.env.http_proxy),o=e?s:i,a=void 0!==t.keepAlive&&t.keepAlive,f=r?new jn(r):new o.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return An.with(function(t){return t.setValue(Cn,!0)}(An.active()),(()=>{const n=function(t,n,e){const{hostname:r,pathname:o,port:i,protocol:s,search:a}=new URL(t.url);return function(f){return new Promise(((h,l)=>{let p=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>Ln&&(d["content-encoding"]="gzip",p=p.pipe(u()));const g=n.request({method:"POST",agent:e,headers:d,hostname:r,path:`${o}${a}`,port:i,protocol:s,ca:t.caCerts},(t=>{t.on("data",(()=>{})),t.on("end",(()=>{})),t.setEncoding("utf8");const n=Un(t.headers["retry-after"],(()=>null)),e=Un(t.headers["x-sentry-rate-limits"],(()=>null));h({statusCode:t.statusCode,headers:{"retry-after":n,"x-sentry-rate-limits":Array.isArray(e)?e[0]:e}})}));g.on("error",l),p.pipe(g)}))}}(t,Un(t.httpModule,(()=>o)),f);return Vt(t,n)}))}({url:(Wn=Gn.dsn,Fn=Gn.tunnel,Kn=Gn.sdkMetadata.sdk,Fn||`${function(t){return`${function(t){const n=t.protocol?`${t.protocol}:`:"",e=t.port?`:${t.port}`:"";return`${n}//${t.host}${e}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(Wn)}?${Ft(Wn,Kn)}`),recordDroppedEvent:()=>{}});async function Yn(){if(Hn){zn("Sending abnormal session"),lt(Hn,{status:"abnormal",abnormal_mechanism:"anr_foreground"});const t=function(t,n,e,r){const o=ot(e);return Q({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:C(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(Hn,Gn.dsn,Gn.sdkMetadata,Gn.tunnel);zn(JSON.stringify(t)),await Vn.send(t);try{Bn([e,"optionalAccess",t=>t.postMessage,"call",t=>t("session-ended")])}catch(t){}}}function qn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(n[n.length-1].function||"")&&n.pop(),n.reverse(),T.test(n[n.length-1].function||"")&&(n.pop(),T.test(n[n.length-1].function||"")&&n.pop()),n.slice(0,k).map((t=>({...t,filename:t.filename||n[n.length-1].filename,function:t.function||D})))}(t);if(Gn.appRootPath)for(const t of n)t.filename&&(t.filename=G(t.filename,Gn.appRootPath));return n}async function Zn(t,n){if(Jn)return;Jn=!0,await Yn(),zn("Sending event");const e={event_id:L(),contexts:Gn.contexts,release:Gn.release,environment:Gn.environment,dist:Gn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${Gn.anrThreshold} ms`,stacktrace:{frames:qn(t)},mechanism:{type:"ANR"}}]},tags:Gn.staticTags};n&&function(t,n){if(zt(t,n),!Bn([t,"access",t=>t.contexts,"optionalAccess",t=>t.trace])){const{traceId:e,spanId:r,parentSpanId:o}=n.propagationContext;t.contexts={trace:{trace_id:e,span_id:r,parent_span_id:o},...t.contexts}}}(e,n);const r=Jt(e,Gn.dsn,Gn.sdkMetadata,Gn.tunnel);zn(JSON.stringify(r)),await Vn.send(r),await Vn.flush(2e3),setTimeout((()=>{process.exit(0)}),5e3)}let Qn;if(zn("Started"),Gn.captureStackTrace){zn("Connecting to debugger");const n=new t;n.connectToMainThread(),zn("Connected to debugger");const e=new Map;n.on("Debugger.scriptParsed",(t=>{e.set(t.params.scriptId,t.params.url)})),n.on("Debugger.paused",(t=>{if("other"===t.params.reason)try{zn("Debugger paused");const i=[...t.params.callFrames],s=Gn.appRootPath?function(t=(process.argv[1]?J(process.argv[1]):process.cwd()),n="\\"===o){const e=n?Mn(t):t;return t=>{if(!t)return;const o=n?Mn(t):t;let{dir:i,base:s,ext:c}=r.parse(o);".js"!==c&&".mjs"!==c&&".cjs"!==c||(s=s.slice(0,-1*c.length)),i||(i=".");const u=i.lastIndexOf("/node_modules");if(u>-1)return`${i.slice(u+14).replace(/\//g,".")}:${s}`;if(i.startsWith(e)){let t=i.slice(e.length+1).replace(/\//g,".");return t&&(t+=":"),t+=s,t}return s}}(Gn.appRootPath):()=>{},c=i.map((t=>function(t,n,e){const r=n?n.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,i=t.location.lineNumber?t.location.lineNumber+1:void 0;return P({filename:r,module:e(r),function:t.functionName||D,colno:o,lineno:i,in_app:r?V(r):void 0})}(t,e.get(t.location.scriptId),s)));n.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,e)=>{t&&zn(`Error executing script: '${t.message}'`);const r=e&&e.result?e.result.value:void 0;n.post("Debugger.resume"),n.post("Debugger.disable"),Zn(c,r).then(null,(()=>{zn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),Qn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:Xn}=function(t,n,e,r){const o=t();let i=!1,s=!0;return setInterval((()=>{const t=o.getTimeMs();!1===i&&t>n+e&&(i=!0,s&&r()),t<n+e&&(i=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{s=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[n,e]=process.hrtime(t);return Math.floor(1e3*n+e/1e6)},reset:()=>{t=process.hrtime()}}}),Gn.pollInterval,Gn.anrThreshold,(function(){zn("Watchdog timeout"),Qn?(zn("Pausing debugger to capture stack trace"),Qn()):(zn("Capturing event without a stack trace"),Zn().then(null,(()=>{zn("Sending ANR event failed on watchdog timeout.")})))}));Bn([e,"optionalAccess",t=>t.on,"call",t=>t("message",(t=>{t.session&&(Hn=ht(t.session)),Xn()}))]);
1
+ /*! @sentry/node 8.0.0-alpha.9 (6f95372) | https://github.com/getsentry/sentry-javascript */
2
+ import{Session as t}from"inspector";import{workerData as n,parentPort as e}from"worker_threads";import{posix as r,sep as o}from"path";import*as i from"node:http";import*as s from"node:https";import{Readable as c}from"stream";import{createGzip as u}from"zlib";import*as a from"net";import*as f from"tls";import*as h from"http";const l=Object.prototype.toString;function p(t,n){return l.call(t)===`[object ${n}]`}function d(t){return p(t,"Object")}function g(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function y(t,n){try{return t instanceof n}catch(t){return!1}}const m=globalThis;function v(t,n,e){const r=e||m,o=r.__SENTRY__=r.__SENTRY__||{};return o[t]||(o[t]=n())}const b=m,w=80;function _(t,n){const e=t,r=[];let o,i,s,c,u;if(!e||!e.tagName)return"";if(b.HTMLElement&&e instanceof HTMLElement&&e.dataset){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}r.push(e.tagName.toLowerCase());const a=n&&n.length?n.filter((t=>e.getAttribute(t))).map((t=>[t,e.getAttribute(t)])):null;if(a&&a.length)a.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else if(e.id&&r.push(`#${e.id}`),o=e.className,o&&p(o,"String"))for(i=o.split(/\s+/),u=0;u<i.length;u++)r.push(`.${i[u]}`);const f=["aria-label","type","name","title","alt"];for(u=0;u<f.length;u++)s=f[u],c=e.getAttribute(s),c&&r.push(`[${s}="${c}"]`);return r.join("")}const S="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,E=["debug","info","warn","error","log","assert","trace"],$={};function x(t){if(!("console"in m))return t();const n=m.console,e={},r=Object.keys($);r.forEach((t=>{const r=$[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}const A=function(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return S?E.forEach((e=>{n[e]=(...n)=>{t&&x((()=>{m.console[e](`Sentry Logger [${e}]:`,...n)}))}})):E.forEach((t=>{n[t]=()=>{}})),n}();function C(t,n=!1){const{host:e,path:r,pass:o,port:i,projectId:s,protocol:c,publicKey:u}=t;return`${c}://${u}${n&&o?`:${o}`:""}@${e}${i?`:${i}`:""}/${r?`${r}/`:r}${s}`}class N extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}const k=50,D="?",T=/captureMessage|captureException/;const O="<anonymous>";function R(t){if(function(t){switch(l.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return y(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...I(t)};if(n=t,"undefined"!=typeof Event&&y(n,Event)){const n={type:t.type,target:j(t.target),currentTarget:j(t.currentTarget),...I(t)};return"undefined"!=typeof CustomEvent&&y(t,CustomEvent)&&(n.detail=t.detail),n}return t;var n}function j(t){try{return n=t,"undefined"!=typeof Element&&y(n,Element)?function(t,n={}){if(!t)return"<unknown>";try{let e=t;const r=5,o=[];let i=0,s=0;const c=" > ",u=c.length;let a;const f=Array.isArray(n)?n:n.keyAttrs,h=!Array.isArray(n)&&n.maxStringLength||w;for(;e&&i++<r&&(a=_(e,f),!("html"===a||i>1&&s+o.length*u+a.length>=h));)o.push(a),s+=a.length,e=e.parentNode;return o.reverse().join(c)}catch(t){return"<unknown>"}}(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}var n}function I(t){if("object"==typeof t&&null!==t){const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}return{}}function P(t){return U(t,new Map)}function U(t,n){if(function(t){if(!d(t))return!1;try{const n=Object.getPrototypeOf(t).constructor.name;return!n||"Object"===n}catch(t){return!0}}(t)){const e=n.get(t);if(void 0!==e)return e;const r={};n.set(t,r);for(const e of Object.keys(t))void 0!==t[e]&&(r[e]=U(t[e],n));return r}if(Array.isArray(t)){const e=n.get(t);if(void 0!==e)return e;const r=[];return n.set(t,r),t.forEach((t=>{r.push(U(t,n))})),r}return t}function L(){const t=m,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function M(t,n=100,e=1/0){try{return B("",t,n,e)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function B(t,n,e=1/0,r=1/0,o=function(){const t="function"==typeof WeakSet,n=t?new WeakSet:[];return[function(e){if(t)return!!n.has(e)||(n.add(e),!1);for(let t=0;t<n.length;t++)if(n[t]===e)return!0;return n.push(e),!1},function(e){if(t)n.delete(e);else for(let t=0;t<n.length;t++)if(n[t]===e){n.splice(t,1);break}}]}()){const[i,s]=o;if(null==n||["number","boolean","string"].includes(typeof n)&&!Number.isNaN(n))return n;const c=function(t,n){try{if("domain"===t&&n&&"object"==typeof n&&n.t)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&n===global)return"[Global]";if("undefined"!=typeof window&&n===window)return"[Window]";if("undefined"!=typeof document&&n===document)return"[Document]";if("object"==typeof(e=n)&&null!==e&&(e.__isVue||e.o))return"[VueViewModel]";if(function(t){return d(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(n))return"[SyntheticEvent]";if("number"==typeof n&&n!=n)return"[NaN]";if("function"==typeof n)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||O}catch(t){return O}}(n)}]`;if("symbol"==typeof n)return`[${String(n)}]`;if("bigint"==typeof n)return`[BigInt: ${String(n)}]`;const r=function(t){const n=Object.getPrototypeOf(t);return n?n.constructor.name:"null prototype"}(n);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var e}(t,n);if(!c.startsWith("[object "))return c;if(n.__sentry_skip_normalization__)return n;const u="number"==typeof n.__sentry_override_normalization_depth__?n.__sentry_override_normalization_depth__:e;if(0===u)return c.replace("object ","");if(i(n))return"[Circular ~]";const a=n;if(a&&"function"==typeof a.toJSON)try{return B("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(n)?[]:{};let h=0;const l=R(n);for(const t in l){if(!Object.prototype.hasOwnProperty.call(l,t))continue;if(h>=r){f[t]="[MaxProperties ~]";break}const n=l[t];f[t]=B(t,n,u-1,r,o),h++}return s(n),f}function G(t,n){const e=n.replace(/\\/g,"/").replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");let r=t;try{r=decodeURI(t)}catch(t){}return r.replace(/\\/g,"/").replace(/webpack:\/?/g,"").replace(new RegExp(`(file://)?/*${e}/*`,"ig"),"app:///")}const H=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function J(t){const n=function(t){const n=t.length>1024?`<truncated>${t.slice(-1024)}`:t,e=H.exec(n);return e?e.slice(1):[]}(t),e=n[0];let r=n[1];return e||r?(r&&(r=r.slice(0,r.length-1)),e+r):"."}var z;function W(t){return new F((n=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(z||(z={}));class F{constructor(t){F.prototype.__init.call(this),F.prototype.__init2.call(this),F.prototype.__init3.call(this),F.prototype.__init4.call(this),this.i=z.PENDING,this.u=[];try{t(this.h,this.l)}catch(t){this.l(t)}}then(t,n){return new F(((e,r)=>{this.u.push([!1,n=>{if(t)try{e(t(n))}catch(t){r(t)}else e(n)},t=>{if(n)try{e(n(t))}catch(t){r(t)}else r(t)}]),this.p()}))}catch(t){return this.then((t=>t),t)}finally(t){return new F(((n,e)=>{let r,o;return this.then((n=>{o=!1,r=n,t&&t()}),(n=>{o=!0,r=n,t&&t()})).then((()=>{o?e(r):n(r)}))}))}__init(){this.h=t=>{this.m(z.RESOLVED,t)}}__init2(){this.l=t=>{this.m(z.REJECTED,t)}}__init3(){this.m=(t,n)=>{this.i===z.PENDING&&(g(n)?n.then(this.h,this.l):(this.i=t,this.v=n,this.p()))}}__init4(){this.p=()=>{if(this.i===z.PENDING)return;const t=this.u.slice();this.u=[],t.forEach((t=>{t[0]||(this.i===z.RESOLVED&&t[1](this.v),this.i===z.REJECTED&&t[2](this.v),t[0]=!0)}))}}}function K(t){const n=[];function e(t){return n.splice(n.indexOf(t),1)[0]}return{$:n,add:function(r){if(!(void 0===t||n.length<t))return o=new N("Not adding Promise because buffer limit was reached."),new F(((t,n)=>{n(o)}));var o;const i=r();return-1===n.indexOf(i)&&n.push(i),i.then((()=>e(i))).then(null,(()=>e(i).then(null,(()=>{})))),i},drain:function(t){return new F(((e,r)=>{let o=n.length;if(!o)return e(!0);const i=setTimeout((()=>{t&&t>0&&e(!1)}),t);n.forEach((t=>{W(t).then((()=>{--o||(clearTimeout(i),e(!0))}),r)}))}))}}}function V(t,n=!1){return!(n||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==t&&!t.includes("node_modules/")}const Y=1e3;function q(){return Date.now()/Y}const Z=function(){const{performance:t}=m;if(!t||!t.now)return q;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/Y}();function Q(t,n=[]){return[t,n]}function X(t,n){const e=t[1];for(const t of e){if(n(t,t[0].type))return!0}return!1}function tt(t){return m.__SENTRY__&&m.__SENTRY__.encodePolyfill?m.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function nt(t){const[n,e]=t;let r=JSON.stringify(n);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[tt(r),t]:r.push("string"==typeof t?tt(t):t)}for(const t of e){const[n,e]=t;if(o(`\n${JSON.stringify(n)}\n`),"string"==typeof e||e instanceof Uint8Array)o(e);else{let t;try{t=JSON.stringify(e)}catch(n){t=JSON.stringify(M(e))}o(t)}}return"string"==typeof r?r:function(t){const n=t.reduce(((t,n)=>t+n.length),0),e=new Uint8Array(n);let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}(r)}(()=>{const{performance:t}=m;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,i=o<n,s=t.timing&&t.timing.navigationStart,c="number"==typeof s?Math.abs(s+e-r):n;(i||c<n)&&(o<=c&&t.timeOrigin)})();const et={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",statsd:"statsd"};function rt(t){return et[t]}function ot(t){if(!t||!t.sdk)return;const{name:n,version:e}=t.sdk;return{name:n,version:e}}const it=6e4;function st(t,{statusCode:n,headers:e},r=Date.now()){const o={...t},i=e&&e["x-sentry-rate-limits"],s=e&&e["retry-after"];if(i)for(const t of i.trim().split(",")){const[n,e]=t.split(":",2),i=parseInt(n,10),s=1e3*(isNaN(i)?60:i);if(e)for(const t of e.split(";"))o[t]=r+s;else o.all=r+s}else s?o.all=r+function(t,n=Date.now()){const e=parseInt(`${t}`,10);if(!isNaN(e))return 1e3*e;const r=Date.parse(`${t}`);return isNaN(r)?it:r-n}(s,r):429===n&&(o.all=r+6e4);return o}const ct="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function ut(){return at(m),m}function at(t){return t.__SENTRY__||(t.__SENTRY__={extensions:{}}),t.__SENTRY__}const ft="production";function ht(t){const n=Z(),e={sid:L(),init:!0,timestamp:n,started:n,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return P({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(e)};return t&&lt(e,t),e}function lt(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),t.did||n.did||(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||Z(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:L()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}const pt="_sentrySpan";function dt(t,n){n?function(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch(e){S&&A.log(`Failed to add non-enumerable property "${n}" to object`,t)}}(t,pt,n):delete t[pt]}function gt(t){return t[pt]}class yt{constructor(){this._=!1,this.S=[],this.A=[],this.C=[],this.N=[],this.k={},this.D={},this.T={},this.O={},this.R={},this.j=mt()}clone(){const t=new yt;return t.C=[...this.C],t.D={...this.D},t.T={...this.T},t.O={...this.O},t.k=this.k,t.I=this.I,t.P=this.P,t.U=this.U,t.L=this.L,t.A=[...this.A],t.M=this.M,t.N=[...this.N],t.R={...this.R},t.j={...this.j},t.B=this.B,dt(t,gt(this)),t}setClient(t){this.B=t}getClient(){return this.B}addScopeListener(t){this.S.push(t)}addEventProcessor(t){return this.A.push(t),this}setUser(t){return this.k=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.P&&lt(this.P,{user:t}),this.G(),this}getUser(){return this.k}getRequestSession(){return this.M}setRequestSession(t){return this.M=t,this}setTags(t){return this.D={...this.D,...t},this.G(),this}setTag(t,n){return this.D={...this.D,[t]:n},this.G(),this}setExtras(t){return this.T={...this.T,...t},this.G(),this}setExtra(t,n){return this.T={...this.T,[t]:n},this.G(),this}setFingerprint(t){return this.L=t,this.G(),this}setLevel(t){return this.I=t,this.G(),this}setTransactionName(t){return this.U=t,this.G(),this}setContext(t,n){return null===n?delete this.O[t]:this.O[t]=n,this.G(),this}setSession(t){return t?this.P=t:delete this.P,this.G(),this}getSession(){return this.P}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof yt?[n.getScopeData(),n.getRequestSession()]:d(n)?[t,t.requestSession]:[],{tags:o,extra:i,user:s,contexts:c,level:u,fingerprint:a=[],propagationContext:f}=e||{};return this.D={...this.D,...o},this.T={...this.T,...i},this.O={...this.O,...c},s&&Object.keys(s).length&&(this.k=s),u&&(this.I=u),a.length&&(this.L=a),f&&(this.j=f),r&&(this.M=r),this}clear(){return this.C=[],this.D={},this.T={},this.k={},this.O={},this.I=void 0,this.U=void 0,this.L=void 0,this.M=void 0,this.P=void 0,dt(this,void 0),this.N=[],this.j=mt(),this.G(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:100;if(e<=0)return this;const r={timestamp:q(),...t},o=this.C;return o.push(r),this.C=o.length>e?o.slice(-e):o,this.G(),this}getLastBreadcrumb(){return this.C[this.C.length-1]}clearBreadcrumbs(){return this.C=[],this.G(),this}addAttachment(t){return this.N.push(t),this}clearAttachments(){return this.N=[],this}getScopeData(){return{breadcrumbs:this.C,attachments:this.N,contexts:this.O,tags:this.D,extra:this.T,user:this.k,level:this.I,fingerprint:this.L||[],eventProcessors:this.A,propagationContext:this.j,sdkProcessingMetadata:this.R,transactionName:this.U,span:gt(this)}}setSDKProcessingMetadata(t){return this.R={...this.R,...t},this}setPropagationContext(t){return this.j=t,this}getPropagationContext(){return this.j}captureException(t,n){const e=n&&n.event_id?n.event_id:L();if(!this.B)return A.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this.B.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:L();if(!this.B)return A.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.B.captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:L();return this.B?(this.B.captureEvent(t,{...n,event_id:e},this),e):(A.warn("No client configured on scope - will not capture event!"),e)}G(){this._||(this._=!0,this.S.forEach((t=>{t(this)})),this._=!1)}}function mt(){return{traceId:L(),spanId:L().substring(16)}}const vt=parseFloat("8.0.0-alpha.9"),bt=100;class wt{constructor(t,n,e,r=vt){let o,i;this.H=r,n?o=n:(o=new yt,o.setClient(t)),e?i=e:(i=new yt,i.setClient(t)),this.J=[{scope:o}],t&&this.bindClient(t),this.W=i}bindClient(t){const n=this.getStackTop();n.client=t,n.scope.setClient(t),t&&t.init()}withScope(t){const n=this.F();let e;try{e=t(n)}catch(t){throw this.K(),t}return g(e)?e.then((t=>(this.K(),t)),(t=>{throw this.K(),t})):(this.K(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.W}getStack(){return this.J}getStackTop(){return this.J[this.J.length-1]}captureException(t,n){const e=n&&n.event_id?n.event_id:L(),r=new Error("Sentry syntheticException");return this.getScope().captureException(t,{originalException:t,syntheticException:r,...n,event_id:e}),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:L(),o=new Error(t);return this.getScope().captureMessage(t,n,{originalException:t,syntheticException:o,...e,event_id:r}),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:L();return this.getScope().captureEvent(t,{...n,event_id:e}),e}addBreadcrumb(t,n){const{client:e}=this.getStackTop();if(!e)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:o=bt}=e.getOptions&&e.getOptions()||{};if(o<=0)return;const i={timestamp:q(),...t},s=r?x((()=>r(i,n))):i;null!==s&&(e.emit("beforeAddBreadcrumb",s,n),this.getIsolationScope().addBreadcrumb(s,o))}setUser(t){this.getIsolationScope().setUser(t)}setTags(t){this.getIsolationScope().setTags(t)}setExtras(t){this.getIsolationScope().setExtras(t)}setTag(t,n){this.getIsolationScope().setTag(t,n)}setExtra(t,n){this.getIsolationScope().setExtra(t,n)}setContext(t,n){this.getIsolationScope().setContext(t,n)}getIntegration(t){const n=this.getClient();if(!n)return null;try{return n.getIntegrationByName(t.id)||null}catch(n){return ct&&A.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}captureSession(t=!1){if(t)return this.endSession();this.V()}endSession(){const t=this.getStackTop().scope,n=t.getSession();n&&function(t,n){let e={};n?e={status:n}:"ok"===t.status&&(e={status:"exited"}),lt(t,e)}(n),this.V(),t.setSession()}startSession(t){const{scope:n,client:e}=this.getStackTop(),{release:r,environment:o=ft}=e&&e.getOptions()||{},{userAgent:i}=m.navigator||{},s=ht({release:r,environment:o,user:n.getUser(),...i&&{userAgent:i},...t}),c=n.getSession&&n.getSession();return c&&"ok"===c.status&&lt(c,{status:"exited"}),this.endSession(),n.setSession(s),s}V(){const{scope:t,client:n}=this.getStackTop(),e=t.getSession();e&&n&&n.captureSession&&n.captureSession(e)}F(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}K(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}}function _t(){const t=at(ut());return t.hub||(t.hub=new wt(void 0,v("defaultCurrentScope",(()=>new yt)),v("defaultIsolationScope",(()=>new yt)))),t.hub}function St(t){const n=at(t);return n.acs?n.acs:{getCurrentHub:_t,withIsolationScope:xt,withScope:Et,withSetScope:$t,withSetIsolationScope:(t,n)=>xt(n),getCurrentScope:()=>_t().getScope(),getIsolationScope:()=>_t().getIsolationScope()}}function Et(t){return _t().withScope(t)}function $t(t,n){const e=_t();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function xt(t){return _t().withScope((()=>t(_t().getIsolationScope())))}function At(){return St(ut()).getCurrentScope().getClient()}const Ct="sentry.source",Nt="sentry.sample_rate",kt="sentry.op",Dt="sentry.origin",Tt=0,Ot=1,Rt=1;function jt(t){const{spanId:n,traceId:e}=t.spanContext(),{data:r,op:o,parent_span_id:i,status:s,origin:c}=Ut(t);return P({data:r,op:o,parent_span_id:i,span_id:n,status:s,trace_id:e,origin:c})}function It(t){return"number"==typeof t?Pt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Pt(t.getTime()):Z()}function Pt(t){return t>9999999999?t/1e3:t}function Ut(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{const{spanId:n,traceId:e}=t.spanContext();if(function(t){const n=t;return!!(n.attributes&&n.startTime&&n.name&&n.endTime&&n.status)}(t)){const{attributes:r,startTime:o,name:i,endTime:s,parentSpanId:c,status:u}=t;return P({span_id:n,trace_id:e,data:r,description:i,parent_span_id:c,start_timestamp:It(o),timestamp:It(s)||void 0,status:Lt(u),op:r[kt],origin:r[Dt],Y:void 0})}return{span_id:n,trace_id:e}}catch(t){return{}}}function Lt(t){if(t&&t.code!==Tt)return t.code===Ot?"ok":t.message||"unknown_error"}const Mt="_sentryRootSpan";function Bt(t){return t[Mt]||t}const Gt="_frozenDsc";function Ht(t){const n=At();if(!n)return{};const e=function(t,n){const e=n.getOptions(),{publicKey:r}=n.getDsn()||{},o=P({environment:e.environment||ft,release:e.release,public_key:r,trace_id:t});return n.emit("createDsc",o),o}(Ut(t).trace_id||"",n),r=Bt(t);if(!r)return e;const o=r[Gt];if(o)return o;const i=Ut(r),s=i.data||{},c=s[Nt];null!=c&&(e.sample_rate=`${c}`);const u=s[Ct];return u&&"url"!==u&&(e.transaction=i.description),e.sampled=String(function(t){const{traceFlags:n}=t.spanContext();return n===Rt}(r)),n.emit("createDsc",e),e}function Jt(t,n,e,r){const o=ot(e),i=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,n){n&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||n.name,t.sdk.version=t.sdk.version||n.version,t.sdk.integrations=[...t.sdk.integrations||[],...n.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...n.packages||[]])}(t,e&&e.sdk);const s=function(t,n,e,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...n&&{sdk:n},...!!e&&r&&{dsn:C(r)},...o&&{trace:P({...o})}}}(t,o,r,n);delete t.sdkProcessingMetadata;return Q(s,[[{type:i},t]])}function zt(t,n){const{fingerprint:e,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=n;!function(t,n){const{extra:e,tags:r,user:o,contexts:i,level:s,transactionName:c}=n,u=P(e);u&&Object.keys(u).length&&(t.extra={...u,...t.extra});const a=P(r);a&&Object.keys(a).length&&(t.tags={...a,...t.tags});const f=P(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=P(i);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts});s&&(t.level=s);c&&"transaction"!==t.type&&(t.transaction=c)}(t,n),r&&function(t,n){t.contexts={trace:jt(n),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ht(n),...t.sdkProcessingMetadata};const e=Bt(n),r=Ut(e).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,n){t.fingerprint=t.fingerprint?function(t){return Array.isArray(t)?t:[t]}(t.fingerprint):[],n&&(t.fingerprint=t.fingerprint.concat(n));t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}(t,e),function(t,n){const e=[...t.breadcrumbs||[],...n];t.breadcrumbs=e.length?e:void 0}(t,o),function(t,n){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...n}}(t,i)}const Wt="7";function Ft(t,n){return e={sentry_key:t.publicKey,sentry_version:Wt,...n&&{sentry_client:`${n.name}/${n.version}`}},Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&");var e}const Kt=30;function Vt(t,n,e=K(t.bufferSize||Kt)){let r={};return{send:function(o){const i=[];if(X(o,((n,e)=>{const o=rt(e);if(function(t,n,e=Date.now()){return function(t,n){return t[n]||t.all||0}(t,n)>e}(r,o)){const r=Yt(n,e);t.recordDroppedEvent("ratelimit_backoff",o,r)}else i.push(n)})),0===i.length)return W({});const s=Q(o[0],i),c=n=>{X(s,((e,r)=>{const o=Yt(e,r);t.recordDroppedEvent(n,rt(r),o)}))};return e.add((()=>n({body:nt(s)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&ct&&A.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=st(r,t),t)),(t=>{throw c("network_error"),t})))).then((t=>t),(t=>{if(t instanceof N)return ct&&A.error("Skipped sending event because buffer is full."),c("queue_overflow"),W({});throw t}))},flush:t=>e.drain(t)}}function Yt(t,n){if("event"===n||"transaction"===n)return Array.isArray(t)?t[1]:void 0}var qt="object"==typeof globalThis?globalThis:global,Zt="1.7.0",Qt=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var Xt=function(t){var n=new Set([t]),e=new Set,r=t.match(Qt);if(!r)return function(){return!1};var o=+r[1],i=+r[2],s=+r[3];if(null!=r[4])return function(n){return n===t};function c(t){return e.add(t),!1}function u(t){return n.add(t),!0}return function(t){if(n.has(t))return!0;if(e.has(t))return!1;var r=t.match(Qt);if(!r)return c(t);var a=+r[1],f=+r[2],h=+r[3];return null!=r[4]||o!==a?c(t):0===o?i===f&&s<=h?u(t):c(t):i<=f?u(t):c(t)}}(Zt),tn=Zt.split(".")[0],nn=Symbol.for("opentelemetry.js.api."+tn),en=qt;function rn(t,n,e,r){var o;void 0===r&&(r=!1);var i=en[nn]=null!==(o=en[nn])&&void 0!==o?o:{version:Zt};if(!r&&i[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return e.error(s.stack||s.message),!1}if(i.version!==Zt){s=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+t+" does not match previously registered API v"+Zt);return e.error(s.stack||s.message),!1}return i[t]=n,e.debug("@opentelemetry/api: Registered a global for "+t+" v"+Zt+"."),!0}function on(t){var n,e,r=null===(n=en[nn])||void 0===n?void 0:n.version;if(r&&Xt(r))return null===(e=en[nn])||void 0===e?void 0:e[t]}function sn(t,n){n.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+Zt+".");var e=en[nn];e&&delete e[t]}var cn,un=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},an=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},fn=function(){function t(t){this.q=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("debug",this.q,t)},t.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("error",this.q,t)},t.prototype.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("info",this.q,t)},t.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("warn",this.q,t)},t.prototype.verbose=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return hn("verbose",this.q,t)},t}();function hn(t,n,e){var r=on("diag");if(r)return e.unshift(n),r[t].apply(r,an([],un(e),!1))}!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(cn||(cn={}));var ln=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},pn=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},dn=function(){function t(){function t(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=on("diag");if(r)return r[t].apply(r,pn([],ln(n),!1))}}var n=this;n.setLogger=function(t,e){var r,o,i;if(void 0===e&&(e={logLevel:cn.INFO}),t===n){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error(null!==(r=s.stack)&&void 0!==r?r:s.message),!1}"number"==typeof e&&(e={logLevel:e});var c=on("diag"),u=function(t,n){function e(e,r){var o=n[e];return"function"==typeof o&&t>=r?o.bind(n):function(){}}return t<cn.NONE?t=cn.NONE:t>cn.ALL&&(t=cn.ALL),n=n||{},{error:e("error",cn.ERROR),warn:e("warn",cn.WARN),info:e("info",cn.INFO),debug:e("debug",cn.DEBUG),verbose:e("verbose",cn.VERBOSE)}}(null!==(o=e.logLevel)&&void 0!==o?o:cn.INFO,t);if(c&&!e.suppressOverrideMessage){var a=null!==(i=(new Error).stack)&&void 0!==i?i:"<failed to generate stacktrace>";c.warn("Current logger will be overwritten from "+a),u.warn("Current logger will overwrite one already registered from "+a)}return rn("diag",u,n,!0)},n.disable=function(){sn("diag",n)},n.createComponentLogger=function(t){return new fn(t)},n.verbose=t("verbose"),n.debug=t("debug"),n.info=t("info"),n.warn=t("warn"),n.error=t("error")}return t.instance=function(){return this.Z||(this.Z=new t),this.Z},t}();var gn,yn=function t(n){var e=this;e.X=n?new Map(n):new Map,e.getValue=function(t){return e.X.get(t)},e.setValue=function(n,r){var o=new t(e.X);return o.X.set(n,r),o},e.deleteValue=function(n){var r=new t(e.X);return r.X.delete(n),r}},mn=new yn,vn=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},bn=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},wn=function(){function t(){}return t.prototype.active=function(){return mn},t.prototype.with=function(t,n,e){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];return n.call.apply(n,bn([e],vn(r),!1))},t.prototype.bind=function(t,n){return n},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),_n=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Sn=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},En="context",$n=new wn,xn=function(){function t(){}return t.getInstance=function(){return this.Z||(this.Z=new t),this.Z},t.prototype.setGlobalContextManager=function(t){return rn(En,t,dn.instance())},t.prototype.active=function(){return this.tt().active()},t.prototype.with=function(t,n,e){for(var r,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(r=this.tt()).with.apply(r,Sn([t,n,e],_n(o),!1))},t.prototype.bind=function(t,n){return this.tt().bind(t,n)},t.prototype.tt=function(){return on(En)||$n},t.prototype.disable=function(){this.tt().disable(),sn(En,dn.instance())},t}(),An=xn.getInstance(),Cn=(gn="OpenTelemetry SDK Context Key SUPPRESS_TRACING",Symbol.for(gn));function Nn(t,n){return null!=t?t:n()}const kn=Symbol("AgentBaseInternalState");class Dn extends h.Agent{constructor(t){super(t),this[kn]={}}isSecureEndpoint(t){if(t){if("boolean"==typeof t.secureEndpoint)return t.secureEndpoint;if("string"==typeof t.protocol)return"https:"===t.protocol}const{stack:n}=new Error;return"string"==typeof n&&n.split("\n").some((t=>-1!==t.indexOf("(https.js:")||-1!==t.indexOf("node:https:")))}createSocket(t,n,e){const r={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then((()=>this.connect(t,r))).then((o=>{if(o instanceof h.Agent)return o.addRequest(t,r);this[kn].currentSocket=o,super.createSocket(t,n,e)}),e)}createConnection(){const t=this[kn].currentSocket;if(this[kn].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return Nn(this[kn].defaultPort,(()=>"https:"===this.protocol?443:80))}set defaultPort(t){this[kn]&&(this[kn].defaultPort=t)}get protocol(){return Nn(this[kn].protocol,(()=>this.isSecureEndpoint()?"https:":"http:"))}set protocol(t){this[kn]&&(this[kn].protocol=t)}}function Tn(...t){A.log("[https-proxy-agent:parse-proxy-response]",...t)}function On(t){return new Promise(((n,e)=>{let r=0;const o=[];function i(){const c=t.read();c?function(c){o.push(c),r+=c.length;const u=Buffer.concat(o,r),a=u.indexOf("\r\n\r\n");if(-1===a)return Tn("have not received end of HTTP headers yet..."),void i();const f=u.slice(0,a).toString("ascii").split("\r\n"),h=f.shift();if(!h)return t.destroy(),e(new Error("No header received from proxy CONNECT response"));const l=h.split(" "),p=+l[1],d=l.slice(2).join(" "),g={};for(const n of f){if(!n)continue;const r=n.indexOf(":");if(-1===r)return t.destroy(),e(new Error(`Invalid header from proxy CONNECT response: "${n}"`));const o=n.slice(0,r).toLowerCase(),i=n.slice(r+1).trimStart(),s=g[o];"string"==typeof s?g[o]=[s,i]:Array.isArray(s)?s.push(i):g[o]=i}Tn("got proxy server response: %o %o",h,g),s(),n({connect:{statusCode:p,statusText:d,headers:g},buffered:u})}(c):t.once("readable",i)}function s(){t.removeListener("end",c),t.removeListener("error",u),t.removeListener("readable",i)}function c(){s(),Tn("onend"),e(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){s(),Tn("onerror %o",t),e(t)}t.on("error",u),t.on("end",c),i()}))}function Rn(...t){A.log("[https-proxy-agent]",...t)}class jn extends Dn{static __initStatic(){this.protocols=["http","https"]}constructor(t,n){var e,r;super(n),this.options={},this.proxy="string"==typeof t?new URL(t):t,this.proxyHeaders=(e=function(t){let n,e=t[0],r=1;for(;r<t.length;){const o=t[r],i=t[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==e)return;"access"===o||"optionalAccess"===o?(n=e,e=i(e)):"call"!==o&&"optionalCall"!==o||(e=i(((...t)=>e.call(n,...t))),n=void 0)}return e}([n,"optionalAccess",t=>t.headers]),r=()=>({}),null!=e?e:r()),Rn("Creating new HttpsProxyAgent instance: %o",this.proxy.href);const o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):"https:"===this.proxy.protocol?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?Pn(n,"headers"):null,host:o,port:i}}async connect(t,n){const{proxy:e}=this;if(!n.host)throw new TypeError('No "host" provided');let r;if("https:"===e.protocol){Rn("Creating `tls.Socket`: %o",this.connectOpts);const t=this.connectOpts.servername||this.connectOpts.host;r=f.connect({...this.connectOpts,servername:t&&a.isIP(t)?void 0:t})}else Rn("Creating `net.Socket`: %o",this.connectOpts),r=a.connect(this.connectOpts);const o="function"==typeof this.proxyHeaders?this.proxyHeaders():{...this.proxyHeaders},i=a.isIPv6(n.host)?`[${n.host}]`:n.host;let s=`CONNECT ${i}:${n.port} HTTP/1.1\r\n`;if(e.username||e.password){const t=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(t).toString("base64")}`}o.Host=`${i}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const t of Object.keys(o))s+=`${t}: ${o[t]}\r\n`;const c=On(r);r.write(`${s}\r\n`);const{connect:u,buffered:h}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),200===u.statusCode){if(t.once("socket",In),n.secureEndpoint){Rn("Upgrading socket connection to TLS");const t=n.servername||n.host;return f.connect({...Pn(n,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const l=new a.Socket({writable:!1});return l.readable=!0,t.once("socket",(t=>{Rn("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),l}}function In(t){t.resume()}function Pn(t,...n){const e={};let r;for(r in t)n.includes(r)||(e[r]=t[r]);return e}function Un(t,n){return null!=t?t:n()}jn.__initStatic();const Ln=32768;function Mn(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Bn(t){let n,e=t[0],r=1;for(;r<t.length;){const o=t[r],i=t[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==e)return;"access"===o||"optionalAccess"===o?(n=e,e=i(e)):"call"!==o&&"optionalCall"!==o||(e=i(((...t)=>e.call(n,...t))),n=void 0)}return e}const Gn=n;let Hn,Jn=!1;function zn(t){Gn.debug&&console.log(`[ANR Worker] ${t}`)}var Wn,Fn,Kn;const Vn=function(t){let n;try{n=new URL(t.url)}catch(n){return x((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),Vt(t,(()=>Promise.resolve({})))}const e="https:"===n.protocol,r=function(t,n){const{no_proxy:e}=process.env;return e&&e.split(",").some((n=>t.host.endsWith(n)||t.hostname.endsWith(n)))?void 0:n}(n,t.proxy||(e?process.env.https_proxy:void 0)||process.env.http_proxy),o=e?s:i,a=void 0!==t.keepAlive&&t.keepAlive,f=r?new jn(r):new o.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return An.with(function(t){return t.setValue(Cn,!0)}(An.active()),(()=>{const n=function(t,n,e){const{hostname:r,pathname:o,port:i,protocol:s,search:a}=new URL(t.url);return function(f){return new Promise(((h,l)=>{let p=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>Ln&&(d["content-encoding"]="gzip",p=p.pipe(u()));const g=n.request({method:"POST",agent:e,headers:d,hostname:r,path:`${o}${a}`,port:i,protocol:s,ca:t.caCerts},(t=>{t.on("data",(()=>{})),t.on("end",(()=>{})),t.setEncoding("utf8");const n=Un(t.headers["retry-after"],(()=>null)),e=Un(t.headers["x-sentry-rate-limits"],(()=>null));h({statusCode:t.statusCode,headers:{"retry-after":n,"x-sentry-rate-limits":Array.isArray(e)?e[0]:e}})}));g.on("error",l),p.pipe(g)}))}}(t,Un(t.httpModule,(()=>o)),f);return Vt(t,n)}))}({url:(Wn=Gn.dsn,Fn=Gn.tunnel,Kn=Gn.sdkMetadata.sdk,Fn||`${function(t){return`${function(t){const n=t.protocol?`${t.protocol}:`:"",e=t.port?`:${t.port}`:"";return`${n}//${t.host}${e}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(Wn)}?${Ft(Wn,Kn)}`),recordDroppedEvent:()=>{}});async function Yn(){if(Hn){zn("Sending abnormal session"),lt(Hn,{status:"abnormal",abnormal_mechanism:"anr_foreground"});const t=function(t,n,e,r){const o=ot(e);return Q({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&n&&{dsn:C(n)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(Hn,Gn.dsn,Gn.sdkMetadata,Gn.tunnel);zn(JSON.stringify(t)),await Vn.send(t);try{Bn([e,"optionalAccess",t=>t.postMessage,"call",t=>t("session-ended")])}catch(t){}}}function qn(t){if(!t)return;const n=function(t){if(!t.length)return[];const n=Array.from(t);return/sentryWrapped/.test(n[n.length-1].function||"")&&n.pop(),n.reverse(),T.test(n[n.length-1].function||"")&&(n.pop(),T.test(n[n.length-1].function||"")&&n.pop()),n.slice(0,k).map((t=>({...t,filename:t.filename||n[n.length-1].filename,function:t.function||D})))}(t);if(Gn.appRootPath)for(const t of n)t.filename&&(t.filename=G(t.filename,Gn.appRootPath));return n}async function Zn(t,n){if(Jn)return;Jn=!0,await Yn(),zn("Sending event");const e={event_id:L(),contexts:Gn.contexts,release:Gn.release,environment:Gn.environment,dist:Gn.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${Gn.anrThreshold} ms`,stacktrace:{frames:qn(t)},mechanism:{type:"ANR"}}]},tags:Gn.staticTags};n&&function(t,n){if(zt(t,n),!Bn([t,"access",t=>t.contexts,"optionalAccess",t=>t.trace])){const{traceId:e,spanId:r,parentSpanId:o}=n.propagationContext;t.contexts={trace:{trace_id:e,span_id:r,parent_span_id:o},...t.contexts}}}(e,n);const r=Jt(e,Gn.dsn,Gn.sdkMetadata,Gn.tunnel);zn(JSON.stringify(r)),await Vn.send(r),await Vn.flush(2e3),setTimeout((()=>{process.exit(0)}),5e3)}let Qn;if(zn("Started"),Gn.captureStackTrace){zn("Connecting to debugger");const n=new t;n.connectToMainThread(),zn("Connected to debugger");const e=new Map;n.on("Debugger.scriptParsed",(t=>{e.set(t.params.scriptId,t.params.url)})),n.on("Debugger.paused",(t=>{if("other"===t.params.reason)try{zn("Debugger paused");const i=[...t.params.callFrames],s=Gn.appRootPath?function(t=(process.argv[1]?J(process.argv[1]):process.cwd()),n="\\"===o){const e=n?Mn(t):t;return t=>{if(!t)return;const o=n?Mn(t):t;let{dir:i,base:s,ext:c}=r.parse(o);".js"!==c&&".mjs"!==c&&".cjs"!==c||(s=s.slice(0,-1*c.length)),i||(i=".");const u=i.lastIndexOf("/node_modules");if(u>-1)return`${i.slice(u+14).replace(/\//g,".")}:${s}`;if(i.startsWith(e)){let t=i.slice(e.length+1).replace(/\//g,".");return t&&(t+=":"),t+=s,t}return s}}(Gn.appRootPath):()=>{},c=i.map((t=>function(t,n,e){const r=n?n.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,i=t.location.lineNumber?t.location.lineNumber+1:void 0;return P({filename:r,module:e(r),function:t.functionName||D,colno:o,lineno:i,in_app:r?V(r):void 0})}(t,e.get(t.location.scriptId),s)));n.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,e)=>{t&&zn(`Error executing script: '${t.message}'`);const r=e&&e.result?e.result.value:void 0;n.post("Debugger.resume"),n.post("Debugger.disable"),Zn(c,r).then(null,(()=>{zn("Sending ANR event failed.")}))}))}catch(t){throw n.post("Debugger.resume"),n.post("Debugger.disable"),t}})),Qn=()=>{try{n.post("Debugger.enable",(()=>{n.post("Debugger.pause")}))}catch(t){}}}const{poll:Xn}=function(t,n,e,r){const o=t();let i=!1,s=!0;return setInterval((()=>{const t=o.getTimeMs();!1===i&&t>n+e&&(i=!0,s&&r()),t<n+e&&(i=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{s=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[n,e]=process.hrtime(t);return Math.floor(1e3*n+e/1e6)},reset:()=>{t=process.hrtime()}}}),Gn.pollInterval,Gn.anrThreshold,(function(){zn("Watchdog timeout"),Qn?(zn("Pausing debugger to capture stack trace"),Qn()):(zn("Capturing event without a stack trace"),Zn().then(null,(()=>{zn("Sending ANR event failed on watchdog timeout.")})))}));Bn([e,"optionalAccess",t=>t.on,"call",t=>t("message",(t=>{t.session&&(Hn=ht(t.session)),Xn()}))]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/node",
3
- "version": "8.0.0-alpha.8",
3
+ "version": "8.0.0-alpha.9",
4
4
  "description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
@@ -73,10 +73,10 @@
73
73
  "@opentelemetry/sdk-trace-base": "1.21.0",
74
74
  "@opentelemetry/semantic-conventions": "1.21.0",
75
75
  "@prisma/instrumentation": "5.9.0",
76
- "@sentry/core": "8.0.0-alpha.8",
77
- "@sentry/opentelemetry": "8.0.0-alpha.8",
78
- "@sentry/types": "8.0.0-alpha.8",
79
- "@sentry/utils": "8.0.0-alpha.8"
76
+ "@sentry/core": "8.0.0-alpha.9",
77
+ "@sentry/opentelemetry": "8.0.0-alpha.9",
78
+ "@sentry/types": "8.0.0-alpha.9",
79
+ "@sentry/utils": "8.0.0-alpha.9"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/node": "^14.18.0"