@swifty.js/swifty 0.0.35 → 0.0.36
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.
- package/dist/{acp-A4KRKOHD.js → acp-ZU5LZRUP.js} +1 -1
- package/dist/{agent-VDWIGFIV.js → agent-YDU6HB4S.js} +1 -1
- package/dist/{anthropic-AR2Y4FBR.js → anthropic-GDT73MMP.js} +1 -1
- package/dist/{chunk-IOLGXPUQ.js → chunk-EEEW3GG4.js} +1 -1
- package/dist/chunk-I7XJSLRI.js +4 -0
- package/dist/{chunk-TOM34LJB.js → chunk-MNP6IJ7C.js} +17 -17
- package/dist/{chunk-4B4SGVJH.js → chunk-MTAGHTBG.js} +21 -21
- package/dist/{chunk-TNF3EHFY.js → chunk-Q3NPRV5P.js} +1 -1
- package/dist/chunk-RDVRYI56.js +610 -0
- package/dist/esm-PDXUGWFK.js +229 -0
- package/dist/lib/{agent-TC4HSVMS.js → agent-ZMIS6IH6.js} +2 -2
- package/dist/lib/{chunk-RUDYC7OS.js → chunk-BHSNJT6Z.js} +1 -1
- package/dist/lib/{chunk-OJTISIYU.js → chunk-PJ7354ZG.js} +1 -1
- package/dist/lib/{chunk-S5VWPTME.js → chunk-YUDCYSKO.js} +22 -7
- package/dist/lib/index.d.ts +500 -98
- package/dist/lib/index.js +1140 -375
- package/dist/lib/{permissions-BW4QPZXV.js → permissions-77UJQITR.js} +1 -1
- package/dist/lib/{providers-ROWSB6ND.js → providers-5SJFTU2G.js} +1 -1
- package/dist/main.js +176 -175
- package/dist/{providers-2J4JJYQD.js → providers-FQCJFM3Q.js} +1 -1
- package/dist/{server-ZYK4L22D.js → server-C6H5ZWUG.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-F4FOFPKL.js +0 -611
- package/dist/chunk-YBS5ATGZ.js +0 -4
- package/dist/esm-VBV56AO5.js +0 -229
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a as B2}from"./chunk-I7XJSLRI.js";import{a as Rr,c as lv}from"./chunk-XGUH7SGV.js";import{F as y_,G as av,M as cv,a as ks,b as Ls,d as sv,r as zp}from"./chunk-YKWIZE5D.js";import{a as ov,c as Li,d as Jp,g as vr,h as iv,k as b_,m as vt,n as Dn,o as pe,p as on,q as $p,r as uo,s as he,u as at}from"./chunk-LC7ZWLIH.js";import{a as Lt,c as Nr,d as rv,e as Qp}from"./chunk-IZ7QOBSB.js";var fk=Nr((kTe,mk)=>{"use strict";var Ha=1e3,Fa=Ha*60,Wa=Fa*60,cs=Wa*24,tZ=cs*7,nZ=cs*365.25;mk.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return rZ(e);if(n==="number"&&isFinite(e))return t.long?iZ(e):oZ(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function rZ(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*nZ;case"weeks":case"week":case"w":return n*tZ;case"days":case"day":case"d":return n*cs;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Wa;case"minutes":case"minute":case"mins":case"min":case"m":return n*Fa;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ha;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function oZ(e){var t=Math.abs(e);return t>=cs?Math.round(e/cs)+"d":t>=Wa?Math.round(e/Wa)+"h":t>=Fa?Math.round(e/Fa)+"m":t>=Ha?Math.round(e/Ha)+"s":e+"ms"}function iZ(e){var t=Math.abs(e);return t>=cs?zd(e,t,cs,"day"):t>=Wa?zd(e,t,Wa,"hour"):t>=Fa?zd(e,t,Fa,"minute"):t>=Ha?zd(e,t,Ha,"second"):e+" ms"}function zd(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}});var Qy=Nr((LTe,gk)=>{"use strict";function sZ(e){n.debug=n,n.default=n,n.coerce=a,n.disable=s,n.enable=o,n.enabled=c,n.humanize=fk(),n.destroy=l,Object.keys(e).forEach(p=>{n[p]=e[p]}),n.names=[],n.skips=[],n.formatters={};function t(p){let u=0;for(let d=0;d<p.length;d++)u=(u<<5)-u+p.charCodeAt(d),u|=0;return n.colors[Math.abs(u)%n.colors.length]}n.selectColor=t;function n(p){let u,d=null,m,_;function h(...b){if(!h.enabled)return;let N=h,L=Number(new Date),R=L-(u||L);N.diff=R,N.prev=u,N.curr=L,u=L,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let v=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(G,I)=>{if(G==="%%")return"%";v++;let B=n.formatters[I];if(typeof B=="function"){let k=b[v];G=B.call(N,k),b.splice(v,1),v--}return G}),n.formatArgs.call(N,b),(N.log||n.log).apply(N,b)}return h.namespace=p,h.useColors=n.useColors(),h.color=n.selectColor(p),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==n.namespaces&&(m=n.namespaces,_=n.enabled(p)),_),set:b=>{d=b}}),typeof n.init=="function"&&n.init(h),h}function r(p,u){let d=n(this.namespace+(typeof u>"u"?":":u)+p);return d.log=this.log,d}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let u=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of u)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function i(p,u){let d=0,m=0,_=-1,h=0;for(;d<p.length;)if(m<u.length&&(u[m]===p[d]||u[m]==="*"))u[m]==="*"?(_=m,h=d,m++):(d++,m++);else if(_!==-1)m=_+1,h++,d=h;else return!1;for(;m<u.length&&u[m]==="*";)m++;return m===u.length}function s(){let p=[...n.names,...n.skips.map(u=>"-"+u)].join(",");return n.enable(""),p}function c(p){for(let u of n.skips)if(i(p,u))return!1;for(let u of n.names)if(i(p,u))return!0;return!1}function a(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}gk.exports=sZ});var _k=Nr((En,em)=>{"use strict";En.formatArgs=cZ;En.save=lZ;En.load=pZ;En.useColors=aZ;En.storage=uZ();En.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();En.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function aZ(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function cZ(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+em.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let n=0,r=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(r=n))}),e.splice(r,0,t)}En.log=console.debug||console.log||(()=>{});function lZ(e){try{e?En.storage.setItem("debug",e):En.storage.removeItem("debug")}catch{}}function pZ(){let e;try{e=En.storage.getItem("debug")||En.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function uZ(){try{return localStorage}catch{}}em.exports=Qy()(En);var{formatters:dZ}=em.exports;dZ.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var yk=Nr((MTe,bk)=>{"use strict";var mZ=Lt("os"),hk=Lt("tty"),Zn=B2(),{env:xt}=process,tm;Zn("no-color")||Zn("no-colors")||Zn("color=false")||Zn("color=never")?tm=0:(Zn("color")||Zn("colors")||Zn("color=true")||Zn("color=always"))&&(tm=1);function fZ(){if("FORCE_COLOR"in xt)return xt.FORCE_COLOR==="true"?1:xt.FORCE_COLOR==="false"?0:xt.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(xt.FORCE_COLOR,10),3)}function gZ(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function _Z(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=fZ();r!==void 0&&(tm=r);let o=n?tm:r;if(o===0)return 0;if(n){if(Zn("color=16m")||Zn("color=full")||Zn("color=truecolor"))return 3;if(Zn("color=256"))return 2}if(e&&!t&&o===void 0)return 0;let i=o||0;if(xt.TERM==="dumb")return i;if(process.platform==="win32"){let s=mZ.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in xt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(s=>s in xt)||xt.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in xt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(xt.TEAMCITY_VERSION)?1:0;if(xt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in xt){let s=Number.parseInt((xt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(xt.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(xt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(xt.TERM)||"COLORTERM"in xt?1:i}function Jy(e,t={}){let n=_Z(e,{streamIsTTY:e&&e.isTTY,...t});return gZ(n)}bk.exports={supportsColor:Jy,stdout:Jy({isTTY:hk.isatty(1)}),stderr:Jy({isTTY:hk.isatty(2)})}});var Ek=Nr((Pt,rm)=>{"use strict";var hZ=Lt("tty"),nm=Lt("util");Pt.init=AZ;Pt.log=EZ;Pt.formatArgs=yZ;Pt.save=TZ;Pt.load=IZ;Pt.useColors=bZ;Pt.destroy=nm.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Pt.colors=[6,2,3,4,5,1];try{let e=yk();e&&(e.stderr||e).level>=2&&(Pt.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Pt.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),r=process.env[t];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),e[n]=r,e},{});function bZ(){return"colors"in Pt.inspectOpts?!!Pt.inspectOpts.colors:hZ.isatty(process.stderr.fd)}function yZ(e){let{namespace:t,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),i=` ${o};1m${t} \x1B[0m`;e[0]=i+e[0].split(`
|
|
5
|
+
`).join(`
|
|
6
|
+
`+i),e.push(o+"m+"+rm.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=SZ()+t+" "+e[0]}function SZ(){return Pt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function EZ(...e){return process.stderr.write(nm.formatWithOptions(Pt.inspectOpts,...e)+`
|
|
7
|
+
`)}function TZ(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function IZ(){return process.env.DEBUG}function AZ(e){e.inspectOpts={};let t=Object.keys(Pt.inspectOpts);for(let n=0;n<t.length;n++)e.inspectOpts[t[n]]=Pt.inspectOpts[t[n]]}rm.exports=Qy()(Pt);var{formatters:Sk}=rm.exports;Sk.o=function(e){return this.inspectOpts.colors=this.useColors,nm.inspect(e,this.inspectOpts).split(`
|
|
8
|
+
`).map(t=>t.trim()).join(" ")};Sk.O=function(e){return this.inspectOpts.colors=this.useColors,nm.inspect(e,this.inspectOpts)}});var Tk=Nr((wTe,$y)=>{"use strict";typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?$y.exports=_k():$y.exports=Ek()});var eS=Nr((GTe,Ik)=>{"use strict";var zy=Lt("path").sep;Ik.exports=function(e){var t=e.split(zy),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",o=r?t[n+1]+"/"+t[n+2]:t[n+1],i=r?3:2,s="",c=n+i-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+zy;for(var l="",p=t.length-1,u=n+i;u<=p;u++)u===p?l+=t[u]:l+=t[u]+zy;return{name:o,basedir:s,path:l}}}});var oS=Nr((UTe,rS)=>{"use strict";var Va=Lt("path"),hr=Lt("module"),gt=Tk()("require-in-the-middle"),NZ=eS();rS.exports=jl;rS.exports.Hook=jl;var tS,om;if(hr.isBuiltin)om=hr.isBuiltin;else if(hr.builtinModules)om=e=>e.startsWith("node:")?!0:(tS===void 0&&(tS=new Set(hr.builtinModules)),tS.has(e));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var vZ=/([/\\]index)?(\.js)?$/,nS=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(t,n){if(this._localCache.has(t))return!0;if(n)return!1;{let r=Lt.cache[t];return!!(r&&this._kRitmExports in r)}}get(t,n){let r=this._localCache.get(t);if(r!==void 0)return r;if(!n){let o=Lt.cache[t];return o&&o[this._kRitmExports]}}set(t,n,r){r?this._localCache.set(t,n):t in Lt.cache?Lt.cache[t][this._kRitmExports]=n:(gt('non-core module is unexpectedly not in require.cache: "%s"',t),this._localCache.set(t,n))}};function jl(e,t,n){if(!(this instanceof jl))return new jl(e,t,n);if(typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),typeof hr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof hr._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues",process.version);return}this._cache=new nS,this._unhooked=!1,this._origRequire=hr.prototype.require;let r=this,o=new Set,i=t?t.internals===!0:!1,s=Array.isArray(e);gt("registering require hook"),this._require=hr.prototype.require=function(a){return r._unhooked===!0?(gt("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):c.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(a){return r._unhooked===!0?(gt("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):c.call(this,arguments,!0)});function c(a,l){let p=a[0],u=om(p),d;if(u){if(d=p,p.startsWith("node:")){let L=p.slice(5);om(L)&&(d=L)}}else{if(l)return gt("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,a);try{d=hr._resolveFilename(p,this)}catch(L){return gt('Module._resolveFilename("%s") threw %j, calling original Module.require',p,L.message),r._origRequire.apply(this,a)}}let m,_;if(gt("processing %s module require('%s'): %s",u===!0?"core":"non-core",p,d),r._cache.has(d,u)===!0)return gt("returning already patched cached module: %s",d),r._cache.get(d,u);let h=o.has(d);h===!1&&o.add(d);let b=l?r._origGetBuiltinModule.apply(this,a):r._origRequire.apply(this,a);if(h===!0)return gt("module is in the process of being patched already - ignoring: %s",d),b;if(o.delete(d),u===!0){if(s===!0&&e.includes(d)===!1)return gt("ignoring core module not on whitelist: %s",d),b;m=d}else if(s===!0&&e.includes(d)){let L=Va.parse(d);m=L.name,_=L.dir}else{let L=NZ(d);if(L===void 0)return gt("could not parse filename: %s",d),b;m=L.name,_=L.basedir;let R=RZ(L);gt("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",m,p,R,_);let v=!1;if(s){if(!p.startsWith(".")&&e.includes(p)&&(m=p,v=!0),!e.includes(m)&&!e.includes(R))return b;e.includes(R)&&R!==m&&(m=R,v=!0)}if(!v){let P;try{P=Lt.resolve(m,{paths:[_]})}catch{return gt("could not resolve module: %s",m),r._cache.set(d,b,u),b}if(P!==d)if(i===!0)m=m+Va.sep+Va.relative(_,d),gt("preparing to process require of internal file: %s",m);else return gt("ignoring require of non-main module file: %s",P),r._cache.set(d,b,u),b}}r._cache.set(d,b,u),gt("calling require hook: %s",m);let N=n(b,m,_);return r._cache.set(d,N,u),gt("returning module: %s",m),N}}jl.prototype.unhook=function(){this._unhooked=!0,this._require===hr.prototype.require?(hr.prototype.require=this._origRequire,gt("require unhook successful")):gt("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,gt("process.getBuiltinModule unhook successful")):gt("process.getBuiltinModule unhook unsuccessful"))};function RZ(e){let t=Va.sep!=="/"?e.path.split(Va.sep).join("/"):e.path;return Va.posix.join(e.name,t).replace(vZ,"")}});var kk=Nr(Ya=>{"use strict";var lS=[],Ok=new WeakMap,sS,aS,vk,pS=new Map,uS=[];function Rk(e,t){return t==="module.exports"&&!Object.hasOwn(e,t)?e.default:e[t]}function xk(e,t,n){return Ok.get(e).write(t,n)}function xZ(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return xk(e,t,n.value)}var PZ={defineProperty:xZ,set:xk};function Pk(e,t,n){let r=sS.get(e)?.[t];return typeof r=="function"?r(n):!0}function kZ(e,t){if(t===Symbol.toStringTag)return"Module";let n=aS.get(e)[t];if(typeof n=="function")return n()}function LZ(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return Pk(e,t,n.value)}function MZ(e,t,n,r,o){sS??=new WeakMap,aS??=new WeakMap,vk??={defineProperty:LZ,get:kZ,set:Pk},pS.set(e,o),sS.set(t,n),aS.set(t,r);let i=new Proxy(t,vk);lS.forEach(s=>s(e,i,o)),uS.push([e,i,o])}function wZ(e,t,n,r,o){if(arguments.length===5){MZ(e,t,n,r,o);return}let{namespace:i}=t;pS.set(e,n),Ok.set(i,t);let s=new Proxy(i,PZ);lS.forEach(c=>c(e,s,n)),uS.push([e,s,n])}var Ck=[0,10,50],cS=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});#r=Object.create(null);#t;#n;#e;constructor(t,n,r,o){if(this.#t=r,n!==void 0)for(let i=0;i<n.length;i++)this.#s(n[i],i,o?.[i]??t)}#s(t,n,r){let o;try{o=Rk(r,t),this.#t(n,o),this.namespace[t]=o}catch(i){if(!(i instanceof ReferenceError))throw i}o===void 0&&(this.#e??=[]).push(this.#a(t,n,r)),this.#r[t]=n}write(t,n){let r=this.#r[t];return r!==void 0&&(this.#t(r,n),this.#e!==void 0&&(this.#n??=Object.create(null),this.#n[t]=!0),this.namespace[t]=n),!0}#a(t,n,r){return()=>{if(this.#n?.[t]===!0)return!0;try{let o=Rk(r,t);return o!==void 0?(this.#t(n,o),this.namespace[t]=o,!0):!1}catch(o){if(o instanceof ReferenceError)return!1;throw o}}}#o(){let t=this.#e;if(t===void 0)return;let n;for(let r of t)r()!==!0&&(n??=[]).push(r);this.#e=n}flush(){this.#e!==void 0&&queueMicrotask(()=>{this.#o(),this.#i(0)})}#i(t){if(this.#e===void 0)return;if(t>=Ck.length){this.#e=void 0;return}let n=setTimeout(()=>{this.#o(),this.#i(t+1)},Ck[t]);n&&typeof n.unref=="function"&&n.unref()}};Ya.register=wZ;Ya.ModuleBinder=cS;Ya.importHooks=lS;Ya.specifiers=pS;Ya.toHook=uS});var gS=Nr((VTe,Za)=>{"use strict";var Lk=Lt("path"),GZ=eS(),{fileURLToPath:UZ}=Lt("url"),{MessageChannel:DZ}=Lt("worker_threads"),{isBuiltin:dS}=Lt("module");dS||(dS=()=>!0);var{importHooks:mS,specifiers:Mk,toHook:BZ}=kk();function HZ(e,t){if(!(process.env.TURBOPACK??process.argv.includes("--turbo")))return!1;let r=e.slice(0,e.lastIndexOf("-"));return t.endsWith(r)}function wk(e){mS.push(e),BZ.forEach(([t,n,r])=>e(t,n,r))}function Gk(e){let t=mS.indexOf(e);t>-1&&mS.splice(t,1)}function ja(e,t,n,r){let o=e(t,n,r);o&&o!==t&&"default"in t&&(t.default=o)}var fS;function FZ(){let{port1:e,port2:t}=new DZ,n=0,r;fS=c=>{n++,e.postMessage(c)},e.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let c=setInterval(()=>{},1e3),a=new Promise(l=>{r=l}).then(()=>{clearInterval(c)});return n===0&&r(),a}let i=t;return{registerOptions:{data:{addHookMessagePort:i,include:[]},transferList:[i]},addHookMessagePort:i,waitForAllMessagesAcknowledged:o}}function Zl(e,t,n){if(!(this instanceof Zl))return new Zl(e,t,n);typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null);let r=t?t.internals===!0:!1;fS&&Array.isArray(e)&&fS(e),this._iitmHook=(o,i,s)=>{let c=o,a=c.startsWith("node:"),l,p;if(a){let u=o.slice(5);dS(u)&&(o=u)}else if(c.startsWith("file://")){let u=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=UZ(o),o=l}catch{}if(Error.stackTraceLimit=u,l){let d=GZ(l);d&&(o=d.name,p=d.basedir)}}if(e)for(let u of e)if(l&&u===l)ja(n,i,l,void 0);else if(u===o){if(!p)ja(n,i,o,p);else if(p.endsWith(Mk.get(c))||HZ(Mk.get(c),p))ja(n,i,o,p);else if(r){let d=o+Lk.sep+Lk.relative(p,l);ja(n,i,d,p)}}else u===s&&ja(n,i,s,p);else ja(n,i,o,p)},wk(this._iitmHook)}Zl.prototype.unhook=function(){Gk(this._iitmHook)};Za.exports=Zl;Za.exports.Hook=Zl;Za.exports.addHook=wk;Za.exports.removeHook=Gk;Za.exports.createAddHookMessageChannel=FZ});var E=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var te=globalThis;var q="10.75.0";function Je(){return zn(te),te}function zn(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||q,t[q]=t[q]||{}}function Bn(e,t,n=te){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[q]=r[q]||{};return o[e]||(o[e]=t())}var tr=["debug","info","warn","error","log","assert","trace"],H2="Sentry Logger ",er={};function Me(e){if(!("console"in te))return e();let t=te.console,n={},r=Object.keys(er);r.forEach(o=>{let i=er[o];n[o]=t[o],t[o]=i});try{return e()}finally{r.forEach(o=>{t[o]=n[o]})}}function F2(){E_().enabled=!0}function W2(){E_().enabled=!1}function pv(){return E_().enabled}function V2(...e){S_("log",...e)}function Y2(...e){S_("warn",...e)}function j2(...e){S_("error",...e)}function S_(e,...t){E&&pv()&&Me(()=>{te.console[e](`${H2}[${e}]:`,...t)})}function E_(){return E?Bn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:F2,disable:W2,isEnabled:pv,log:V2,warn:Y2,error:j2};var uv=/\(error: (.*)\)/,dv=/captureMessage|captureException/;function tu(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let i=[],s=n.split(`
|
|
9
|
+
`);for(let c=r;c<s.length;c++){let a=s[c];a.length>1024&&(a=a.slice(0,1024));let l=uv.test(a)?a.replace(uv,"$1"):a;if(!l.includes("Error: ")){for(let p of t){let u=p(l);if(u){i.push(u);break}}if(i.length>=50+o)break}}return mv(i.slice(o))}}function I_(e){return Array.isArray(e)?tu(...e):e}function mv(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(eu(t).function||"")&&t.pop(),t.reverse(),dv.test(eu(t).function||"")&&(t.pop(),dv.test(eu(t).function||"")&&t.pop()),t.slice(0,50).map(n=>({...n,filename:n.filename||eu(t).filename,function:n.function||"?"}))}function eu(e){return e[e.length-1]||{}}var T_="<anonymous>";function xc(e){try{return!e||typeof e!="function"?T_:e.name||T_}catch{return T_}}function nu(e){let t=e.exception;if(t){let n=[];try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function fv(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var Pc={},gv={};function A_(e,t){return Pc[e]=Pc[e]||[],Pc[e].push(t),()=>{let n=Pc[e];if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}function kc(e,t){if(!gv[e]){gv[e]=!0;try{t()}catch(n){E&&g.error(`Error while instrumenting ${e}`,n)}}}function Ms(e,t){let n=e&&Pc[e];if(n)for(let r of n)try{r(t)}catch(o){E&&g.error(`Error while triggering instrumentation handler.
|
|
10
|
+
Type: ${e}
|
|
11
|
+
Name: ${xc(r)}
|
|
12
|
+
Error:`,o)}}var _v=Object.prototype.toString;function et(e){switch(_v.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return C_(e,Error)}}function ru(e,t){return _v.call(e)===`[object ${t}]`}function N_(e){return ru(e,"ErrorEvent")}function ws(e){return ru(e,"String")}function Fo(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function nr(e){return e===null||Fo(e)||typeof e!="object"&&typeof e!="function"}function Zt(e){return ru(e,"Object")}function V(e){return typeof e=="object"&&e!==null}function v_(e){return typeof Event<"u"&&C_(e,Event)}function R_(e){return ru(e,"RegExp")}function bt(e){return!!(e?.then&&typeof e.then=="function")}function C_(e,t){try{return e instanceof t}catch{return!1}}function Mt(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&Mi(o,r);try{e[t]=o}catch{E&&g.log(`Failed to replace method "${t}" in object`,e)}}function we(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{E&&g.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Mi(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,we(e,"__sentry_original__",t)}catch{}}function Gs(e,t,n,r=!0){let o=e[t];if(typeof o!="function")throw new Error(`Cannot wrap method: ${t} is not a function`);if(Cr(o))throw new Error(`Attempting to wrap method ${t} multiple times`);Mi(n,o),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Cr(e){return e.__sentry_original__}function ou(e){if(et(e))return{message:e.message,name:e.name,stack:e.stack,...hv(e)};if(v_(e)){let{type:t,target:n,currentTarget:r,detail:o}=e;return{type:t,target:n,currentTarget:r,...o?{detail:o}:{},...hv(e)}}return e}function hv(e){return V(e)?Object.fromEntries(Object.entries(e)):{}}function O_(e){let t=Object.keys(ou(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var Us;function wi(e){if(Us!==void 0)return Us?Us(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=te;return t in n&&typeof n[t]=="function"?(Us=n[t],Us(e)):(Us=null,e())}function ct(){return wi(()=>Math.random())}function tt(){return wi(()=>Date.now())}var bv=Symbol.for("sentry.skipNormalization"),yv=Symbol.for("sentry.overrideNormalizationDepth");function Sv(e){we(e,bv,!0)}function Ev(e,t){we(e,yv,t)}function Tv(e){return!!e[bv]}function Iv(e){let t=e[yv];return typeof t=="number"?t:void 0}var Av;function Ke(e,t=100,n=1/0){try{return x_("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function P_(e,t=3,n=100*1024){let r=Ke(e,t);return K2(r)>n?P_(e,t-1,n):r}function x_(e,t,n=1/0,r=1/0,o=q2()){let[i,s]=o;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let c=k_(e,t);if(!c.startsWith("[object "))return c;if(Tv(t))return t;let a=Iv(t),l=a!==void 0?a:n;if(l===0)return c.replace("object ","");if(i(t))return"[Circular ~]";let p=t;if(p&&typeof p.toJSON=="function")try{let _=p.toJSON();return x_("",_,l-1,r,o)}catch{}let u=Array.isArray(t)?[]:{},d=0,m=ou(t);for(let _ in m){if(!Object.prototype.hasOwnProperty.call(m,_))continue;if(d>=r){u[_]="[MaxProperties ~]";break}let h=m[_];u[_]=x_(_,h,l-1,r,o),d++}return s(t),u}function k_(e,t){try{if(Av){let r=Av(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${xc(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${Z2(t)}]`}catch(n){return`**non-serializable** (${n})`}}function Z2(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function X2(e){return~-encodeURI(e).split(/%..|./).length}function K2(e){return X2(JSON.stringify(e))}function q2(){let e=new WeakSet;function t(r){return e.has(r)?!0:(e.add(r),!1)}function n(r){e.delete(r)}return[t,n]}function Ge(e,t="[unserializable]"){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return typeof t=="function"?t(e):t}}function gn(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function L_(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let o=Math.max(t-60,0);o<5&&(o=0);let i=Math.min(o+140,r);return i>r-5&&(i=r),i===r&&(o=Math.max(i-140,0)),n=n.slice(o,i),o>0&&(n=`'{snip} ${n}`),i<r&&(n+=" {snip}"),n}function Ds(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let o=e[r];nr(o)?n.push(String(o)):o instanceof Error?n.push(o.message?`${o.name}: ${o.message}`:o.name):n.push(k_(void 0,o))}return n.join(t)}function Or(e,t,n=!1){return ws(e)?R_(t)?t.test(e):ws(t)?n?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function _n(e,t=[],n=!1){for(let r of t)if(Or(e,r,n))return!0;return!1}function Q2(){let e=te;return e.crypto||e.msCrypto}var M_;function J2(){return ct()*16}function dt(e=Q2()){try{if(e?.randomUUID)return wi(()=>e.randomUUID()).replace(/-/g,"")}catch{}return M_||(M_="10000000100040008000"+1e11),M_.replace(/[018]/g,t=>(t^(J2()&15)>>t/4).toString(16))}function Nv(e){return e.exception?.values?.[0]}function Wo(e){let{message:t,event_id:n}=e;if(t)return t;let r=Nv(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function G_(e,t,n){let r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type=n||"Error")}function Hn(e,t){let n=Nv(e);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...t},t&&"data"in t){let i={...o?.data,...t.data};n.mechanism.data=i}}var $2=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function w_(e){return parseInt(e||"",10)}function Bs(e){let t=e.match($2)||[],n=w_(t[1]),r=w_(t[2]),o=w_(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:t[4]}}function iu(e){if(vv(e))return!0;try{we(e,"__sentry_captured__",!0)}catch{}return!1}function vv(e){try{return e.__sentry_captured__}catch{}}var Cv=1e3;function xr(){return tt()/Cv}function z2(){let{performance:e}=te;if(!e?.now||!e.timeOrigin)return xr;let t=e.timeOrigin;return()=>(t+wi(()=>e.now()))/Cv}var Rv;function lt(){return(Rv??(Rv=z2()))()}function Ov(e){let t=lt(),n={sid:dt(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>eW(n)};return e&&mo(n,e),n}function mo(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||lt(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:dt()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{let n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function xv(e,t){let n={};t?n={status:t}:e.status==="ok"&&(n={status:"exited"}),mo(e,n)}function eW(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Vo(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Vo(r[o],t[o],n-1));return r}function yt(){return dt()}function Xt(){return dt().substring(16)}function Gi(e){try{let t=te.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function Ui(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var U_="_sentrySpan";function Fn(e,t){t?we(e,U_,Gi(t)):delete e[U_]}function rr(e){return Ui(e[U_])}var tW=100,Kt=class e{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:yt(),sampleRand:ct()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Fn(t,rr(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&mo(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t=="function"?t(this):t,r=n instanceof e?n.getScopeData():Zt(n)?t:void 0,{tags:o,attributes:i,extra:s,user:c,contexts:a,level:l,fingerprint:p=[],propagationContext:u,conversationId:d}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...a},c&&Object.keys(c).length&&(this._user=c),l&&(this._level=l),p.length&&(this._fingerprint=p),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Fn(this,void 0),this._attachments=[],this.setPropagationContext({traceId:yt(),sampleRand:ct()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){let r=typeof n=="number"?n:tW;if(r<=0)return this;let o={timestamp:xr(),...t,message:t.message?gn(t.message,2048):t.message};return this._breadcrumbs.push(o),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(t){return this._attachments.push(t),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:rr(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Vo(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){let r=n?.event_id||dt();if(!this._client)return E&&g.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...n,event_id:r},this),r}captureMessage(t,n,r){let o=r?.event_id||dt();if(!this._client)return E&&g.warn("No client configured on scope - will not capture message!"),o;let i=r?.syntheticException??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...r,event_id:o},this),o}captureEvent(t,n){let r=t.event_id||n?.event_id||dt();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(E&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}};function Hs(){return Bn("defaultCurrentScope",()=>new Kt)}function Rt(){return Bn("defaultIsolationScope",()=>new Kt)}var Pv=e=>e instanceof Promise&&!e[kv],kv=Symbol("chained PromiseLike"),su=(e,t,n)=>{let r=e.then(o=>(t(o),o),o=>{throw n(o),o});return Pv(r)&&Pv(e)?r:nW(e,r)},nW=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let o=e[r];typeof o=="function"?Object.defineProperty(t,r,{value:(...i)=>o.apply(e,i),enumerable:!0,configurable:!0,writable:!0}):t[r]=o}return n&&Object.assign(t,{[kv]:!0}),t};var D_=class{constructor(t,n){let r;t?r=t:r=new Kt;let o;n?o=n:o=new Kt,this._stack=[{scope:r}],this._isolationScope=o}withScope(t){let n=this._pushScope(),r;try{r=t(n)}catch(o){throw this._popScope(),o}return bt(r)?su(r,()=>this._popScope(),()=>this._popScope()):(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(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Fs(){let e=Je(),t=zn(e);return t.stack=t.stack||new D_(Hs(),Rt())}function rW(e){return Fs().withScope(e)}function oW(e,t){let n=Fs();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Lv(e){return Fs().withScope(()=>e(Fs().getIsolationScope()))}function Mv(){return{withIsolationScope:Lv,withScope:rW,withSetScope:oW,withSetIsolationScope:(e,t)=>Lv(t),getCurrentScope:()=>Fs().getScope(),getIsolationScope:()=>Fs().getIsolationScope()}}function B_(e){let t=Je(),n=zn(t);n.acs=e}function St(e){let t=zn(e);return t.acs?t.acs:Mv()}function iW(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function sW(e,t){let{value:n,unit:r}=iW(e)?e:{value:e,unit:void 0},o=aW(n),i=r&&typeof r=="string"?{unit:r}:{};if(o)return{...o,...i};if(!t||t==="skip-undefined"&&n===void 0)return;let s="";try{s=JSON.stringify(n)??""}catch{}return{value:s,type:"string",...i}}function fo(e,t=!1){let n={};for(let[r,o]of Object.entries(e??{})){let i=sW(o,t);i&&(n[r]=i)}return n}function H_(e){if(!e)return 0;let t=0;for(let[n,r]of Object.entries(e)){t+=n.length*2,t+=r.type.length*2,t+=(r.unit?.length??0)*2;let o=r.value;Array.isArray(o)?t+=wv(o[0])*o.length:nr(o)?t+=wv(o):t+=100}return t}function wv(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function aW(e){if(Array.isArray(e))return{value:e,type:"array"};let t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}var Gv;function Uv(){return Gv?.()}function F_(){return Gv!==void 0}function ne(){let e=Je();return St(e).getCurrentScope()}function J(){let e=Je();return St(e).getIsolationScope()}function Di(){return Bn("globalScope",()=>new Kt)}function Be(...e){let t=Je(),n=St(t);if(e.length===2){let[r,o]=e;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(e[0])}function or(...e){let t=Je(),n=St(t);if(e.length===2){let[r,o]=e;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(e[0])}function O(){return ne().getClient()}function Bi(e){let t=Uv();if(t)return{trace_id:t.traceId,span_id:t.spanId};let n=e.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:i}=n,s={trace_id:r,span_id:i||Xt()};return o&&(s.parent_span_id=o),s}var ve="sentry.source",Wn="sentry.sample_rate",W_="sentry.previous_trace_sample_rate",H="sentry.op",S="sentry.origin",V_="sentry.status.message";var au="sentry.measurement_unit",cu="sentry.measurement_value",Y_="sentry.release",j_="sentry.environment";var Z_="sentry.sdk.integrations",X_="user.id",K_="user.email",Lc="user.ip_address",q_="user.name",hn="sentry.custom_span_name",Ws="sentry.profile_id",Vs="sentry.exclusive_time",Q_="cache.hit",J_="cache.key",$_="cache.item_size",z_="http.request.method";var Hi="gen_ai.conversation.id";function qt(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}function Ys(e,t){e.setAttribute("http.response.status_code",t);let n=qt(t);n.message!=="unknown_error"&&e.setStatus(n)}var Dv="_sentryScope",Bv="_sentryIsolationScope",Hv=Symbol.for("sentry.otelSourceInference"),Fv=Symbol.for("sentry.otelSourceExplicitlySet"),Wv=Symbol.for("sentry.tracerProviderSpan");function Pr(e,t,n){e&&(we(e,Bv,Gi(n)),we(e,Dv,t))}function Qt(e){let t=e;return{scope:t[Dv],isolationScope:Ui(t[Bv])}}function eh(e){we(e,Hv,!0)}function js(e){return e[Hv]===!0}function th(e){we(e,Fv,!0)}function nh(e){return e[Fv]===!0}function rh(e){we(e,Wv,!0)}function lu(e){return e[Wv]===!0}var go="sentry-";var Yv=8192;function ir(e){let t=Zs(e);if(!t)return;let n=Object.entries(t).reduce((r,[o,i])=>{if(o.startsWith(go)){let s=o.slice(go.length);r[s]=i}return r},{});if(Object.keys(n).length>0)return n}function Yo(e){if(!e)return;let t=Object.entries(e).reduce((n,[r,o])=>(o&&(n[`${go}${r}`]=o),n),{});return oh(t)}function Zs(e){if(!(!e||!ws(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{let r=Vv(n);return Object.entries(r).forEach(([o,i])=>{t[o]=i}),t},{}):Vv(e)}function Vv(e){return e.split(",").map(t=>{let n=t.indexOf("=");if(n===-1)return[];let r=t.slice(0,n),o=t.slice(n+1);return[r,o].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function oh(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],o)=>{let i=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,s=o===0?i:`${t},${i}`;return s.length>Yv?(E&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):s},"")}function Xs(e,t){if(!e)return t;let n=Zs(e),r=Zs(t);if(!r)return e;let o={},i=!1,s={},c={};for(let[a,l]of Object.entries(r))a.startsWith(go)?(s[a]=l,i=!0):c[a]=l;if(n)for(let[a,l]of Object.entries(n))(!i||!a.startsWith(go))&&(o[a]=l);i&&Object.assign(o,s);for(let[a,l]of Object.entries(c))o[a]??(o[a]=l);return oh(o)}var cW=/^o(\d+)\./,lW=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function pW(e){return e==="http"||e==="https"}function sn(e,t=!1){let{host:n,path:r,pass:o,port:i,projectId:s,protocol:c,publicKey:a}=e;return`${c}://${a}${t&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${s}`}function uW(e){let t=lW.exec(e);if(!t){Me(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,o="",i="",s="",c=""]=t.slice(1),a="",l=c,p=l.split("/");if(p.length>1&&(a=p.slice(0,-1).join("/"),l=p.pop()),l){let u=l.match(/^\d+/);u&&(l=u[0])}return jv({host:i,pass:o,path:a,projectId:l,port:s,protocol:n,publicKey:r})}function jv(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function dW(e){if(!E)return!0;let{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(g.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:n.match(/^\d+$/)?pW(r)?t&&isNaN(parseInt(t,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function mW(e){return e.match(cW)?.[1]}function pu(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=mW(n)),r}function Zv(e){let t=typeof e=="string"?uW(e):jv(e);if(!(!t||!dW(t)))return t}function An(e){if(typeof e=="boolean")return Number(e);let t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}var uu=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Xv(e){if(!e)return;let t=e.match(uu);if(!t)return;let n;return t[3]==="1"?n=!0:t[3]==="0"&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Mc(e){return!!e.parentSpanId||!!e.dsc}function Nn(e,t){let n=Xv(e),r=ir(t);if(!n?.traceId)return{traceId:yt(),sampleRand:ct()};let o=fW(n,r);r&&(r.sample_rand=o.toString());let{traceId:i,parentSpanId:s,parentSampled:c}=n;return{traceId:i,parentSpanId:s,sampled:c,dsc:r||{},sampleRand:o}}function jo(e=yt(),t=Xt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function Zo(e=yt(),t=Xt(),n){return`00-${e}-${t}-${n?"01":"00"}`}function fW(e,t){let n=An(t?.sample_rand);if(n!==void 0)return n;let r=An(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?ct()*r:r+ct()*(1-r):ct()}function wc(e,t){let n=pu(e);return t&&n&&t!==n?(g.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):(e.getOptions().strictTraceContinuation||!1)&&(t&&!n||!t&&n)?(g.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}var mu=0,Uc=1,Kv=!1;function Qv(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:o,parent_span_id:i,status:s,origin:c,links:a}=ie(e);return{parent_span_id:i,span_id:t,trace_id:n,data:r,op:o,status:s,origin:c,links:a}}function Lr(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),o=r?t:ie(e).parent_span_id,i=Qt(e).scope,s=r?i?.getPropagationContext().propagationSpanId||Xt():t;return{parent_span_id:o,span_id:s,trace_id:n}}function Dc(e){let{traceId:t,spanId:n}=e.spanContext(),r=$t(e);return jo(t,n,r)}function Jv(e){let{traceId:t,spanId:n}=e.spanContext(),r=$t(e);return Zo(t,n,r)}function Fi(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...o},attributes:i})=>({span_id:t,trace_id:n,sampled:r===Uc,attributes:i,...o}))}function sh(e){if(e?.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:o})=>({span_id:t,trace_id:n,sampled:r===Uc,attributes:o}))}function Jt(e){return typeof e=="number"?qv(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?qv(e.getTime()):lt()}function qv(e){return e>9999999999?e/1e3:e}function ie(e){if(Bc(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(zv(e)){let{attributes:r,startTime:o,name:i,endTime:s,status:c,links:a}=e;return{span_id:t,trace_id:n,data:r,description:i,parent_span_id:$v(e),start_timestamp:Jt(o),timestamp:Jt(s)||void 0,status:Wi(c),op:r[H],origin:r[S],links:Fi(a)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function fu(e){if(Bc(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(zv(e)){let{attributes:r,startTime:o,name:i,endTime:s,status:c,links:a}=e;return{name:i,span_id:t,trace_id:n,parent_span_id:$v(e),start_timestamp:Jt(o),end_timestamp:Jt(s),is_segment:e===Ks(e),status:_u(c),attributes:ah(r,c),links:sh(a)}}return{span_id:t,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===Ks(e)}}function $v(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function gu(e){return{...e,attributes:fo(e.attributes),links:e.links?.map(t=>({...t,attributes:fo(t.attributes)}))}}function zv(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Bc(e){return typeof e.getSpanJSON=="function"}function $t(e){let{traceFlags:t}=e.spanContext();return t===Uc}function Wi(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function _u(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function ah(e,t){let n=_u(t)==="error"?t?.message:void 0;return{...n&&{[V_]:n},...e}}var Gc="_sentryChildSpans",ih="_sentryRootSpan";function _o(e,t){let n=e[ih]||e;we(t,ih,n),$t(e)&&(!e.isRecording()&&!n.isRecording()||(e[Gc]?e[Gc].add(t):we(e,Gc,new Set([t]))))}function Hc(e){let t=new Set;function n(r){if(!t.has(r)&&$t(r)){t.add(r);let o=r[Gc]?Array.from(r[Gc]):[];for(let i of o)n(i)}}return n(e),Array.from(t)}var Re=Ks;function Ks(e){return e[ih]||e}function Q(){let e=Je(),t=St(e);return t.getActiveSpan?t.getActiveSpan():rr(ne())}function Vi(){Kv||(Me(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Kv=!0)}function ch(e,t){e.updateName(t),e.setAttributes({[ve]:"custom",[hn]:t})}function Ue(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||O()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function eR(e){g.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function sr(e,t){if(!t?.length)return!1;for(let n of t){if(_W(n)){if(e.description&&Or(e.description,n))return E&&eR(e),!0;continue}let r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;let o=n.name?e.description&&Or(e.description,n.name):!0,i=n.op?e.op&&Or(e.op,n.op):!0,s=n.attributes?Object.entries(n.attributes).every(([c,a])=>gW(e.attributes?.[c],a)):!0;if(o&&i&&s)return E&&eR(e),!0}return!1}function gW(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?Or(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function tR(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let o of e)o.parent_span_id===r&&(o.parent_span_id=n)}function _W(e){return typeof e=="string"||e instanceof RegExp}var nR=Symbol.for("sentry.nonRecordingSpan"),Mr=class{constructor(t={}){this._traceId=t.traceId||yt(),this._spanId=t.spanId||Xt(),this.dropReason=t.dropReason,we(this,nR,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:mu}}end(t){}setAttribute(t,n){return this}setAttributes(t){return this}setStatus(t){return this}updateName(t){return this}isRecording(){return!1}addEvent(t,n,r){return this}addLink(t){return this}addLinks(t){return this}recordException(t,n){}};function Xo(e){return!!e&&e[nR]===!0}var Ko="production";var rR="_frozenDsc";function lh(e,t){we(e,rR,t)}function ph(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},o={environment:n.environment||Ko,release:n.release,public_key:r,trace_id:e,org_id:pu(t)};return t.emit("createDsc",o),o}function ar(e,t){let n=t.getPropagationContext();return n.dsc||ph(n.traceId,e)}function nt(e){let t=O();if(!t)return{};let n=Re(e),r=ie(n),o=r.data,i=n.spanContext().traceState,s=i?.get("sentry.sample_rate")??o[Wn]??o[W_];function c(b){return(typeof s=="number"||typeof s=="string")&&(b.sample_rate=`${s}`),b}let a=n[rR];if(a)return c(a);let l=Xo(n),p=l&&n.dropReason==="ignored";if(l&&(!Ue(t.getOptions())||p)){let b=Qt(n).scope;if(b){let N={...ar(t,b)};return p&&(N.sampled="false"),c(N)}}let u=i?.get("sentry.dsc"),d=u&&ir(u);if(d)return c(d);let m=ph(e.spanContext().traceId,t),_=o[ve]??o["sentry.segment.name.source"],h=r.description;return _!=="url"&&h&&(m.transaction=h),Ue()&&(m.sampled=String($t(n)),m.sample_rand=i?.get("sentry.sample_rand")??Qt(n).scope?.getPropagationContext().sampleRand.toString()),c(m),t.emit("createDsc",m,n),m}function uh(e){let t=nt(e);return Yo(t)}function dh(e){return we(e,"_streamed",!0),e}function ho(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function wt(e,t=[]){return[e,t]}function hu(e,t){let[n,r]=e;return[n,[...r,t]]}function Fc(e,t){let n=e[1];for(let r of n){let o=r[0].type;if(t(r,o))return!0}return!1}function fh(e,t){return Fc(e,(n,r)=>t.includes(r))}function mh(e){let t=zn(te);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Wc(e){let[t,n]=e,r=JSON.stringify(t);function o(i){typeof r=="string"?r=typeof i=="string"?r+i:[mh(r),i]:r.push(typeof i=="string"?mh(i):i)}for(let i of n){let[s,c]=i;if(o(`
|
|
13
|
+
${JSON.stringify(s)}
|
|
14
|
+
`),typeof c=="string"||c instanceof Uint8Array)o(c);else{let a;try{a=JSON.stringify(c)}catch{a=JSON.stringify(Ke(c))}o(a)}}return typeof r=="string"?r:hW(r)}function hW(e){let t=e.reduce((o,i)=>o+i.length,0),n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function gh(e){return[{type:"span"},e]}function _h(e){let t=typeof e.data=="string"?mh(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var oR={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function bW(e){return e in oR}function bu(e){return bW(e)?oR[e]:e}function qs(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function hh(e,t,n,r){let o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(tt()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:sn(r)},...o&&{trace:o}}}function yW(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function iR(e,t,n,r){let o=qs(n),i={sent_at:new Date(tt()).toISOString(),...o&&{sdk:o},...!!r&&t&&{dsn:sn(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return wt(i,[s])}function sR(e,t,n,r){let o=qs(n),i=e.type&&e.type!=="replay_event"?e.type:"event";yW(e,n?.sdk);let s=hh(e,o,r,t);return delete e.sdkProcessingMetadata,wt(s,[[{type:i},e]])}function aR(e,t){function n(m){return!!m.trace_id&&!!m.public_key}let r=nt(e[0]),o=t?.getDsn(),i=t?.getOptions().tunnel,s={sent_at:new Date(tt()).toISOString(),...n(r)&&{trace:r},...!!i&&o&&{dsn:sn(o)}},{beforeSendSpan:c,ignoreSpans:a}=t?.getOptions()||{},l=a?.length?e.filter(m=>{let _=ie(m);return!sr({description:_.description,op:_.op,attributes:_.data},a)}):e,p=e.length-l.length;p&&t?.recordDroppedEvent("before_send","span",p);let u=c?m=>{let _=ie(m),h=ho(c)?_:c(_);return h||(Vi(),_)}:ie,d=[];for(let m of l){let _=u(m);_&&d.push(gh(_))}return wt(s,d)}function Vc(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=ie(e),{spanId:o}=e.spanContext(),i=$t(e),s=Re(e),c=s===e,a=`[Tracing] Starting ${i?"sampled":"unsampled"} ${c?"root ":""}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!c){let{op:p,description:u}=ie(s);l.push(`root ID: ${s.spanContext().spanId}`),p&&l.push(`root op: ${p}`),u&&l.push(`root description: ${u}`)}g.log(`${a}
|
|
15
|
+
${l.join(`
|
|
16
|
+
`)}`)}function Yc(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >"}=ie(e),{spanId:r}=e.spanContext(),i=Re(e)===e,s=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${t}" with ID ${r}`;g.log(s)}function bh(e,t,n,r=Q()){let o=r&&Re(r);o&&(E&&g.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),o.addEvent(e,{[cu]:t,[au]:n}))}function Yi(e){if(!e||e.length===0)return;let t={};return e.forEach(n=>{let r=n.attributes||{},o=r[au],i=r[cu];typeof o=="string"&&typeof i=="number"&&(t[n.name]={value:i,unit:o})}),t}function cR(e){zn(Je()).segmentSpanCaptureStrategy=e}function jc(){return zn(Je()).segmentSpanCaptureStrategy}function rt(e){return e.getOptions().traceLifecycle==="stream"}var lR=1e3,Qs=class{constructor(t={}){this._traceId=t.traceId||yt(),this._spanId=t.spanId||Xt(),this._startTime=t.startTimestamp||lt(),this._links=t.links,this._attributes={},this.setAttributes({[S]:"manual",[H]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}addLink(t){return this._frozen?this:(this._links?this._links.push(t):this._links=[t],this)}addLinks(t){return this._frozen?this:(this._links?this._links.push(...t):this._links=t,this)}recordException(t,n){}spanContext(){let{_spanId:t,_traceId:n,_sampled:r}=this;return{spanId:t,traceId:n,traceFlags:r?Uc:mu}}setAttribute(t,n){return this._frozen?this:(n===void 0?delete this._attributes[t]:this._attributes[t]=n,t===ve&&n!==void 0&&js(this)&&th(this),this)}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._frozen||(this._startTime=Jt(t))}setStatus(t){return this._frozen?this:(this._status=t,this)}updateName(t){return this._frozen?this:(this._name=t,js(this)||this.setAttribute(ve,"custom"),this)}end(t){if(this._endTime){this._frozen=lu(this);return}this._endTime=Jt(t),Yc(this),this._onSpanEnded(),this._frozen=lu(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[H],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Wi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[S],profile_id:this._attributes[Ws],exclusive_time:this._attributes[Vs],measurements:Yi(this._events),is_segment:this._isStandaloneSpan&&Re(this)===this||void 0,segment_id:this._isStandaloneSpan?Re(this).spanContext().spanId:void 0,links:Fi(this._links)}}getStreamedSpanJSON(){return{name:this._name??"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:this._endTime??this._startTime,is_segment:this._isStandaloneSpan||this===Re(this),status:_u(this._status),attributes:ah(this._attributes,this._status),links:sh(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,r){if(this._frozen)return this;E&&g.log("[Tracing] Adding an event to span:",t);let o=pR(n)?n:r||lt(),i=pR(n)?{}:n||{},s={name:t,time:Jt(o),attributes:i};return this._events.push(s),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let t=O();t&&(t.emit("spanEnd",this),this._isStandaloneSpan||t.emit("afterSpanEnd",this));let n=Re(this),r=this._isStandaloneSpan||this===n;if(this._isStandaloneSpan){this._sampled?EW(aR([this],t)):(E&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}if(!r){let s=jc();if(s){let c=Qt(this).scope||ne();s.onChildSpanEnded(this,n,a=>this._convertSpanToTransaction(a),c)}return}if(t&&rt(t)){t.emit("afterSegmentSpanEnd",this);return}let o=Qt(this).scope||ne(),i=jc();if(i)i.onSegmentSpanEnded(s=>this._convertSpanToTransaction(s),o);else{let s=this._convertSpanToTransaction();s&&o.captureEvent(s)}}_convertSpanToTransaction(t={}){if(!uR(ie(this)))return;this._name||(E&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:n,isolationScope:r}=Qt(this),o=n?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;t.onSpanCaptured?.(this);let i=[];for(let u of Hc(this)){if(u===this||SW(u)||t.isSpanAlreadyCaptured?.(u))continue;let d=ie(u);uR(d)&&(t.onSpanCaptured?.(u),i.push(d))}let s=this._attributes[ve];delete this._attributes[hn];let c=!1;i.forEach(u=>{delete u.data[hn],u.op?.startsWith("gen_ai.")&&(c=!0)});let a={contexts:{trace:Qv(this)},spans:i.length>lR?i.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,lR):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:n,capturedSpanIsolationScope:r,dynamicSamplingContext:nt(this),hasGenAiSpans:c},request:o,...s&&{transaction_info:{source:s}}},l=Yi(this._events);return l&&Object.keys(l).length&&(E&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(l,void 0,2)),a.measurements=l),a}};function pR(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function uR(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function SW(e){return e instanceof Qs&&e.isStandaloneSpan()}function EW(e){let t=O();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function cr(e,t,n=()=>{},r=()=>{}){let o;try{o=e()}catch(i){throw t(i),n(),i}return TW(o,t,n,r)}function TW(e,t,n,r){return bt(e)?su(e,o=>{n(),r(o)},o=>{t(o),n()}):(n(),r(e),e)}function Zc(e,t,n){if(!Ue(e))return[!1];let r,o;typeof e.tracesSampler=="function"?(o=e.tracesSampler({...t,inheritOrSampleWith:c=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):c}),r=!0):t.parentSampled!==void 0?o=t.parentSampled:typeof e.tracesSampleRate<"u"&&(o=e.tracesSampleRate,r=!0);let i=An(o);if(i===void 0)return E&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!i)return E&&g.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,i,r];let s=n<i;return s||E&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[s,i,r]}var Js="__SENTRY_SUPPRESS_TRACING__";function Se(e,t){let n=ji();if(n.startSpan)return n.startSpan(e,t);let r=Eh(e),{forceTransaction:o,parentSpan:i,scope:s}=e,c=s?.clone();return Be(c,()=>fR(i)(()=>{let l=ne(),p=Th(l,i),u=O(),m=e.onlyIfParent&&!p?yh(l,u):Sh({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return(!Gr(m)||!p)&&Fn(l,m),cr(()=>t(m),()=>{let{status:_}=ie(m);m.isRecording()&&(!_||_==="ok")&&m.setStatus({code:2,message:"internal_error"})},()=>{m.end()})}))}function ke(e,t){let n=ji();if(n.startSpanManual)return n.startSpanManual(e,t);let r=Eh(e),{forceTransaction:o,parentSpan:i,scope:s}=e,c=s?.clone();return Be(c,()=>fR(i)(()=>{let l=ne(),p=Th(l,i),d=e.onlyIfParent&&!p?yh(l,O()):Sh({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return(!Gr(d)||!p)&&Fn(l,d),cr(()=>t(d,()=>d.end()),()=>{let{status:m}=ie(d);d.isRecording()&&(!m||m==="ok")&&d.setStatus({code:2,message:"internal_error"})})}))}function M(e){let t=ji();return t.startInactiveSpan?t.startInactiveSpan(e):mR(e)}function $s(e){return mR(e)}function mR(e){let t=Eh(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?i=>Be(e.scope,i):r!==void 0?i=>se(r,i):i=>i())(()=>{let i=ne(),s=Th(i,r),c=O();return e.onlyIfParent&&!s?yh(i,c):Sh({parentSpan:s,spanArguments:t,forceTransaction:n,scope:i})})}var vn=(e,t)=>{let n=Je(),r=St(n);if(r.continueTrace)return r.continueTrace(e,t);let{sentryTrace:o,baggage:i}=e,s=O(),c=ir(i);return s&&!wc(s,c?.org_id)?Rn(t):Be(a=>{let l=Nn(o,i);return a.setPropagationContext(l),Fn(a,void 0),t()})};function se(e,t){let n=ji();return n.withActiveSpan?n.withActiveSpan(e,t):Be(r=>(Fn(r,e||void 0),t(r)))}function Vn(e){let t=ji();return t.suppressTracing?t.suppressTracing(e):Be(n=>{n.setSDKProcessingMetadata({[Js]:!0});let r=e();return n.setSDKProcessingMetadata({[Js]:void 0}),r})}function wr(e=ne()){let t=ji();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[Js]===!0}function Rn(e){let t=ji();return t.startNewTrace?t.startNewTrace(e):Be(n=>(n.setPropagationContext({traceId:yt(),sampleRand:ct()}),E&&g.log(`Starting a new trace with id ${n.getPropagationContext().traceId}`),se(null,e)))}function yh(e,t){t?.recordDroppedEvent("no_parent_span","span");let n=new Mr({traceId:e.getPropagationContext().traceId});return Pr(n,e,J()),n}function Sh({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let o=J();if(!Ue()){let c=r.getPropagationContext(),a=e?e.spanContext().traceId:c.traceId,l=new Mr({traceId:a});return e&&!n&&_o(e,l),Pr(l,r,o),l}let i=O();if(AW(i,t)){wr(r)||i?.recordDroppedEvent("ignored","span");let c=new Mr({dropReason:"ignored",traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&_o(e,c),Pr(c,r,o),c}let s;if(e&&!n)s=IW(e,r,t,o),_o(e,s);else if(e){let c=nt(e),{traceId:a,spanId:l}=e.spanContext(),p=$t(e);s=dR({traceId:a,parentSpanId:l,...t},r,o,p),lh(s,c)}else{let{traceId:c,dsc:a,parentSpanId:l,sampled:p}=r.getPropagationContext();s=dR({traceId:c,parentSpanId:l,...t},r,o,p),a&&lh(s,a)}return Vc(s),s}function Eh(e){let n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let r={...n};return r.startTimestamp=Jt(e.startTime),delete r.startTime,r}return n}function ji(){let e=Je();return St(e)}function dR(e,t,n,r){let o=O(),i=o?.getOptions()||{},{name:s=""}=e,c={spanAttributes:{...e.attributes},spanName:s,parentSampled:r};o?.emit("beforeSampling",c,{decision:!1});let a=c.parentSampled??r,l=c.spanAttributes,p=t.getPropagationContext(),u=wr(t),[d,m,_]=u?[!1]:Zc(i,{name:s,parentSampled:a,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:An(p.dsc?.sample_rate)},p.sampleRand),h=new Qs({...e,attributes:{[ve]:"custom",[Wn]:m!==void 0&&_?m:void 0,...l},sampled:d});return!d&&o&&!u&&(E&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),o.recordDroppedEvent("sample_rate",rt(o)?"span":"transaction")),Pr(h,t,n),o&&o.emit("spanStart",h),h}function IW(e,t,n,r){let{spanId:o,traceId:i}=e.spanContext(),s=wr(t),c=s?!1:$t(e),a=c?new Qs({...n,parentSpanId:o,traceId:i,sampled:c}):new Mr({traceId:i});_o(e,a),Pr(a,t,r);let l=O();return l&&(rt(l)&&Xo(a)&&(Xo(e)&&e.dropReason?(a.dropReason=e.dropReason,l.recordDroppedEvent(e.dropReason,"span")):s||(a.dropReason="sample_rate",l.recordDroppedEvent("sample_rate","span"))),l.emit("spanStart",a),n.endTimestamp&&(l.emit("spanEnd",a),l.emit("afterSpanEnd",a))),a}function Th(e,t){if(t)return t;if(t===null)return;let n=rr(e);if(!n)return;let r=O();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Re(n):n}function fR(e){return e!==void 0?t=>se(e,t):t=>t()}function AW(e,t){let n=e?.getOptions().ignoreSpans;return!e||!rt(e)||!n?.length?!1:sr({description:t.name||"",op:t.attributes?.[H]||t.op,attributes:t.attributes},n)}function Gr(e){return Xo(e)&&e.dropReason==="ignored"}function Xc(e,t,n){let r,o,i,s=n?.maxWait?Math.max(n.maxWait,t):0,c=n?.setTimeoutImpl||setTimeout;function a(){return l(),r=e(),r}function l(){o!==void 0&&clearTimeout(o),i!==void 0&&clearTimeout(i),o=i=void 0}function p(){return o!==void 0||i!==void 0?a():r}function u(){return o&&clearTimeout(o),o=c(a,t),s&&i===void 0&&(i=c(a,s)),r}return u.cancel=l,u.flush=p,u}var yu=new WeakSet,gR=e=>yu.has(e),_R=e=>{yu.add(e)},Su=new WeakMap;function Ih(e){if(jc()||cR(NW),Su.has(e))return;let t=new Set,n=Xc(()=>{let r=[...t];t.clear();for(let o of r)o()},1,{maxWait:100});e.on("flush",()=>{n.flush()}),Su.set(e,r=>{t.add(r),n()})}var NW={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&Su.get(n);if(!r){let o=e();o&&n?.captureEvent(o);return}r(()=>{let o=e({isSpanAlreadyCaptured:gR,onSpanCaptured:_R});o&&n.captureEvent(o)})},onChildSpanEnded(e,t,n,r){if(yu.has(e)||!yu.has(t))return;let o=r.getClient(),i=o&&Su.get(o),s=()=>{let c=n({isSpanAlreadyCaptured:gR,onSpanCaptured:_R});c?.contexts?.trace?.data&&(c.contexts.trace.data["sentry.parent_span_already_sent"]=!0),c&&o?.captureEvent(c)};i?i(s):s()}};var vW=["addListener","on","once","prependListener","prependOnceListener","addEventListener"],RW=["removeListener","off","removeEventListener"],hR=Symbol("SentryScopeBoundListeners"),zs;function CW(e){return zs!==void 0&&(e===zs||e.listener===zs)}function bn(e,t=ne()){let n=e;if(Eu(n))return e;Ah(n);for(let r of vW)typeof n[r]=="function"&&(n[r]=xW(n,n[r],t));for(let r of RW)typeof n[r]=="function"&&(n[r]=PW(n,n[r]));return typeof n.removeAllListeners=="function"&&(n.removeAllListeners=kW(n,n.removeAllListeners)),e}function OW(e,t){return function(...n){return Be(t,()=>e.apply(this,n))}}function bR(e){return typeof e=="function"}function xW(e,t,n){return function(...r){let o=r[0],i=r[1],s=r.slice(2);if(!bR(i)||CW(i))return t.apply(this,r);let c=Eu(e)||Ah(e),a=c.get(o);a||(a=new WeakMap,c.set(o,a));let l=a.get(i);l||(l=OW(i,n),a.set(i,l));let p=zs;zs=l;try{return t.call(this,o,l,...s)}finally{zs=p}}}function PW(e,t){return function(...n){let r=n[0],o=n[1],i=n.slice(2),s=bR(o)?Eu(e)?.get(r)?.get(o):void 0;return s?t.call(this,r,s,...i):t.apply(this,n)}}function kW(e,t){return function(...n){let r=Eu(e);if(r)if(n.length===0)Ah(e);else{let o=n[0];r.delete(o)}return t.apply(this,n)}}function Ah(e){let t=new Map;return e[hR]=t,t}function Eu(e){return e[hR]}function vh(e,t){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=t;LW(e,t),r&&GW(e,r),UW(e,n),MW(e,o),wW(e,i)}function Nh(e,t){let{extra:n,tags:r,attributes:o,user:i,contexts:s,level:c,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:p,eventProcessors:u,attachments:d,propagationContext:m,transactionName:_,span:h}=t;Kc(e,"extra",n),Kc(e,"tags",r),Kc(e,"attributes",o),Kc(e,"user",i),Kc(e,"contexts",s),e.sdkProcessingMetadata=Vo(e.sdkProcessingMetadata,a,2),c&&(e.level=c),_&&(e.transactionName=_),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),p.length&&(e.fingerprint=[...e.fingerprint,...p]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...m}}function Kc(e,t,n){e[t]=Vo(e[t],n,1)}function Cn(e,t){let n=Di().getScopeData();return e&&Nh(n,e.getScopeData()),t&&Nh(n,t.getScopeData()),n}function LW(e,t){let{extra:n,tags:r,user:o,contexts:i,level:s,transactionName:c}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(o).length&&(e.user={...o,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),s&&(e.level=s),c&&e.type!=="transaction"&&(e.transaction=c)}function MW(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function wW(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function GW(e,t){e.contexts={trace:Lr(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:nt(t),...e.sdkProcessingMetadata};let n=Re(t),r=ie(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function UW(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function yR(e){let t={},{response:n,profile:r,cloud_resource:o,culture:i,state:s}=e;if(n&&(n.status_code!=null&&(t["http.response.status_code"]=n.status_code),n.body_size!=null&&(t["http.response.body.size"]=n.body_size)),r&&(r.profile_id&&(t["sentry.profile_id"]=r.profile_id),r.profiler_id&&(t["sentry.profiler_id"]=r.profiler_id)),o)for(let[l,p]of Object.entries(o))p!=null&&(t[l]=p);i&&(i.locale&&(t["culture.locale"]=i.locale),i.timezone&&(t["culture.timezone"]=i.timezone)),s?.state&&typeof s.state.type=="string"&&(t["state.type"]=s.state.type);let c=e.angular;if(c){let l=c.version;(typeof l=="string"||typeof l=="number")&&(t["angular.version"]=l)}let a=e.react;if(a){let l=a.version;(typeof l=="string"||typeof l=="number")&&(t["react.version"]=l)}return t}var SR="aws.dynamodb.attribute_definitions",ER="aws.dynamodb.consistent_read",TR="aws.dynamodb.consumed_capacity",IR="aws.dynamodb.count",AR="aws.dynamodb.exclusive_start_table",NR="aws.dynamodb.global_secondary_indexes",vR="aws.dynamodb.global_secondary_index_updates",Rh="aws.dynamodb.index_name",RR="aws.dynamodb.item_collection_metrics",CR="aws.dynamodb.limit",OR="aws.dynamodb.local_secondary_indexes",xR="aws.dynamodb.projection",PR="aws.dynamodb.provisioned_read_capacity",kR="aws.dynamodb.provisioned_write_capacity",LR="aws.dynamodb.scanned_count",MR="aws.dynamodb.scan_forward",wR="aws.dynamodb.segment",Ch="aws.dynamodb.select",GR="aws.dynamodb.table_count",Oh="aws.dynamodb.table_names",UR="aws.dynamodb.total_segments";var DR="aws.kinesis.stream.name";var BR="aws.request.extended_id";var HR="aws.request.id",FR="aws.s3.bucket",xh="aws.secretsmanager.secret.arn",Ph="aws.sns.topic.arn",WR="aws.step_functions.activity.arn",VR="aws.step_functions.state_machine.arn";var ea="cache.key";var Tu="cloud.region";var Iu="code.function.name";var ta="db.collection.name";var Et="db.name",bo="db.namespace",na="db.operation",ra="db.operation.batch.size",lr="db.operation.name";var Ur="db.query.text";var Ve="db.statement";var Pe="db.system",mt="db.system.name",Gt="db.user";var Dr="error.type";var YR="faas.execution";var jR="faas.invoked_name",ZR="faas.invoked_provider",XR="faas.invoked_region",KR="faas.name";var Au="faas.trigger";var qR="gen_ai.embeddings.input",QR="gen_ai.function_id",JR="gen_ai.input.messages",Nu="gen_ai.operation.name";var kh="gen_ai.output.messages";var $R="gen_ai.request.available_tools";var yo="gen_ai.request.max_tokens";var qc="gen_ai.request.model";var qo="gen_ai.request.stop_sequences",So="gen_ai.request.temperature";var Eo="gen_ai.request.top_p",Ct="gen_ai.response.finish_reasons",zR="gen_ai.response.id",e0="gen_ai.response.model",t0="gen_ai.response.streaming";var Qc="gen_ai.system";var n0="gen_ai.tool.input";var r0="gen_ai.tool.name",o0="gen_ai.tool.output",i0="gen_ai.tool.type";var zt="gen_ai.usage.input_tokens";var Tt="gen_ai.usage.output_tokens";var Lh="gen_ai.usage.total_tokens",oa="graphql.document",vu="graphql.operation.name",Ru="graphql.operation.type";var s0="http.client_ip";var a0="http.flavor";var c0="http.host",Br="http.method";var Hr="http.request.method";var yn="http.response.status_code";var He="http.route",l0="http.scheme";var To="http.status_code",Cu="http.target",Io="http.url",p0="http.user_agent";var Ou="koa.name",Mh="koa.type";var ia="messaging.batch.message_count",u0="messaging.destination";var On="messaging.destination.name";var sa="messaging.message.id";var aa="messaging.operation.name",pr="messaging.operation.type";var Ut="messaging.system";var d0="network.peer.address",m0="network.peer.port",wh="network.protocol.name",f0="network.protocol.version";var g0="net.host.ip",_0="net.host.name",h0="net.host.port",b0="net.peer.ip",Le="net.peer.name",xe="net.peer.port";var ca="net.transport";var y0="rpc.grpc.status_code",S0="rpc.method";var xu="rpc.service",E0="rpc.system";var Gh="sentry.graphql.operation";var T0="sentry.http.prefetch";var I0="sentry.origin";var A0="sentry.sdk.name",N0="sentry.sdk.version",v0="sentry.segment.id";var R0="sentry.segment.name";var C0="sentry.trace_lifecycle";var _t="server.address";var ht="server.port",Uh="service.name",O0="service.version";var pt="url.full",Qo="url.path";var Pu="url.query";var x0="url.scheme";var P0="user_agent.original";function Dh(e,t){let n=fu(e),r=Ks(e),o=fu(r),{isolationScope:i,scope:s}=Qt(e),c=Cn(i,s);HW(n,o,t,c);let a=e.kind;t.emit("preprocessSpan",n,{spanKind:a}),n.is_segment&&(DW(n,c),BW(n,t),t.emit("processSegmentSpan",n)),t.emit("processSpan",n);let{beforeSendSpan:l}=t.getOptions(),p=l&&ho(l)?FW(n,l):n,u=p.attributes?.[ve];return n.is_segment&&u&&Dt(p,{"sentry.segment.name.source":u}),{...gu(p),_segmentSpan:r}}function DW(e,t){let n=yR(t.contexts);Dt(e,n)}function Dt(e,t){let n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,o])=>{o!=null&&!(r in n)&&(n[r]=o)})}function BW(e,t){let n=t.getIntegrationNames();n.length&&Dt(e,{[Z_]:n})}function HW(e,t,n,r){let o=n.getSdkMetadata(),{release:i,environment:s}=n.getOptions();Dt(e,{[C0]:"stream",[R0]:t.name,[v0]:t.span_id,[A0]:o?.sdk?.name,[N0]:o?.sdk?.version,[Y_]:i,[j_]:s||Ko,[X_]:r.user?.id,[K_]:r.user?.email,[Lc]:r.user?.ip_address,[q_]:r.user?.username,...r.attributes})}function FW(e,t){let n=t(e);return n||(Vi(),e)}var Bh=0,k0=1,L0=2;function Ao(e){return new ku(t=>{t(e)})}function Lu(e){return new ku((t,n)=>{n(e)})}var ku=class e{constructor(t){this._state=Bh,this._handlers=[],this._runExecutor(t)}then(t,n){return new e((r,o)=>{this._handlers.push([!1,i=>{if(!t)r(i);else try{r(t(i))}catch(s){o(s)}},i=>{if(!n)o(i);else try{r(n(i))}catch(s){o(s)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new e((n,r)=>{let o,i;return this.then(s=>{i=!1,o=s,t&&t()},s=>{i=!0,o=s,t&&t()}).then(()=>{if(i){r(o);return}n(o)})})}_executeHandlers(){if(this._state===Bh)return;let t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===k0&&n[1](this._value),this._state===L0&&n[2](this._value),n[0]=!0)})}_runExecutor(t){let n=(i,s)=>{if(this._state===Bh){if(bt(s)){s.then(r,o);return}this._state=i,this._value=s,this._executeHandlers()}},r=i=>{n(k0,i)},o=i=>{n(L0,i)};try{t(r,o)}catch(i){o(i)}}};function M0(e,t,n,r=0){try{let o=Hh(t,n,e,r);return bt(o)?o:Ao(o)}catch(o){return Lu(o)}}function Hh(e,t,n,r){let o=n[r];if(!e||!o)return e;let i=o({...e},t);return E&&i===null&&g.log(`Event processor "${o.id||"?"}" dropped event`),bt(i)?i.then(s=>Hh(s,t,n,r+1)):Hh(i,t,n,r+1)}var Zi,w0,G0,Jo;function Jc(e){let t=te._sentryDebugIds,n=te._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],o=n?Object.keys(n):[];if(Jo&&r.length===w0&&o.length===G0)return Jo;w0=r.length,G0=o.length,Jo={},Zi||(Zi={});let i=(s,c)=>{for(let a of s){let l=c[a],p=Zi?.[a];if(p&&Jo&&l)Jo[p[0]]=l,Zi&&(Zi[a]=[p[0],l]);else if(l){let u=e(a);for(let d=u.length-1;d>=0;d--){let _=u[d]?.filename;if(_&&Jo&&Zi){Jo[_]=l,Zi[a]=[_,l];break}}}}};return t&&i(r,t),n&&i(o,n),Jo}function U0(e,t,n,r,o,i){let{normalizeDepth:s=3,normalizeMaxBreadth:c=1e3}=e,a={...t,event_id:t.event_id||n.event_id||dt(),timestamp:t.timestamp||xr()},l=n.integrations||e.integrations.map(N=>N.name);WW(a,e),jW(a,l),o&&o.emit("applyFrameMetadata",t),t.type===void 0&&VW(a,e.stackParser);let p=XW(r,n.captureContext);n.mechanism&&Hn(a,n.mechanism);let u=o?o.getEventProcessors():[],d=Cn(i,p),m=[...n.attachments||[],...d.attachments];m.length&&(n.attachments=m),vh(a,d);let _=[...u,...d.eventProcessors];return(n.data&&n.data.__sentry__===!0?Ao(a):M0(_,a,n)).then(N=>(N&&YW(N),typeof s=="number"&&s>0?ZW(N,s,c):N))}function WW(e,t){let{environment:n,release:r,dist:o,maxValueLength:i}=t;e.environment=e.environment||n||Ko,!e.release&&r&&(e.release=r),!e.dist&&o&&(e.dist=o);let s=e.request;s?.url&&i&&(s.url=gn(s.url,i)),i&&e.exception?.values?.forEach(c=>{c.value&&(c.value=gn(c.value,i))})}function VW(e,t){let n=Jc(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function YW(e){let t={};if(e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?t[o.abs_path]=o.debug_id:o.filename&&(t[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function jW(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function ZW(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:Ke(o.data,t,n)}}))},...e.user&&{user:Ke(e.user,t,n)},...e.contexts&&{contexts:Ke(e.contexts,t,n)},...e.extra&&{extra:Ke(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ke(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(o=>({...o,...o.data&&{data:Ke(o.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Ke(e.contexts.flags,3,n)),r}function XW(e,t){if(!t)return e;let n=e?e.clone():new Kt;return n.update(t),n}function D0(e){if(e)return KW(e)?{captureContext:e}:QW(e)?{captureContext:e}:e}function KW(e){return e instanceof Kt||typeof e=="function"}var qW=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function QW(e){return Object.keys(e).some(t=>qW.includes(t))}function me(e,t){return ne().captureException(e,D0(t))}function $c(e,t){let n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return ne().captureMessage(e,n,r)}function zc(e,t){return ne().captureEvent(e,t)}function Fh(e,t){J().setContext(e,t)}function Wh(e){J().setExtras(e)}function Vh(e,t){J().setExtra(e,t)}function Yh(e){J().setTags(e)}function jh(e,t){J().setTag(e,t)}function Zh(e){J().setAttributes(e)}function Xh(e,t){J().setAttribute(e,t)}function Kh(e){J().setUser(e)}function B0(e){J().setConversationId(e)}function qh(){return J().lastEventId()}async function Xi(e){let t=O();return t?t.flush(e):(E&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function Qh(e){let t=O();return t?t.close(e):(E&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function Jh(){return!!O()}function Ki(){let e=O();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function $h(e){J().addEventProcessor(e)}function el(e){let t=J(),{user:n}=Cn(t,ne()),{userAgent:r}=te.navigator||{},o=Ov({user:n,...r&&{userAgent:r},...e}),i=t.getSession();return i?.status==="ok"&&mo(i,{status:"exited"}),qi(),t.setSession(o),o}function qi(){let e=J(),n=ne().getSession()||e.getSession();n&&xv(n),H0(),e.setSession()}function H0(){let e=J(),t=O(),n=e.getSession();n&&t&&t.captureSession(n)}function zh(e=!1){if(e){qi();return}H0()}function Fr(e,t,n){function r(){let i=tl({monitorSlug:e,status:"in_progress"},n),s=lt();function c(l){tl({monitorSlug:e,status:l,checkInId:i,duration:lt()-s})}let a;try{a=t()}catch(l){throw c("error"),l}return bt(a)?a.then(l=>(c("ok"),l),l=>{throw c("error"),l}):(c("ok"),a)}let o={...ne().getPropagationContext()};return or(()=>{if(n?.isolateTrace)return Rn(r);let i=ne();return Mc(i.getPropagationContext())||i.setPropagationContext(o),r()})}function tl(e,t){let n=ne(),r=O();if(!r)E&&g.warn("Cannot capture check-in. No client defined.");else if(!r.captureCheckIn)E&&g.warn("Cannot capture check-in. Client does not support sending check-ins.");else return r.captureCheckIn(e,t,n);return dt()}function xn(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}function ue(e,t=1){if(St(Je()).getTracingChannelBinding?.()){e();return}t&&xn(setTimeout(()=>{ue(e,t-1)},1))}var JW="7";function $W(e){let t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function zW(e){return`${$W(e)}${e.projectId}/envelope/`}function eV(e,t){let n={sentry_version:JW};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function F0(e,t,n){return t||`${zW(e)}?${eV(e,n)}`}var eb=[];function tV(e){let t={};return e.forEach(n=>{let{name:r}=n,o=t[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function tb(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){let o=n(t);r=Array.isArray(o)?o:[o]}else r=t;return tV(r)}function W0(e,t){let n={};return t.forEach(r=>{r?.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&rb(e,r,n)}),n}function nb(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function rb(e,t,n){if(n[t.name]){E&&g.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!eb.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),eb.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(o,i)=>r(o,i,e))}if(typeof t.processEvent=="function"){let r=t.processEvent.bind(t),o=Object.assign((i,s)=>r(i,s,e),{id:t.name});e.addEventProcessor(o)}["processSpan","processSegmentSpan"].forEach(r=>{let o=t[r];typeof o=="function"&&e.on(r,i=>o.call(t,i,e))}),E&&g.log(`Integration installed: ${t.name}`)}function ob(e){let t=O();if(!t){E&&g.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function Bt(e,t){let n={...e,...t};for(let r in t){let o=e[r],i=t[r];if(typeof o=="function"&&typeof i=="function"){let s=new Proxy(o,{apply:(c,a,l)=>(Reflect.apply(c,a,l),Reflect.apply(i,a,l))});n[r]=s}}return n}var nV="sentry.timestamp.sequence",ib=0,sb;function Mu(e){let t=Math.floor(e*1e3);sb!==void 0&&t!==sb&&(ib=0);let n=ib;return ib++,sb=t,{key:nV,value:{value:n,type:"integer"}}}function la(e,t){return t?Be(t,()=>{let n=Q(),r=n?Lr(n):Bi(t);return[n?nt(n):ar(e,t),r]}):[void 0,void 0]}var V0={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function Y0(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function j0(){return!Y0()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function It(){return typeof window<"u"&&(!j0()||rV())}function rV(){return te.process?.type==="renderer"}function oV(e,t){let n=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...It()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Z0(e,t,n,r,o){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=sn(r)),wt(i,[oV(e,o)])}var iV=100;function Wr(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function X0(e,t){let n=cb(),r=K0(e);r===void 0?n.set(e,[t]):r.length>=iV?(pa(e,r),n.set(e,[t])):n.set(e,[...r,t])}function ur(e,t=ne(),n=X0){let r=t?.getClient()??O();if(!r){E&&g.warn("No client available to capture log.");return}let{release:o,environment:i,enableLogs:s=!0,beforeSendLog:c}=r.getOptions();if(!s){E&&g.warn("logging option not enabled, log will not be captured.");return}let[,a]=la(r,t),l={...e.attributes},{user:{id:p,email:u,username:d},attributes:m={}}=Cn(J(),t);Wr(l,"user.id",p,!1),Wr(l,"user.email",u,!1),Wr(l,"user.name",d,!1),Wr(l,"sentry.release",o),Wr(l,"sentry.environment",i);let{name:_,version:h}=r.getSdkMetadata()?.sdk??{};Wr(l,"sentry.sdk.name",_),Wr(l,"sentry.sdk.version",h);let b=r.getIntegrationByName("Replay"),N=b?.getReplayId(!0);Wr(l,"sentry.replay_id",N),N&&b?.getRecordingMode()==="buffer"&&Wr(l,"sentry._internal.replay_is_buffering",!0);let L=e.message;if(Fo(L)){let{__sentry_template_string__:Ne,__sentry_template_values__:Te=[]}=L;Te?.length&&(l["sentry.message.template"]=Ne),Te.forEach((Oe,qe)=>{l[`sentry.message.parameter.${qe}`]=Oe})}let R=rr(t);Wr(l,"sentry.trace.parent_span_id",R?.spanContext().spanId);let v={...e,attributes:l};r.emit("beforeCaptureLog",v);let P=c?Me(()=>c(v)):v;if(!P){r.recordDroppedEvent("before_send","log_item",1),E&&g.warn("beforeSendLog returned null, log will not be captured.");return}let{level:G,message:I,attributes:B={},severityNumber:k}=P,U=lt(),ce=Mu(U),ge={timestamp:U,level:G,body:ab(String(I)),trace_id:a?.trace_id,severity_number:k??V0[G],attributes:sV({...fo(m),...fo(B,!0),[ce.key]:ce.value})};n(r,ge),r.emit("afterCaptureLog",P)}function pa(e,t){let n=t??K0(e)??[];if(n.length===0)return;let r=e.getOptions(),o=Z0(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);cb().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function K0(e){return cb().get(e)}function cb(){return Bn("clientToLogBufferMap",()=>new WeakMap)}function sV(e){let t={};for(let[n,r]of Object.entries(e)){let o=ab(n);r.type==="string"?t[o]={...r,value:ab(r.value)}:t[o]=r}return t}function ab(e){let t=Object(e),n=t.isWellFormed,r=t.toWellFormed;return typeof n=="function"&&typeof r=="function"?n.call(e)?e:r.call(e):e}function aV(e,t){let n=t?"auto":"never";return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...It()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function q0(e,t,n,r,o){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=sn(r)),wt(i,[aV(e,o)])}var cV=1e3;function No(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function lV(e,t){let n=pb(),r=J0(e);r===void 0?n.set(e,[t]):r.length>=cV?(lb(e,r),n.set(e,[t])):n.set(e,[...r,t])}function pV(e,t,n){let{release:r,environment:o}=t.getOptions(),i={...e.attributes};No(i,"user.id",n.id,!1),No(i,"user.email",n.email,!1),No(i,"user.name",n.username,!1),No(i,"sentry.release",r),No(i,"sentry.environment",o);let{name:s,version:c}=t.getSdkMetadata()?.sdk??{};No(i,"sentry.sdk.name",s),No(i,"sentry.sdk.version",c);let a=t.getIntegrationByName("Replay"),l=a?.getReplayId(!0);return No(i,"sentry.replay_id",l),l&&a?.getRecordingMode()==="buffer"&&No(i,"sentry._internal.replay_is_buffering",!0),{...e,attributes:i}}function uV(e,t,n,r){let[,o]=la(t,n),i=rr(n),s=i?i.spanContext().traceId:o?.trace_id,c=i?i.spanContext().spanId:void 0,a=lt(),l=Mu(a);return{timestamp:a,trace_id:s??"",span_id:c,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...fo(r),...fo(e.attributes,"skip-undefined"),[l.key]:l.value}}}function Q0(e,t){let n=t?.scope??ne(),r=t?.captureSerializedMetric??lV,o=n?.getClient()??O();if(!o){E&&g.warn("No client available to capture metric.");return}let{_experiments:i,enableMetrics:s,beforeSendMetric:c}=o.getOptions();if(!(s??i?.enableMetrics??!0)){E&&g.warn("metrics option not enabled, metric will not be captured.");return}let{user:l,attributes:p}=Cn(J(),n),u=pV(e,o,l);o.emit("processMetric",u);let d=c||i?.beforeSendMetric,m=d?d(u):u;if(!m){E&&g.log("`beforeSendMetric` returned `null`, will not send metric.");return}let _=uV(m,o,n,p);E&&g.log("[Metric]",_),r(o,_),o.emit("afterCaptureMetric",m)}function lb(e,t){let n=t??J0(e)??[];if(n.length===0)return;let r=e.getOptions(),o=q0(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);pb().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function J0(e){return pb().get(e)}function pb(){return Bn("clientToMetricBufferMap",()=>new WeakMap)}function $0(e){let t={trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||"",start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status==="ok"||e.status==="cancelled"?"ok":"error",is_segment:!1,attributes:{...e.data},links:e.links};return gu(t)}function z0(e,t){if(e.type!=="transaction"||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||rt(t))return;let n=[],r=[];for(let i of e.spans)i.op?.startsWith("gen_ai.")?n.push($0(i)):r.push(i);if(n.length===0)return;e.spans=r;let o=t.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...It()&&{ingest_settings:{infer_ip:o,infer_user_agent:o}},items:n}]}var nl=Symbol.for("SentryBufferFullError");function ua(e=100){let t=new Set;function n(){return t.size<e}function r(s){t.delete(s)}function o(s){if(!n())return Lu(nl);let c=s();return t.add(c),c.then(()=>r(c),()=>r(c)),c}function i(s){if(!t.size)return Ao(!0);let c=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return c;let a=[c,new Promise(l=>xn(setTimeout(()=>l(!1),s)))];return Promise.race(a)}return{get $(){return Array.from(t)},add:o,drain:i}}var dV=60*1e3;function mV(e,t=tt()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?dV:r-t}function fV(e,t){return e[t]||e.all||0}function eC(e,t,n=tt()){return fV(e,t)>n}function tC(e,{statusCode:t,headers:n},r=tt()){let o={...e},i=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(i)for(let c of i.trim().split(",")){let[a,l,,,p]=c.split(":",5),u=parseInt(a,10),d=(isNaN(u)?60:u)*1e3;if(!l)o.all=r+d;else for(let m of l.split(";"))m==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[m]=r+d):o[m]=r+d}else s?o.all=r+mV(s,r):t===429&&(o.all=r+60*1e3);return o}var rl=64;function da(e,t,n=ua(e.bufferSize||rl)){let r={},o=s=>n.drain(s);function i(s){let c=[];if(Fc(s,(u,d)=>{let m=bu(d);eC(r,m)?e.recordDroppedEvent("ratelimit_backoff",m):c.push(u)}),c.length===0)return Promise.resolve({});let a=wt(s[0],c),l=u=>{if(fh(a,["client_report"])){E&&g.warn(`Dropping client report. Will not send outcomes (reason: ${u}).`);return}Fc(a,(d,m)=>{e.recordDroppedEvent(u,bu(m))})},p=()=>t({body:Wc(a)}).then(u=>u.statusCode===413?(E&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),u):(E&&u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&g.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),r=tC(r,u),u),u=>{throw l("network_error"),E&&g.error("Encountered error running transport request:",u),u});return n.add(p).then(u=>u,u=>{if(u===nl)return E&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw u})}return{send:i,flush:o}}function nC(e,t,n){let r=[{type:"client_report"},{timestamp:n||xr(),discarded_events:e}];return wt(t?{dsn:t}:{},[r])}function wu(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function rC(e){let{trace_id:t,parent_span_id:n,span_id:r,status:o,origin:i,data:s,op:c}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:c,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:s?.[Ws],exclusive_time:s?.[Vs],measurements:e.measurements,is_segment:!0}}function oC(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[Ws]:e.profile_id},...e.exclusive_time&&{[Vs]:e.exclusive_time}}}},measurements:e.measurements}}var Qi="[Filtered]",ol=["forwarded","-ip","remote-","via","-user"],ub=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","sid","identity","set-cookie","cookie"],iC=[".sid","sessid","remember","oidc","pkce","nonce","__secure-","__host-","awsalb","awselb","akamai","__stripe","cognito","firebase","supabase","sb-","mfa","2fa"];function Gu(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:ol},httpHeaders:{request:{deny:ol},response:{deny:ol}},httpBodies:[],urlQueryParams:{deny:ol},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var gV={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:5};function _V(e){return typeof e=="boolean"||"allow"in e||"deny"in e}function hV(e,t){return e===void 0?{...t.httpHeaders}:_V(e)?{request:e,response:e}:{request:e.request??t.httpHeaders.request,response:e.response??t.httpHeaders.response}}function sC(e){let t=e.dataCollection!=null?gV:Gu(e.sendDefaultPii),n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:hV(n.httpHeaders,t),httpBodies:n.httpBodies??t.httpBodies,urlQueryParams:n.urlQueryParams??n.queryParams??t.urlQueryParams,graphQL:{document:n.graphQL?.document??t.graphQL.document,variables:n.graphQL?.variables??t.graphQL.variables},genAI:{inputs:n.genAI?.inputs??t.genAI.inputs,outputs:n.genAI?.outputs??t.genAI.outputs},databaseQueryData:n.databaseQueryData??t.databaseQueryData,stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}var aC="Not capturing exception because it's already been captured.",cC="Discarded session because of missing or non-string release",fC=Symbol.for("SentryInternalError"),gC=Symbol.for("SentryDoNotSendEventError"),bV=5e3;function Uu(e){return{message:e,[fC]:!0}}function db(e){return{message:e,[gC]:!0}}function lC(e){return V(e)&&fC in e}function pC(e){return V(e)&&gC in e}function uC(e,t,n,r,o){let i=0,s,c=!1;e.on(n,()=>{i=0,clearTimeout(s),c=!1}),e.on(t,a=>{if(i+=r(a),i>=8e5)o(e);else if(!c){let l=e.getOptions()._flushInterval??bV;l>0&&(c=!0,s=xn(setTimeout(()=>{o(e)},l)))}}),e.on("flush",()=>{o(e)})}var Du=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=ua(t.transportOptions?.bufferSize??rl),this._dataCollection=sC(t),t.dsn?this._dsn=Zv(t.dsn):E&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=F0(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs??!0,this._options.enableLogs&&uC(this,"afterCaptureLog","flushLogs",TV,pa),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&uC(this,"afterCaptureMetric","flushMetrics",EV,lb)}captureException(t,n,r){let o=dt();if(iu(t))return E&&g.log(aC),o;let i={event_id:o,...n};return this._process(()=>this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r)).then(s=>s),"error"),i.event_id}captureMessage(t,n,r,o){let i={event_id:dt(),...r},s=Fo(t)?t:String(t),c=nr(t),a=c?this.eventFromMessage(s,n,i):this.eventFromException(t,i);return this._process(()=>a.then(l=>this._captureEvent(l,i,o)),c?"unknown":"error"),i.event_id}captureEvent(t,n,r){let o=dt();if(n?.originalException&&iu(n.originalException))return E&&g.log(aC),o;let i={event_id:o,...n},s=t.sdkProcessingMetadata||{},c=s.capturedSpanScope,a=s.capturedSpanIsolationScope,l=dC(t.type);return this._process(()=>this._captureEvent(t,i,c||r,a),l),i.event_id}captureSession(t){this.sendSession(t),mo(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){let n=this._transport;if(this.emit("flush"),!n)return!0;let r=await this._isClientDoneProcessing(t),o=await n.flush(t);return r&&o}async close(t){let n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(t){let n=this._integrations[t.name];!n&&t.beforeSetup&&t.beforeSetup(this),rb(this,t,this._integrations),n||nb(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=z0(t,this),o=sR(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of n.attachments||[])o=hu(o,_h(i));r&&(o=hu(o,r)),this.sendEnvelope(o).then(i=>this.emit("afterSendEvent",t,i))}sendSession(t){let{release:n,environment:r=Ko}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!n){E&&g.warn(cC);return}i.release=i.release||n,i.environment=i.environment||r,t.attrs=i}else{if(!t.release&&!n){E&&g.warn(cC);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);let o=iR(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){let o=`${t}:${n}`;E&&g.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(t,n){let r=this._hooks[t]=this._hooks[t]||new Set,o=(...i)=>n(...i);return r.add(o),()=>{r.delete(o)}}emit(t,...n){let r=this._hooks[t];r&&r.forEach(o=>o(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return E&&g.error("Error while sending envelope:",n),{}}return E&&g.error("Transport disabled"),{}}registerCleanup(t){}dispose(){}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=W0(this,t),nb(this,t)}_updateSessionFromEvent(t,n){let r=n.level==="fatal",o=!1,i=n.exception?.values;if(i){o=!0,r=!1;for(let a of i)if(a.mechanism?.handled===!1){r=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(mo(t,{...r&&{status:"crashed"},errors:t.errors||Number(o||r)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,r,o){let i=this.getOptions(),s=this.getIntegrationNames();return!n.integrations&&s.length&&(n.integrations=s),this.emit("preprocessEvent",t,n),t.type||o.setLastEventId(t.event_id||n.event_id),U0(i,t,n,r,this,o).then(c=>{if(c===null)return c;this.emit("postprocessEvent",c,n),c.contexts={trace:{...c.contexts?.trace,...Bi(r)},...c.contexts};let a=ar(this,r);return c.sdkProcessingMetadata={dynamicSamplingContext:a,...c.sdkProcessingMetadata},c})}_captureEvent(t,n={},r=ne(),o=J()){return E&&mb(t)&&g.log(`Captured error event \`${wu(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,o).then(i=>i.event_id,i=>{E&&(pC(i)?g.log(i.message):lC(i)?g.warn(i.message):g.warn(i))})}_processEvent(t,n,r,o){let i=this.getOptions(),{sampleRate:s}=i,c=_C(t),a=mb(t),p=`before send for type \`${t.type||"error"}\``,u=typeof s>"u"?void 0:An(s),d=dC(t.type);return this._prepareEvent(t,n,r,o).then(m=>{if(m===null)throw this.recordDroppedEvent("event_processor",d),db("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return m;let h=SV(this,i,m,n);return yV(h,p)}).then(m=>{if(m===null){if(this.recordDroppedEvent("before_send",d),c){let N=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",N)}throw db(`${p} returned \`null\`, will not send event.`)}let _=r.getSession()||o.getSession();if(a&&_&&this._updateSessionFromEvent(_,m),a&&typeof u=="number"&&ct()>u)throw this.recordDroppedEvent("sample_rate","error"),db(`Discarding event because it's not included in the random sample (sampling rate = ${s})`);if(c){let b=m.sdkProcessingMetadata?.spanCountBeforeProcessing||0,N=m.spans?m.spans.length:0,L=b-N;L>0&&this.recordDroppedEvent("before_send","span",L)}let h=m.transaction_info;if(c&&h&&m.transaction!==t.transaction){let b="custom";m.transaction_info={...h,source:b}}return this.sendEvent(m,n),m}).then(null,m=>{throw pC(m)||lC(m)?m:(this.captureException(m,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:m}),Uu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
17
|
+
Reason: ${m}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===nl&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{let[o,i]=n.split(":");return{reason:o,category:i,quantity:r}})}_flushOutcomes(){E&&g.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){E&&g.log("No outcomes to send");return}if(!this._dsn){E&&g.log("No dsn provided, will not send outcomes");return}E&&g.log("Sending outcomes:",t);let n=nC(t,this._options.tunnel&&sn(this._dsn));this.sendEnvelope(n)}};function dC(e){return e==="replay_event"?"replay":e||"error"}function yV(e,t){let n=`${t} must return \`null\` or a valid event.`;if(bt(e))return e.then(r=>{if(!Zt(r)&&r!==null)throw Uu(n);return r},r=>{throw Uu(`${t} rejected with ${r}`)});if(!Zt(e)&&e!==null)throw Uu(n);return e}function SV(e,t,n,r){let{beforeSend:o,beforeSendTransaction:i,ignoreSpans:s}=t,c=!ho(t.beforeSendSpan)&&t.beforeSendSpan,a=n;if(mb(a)&&o)return o(a,r);if(_C(a)){if(c||s){let l=rC(a);if(s?.length&&sr({description:l.description,op:l.op,attributes:l.data},s))return null;if(c){let p=c(l);p?a=Vo(n,oC(p)):Vi()}if(a.spans){let p=[],u=a.spans;for(let m of u){if(s?.length&&sr({description:m.description,op:m.op,attributes:m.data},s)){tR(u,m);continue}if(c){let _=c(m);_?p.push(_):(Vi(),p.push(m))}else p.push(m)}let d=a.spans.length-p.length;d&&e.recordDroppedEvent("before_send","span",d),a.spans=p}}if(i){if(a.spans){let l=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return i(a,r)}}return a}function mb(e){return e.type===void 0}function _C(e){return e.type==="transaction"}function EV(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+hC(e.attributes)}function TV(e){let t=0;return e.message&&(t+=e.message.length*2),t+hC(e.attributes)}function hC(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*mC(n[0]):nr(n)?t+=mC(n):t+=100}),t}function mC(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function fb(e){ne().setClient(e)}var gb=new Set;function vo(e){e.forEach(t=>{gb.add(t),E&&g.log(`AI provider "${t}" wrapping will be skipped`)})}function Pn(e){return gb.has(e)}function _b(){gb.clear(),E&&g.log("Cleared AI provider skip registrations")}function hb(e,t){return t.some(n=>e.includes(n))}function ma(e,t,n){if(t===!1)return{};let r=n!=null?[...ub,...n]:ub,o={};if(t===!0){for(let s of Object.keys(e))o[s]=hb(s.toLowerCase(),r)?Qi:e[s];return o}if("deny"in t){let s=t.deny.map(c=>c.toLowerCase());for(let c of Object.keys(e)){let a=c.toLowerCase(),l=hb(a,r)||s.some(p=>a.includes(p));o[c]=l?Qi:e[c]}return o}let i=t.allow.map(s=>s.toLowerCase());for(let s of Object.keys(e)){let c=s.toLowerCase();if(hb(c,r))o[s]=Qi;else{let a=i.some(l=>c.includes(l));o[s]=a?e[s]:Qi}}return o}function bC(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf("=",n);if(r===-1)break;let o=e.indexOf(";",n);if(o===-1)o=e.length;else if(o<r){n=e.lastIndexOf(";",r-1)+1;continue}let i=e.slice(n,r).trim();if(t[i]===void 0){let s=e.slice(r+1,o).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));try{t[i]=s.indexOf("%")!==-1?decodeURIComponent(s):s}catch{t[i]=s}}n=o+1}return t}var IV=new Set(["false","f","n","no","off","0"]),AV=new Set(["true","t","y","yes","on","1"]);function Ji(e,t){let n=String(e).toLowerCase();return IV.has(n)?!1:AV.has(n)?!0:t?.strict?null:!!e}function yC(e,t,n,r,o){let i={sent_at:new Date(tt()).toISOString()};n?.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(i.dsn=sn(o)),t&&(i.trace=t);let s=NV(e);return wt(i,[s])}function NV(e){return[{type:"check_in"},e]}var vV="thismessage:/";function dr(e){return"isRelative"in e}function mr(e,t){let n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=t??(n?vV:void 0);try{if("canParse"in URL&&!URL.canParse(e,r))return;let o=new URL(e,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function SC(e){if(dr(e))return e.pathname;let t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function RV(e,t,n,r){let o=n?.method?.toUpperCase()??"GET",i=r||(e?t==="client"?SC(e):e.pathname:"/");return`${o} ${i}`}function bb(e,t,n,r,o){let i={[S]:n,[ve]:"url"};return o&&(i[t==="server"?"http.route":"url.template"]=o,i[ve]="route"),r?.method&&(i[z_]=r.method.toUpperCase()),e&&(e.search&&(i["url.query"]=e.search),e.hash&&(i["url.fragment"]=e.hash),e.pathname&&(i["url.path"]=e.pathname,e.pathname==="/"&&(i[ve]="route")),dr(e)||(i[pt]=e.href,e.port&&(i["url.port"]=e.port),e.protocol&&(i["url.scheme"]=e.protocol),e.hostname&&(i[t==="server"?"server.address":"url.domain"]=e.hostname))),[RV(e,t,r,o),i]}function $o(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function fr(e){return e.split(/[?#]/,1)[0]}function zo(e){let{protocol:t,host:n,path:r}=e,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${o}${r}`}function il(e,t=!0){if(e.startsWith("data:")){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=e.includes(";base64,"),i=e.indexOf(","),s="";if(t&&i!==-1){let c=e.slice(i+1);s=c.length>10?`${c.slice(0,10)}... [truncated]`:c}return`data:${r}${o?",base64":""}${s?`,${s}`:""}`}return e}function yb(e,t){let n=t?.getDsn(),r=t?.getOptions().tunnel;return OV(e,n)||CV(e,r)}function CV(e,t){return t?EC(e)===EC(t):!1}function OV(e,t){let n=mr(e);return!n||dr(n)||!t?!1:xV(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function xV(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function EC(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function Bu(e,...t){let n=new String(String.raw(e,...t));return n.__sentry_template_string__=e.join("\0").replace(/%/g,"%%").replace(/\0/g,"%s"),n.__sentry_template_values__=t,n}var Sb=Bu;function $i(e,t,n=[t],r="npm"){let o=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${t}`,o.packages=n.map(i=>({name:`${r}:@sentry/${i}`,version:q})),o.version=q)}function $e(e={}){let t=e.client||O();if(!Ki()||!t)return{};let n=Je(),r=St(n);if(r.getTraceData)return r.getTraceData(e);let o=e.scope||ne(),i=e.span||Q(),s=Xo(i)&&!Ue(t.getOptions());if(!i&&F_())return{};let c=i&&!s?Dc(i):PV(o),a=i?nt(i):ar(t,o),l=Yo(a);if(!uu.test(c))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let u={"sentry-trace":c,baggage:l};return e.propagateTraceparent&&(u.traceparent=i&&!s?Jv(i):kV(o)),u}function PV(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return jo(t,r,n)}function kV(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Zo(t,r,n)}var TC="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function zi(e,t,n){if(typeof e!="string"||!t)return!0;let r=n?.get(e);if(r!==void 0)return E&&!r&&g.log(TC,e),r;let o=_n(e,t);return n?.set(e,o),E&&!o&&g.log(TC,e),o}function Eb(e){return Object.entries(e||$e()).map(([t,n])=>`<meta name="${t}" content="${n}"/>`).join("")}function sl(e){return Array.from(new Set(e))}var IC=1024*1024;function Tb(e){return e==="small"?1e3:e==="medium"?1e4:IC}function AC(e){let t={};try{e.forEach((n,r)=>{typeof n=="string"&&(t[r]=n)})}catch{}return t}function Fu(e){let t=Object.create(null);try{Object.entries(e).forEach(([n,r])=>{typeof r=="string"?t[n]=r:typeof r=="number"&&(t[n]=String(r))})}catch{}return t}function es(e){let t=e.headers||{},r=(typeof t["x-forwarded-host"]=="string"?t["x-forwarded-host"]:void 0)||(typeof t.host=="string"?t.host:void 0),i=(typeof t["x-forwarded-proto"]=="string"?t["x-forwarded-proto"]:void 0)||e.protocol||(e.socket?.encrypted?"https":"http"),s=e.url||"",c=LV({url:s,host:r,protocol:i}),a=e.body||void 0,l=e.cookies;return{url:c,method:e.method,query_string:NC(s),headers:Fu(t),cookies:l,data:a}}function LV({url:e,protocol:t,host:n}){if(e?.startsWith("http"))return e;if(e&&n)return`${t}://${n}${e}`}function Vr(e,t=!1,n="request"){let r=typeof t=="boolean"?Gu(t):t,o=n==="request"?r.httpHeaders.request:r.httpHeaders.response,i=r.cookies,s=`http.${n}.header.`,c={};try{let a={};for(let[l,p]of Object.entries(e)){if(p==null)continue;let u=l.toLowerCase();if(u==="cookie"||u==="set-cookie"){if(i===!1)continue;if(typeof p=="string"&&p!==""){let m=MV(p,u==="set-cookie"),_=ma(m,i,iC);for(let[h,b]of Object.entries(_))c[`${s}${Hu(u)}.${Hu(h)}`]=b}else c[`${s}${Hu(u)}`]=Qi}else{if(o===!1)continue;Array.isArray(p)?a[u]=p.map(m=>m!=null?String(m):m).join(";"):typeof p=="string"&&(a[u]=p)}}if(o!==!1){let l=ma(a,o);for(let[p,u]of Object.entries(l))c[`${s}${Hu(p)}`]=u}}catch{}return c}function Hu(e){return e.replace(/-/g,"_")}function MV(e,t){let n=e.indexOf(";"),r=t&&n!==-1?e.substring(0,n):e,o=t?[r]:r.split("; "),i={};for(let s of o){let c=s.indexOf("="),a=(c!==-1?s.substring(0,c):s).toLowerCase(),l=c!==-1?s.substring(c+1):"";i[a]=l}return i}function NC(e){if(e)try{let t=new URL(e,"http://s.io").search.slice(1);return t.length?t:void 0}catch{return}}var D={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},wV={[D.INTERNAL]:"INTERNAL",[D.SERVER]:"SERVER",[D.CLIENT]:"CLIENT",[D.PRODUCER]:"PRODUCER",[D.CONSUMER]:"CONSUMER"};function Ib(e){return wV[e]}var GV=100;function an(e,t){let n=O(),r=J();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:i=GV}=n.getOptions();if(i<=0)return;let c={timestamp:xr(),...e},a=o?Me(()=>o(c,t)):c;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,i))}var UV="FunctionToString",vC=new WeakMap,DV=(()=>({name:UV,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Cr(this),r;try{vC.has(O())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){vC.set(e,!0)}})),al=DV;var BV=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/Java exception was raised during method invocation$/,/Java object is gone$/],HV="EventFilters",Vu=(e={})=>{let t;return{name:HV,setup(n){let r=n.getOptions();t=RC(e,r)},processEvent(n,r,o){if(!t){let i=o.getOptions();t=RC(e,i)}return FV(n,t)?null:n}}},cl=((e={})=>({...Vu(e),name:"InboundFilters"}));function RC(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:BV],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function FV(e,t){if(e.type){if(e.type==="transaction"&&VV(e,t.ignoreTransactions))return E&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
18
|
+
Event: ${Wo(e)}`),!0}else{if(WV(e,t.ignoreErrors))return E&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
19
|
+
Event: ${Wo(e)}`),!0;if(XV(e))return E&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
20
|
+
Event: ${Wo(e)}`),!0;if(YV(e,t.denyUrls))return E&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
21
|
+
Event: ${Wo(e)}.
|
|
22
|
+
Url: ${Wu(e)}`),!0;if(!jV(e,t.allowUrls))return E&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
23
|
+
Event: ${Wo(e)}.
|
|
24
|
+
Url: ${Wu(e)}`),!0}return!1}function WV(e,t){return t?.length?wu(e).some(n=>_n(n,t)):!1}function VV(e,t){if(!t?.length)return!1;let n=e.transaction;return n?_n(n,t):!1}function YV(e,t){if(!t?.length)return!1;let n=Wu(e);return n?_n(n,t):!1}function jV(e,t){if(!t?.length)return!0;let n=Wu(e);return n?_n(n,t):!0}function ZV(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Wu(e){try{let n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?ZV(n):null}catch{return E&&g.error(`Cannot extract url for event ${Wo(e)}`),null}}function XV(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function xC(e,t,n,r,o,i){if(!o.exception?.values||!i||!et(i.originalException))return;let s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=Ab(e,t,r,i.originalException,n,o.exception.values,s,0))}function Ab(e,t,n,r,o,i,s,c){if(i.length>=n+1)return i;let a=[...i];if(et(r[o])){CC(s,c,r);let l=e(t,r[o]),p=a.length;OC(l,o,p,c),a=Ab(e,t,n,r[o],o,[l,...a],l,p)}return PC(r)&&r.errors.forEach((l,p)=>{if(et(l)){CC(s,c,r);let u=e(t,l),d=a.length;OC(u,`errors[${p}]`,d,c),a=Ab(e,t,n,l,o,[u,...a],u,d)}}),a}function PC(e){return Array.isArray(e.errors)}function CC(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...PC(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function OC(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function kC(e,t){return e(t.stack||"",1)}function KV(e){return et(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function qV(e){return KV(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Nb(e,t){let n={type:t.name||t.constructor.name,value:qV(t)},r=kC(e,t);return r.length&&(n.stacktrace={frames:r}),n}function QV(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(et(n))return n}}function JV(e){if("name"in e&&typeof e.name=="string"){let r=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(r+=` with message '${e.message}'`),r}else if("message"in e&&typeof e.message=="string")return e.message;let t=O_(e);if(N_(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=$V(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${t}`}function $V(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function zV(e,t,n,r){if(et(n))return[n,void 0];if(t.synthetic=!0,Zt(n)){let i=e?.getOptions().normalizeDepth,s={__serialized__:P_(n,i)},c=QV(n);if(c)return[c,s];let a=JV(n),l=r?.syntheticException||new Error(a);return l.message=a,[l,s]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function LC(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[s,c]=zV(e,i,n,r),a={exception:{values:[Nb(t,s)]}};return c&&(a.extra=c),G_(a,void 0,void 0),Hn(a,i),{...a,event_id:r?.event_id}}function MC(e,t,n="info",r,o){let i={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let s=kC(e,r.syntheticException);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]},Hn(i,{synthetic:!0}))}if(Fo(t)){let{__sentry_template_string__:s,__sentry_template_values__:c}=t;return i.logentry={message:s,params:c},i}return i.message=t,i}var eY="cause",tY=5,nY="LinkedErrors",rY=((e={})=>{let t=e.limit||tY,n=e.key||eY;return{name:nY,preprocessEvent(r,o,i){let s=i.getOptions();xC(Nb,s.stackParser,n,t,r,o)}}}),ll=rY;var vb=["X-Client-IP","X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP","Fastly-Client-Ip","True-Client-Ip","X-Real-IP","X-Cluster-Client-IP","X-Forwarded","Forwarded-For","Forwarded","X-Vercel-Forwarded-For"];function Rb(e){let t={};for(let i of Object.keys(e))t[i.toLowerCase()]=e[i];return vb.map(i=>{let s=t[i.toLowerCase()],c=Array.isArray(s)?s.join(";"):s;return i==="Forwarded"?oY(c):c?.split(",").map(a=>a.trim())}).reduce((i,s)=>s?i.concat(s):i,[]).find(i=>i!==null&&iY(i))||null}function oY(e){if(!e)return null;for(let t of e.split(";"))if(t.startsWith("for="))return t.slice(4);return null}function iY(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}var sY="RequestData",aY=((e={})=>{function t(n){let r=n.getDataCollectionOptions(),o={...r,...e.include?.cookies===!0&&r.cookies===!1&&{cookies:!0},...e.include?.headers===!0&&r.httpHeaders.request===!1&&{httpHeaders:{...r.httpHeaders,request:!0}}};return{dataCollection:o,include:{cookies:o.cookies!==!1,data:!0,headers:o.httpHeaders.request!==!1,ip:o.userInfo,query_string:o.urlQueryParams!==!1,url:!0,...e.include}}}return{name:sY,processEvent(n,r,o){let{sdkProcessingMetadata:i={}}=n,{normalizedRequest:s,ipAddress:c}=i,{include:a}=t(o);return s&&cY(n,s,{ipAddress:c},a),n},processSegmentSpan(n,r){let{sdkProcessingMetadata:o={}}=J().getScopeData(),{normalizedRequest:i,ipAddress:s}=o;if(!i)return;let{include:c,dataCollection:a}=t(r);lY(n,i,s,c,a)}}}),pl=aY;function cY(e,t,n,r){if(e.request={...e.request,...wC(t,r)},r.ip){let o=t.headers&&Rb(t.headers)||n.ipAddress;o&&(e.user={...e.user,ip_address:o})}}function lY(e,t,n,r,o){let i=wC(t,r),s={};if(i.url&&(s[pt]=i.url),i.method&&(s["http.request.method"]=i.method),i.query_string&&(s[Pu]=pY(i.query_string)),Dt(e,s),i.cookies&&Object.keys(i.cookies).length>0){let c=Object.entries(i.cookies).map(([l,p])=>`${l}=${p}`).join("; "),a=Vr({cookie:c},o,"request");Dt(e,a)}if(i.headers){let c=Vr(i.headers,o,"request");Dt(e,c)}if(i.data!=null){let c=typeof i.data=="string"?i.data:JSON.stringify(i.data);c&&Dt(e,{"http.request.body.data":c})}if(r.ip){let c=t.headers&&Rb(t.headers)||n||void 0;c&&Dt(e,{[Lc]:c})}}function wC(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let o=new Set(vb.map(i=>i.toLowerCase()));for(let i of Object.keys(r))o.has(i.toLowerCase())&&delete r[i]}if(n.method=e.method,t.url&&(n.url=e.url),t.cookies){let o=e.cookies||(r?.cookie?bC(r.cookie):void 0);n.cookies=o||{}}return t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function pY(e){return typeof e=="string"?e||void 0:(Array.isArray(e)?e:Object.entries(e)).map(([r,o])=>`${r}=${o}`).join("&")||void 0}var Yu=new Set([]);function fa(e){let t="console",n=A_(t,e);return kc(t,uY),n}function UC(e){for(let t of e)Yu.add(t);return()=>{for(let t of e)Yu.delete(t)}}var GC=new Set;function uY(){"console"in te&&tr.forEach(function(e){GC.has(e)||!(e in te.console)||(GC.add(e),Mt(te.console,e,function(t){return er[e]=t,function(...n){let r=n[0],o=er[e],i=Yu.size&&typeof r=="string"&&_n(r,Yu);i||Ms("console",{args:n,level:e}),(!i||E&&g.isEnabled())&&o?.apply(te.console,n)}}))})}function ei(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var dY="CaptureConsole",mY=((e={})=>{let t=e.levels||tr,n=e.handled??!0;return{name:dY,setup(r){"console"in te&&fa(({args:o,level:i})=>{O()!==r||!t.includes(i)||fY(o,i,n)})}}}),Cb=mY;function fY(e,t,n){let r=ei(t),o=new Error,i={level:ei(t),extra:{arguments:e}};Be(s=>{if(s.addEventProcessor(l=>(l.logger="console",Hn(l,{handled:n,type:"auto.core.capture_console"}),l)),t==="assert"){if(!e[0]){let l=`Assertion failed: ${Ds(e.slice(1)," ")||"console.assert"}`;s.setExtra("arguments",e.slice(1)),s.captureMessage(l,r,{captureContext:i,syntheticException:o})}return}let c=e.find(l=>l instanceof Error);if(c){me(c,i);return}let a=Ds(e," ");s.captureMessage(a,r,{captureContext:i,syntheticException:o})})}var gY="Dedupe",_Y=(()=>{let e;return{name:gY,processEvent(t){if(t.type)return t;try{if(hY(t,e))return E&&g.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),Ob=_Y;function hY(e,t){return t?!!(bY(e,t)||yY(e,t)):!1}function bY(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!HC(e,t)||!BC(e,t))}function yY(e,t){let n=DC(t),r=DC(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!HC(e,t)||!BC(e,t))}function BC(e,t){let n=nu(e),r=nu(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let o=0;o<r.length;o++){let i=r[o],s=n[o];if(i.filename!==s.filename||i.lineno!==s.lineno||i.colno!==s.colno||i.function!==s.function)return!1}return!0}function HC(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function DC(e){return e.exception?.values?.[0]}var SY="ExtraErrorData",EY=((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:SY,processEvent(r,o,i){let{maxValueLength:s}=i.getOptions();return TY(r,o,t,n,s)}}}),xb=EY;function TY(e,t={},n,r,o){if(!t.originalException||!et(t.originalException))return e;let i=t.originalException.name||t.originalException.constructor.name,s=FC(t.originalException,r,o);if(s){let c={...e.contexts},a=Ke(s,n);return Zt(a)&&(Sv(a),c[i]=a),{...e,contexts:c}}return e}function FC(e,t,n){try{let r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],o={};for(let i of Object.keys(e)){if(r.indexOf(i)!==-1)continue;let s=e[i];o[i]=et(s)||typeof s=="string"?n?gn(`${s}`,n):`${s}`:s}if(t&&e.cause!==void 0)if(et(e.cause)){let i=e.cause.name||e.cause.constructor.name;o.cause={[i]:FC(e.cause,!1,n)}}else o.cause=e.cause;if(typeof e.toJSON=="function"){let i=e.toJSON();for(let s of Object.keys(i)){let c=i[s];o[s]=et(c)?c.toString():c}}return o}catch(r){E&&g.error("Unable to extract extra data from the Error object:",r)}return null}function IY(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let o=e[r];o==="."?e.splice(r,1):o===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var AY=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function VC(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=AY.exec(t);return n?n.slice(1):[]}function Pb(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let o=r>=0?e[r]:"/";o&&(t=`${o}/${t}`,n=o.charAt(0)==="/")}return t=IY(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function WC(e){let t=0;for(;t<e.length&&e[t]==="";t++);let n=e.length-1;for(;n>=0&&e[n]==="";n--);return t>n?[]:e.slice(t,n-t+1)}function kb(e,t){e=Pb(e).slice(1),t=Pb(t).slice(1);let n=WC(e.split("/")),r=WC(t.split("/")),o=Math.min(n.length,r.length),i=o;for(let c=0;c<o;c++)if(n[c]!==r[c]){i=c;break}let s=[];for(let c=i;c<n.length;c++)s.push("..");return s=s.concat(r.slice(i)),s.join("/")}function Lb(e){let t=VC(e),n=t[0]||"",r=t[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}function Mb(e,t){let n=VC(e)[2]||"";return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var NY="RewriteFrames",wb=(e={})=>{let t=e.root,n=e.prefix||"app:///",r="window"in te&&!!te.window,o=e.iteratee||vY({isBrowser:r,root:t,prefix:n});function i(c){try{return{...c,exception:{...c.exception,values:c.exception.values.map(a=>({...a,...a.stacktrace&&{stacktrace:s(a.stacktrace)}}))}}}catch{return c}}function s(c){return{...c,frames:c?.frames?.map(a=>o(a))}}return{name:NY,processEvent(c){let a=c;return c.exception&&Array.isArray(c.exception.values)&&(a=i(a)),a}}};function vY({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let o=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),i=/^\//.test(r.filename);if(e){if(t){let s=r.filename;s.indexOf(t)===0&&(r.filename=s.replace(t,n))}}else if(o||i){let s=o?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,c=t?kb(t,s):Mb(s);r.filename=`${n}${c}`}return r}}var RY=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],CY=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],OY={eq:"eq",neq:"neq",gt:"gt",gte:"gte",lt:"lt",lte:"lte",like:"like","like(all)":"likeAllOf","like(any)":"likeAnyOf",ilike:"ilike","ilike(all)":"ilikeAllOf","ilike(any)":"ilikeAnyOf",is:"is",in:"in",cs:"contains",cd:"containedBy",sr:"rangeGt",nxl:"rangeGte",sl:"rangeLt",nxr:"rangeLte",adj:"rangeAdjacent",ov:"overlaps",fts:"",plfts:"plain",phfts:"phrase",wfts:"websearch",not:"not"},jC=["select","insert","upsert","update","delete"];function ju(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Zu(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function ZC(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function xY(e,t){return ZC(e,t)!==void 0}function XC(e,t){if(!e)return;if(typeof e.get=="function")return e.get(t)??void 0;let n=e,r=t.toLowerCase(),o=Object.keys(n).find(i=>i.toLowerCase()===r);return o!==void 0?n[o]:void 0}function PY(e,t={}){switch(e){case"GET":return"select";case"POST":return XC(t,"Prefer")?.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return"<unknown-op>"}}function kY(e,t){if(t===""||t==="*")return"select(*)";if(e==="select")return`select(${t})`;if(e==="or"||e.endsWith(".or"))return`${e}${t}`;let[n,...r]=t.split("."),o;return n?.startsWith("fts")?o="textSearch":n?.startsWith("plfts")?o="textSearch[plain]":n?.startsWith("phfts")?o="textSearch[phrase]":n?.startsWith("wfts")?o="textSearch[websearch]":o=n&&OY[n]||"filter",`${o}(${e}, ${r.join(".")})`}function YC(e,t=!1){return new Proxy(e,{apply(n,r,o){return Se({name:`auth ${t?"(admin) ":""}${e.name}`,attributes:{[S]:"auto.db.supabase",[H]:"db","db.system":"postgresql","db.operation":`auth.${t?"admin.":""}${e.name}`}},i=>Reflect.apply(n,r,o).then(s=>(V(s)&&"error"in s&&s.error?(i.setStatus({code:2}),me(s.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):i.setStatus({code:1}),i.end(),s)).catch(s=>{throw i.setStatus({code:2}),i.end(),me(s,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),s}).then(...o))}})}function LY(e){let t=e.auth;if(!(!t||Zu(e.auth))){for(let n of RY){let r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=YC(r))}for(let n of CY){let r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=YC(r,!0))}ju(e.auth)}}function MY(e,t){Zu(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(n,r,o){let i=Reflect.apply(n,r,o),s=i.constructor;return GY(s,t),i}}),ju(e.prototype.from))}function wY(e,t){Zu(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(n,r,o){let i=jC,s=r,c=PY(s.method,s.headers);if(!i.includes(c)||!s?.url?.pathname||typeof s.url.pathname!="string")return Reflect.apply(n,r,o);let a=s.url.pathname.split("/"),l=a.length>0?a[a.length-1]:"",p=[];for(let[v,P]of s.url.searchParams.entries())p.push(kY(v,P));let u=Object.create(null);if(Zt(s.body))for(let[v,P]of Object.entries(s.body))u[v]=P;let d=O(),m=t.sendOperationData??d?.getDataCollectionOptions().databaseQueryData===!0,_=ZC(s.body,u),h=c==="select"?"":`${c}${xY(s.body,u)?"(...) ":""}`,b=m?p.join(" "):p.length>0?"[redacted]":"",N=[h.trimEnd(),b].filter(Boolean).join(" "),L=N?`${N} from(${l})`:`from(${l})`,R={"db.table":l,"db.schema":s.schema,"db.url":s.url.origin,"db.sdk":XC(s.headers,"X-Client-Info"),"db.system":"postgresql","db.operation":c,[S]:"auto.db.supabase",[H]:"db"};return p.length&&m&&(R["db.query"]=p),_!==void 0&&m&&(R["db.body"]=_),Se({name:L,attributes:R},v=>Reflect.apply(n,r,[]).then(P=>{if(v&&(P&&typeof P=="object"&&"status"in P&&Ys(v,P.status||500),v.end()),P?.error){let B=new Error(P.error.message);P.error.code&&(B.code=P.error.code),P.error.details&&(B.details=P.error.details);let k={};p.length&&m&&(k.query=p),_!==void 0&&m&&(k.body=_),me(B,U=>(U.addEventProcessor(ce=>(Hn(ce,{handled:!1,type:"auto.db.supabase.postgres"}),ce)),U.setContext("supabase",k),U))}let G={type:"supabase",category:`db.${c}`,message:L},I={};return p.length&&m&&(I.query=p),_!==void 0&&m&&(I.body=_),Object.keys(I).length&&(G.data=I),an(G),P},P=>{throw v&&(Ys(v,500),v.end()),P}).then(...o))}}),ju(e.prototype.then))}function GY(e,t){for(let n of jC)Zu(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(r,o,i){let s=Reflect.apply(r,o,i),c=s.constructor;return E&&g.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),wY(c,t),s}}),ju(e.prototype[n]))}var Xu=(e,t={})=>{if(!e){E&&g.warn("Supabase integration was not installed because no Supabase client was provided.");return}let n=e.constructor===Function?e:e.constructor;MY(n,t),LY(e)},UY="Supabase",DY=((e,t)=>({setupOnce(){Xu(e,t)},name:UY})),Gb=e=>DY(e.supabaseClient,{sendOperationData:e.sendOperationData});var BY=10,HY="ZodErrors";function FY(e){return et(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function WY(e){return{...e,path:"path"in e&&Array.isArray(e.path)?e.path.join("."):void 0,keys:"keys"in e?JSON.stringify(e.keys):void 0,unionErrors:"unionErrors"in e?JSON.stringify(e.unionErrors):void 0}}function VY(e){return e.map(t=>typeof t=="number"?"<array>":t).join(".")}function YY(e){let t=new Set;for(let r of e.issues){let o=VY(r.path);o.length>0&&t.add(o)}let n=Array.from(t);if(n.length===0){let r="variable";if(e.issues.length>0){let o=e.issues[0];o!==void 0&&"expected"in o&&typeof o.expected=="string"&&(r=o.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${gn(n.join(", "),100)}`}function jY(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!FY(r.originalException)||r.originalException.issues.length===0)return n;try{let i=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(WY);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:i})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:YY(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":i.slice(0,e)}}}catch(o){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:o instanceof Error?`${o.name}: ${o.message}
|
|
25
|
+
${o.stack}`:"unknown"}}}}}var ZY=((e={})=>{let t=e.limit??BY;return{name:HY,processEvent(n,r){return jY(t,e.saveZodIssuesAsAttachment,n,r)}}}),Ub=ZY;var XY="Console",Db=(e={})=>{let t=new Set(e.levels||tr);return{name:XY,setup(n){let r=fa(({args:o,level:i})=>{O()!==n||!t.has(i)||KY(i,o)});if(n.registerCleanup(r),e.filter){let o=UC(e.filter);n.registerCleanup(o)}}}};function KY(e,t){let n={category:"console",data:{arguments:t,logger:"console"},level:ei(e),message:KC(t)};if(e==="assert")if(t[0]===!1){let r=t.slice(1);n.message=r.length>0?`Assertion failed: ${KC(r)}`:"Assertion failed",n.data.arguments=r}else return;an(n,{input:t,level:e})}function KC(e){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):Ds(e," ")}var qY=100,QY=10,Ku="flag.evaluation.";function qu(e){if(e.type)return e;let n=ne().getScopeData().contexts.flags,r=n?n.values:[];return r.length&&(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...r]}),e}function Qu(e,t,n=qY){let r=ne().getScopeData().contexts;r.flags||(r.flags={values:[]});let o=r.flags.values;JY(o,e,t,n)}function JY(e,t,n,r){if(typeof n!="boolean")return;if(e.length>r){E&&g.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}let o=e.findIndex(i=>i.flag===t);o!==-1&&e.splice(o,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function Ju(e,t,n=QY){if(typeof t!="boolean")return;let r=Q();if(!r)return;let o=ie(r).data;if(`${Ku}${e}`in o){r.setAttribute(`${Ku}${e}`,t);return}Object.keys(o).filter(s=>s.startsWith(Ku)).length<n&&r.setAttribute(`${Ku}${e}`,t)}var Bb=()=>({name:"FeatureFlags",processEvent(e,t,n){return qu(e)},addFeatureFlag(e,t){Qu(e,t),Ju(e,t)}});var Hb=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){let t=e.prototype;typeof t.isOn=="function"&&Mt(t,"isOn",qC),typeof t.getFeatureValue=="function"&&Mt(t,"getFeatureValue",qC)},processEvent(t,n,r){return qu(t)}});function qC(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&(Qu(n,r),Ju(n,r)),r}}var $Y="ConversationId",zY=(()=>({name:$Y,setup(e){e.on("spanStart",t=>{let n=ne().getScopeData(),r=J().getScopeData(),o=n.conversationId||r.conversationId;if(o){let{op:i,data:s,description:c}=ie(t);if(!i?.startsWith("gen_ai.")&&!s["ai.operationId"]&&!c?.startsWith("ai."))return;t.setAttribute(Hi,o)}})}})),Fb=zY;function QC(e){return!!e&&typeof e._profiler<"u"&&typeof e._profiler.start=="function"&&typeof e._profiler.stop=="function"}function e3(){let e=O();if(!e){E&&g.warn("No Sentry client available, profiling is not started");return}let t=e.getIntegrationByName("ProfilingIntegration");if(!t){E&&g.warn("ProfilingIntegration is not available");return}if(!QC(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.start()}function t3(){let e=O();if(!e){E&&g.warn("No Sentry client available, profiling is not started");return}let t=e.getIntegrationByName("ProfilingIntegration");if(!t){E&&g.warn("ProfilingIntegration is not available");return}if(!QC(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.stop()}var Wb={startProfiler:e3,stopProfiler:t3};function Vb(e,t={},n=ne()){let{message:r,name:o,email:i,url:s,source:c,associatedEventId:a,tags:l}=e,p={contexts:{feedback:{contact_email:i,name:o,message:r,url:s,source:c,associated_event_id:a}},type:"feedback",level:"info",tags:l},u=n?.getClient()||O();return u&&u.emit("beforeSendFeedback",p,t),n.captureEvent(p,t)}function ga(e,t,n){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):n3(e,t,n)}function n3(e,t,n){return e.map(r=>nr(r)?String(r):JSON.stringify(Ke(r,t,n))).join(" ")}function $u(e){return/%[sdifocO]/.test(e)}function zu(e,t){let n={},r=new Array(t.length).fill("{}").join(" ");return n["sentry.message.template"]=`${e} ${r}`,t.forEach((o,i)=>{n[`sentry.message.parameter.${i}`]=o}),n}var r3="ConsoleLogs",JC={[S]:"auto.log.console"},o3=((e={})=>{let t=e.levels||tr;return{name:r3,setup(n){let{enableLogs:r,normalizeDepth:o=3,normalizeMaxBreadth:i=1e3}=n.getOptions();if(!r){E&&g.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let s=fa(({args:c,level:a})=>{if(O()!==n||!t.includes(a))return;let l=c[0],p=c.slice(1);if(a==="assert"){if(!l){let m=p.length>0?`Assertion failed: ${ga(p,o,i)}`:"Assertion failed";ur({level:"error",message:m,attributes:JC})}return}let u=a==="log",d={...JC};if(Zt(l)){Object.assign(d,Ke(l,o,i));let m=typeof c[1]=="string"?2:1;c.slice(m).forEach((h,b)=>{d[`sentry.message.parameter.${b}`]=Ke(h,o,i)})}else if(p.length>0&&typeof l=="string"&&!$u(l)){let _=zu(l,p);for(let[h,b]of Object.entries(_))d[h]=h.startsWith("sentry.message.parameter.")?Ke(b,o,i):b}ur({level:u?"info":a,message:ga(c,o,i),severityNumber:u?10:void 0,attributes:d})});n.registerCleanup(s)}}}),Yb=o3;var ft={};rv(ft,{count:()=>i3,distribution:()=>a3,gauge:()=>s3});function jb(e,t,n,r){Q0({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function i3(e,t=1,n){jb("counter",e,t,n)}function s3(e,t,n){jb("gauge",e,t,n)}function a3(e,t,n){jb("distribution",e,t,n)}var c3=["trace","debug","info","warn","error","fatal"];function Zb(e={}){let t=new Set(e.levels??c3),n=e.client;return{log(r){let{type:o,level:i,message:s,args:c,tag:a,date:l,...p}=r,u=n||O();if(!u)return;let d=u3(o,i);if(!t.has(d))return;let{normalizeDepth:m=3,normalizeMaxBreadth:_=1e3}=u.getOptions(),h={};for(let[N,L]of Object.entries(p))h[N]=Ke(L,m,_);h["sentry.origin"]="auto.log.consola",a&&(h["consola.tag"]=a),o&&(h["consola.type"]=o),i!=null&&typeof i=="number"&&(h["consola.level"]=i);let b=m3(d3(c,m,_),m,_);b?.attributes&&Object.assign(h,b.attributes),ur({level:d,message:b?.message||s||c&&ga(c,m,_)||"",attributes:h})}}}var l3={silent:"trace",fatal:"fatal",error:"error",warn:"warn",log:"info",info:"info",success:"info",fail:"error",ready:"info",start:"info",box:"info",debug:"debug",trace:"trace",verbose:"debug",critical:"fatal",notice:"info"},p3={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function u3(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){let n=l3[e];if(n)return n}if(typeof t=="number"){let n=p3[t];if(n)return n}return"info"}function d3(e,t,n){if(!e?.length)return{message:""};let r=ga(e,t,n),o=e[0];if(Zt(o)){let i=typeof e[1]=="string"?2:1,s=e.slice(i);return{message:r,attributes:o,messageParameters:s}}else{let i=e.slice(1),s=i.length>0&&typeof o=="string"&&!$u(o);return{message:r,messageTemplate:s?o:void 0,messageParameters:s?i:void 0}}}function m3(e,t,n){let{message:r,attributes:o,messageTemplate:i,messageParameters:s}=e,c={};if(i&&s){let a=zu(i,s);for(let[l,p]of Object.entries(a))c[l]=l.startsWith("sentry.message.parameter.")?Ke(p,t,n):p}else s&&s.length>0&&s.forEach((a,l)=>{c[`sentry.message.parameter.${l}`]=Ke(a,t,n)});return{message:r,attributes:{...Ke(o,t,n),...c}}}var $C="gen_ai.prompt",Yr="gen_ai.system",De="gen_ai.request.model",_a="gen_ai.request.stream",ti="gen_ai.request.temperature",ha="gen_ai.request.max_tokens",ni="gen_ai.request.frequency_penalty",ba="gen_ai.request.presence_penalty",ri="gen_ai.request.top_p",ed="gen_ai.request.top_k",td="gen_ai.request.encoding_format",nd="gen_ai.request.dimensions",jr="gen_ai.response.finish_reasons",cn="gen_ai.response.model",oi="gen_ai.response.id",zC="gen_ai.response.stop_reason",ot="gen_ai.usage.input_tokens",ut="gen_ai.usage.output_tokens",Ht="gen_ai.usage.total_tokens",it="gen_ai.operation.name",Ot="sentry.sdk_meta.gen_ai.input.messages.original_length",Ft="gen_ai.input.messages",eO="gen_ai.output.messages",en="gen_ai.system_instructions",tn="gen_ai.response.text",Yn="gen_ai.request.available_tools",tO="gen_ai.response.streaming",Sn="gen_ai.response.tool_calls",ii="gen_ai.agent.name",nO="gen_ai.pipeline.name",si="gen_ai.conversation.id",rO="gen_ai.usage.cache_creation_input_tokens",oO="gen_ai.usage.cache_read_input_tokens",Xb="gen_ai.usage.input_tokens.cache_write",ai="gen_ai.usage.input_tokens.cached",iO="gen_ai.invoke_agent",ci="gen_ai.embeddings.input",Kb="gen_ai.embeddings",qb="gen_ai.execute_tool",Zr="gen_ai.tool.name",ul="gen_ai.tool.call.id",dl="gen_ai.tool.type",ya="gen_ai.tool.input",Sa="gen_ai.tool.output",Ea="gen_ai.tool.description";function li(e){return!e||typeof e!="object"?!1:g3(e)||aO(e)||f3(e)||cO(e)||lO(e)||_3(e)||h3(e)||b3(e)||y3(e)||S3(e)||E3(e)||T3(e)}function f3(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):sO(e):!1}function sO(e){return"image_url"in e&&!!e.image_url&&typeof e.image_url=="object"&&"url"in e.image_url&&typeof e.image_url.url=="string"&&e.image_url.url.startsWith("data:")}function g3(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&li(e.source)}function aO(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function cO(e){return"type"in e&&e.type==="input_audio"&&"input_audio"in e&&!!e.input_audio&&typeof e.input_audio=="object"&&"data"in e.input_audio&&typeof e.input_audio.data=="string"}function lO(e){return"type"in e&&e.type==="file"&&"file"in e&&!!e.file&&typeof e.file=="object"&&"file_data"in e.file&&typeof e.file.file_data=="string"}function _3(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function h3(e){return"type"in e&&e.type==="file"&&"mediaType"in e&&typeof e.mediaType=="string"&&"data"in e&&typeof e.data=="string"&&!e.data.startsWith("http://")&&!e.data.startsWith("https://")}function b3(e){return"type"in e&&e.type==="image"&&"image"in e&&typeof e.image=="string"&&!e.image.startsWith("http://")&&!e.image.startsWith("https://")}function y3(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function S3(e){return"b64_json"in e}function E3(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function T3(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}var ml="[Blob substitute]",I3=["image_url","data","content","b64_json","result","uri","image"];function ts(e){let t={...e};li(t.source)&&(t.source=ts(t.source)),aO(e)&&(t.inlineData={...e.inlineData,data:ml}),sO(e)&&(t.image_url={...e.image_url,url:ml}),cO(e)&&(t.input_audio={...e.input_audio,data:ml}),lO(e)&&(t.file={...e.file,file_data:ml});for(let n of I3)typeof t[n]=="string"&&(t[n]=ml);return t}var uO=2e4,rd=e=>new TextEncoder().encode(e).length,Jb=e=>rd(JSON.stringify(e));function od(e,t){if(rd(e)<=t)return e;let n=0,r=e.length,o="";for(;n<=r;){let i=Math.floor((n+r)/2),s=e.slice(0,i);rd(s)<=t?(o=s,n=i+1):r=i-1}return o}function A3(e){return typeof e=="string"?e:"text"in e&&typeof e.text=="string"?e.text:""}function pO(e,t){return typeof e=="string"?t:{...e,text:t}}function N3(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function dO(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function mO(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function v3(e,t){let n={...e,content:""},r=Jb(n),o=t-r;if(o<=0)return[];let i=od(e.content,o);return[{...e,content:i}]}function R3(e){return"parts"in e&&Array.isArray(e.parts)?{key:"parts",items:e.parts}:"content"in e&&Array.isArray(e.content)?{key:"content",items:e.content}:{key:null,items:[]}}function C3(e,t){let{key:n,items:r}=R3(e);if(n===null||r.length===0)return[];let o=r.map(a=>pO(a,"")),i=Jb({...e,[n]:o}),s=t-i;if(s<=0)return[];let c=[];for(let a of r){let l=A3(a),p=rd(l);if(p<=s)c.push(a),s-=p;else if(c.length===0){let u=od(l,s);u&&c.push(pO(a,u));break}else break}return c.length<=0?[]:[{...e,[n]:c}]}function O3(e,t){if(!e)return[];if(typeof e=="string"){let n=od(e,t);return n?[n]:[]}return typeof e!="object"?[]:N3(e)?v3(e,t):dO(e)||mO(e)?C3(e,t):[]}function Qb(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(dO(n)?r={...n,content:Qb(n.content)}:"content"in n&&li(n.content)&&(r={...n,content:ts(n.content)}),mO(n)&&(r={...r??n,parts:Qb(n.parts)}),li(r)?r=ts(r):li(n)&&(r=ts(n))),r??n})}function x3(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],o=Qb([r]),i=o[0];return Jb(i)<=n?o:O3(i,n)}function fO(e){return x3(e,uO)}function gO(e){return od(e,uO)}function Ze(e){let t=O()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function ze(e){if(e!==void 0)return e;let t=O();return t?!rt(t)&&t.getOptions().streamGenAiSpans===!1:!0}function id(e,t){return e?`${e}.${t}`:t}function _O(e,t,n,r,o){if(t!==void 0&&e.setAttributes({[ot]:t}),n!==void 0&&e.setAttributes({[ut]:n}),t!==void 0||n!==void 0||r!==void 0||o!==void 0){let i=(t??0)+(n??0)+(r??0)+(o??0);e.setAttributes({[Ht]:i})}}function ns(e,t,n){if(!e.isRecording())return;let r={[tO]:!0};t.responseId&&(r[oi]=t.responseId),t.responseModel&&(r[cn]=t.responseModel),t.promptTokens!==void 0&&(r[ot]=t.promptTokens),t.completionTokens!==void 0&&(r[ut]=t.completionTokens),t.totalTokens!==void 0?r[Ht]=t.totalTokens:(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Ht]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)),t.finishReasons.length&&(r[jr]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[tn]=t.responseTexts.join("")),n&&t.toolCalls.length&&(r[Sn]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Wt(e){if(typeof e=="string")return gO(e);try{return JSON.stringify(Array.isArray(e)?fO(e):e)}catch{return"[unserializable]"}}function kn(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};let t=e.findIndex(s=>s&&typeof s=="object"&&"role"in s&&s.role==="system");if(t===-1)return{systemInstructions:void 0,filteredMessages:e};let n=e[t],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:e};let o=JSON.stringify([{type:"text",content:r}]),i=[...e.slice(0,t),...e.slice(t+1)];return{systemInstructions:o,filteredMessages:i}}async function P3(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r=="object"&&"data"in r?{...r,data:n}:n}function Ta(e,t){return bt(e)?new Proxy(e,{get(n,r){let i=r in Promise.prototype||r===Symbol.toStringTag?t:n,s=Reflect.get(i,r);return r==="withResponse"&&typeof s=="function"?function(){let a=s.call(n);return P3(a,t)}:typeof s=="function"?s.bind(i):s}}):t}var hO="WorkersAI";var fl=new Map,sd=new Map,ad=new Map([["ai.generateText","invoke_agent"],["ai.streamText","invoke_agent"],["ai.generateObject","invoke_agent"],["ai.streamObject","invoke_agent"],["ai.generateText.doGenerate","generate_content"],["ai.streamText.doStream","generate_content"],["ai.generateObject.doGenerate","generate_content"],["ai.streamObject.doStream","generate_content"],["ai.embed.doEmbed","embeddings"],["ai.embedMany.doEmbed","embeddings"],["ai.rerank.doRerank","rerank"],["ai.toolCall","execute_tool"]]);var cd="operation.name",ld="ai.operationId",pd="ai.prompt",bO="ai.schema",yO="ai.response.object",$b="ai.values",zb="ai.response.text",ey="ai.response.toolCalls",SO="ai.response.finishReason",rs="ai.prompt.messages",Ro="ai.prompt.tools",gl="ai.model.id",EO="ai.response.providerMetadata",TO="ai.usage.cachedInputTokens",IO="ai.usage.inputTokenDetails.",AO="ai.telemetry.functionId",NO="ai.usage.completionTokens",vO="ai.usage.promptTokens",RO="ai.usage.tokens",ty="ai.toolCall.name",ny="ai.toolCall.id",CO="ai.toolCall.args",OO="ai.toolCall.result";function PO(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[ot],o=e.data[ut];if(typeof r=="number"||typeof o=="number"){let i=t.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(i.inputTokens+=r),typeof o=="number"&&(i.outputTokens+=o),t.set(n,i)}}function ry(e,t){let n=t.get(e.span_id);!n||!e.data||(n.inputTokens>0&&(e.data[ot]=n.inputTokens),n.outputTokens>0&&(e.data[ut]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function k3(e){let t=new Map;for(let n of e){let r=n.data[Yn];if(typeof r=="string")try{let o=JSON.parse(r);for(let i of o)i.name&&i.description&&!t.has(i.name)&&t.set(i.name,i.description)}catch{}}return t}function kO(e,t){let n=k3(e);for(let r of e){if(r.op==="gen_ai.execute_tool"){let o=r.data[Zr];if(typeof o=="string"){let i=n.get(o);i&&(r.data[Ea]=i)}}r.op==="gen_ai.invoke_agent"&&ry(r,t)}}function oy(e){return fl.get(e)}function iy(e){fl.delete(e)}function LO(e){let t=e.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(t)}function xO(e){return e.filter(t=>!!t&&typeof t=="object"&&"role"in t&&"content"in t)}function L3(e){try{let t=JSON.parse(e);if(t&&typeof t=="object"){let{messages:n}=t,{prompt:r,system:o}=t,i=[];if(typeof o=="string"&&i.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return i.push(...xO(n)),i;if(Array.isArray(r))return i.push(...xO(r)),i;if(typeof r=="string"&&i.push({role:"user",content:r}),i.length>0)return i}}catch{}return[]}function MO(e,t,n){if(typeof t[pd]=="string"&&!t[Ft]&&!t[rs]){let r=t[pd],o=L3(r);if(o.length){let{systemInstructions:i,filteredMessages:s}=kn(o);i&&e.setAttribute(en,i);let c=Array.isArray(s)?s.length:0,a=n?Wt(s):Ge(s);e.setAttributes({[pd]:a,[Ft]:a,[Ot]:c})}}else if(typeof t[rs]=="string"){let r=t[rs];try{let o=JSON.parse(r);if(Array.isArray(o)){let{systemInstructions:i,filteredMessages:s}=kn(o);i&&e.setAttribute(en,i);let c=Array.isArray(s)?s.length:0,a=!n&&s===o?r:n?Wt(s):Ge(s);e.setAttributes({[rs]:a,[Ft]:a,[Ot]:c})}}catch{}}}function M3(e){let{data:t,description:n}=ie(e);if(!n)return;if(t[ty]&&t[ny]&&n==="ai.toolCall"){H3(e,t);return}if(!t[ld]&&!n.startsWith("ai."))return;ad.get(n)==="generate_content"&&vo([hO]);let o=O()?.getIntegrationByName("VercelAI"),i=ze(o?.options?.enableTruncation);F3(e,n,t,i)}function w3(e){if(e.type==="transaction"&&e.spans){let t=new Map;for(let r of e.spans)D3(r),PO(r,t);kO(e.spans,t);let n=e.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&ry(n,t)}return e}function G3(e){if(typeof e!="string")return"stop";switch(e){case"tool-calls":return"tool_call";case"stop":case"length":case"content_filter":case"error":return e;default:return e}}function U3(e){let t=e[zb],n=e[ey],r=e[SO];if(t==null&&n==null)return;let o=[];if(typeof t=="string"&&t.length>0&&o.push({type:"text",content:t}),n!=null)try{let i=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(i)){for(let s of i){let c=s.input??s.args;o.push({type:"tool_call",id:s.toolCallId,name:s.toolName,arguments:typeof c=="string"?c:JSON.stringify(c??{})})}delete e[ey]}}catch{}if(o.length>0){let i={role:"assistant",parts:o,finish_reason:G3(r)};e[eO]=JSON.stringify([i]),delete e[zb]}}function GO(e){if(Vt(e,NO,ut),Vt(e,vO,ot),Vt(e,TO,ai),Vt(e,"ai.usage.inputTokens",ot),Vt(e,"ai.usage.outputTokens",ut),Vt(e,RO,ot),Vt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),!Object.keys(e).some(n=>n.startsWith(IO))&&typeof e[ot]=="number"&&typeof e[ai]=="number"&&(e[ot]=e[ot]+e[ai]),typeof e[ot]=="number"){let n=typeof e[ut]=="number"?e[ut]:0;e[Ht]=n+e[ot]}if(e[Ro]&&Array.isArray(e[Ro])&&(e[Ro]=LO(e[Ro])),e[cd]){let n=e[ld]?e[ld]:e[cd],r=ad.get(n)??n;e[it]=r,delete e[cd]}if(Vt(e,rs,Ft),U3(e),Vt(e,yO,"gen_ai.response.object"),Vt(e,Ro,"gen_ai.request.available_tools"),Vt(e,CO,ya),Vt(e,OO,Sa),Vt(e,bO,"gen_ai.request.schema"),Vt(e,gl,De),Array.isArray(e[$b])){let n=e[$b].map(r=>{try{return JSON.parse(r)}catch{return r}});e[ci]=n.length===1?n[0]:JSON.stringify(n)}W3(e);for(let n of Object.keys(e))Array.isArray(e[n])&&(e[n]=JSON.stringify(e[n])),n.startsWith("ai.")&&Vt(e,n,`vercel.${n}`)}function D3(e){let{data:t,origin:n}=e;n==="auto.vercelai.otel"&&(e.status&&e.status!=="ok"&&(e.status="internal_error"),GO(t))}function B3(e){let t=e.attributes;if(t?.[S]==="auto.vercelai.otel"){if(GO(t),t[H]==="gen_ai.execute_tool"&&e.parent_span_id){let n=sd.get(e.parent_span_id);if(n){let r=t[Zr];if(typeof r=="string"){let o=n.get(r);o&&(t[Ea]=o)}}}sd.delete(e.span_id)}}function Vt(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function H3(e,t){e.setAttribute(S,"auto.vercelai.otel"),e.setAttribute(H,"gen_ai.execute_tool"),e.setAttribute(it,"execute_tool"),Vt(t,ty,Zr),Vt(t,ny,ul);let n=t[ul];typeof n=="string"&&fl.set(n,e.spanContext()),t[dl]||e.setAttribute(dl,"function");let r=t[Zr];r&&e.updateName(`execute_tool ${r}`)}function F3(e,t,n,r){e.setAttribute(S,"auto.vercelai.otel");let o=t.replace("ai.","");e.setAttribute("ai.pipeline.name",o),e.updateName(o);let i=n[AO];i&&typeof i=="string"&&e.setAttribute("gen_ai.function_id",i),MO(e,n,r),n[gl]&&!n[cn]&&e.setAttribute(cn,n[gl]),e.setAttribute("ai.streaming",t.includes("stream"));let s=ad.get(t);if(s?e.setAttribute(H,`gen_ai.${s}`):t.startsWith("ai.stream")&&e.setAttribute(H,"ai.run"),s==="invoke_agent"){i&&typeof i=="string"?e.updateName(`invoke_agent ${i}`):e.updateName("invoke_agent");return}let c=n[gl];c&&s&&e.updateName(`${s} ${c}`);let a=O();if(a&&rt(a)&&n[Ro]&&Array.isArray(n[Ro])){let l=new Map;for(let p of n[Ro])try{let u=typeof p=="string"?JSON.parse(p):p;u?.name&&u?.description&&l.set(u.name,u.description)}catch{}if(l.size>0){let p=ie(e).parent_span_id;p&&sd.set(p,l)}}}var wO=new WeakSet;function ud(e){wO.has(e)||(wO.add(e),e.on("spanStart",M3),e.addEventProcessor(Object.assign(w3,{id:"VercelAiEventProcessor"})),e.on("processSpan",t=>{B3(t)}))}function dd(e){let t={};if(!e||typeof e!="object")return t;let n=e,r=n.openai??n.azure;if(r&&(Ln(t,ai,r.cachedPromptTokens),Ln(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),Ln(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),Ln(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),Ln(t,si,r.responseId)),n.anthropic){let i=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;Ln(t,ai,i);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;Ln(t,Xb,s)}n.bedrock?.usage&&(Ln(t,ai,n.bedrock.usage.cacheReadInputTokens),Ln(t,Xb,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(Ln(t,ai,n.deepseek.promptCacheHitTokens),Ln(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens));let o=(n.google??n.vertex)?.usageMetadata;return o&&typeof o.thoughtsTokenCount=="number"&&o.thoughtsTokenCount>0&&(t[ut]=(o.candidatesTokenCount??0)+o.thoughtsTokenCount,Ln(t,Ht,o.totalTokenCount),Ln(t,"gen_ai.usage.reasoning.output_tokens",o.thoughtsTokenCount)),t}var md=new Set([ut,Ht,"gen_ai.usage.reasoning.output_tokens"]);function W3(e){let t=e[EO];if(!t)return;let n=e[it]==="invoke_agent";try{let r=dd(JSON.parse(t));for(let[o,i]of Object.entries(r))o===si&&e[o]||n&&md.has(o)||(e[o]=i)}catch{}}function Ln(e,t,n){n!=null&&(e[t]=n)}var Xr="OpenAI",UO={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},V3=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],DO=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...V3];function BO(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function HO(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function _l(e,t,n){if(!t||typeof t!="object")return;let r=t,o={};if(typeof r.id=="string"&&(o[oi]=r.id),typeof r.model=="string"&&(o[cn]=r.model),r.object==="conversation"&&typeof r.id=="string"&&(o[si]=r.id),r.usage&&typeof r.usage=="object"){let i=r.usage,s=i.prompt_tokens??i.input_tokens;typeof s=="number"&&(o[ot]=s);let c=i.completion_tokens??i.output_tokens;typeof c=="number"&&(o[ut]=c),typeof i.total_tokens=="number"&&(o[Ht]=i.total_tokens)}if(Array.isArray(r.choices)){let i=r.choices,s=i.map(c=>c.finish_reason).filter(c=>typeof c=="string");if(s.length>0&&(o[jr]=JSON.stringify(s)),n){let c=i.map(l=>l.message?.content||"");o[tn]=JSON.stringify(c);let a=i.map(l=>l.message?.tool_calls).filter(l=>Array.isArray(l)&&l.length>0).flat();a.length>0&&(o[Sn]=JSON.stringify(a))}}if(typeof r.status=="string"&&(o[jr]||(o[jr]=JSON.stringify([r.status]))),n&&(typeof r.output_text=="string"&&!o[tn]&&(o[tn]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!o[Sn])){let i=r.output.filter(s=>s?.type==="function_call");i.length>0&&(o[Sn]=JSON.stringify(i))}e.setAttributes(o)}function Y3(e){if("conversation"in e&&typeof e.conversation=="string")return e.conversation;if("previous_response_id"in e&&typeof e.previous_response_id=="string")return e.previous_response_id}function sy(e){let t={[De]:e.model??"unknown"};"temperature"in e&&(t[ti]=e.temperature),"top_p"in e&&(t[ri]=e.top_p),"frequency_penalty"in e&&(t[ni]=e.frequency_penalty),"presence_penalty"in e&&(t[ba]=e.presence_penalty),"stream"in e&&(t[_a]=e.stream),"encoding_format"in e&&(t[td]=e.encoding_format),"dimensions"in e&&(t[nd]=e.dimensions);let n=Y3(e);return n&&(t[si]=n),t}function j3(e,t){for(let n of e){let r=n.index;if(!(r===void 0||!n.function))if(!(r in t.chatCompletionToolCalls))t.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=t.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function Z3(e,t,n){t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.prompt_tokens,t.completionTokens=e.usage.completion_tokens,t.totalTokens=e.usage.total_tokens);for(let r of e.choices??[])n&&(r.delta?.content&&t.responseTexts.push(r.delta.content),r.delta?.tool_calls&&j3(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function X3(e,t,n,r){if(!(e&&typeof e=="object")){t.eventTypes.push("unknown:non-object");return}if(e instanceof Error){r.setStatus({code:2,message:"internal_error"}),me(e,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in e))return;let o=e;if(!DO.includes(o.type)){t.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&t.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){t.responseTexts.push(o.delta);return}if("response"in o){let{response:i}=o;t.responseId=i.id??t.responseId,t.responseModel=i.model??t.responseModel,i.usage&&(t.promptTokens=i.usage.input_tokens,t.completionTokens=i.usage.output_tokens,t.totalTokens=i.usage.total_tokens),i.status&&t.finishReasons.push(i.status),n&&i.output_text&&t.responseTexts.push(i.output_text)}}async function*hl(e,t,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of e)HO(o)?Z3(o,r,n):BO(o)&&X3(o,r,n,t),yield o}finally{let o=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];ns(t,{...r,toolCalls:o},n)}}function K3(e){let t=Array.isArray(e.tools)?e.tools:[],r=e.web_search_options&&typeof e.web_search_options=="object"?[{type:"web_search_options",...e.web_search_options}]:[],o=[...t,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(i){E&&g.error("Failed to serialize OpenAI tools:",i);return}}function fd(e,t){let n={[Yr]:"openai",[it]:t,[S]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let r=e[0],o=K3(r);o&&(n[Yn]=o),Object.assign(n,sy(r))}else n[De]="unknown";return n}function bl(e,t,n,r){if(n==="embeddings"&&"input"in t){let c=t.input;if(c==null||typeof c=="string"&&c.length===0||Array.isArray(c)&&c.length===0)return;e.setAttribute(ci,typeof c=="string"?c:JSON.stringify(c));return}let o="input"in t?t.input:"messages"in t?t.messages:void 0;if(!o||Array.isArray(o)&&o.length===0)return;let{systemInstructions:i,filteredMessages:s}=kn(o);i&&e.setAttribute(en,i),e.setAttribute(Ft,r?Wt(s):Ge(s)),Array.isArray(s)?e.setAttribute(Ot,s.length):e.setAttribute(Ot,1)}function q3(e,t,n,r,o){return function(...s){let c=n.operation||"unknown",a=fd(s,c),l=a[De]||"unknown",p=s[0],u=p&&typeof p=="object"&&p.stream===!0,d={name:`${c} ${l}`,op:`gen_ai.${c}`,attributes:a};if(u){let h,b=ke(d,N=>(h=e.apply(r,s),o.recordInputs&&p&&bl(N,p,c,ze(o.enableTruncation)),(async()=>{try{let L=await h;return hl(L,N,o.recordOutputs??!1)}catch(L){throw N.setStatus({code:2,message:"internal_error"}),N.end(),L}})()));return Ta(h,b)}let m,_=Se(d,h=>(m=e.apply(r,s),o.recordInputs&&p&&bl(h,p,c,ze(o.enableTruncation)),m.then(b=>(_l(h,b,o.recordOutputs),b))));return Ta(m,_)}}function FO(e,t="",n){return new Proxy(e,{get(r,o){let i=r[o],s=id(t,String(o)),c=UO[s];return typeof i=="function"&&c?q3(i,s,c,r,n):typeof i=="function"?i.bind(r):i&&typeof i=="object"?FO(i,s,n):i}})}function gd(e,t){return FO(e,"",Ze(t))}var Kr="Anthropic_AI",ay={"messages.create":{operation:"chat"},"messages.stream":{operation:"chat",streaming:!0},"messages.countTokens":{operation:"chat"},"models.get":{operation:"models"},"completions.create":{operation:"chat"},"models.retrieve":{operation:"models"},"beta.messages.create":{operation:"chat"}};function WO(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:o}=kn(t);r&&e.setAttributes({[en]:r});let i=Array.isArray(o)?o.length:1;e.setAttributes({[Ft]:n?Wt(o):Ge(o),[Ot]:i})}var Q3={invalid_request_error:"invalid_argument",authentication_error:"unauthenticated",permission_error:"permission_denied",not_found_error:"not_found",request_too_large:"failed_precondition",rate_limit_error:"resource_exhausted",api_error:"internal_error",overloaded_error:"unavailable"};function cy(e){return e&&Q3[e]||"internal_error"}function VO(e,t){t.error&&(e.setStatus({code:2,message:cy(t.error.type)}),me(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function YO(e){let{system:t,messages:n,input:r}=e,o=typeof t=="string"?[{role:"system",content:e.system}]:[],i=Array.isArray(r)?r:r!=null?[r]:void 0,s=Array.isArray(n)?n:n!=null?[n]:[],c=i??s;return[...o,...c]}function J3(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:2,message:cy(e.error?.type)}),!0):!1}function $3(e,t){if(e.type==="message_delta"&&(e.usage&&typeof e.usage.output_tokens=="number"&&(t.completionTokens=e.usage.output_tokens),e.delta?.stop_reason&&t.finishReasons.push(e.delta.stop_reason)),e.message){let n=e.message;n.id&&(t.responseId=n.id),n.model&&(t.responseModel=n.model),n.usage&&(typeof n.usage.input_tokens=="number"&&(t.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(t.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(t.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function z3(e,t){e.type!=="content_block_start"||typeof e.index!="number"||!e.content_block||(e.content_block.type==="tool_use"||e.content_block.type==="server_tool_use")&&(t.activeToolBlocks[e.index]={id:e.content_block.id,name:e.content_block.name,inputJsonParts:[]})}function e5(e,t,n){if(!(e.type!=="content_block_delta"||!e.delta)){if(typeof e.index=="number"&&"partial_json"in e.delta&&typeof e.delta.partial_json=="string"){let r=t.activeToolBlocks[e.index];r&&r.inputJsonParts.push(e.delta.partial_json)}n&&typeof e.delta.text=="string"&&t.responseTexts.push(e.delta.text)}}function t5(e,t){if(e.type!=="content_block_stop"||typeof e.index!="number")return;let n=t.activeToolBlocks[e.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}t.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete t.activeToolBlocks[e.index]}function jO(e,t,n,r){!(e&&typeof e=="object")||J3(e,r)||($3(e,t),z3(e,t),e5(e,t,n),t5(e,t))}async function*yl(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of e)jO(o,r,n,t),yield o}finally{ns(t,r,n)}}function Sl(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return e.on("streamEvent",o=>{jO(o,r,n,t)}),e.on("message",()=>{ns(t,r,n)}),e.on("error",o=>{me(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end())}),e}var _d=!1,ZO=new WeakSet;function hd(e,t,n){let r={[Yr]:"anthropic",[it]:n,[S]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let o=e[0];o.tools&&Array.isArray(o.tools)&&(r[Yn]=JSON.stringify(o.tools)),r[De]=o.model??"unknown","temperature"in o&&(r[ti]=o.temperature),"top_p"in o&&(r[ri]=o.top_p),"stream"in o&&(r[_a]=o.stream),"top_k"in o&&(r[ed]=o.top_k),"frequency_penalty"in o&&(r[ni]=o.frequency_penalty),"max_tokens"in o&&(r[ha]=o.max_tokens)}else t==="models.retrieve"||t==="models.get"?r[De]=e[0]:r[De]="unknown";return r}function Ia(e,t,n){let r=YO(t);WO(e,r,n),"prompt"in t&&e.setAttributes({[$C]:JSON.stringify(t.prompt)})}function n5(e,t){if("content"in t&&Array.isArray(t.content)){e.setAttributes({[tn]:t.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of t.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&e.setAttributes({[Sn]:JSON.stringify(n)})}"completion"in t&&e.setAttributes({[tn]:t.completion}),"input_tokens"in t&&e.setAttributes({[tn]:JSON.stringify(t.input_tokens)})}function r5(e,t){"id"in t&&"model"in t&&(e.setAttributes({[oi]:t.id,[cn]:t.model}),"usage"in t&&t.usage&&_O(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function bd(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){VO(e,t);return}n&&n5(e,t),r5(e,t)}}function XO(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end()),e}function o5(e,t,n,r,o,i,s,c,a,l){let p=r[De]??"unknown",u={name:`${o} ${p}`,op:`gen_ai.${o}`,attributes:r};if(a&&!l){let d,m=ke(u,_=>(d=e.apply(t,n),c.recordInputs&&s&&Ia(_,s,ze(c.enableTruncation)),(async()=>{try{let h=await d;return yl(h,_,c.recordOutputs??!1)}catch(h){return XO(h,_)}})()));return Ta(d,m)}else return ke(u,d=>{try{c.recordInputs&&s&&Ia(d,s,ze(c.enableTruncation)),_d=!0;let m=e.apply(t,n);return _d=!1,Sl(m,d,c.recordOutputs??!1)}catch(m){return _d=!1,XO(m,d)}})}function i5(e,t,n,r,o){return new Proxy(e,{apply(i,s,c){let a=s!==void 0?s:r,l=n.streaming===!0;if(!l&&_d)return i.apply(a,c);let p=n.operation||"unknown",u=hd(c,t,p),d=u[De]??"unknown",m=typeof c[0]=="object"?c[0]:void 0,_=!!m?.stream;if(_||l)return o5(i,a,c,u,p,t,m,o,_,l);let h,b=Se({name:`${p} ${d}`,op:`gen_ai.${p}`,attributes:u},N=>(h=i.apply(a,c),o.recordInputs&&m&&Ia(N,m,ze(o.enableTruncation)),h.then(L=>(bd(N,L,o.recordOutputs),L))));return Ta(h,b)}})}function s5(e,t){for(let n of Object.keys(ay)){let r=n.split("."),o=r.pop(),i=e;for(let a of r)i=i?.[a];if(!i||typeof i[o]!="function")continue;let s=i[o];if(ZO.has(s))continue;let c=i5(s,n,ay[n],i,t);ZO.add(c),i[o]=c}return e}function yd(e,t){return s5(e,Ze(t))}var qr="Google_GenAI",KO={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{proxyResultPath:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},qO="google_genai";function a5(e,t){let n=e?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:"internal_error"}),me(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function c5(e,t){typeof e.responseId=="string"&&(t.responseId=e.responseId),typeof e.modelVersion=="string"&&(t.responseModel=e.modelVersion);let n=e.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(t.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(t.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(t.totalTokens=n.totalTokenCount))}function l5(e,t,n){Array.isArray(e.functionCalls)&&t.toolCalls.push(...e.functionCalls);for(let r of e.candidates??[]){r?.finishReason&&!t.finishReasons.includes(r.finishReason)&&t.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&t.responseTexts.push(o.text),o.functionCall&&t.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function p5(e,t,n,r){!e||a5(e,r)||(c5(e,t),l5(e,t,n))}async function*El(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of e)p5(o,r,n,t),yield o}finally{ns(t,r,n)}}function Aa(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>Aa(n,t)):typeof e!="object"||!e?[]:"role"in e&&typeof e.role=="string"?[e]:"parts"in e?[{...e,role:t}]:[{role:t,content:e}]}function QO(e,t){if("model"in e&&typeof e.model=="string")return e.model;if(t&&typeof t=="object"){let n=t;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function u5(e){let t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[ti]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[ri]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[ed]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[ha]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[ni]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[ba]=e.presencePenalty),t}function Sd(e,t,n){let r={[Yr]:qO,[it]:e,[S]:"auto.ai.google_genai"};if(t){if(r[De]=QO(t,n),"config"in t&&typeof t.config=="object"&&t.config){let o=t.config;if(Object.assign(r,u5(o)),"tools"in o&&Array.isArray(o.tools)){let i=o.tools.flatMap(s=>s.functionDeclarations);r[Yn]=JSON.stringify(i)}}}else r[De]=QO({},n);return r}function Tl(e,t,n,r){if(n==="embeddings"){let i=t.contents;i!=null&&e.setAttribute(ci,typeof i=="string"?i:JSON.stringify(i));return}let o=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&o.push(...Aa(t.config.systemInstruction,"system")),"history"in t&&o.push(...Aa(t.history,"user")),"contents"in t&&o.push(...Aa(t.contents,"user")),"message"in t&&o.push(...Aa(t.message,"user")),Array.isArray(o)&&o.length){let{systemInstructions:i,filteredMessages:s}=kn(o);i&&e.setAttribute(en,i);let c=Array.isArray(s)?s.length:0;e.setAttributes({[Ot]:c,[Ft]:r?Wt(s):Ge(s)})}}function Ed(e,t,n){if(!(!t||typeof t!="object")){if(t.modelVersion&&e.setAttribute(cn,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata=="object"){let r=t.usageMetadata;typeof r.promptTokenCount=="number"&&e.setAttributes({[ot]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&e.setAttributes({[ut]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&e.setAttributes({[Ht]:r.totalTokenCount})}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let r=t.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(i=>typeof i.text=="string"?i.text:"").filter(i=>i.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&e.setAttributes({[tn]:r.join("")})}if(n&&t.functionCalls){let r=t.functionCalls;Array.isArray(r)&&r.length>0&&e.setAttributes({[Sn]:JSON.stringify(r)})}}}function d5(e,t,n,r,o){let i=n.operation==="embeddings";return new Proxy(e,{apply(s,c,a){let l=n.operation||"unknown",p=a[0],u=Sd(l,p,r),d=u[De]??"unknown";return n.streaming?ke({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},async m=>{try{o.recordInputs&&p&&Tl(m,p,l,ze(o.enableTruncation));let _=await s.apply(r,a);return El(_,m,!!o.recordOutputs)}catch(_){throw m.setStatus({code:2,message:"internal_error"}),m.end(),_}}):Se({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},m=>(o.recordInputs&&p&&Tl(m,p,l,ze(o.enableTruncation)),cr(()=>s.apply(r,a),()=>{},()=>{},_=>{i||Ed(m,_,o.recordOutputs)})))}})}function ly(e,t="",n){return new Proxy(e,{get:(r,o,i)=>{let s=Reflect.get(r,o,i),c=id(t,String(o)),a=KO[c];if(typeof s=="function"&&a){let l=a.operation?d5(s,c,a,r,n):s.bind(r);return a.proxyResultPath?function(...p){let u=l(...p);return u&&typeof u=="object"?ly(u,a.proxyResultPath,n):u}:l}return typeof s=="function"?s.bind(r):s&&typeof s=="object"?ly(s,c,n):s}})}function Td(e,t){return ly(e,"",Ze(t))}var Na="LangChain",va="auto.ai.langchain",JO={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var jn=(e,t,n)=>{n!=null&&(e[t]=n)},Mn=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function Ra(e){if(Array.isArray(e))try{let t=e.map(n=>n&&typeof n=="object"&&li(n)?ts(n):n);return JSON.stringify(t)}catch{return String(e)}return Ge(e,String)}function Il(e){let t=e.toLowerCase();return JO[t]??t}function $O(e){return e.includes("System")?"system":e.includes("Human")?"user":e.includes("AI")||e.includes("Assistant")?"assistant":e.includes("Function")?"function":e.includes("Tool")?"tool":"user"}function py(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function Al(e){return e.map(t=>{let n=t._getType;if(typeof n=="function"){let o=n.call(t);return{role:Il(o),content:Ra(t.content)}}if(t.lc===1&&t.kwargs){let o=t.id,i=Array.isArray(o)&&o.length>0?o[o.length-1]:"",s=typeof i=="string"?$O(i):"user";return{role:Il(s),content:Ra(t.kwargs?.content)}}if(t.type){let o=String(t.type).toLowerCase();return{role:Il(o),content:Ra(t.content)}}if(t.role)return{role:Il(String(t.role)),content:Ra(t.content)};let r=t.constructor?.name;return r&&r!=="Object"?{role:Il($O(r)),content:Ra(t.content)}:{role:"user",content:Ra(t.content)}})}function m5(e,t,n){let r={},o="kwargs"in e?e.kwargs:void 0,i=t?.temperature??n?.ls_temperature??o?.temperature;Mn(r,ti,i);let s=t?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Mn(r,ha,s);let c=t?.top_p??o?.top_p;Mn(r,ri,c);let a=t?.frequency_penalty;Mn(r,ni,a);let l=t?.presence_penalty;return Mn(r,ba,l),t&&"stream"in t&&jn(r,_a,!!t.stream),r}function ex(e,t,n,r,o){return{[Yr]:Ge(e??"langchain",String),[it]:"chat",[De]:Ge(t,String),[S]:va,...m5(n,r,o)}}function tx(e,t,n,r,o,i){let s=i?.ls_provider,c=o?.model??i?.ls_model_name??"unknown",a=ex(s,c,e,o,i);if(n&&Array.isArray(t)&&t.length>0){jn(a,Ot,t.length);let l=t.map(p=>({role:"user",content:p}));jn(a,Ft,r?Wt(l):Ge(l))}return a}function nx(e,t,n,r,o,i){let s=i?.ls_provider??e.id?.[2],c=o?.model??i?.ls_model_name??"unknown",a=ex(s,c,e,o,i);if(n&&Array.isArray(t)&&t.length>0){let l=Al(t.flat()),{systemInstructions:p,filteredMessages:u}=kn(l);p&&jn(a,en,p);let d=Array.isArray(u)?u.length:0;jn(a,Ot,d),jn(a,Ft,r?Wt(u):Ge(u))}return a}function f5(e,t){let n=[],r=e.flat();for(let o of r){let s=o.message?.tool_calls;if(Array.isArray(s)&&s.length>0)n.push(...s);else{let c=o.message?.content;if(Array.isArray(c))for(let a of c){let l=a;l.type==="tool_use"&&n.push(l)}}}n.length>0&&jn(t,Sn,Ge(n,String))}function g5(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)Mn(t,ot,n.promptTokens),Mn(t,ut,n.completionTokens),Mn(t,Ht,n.totalTokens);else if(r){Mn(t,ot,r.input_tokens),Mn(t,ut,r.output_tokens);let o=Number(r.input_tokens),i=Number(r.output_tokens),s=(Number.isNaN(o)?0:o)+(Number.isNaN(i)?0:i);s>0&&Mn(t,Ht,s),r.cache_creation_input_tokens!==void 0&&Mn(t,rO,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&Mn(t,oO,r.cache_read_input_tokens)}}function rx(e,t){if(!e)return;let n={};if(Array.isArray(e.generations)){let l=e.generations.flat().map(p=>p.generationInfo?.finish_reason?p.generationInfo.finish_reason:p.generation_info?.finish_reason?p.generation_info.finish_reason:null).filter(p=>typeof p=="string");if(l.length>0&&jn(n,jr,Ge(l,String)),f5(e.generations,n),t){let p=e.generations.flat().map(u=>u.text??u.message?.content).filter(u=>typeof u=="string");p.length>0&&jn(n,tn,Ge(p,String))}}g5(e.llmOutput,n);let r=e.llmOutput,i=e.generations?.[0]?.[0]?.message,s=r?.model_name??r?.model??i?.response_metadata?.model_name;s&&jn(n,cn,s);let c=r?.id??i?.id;c&&jn(n,oi,c);let a=r?.stop_reason??i?.response_metadata?.finish_reason;return a&&jn(n,zC,Ge(a,String)),n}function Id(e){let t={},n=e?.lc_agent_name;return typeof n=="string"&&(t[ii]=n),t}function ox(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(r=>{let o=r.function;return{type:"function",name:r.name??o?.name??"",description:r.description??o?.description}});return JSON.stringify(n)}function _5(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.addHandler=="function"&&typeof t.copy=="function"}function h5(e){return typeof e=="object"&&e?.name==="SentryCallbackHandler"}function zO(e){return e.some(h5)}function os(e,t){if(!e)return[t];if(_5(e)){if(zO(e.handlers??[]))return e;let r=e.copy();return r.addHandler(t,!0),r}let n=Array.isArray(e)?e:[e];return zO(n)?e:[...n,t]}function gr(e={}){let{recordInputs:t,recordOutputs:n}=Ze(e),r=ze(e.enableTruncation),o=new Map,i=c=>{let a=o.get(c);a?.isRecording()&&(a.end(),o.delete(c))},s={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(c,a,l,p,u,d,m,_){let h=py(d),b=tx(c,a,t,r,h,m),N=b[De],L=b[it];ke({name:`${L} ${N}`,op:"gen_ai.chat",attributes:{...Id(m),...b,[H]:"gen_ai.chat"}},R=>(o.set(l,R),R))},handleChatModelStart(c,a,l,p,u,d,m,_){let h=py(d),b=nx(c,a,t,r,h,m),N=ox(u);N&&(b[Yn]=N);let L=b[De],R=b[it];ke({name:`${R} ${L}`,op:"gen_ai.chat",attributes:{...Id(m),...b,[H]:"gen_ai.chat"}},v=>(o.set(l,v),v))},handleLLMEnd(c,a,l,p,u){let d=o.get(a);if(d?.isRecording()){let m=rx(c,n);m&&d.setAttributes(m),i(a)}},handleLLMError(c,a){let l=o.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),i(a))},handleChainStart(c,a,l,p,u,d,m,_){if(d?.__sentry_langgraph__)return;let h=_||c.name||"unknown_chain",b={[S]:"auto.ai.langchain","langchain.chain.name":h};t&&(b["langchain.chain.inputs"]=JSON.stringify(a)),ke({name:`chain ${h}`,op:"gen_ai.invoke_agent",attributes:{...b,[H]:"gen_ai.invoke_agent"}},N=>(o.set(l,N),N))},handleChainEnd(c,a){let l=o.get(a);l?.isRecording()&&(n&&l.setAttributes({"langchain.chain.outputs":JSON.stringify(c)}),i(a))},handleChainError(c,a){let l=o.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),i(a))},handleToolStart(c,a,l,p,u,d,m){if(d?.__sentry_langgraph__)return;let _=m||c.name||"unknown_tool",h={...Id(d),[S]:va,[it]:"execute_tool",[Zr]:_};t&&(h[ya]=a),ke({name:`execute_tool ${_}`,op:"gen_ai.execute_tool",attributes:{...h,[H]:"gen_ai.execute_tool"}},b=>(o.set(l,b),b))},handleToolEnd(c,a){let l=o.get(a);if(l?.isRecording()){if(n){let p=c,u=p&&typeof p=="object"&&"content"in p?p.content:c;l.setAttributes({[Sa]:typeof u=="string"?u:JSON.stringify(u)})}i(a)}},handleToolError(c,a){let l=o.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),i(a))},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}function b5(e){let t=e.constructor?.name??"";return t.includes("OpenAI")?"openai":t.includes("Google")?"google_genai":t.includes("Mistral")?"mistralai":t.includes("Vertex")?"google_vertexai":t.includes("Bedrock")?"aws_bedrock":t.includes("Ollama")?"ollama":t.includes("Cloudflare")?"cloudflare":t.includes("Cohere")?"cohere":"langchain"}function y5(e){let t=e??{},n={[S]:va,[H]:Kb,[it]:"embeddings",[De]:t.model??"unknown"};return n[Yr]=b5(t),"dimensions"in t&&(n[nd]=t.dimensions),"encodingFormat"in t&&(n[td]=t.encodingFormat),n}function Ad(e,t,n={}){let{recordInputs:r}=Ze(n),o=y5(e),i=o[De]||"unknown";return r&&t!=null&&(o[ci]=typeof t=="string"?t:JSON.stringify(t)),{name:`embeddings ${i}`,op:Kb,attributes:o}}function ix(e,t={}){return new Proxy(e,{apply(n,r,o){return Se(Ad(r,o[0],t),()=>Reflect.apply(n,r,o))}})}function Nd(e,t){let n=e;return typeof n.embedQuery=="function"&&(n.embedQuery=ix(n.embedQuery,t)),typeof n.embedDocuments=="function"&&(n.embedDocuments=ix(n.embedDocuments,t)),e}var Ca="LangGraph",Nl="auto.ai.langgraph";function vl(e){let t=e[0];if(typeof t!="object"||!t||!("llm"in t)||!t.llm||typeof t.llm!="object")return null;let n=t.llm;return typeof n.modelName!="string"&&typeof n.model!="string"?null:n}function Oa(e){let t=e[0];return typeof t=="object"&&t&&"name"in t&&typeof t.name=="string"?t.name:null}function Rl(e,t,n){let r="__sentry_tool_wrapped__";for(let o of e){if(!o||typeof o!="object")continue;let i=o,s=i.invoke;if(typeof s!="function"||Object.prototype.hasOwnProperty.call(i,r))continue;let c=typeof i.name=="string"?i.name:"unknown_tool",a=typeof i.description=="string"?i.description:void 0,l=new Proxy(s,{apply(p,u,d){let m={[S]:Nl,[H]:qb,[it]:"execute_tool",[Zr]:c,[dl]:"function"},h=d[1]?.metadata?.lc_agent_name??n;typeof h=="string"&&(m[ii]=h),a&&(m[Ea]=a);let b=d[0];if(typeof b=="object"&&b&&("id"in b&&typeof b.id=="string"&&(m[ul]=b.id),t.recordInputs)){let N="args"in b&&typeof b.args=="object"?b.args:b;try{m[ya]=JSON.stringify(N)}catch{}}return Se({op:qb,name:`execute_tool ${c}`,attributes:m},async N=>{try{let L=await Reflect.apply(p,u,d);if(t.recordOutputs)try{let R=L,v=R&&typeof R=="object"&&"content"in R?R.content:L;N.setAttribute(Sa,typeof v=="string"?v:JSON.stringify(v))}catch{}return L}catch(L){throw N.setStatus({code:2,message:"internal_error"}),L}})}});i.invoke=l,Object.defineProperty(i,r,{value:!0,enumerable:!1})}return e}function S5(e){if(!e||e.length===0)return null;let t=[];for(let n of e)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&t.push(...r)}return t.length>0?t:null}function E5(e){let t=e,n=0,r=0,o=0;if(t.usage_metadata&&typeof t.usage_metadata=="object"){let i=t.usage_metadata;return typeof i.input_tokens=="number"&&(n=i.input_tokens),typeof i.output_tokens=="number"&&(r=i.output_tokens),typeof i.total_tokens=="number"&&(o=i.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(t.response_metadata&&typeof t.response_metadata=="object"){let i=t.response_metadata;if(i.tokenUsage&&typeof i.tokenUsage=="object"){let s=i.tokenUsage;typeof s.promptTokens=="number"&&(n=s.promptTokens),typeof s.completionTokens=="number"&&(r=s.completionTokens),typeof s.totalTokens=="number"&&(o=s.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function T5(e,t){let n=t;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&e.setAttribute(cn,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&e.setAttribute(jr,[r.finish_reason])}}function sx(e){if(!e.builder?.nodes?.tools?.runnable?.tools)return null;let t=e.builder?.nodes?.tools?.runnable?.tools;return!t||!Array.isArray(t)||t.length===0?null:t.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function ax(e,t,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let i=t?.length??0,s=o.length>i?o.slice(i):[];if(s.length===0)return;let c=S5(s);c&&e.setAttribute(Sn,JSON.stringify(c));let a=Al(s);e.setAttribute(tn,JSON.stringify(a));let l=0,p=0,u=0;for(let d of s){let m=E5(d);l+=m.inputTokens,p+=m.outputTokens,u+=m.totalTokens,T5(e,d)}l>0&&e.setAttribute(ot,l),p>0&&e.setAttribute(ut,p),u>0&&e.setAttribute(Ht,u)}var uy=!1,vd="__sentry_patched__";function Rd(e){let t={[S]:Nl,[H]:"gen_ai.create_agent",[it]:"create_agent"};return e&&(t[ii]=e),{op:"gen_ai.create_agent",name:e?`create_agent ${e}`:"create_agent",attributes:t}}function dy(e,t){if(Object.prototype.hasOwnProperty.call(e,vd))return e;let n=gr(t),r=new Proxy(e,{apply(o,i,s){return uy?Reflect.apply(o,i,s):Se(Rd(),c=>{try{let a=Reflect.apply(o,i,s),l=s.length>0?s[0]:{};l?.name&&typeof l.name=="string"&&(c.setAttribute(ii,l.name),c.updateName(`create_agent ${l.name}`));let p=a.invoke;return p&&typeof p=="function"&&(a.invoke=Cl(p.bind(a),a,l,t,void 0,n)),a}catch(a){throw c.setStatus({code:2,message:"internal_error"}),a}})}});return Object.defineProperty(r,vd,{value:!0,enumerable:!1}),r}function Cl(e,t,n,r,o,i){return new Proxy(e,{apply(s,c,a){let l=o?.modelName??o?.model;return Se({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[S]:Nl,[H]:iO,[it]:"invoke_agent"}},async p=>{try{let u=n?.name;u&&typeof u=="string"&&(p.setAttribute(nO,u),p.setAttribute(ii,u),p.updateName(`invoke_agent ${u}`)),l&&p.setAttribute(De,l);let _=(a.length>1?a[1]:void 0)?.configurable?.thread_id;if(_&&typeof _=="string"&&p.setAttribute(si,_),i){let v=a[1]??{};a[1]=v;let P=v.metadata??{};v.metadata={...P,__sentry_langgraph__:!0,...typeof u=="string"?{lc_agent_name:u}:{}},v.callbacks=os(v.callbacks,i)}let h=sx(t);h&&p.setAttribute(Yn,JSON.stringify(h));let b=r.recordInputs,N=r.recordOutputs,L=a.length>0?a[0]?.messages??[]:[];if(L&&b){let v=Al(L),{systemInstructions:P,filteredMessages:G}=kn(v);P&&p.setAttribute(en,P);let I=ze(r.enableTruncation),B=Array.isArray(G)?G.length:0;p.setAttributes({[Ft]:I?Wt(G):Ge(G),[Ot]:B})}let R=await Reflect.apply(s,c,a);return N&&ax(p,L??null,R),R}catch(u){throw p.setStatus({code:2,message:"internal_error"}),u}})}})}function my(e,t){if(Object.prototype.hasOwnProperty.call(e,vd))return e;let n=Ze(t),r=gr(n),o=new Proxy(e,{apply(i,s,c){let a=vl(c),l=Oa(c),p=c[0];p&&Array.isArray(p.tools)&&p.tools.length>0&&Rl(p.tools,n,l??void 0),uy=!0;let u;try{u=Reflect.apply(i,s,c)}finally{uy=!1}let d=u.invoke;if(d&&typeof d=="function"){let m={};l&&(m.name=l),u.invoke=Cl(d.bind(u),u,m,n,a,r)}return u}});return Object.defineProperty(o,vd,{value:!0,enumerable:!1}),o}function Ol(e,t){return e.compile=dy(e.compile,Ze(t)),e}var cx=Ol;function lx(e,t,n){let r=n.getOptions(),o=n.getDsn(),i=r.tunnel,s=qs(r._metadata),c={sent_at:new Date(tt()).toISOString(),...I5(t)&&{trace:t},...s&&{sdk:s},...!!i&&o&&{dsn:sn(o)}},a=n.getDataCollectionOptions().userInfo?"auto":"never",l=[{type:"span",item_count:e.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...It()&&{ingest_settings:{infer_ip:a,infer_user_agent:a}},items:e}];return wt(c,[l])}function I5(e){return!!e.trace_id&&!!e.public_key}function px(e){let t=156;if(t+=e.name.length*2,t+=H_(e.attributes),e.links&&e.links.length>0){let r=e.links[0]?.attributes,o=100+(r?H_(r):0);t+=o*e.links.length}return t}var ux=1e3,A5=5e6,Cd=class{constructor(t,n){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:r,flushInterval:o,maxTraceWeightInBytes:i}=n??{};this._maxSpanLimit=r&&r>0&&r<=ux?r:ux,this._flushInterval=o&&o>0?o:5e3,this._maxTraceWeight=i&&i>0?i:A5,this._client.on("flush",()=>{this.drain()}),this._client.on("close",()=>{this._traceBuckets.forEach(s=>{clearTimeout(s.timeout)}),this._traceBuckets.clear()})}add(t){let n=t.trace_id,r=this._traceBuckets.get(n);r||(r={spans:new Set,size:0,timeout:xn(setTimeout(()=>{this.flush(n)},this._flushInterval))},this._traceBuckets.set(n,r)),r.spans.add(t),r.size+=px(t),(r.spans.size>=this._maxSpanLimit||r.size>=this._maxTraceWeight)&&this.flush(n)}drain(){this._traceBuckets.size&&(E&&g.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((t,n)=>{this.flush(n)}))}flush(t){let n=this._traceBuckets.get(t);if(!n)return;if(!n.spans.size){this._removeTrace(t);return}let r=Array.from(n.spans),o=r[0]?._segmentSpan;if(!o){E&&g.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let i=nt(o),s=r.map(a=>{let{_segmentSpan:l,...p}=a;return p}),c=lx(s,i,this._client);E&&g.log(`Sending span envelope for trace ${t} with ${s.length} spans`),this._client.sendEnvelope(c).then(null,a=>{E&&g.error("Error while sending streamed span envelope:",a)}),this._removeTrace(t)}_removeTrace(t){let n=this._traceBuckets.get(t);n&&clearTimeout(n.timeout),this._traceBuckets.delete(t)}};var xl=()=>({name:"SpanStreaming",setup(e){let t="SpanStreaming integration requires",n="Falling back to static trace lifecycle.",r=e.getOptions();if(!rt(e)){r.traceLifecycle="static",E&&g.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let o=r.beforeSendSpan;if(o&&!ho(o)){r.traceLifecycle="static",E&&g.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let i=new Cd(e);e.on("afterSpanEnd",s=>{$t(s)&&i.add(Dh(s,e))})}});function Pl(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}function kl(e,t,n){let r=e[t];if(typeof r=="function"){try{e[t]=n}catch{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=n}catch{Object.defineProperty(e,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}var Yt=class{constructor(t){this._maxSize=t,this._cache=new Map}get size(){return this._cache.size}get(t){let n=this._cache.get(t);if(n!==void 0)return this._cache.delete(t),this._cache.set(t,n),n}set(t,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(t,n)}remove(t){let n=this._cache.get(t);return n&&this._cache.delete(t),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let t=[];return this._cache.forEach(n=>t.push(n)),t}};function dx(e){let t=e._metadata?.sdk,n=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...n&&{"user-agent":n},...e.transportOptions?.headers}}}var Ll=class extends Du{constructor(t){dx(t),t.traceLifecycle==="stream"&&!t.integrations.some(n=>n.name==="SpanStreaming")&&t.integrations.push(xl()),super(t),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(t,n){let r=LC(this,this._options.stackParser,t,n);return r.level="error",Ao(r)}eventFromMessage(t,n="info",r){return Ao(MC(this._options.stackParser,t,n,r,this._options.attachStacktrace))}captureException(t,n,r){return mx(n),super.captureException(t,n,r)}captureEvent(t,n,r){return!t.type&&t.exception?.values&&t.exception.values.length>0&&mx(n),super.captureEvent(t,n,r)}captureCheckIn(t,n,r){let o="checkInId"in t&&t.checkInId?t.checkInId:dt();if(!this._isEnabled())return E&&g.warn("SDK not enabled, will not capture check-in."),o;let i=this.getOptions(),{release:s,environment:c,tunnel:a}=i,l={check_in_id:o,monitor_slug:t.monitorSlug,status:t.status,release:s,environment:c};"duration"in t&&(l.duration=t.duration),n&&(l.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[p,u]=la(this,r);u&&(l.contexts={trace:u});let d=yC(l,p,this.getSdkMetadata(),a,this.getDsn());return E&&g.log("Sending checkin:",t.monitorSlug,t.status),this.sendEnvelope(d),o}registerCleanup(t){this._disposeCallbacks.push(t)}dispose(){E&&g.log("Disposing client...");for(let t of this._disposeCallbacks)try{t()}catch{}this._disposeCallbacks.length=0;for(let t of Object.keys(this._hooks))this._hooks[t]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=ua(rl)}_prepareEvent(t,n,r,o){return this._options.platform&&(t.platform=t.platform||this._options.platform),this._options.runtime&&(t.contexts={...t.contexts,runtime:t.contexts?.runtime||this._options.runtime}),this._options.serverName&&(t.server_name=t.server_name||this._options.serverName),super._prepareEvent(t,n,r,o)}_setUpMetricsProcessing(){this.on("processMetric",t=>{this._options.serverName&&(t.attributes={"server.address":this._options.serverName,...t.attributes})})}};function mx(e){let t=J().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!=="crashed"?t.status="errored":n||(t.status="crashed")}}var fx={mechanism:{handled:!1,type:"auto.rpc.trpc.middleware"}};function N5(e){typeof e=="object"&&e!==null&&"ok"in e&&!e.ok&&"error"in e&&me(e.error,fx)}function fy(e={}){return async function(t){let{path:n,type:r,next:o,rawInput:i,getRawInput:s}=t,c=O(),a=c?.getOptions(),l=c?.getDataCollectionOptions(),p={procedure_path:n,procedure_type:r};if(Ev(p,1+(a?.normalizeDepth??5)),(e.attachRpcInput!==void 0?e.attachRpcInput:l?.httpBodies.includes("incomingRequest"))&&(i!==void 0&&(p.input=Ke(i)),s!==void 0&&typeof s=="function"))try{let u=await s();p.input=Ke(u)}catch{}return or(u=>(u.setContext("trpc",p),ke({name:`trpc/${n}`,op:"rpc.server",attributes:{[ve]:"route",[S]:"auto.rpc.trpc"},forceTransaction:!!e.forceTransaction},async d=>{try{let m=await o();return N5(m),d.end(),m}catch(m){throw me(m,fx),d.end(),m}})))}}function Co(e,t,n){try{if(!O())return;let o=Q();o?.isRecording()&&o.setStatus({code:2,message:"internal_error"}),me(e,{mechanism:{type:"auto.ai.mcp_server",handled:!1,data:{error_type:t||"handler_execution",...n}}})}catch{}}function xa(e,t){Mt(e,t,n=>function(r,...o){let i=o[o.length-1];if(typeof i!="function")return n.call(this,r,...o);let s=Ml(i,t,r);return n.call(this,r,...o.slice(0,-1),s)})}function Ml(e,t,n){return function(...r){try{return v5.call(this,e,t,n,r)}catch(o){return E&&g.warn("MCP handler wrapping failed:",o),e.apply(this,r)}}}function v5(e,t,n,r){try{let o=e.apply(this,r);return V(o)&&typeof o.then=="function"?Promise.resolve(o).catch(i=>{throw gx(i,t,n),i}):o}catch(o){throw gx(o,t,n),o}}function gx(e,t,n){try{let r={};t==="tool"||t==="registerTool"?(r.tool_name=n,e.name==="ProtocolValidationError"||e.message.includes("validation")||e.message.includes("protocol")?Co(e,"validation",r):e.name==="ServerTimeoutError"||e.message.includes("timed out")||e.message.includes("timeout")?Co(e,"timeout",r):Co(e,"tool_execution",r)):t==="resource"||t==="registerResource"?(r.resource_uri=n,Co(e,"resource_execution",r)):(t==="prompt"||t==="registerPrompt")&&(r.prompt_name=n,Co(e,"prompt_execution",r))}catch{}}function R5(e){typeof e.tool=="function"&&xa(e,"tool"),typeof e.registerTool=="function"&&xa(e,"registerTool")}function C5(e){typeof e.resource=="function"&&xa(e,"resource"),typeof e.registerResource=="function"&&xa(e,"registerResource")}function O5(e){typeof e.prompt=="function"&&xa(e,"prompt"),typeof e.registerPrompt=="function"&&xa(e,"registerPrompt")}function _x(e){R5(e),C5(e),O5(e)}function hx(e){let t=e,n=t._registeredTools;if(V(n))for(let[s,c]of Object.entries(n))typeof c.executor=="function"&&(c.executor=Ml(c.executor,"registerTool",s));let r=t._registeredResources;if(V(r))for(let[s,c]of Object.entries(r))typeof c.readCallback=="function"&&(c.readCallback=Ml(c.readCallback,"registerResource",s));let o=t._registeredResourceTemplates;if(V(o))for(let[s,c]of Object.entries(o))typeof c.readCallback=="function"&&(c.readCallback=Ml(c.readCallback,"registerResource",s));let i=t._registeredPrompts;if(V(i))for(let[s,c]of Object.entries(i))typeof c.handler=="function"&&(c.handler=Ml(c.handler,"registerPrompt",s))}var gy="mcp.method.name",bx="mcp.request.id",yx="mcp.session.id",Sx="mcp.transport",_y="mcp.server.name",hy="mcp.server.title",by="mcp.server.version",Pa="mcp.protocol.version",Ex="mcp.tool.name",pi="mcp.resource.uri",Tx="mcp.prompt.name",Ix="mcp.tool.result.is_error",Ax="mcp.tool.result.content_count",Nx="mcp.prompt.result.description",vx="mcp.prompt.result.message_count",Od="mcp.request.argument",Rx="mcp.logging.level",Cx="mcp.logging.logger",Ox="mcp.logging.data_type",xx="mcp.logging.message",Px="network.transport",kx="network.protocol.version",xd="client.address",Pd="client.port",yy="mcp.server",Lx="mcp.notification.client_to_server",Mx="mcp.notification.server_to_client",wx="auto.function.mcp_server",Sy="auto.mcp.notification",Gx="route";function Ux(e){return V(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&"id"in e}function Ey(e){return V(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&!("id"in e)}function Dx(e){return V(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"id"in e&&("result"in e||"error"in e)}function Bx(e){return V(e)&&"connect"in e&&("tool"in e&&"resource"in e&&"prompt"in e||"registerTool"in e&&"registerResource"in e&&"registerPrompt"in e)?!0:(E&&g.warn("Did not patch MCP server. Interface is incompatible."),!1)}function ln(e){return V(e)}function x5(e,t){let n={[Ax]:e.length};for(let[r,o]of e.entries()){if(!ln(o))continue;let i=e.length===1?"mcp.tool.result":`mcp.tool.result.${r}`;if(typeof o.type=="string"&&(n[`${i}.content_type`]=o.type),t){let s=(a,l)=>{typeof l=="string"&&(n[`${i}.${a}`]=l)};s("mime_type",o.mimeType),s("uri",o.uri),s("name",o.name),typeof o.text=="string"&&(n[`${i}.content`]=o.text),typeof o.data=="string"&&(n[`${i}.data_size`]=o.data.length);let c=o.resource;ln(c)&&(s("resource_uri",c.uri),s("resource_mime_type",c.mimeType))}}return n}function Hx(e,t){if(!ln(e))return{};let n=Array.isArray(e.content)?x5(e.content,t):{};return typeof e.isError=="boolean"&&(n[Ix]=e.isError),n}function Fx(e,t){let n={};if(!ln(e))return n;if(t&&typeof e.description=="string"&&(n[Nx]=e.description),Array.isArray(e.messages)&&(n[vx]=e.messages.length,t)){let r=e.messages;for(let[o,i]of r.entries()){if(!ln(i))continue;let s=r.length===1?"mcp.prompt.result":`mcp.prompt.result.${o}`;if(((a,l)=>{if(typeof l=="string"){let p=r.length===1?`${s}.message_${a}`:`${s}.${a}`;n[p]=l}})("role",i.role),ln(i.content)){let a=i.content;if(typeof a.text=="string"){let l=r.length===1?`${s}.message_content`:`${s}.content`;n[l]=a.text}}}}return n}var Ty=new Map,Wx=new WeakMap;function kd(e){let t=e.sessionId;return t?Ty.get(t):Wx.get(e)}function P5(e,t){let n=e.sessionId;n?Ty.set(n,t):Wx.set(e,t)}function Ld(e,t){let n=kd(e)||{};P5(e,{...n,...t})}function Vx(e){return kd(e)?.clientInfo}function Yx(e){return kd(e)?.protocolVersion}function jx(e){return kd(e)}function Zx(e){let t=e.sessionId;t&&Ty.delete(t)}var Xx="io.modelcontextprotocol/protocolVersion",Kx="io.modelcontextprotocol/clientInfo",qx="io.modelcontextprotocol/serverInfo";function Md(e){let t={};return ln(e)&&(typeof e.name=="string"&&(t.name=e.name),typeof e.title=="string"&&(t.title=e.title),typeof e.version=="string"&&(t.version=e.version)),t}function Qx(e){let t={};return ln(e.params)&&(typeof e.params.protocolVersion=="string"&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=Md(e.params.clientInfo))),t}function Jx(e){let t={};if(ln(e.params)&&ln(e.params._meta)){let n=e.params._meta;typeof n[Xx]=="string"&&(t.protocolVersion=n[Xx]),n[Kx]&&(t.clientInfo=Md(n[Kx]))}return t}function $x(e){let t={};return ln(e)&&(typeof e.protocolVersion=="string"&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=Md(e.serverInfo))),t}function zx(e){let t={};return ln(e)&&ln(e._meta)&&e._meta[qx]&&(t.serverInfo=Md(e._meta[qx])),t}function k5(e){let t=Vx(e),n={};return t?.name&&(n["mcp.client.name"]=t.name),t?.title&&(n["mcp.client.title"]=t.title),t?.version&&(n["mcp.client.version"]=t.version),n}function eP(e){let t={};return e?.name&&(t["mcp.client.name"]=e.name),e?.title&&(t["mcp.client.title"]=e.title),e?.version&&(t["mcp.client.version"]=e.version),t}function L5(e){let t=jx(e)?.serverInfo,n={};return t?.name&&(n[_y]=t.name),t?.title&&(n[hy]=t.title),t?.version&&(n[by]=t.version),n}function tP(e){let t={};return e?.name&&(t[_y]=e.name),e?.title&&(t[hy]=e.title),e?.version&&(t[by]=e.version),t}function M5(e){return{address:e?.requestInfo?.remoteAddress||e?.clientAddress||e?.request?.ip||e?.request?.connection?.remoteAddress,port:e?.requestInfo?.remotePort||e?.clientPort||e?.request?.connection?.remotePort}}function w5(e){if(!e?.constructor)return{mcpTransport:"unknown",networkTransport:"unknown"};let t=typeof e.constructor?.name=="string"?e.constructor.name:"unknown",n="unknown",r=t.toLowerCase();return r.includes("stdio")?n="pipe":(r.includes("http")||r.includes("sse"))&&(n="tcp"),{mcpTransport:t,networkTransport:n}}function Iy(e,t){let n=e&&"sessionId"in e?e.sessionId:void 0,r=t?M5(t):{},{mcpTransport:o,networkTransport:i}=w5(e),s=k5(e),c=L5(e),a=Yx(e);return{...n&&{[yx]:n},...r.address&&{[xd]:r.address},...r.port&&{[Pd]:r.port},[Sx]:o,[Px]:i,[kx]:"2.0",...a&&{[Pa]:a},...s,...c}}var wd=new Map,Ay=new WeakMap;function nP(e){let t=e.sessionId;if(t){let r=wd.get(t);return r||(r=new Map,wd.set(t,r)),r}let n=Ay.get(e);return n||(n=new Map,Ay.set(e,n)),n}function rP(e,t,n,r,o){nP(e).set(t,{span:n,method:r,capturePolicy:o,startTime:Date.now()})}function oP(e,t,n,r=!1){let o=nP(e),i=o.get(t);if(i){let{span:s,method:c}=i,a=c==="initialize"?$x(n):zx(n);(a.protocolVersion||a.serverInfo)&&Ld(e,a);let l={...tP(a.serverInfo)};if(a.protocolVersion&&(l[Pa]=a.protocolVersion),Object.keys(l).length>0&&s.setAttributes(l),r)s.setStatus({code:2,message:"internal_error"});else if(c==="tools/call"){let p=Hx(n,i.capturePolicy.recordOutputs);s.setAttributes(p)}else if(c==="prompts/get"){let p=Fx(n,i.capturePolicy.recordOutputs);s.setAttributes(p)}s.end(),o.delete(t)}}function iP(e){let t=e.sessionId;if(t){let r=wd.get(t);if(r){for(let[,o]of r)o.span.setStatus({code:2,message:"cancelled"}),o.span.end();wd.delete(t)}return}let n=Ay.get(e);if(n){for(let[,r]of n)r.span.setStatus({code:2,message:"cancelled"}),r.span.end();n.clear()}}var sP={"tools/call":{targetField:"name",targetAttribute:Ex,captureArguments:!0,argumentsField:"arguments"},"resources/read":{targetField:"uri",targetAttribute:pi,captureUri:!0},"resources/subscribe":{targetField:"uri",targetAttribute:pi},"resources/unsubscribe":{targetField:"uri",targetAttribute:pi},"prompts/get":{targetField:"name",targetAttribute:Tx,captureName:!0,captureArguments:!0,argumentsField:"arguments"}};function wl(e,t){let n=sP[e];if(!n)return{attributes:{}};let r=n.targetField&&typeof t?.[n.targetField]=="string"?t[n.targetField]:void 0;return{target:r,attributes:r&&n.targetAttribute?{[n.targetAttribute]:r}:{}}}function aP(e,t){let n={},r=sP[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let o=t[r.argumentsField];if(V(o))for(let[i,s]of Object.entries(o))n[`${Od}.${i.toLowerCase()}`]=JSON.stringify(s)}return r.captureUri&&t?.uri&&(n[`${Od}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${Od}.name`]=JSON.stringify(t.name)),n}function G5(e){return typeof e=="string"?e:JSON.stringify(e)}function U5(e,t,n){let r={};switch(e){case"notifications/cancelled":t?.requestId&&(r["mcp.cancelled.request_id"]=String(t.requestId)),t?.reason&&(r["mcp.cancelled.reason"]=String(t.reason));break;case"notifications/message":t?.level&&(r[Rx]=String(t.level)),t?.logger&&(r[Cx]=String(t.logger)),t?.data!==void 0&&(r[Ox]=typeof t.data,n&&(r[xx]=G5(t.data)));break;case"notifications/progress":t?.progressToken&&(r["mcp.progress.token"]=String(t.progressToken)),typeof t?.progress=="number"&&(r["mcp.progress.current"]=t.progress),typeof t?.total=="number"&&(r["mcp.progress.total"]=t.total,typeof t?.progress=="number"&&(r["mcp.progress.percentage"]=t.progress/t.total*100)),t?.message&&(r["mcp.progress.message"]=String(t.message));break;case"notifications/resources/updated":if(t?.uri){r[pi]=String(t.uri);let o=mr(String(t.uri));o&&!dr(o)&&(r["mcp.resource.protocol"]=o.protocol.replace(":",""))}break;case"notifications/initialized":r["mcp.lifecycle.phase"]="initialization_complete",r["mcp.protocol.ready"]=1;break}return r}function Ny(e,t,n,r){if(e==="request"){let o=t,i=wl(o.method,n||{});return{...o.id!==void 0&&{[bx]:String(o.id)},...i.attributes,...r?aP(o.method,n||{}):{}}}return U5(t.method,n||{},r)}var D5=new Set([xd,Pd,pi]);function B5(e){return D5.has(e)}function vy(e,t){return t?e:Object.entries(e).reduce((n,[r,o])=>(B5(r)||(n[r]=o),n),{})}function cP(e,t){return t?`${e} ${t}`:e}function lP(e){let t,n;switch(e){case"request":t=yy,n=wx;break;case"notification-incoming":t=Lx,n=Sy;break;case"notification-outgoing":t=Mx,n=Sy;break}return{[H]:t,[S]:n,[ve]:Gx}}function pP(e){let{type:t,message:n,transport:r,extra:o,callback:i,options:s}=e,{method:c}=n,a=n.params,l;if(t==="request"){let _=wl(c,a||{});l=cP(c,_.target)}else l=c;let p={...Iy(r,o),[gy]:c,...Ny(t,n,a,s?.recordInputs),...lP(t)},d=!!O()?.getDataCollectionOptions().userInfo,m=vy(p,d);return Se({name:l,forceTransaction:!0,attributes:m},i)}function uP(e,t,n,r,o){return pP({type:"notification-incoming",message:e,transport:t,extra:n,callback:o,options:r})}function dP(e,t,n,r){return pP({type:"notification-outgoing",message:e,transport:t,options:n,callback:r})}function mP(e,t,n,r){let{method:o}=e,i=e.params,s=wl(o,i||{}),c=cP(o,s.target),a={...Iy(t,n),[gy]:o,...Ny("request",e,i,r?.recordInputs),...lP("request")},p=!!O()?.getDataCollectionOptions().userInfo,u=vy(a,p);return{name:c,op:yy,forceTransaction:!0,attributes:u}}function Ry(e){if(e.recordInputs!==void 0&&e.recordOutputs!==void 0)return{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs};let t=O()?.getDataCollectionOptions().genAI;return{recordInputs:e.recordInputs??t?.inputs??!1,recordOutputs:e.recordOutputs??t?.outputs??!1}}function fP(e,t){e.onmessage&&Mt(e,"onmessage",n=>function(r,o){let i=Ux(r)?r:void 0,s=Ey(r)?r:void 0,c=i||s,a;if(c)try{a=i?.method==="initialize"?Qx(i):Jx(c),(a.protocolVersion||a.clientInfo)&&Ld(e,a)}catch{}if(i){let l=Ry(t),p=J().clone();return or(p,()=>{let u=mP(i,e,o,l),d=M(u);return i.method==="initialize"&&a&&d.setAttributes({...eP(a.clientInfo),...a.protocolVersion&&{[Pa]:a.protocolVersion}}),rP(e,i.id,d,i.method,l),se(d,()=>n.call(this,i,o))})}if(s){let l=Ry(t);return uP(s,e,o,l,()=>n.call(this,s,o))}return n.call(this,r,o)})}function gP(e,t){e.send&&Mt(e,"send",n=>async function(...r){let[o]=r;if(Ey(o)){let i=Ry(t);return dP(o,e,i,()=>n.call(this,...r))}return Dx(o)&&o.id!==null&&o.id!==void 0&&(o.error&&H5(o.error),oP(e,o.id,o.result,!!o.error)),n.call(this,...r)})}function _P(e){e.onclose&&Mt(e,"onclose",t=>function(...n){return iP(e),Zx(e),t.call(this,...n)})}function hP(e){e.onerror&&Mt(e,"onerror",t=>function(n){return F5(n),t.call(this,n)})}function H5(e){try{if(V(e)&&"code"in e&&"message"in e){let t=e;if(t.code===-32603||t.code>=-32099&&t.code<=-32e3){let r=new Error(t.message);r.name=`JsonRpcError_${t.code}`,Co(r,"protocol")}}}catch{}}function F5(e){try{Co(e,"transport")}catch{}}var bP=new WeakSet;function Cy(e,t){if(bP.has(e)||!Bx(e))return e;let n=e,r={...t};return Mt(n,"connect",o=>async function(i,...s){let c=await o.call(this,i,...s);return fP(i,r),gP(i,r),_P(i),hP(i),c}),_x(n),hx(n),bP.add(e),e}function EP(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function TP(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let i=o.match(r);if(i)return{filename:`<data:${i[2]}>`,function:i[1]};let s=o.match(n);if(s){let c,a,l,p,u;if(s[1]){l=s[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){c=l.slice(0,h),a=l.slice(h+1);let b=c.indexOf(".Module");b>0&&(l=l.slice(b+1),c=c.slice(0,b))}p=void 0}a&&(p=c,u=a),a==="<anonymous>"&&(u=void 0,l=void 0),l===void 0&&(u=u||"?",l=p?`${p}.${u}`:u);let d=fv(s[2]),m=s[5]==="native";!d&&s[5]&&!m&&(d=s[5]);let _=d?W5(d):void 0;return{filename:_??d,module:_&&e?.(_),function:l,lineno:yP(s[3]),colno:yP(s[4]),in_app:EP(d||"",m)}}if(o.match(t))return{filename:o}}}function Oy(e){return[90,TP(e)]}function yP(e){return parseInt(e||"",10)||void 0}function W5(e){try{return decodeURI(e)}catch{return}}var Gd=new WeakMap,IP=(e,t)=>{let n=Gd.get(e);n?n.push(t):Gd.set(e,[t])},Gl=e=>{let t=Gd.get(e);return t||(t=[],Gd.set(e,t)),t};var is="express.name",AP="http.route",ss="express.type",Ud="router",NP="middleware",vP="request_handler";var xy=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function V5(e){return e.includes(":")||e.includes("*")}var CP=(e,t,n)=>{if(t.name==="router"){let r=OP("",t),o=r||n||e||"/";return{attributes:{[is]:o,[ss]:Ud},name:`router - ${o}`}}else return t.name==="bound dispatch"||t.name==="handle"?{attributes:{[is]:(e||n)??"request handler",[ss]:vP},name:`request handler${t.path?` - ${e||n}`:""}`}:{attributes:{[is]:t.name,[ss]:NP},name:`middleware - ${t.name}`}},OP=(e,t)=>{let n=Array.isArray(t.handle?.stack)?t.handle?.stack?.[0]:void 0;return n?.route?.path?`${e}${n.route.path}`:n&&Array.isArray(n?.handle?.stack)?OP(e,n):e},xP=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return _n(e,n.ignoreLayers,!0)}catch{}return!1};function PP(e,t){let n=Gl(e);if(n.length===0)return;if(n.every(i=>i==="/"))return e.originalUrl==="/"?"/":void 0;if(t==="*"||t.includes("/")&&(t.includes(",")||t.includes("\\")||t.includes("*")||t.includes("[")))return t;let r=t.startsWith("/")?t:`/${t}`;return r.length>0&&(e.originalUrl===r||e.originalUrl.startsWith(r)||V5(r))?r:void 0}function kP(e){let t=Gl(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}var Dd=e=>{let t=e[0];return Array.isArray(t)?t.map(n=>RP(n)||"").join(","):RP(t)},RP=e=>typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0,Bd=e=>LP(e?.Router?.prototype),LP=e=>(typeof e=="object"||typeof e=="function")&&!!e&&"route"in e&&typeof e.route=="function",MP=e=>LP(e.Router)&&!Bd(e);function Y5(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function wP(e){return Y5(e)>=500}function Ul(e){if(!J()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let n=es(e);J().setSDKProcessingMetadata({normalizedRequest:n})}}function Hd(e,t,n){if(!t?.handle)return;let r=t,o=r.handle;if(Cr(o)||o.length===4)return;function i(s,c,...a){let l=e();Ul(s);let p=Q();if(!p)return o.apply(this,[s,c,...a]);n&&IP(s,n);let u=Gl(s),d=!!n,m=kP(s),_=PP(s,m);l.onRouteResolved?.(_);let h=CP(m,r,n),b=h.attributes[is],N=h.attributes[ss],L=Object.assign(h.attributes,{[S]:"auto.http.express",[H]:`${N}.express`});if(_&&(L[AP]=_),xP(h.attributes[is],N,l))return d&&u.pop(),o.apply(this,[s,c,...a]);let R=J();if(R!==Rt()){if(N==="request_handler"){let v=s.method?s.method.toUpperCase():"GET";R.setTransactionName(`${v} ${m}`)}}else E&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName");return ke({name:b,attributes:L},v=>{let P=!1;h.attributes[ss]===Ud&&(v.end(),P=!0);let G=()=>{P||(P=!0,v.end())};for(let I=0;I<a.length;I++){let B=a[I];if(typeof B=="function"){a[I]=function(...k){let U=k[0],ce=!!U&&U!=="route"&&U!=="router";if(!P&&ce){let[ge,Ne]=xy(U);v.setStatus({code:2,message:Ne})}return P||(P=!0,c.removeListener("finish",G),v.end()),!(s.route&&ce)&&d&&u.pop(),se(p,()=>B.apply(this,k))};break}}try{return o.apply(this,[s,c,...a])}catch(I){let[B,k]=xy(I);throw v.setStatus({code:2,message:k}),I}finally{P||c.once("finish",G)}})}for(let s in o)s in i||Object.defineProperty(i,s,{get(){return o[s]},set(c){o[s]=c}});Mi(i,o),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:i})}function Fd(e){return!!e&&typeof e=="object"&&"default"in e&&e.default||e}function j5(e){return!!e.express}var GP=!1;function Z5(){GP||(GP=!0,E&&g.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function Py(e,t){let n,r;if(!t&&j5(e)){let{express:p,...u}=e;r=p,n=()=>u,Z5()}else{if(typeof t!="function")throw new TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");n=t,r=e}let o=Fd(r),i=Bd(o)?o.Router.prototype:MP(o)?o.Router:void 0;if(!i)throw new TypeError("no valid Express route function to instrument");let s=i.route;try{Gs(i,"route",function(...u){let d=s.apply(this,u),m=this.stack[this.stack.length-1];return Hd(n,m,Dd(u)),d})}catch(p){E&&g.error("Failed to patch express route method:",p)}let c=i.use;try{Gs(i,"use",function(...u){let d=c.apply(this,u),m=this.stack[this.stack.length-1];return m&&Hd(n,m,Dd(u)),d})}catch(p){E&&g.error("Failed to patch express use method:",p)}let{application:a}=o,l=a.use;try{Gs(a,"use",function(...u){let d=l.apply(this,u),m=Bd(o)?this.router:this._router;if(m){let _=m.stack[m.stack.length-1];_&&Hd(n,_,Dd(u))}return d})}catch(p){E&&g.error("Failed to patch express application.use method:",p)}return o}function X5(){return O()?.getIntegrationByName("Express")?.getShouldHandleError?.()}function ky(e){return function(n,r,o,i){Ul(r);let s=e?.shouldHandleError??X5()??wP;if(s===!1){i(n);return}if(s(n)){let c=me(n,{mechanism:{type:"auto.middleware.express",handled:!1}});o.sentry=c}i(n)}}function Ly(e,t){e.use(K5()),e.use(ky(t))}function K5(){return function(t,n,r){Ul(t),r()}}var q5=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,Wd=Symbol("sentryPostgresConnectionContext"),My=Symbol.for("sentry.instrumented.postgresjs"),Q5=Symbol.for("sentry.query.from.instrumented.sql");function Uy(e,t){return!e||typeof e!="function"?(E&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),e):Gy(e,{requireParentSpan:!0,...t})}function Gy(e,t,n){if(e[My])return e;let r=new Proxy(e,{apply(o,i,s){let c=Reflect.apply(o,i,s);return V(c)&&"handle"in c&&UP(c,r,t),c},get(o,i){let s=o[i];return typeof i!="string"||typeof s!="function"?s:i==="unsafe"||i==="file"?J5(s,o,r,t):i==="begin"||i==="reserve"?$5(s,o,r,t):s}});return n?r[Wd]=n:ej(e,r),e[My]=!0,r[My]=!0,r}function J5(e,t,n,r){return function(...o){let i=Reflect.apply(e,t,o);return V(i)&&"handle"in i&&UP(i,n,r),i}}function $5(e,t,n,r){return function(...o){let i=n[Wd];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(e,t,o);return p&&typeof p.then=="function"?p.then(u=>Gy(u,r,i)):p}let c=o.length===1?o[0]:o[1],a=function(p){let u=Gy(p,r,i);return c(u)},l=o.length===1?[a]:[o[0],a];return Reflect.apply(e,t,l)}}function UP(e,t,n){if(e.handle?.__sentryWrapped)return;e[Q5]=!0;let r=e.handle,o=async function(...i){if(this.executed||!z5(n))return r.apply(this,i);let s=Vd(e.strings),c=La(s);return ke({name:c||"postgresjs.query",op:"db"},a=>{a.setAttribute(S,"auto.db.postgresjs"),a.setAttributes({"db.system.name":"postgres","db.query.text":c});let l=t?t[Wd]:void 0;if(Yd(a,l),n.requestHook)try{n.requestHook(a,c,l)}catch(u){a.setAttribute("sentry.hook.error","requestHook failed"),E&&g.error("Error in requestHook for PostgresJs instrumentation:",u)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(u,d,m)=>{try{ka(a,c,m?.[0]?.command),a.end()}catch(_){E&&g.error("Error ending span in resolve callback:",_)}return Reflect.apply(u,d,m)}}),p.reject=new Proxy(p.reject,{apply:(u,d,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute("db.response.status_code",m?.[0]?.code||"unknown"),a.setAttribute("error.type",m?.[0]?.name||"unknown"),ka(a,c),a.end()}catch(_){E&&g.error("Error ending span in reject callback:",_)}return Reflect.apply(u,d,m)}});try{return r.apply(this,i)}catch(u){throw a.setStatus({code:2,message:u instanceof Error?u.message:"unknown_error"}),a.end(),u}})};o.__sentryWrapped=!0,e.handle=o}function z5(e){return Q()!==void 0||!e.requireParentSpan}function Vd(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((t,n,r)=>r===0?n:`${t}$${r}${n}`,"")}var wy;function La(e){return e?(wy||(wy=new RegExp("(?<!\\$)-?\\b\\d+\\b","g")),e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(wy,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)")):"Unknown SQL Query"}function Yd(e,t){if(t&&(t.ATTR_DB_NAMESPACE&&e.setAttribute("db.namespace",t.ATTR_DB_NAMESPACE),t.ATTR_SERVER_ADDRESS&&e.setAttribute("server.address",t.ATTR_SERVER_ADDRESS),t.ATTR_SERVER_PORT!==void 0)){let n=parseInt(t.ATTR_SERVER_PORT,10);isNaN(n)||e.setAttribute("server.port",n)}}function ka(e,t,n){if(n){e.setAttribute("db.operation.name",n);return}let r=t?.match(q5);r?.[1]&&e.setAttribute("db.operation.name",r[1].toUpperCase())}function jd(e){let t=e.host?.[0]||"localhost",n=e.port?.[0]||5432;return{ATTR_DB_NAMESPACE:typeof e.database=="string"&&e.database!==""?e.database:void 0,ATTR_SERVER_ADDRESS:t,ATTR_SERVER_PORT:String(n)}}function ej(e,t){let n=e;!n.options||typeof n.options!="object"||(t[Wd]=jd(n.options))}var Qr="@sentry/instrumentation-http",Jr="http.client.request.created",Ma="http.server.request.start";function Zd(e){let t=e.host||"",n=/^(.*):(\d+)$/.exec(t),r=n?n[1]:t,o=e.port??(n?Number(n[2]):void 0);return{method:e.method,port:o,protocol:e.protocol,host:e.host,hostname:r,path:e.path,headers:e.getHeaders()}}function Dy(e){try{return String(DP(e))}catch{return""}}function DP(e){let t=e.protocol||"http:",r=e.headers?.host&&String(e.headers?.host)||e.hostname||e.host||"",o=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(r)?"":`:${e.port}`,i=e.path?e.path:"/",s=`${t}//${r}${o}`;return new URL(i.startsWith("//")?`${s}${i}`:i,s)}function _r(e){return String(Dy(Zd(e)))}function BP(e,t){let n=_r(e),r=$o(n),o=t?.statusCode,i=Pl(o);an({category:"http",data:{status_code:o,url:zo(r),"http.method":e.method||"GET",...r.search?{"http.query":r.search}:{},...r.hash?{"http.fragment":r.hash}:{}},type:"http",level:i},{event:"response",request:e,response:t})}function HP(e){let t=_r(e),[n,r]=bb(mr(t),"client","auto.http.client",e),o=e.getHeader("user-agent");return{name:n,attributes:{[H]:"http.client","otel.kind":"CLIENT","http.url":t,"http.method":e.method,"http.target":e.path||"/","net.peer.name":e.host,"http.host":e.getHeader("host"),...o?{"user_agent.original":o}:{},...r},onlyIfParent:!0}}function FP(e,t){let{statusCode:n,statusMessage:r,httpVersion:o,socket:i}=e,s=o?.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp";t.setAttributes({"http.response.status_code":n,"network.protocol.version":o,"http.flavor":o,"network.transport":s,"net.transport":s,"http.status_text":r?.toUpperCase(),"http.status_code":n,...nj(e),...tj(i)})}function tj(e){if(!e)return{};let{remoteAddress:t,remotePort:n}=e;return{"network.peer.address":t,"network.peer.port":n,"net.peer.ip":t,"net.peer.port":n}}function nj(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,o=t["content-encoding"];return r>=0?o&&o!=="identity"?{"http.response_content_length":r}:{"http.response_content_length_uncompressed":r}:{}}function Xd(e,t){let n=_r(e),r=O()?.getOptions(),{tracePropagationTargets:o,propagateTraceparent:i}=r??{};if(!zi(n,o,t)||!!e.getHeader("sentry-trace"))return;let c=$e({propagateTraceparent:i});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c;if(a)try{e.setHeader("sentry-trace",a),E&&g.log(Qr,"Added sentry-trace header")}catch(u){E&&g.error(Qr,"Failed to set sentry-trace header:",et(u)?u.message:"Unknown error")}if(p&&!e.getHeader("traceparent"))try{e.setHeader("traceparent",p),E&&g.log(Qr,"Added traceparent header")}catch(u){E&&g.error(Qr,"Failed to set traceparent header:",et(u)?u.message:"Unknown error")}if(l){let u=Xs(e.getHeader("baggage"),l);if(u)try{e.setHeader("baggage",u),E&&g.log(Qr,"Added baggage header")}catch(d){E&&g.error(Qr,"Failed to set baggage header:",et(d)?d.message:"Unknown error")}}}var WP=e=>typeof e.__unwrap=="function",rj="Double-wrapped http.client detected. Either disable spans in Sentry.httpIntegration, or disable the OpenTelemetry HTTP instrumentation. See: https://docs.sentry.io/platforms/javascript/guides/express/opentelemetry/custom-setup/#custom-http-instrumentation",VP=!1,By=E?e=>{VP||(WP(e.request)||WP(e.get))&&(VP=!0,g.warn(rj))}:()=>{};function Dl(e){let t=new Yt(100),n=()=>O()?.getOptions(),r=o=>{if(ne().getScopeData().sdkProcessingMetadata[Js]===!0)return;let i=n(),{errorMonitor:s="error",spans:c=i?Ue(i):!0,propagateTrace:a=!1,breadcrumbs:l=!0,http:p,https:u,suppressOtelWarning:d=!1}=e,{request:m}=o,_=_r(m);if(yb(_,O())||e.ignoreOutgoingRequests?.(_,m))return;let h=!1;function b(G,I){h||(h=!0,BP(G,I))}function N(G){G.on(s,()=>b(G,void 0)),G.prependListener("response",I=>{G.listenerCount("response")<=1&&I.resume(),I.on("end",()=>b(G,I)),I.on(s,()=>b(G,I))})}if(!c){l&&N(m),a&&Xd(m,t);return}d||(p&&By(p),u&&By(u));let L=M(HP(m));e.outgoingRequestHook?.(L,m),a&&(L.isRecording()?se(L,()=>{Xd(m,t)}):Xd(m,t));let R=!1;function v(G){R||(R=!0,L.setStatus(G),L.end())}let P=()=>v({code:0});m.on("close",P),m.on(s,G=>{E&&g.log(Qr,"outgoingRequest on request error()",G),l&&b(m,void 0),v({code:2})}),m.prependListener("response",G=>{m.removeListener("close",P),m.listenerCount("response")<=1&&G.resume(),FP(G,L),bn(G),e.outgoingResponseHook?.(L,G);let I=!1;function B(k){if(!I){I=!0,k&&E&&g.log(Qr,"outgoingRequest on response error()",k),l&&b(m,G);let U=G.aborted&&!G.complete,ce=k||typeof G.statusCode!="number"||U?{code:2}:qt(G.statusCode);e.applyCustomAttributesOnSpan?.(L,m,G),v(ce)}}G.on("end",()=>B()),G.on(s,B)})};return{[Jr]:r}}var YP;function oj(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!="function"||(YP=Dl({...t,http:e})[Jr],Cr(n._storeHeader)))return;let o=n._storeHeader;Gs(n,"_storeHeader",function(...s){try{YP({request:this},Jr)}catch{}return o.apply(this,s)})}function ij(e,t={}){let n=Fd(e);return oj(n,t),e}var Hy=(e,t={})=>ij(e,t);function jP(e,t,n,r){let o=0,i=[];E&&g.log(r,"Patching request.on");let s=new WeakMap,c=Tb(n);try{e.on=e.addListener=new Proxy(e.on,{apply:(a,l,p)=>{let[u,d,...m]=p;if(u==="data"){E&&g.log(r,`Handling request.on("data") with maximum body size of ${c}b`);let _=new Proxy(d,{apply:(h,b,N)=>{try{let L=N[0],R=Buffer.from(L);o<c?(i.push(R),o+=R.byteLength):E&&g.log(r,`Dropping request body chunk because maximum body length of ${c}b is exceeded.`)}catch{E&&g.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(h,b,N)}});return s.set(d,_),Reflect.apply(a,l,[u,_,...m])}return Reflect.apply(a,l,p)}}),e.off=e.removeListener=new Proxy(e.off,{apply:(a,l,p)=>{let[,u]=p,d=s.get(u);if(d){s.delete(u);let m=p.slice();return m[1]=d,Reflect.apply(a,l,m)}return Reflect.apply(a,l,p)}}),e.on("end",()=>{try{let a=Buffer.concat(i).toString("utf-8");if(a){let p=Buffer.byteLength(a,"utf-8")>c?`${Buffer.from(a).subarray(0,c-3).toString("utf-8")}...`:a;t.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(a){E&&g.error(r,"Error building captured request body",a)}})}catch(a){E&&g.error(r,"Error patching request to capture body",a)}}var Fy=new WeakMap;function ZP(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&o){E&&g.log(`Recorded request session with status: ${o.status}`);let i=new Date(tt());i.setSeconds(0,0);let s=i.toISOString(),c=Fy.get(e),a=c?.[s]||{exited:0,crashed:0,errored:0};if(a[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,c)c[s]=a;else{E&&g.log("Opened new request session aggregate.");let l={[s]:a};Fy.set(e,l);let p=()=>{clearTimeout(d),u(),Fy.delete(e);let m=Object.entries(l).map(([_,h])=>({started:_,exited:h.exited,errored:h.errored,crashed:h.crashed}));e.sendSession({aggregates:m})},u=e.on("flush",()=>{E&&g.log("Sending request session aggregate due to client flush"),p()}),d=setTimeout(()=>{E&&g.log("Sending request session aggregate due to flushing schedule"),p()},r);xn(d)}}})}var XP="Http.Server",sj="Http.SentryServerSpans",KP=new WeakMap,qP=Symbol.for("sentry_http_server_instrumented");function aj(e){return!e[qP]&&(e[qP]=!0)}function cj(e,t){let n=t.emit,r=KP.get(t);if(n===r)return;let o=new Proxy(n,{apply(i,s,c){let[a,...l]=c;if(a!=="request")return i.apply(s,c);let p=O(),[u,d]=l;if(!p||!aj(u))return i.apply(s,c);E&&g.log(XP,"Handling incoming request");let m=J().clone();m.setClient(p);let _=u.socket?.remoteAddress,h=u.url||"/",b=es(u),{maxRequestBodySize:N="medium",ignoreRequestBody:L,sessions:R=!0,sessionFlushingDelayMS:v=6e4}=e;N!=="none"&&!L?.(h,u)&&jP(u,m,N,XP),m.setSDKProcessingMetadata({normalizedRequest:b,ipAddress:_});let P=(u.method||"GET").toUpperCase(),G=fr(h),I=`${P} ${G}`;return m.setTransactionName(I),R&&ZP(p,{requestIsolationScope:m,response:d,sessionFlushingDelayMS:v??6e4}),or(m,()=>{let B=b.headers?.["sentry-trace"],k=b.headers?.baggage,U=Array.isArray(B)?B[0]:B;return vn({sentryTrace:U,baggage:Array.isArray(k)?k[0]:k},()=>{let ce=ne().getPropagationContext();ce.propagationSpanId=Xt(),U||(ce.traceId=yt(),ce.sampleRand=ct()),d.once("close",()=>{m.setContext("response",{status_code:d.statusCode})});let ge=e.wrapServerEmitRequest,Ne=!1;return ge?ge(u,d,b,()=>{Ne=i.apply(s,c)}):Ne=i.apply(s,c),Ne})})}});KP.set(t,o),t.emit=o}function Wy(e){let t=e.wrapServerEmitRequest,n=lj(e),r={...e,wrapServerEmitRequest(i,s,c,a){let l=O()?.getOptions();e.spans??(l?Ue(l):!1)?n(i,s,c,a):t?t(i,s,c,a):a()}},o=i=>{let{server:s}=i;cj(r,s)};return{[Ma]:o}}function lj(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:o,errorMonitor:i="error",onSpanEnd:s}=e;return(c,a,l,p)=>{if(typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__)return p();return t?t(c,a,l,u):u();function u(){let m=J().getClient();if(!m)return p();if(pj(c,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return E&&g.log(sj,"Skipping span creation for incoming request",c.url),p();let _=l.url||c.url||"/",h=mr(_),b=h?h.pathname:fr(_),N=(c.method||"GET").toUpperCase(),L=`${N} ${b}`,R=c.headers,v=R["user-agent"],P=R["x-forwarded-for"],G=c.httpVersion,I=R.host,B=I?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",k=_.startsWith("https")?"https":"http",{socket:U}=c,{localAddress:ce,localPort:ge,remoteAddress:Ne,remotePort:Te}=U??{};return ke({name:L,kind:D.SERVER,attributes:{[H]:"http.server",[S]:"auto.http.server",[ve]:"url","http.route":b,"otel.kind":"SERVER","net.host.ip":ce,"net.host.port":ge,"net.peer.ip":Ne,"net.peer.port":Te,"sentry.http.prefetch":uj(c)||void 0,[pt]:h&&!dr(h)?h.href:void 0,[Qo]:h?.pathname??b,[Io]:_,"http.method":N,"http.target":h?`${h.pathname}${h.search}`:b,"http.host":I,"net.host.name":B,"http.client_ip":typeof P=="string"?P.split(",")[0]:void 0,"http.user_agent":v,"http.scheme":k,"http.flavor":G,"net.transport":G?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...dj(c),...Vr(l.headers||{},m.getDataCollectionOptions())}},Oe=>{o?.(Oe,c,a);let qe=!1;function Nt(In){qe||(qe=!0,Oe.setAttributes({"http.status_text":a.statusMessage?.toUpperCase(),"http.response.status_code":a.statusCode,"http.status_code":a.statusCode,...Vr(Fu(a.headers),m?.getDataCollectionOptions()??!1,"response")}),Oe.setStatus(In),s?.(Oe,c,a),Oe.end())}a.once("close",()=>{Nt(qt(a.statusCode))}),a.once(i,()=>{let In=qt(a.statusCode);Nt(In.code===2?In:{code:2})}),p()})}}}function pj(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,o=e.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||t&&o==="GET"&&QP(r)||n?.(r,e))}function QP(e){let t=fr(e);return!!(t.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||t.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function uj(e){return e.headers["next-router-prefetch"]==="1"}function dj(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,o=t["content-encoding"];return r>=0?o&&o!=="identity"?{"http.request_content_length":r}:{"http.request_content_length_uncompressed":r}:{}}at();import{subscribe as mj}from"diagnostics_channel";var We=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var JP=Li("sentry_http_server_instrumented"),fj="Http.Server";function $P(e,t){we(e,"_startSpanCallback",new WeakRef(t))}var gj=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??"medium",spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(n,r,o,i){let s=O();if(!s||pe.active().getValue(JP))return i();let c=uo.extract(pe.active(),o.headers).setValue(JP,!0);pe.with(c,()=>{s.emit("httpServerRequest",n,r,o);let a=n._startSpanCallback?.deref();a?a(()=>(i(),!0)):i()})}};return{name:fj,setupOnce(){let{[Ma]:n}=Wy(t);mj(Ma,n)},afterAllSetup(n){We&&n.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}}),wa=gj;at();cv();import{errorMonitor as _j}from"events";var zP="Http.ServerSpans",hj=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,r=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=e,{requestHook:i,responseHook:s,applyCustomAttributesOnSpan:c}=e.instrumentation??{};return{name:zP,setup(a){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||a.on("httpServerRequest",(l,p,u)=>{let d=l,m=p;$P(d,h=>{if(Sj(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return We&&g.log(zP,"Skipping span creation for incoming request",d.url),h();let b=u.url||d.url||"/",N=mr(b),L=d.headers,R=L["user-agent"],v=L["x-forwarded-for"],P=d.httpVersion,G=L.host,I=G?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",B=b.startsWith("https")?"https":"http",k=u.method||d.method?.toUpperCase()||"GET",U=N?N.pathname:fr(b),ce=`${k} ${U}`,ge=M({name:ce,kind:D.SERVER,attributes:{[H]:"http.server",[S]:"auto.http.otel.http",[T0]:bj(d)||void 0,[pt]:N&&!dr(N)?N.href:void 0,[Qo]:N?.pathname??U,[Io]:b,[Br]:u.method,[Cu]:N?`${N.pathname}${N.search}`:U,[c0]:G,[_0]:I,[s0]:typeof v=="string"?v.split(",")[0]:void 0,[p0]:R,[l0]:B,[a0]:P,[ca]:P?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...Ej(d),...Vr(u.headers||{},a.getDataCollectionOptions())}});i?.(ge,d),s?.(ge,m),c?.(ge,d,m),o?.(ge,d,m);let Ne={type:y_.HTTP,span:ge};return se(ge,()=>pe.with(av(pe.active(),Ne),()=>{bn(d),bn(m);let Te=!1;function Oe(qe){if(Te)return;Te=!0;let Nt=Aj(d,m,Ne);ge.setAttributes(Nt),ge.setStatus(qe),ge.end();let In=Nt["http.route"];In&&J().setTransactionName(`${d.method?.toUpperCase()||"GET"} ${In}`)}return m.on("close",()=>{Oe(qt(m.statusCode))}),m.on(_j,()=>{let qe=qt(m.statusCode);Oe(qe.code===2?qe:{code:2})}),h()}))})})},processEvent(a){if(a.type==="transaction"){let l=a.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"){if(Nj(l,r))return We&&g.log("Dropping transaction due to status code",l),null;a.contexts={...a.contexts,response:{...a.contexts?.response,status_code:l}}}}return a},afterAllSetup(a){We&&(a.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerSpansIntegration` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),a.getIntegrationByName("Http.Server")||g.error("It seems that you have manually added `httpServerSpansIntegration` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}}),Ga=hj;function bj(e){return e.headers["next-router-prefetch"]==="1"}function yj(e){let t=fr(e);return!!(t.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||t.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function Sj(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(wr())return!0;let r=e.url,o=e.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||t&&o==="GET"&&yj(r)||n?.(r,e))}function Ej(e){let t=Tj(e.headers);return t==null?{}:Ij(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function Tj(e){let t=e["content-length"];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function Ij(e){let t=e["content-encoding"];return!!t&&t!=="identity"}function Aj(e,t,n){let{socket:r}=e,{statusCode:o,statusMessage:i}=t,s={[yn]:o,[To]:o,"http.status_text":i?.toUpperCase()};if(r){let{localAddress:c,localPort:a,remoteAddress:l,remotePort:p}=r;s[g0]=c,s[h0]=a,s[b0]=l,s[xe]=p}if(s[To]=o,s["http.status_text"]=(i||"").toUpperCase(),n?.type===y_.HTTP&&n.route!==void 0){let c=n.route;s[He]=c}return s}function Nj(e,t){return t.some(n=>{if(typeof n=="number")return n===e;let[r,o]=n;return e>=r&&e<=o})}at();import{subscribe as VZ,unsubscribe as YZ}from"diagnostics_channel";at();var Bl=class{emit(t){}enabled(){return!1}},ek=new Bl;var Hl=Symbol.for("io.opentelemetry.js.api.logs"),Ua=globalThis;function tk(e,t,n){return r=>r===e?t:n}var Vy=1;var Yy=class{getLogger(t,n,r){return new Bl}},Kd=new Yy;var qd=class{constructor(t,n,r,o){this._provider=t,this.name=n,this.version=r,this.options=o}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):ek}};var Fl=class{getLogger(t,n,r){var o;return(o=this._getDelegateLogger(t,n,r))!==null&&o!==void 0?o:new qd(this,t,n,r)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Kd}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,n,r)}};var Qd=class e{constructor(){this._proxyLoggerProvider=new Fl}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return Ua[Hl]?this.getLoggerProvider():(Ua[Hl]=tk(Vy,t,Kd),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,n;return(n=(t=Ua[Hl])===null||t===void 0?void 0:t.call(Ua,Vy))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(t,n,r){return this.getLoggerProvider().getLogger(t,n,r)}disable(){delete Ua[Hl],this._proxyLoggerProvider=new Fl}};var Jd=Qd.getInstance();function nk(e,t,n,r){for(let o=0,i=e.length;o<i;o++){let s=e[o];t&&s.setTracerProvider(t),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}}function rk(e){e.forEach(t=>t.disable())}function Da(e){let t=e.tracerProvider||he.getTracerProvider(),n=e.meterProvider||$p.getMeterProvider(),r=e.loggerProvider||Jd.getLoggerProvider(),o=e.instrumentations?.flat()??[];return nk(o,t,n,r),()=>{rk(o)}}import*as Oo from"path";import{types as Uk}from"util";at();var ck=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,vj=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Rj={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function lk(e,t,n){if(!Cj(e))return on.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,"$1");let r=kj(e);if(!r)return!1;let o=[],i=pk(r,t,o,n);return i&&!n?.includePrerelease?xj(r,o):i}function Cj(e){return typeof e=="string"&&ck.test(e)}function pk(e,t,n,r){if(t.includes("||")){let o=t.trim().split("||");for(let i of o)if(jy(e,i,n,r))return!0;return!1}else if(t.includes(" - "))t=zj(t,r);else if(t.includes(" ")){let o=t.trim().replace(/\s{2,}/g," ").split(" ");for(let i of o)if(!jy(e,i,n,r))return!1;return!0}return jy(e,t,n,r)}function jy(e,t,n,r){if(t=Pj(t,r),t.includes(" "))return pk(e,t,n,r);{let o=Lj(t);return n.push(o),Oj(e,o)}}function Oj(e,t){if(t.invalid)return!1;if(!t.version||Xy(t.version))return!0;let n=ik(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],o=t.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=ik(r,o)}return Rj[t.op]?.includes(n)}function xj(e,t){return e.prerelease?t.some(n=>n.prerelease&&n.version===e.version):!0}function Pj(e,t){return e=e.trim(),e=Jj(e,t),e=Qj(e),e=$j(e,t),e=e.trim(),e}function pn(e){return!e||e.toLowerCase()==="x"||e==="*"}function kj(e){let t=e.match(ck);if(!t){on.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,o=t.groups.build,i=n.split("."),s=r?.split(".");return{op:void 0,version:n,versionSegments:i,versionSegmentCount:i.length,prerelease:r,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:o}}function Lj(e){if(!e)return{};let t=e.match(vj);if(!t)return on.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,o=t.groups.prerelease,i=t.groups.build,s=r.split("."),c=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:s,versionSegmentCount:s.length,prerelease:o,prereleaseSegments:c,prereleaseSegmentCount:c?c.length:0,build:i}}function Xy(e){return e==="*"||e==="x"||e==="X"}function ok(e){let t=parseInt(e,10);return isNaN(t)?e:t}function Mj(e,t){if(typeof e==typeof t){if(typeof e=="number")return[e,t];if(typeof e=="string")return[e,t];throw new Error("Version segments can only be strings or numbers")}else return[String(e),String(t)]}function wj(e,t){if(Xy(e)||Xy(t))return 0;let[n,r]=Mj(ok(e),ok(t));return n>r?1:n<r?-1:0}function ik(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=wj(e[n]||"0",t[n]||"0");if(r!==0)return r}return 0}var uk="[a-zA-Z0-9-]",dk="0|[1-9]\\d*",Gj=`\\d*[a-zA-Z-]${uk}*`,Uj="((?:<|>)?=?)",sk=`(?:${dk}|${Gj})`,Dj=`(?:-(${sk}(?:\\.${sk})*))`,ak=`${uk}+`,Bj=`(?:\\+(${ak}(?:\\.${ak})*))`,Zy=`${dk}|x|X|\\*`,Wl=`[v=\\s]*(${Zy})(?:\\.(${Zy})(?:\\.(${Zy})(?:${Dj})?${Bj}?)?)?`,Hj=`^${Uj}\\s*${Wl}$`,Fj=new RegExp(Hj),Wj=`^\\s*(${Wl})\\s+-\\s+(${Wl})\\s*$`,Vj=new RegExp(Wj),Yj="(?:~>?)",jj=`^${Yj}${Wl}$`,Zj=new RegExp(jj),Xj="(?:\\^)",Kj=`^${Xj}${Wl}$`,qj=new RegExp(Kj);function Qj(e){let t=Zj;return e.replace(t,(n,r,o,i,s)=>{let c;return pn(r)?c="":pn(o)?c=`>=${r}.0.0 <${+r+1}.0.0-0`:pn(i)?c=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:s?c=`>=${r}.${o}.${i}-${s} <${r}.${+o+1}.0-0`:c=`>=${r}.${o}.${i} <${r}.${+o+1}.0-0`,c})}function Jj(e,t){let n=qj,r=t?.includePrerelease?"-0":"";return e.replace(n,(o,i,s,c,a)=>{let l;return pn(i)?l="":pn(s)?l=`>=${i}.0.0${r} <${+i+1}.0.0-0`:pn(c)?i==="0"?l=`>=${i}.${s}.0${r} <${i}.${+s+1}.0-0`:l=`>=${i}.${s}.0${r} <${+i+1}.0.0-0`:a?i==="0"?s==="0"?l=`>=${i}.${s}.${c}-${a} <${i}.${s}.${+c+1}-0`:l=`>=${i}.${s}.${c}-${a} <${i}.${+s+1}.0-0`:l=`>=${i}.${s}.${c}-${a} <${+i+1}.0.0-0`:i==="0"?s==="0"?l=`>=${i}.${s}.${c}${r} <${i}.${s}.${+c+1}-0`:l=`>=${i}.${s}.${c}${r} <${i}.${+s+1}.0-0`:l=`>=${i}.${s}.${c} <${+i+1}.0.0-0`,l})}function $j(e,t){let n=Fj;return e.replace(n,(r,o,i,s,c,a)=>{let l=pn(i),p=l||pn(s),u=p||pn(c),d=u;return o==="="&&d&&(o=""),a=t?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&d?(p&&(s=0),c=0,o===">"?(o=">=",p?(i=+i+1,s=0,c=0):(s=+s+1,c=0)):o==="<="&&(o="<",p?i=+i+1:s=+s+1),o==="<"&&(a="-0"),r=`${o+i}.${s}.${c}${a}`):p?r=`>=${i}.0.0${a} <${+i+1}.0.0-0`:u&&(r=`>=${i}.${s}.0${a} <${i}.${+s+1}.0-0`),r})}function zj(e,t){let n=Vj;return e.replace(n,(r,o,i,s,c,a,l,p,u,d,m,_)=>(pn(i)?o="":pn(s)?o=`>=${i}.0.0${t?.includePrerelease?"-0":""}`:pn(c)?o=`>=${i}.${s}.0${t?.includePrerelease?"-0":""}`:a?o=`>=${o}`:o=`>=${o}${t?.includePrerelease?"-0":""}`,pn(u)?p="":pn(d)?p=`<${+u+1}.0.0-0`:pn(m)?p=`<${u}.${+d+1}.0-0`:_?p=`<=${u}.${d}.${m}-${_}`:t?.includePrerelease?p=`<${u}.${d}.${+m+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}var un=console.error.bind(console);function Vl(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}var as=(e,t,n)=>{if(!e||!e[t]){un("no original function "+String(t)+" to wrap");return}if(!n){un("no wrapper function"),un(new Error().stack);return}let r=e[t];if(typeof r!="function"||typeof n!="function"){un("original object and wrapper must be functions");return}let o=n(r,t);return Vl(o,"__original",r),Vl(o,"__unwrap",()=>{e[t]===o&&Vl(e,t,r)}),Vl(o,"__wrapped",!0),Vl(e,t,o),o},Ky=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{un("must provide one or more modules to patch"),un(new Error().stack);return}if(!(t&&Array.isArray(t))){un("must provide one or more functions to wrap on modules");return}e.forEach(r=>{t.forEach(o=>{as(r,o,n)})})},Ba=(e,t)=>{if(!e||!e[t]){un("no function to unwrap."),un(new Error().stack);return}let n=e[t];if(!n.__unwrap)un("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{n.__unwrap();return}},qy=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{un("must provide one or more modules to patch"),un(new Error().stack);return}if(!(t&&Array.isArray(t))){un("must provide one or more functions to unwrap on modules");return}e.forEach(n=>{t.forEach(r=>{Ba(n,r)})})};function Yl(e){e&&e.logger&&(typeof e.logger!="function"?un("new logger isn't a function, not replacing"):un=e.logger)}Yl.wrap=as;Yl.massWrap=Ky;Yl.unwrap=Ba;Yl.massUnwrap=qy;at();var $d=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,n,r){this.instrumentationName=t,this.instrumentationVersion=n,this.setConfig(r),this._diag=on.createComponentLogger({namespace:t}),this._tracer=he.getTracer(t,n),this._meter=$p.getMeter(t,n),this._logger=Jd.getLogger(t,n),this._updateMetricInstruments()}_wrap=as;_unwrap=Ba;_massWrap=Ky;_massUnwrap=qy;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,n,r,o){if(t)try{t(r,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},i)}}};var Nk=Qp(oS());import*as iS from"path";var im=class{hooks=[];children=new Map},sm=class{_trie=new im;_counter=0;insert(t){let n=this._trie;for(let r of t.moduleName.split("/")){let o=n.children.get(r);o||(o=new im,n.children.set(r,o)),n=o}n.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,i=[],s=!0;for(let c of t.split("/")){let a=o.children.get(c);if(!a){s=!1;break}r||i.push(...a.hooks),o=a}return r&&s&&i.push(...o.hooks),i.length===0?[]:i.length===1?[i[0].hook]:(n&&i.sort((c,a)=>c.insertedId-a.insertedId),i.map(({hook:c})=>c))}};var CZ=["afterEach","after","beforeEach","before","describe","it"].every(e=>typeof global[e]=="function"),am=class e{_moduleNameTrie=new sm;static _instance;constructor(){this._initialize()}_initialize(){new Nk.Hook(null,{internals:!0},(t,n,r)=>{let o=OZ(n),i=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:s}of i)t=s(t,n,r);return t})}register(t,n){let r={moduleName:t,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return CZ?new e:this._instance=this._instance??new e}};function OZ(e){return iS.sep!=="/"?e.split(iS.sep).join("/"):e}var Bk=Qp(gS());at();var Hk=Qp(oS());import{readFileSync as WZ}from"fs";function $r(e,t,n){let r,o;try{o=e()}catch(i){r=i}finally{if(t(r,o),r&&!n)throw r;return o}}function w(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var ae=class extends $d{_modules;_hooks=[];_requireInTheMiddleSingleton=am.getInstance();_enabled=!1;constructor(t,n,r){super(t,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(t,n,r)=>{if(w(t[n])&&this._unwrap(t,n),Uk.isProxy(t)){let o=as(Object.assign({},t),n,r);return Object.defineProperty(t,n,{value:o}),o}else return as(t,n,r)};_unwrap=(t,n)=>Uk.isProxy(t)?Object.defineProperty(t,n,{value:t[n]}):Ba(t,n);_massWrap=(t,n,r)=>{if(t)Array.isArray(t)||(t=[t]);else{on.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){on.error("must provide one or more functions to wrap on modules");return}t.forEach(o=>{n.forEach(i=>{this._wrap(o,i,r)})})};_massUnwrap=(t,n)=>{if(t)Array.isArray(t)||(t=[t]);else{on.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){on.error("must provide one or more functions to wrap on modules");return}t.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let t=globalThis.require;!t?.resolve||!t?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=t.resolve(r);t.cache[o]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(t){try{let n=WZ(Oo.join(t,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{on.warn("Failed extracting version",t)}}_onRequire(t,n,r,o){if(!o)return typeof t.patch=="function"&&(t.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:t.name}),t.patch(n)):n;let i=this._extractPackageVersion(o);if(t.moduleVersion=i,t.name===r)return Dk(t.supportedVersions,i,t.includePrerelease)&&typeof t.patch=="function"&&(t.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:t.name,version:t.moduleVersion,baseDir:o}),t.patch(n,t.moduleVersion)):n;let s=t.files??[],c=Oo.normalize(r);return s.filter(l=>l.name===c&&Dk(l.supportedVersions,i,t.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:t.name,version:t.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,t.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let t of this._modules){typeof t.patch=="function"&&t.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:t.name,version:t.moduleVersion}),t.patch(t.moduleExports,t.moduleVersion));for(let n of t.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:t.name,version:t.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,t.moduleVersion))}return}this._warnOnPreloadedModules();for(let t of this._modules){let n=(s,c,a)=>{if(!a&&Oo.isAbsolute(c)){let l=Oo.parse(c);c=l.name,a=l.dir}return this._onRequire(t,s,c,a)},r=(s,c,a)=>this._onRequire(t,s,c,a),o=Oo.isAbsolute(t.name)?new Hk.Hook([t.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(t.name,r);this._hooks.push(o);let i=new Bk.Hook([t.name],{internals:!0},n);this._hooks.push(i)}}}disable(){if(this._enabled){this._enabled=!1;for(let t of this._modules){typeof t.unpatch=="function"&&t.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:t.name,version:t.moduleVersion}),t.unpatch(t.moduleExports,t.moduleVersion));for(let n of t.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:t.name,version:t.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,t.moduleVersion))}}}isEnabled(){return this._enabled}};function Dk(e,t,n){return typeof t>"u"?e.includes("*"):e.some(r=>lk(t,r,{includePrerelease:n}))}var re=class{files;name;supportedVersions;patch;unpatch;constructor(t,n,r,o,i){this.files=i||[],this.name=t,this.supportedVersions=n,this.patch=r,this.unpatch=o}};var nn=Bs(process.versions.node),Xa=nn.major,_S=nn.minor;import{errorMonitor as jZ}from"events";import*as Fk from"http";var ZZ=nn.major===22&&nn.minor>=12||nn.major===23&&nn.minor>=2||nn.major>=24;function ls(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,r={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(o,i){return wr()||!!n.ignoreOutgoingRequests?.(o,Zd(i))},outgoingRequestHook(o,i){n.outgoingRequestHook?.(o,i);let s=i.once,c=new Proxy(s,{apply(a,l,p){let[u]=p;if(u!=="response")return a.apply(l,p);let d=pe.active(),m=he.setSpan(d,o);return pe.with(m,()=>a.apply(l,p))}});i.once=c},outgoingResponseHook(o,i){n.outgoingResponseHook?.(o,i)},errorMonitor:jZ,http:Fk};ZZ?XZ(r):KZ(r)}var hS;function XZ(e){let{[Jr]:t}=Dl(e);hS&&YZ(Jr,hS),VZ(Jr,t),hS=t}function KZ(e){Hy(Fk,e)}var Wk="Http";Object.assign(ls,{id:`${Wk}.sentry`});var Vk=(e={})=>{let t=e.spans??!1,n=e.disableIncomingRequestSpans??!1,r=t&&!n,o={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},i={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},s={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests,spans:t},c=wa(o),a=Ga(i);return{name:Wk,setup(l){r&&a.setup(l)},setupOnce(){c.setupOnce(),ls(s)},processEvent(l){return a.processEvent(l)}}};import*as lm from"diagnostics_channel";import{URL as eX}from"url";var bS="sentry-trace",cm="baggage",qZ="traceparent";function ES(e,t,n){let r=jk(e.origin,e.path),{tracePropagationTargets:o,propagateTraceparent:i}=O()?.getOptions()||{};if(!zi(r,o,t))return;let s=n&&Gr(n)&&Q()?void 0:n,c=s?se(s,()=>$e({propagateTraceparent:i})):$e({propagateTraceparent:i});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c,u=Array.isArray(e.headers)?QZ(e.headers):JZ(e.headers);if(yS(u,bS),yS(u,cm),i&&yS(u,qZ),!(SS(u,bS)!==-1)){a&&u.push(bS,a),p&&SS(u,"traceparent")===-1&&u.push("traceparent",p);let m=SS(u,cm);if(l&&m===-1)u.push(cm,l);else if(l){let _=u[m+1],h=Xs(_,l);h&&(u[m+1]=h)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...u):e.headers=$Z(u)}function QZ(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];n%2===0?t.push(typeof r=="string"?r:String(r)):t.push(Array.isArray(r)?r.join(", "):r??"")}return t}function JZ(e){let t=e.split(`\r
|
|
26
|
+
`),n=[];for(let r of t)try{let o=r.indexOf(":");if(o===-1)continue;let i=r.slice(0,o).trim(),s=r.slice(o+1).trim();i&&n.push(i,s)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function $Z(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],o=e[n+1];!r||o==null||t.push(`${r}: ${o}`)}return t.length?t.join(`\r
|
|
27
|
+
`).concat(`\r
|
|
28
|
+
`):""}function yS(e,t){let n=-1;for(let r=0;r<e.length;r+=2){if(e[r]!==t)continue;if(n===-1){n=r;continue}let o=e[n+1];if(t===cm&&o){let i=Xs(e[r+1],o);i&&(e[n+1]=i)}e.splice(r,2),r-=2}}function SS(e,t){return e.findIndex((n,r)=>r%2===0&&n===t)}function Yk(e,t){let n=zZ(e),r=t.statusCode,o=Pl(r);an({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:e,response:t})}function zZ(e){try{let t=jk(e.origin,e.path),n=$o(t),r={url:zo(n),"http.method":e.method||"GET"};return n.search&&(r["http.query"]=n.search),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function jk(e,t="/"){try{return new URL(t,e).toString()}catch{let n=`${e}`;return n.endsWith("/")&&t.startsWith("/")?`${n}${t.slice(1)}`:!n.endsWith("/")&&!t.startsWith("/")?`${n}/${t}`:`${n}${t}`}}var tX="http.request.method_original",TS=[],ps=new WeakMap,Xk=new WeakMap,Zk=new Yt(100);function Kl(e={}){TS.length||(Xl("undici:request:create",t=>nX(e,t)),Xl("undici:client:sendHeaders",t=>rX(e,t)),Xl("undici:request:headers",t=>oX(e,t)),Xl("undici:request:trailers",t=>iX(t)),Xl("undici:request:error",t=>sX(t)))}function IS(e,t){try{return e()}catch(n){t(n);return}}function Xl(e,t){let[n=0,r=0]=process.version.replace("v","").split(".").map(i=>Number(i));n>18||n===18&&r>=19?TS.push(lm.subscribe?.(e,t)):TS.push(lm.channel(e).subscribe(t))}function Kk(e){let t=new Map;if(Array.isArray(e.headers))for(let n=0;n<e.headers.length;n+=2){let r=e.headers[n],o=e.headers[n+1];typeof r=="string"&&o!==void 0&&t.set(r.toLowerCase(),o)}else if(typeof e.headers=="string"){let n=e.headers.split(`\r
|
|
29
|
+
`);for(let r of n){if(!r)continue;let o=r.indexOf(":");if(o===-1)continue;let i=r.substring(0,o).toLowerCase(),s=r.substring(o+1).trim(),c=t.get(i);c&&Array.isArray(c)?c.push(s):c?t.set(i,[c,s]):t.set(i,s)}}return t}function nX(e,{request:t}){let n=cX(t.origin,t.path),r=IS(()=>!!e.ignoreOutgoingRequests?.(n),b=>b&&We&&g.error("caught ignoreOutgoingRequests error: ",b)),o=wr()||!!r;if(Xk.set(t,o),!e.spans){e.tracePropagation!==!1&&!o&&ES(t,Zk);return}if(t.method==="CONNECT"||r)return;let i;try{i=new eX(t.path,t.origin)}catch(b){We&&g.warn("could not determine url.full:",b);return}let s=i.protocol.replace(":",""),c=aX(t.method),a={[Hr]:c,[tX]:t.method,[pt]:i.toString(),[Qo]:i.pathname,[Pu]:i.search,[x0]:s,[S]:"auto.http.otel.node_fetch"};if(n.startsWith("data:")){let b=il(n);a["http.url"]=b,a[pt]=b,a[hn]=`${t.method||"GET"} ${b}`}let l={https:"443",http:"80"},p=i.hostname,u=i.port||l[s];a[_t]=p,u&&!isNaN(Number(u))&&(a[ht]=Number(u));let m=Kk(t).get("user-agent");if(m){let b=Array.isArray(m)?m[m.length-1]:m;a[P0]=b}let _=O(),h=M({name:c==="_OTHER"?"HTTP":c,kind:D.CLIENT,attributes:a,onlyIfParent:!_||!rt(_)});IS(()=>e.requestHook?.(h,t),b=>b&&We&&g.error("caught requestHook error: ",b)),ES(t,Zk,h),ps.set(t,h)}function rX(e,{request:t,socket:n}){let r=ps.get(t);if(!r)return;let{remoteAddress:o,remotePort:i}=n,s={[d0]:o,[m0]:i};if(e.headersToSpanAttributes?.requestHeaders){let c=new Set(e.headersToSpanAttributes.requestHeaders.map(l=>l.toLowerCase())),a=Kk(t);for(let[l,p]of a.entries())if(c.has(l)){let u=Array.isArray(p)?p:[p];s[`http.request.header.${l}`]=u}}r.setAttributes(s)}function oX(e,{request:t,response:n}){e.breadcrumbs!==!1&&!Xk.get(t)&&Yk(t,n);let o=ps.get(t);if(!o)return;let i={[yn]:n.statusCode};if(IS(()=>e.responseHook?.(o,{request:t,response:n}),s=>s&&We&&g.error("caught responseHook error: ",s)),e.headersToSpanAttributes?.responseHeaders){let s=new Set;e.headersToSpanAttributes?.responseHeaders.forEach(c=>s.add(c.toLowerCase()));for(let c=0;c<n.headers.length;c=c+2){let a=n.headers[c],l=n.headers[c+1];if(a===void 0||l===void 0)continue;let p=a.toString().toLowerCase(),u=l;if(s.has(p)){let d=`http.response.header.${p}`;Object.prototype.hasOwnProperty.call(i,d)?i[d].push(u.toString()):i[d]=[u.toString()]}}}o.setAttributes(i),n.statusCode>=400&&o.setStatus(qt(n.statusCode))}function iX({request:e}){let t=ps.get(e);t&&(t.end(),ps.delete(e))}function sX({request:e,error:t}){let n=ps.get(e);n&&(n.setStatus({code:2,message:t.message}),n.end(),ps.delete(e))}function aX(e){let t={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in t?e.toUpperCase():"_OTHER"}function cX(e,t="/"){let n=`${e}`;return n.endsWith("/")&&t.startsWith("/")?`${n}${t.slice(1)}`:!n.endsWith("/")&&!t.startsWith("/")?`${n}/${t}`:`${n}${t}`}var lX=((e={})=>({name:"NodeFetch",setupOnce(){Kl(e)}})),qk=lX;at();at();cv();var GS="sentry.parentIsRemote",us="sentry.graphql.operation";function US(e){if("parentSpanId"in e)return e.parentSpanId;if("parentSpanContext"in e)return e.parentSpanContext?.spanId}function mm(e){return V(e.attributes)}function eL(e){return typeof e.kind=="number"}function tL(e){return!!e.status}function AS(e){return!!e.name}function nL(e){if(!mm(e))return{};let t=e.attributes[pt]||e.attributes[Io],n={url:t,"http.method":e.attributes[Hr]||e.attributes[Br]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof t=="string"){let r=$o(t);n.url=zo(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function rL(e){return eL(e)?e.kind:vt.INTERNAL}var pm="sentry-trace",NS="baggage",fm="sentry.dsc",DS="sentry.sampled_not_recording",oL="sentry.url",pX="sentry.sample_rand",uX="sentry.sample_rate",gm="sentry.ignored",iL="sentry.segment_ignored",_m=Li("sentry_scopes"),vS=Li("sentry_fork_isolation_scope"),RS=Li("sentry_fork_set_scope"),um=Li("sentry_fork_set_isolation_scope"),sL="_scopeContext";function ds(e){return e.getValue(_m)}function aL(e,t){return e.setValue(_m,t)}function dX(e,t){we(e,sL,Gi(t))}function Ka(e){return Ui(e[sL])}function qa(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(DS)==="1":!1;if(t===vr.SAMPLED)return!0;if(r)return!1;let o=n?n.get(fm):void 0,i=o?ir(o):void 0;if(i?.sampled==="true")return!0;if(i?.sampled==="false")return!1}function cL(e,t){let n=e.spanContext(),r=Re(e),o=qa(n);if(o!==void 0)return o;if(Gr(r))return!1;if(!(!Ue(t?.getOptions())||n.isRemote||!Bc(r)))return $t(e)}function Ql(e,t,n){let r=t[Hr]||t[Br];if(r)return fX({attributes:t,name:e,kind:n},r);let o=t[mt]||t[Pe],i=typeof t[H]=="string"&&t[H].startsWith("cache.");if(o&&!i)return mX({attributes:t,name:e});let s=t[ve]==="custom"?"custom":"route";if(t[xu])return{...ql(e,t,"route"),op:"rpc"};if(t[Ut])return{...ql(e,t,s),op:"message"};let l=t[Au];return l?{...ql(e,t,s),op:l.toString()}:{op:void 0,description:e,source:"custom"}}function lL(e){let t,n;if(mm(e))t=e.attributes,n=AS(e)?e.name:"<unknown>";else{let o=typeof e.spanContext=="function"?ie(e):void 0;t=o?.data||{},n=AS(e)?e.name:o?.description||"<unknown>"}let r=rL(e);return Ql(n,t,r)}function mX({attributes:e,name:t}){let n=e[hn];if(typeof n=="string")return{op:"db",description:n,source:e[ve]||"custom"};if(e[ve]==="custom")return{op:"db",description:t,source:"custom"};let r=e[Ve];return{op:"db",description:r?r.toString():t,source:"task"}}function fX({name:e,kind:t,attributes:n},r){let o=["http"];switch(t){case vt.CLIENT:o.push("client");break;case vt.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:i,url:s,query:c,fragment:a,hasRoute:l}=_X(n,t);if(!i)return{...ql(e,n),op:o.join(".")};let p=n[us],u=`${r} ${i}`,d=p?`${u} (${gX(p)})`:u,m=l||i==="/"?"route":"url",_={};s&&(_.url=s),c&&(_["http.query"]=c.slice(1)),a&&(_["http.fragment"]=a.slice(1));let h=t===vt.CLIENT||t===vt.SERVER,N=!`${n[S]||"manual"}`.startsWith("auto"),L=n[ve]==="custom",R=n[hn],v=!L&&R==null&&(h||!N),{description:P,source:G}=v?{description:d,source:m}:ql(e,n);return{op:o.join("."),description:P,source:G,data:_}}function gX(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(", "):`${t.slice(0,5).join(", ")}, +${t.length-5}`}return`${e}`}function _X(e,t){let n=e[Cu],r=e[Io]||e[pt],o=e[He],i=typeof r=="string"?$o(r):void 0,s=i?zo(i):void 0,c=i?.search||void 0,a=i?.hash||void 0;return typeof o=="string"?{urlPath:o,url:s,query:c,fragment:a,hasRoute:!0}:t===vt.SERVER&&typeof n=="string"?{urlPath:fr(n),url:s,query:c,fragment:a,hasRoute:!1}:i?{urlPath:s,url:s,query:c,fragment:a,hasRoute:!1}:typeof n=="string"?{urlPath:fr(n),url:s,query:c,fragment:a,hasRoute:!1}:{urlPath:void 0,url:s,query:c,fragment:a,hasRoute:!1}}function ql(e,t,n="custom"){let r=t[ve]||n,o=t[hn];return o&&typeof o=="string"?{description:o,source:r}:{description:e,source:r}}function BS(e){e.on("createDsc",(t,n)=>{if(!n)return;let r=ie(n),i=r.data[ve],s=cL(n,e);if(s===!1)delete t.transaction;else if(r.description){let{description:c}=lL(n);i!=="url"&&c&&(t.transaction=c)}Ue()&&(t.sampled=s==null?void 0:String(s))})}function HS(){return he.getActiveSpan()}var ui=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,dm=class e{constructor(){this._internalState=new Map}set(t,n){let r=this._clone();return r._internalState.has(t)&&r._internalState.delete(t),r._internalState.set(t,n),r}unset(t){let n=this._clone();return n._internalState.delete(t),n}get(t){return this._internalState.get(t)}serialize(){return Array.from(this._internalState.keys()).reverse().map(t=>`${t}=${this._internalState.get(t)}`).join(",")}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};function pL({dsc:e,sampled:t}){let n=e?Yo(e):void 0,r=new dm,o=n?r.set(fm,n):r;return t===!1?o.set(DS,"1"):o}var uL=new Set;function FS(){return Array.from(uL)}function ms(e){uL.add(e)}var Qa=class extends sv{constructor(){super(),ms("SentryPropagator"),this._urlMatchesTargetsMap=new Yt(100)}inject(t,n,r){if(Ls(t)){ui&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=he.getSpan(t),i=o&&SX(o),{tracePropagationTargets:s,propagateTraceparent:c}=O()?.getOptions()||{};if(!zi(i,s,this._urlMatchesTargetsMap)){ui&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",i);return}let a=bX(n),l=yX(n),p=uo.getBaggage(t)||uo.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:m,sampled:_}=dL(t);if(a){let h=Zs(a);h&&Object.entries(h).forEach(([b,N])=>{!l&&b.startsWith(go)||(p=p.setEntry(b,{value:N}))})}!l&&u&&(p=Object.entries(u).reduce((h,[b,N])=>N?h.setEntry(`${go}${b}`,{value:N}):h,p)),!l&&d&&d!==iv&&(r.set(n,pm,jo(d,m,_)),c&&r.set(n,"traceparent",Zo(d,m,_))),super.inject(uo.setBaggage(t,p),n,r)}extract(t,n,r){let o=r.get(n,pm),i=r.get(n,NS),s=o?Array.isArray(o)?o[0]:o:void 0;return fL(mL(t,{sentryTrace:s,baggage:i}))}fields(){return[pm,NS,"traceparent"]}};function dL(e,t={}){let n=he.getSpan(e);if(n?.spanContext().isRemote){let c=n.spanContext();return{dynamicSamplingContext:nt(n),traceId:c.traceId,spanId:void 0,sampled:qa(c)}}if(n){let c=n.spanContext();return{dynamicSamplingContext:nt(n),traceId:c.traceId,spanId:c.spanId,sampled:cL(n,t.client)}}let r=t.scope||ds(e)?.scope||ne(),o=t.client||O(),i=r.getPropagationContext();return{dynamicSamplingContext:o?ar(o,r):void 0,traceId:i.traceId,spanId:i.propagationSpanId,sampled:i.sampled}}function mL(e,{sentryTrace:t,baggage:n}){let r=Nn(t,n),{traceId:o,parentSpanId:i,sampled:s,dsc:c}=r,a=O(),l=ir(n);if(!i||a&&!wc(a,l?.org_id))return e;let p=EX({traceId:o,spanId:i,sampled:s,dsc:c});return he.setSpanContext(e,p)}function hX(e,t,n){let r=fL(mL(e,t));return pe.with(r,n)}function fL(e){let t=ds(e),n={scope:t?t.scope:ne().clone(),isolationScope:t?t.isolationScope:J()};return aL(e,n)}function bX(e){try{let t=e[NS];return Array.isArray(t)?t.join(","):t}catch{return}}function yX(e){try{return e[pm]}catch{return}}function SX(e){let t=ie(e).data,n=t[Io]||t[pt];if(typeof n=="string")return n;let r=e.spanContext().traceState?.get(oL);if(r)return r}function EX({spanId:e,traceId:t,sampled:n,dsc:r}){let o=pL({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?vr.SAMPLED:vr.NONE,traceState:o}}function gL(e,t,n){let r=yL(),{name:o,parentSpan:i}=e;return AL(i)(()=>{let c=TL(e.scope,e.forceTransaction),a=e.onlyIfParent&&!he.getSpan(c),l=a?ks(c):c;a&&O()?.recordDroppedEvent("no_parent_span","span");let p=SL(e);if(!Ue()){let u=Ls(l)?l:ks(l);return pe.with(u,()=>r.startActiveSpan(o,p,u,d=>(CS(d),pe.with(c,()=>cr(()=>t(d),()=>{ie(d).status===void 0&&d.setStatus({code:Dn.ERROR})},n?()=>d.end():void 0)))))}return r.startActiveSpan(o,p,l,u=>(CS(u),cr(()=>t(u),()=>{ie(u).status===void 0&&u.setStatus({code:Dn.ERROR})},n?()=>u.end():void 0)))})}function _L(e,t){return gL(e,t,!0)}function hL(e,t){return gL(e,n=>t(n,()=>n.end()),!1)}function bL(e){let t=yL(),{name:n,parentSpan:r}=e;return AL(r)(()=>{let i=TL(e.scope,e.forceTransaction),s=e.onlyIfParent&&!he.getSpan(i),c=s?ks(i):i;s&&O()?.recordDroppedEvent("no_parent_span","span");let a=SL(e);Ue()||(c=Ls(c)?c:ks(c));let l=t.startSpan(n,a,c);return CS(l),l})}function WS(e,t){let n=e?he.setSpan(pe.active(),e):he.deleteSpan(pe.active());return pe.with(n,()=>t(ne()))}function yL(){return O()?.tracer||he.getTracer("@sentry/opentelemetry",q)}function SL(e){let{startTime:t,attributes:n,kind:r,op:o,links:i}=e,s=typeof t=="number"?EL(t):t;return{attributes:o?{[H]:o,...n}:n,kind:r,links:i,startTime:s}}function EL(e){return e<9999999999?e*1e3:e}function CS(e){let t=e.end.bind(e);e.end=n=>t(typeof n=="number"?EL(n):n)}function TL(e,t){let n=TX(e),r=he.getSpan(n);if(!r||!t)return n;let o=he.deleteSpan(n),{spanId:i,traceId:s}=r.spanContext(),c=qa(r.spanContext()),a=Re(r),l=nt(a),p=pL({dsc:l,sampled:c}),u={traceId:s,spanId:i,isRemote:!0,traceFlags:c?vr.SAMPLED:vr.NONE,traceState:p};return he.setSpanContext(o,u)}function TX(e){if(e){let t=Ka(e);if(t)return t}return pe.active()}function IL(e,t){return hX(pe.active(),e,t)}function IX(e){let t=yt(),n=Xt(),r={traceId:t,spanId:n,isRemote:!0,traceFlags:vr.NONE},o=he.setSpanContext(pe.active(),r);return pe.with(o,()=>(ne().setPropagationContext({traceId:t,sampleRand:ct()}),e()))}function VS(e,t){let n=Ka(t),r=n&&he.getSpan(n),o=r?Lr(r):Bi(t);return[r?nt(r):ar(e,t),o]}function AL(e){return e!==void 0?t=>WS(e,t):t=>t()}function NL(e){let t=ks(pe.active());return pe.with(t,e)}function AX(e){let t=e?Ka(e):pe.active();return t?Ls(t):!1}function YS(e){e.on("preprocessEvent",t=>{let n=HS();if(!n||t.type==="transaction")return;t.contexts={trace:Lr(n),...t.contexts};let r=Re(n);return t.sdkProcessingMetadata={dynamicSamplingContext:nt(r),...t.sdkProcessingMetadata},t})}function vL(e,t){let n=he.getSpan(e),r;if(n?.spanContext().traceState?.get(gm)==="1"){let h=he.deleteSpan(e),b=he.getSpan(t);r=b?he.setSpan(h,b):h}else r=e;let o=ds(r),i=o?.scope||ne(),s=o?.isolationScope||J(),c=r.getValue(vS)===!0,a=r.getValue(RS),l=r.getValue(um),p=a||i.clone(),u=l||(c?s.clone():s),_=aL(r,{scope:p,isolationScope:u}).deleteValue(vS).deleteValue(RS).deleteValue(um);return dX(p,_),_}function NX(e){let t=new Map;for(let n of e)vX(t,n);return Array.from(t,function([n,r]){return r})}function RL(e){return e.attributes[GS]===!0?void 0:US(e)}function vX(e,t){let n=t.spanContext().spanId,r=RL(t);if(!r){OS(e,{id:n,span:t,children:[]});return}let o=RX(e,r),i=OS(e,{id:n,span:t,parentNode:o,children:[]});o.children.push(i)}function RX(e,t){let n=e.get(t);return n||OS(e,{id:t,children:[]})}function OS(e,t){let n=e.get(t.id);return n?.span?n:n&&!n.span?(n.span=t.span,n.parentNode=t.parentNode,n):(e.set(t.id,t),t)}var CL={1:"cancelled",2:"unknown_error",3:"invalid_argument",4:"deadline_exceeded",5:"not_found",6:"already_exists",7:"permission_denied",8:"resource_exhausted",9:"failed_precondition",10:"aborted",11:"out_of_range",12:"unimplemented",13:"internal_error",14:"unavailable",15:"data_loss",16:"unauthenticated"},OL=e=>Object.values(CL).includes(e);function xL(e){let t=mm(e)?e.attributes:{},n=tL(e)?e.status:void 0;if(n){if(n.code===Dn.OK)return{code:1};if(n.code===Dn.ERROR){if(typeof n.message>"u"){let o=xS(t);if(o)return o}return n.message&&OL(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=xS(t);return r||(n?.code===Dn.UNSET?{code:1}:{code:2,message:"unknown_error"})}function xS(e){let t=e[yn]||e[To],n=e[y0],r=typeof t=="number"?t:typeof t=="string"?parseInt(t):void 0;if(typeof r=="number")return qt(r);if(typeof n=="string")return{code:2,message:CL[n]||"unknown_error"}}var Qk=1e3,CX=300,OX=1e4,PS=class{constructor(t){this._finishedSpanBucketSize=t?.timeout||CX,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(tt()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Yt(OX),this._debouncedFlush=Xc(this.flush.bind(this),1,{maxWait:100})}export(t){let n=Math.floor(tt()/1e3);if(this._lastCleanupTimestampInS!==n){let s=0;this._finishedSpanBuckets.forEach((c,a)=>{c&&c.timestampInS<=n-this._finishedSpanBucketSize&&(s+=c.spans.size,this._finishedSpanBuckets[a]=void 0)}),s>0&&ui&&g.log(`SpanExporter dropped ${s} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(t),this._spansToBucketEntry.set(t,o);let i=RL(t);(!i||this._sentSpans.get(i))&&this._debouncedFlush()}flush(){let t=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]),n=this._maybeSend(t),r=n.size,o=t.length-r;ui&&g.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);for(let i of n){this._sentSpans.set(i.spanContext().spanId,1);let s=this._spansToBucketEntry.get(i);s&&s.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(t){let n=NX(t),r=new Set,o=this._getCompletedRootNodes(n);for(let i of o){let s=i.span;r.add(s);let c=PX(s);if(i.parentNode&&this._sentSpans.get(i.parentNode.id)){let u=c.contexts?.trace?.data;u&&(u["sentry.parent_span_already_sent"]=!0)}let a=c.spans||[],l=!1;for(let u of i.children)kS(u,a,r)&&(l=!0);c.spans=a.length>Qk?a.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,Qk):a,l&&(c.sdkProcessingMetadata={...c.sdkProcessingMetadata,hasGenAiSpans:!0});let p=Yi(s.events);p&&(c.measurements=p),zc(c)}return r}_nodeIsCompletedRootNodeOrHasSentParent(t){return!!t.span&&(!t.parentNode||!!this._sentSpans.get(t.parentNode.id))}_getCompletedRootNodes(t){return t.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function xX(e){let t=e.attributes,n=t[S],r=t[H],o=t[ve];return{origin:n,op:r,source:o}}function PX(e){let{op:t,description:n,data:r,origin:o="manual",source:i}=PL(e),s=Qt(e),c=e.attributes[Wn],a={[ve]:i,[Wn]:c,[H]:t,[S]:o,...r,...kL(e.attributes)},{links:l}=e,{traceId:p,spanId:u}=e.spanContext(),d=US(e),m=xL(e),_={parent_span_id:d,span_id:u,trace_id:p,data:a,origin:o,op:t,status:Wi(m),links:Fi(l)},h=a[yn],b=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:_,otel:{resource:e.resource.attributes},...b},spans:[],start_timestamp:Jt(e.startTime),timestamp:Jt(e.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:s.scope,capturedSpanIsolationScope:s.isolationScope,sampleRate:c,dynamicSamplingContext:nt(e)},...i&&{transaction_info:{source:i}}}}function kS(e,t,n){let r=e.span;if(r&&n.add(r),!r){let v=!1;return e.children.forEach(P=>{kS(P,t,n)&&(v=!0)}),v}let i=r.spanContext().spanId,s=r.spanContext().traceId,c=US(r),{attributes:a,startTime:l,endTime:p,links:u}=r,{op:d,description:m,data:_,origin:h="manual"}=PL(r),b={[S]:h,[H]:d,...kL(a),..._},N=xL(r),L={span_id:i,trace_id:s,data:b,description:m,parent_span_id:c,start_timestamp:Jt(l),timestamp:Jt(p)||void 0,status:Wi(N),op:d,origin:h,measurements:Yi(r.events),links:Fi(u)};t.push(L);let R=!!d?.startsWith("gen_ai.");return e.children.forEach(v=>{kS(v,t,n)&&(R=!0)}),R}function PL(e){let{op:t,source:n,origin:r}=xX(e),{op:o,description:i,source:s,data:c}=lL(e),a=t||o,l=n||s,p={...c,...kX(e)};return{op:a,description:i,source:l,origin:r,data:p}}function kL(e){let t={...e};return delete t[Wn],delete t[GS],delete t[hn],t}function kX(e){let t=e.attributes,n={};e.kind!==vt.INTERNAL&&(n["otel.kind"]=vt[e.kind]);let r=t[To];r&&(n[yn]=r);let o=nL(e);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function hm(e,t){let n=e.attributes??{},r=t?.spanKind??D.INTERNAL,{op:o,description:i,source:s,data:c}=Ql(e.name,n,r);e.name=i,Dt(e,{[H]:o,[ve]:s,[I0]:"manual",...c}),r!==D.INTERNAL&&Dt(e,{"otel.kind":Ib(r)})}var Jl=class{constructor(t){this._unsubscribePreprocessSpan=void 0,ms("SentrySpanProcessor"),this._exporter=new PS(t),this._client=t?.client??O(),this._client&&rt(this._client)&&(this._unsubscribePreprocessSpan=this._client.on("preprocessSpan",hm))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(t,n){let r=he.getSpan(n),o=ds(n);r&&!r.spanContext().isRemote&&_o(r,t),r?.spanContext().isRemote&&t.setAttribute(GS,!0),n===Jp&&(o={scope:Hs(),isolationScope:Rt()}),o&&Pr(t,o.scope,o.isolationScope),Vc(t),this._client?.emit("spanStart",t)}onEnd(t){Yc(t),this._client?.emit("spanEnd",t),this._client&&rt(this._client)?this._client.emit("afterSpanEnd",t):this._exporter.export(t)}},$l=class{constructor(t){this._client=t,this._isSpanStreaming=rt(t),ms("SentrySampler")}shouldSample(t,n,r,o,i,s){let c=this._client.getOptions(),{ignoreSpans:a}=c,l=wX(t),p=l?.spanContext();if(!Ue(c))return xo({decision:void 0,context:t,spanAttributes:i});let u=i[Br]||i[Hr];if(o===vt.CLIENT&&u&&(!l||p?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent("no_parent_span","span"),xo({decision:void 0,context:t,spanAttributes:i});let d=l?LX(l,n,r):void 0;if(!(!l||p?.isRemote)){if(this._isSpanStreaming){if(d&&a?.length){let{description:ce,op:ge}=Ql(r,i,o);if(sr({description:ce,op:i[H]??ge,attributes:i},a))return this._client.recordDroppedEvent("ignored","span"),xo({decision:Rr.NOT_RECORD,context:t,spanAttributes:i,ignoredChildSpan:!0})}if(!d){let ce=p?.traceState?.get(iL)==="1";this._client.recordDroppedEvent(ce?"ignored":"sample_rate","span")}}return xo({decision:d?Rr.RECORD_AND_SAMPLED:Rr.NOT_RECORD,context:t,spanAttributes:i})}let{description:_,data:h,op:b}=Ql(r,i,o),N={...h,...i};if(b&&(N[H]=b),this._isSpanStreaming&&a?.length&&sr({description:_,op:N[H]??b,attributes:N},a))return this._client.recordDroppedEvent("ignored","span"),xo({decision:Rr.NOT_RECORD,context:t,spanAttributes:i,ignoredSegmentSpan:!0});let L={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:N,spanName:_,parentSampled:d,parentContext:p},L),!L.decision)return xo({decision:void 0,context:t,spanAttributes:i});let{isolationScope:R}=ds(t)??{},v=p?.traceState?p.traceState.get(fm):void 0,P=v?ir(v):void 0,G=An(P?.sample_rand)??ct(),[I,B,k]=Zc(c,{name:_,attributes:N,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:An(P?.sample_rate)},G),U=`${u}`.toUpperCase();return U==="OPTIONS"||U==="HEAD"?(ui&&g.log(`[Tracing] Not sampling span because HTTP method is '${U}' for ${r}`),xo({decision:Rr.NOT_RECORD,context:t,spanAttributes:i,sampleRand:G,downstreamTraceSampleRate:0})):(!I&&d===void 0&&(ui&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate",this._isSpanStreaming?"span":"transaction")),{...xo({decision:I?Rr.RECORD_AND_SAMPLED:Rr.NOT_RECORD,context:t,spanAttributes:i,sampleRand:G,downstreamTraceSampleRate:k?B:void 0}),attributes:{[Wn]:k?B:void 0}})}toString(){return"SentrySampler"}};function LX(e,t,n){let r=e.spanContext();if(b_(r)&&r.traceId===t){if(r.isRemote){let i=qa(e.spanContext());return ui&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${i}`),i}let o=qa(r);return ui&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function xo({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o,ignoredChildSpan:i,ignoredSegmentSpan:s}){let c=MX(t,n);return o!==void 0&&(c=c.set(uX,`${o}`)),r!==void 0&&(c=c.set(pX,`${r}`)),i&&(c=c.set(gm,"1")),s&&(c=c.set(iL,"1")),e==null?{decision:Rr.NOT_RECORD,traceState:c}:e===Rr.NOT_RECORD?{decision:e,traceState:c.set(DS,"1")}:{decision:e,traceState:c}}function MX(e,t){let o=he.getSpan(e)?.spanContext()?.traceState||new dm,i=t[Io]||t[pt];return i&&typeof i=="string"&&(o=o.set(oL,i)),o}function wX(e){let t=he.getSpan(e);return t&&b_(t.spanContext())?t:void 0}function bm(e,t={}){let n=ie(e),r=n.data,o=e.kind??vt.INTERNAL,i=js(e),s=r[hn]!==void 0,c=i&&!s&&!nh(e),a=c&&r[ve]==="custom"?{...r,[ve]:void 0}:r,l=Ql(n.description||"<unknown>",a,o);if(o!==vt.INTERNAL&&r["otel.kind"]===void 0&&e.setAttribute("otel.kind",vt[o]),l.op&&r[H]===void 0&&e.setAttribute(H,l.op),l.source!==void 0&&l.source!=="custom"&&(t.finalizeStatus||l.source!=="url")&&(n.parent_span_id===void 0||o===vt.SERVER)&&(r[ve]===void 0||c)&&e.setAttribute(ve,l.source),l.data&&Object.entries(l.data).forEach(([u,d])=>{d!==void 0&&r[u]===void 0&&e.setAttribute(u,d)}),t.finalizeStatus){DX(e,r);let u=O();UX(e,r,n.status,!!u&&rt(u))}i&&l.description!==n.description&&(r[ve]!=="custom"||c)&&e.updateName(l.description)}function GX(e,t){we(e,"kind",t??vt.INTERNAL)}function UX(e,t,n,r){if(n===void 0){e.setStatus(xS(t)||{code:1});return}!r&&n!=="ok"&&!OL(n)&&e.setStatus({code:2,message:"internal_error"})}function DX(e,t){let n=t[To];t[yn]===void 0&&n!==void 0&&(e.setAttribute(yn,n),t[yn]=n)}var LS=class{startSpan(t,n={},r){let o=r||pe.active(),i=n.root?void 0:he.getSpan(o);if(Ls(o))return this._createNonRecordingSpan(i);let s=this._startSentrySpan(t,n,i,r!==void 0);return rh(s),GX(s,n.kind),n.attributes?.[ve]===void 0&&eh(s),bm(s),s}startActiveSpan(t,n,r,o){let i=typeof n=="function"?{}:n,s=typeof r=="function"||r===void 0?pe.active():r,c=typeof n=="function"?n:typeof r=="function"?r:o,a=this.startSpan(t,i,s),l=Qt(a).isolationScope,p=u=>l?u.setValue(um,l):u;return Gr(a)&&he.getSpan(s)?pe.with(p(s),()=>c(a)):pe.with(p(he.setSpan(s,a)),()=>(Fn(ne(),a),c(a)))}_startSentrySpan(t,n,r,o){let i={name:t,attributes:n.attributes,links:n.links,startTime:n.startTime};return n.root?Rn(()=>$s({...i,parentSpan:null})):r?.spanContext().isRemote?this._startRootSpanWithRemoteParent(i,r):r?$s({...i,parentSpan:r}):Rn(()=>$s({...i,parentSpan:o?null:void 0}))}_startRootSpanWithRemoteParent(t,n){let{spanId:r,traceId:o,traceState:i}=n.spanContext(),s=nt(n),c=typeof s.sample_rand=="string"?Number(s.sample_rand):void 0,a=!!i?.get(fm);return Be(l=>(l.setPropagationContext({traceId:o,parentSpanId:r,sampled:qa(n.spanContext()),dsc:a?s:void 0,sampleRand:typeof c=="number"&&!Number.isNaN(c)?c:ct()}),Fn(l,void 0),$s({...t,parentSpan:null})))}_createNonRecordingSpan(t){let n=new Mr({traceId:t?.spanContext().traceId});return t&&_o(t,n),Pr(n,ne(),J()),n}},zl=class{constructor(t={}){this._tracers=new Map,this.resource=t.resource}getTracer(t,n,r){let o=JSON.stringify([t,n,r]),i=this._tracers.get(o);if(i)return i;let s=new LS;return this._tracers.set(o,s),s}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},Jk="telemetry.sdk.language",$k="telemetry.sdk.name",zk="telemetry.sdk.version",BX="service.namespace",MS=class e{constructor(t){this._attributes=t}get attributes(){return this._attributes}merge(t){return t?new e({...this._attributes,...t.attributes}):this}getRawAttributes(){return Object.entries(this._attributes)}};function HX(e){if(!e)return{};let t={};for(let n of e.split(",")){let r=n.indexOf("=");if(r===-1)continue;let o=n.substring(0,r).trim(),i=n.substring(r+1).trim();if(o)try{t[o]=decodeURIComponent(i)}catch{t[o]=i}}return t}function ym(e){let t=typeof process<"u"?process.env:{},n=t.OTEL_SERVICE_NAME,r=HX(t.OTEL_RESOURCE_ATTRIBUTES);return new MS({[BX]:"sentry",[Uh]:e,...r,...n?{[Uh]:n}:{},[O0]:q,[Jk]:zp[Jk],[$k]:zp[$k],[zk]:zp[zk]})}function FX({span:e,scope:t,client:n,propagateTraceparent:r}={}){let o=(t&&Ka(t))??pe.active();if(e){let{scope:p}=Qt(e);o=p&&Ka(p)||he.setSpan(pe.active(),e)}let{traceId:i,spanId:s,sampled:c,dynamicSamplingContext:a}=dL(o,{scope:t,client:n}),l={"sentry-trace":jo(i,s,c),baggage:Yo(a)};return r&&(l.traceparent=Zo(i,s,c)),l}function LL(e){function t(){let a=pe.active(),l=ds(a);return l||{scope:Hs(),isolationScope:Rt()}}function n(a){let l=pe.active();return pe.with(l,()=>a(s()))}function r(a,l){let p=Ka(a)||pe.active();return pe.with(p.setValue(RS,a),()=>l(a))}function o(a){let l=pe.active();return pe.with(l.setValue(vS,!0),()=>{let p=s();return Mc(p.getPropagationContext())||p.setPropagationContext({traceId:yt(),sampleRand:ct()}),a(c())})}function i(a,l){let p=pe.active();return pe.with(p.setValue(um,a),()=>l(c()))}function s(){return t().scope}function c(){return t().isolationScope}B_({withScope:n,withSetScope:r,withSetIsolationScope:i,withIsolationScope:o,getCurrentScope:s,getIsolationScope:c,startSpan:_L,startSpanManual:hL,startInactiveSpan:bL,getActiveSpan:HS,suppressTracing:NL,isTracingSuppressed:AX,getTraceData:FX,continueTrace:IL,startNewTrace:IX,withActiveSpan:WS,getTracingChannelBinding:e?.getTracingChannelBinding})}at();at();import{AsyncLocalStorage as ML}from"async_hooks";import{EventEmitter as WX}from"events";var VX=["addListener","on","once","prependListener","prependOnceListener"],Sm=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1,ms("SentryContextManager"),this._asyncLocalStorage=St(Je()).getTracingChannelBinding?.()?.asyncLocalStorage??new ML}active(){return this._asyncLocalStorage.getStore()??Jp}with(t,n,r,...o){let i=vL(t,this.active()),s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(i,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(t,n){return n instanceof WX?this._bindEventEmitter(t,n):typeof n=="function"?this._bindFunction(t,n):n}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:_m}}_bindFunction(t,n){let r=this.with.bind(this),o=function(...i){return r(t,()=>n.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(t,n){if(this._getPatchMap(n)!==void 0)return n;this._createPatchMap(n);for(let r of VX)n[r]!==void 0&&(n[r]=this._patchAddListener(n,n[r],t));return typeof n.removeListener=="function"&&(n.removeListener=this._patchRemoveListener(n,n.removeListener)),typeof n.off=="function"&&(n.off=this._patchRemoveListener(n,n.off)),typeof n.removeAllListeners=="function"&&(n.removeAllListeners=this._patchRemoveAllListeners(n,n.removeAllListeners)),n}_patchRemoveListener(t,n){let r=this;return function(o,i){let s=r._getPatchMap(t)?.[o];if(s===void 0)return n.call(this,o,i);let c=s.get(i);return n.call(this,o,c||i)}}_patchRemoveAllListeners(t,n){let r=this;return function(o){let i=r._getPatchMap(t);return i!==void 0&&(arguments.length===0?r._createPatchMap(t):o!==void 0&&i[o]!==void 0&&delete i[o]),n.apply(this,arguments)}}_patchAddListener(t,n,r){let o=this;return function(i,s){if(o._wrapped)return n.call(this,i,s);let c=o._getPatchMap(t);c===void 0&&(c=o._createPatchMap(t));let a=c[i];a===void 0&&(a=new WeakMap,c[i]=a);let l=o.bind(r,s);a.set(s,l),o._wrapped=!0;try{return n.call(this,i,l)}finally{o._wrapped=!1}}}_createPatchMap(t){let n=Object.create(null);return t[this._kOtListeners]=n,n}_getPatchMap(t){return t[this._kOtListeners]}};function jS(e){LL({getTracingChannelBinding:e?.skipOpenTelemetrySetup?jX():YX()})}function YX(){let e=new ML;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:wL})}function jX(){return()=>{try{let t=pe._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return t?{asyncLocalStorage:t,getStoreWithActiveSpan:wL}:void 0}catch{return}}}function wL(e){let t=pe.active();return Gr(e)&&Re(e)!==e||e.spanContext().traceState?.get(gm)==="1"?t:he.setSpan(t,e)}var ep=Sm;at();function ZS(){on.disable(),on.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},ov.DEBUG)}var tp={};function de(e,t,n){return n?XX(e,t,n):ZX(e,t)}function ZX(e,t){return Object.assign(n=>{let r=tp[e];if(r)return n&&r.setConfig(n),r;let o=t(n);return tp[e]=o,Da({instrumentations:[o]}),o},{id:e})}function XX(e,t,n){return Object.assign(r=>{let o=n(r),i=tp[e];if(i)return i.setConfig(o),i;let s=new t(o);return tp[e]=s,Da({instrumentations:[s]}),s},{id:e})}import*as XS from"diagnostics_channel";var KX="ChildProcess",Em=(e={})=>({name:KX,setup(){XS.channel("child_process").subscribe(t=>{V(t)&&"process"in t&&qX(t.process,e)}),XS.channel("worker_threads").subscribe(t=>{V(t)&&"worker"in t&&QX(t.worker,e)})}});function qX(e,t){let n=!1,r;e.on("spawn",()=>{if(e.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(r.spawnargs=e.spawnargs)}).on("exit",o=>{n||(n=!0,o!==null&&o!==0&&an({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,an({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function QX(e,t){let n;e.on("online",()=>{n=e.threadId}).on("error",r=>{t.captureWorkerErrors!==!1?me(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):an({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as JX}from"child_process";import{readFile as $X,readdir as zX}from"fs";import*as At from"os";import{join as e9}from"path";import{promisify as DL}from"util";var t9=DL($X),n9=DL(zX),r9="Context",o9=((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?l9():void 0,r=t.device?p9(t.device):void 0,o=t.culture?c9():void 0,i=t.cloudResource?_9():void 0,s=t.os?a9():void 0,c={"process.runtime.engine.name":"v8","process.runtime.engine.version":process.versions.v8,...GL({app:n,device:r,culture:o,cloud_resource:i})};s&&s.then(p=>Object.assign(c,GL({os:p}))).catch(()=>{});let a=(async()=>{let p={};return s&&(p.os=await s),n&&(p.app=n),r&&(p.device=r),o&&(p.culture=o),i&&(p.cloud_resource=i),p})();async function l(p){let u=i9(await a);return p.contexts={...p.contexts,app:{...u.app,...p.contexts?.app},os:{...u.os,...p.contexts?.os},device:{...u.device,...p.contexts?.device},culture:{...u.culture,...p.contexts?.culture},cloud_resource:{...u.cloud_resource,...p.contexts?.cloud_resource}},p}return{name:r9,processEvent(p){return l(p)},processSegmentSpan(p){Dt(p,c),Dt(p,s9(n,r))}}}),Tm=o9;function i9(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory=="function"){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=At.freemem()),e}function GL(e){let t={},{app:n,device:r,os:o,culture:i,cloud_resource:s}=e;if(n&&n.app_start_time&&(t["app.start_time"]=n.app_start_time),r&&(r.arch&&(t["device.archs"]=[r.arch]),r.boot_time&&(t["device.boot_time"]=r.boot_time),r.memory_size!=null&&(t["device.memory_size"]=r.memory_size),r.processor_count!=null&&(t["device.processor_count"]=r.processor_count),r.cpu_description&&(t["device.cpu_description"]=r.cpu_description),r.processor_frequency!=null&&(t["device.processor_frequency"]=r.processor_frequency)),o&&(o.name&&(t["os.name"]=o.name),o.version&&(t["os.version"]=o.version),o.kernel_version&&(t["os.kernel_version"]=o.kernel_version),o.build&&(t["os.build"]=o.build)),i&&(i.locale&&(t["culture.locale"]=i.locale),i.timezone&&(t["culture.timezone"]=i.timezone)),s)for(let[c,a]of Object.entries(s))a!=null&&(t[c]=a);return t}function s9(e,t){let n={};if(e&&(n["app.memory"]=process.memoryUsage().rss,typeof process.availableMemory=="function")){let r=process.availableMemory?.();r!=null&&(n["app.free_memory"]=r)}return t?.free_memory!=null&&(n["device.free_memory"]=At.freemem()),n}async function a9(){let e=At.platform();switch(e){case"darwin":return f9();case"linux":return g9();default:return{name:u9[e]||e,version:At.release()}}}function c9(){try{if(typeof process.versions.icu!="string")return;let e=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(e)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function l9(){let e=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function p9(e){let t={},n;try{n=At.uptime()}catch{}if(typeof n=="number"&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=At.arch(),(e===!0||e.memory)&&(t.memory_size=At.totalmem(),t.free_memory=At.freemem()),e===!0||e.cpu){let r=At.cpus(),o=r?.[0];o&&(t.processor_count=r.length,t.cpu_description=o.model,t.processor_frequency=o.speed)}return t}var u9={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},d9=[{name:"fedora-release",distros:["Fedora"]},{name:"redhat-release",distros:["Red Hat Linux","Centos"]},{name:"redhat_version",distros:["Red Hat Linux"]},{name:"SuSE-release",distros:["SUSE Linux"]},{name:"lsb-release",distros:["Ubuntu Linux","Arch Linux"]},{name:"debian_version",distros:["Debian"]},{name:"debian_release",distros:["Debian"]},{name:"arch-release",distros:["Arch Linux"]},{name:"gentoo-release",distros:["Gentoo Linux"]},{name:"novell-release",distros:["SUSE Linux"]},{name:"alpine-release",distros:["Alpine Linux"]}],m9={alpine:e=>e,arch:e=>zr(/distrib_release=(.*)/,e),centos:e=>zr(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>zr(/release (..)/,e),mint:e=>zr(/distrib_release=(.*)/,e),red:e=>zr(/release ([^ ]+)/,e),suse:e=>zr(/VERSION = (.*)\n/,e),ubuntu:e=>zr(/distrib_release=(.*)/,e)};function zr(e,t){let n=e.exec(t);return n?n[1]:void 0}async function f9(){let e={kernel_version:At.release(),name:"Mac OS X",version:`10.${Number(At.release().split(".")[0])-4}`};try{let t=await new Promise((n,r)=>{JX("/usr/bin/sw_vers",(o,i)=>{if(o){r(o);return}n(i)})});e.name=zr(/^ProductName:\s+(.*)$/m,t),e.version=zr(/^ProductVersion:\s+(.*)$/m,t),e.build=zr(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function UL(e){return e.split(" ")[0].toLowerCase()}async function g9(){let e={kernel_version:At.release(),name:"Linux"};try{let t=await n9("/etc"),n=d9.find(c=>t.includes(c.name));if(!n)return e;let r=e9("/etc",n.name),o=(await t9(r,{encoding:"utf-8"})).toLowerCase(),{distros:i}=n;e.name=i.find(c=>o.indexOf(UL(c))>=0)||i[0];let s=UL(e.name);e.version=m9[s]?.(o)}catch{}return e}function _9(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as h9}from"fs";import{createInterface as b9}from"readline";var KS=new Yt(10),FL=new Yt(20),y9=7,S9="ContextLines",E9=1e3,T9=1e4;function I9(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function A9(e){return!!(e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:"))}function N9(e){return e.lineno!==void 0&&e.lineno>T9||e.colno!==void 0&&e.colno>E9}function v9(e,t){let n=KS.get(e);if(n===void 0)return!1;for(let r=t[0];r<=t[1];r++)if(n[r]===void 0)return!1;return!0}function R9(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!="number")return[];let o=HL(r,t),i=[];for(;;){if(n===e.length-1){i.push(o);break}let s=e[n+1];if(typeof s!="number")break;s<=o[1]?o[1]=s+t:(i.push(o),o=HL(s,t)),n++}return i}function C9(e,t,n){return new Promise((r,o)=>{let i=h9(e),s=b9({input:i});function c(){i.destroy(),r()}let a=0,l=0,p=t[l];if(p===void 0){c();return}let u=p[0],d=p[1];function m(_){FL.set(e,1),We&&g.error(`Failed to read file: ${e}. Error: ${_}`),s.close(),s.removeAllListeners(),c()}i.on("error",m),s.on("error",m),s.on("close",c),s.on("line",_=>{if(a++,!(a<u)&&(n[a]=L_(_,0),a>=d)){if(l===t.length-1){s.close(),s.removeAllListeners();return}l++;let h=t[l];if(h===void 0){s.close(),s.removeAllListeners();return}u=h[0],d=h[1]}})})}async function O9(e,t){let n={};if(t>0&&e.exception?.values){for(let i of e.exception.values)if(i.stacktrace?.frames?.length)for(let s=i.stacktrace.frames.length-1;s>=0;s--){let c=i.stacktrace.frames[s],a=c?.filename;if(!c||typeof a!="string"||typeof c.lineno!="number"||A9(a)||N9(c))continue;n[a]||(n[a]=[]),n[a].push(c.lineno)}}let r=Object.keys(n);if(r.length==0)return e;let o=[];for(let i of r){if(FL.get(i))continue;let s=n[i];if(!s)continue;s.sort((l,p)=>l-p);let c=R9(s,t);if(c.every(l=>v9(i,l)))continue;let a=I9(KS,i,{});o.push(C9(i,c,a))}if(await Promise.all(o).catch(()=>{We&&g.log("Failed to read one or more source files and resolve context lines")}),t>0&&e.exception?.values)for(let i of e.exception.values)i.stacktrace?.frames&&i.stacktrace.frames.length>0&&x9(i.stacktrace.frames,t,KS);return e}function x9(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;P9(r.lineno,r,t,o)}}function BL(e){delete e.pre_context,delete e.context_line,delete e.post_context}function P9(e,t,n,r){if(t.lineno===void 0||r===void 0){We&&g.error("Cannot resolve context for frame with no lineno or file contents");return}t.pre_context=[];for(let i=WL(e,n);i<e;i++){let s=r[i];if(s===void 0){BL(t),We&&g.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(s)}if(r[e]===void 0){BL(t),We&&g.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let o=VL(e,n);t.post_context=[];for(let i=e+1;i<=o;i++){let s=r[i];if(s===void 0)break;t.post_context.push(s)}}function WL(e,t){return Math.max(1,e-t)}function VL(e,t){return e+t}function HL(e,t){return[WL(e,t),VL(e,t)]}var k9=((e={})=>({name:S9,processEvent(t,n,r){let o=e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??y9;return O9(t,o)}})),Im=k9;import{Worker as L9}from"worker_threads";var Am;async function Ja(){if(Am===void 0)try{Am=!!(await import("inspector")).url()}catch{Am=!1}return Am}function Nm(e,t){return ma(e,t)}var np="__SENTRY_ERROR_LOCAL_VARIABLES__";function jL(e,t,n){let r=0,o=5,i=0;return setInterval(()=>{i===0?r>e&&(o*=2,n(o),o>86400&&(o=86400),i=o):(i-=1,i===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function YL(e){return e!==void 0&&(e.length===0||e==="?"||e==="<anonymous>")}function vm(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||YL(e)&&YL(t)}var M9="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc1LjAgKDlmZmI1OGMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZv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WQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function ZL(...e){g.log("[LocalVariables]",...e)}var XL=((e={})=>{function t(i,s,c){if(c===!1)return;let a=(i.stacktrace?.frames||[]).filter(l=>l.function!=="new Promise");for(let l=0;l<a.length;l++){let p=a.length-l-1,u=s[l],d=a[p];if(!d||!u)break;u.vars===void 0||d.in_app===!1&&e.includeOutOfAppFrames!==!0||!vm(d.function,u.function)||(d.vars=Nm(u.vars,c))}}function n(i,s){if(s.originalException&&typeof s.originalException=="object"&&np in s.originalException&&Array.isArray(s.originalException[np])){let c=O()?.getDataCollectionOptions().stackFrameVariables??!0;for(let a of i.exception?.values||[])t(a,s.originalException[np],c);s.originalException[np]=void 0}return i}async function r(){let i=await import("inspector");i.url()||i.open(0)}function o(i){let s=new L9(new URL(`data:application/javascript;base64,${M9}`),{workerData:i,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{s.terminate()}),s.once("error",c=>{ZL("Worker error",c)}),s.once("exit",c=>{ZL("Worker exit",c)}),s.unref()}return{name:"LocalVariablesAsync",async setup(i){if(!i.getOptions().includeLocalVariables)return;if(await Ja()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let c={...e,debug:g.isEnabled()};r().then(()=>{try{o(c)}catch(a){g.error("Failed to start worker",a)}},a=>{g.error("Failed to start inspector",a)})},processEvent(i,s){return n(i,s)}}});function KL(e){if(e!==void 0)return e.slice(-10).reduce((t,n)=>`${t},${n.function},${n.lineno},${n.colno}`,"")}function w9(e,t){if(t!==void 0)return KL(e(t,1))}function qL(e){let t=[],n=!1;function r(s){t=[],!n&&(n=!0,e(s))}t.push(r);function o(s){t.push(s)}function i(s){let c=t.pop()||r;try{c(s)}catch{r(s)}}return{add:o,next:i}}var qS=class e{constructor(t){this._session=t}static async create(t){if(t)return t;let n=await import("inspector");return new e(new n.Session)}configureAndConnect(t,n){this._session.connect(),this._session.on("Debugger.paused",r=>{t(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(t){this._session.post("Debugger.setPauseOnExceptions",{state:t?"all":"uncaught"})}getLocalVariables(t,n){this._getProperties(t,r=>{let{add:o,next:i}=qL(n);for(let s of r)if(s.value?.objectId&&s.value.className==="Array"){let c=s.value.objectId;o(a=>this._unrollArray(c,s.name,a,i))}else if(s.value?.objectId&&s.value.className==="Object"){let c=s.value.objectId;o(a=>this._unrollObject(c,s.name,a,i))}else s.value&&o(c=>this._unrollOther(s,c,i));i({})})}_getProperties(t,n){this._session.post("Runtime.getProperties",{objectId:t,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(t,n,r,o){this._getProperties(t,i=>{r[n]=i.filter(s=>s.name!=="length"&&!isNaN(parseInt(s.name,10))).sort((s,c)=>parseInt(s.name,10)-parseInt(c.name,10)).map(s=>s.value?.value),o(r)})}_unrollObject(t,n,r,o){this._getProperties(t,i=>{r[n]=i.map(s=>[s.name,s.value?.value]).reduce((s,[c,a])=>(s[c]=a,s),{}),o(r)})}_unrollOther(t,n,r){t.value&&("value"in t.value?t.value.value===void 0||t.value.value===null?n[t.name]=`<${t.value.value}>`:n[t.name]=t.value.value:"description"in t.value&&t.value.type!=="function"?n[t.name]=`<${t.value.description}>`:t.value.type==="undefined"&&(n[t.name]="<undefined>")),r(n)}},G9="LocalVariables",U9=((e={},t)=>{let n=new Yt(20),r,o=!1;function i(l,p){let u=KL(l.stacktrace?.frames);if(u===void 0)return;let d=n.remove(u);if(d===void 0||p===!1)return;let m=(l.stacktrace?.frames||[]).filter(_=>_.function!=="new Promise");for(let _=0;_<m.length;_++){let h=m.length-_-1,b=d[_],N=m[h];if(!N||!b)break;b.vars===void 0||N.in_app===!1&&e.includeOutOfAppFrames!==!0||!vm(N.function,b.function)||(N.vars=Nm(b.vars,p))}}function s(l){for(let p of l.exception?.values||[])i(p,O()?.getDataCollectionOptions().stackFrameVariables??!0);return l}let c;async function a(){let p=O()?.getOptions();if(!p?.includeLocalVariables)return;if(Xa<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Ja()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let d=await qS.create(t),m=(h,{params:{reason:b,data:N,callFrames:L}},R)=>{if(b!=="exception"&&b!=="promiseRejection"){R();return}r?.();let v=w9(h,N.description);if(v==null){R();return}let{add:P,next:G}=qL(I=>{n.set(v,I),R()});for(let I=0;I<Math.min(L.length,5);I++){let{scopeChain:B,functionName:k,this:U}=L[I],ce=B.find(Ne=>Ne.type==="local"),ge=U.className==="global"||!U.className?k:`${U.className}.${k}`;if(ce?.object.objectId===void 0)P(Ne=>{Ne[I]={function:ge},G(Ne)});else{let Ne=ce.object.objectId;P(Te=>d.getLocalVariables(Ne,Oe=>{Te[I]={function:ge,vars:Oe},G(Te)}))}}G([])},_=e.captureAllExceptions!==!1;if(d.configureAndConnect((h,b)=>m(p.stackParser,h,b),_),_){let h=e.maxExceptionsPerSecond||50;r=jL(h,()=>{g.log("Local variables rate-limit lifted."),d.setPauseOnExceptions(!0)},b=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${b} seconds.`),d.setPauseOnExceptions(!1)})}o=!0}catch(d){g.log("The `LocalVariables` integration failed to start.",d)}}return{name:G9,setupOnce(){c=a()},async processEvent(l){return await c,o?s(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}}),QL=U9;var Rm=(e={})=>nn.major<19?QL(e):XL(e);import{readFileSync as D9}from"fs";import{join as B9}from"path";var QS,H9="Modules";function F9(){return typeof __SENTRY_SERVER_MODULES__<"u"?__SENTRY_SERVER_MODULES__:te.__SENTRY_SERVER_MODULES__??{}}var W9=(()=>({name:H9,processEvent(e){return e.modules={...e.modules,...JL()},e},getModules:JL})),Cm=W9;function V9(){return{...F9(),...j9()}}function JL(){return QS||(QS=V9()),QS}function Y9(){try{let e=B9(process.cwd(),"package.json");return JSON.parse(D9(e,"utf8"))}catch{return{}}}function j9(){let e=Y9();return{...e.dependencies,...e.devDependencies}}import{isMainThread as X9}from"worker_threads";var Z9=2e3,$L=!1;function rp(e){if($L)return;$L=!0,Me(()=>{console.error(e)});let t=O();if(t===void 0){We&&g.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let n=t.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:Z9;t.close(r).then(o=>{o||We&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{We&&g.error(o),global.process.exit(1)})}var K9="OnUncaughtException",Om=(e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:K9,setup(n){X9&&global.process.on("uncaughtException",q9(n,t))}}};function q9(e,t){let r=!1,o=!1,i=!1,s,c=e.getOptions();return Object.assign(a=>{let l=rp;t.onFatalError?l=t.onFatalError:c.onFatalError&&(l=c.onFatalError);let u=global.process.listeners("uncaughtException").filter(m=>m.name!=="domainUncaughtExceptionClear"&&m._errorHandler!==!0).length===0,d=t.exitEvenIfOtherHandlersAreRegistered||u;r?d&&(i?(We&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),rp(a)):o||(o=!0,setTimeout(()=>{i||(i=!0,l(s,a))},2e3))):(s=a,r=!0,O()===e&&me(a,{originalException:a,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!i&&d&&(i=!0,l(a)))},{_errorHandler:!0})}var Q9="OnUnhandledRejection",J9=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],$9=((e={})=>{let t={mode:e.mode??"warn",ignore:[...J9,...e.ignore??[]]};return{name:Q9,setup(n){global.process.on("unhandledRejection",nK(n,t))}}}),xm=$9;function z9(e){if(!V(e))return{name:"",message:String(e??"")};let t=e,n=typeof t.name=="string"?t.name:"",r=typeof t.message=="string"?t.message:String(e);return{name:n,message:r}}function eK(e,t){let n=e.name===void 0||Or(t.name,e.name,!0),r=e.message===void 0||Or(t.message,e.message);return n&&r}function tK(e,t){let n=z9(t);return e.some(r=>eK(r,n))}function nK(e,t){return function(r,o){if(O()!==e||tK(t.ignore??[],r))return;let i=t.mode==="strict"?"fatal":"error",s=V(r)?r._sentry_active_span:void 0;(s?a=>se(s,a):a=>a())(()=>{me(r,{originalException:r,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),rK(r,t.mode)}}function rK(e,t){let n="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";t==="warn"?Me(()=>{console.warn(n),console.error(V(e)&&"stack"in e?e.stack:e)}):t==="strict"&&(Me(()=>{console.warn(n)}),rp(e))}var oK="ProcessSession",Pm=()=>({name:oK,setupOnce(){el(),process.on("beforeExit",()=>{J().getSession()?.status==="ok"&&qi()})}});import*as zL from"http";var JS="Spotlight",iK=((e={})=>{let t={sidecarUrl:e.sidecarUrl||"http://localhost:8969/stream"};return{name:JS,setup(n){try{g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}sK(n,t)}}}),km=iK;function sK(e,t){let n=aK(t.sidecarUrl);if(!n)return;let r=0;e.on("beforeEnvelope",o=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let i=Wc(o);Vn(()=>{let s=zL.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},c=>{c.statusCode&&c.statusCode>=200&&c.statusCode<400&&(r=0),c.on("data",()=>{}),c.on("end",()=>{}),c.setEncoding("utf8")});s.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),s.write(i),s.end()})})}function aK(e){try{return new URL(`${e}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var Lm=(e={})=>({name:"Console",setup(t){process.env.LAMBDA_TASK_ROOT&&kc("console",cK),Db({...e,filter:[...e.filter||[],"[DEP0205] DeprecationWarning"]}).setup?.(t)}});function cK(){let e=te?.console;e&&tr.forEach(t=>{t in e&&lK(e,t)})}function lK(e,t){let n=e[t];er[t]=n;let r=n,o,i=!1,s=function(...a){if(i){n.apply(e,a);return}i=!0;try{Ms("console",{args:a,level:t}),r.apply(e,a)}finally{i=!1}};Mi(s,n);let c=n.bind(e);er[t]=c;try{let a=s;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return a},set(l){l===s?(o!==void 0&&(r=o,o=void 0),a=s):l===c?(o=r,a=c):typeof l=="function"&&!l.__sentry_original__?(r=l,a=s):a=l}})}catch{Mt(e,t,function(a){return er[t]=a,function(...l){Ms("console",{args:l,level:t}),er[t]?.apply(this,l)}})}}import*as $S from"util";var pK="NodeSystemError";function uK(e){return!(e instanceof Error)||!("errno"in e)||typeof e.errno!="number"||typeof $S.getSystemErrorMap!="function"?!1:$S.getSystemErrorMap().has(e.errno)}var Mm=(e={})=>({name:pK,processEvent:(t,n,r)=>{if(!uK(n.originalException))return t;let o=n.originalException,i={...o};!r.getDataCollectionOptions().userInfo&&e.includePaths!==!0&&(delete i.path,delete i.dest),t.contexts={...t.contexts,node_system_error:i};for(let s of t.exception?.values||[])s.value&&(o.path&&s.value.includes(o.path)&&(s.value=s.value.replace(`'${o.path}'`,"").trim()),o.dest&&s.value.includes(o.dest)&&(s.value=s.value.replace(`'${o.dest}'`,"").trim()));return t}});import*as mK from"http";import*as fK from"https";import{Readable as gK}from"stream";import{createGzip as _K}from"zlib";import*as Po from"net";import*as eE from"tls";import*as zS from"http";import"https";var e1,eo=Symbol("AgentBaseInternalState"),wm=class extends(e1=zS.Agent,e1){constructor(t){super(t),this[eo]={}}isSecureEndpoint(t){if(t){if(typeof t.secureEndpoint=="boolean")return t.secureEndpoint;if(typeof t.protocol=="string")return t.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
|
|
30
|
+
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(t,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(t,o)).then(i=>{if(i instanceof zS.Agent)return i.addRequest(t,o);this[eo].currentSocket=i,super.createSocket(t,n,r)},r)}createConnection(){let t=this[eo].currentSocket;if(this[eo].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[eo].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[eo]&&(this[eo].defaultPort=t)}get protocol(){return this[eo].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[eo]&&(this[eo].protocol=t)}};function Gm(...e){g.log("[https-proxy-agent:parse-proxy-response]",...e)}function t1(e){return new Promise((t,n)=>{let r=0,o=[];function i(){let p=e.read();p?l(p):e.once("readable",i)}function s(){e.removeListener("end",c),e.removeListener("error",a),e.removeListener("readable",i)}function c(){s(),Gm("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function a(p){s(),Gm("onerror %o",p),n(p)}function l(p){o.push(p),r+=p.length;let u=Buffer.concat(o,r),d=u.indexOf(`\r
|
|
31
|
+
\r
|
|
32
|
+
`);if(d===-1){Gm("have not received end of HTTP headers yet..."),i();return}let m=u.subarray(0,d).toString("ascii").split(`\r
|
|
33
|
+
`),_=m.shift();if(!_)return e.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=_.split(" "),b=+(h[1]||0),N=h.slice(2).join(" "),L={};for(let R of m){if(!R)continue;let v=R.indexOf(":");if(v===-1)return e.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${R}"`));let P=R.slice(0,v).toLowerCase(),G=R.slice(v+1).trimStart(),I=L[P];typeof I=="string"?L[P]=[I,G]:Array.isArray(I)?I.push(G):L[P]=G}Gm("got proxy server response: %o %o",_,L),s(),t({connect:{statusCode:b,statusText:N,headers:L},buffered:u})}e.on("error",a),e.on("end",c),i()})}function op(...e){g.log("[https-proxy-agent]",...e)}var ip=class extends wm{constructor(t,n){super(n),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=n?.headers??{},op("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?n1(n,"headers"):null,host:r,port:o}}async connect(t,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){op("Creating `tls.Socket`: %o",this.connectOpts);let d=this.connectOpts.servername||this.connectOpts.host;o=eE.connect({...this.connectOpts,servername:d&&Po.isIP(d)?void 0:d})}else op("Creating `net.Socket`: %o",this.connectOpts),o=Po.connect(this.connectOpts);let i=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=Po.isIPv6(n.host)?`[${n.host}]`:n.host,c=`CONNECT ${s}:${n.port} HTTP/1.1\r
|
|
34
|
+
`;if(r.username||r.password){let d=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;i["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}i.Host=`${s}:${n.port}`,i["Proxy-Connection"]||(i["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(i))c+=`${d}: ${i[d]}\r
|
|
35
|
+
`;let a=t1(o);o.write(`${c}\r
|
|
36
|
+
`);let{connect:l,buffered:p}=await a;if(t.emit("proxyConnect",l),this.emit("proxyConnect",l,t),l.statusCode===200){if(t.once("socket",dK),n.secureEndpoint){op("Upgrading socket connection to TLS");let d=n.servername||n.host;return eE.connect({...n1(n,"host","path","port"),socket:o,servername:Po.isIP(d)?void 0:d})}return o}o.destroy();let u=new Po.Socket({writable:!1});return u.readable=!0,t.once("socket",d=>{op("Replaying proxy buffer for failed request"),d.push(p),d.push(null)}),u}};ip.protocols=["http","https"];function dK(e){e.resume()}function n1(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var hK=1024*32;function bK(e){return new gK({read(){this.push(e),this.push(null)}})}function Um(e){let t;try{t=new URL(e.url)}catch{return Me(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),da(e,()=>Promise.resolve({}))}let n=t.protocol==="https:",r=yK(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?fK:mK,i=e.keepAlive===void 0?!1:e.keepAlive,s=r?new ip(r):new o.Agent({keepAlive:i,maxSockets:30,timeout:2e3}),c=SK(e,e.httpModule??o,s);return da(e,c)}function yK(e,t){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>e.host.endsWith(o)||e.hostname.endsWith(o)))return t}function SK(e,t,n){let{hostname:r,pathname:o,port:i,protocol:s,search:c}=new URL(e.url);return function(l){return new Promise((p,u)=>{Vn(()=>{let d=bK(l.body),m={...e.headers};l.body.length>hK&&(m["content-encoding"]="gzip",d=d.pipe(_K()));let _=r.startsWith("["),h=t.request({method:"POST",agent:n,headers:m,hostname:_?r.slice(1,-1):r,path:`${o}${c}`,port:i,protocol:s,ca:e.caCerts},b=>{b.on("data",()=>{}),b.on("end",()=>{}),b.setEncoding("utf8");let N=b.headers["retry-after"]??null,L=b.headers["x-sentry-rate-limits"]??null;p({statusCode:b.statusCode,headers:{"retry-after":N,"x-sentry-rate-limits":Array.isArray(L)?L[0]||null:L}})});h.on("error",u),d.pipe(h)})})}}function r1(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=Ji(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?n??!0:t??n}import{posix as EK,sep as TK}from"path";function o1(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Dm(e=process.argv[1]?Lb(process.argv[1]):process.cwd(),t=TK==="\\"){let n=t?o1(e):e;return r=>{if(!r)return;let o=t?o1(r):r,{dir:i,base:s,ext:c}=EK.parse(o);(c===".js"||c===".mjs"||c===".cjs")&&(s=s.slice(0,c.length*-1));let a=decodeURIComponent(s);i||(i=".");let l=i.lastIndexOf("/node_modules");if(l>-1)return`${i.slice(l+14).replace(/\//g,".")}:${a}`;if(i.startsWith(n)){let p=i.slice(n.length+1).replace(/\//g,".");return p?`${p}:${a}`:a}return a}}function Bm(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(te.SENTRY_RELEASE?.id)return te.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||n||r||e}var Hm=tu(Oy(Dm()));at();import*as i1 from"os";import{threadId as IK,isMainThread as AK}from"worker_threads";var NK=6e4,$a=class extends Ll{constructor(t){let n=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||i1.hostname(),r={...t,platform:"node",runtime:t.runtime||{name:"node",version:global.process.version},serverName:n};t.openTelemetryInstrumentations&&Da({instrumentations:t.openTelemetryInstrumentations}),$i(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${AK?"main":`worker-${IK}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{pa(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener)),Ih(this)}get tracer(){if(this._tracer)return this._tracer;let t="@sentry/node",n=q,r=he.getTracer(t,n);return this._tracer=r,r}async flush(t){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(t)}async close(t){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(t);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let t=this.getOptions();t.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{We&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},t.clientReportFlushInterval??NK).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){_b(),super._setupIntegrations()}_getTraceInfoFromScope(t){return t?VS(this,t):[void 0,void 0]}};var c1=Qp(gS(),1);import*as l1 from"module";var s1;function a1(){return Xa>=21||Xa===20&&_S>=6||Xa===18&&_S>=19?!0:(s1||(s1=!0,Me(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})),!1)}function sp(){if(a1()&&!te._sentryEsmLoaderHookRegistered){te._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,c1.createAddHookMessageChannel)();l1.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){g.warn("Failed to register 'import-in-the-middle' hook",e)}}}function Fm(){return[cl(),al(),ll(),pl(),Mm(),Fb(),Lm(),Vk(),qk(),Om(),xm(),Im(),Rm(),Tm(),Em(),Pm(),Cm()]}function tE(e={}){return vK(e,Fm)}function vK(e={},t){let n=RK(e,t);n.debug===!0&&(We?g.enable():Me(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&sp(),jS(n),ne().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:i})=>i===JS)&&n.integrations.push(km({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),$i(n,"node-core");let o=new $a(n);return ne().setClient(o),o.init(),g.log("SDK initialized from ESM"),o.startClientReportTracking(),xK(),BS(o),YS(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function Wm(){if(!We)return;let e=FS(),t=["SentryContextManager","SentryPropagator"],n=e.includes("SentryTracerProvider");Ue()&&!n&&t.push("SentrySpanProcessor");for(let r of t)e.includes(r)||g.error(`You have to set up the ${r}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);!n&&!e.includes("SentrySampler")&&g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function RK(e,t){let n=CK(e.release),r=r1(e.spotlight),o=OK(e.tracesSampleRate),i={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??Um,stackParser:I_(e.stackParser||Hm),release:n,tracesSampleRate:o,spotlight:r,debug:Ji(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,c=e.defaultIntegrations??t(i),a=tb({defaultIntegrations:c,integrations:s});return{...i,integrations:a}}function CK(e){if(e!==void 0)return e;let t=Bm();if(t!==void 0)return t}function OK(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let n=parseFloat(t);return isFinite(n)?n:void 0}function xK(){if(Ji(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Nn(e,t);ne().setPropagationContext(n)}}var p1=e=>{let t;return t=!1,{package:e,"javascript.is_cjs":t}};function br(e,t){let n=O()?.getOptions();!n?.disableInstrumentationWarnings&&!(w(e)||typeof Cr(e)=="function")&&Ki()&&Ue(n)&&(Me(()=>{console.warn(`[Sentry] ${t} is not instrumented. Please make sure to initialize Sentry in a separate file that you \`--import\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${t}/install/esm/.`)}),Di().setContext("missing_instrumentation",p1(t)))}import{types as PK}from"util";import{Worker as kK}from"worker_threads";var{isPromise:LK}=PK,MK="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc1LjAgKDlmZmI1OGMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIG4scGFyZW50UG9ydCBhcyBlfWZyb20ibm9kZTp3b3JrZXJfdGhyZWFkcyI7aW1wb3J0e3Bvc2l4IGFzIHIsc2VwIGFzIG99ZnJvbSJub2RlOnBhdGgiO2ltcG9ydCphcyBpIGZyb20ibm9kZTpodHRwIjtpbXBvcnQqYXMgcyBmcm9tIm5vZGU6aHR0cHMiO2ltcG9ydHtSZWFkYWJsZSBhcyBjfWZyb20ibm9kZTpzdHJlYW0iO2ltcG9ydHtjcmVhdGVHemlwIGFzIHV9ZnJvbSJub2RlOnpsaWIiO2ltcG9ydCphcyBhIGZyb20ibm9kZTpuZXQiO2ltcG9ydCphcyBmIGZyb20ibm9kZTp0bHMiO2NvbnN0IGg9InVuZGVmaW5lZCI9PXR5cGVvZiBfX1NFTlRSWV9ERUJVR19ffHxfX1NFTlRSWV9ERUJVR19fLHA9Z2xvYmFsVGhpcyxkPSIxMC43NS4wIjtmdW5jdGlvbiBsKCl7cmV0dXJuIGcocCkscH1mdW5jdGlvbiBnKHQpe2NvbnN0IG49dC5fX1NFTlRSWV9fPXQuX19TRU5UUllfX3x8e307cmV0dXJuIG4udmVyc2lvbj1uLnZlcnNpb258fGQsbltkXT1uW2RdfHx7fX1mdW5jdGlvbiBtKHQsbixlPXApe2NvbnN0IHI9ZS5fX1NFTlRSWV9fPWUuX19TRU5UUllfX3x8e30sbz1yW2RdPXJbZ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EludGVydmFsKCgpPT57Y29uc3QgdD1vLmdldFRpbWVNcygpOyExPT09aSYmdD5uK2UmJihpPSEwLHMmJnIoKSksdDxuK2UmJihpPSExKX0sMjApLHtwb2xsOigpPT57by5yZXNldCgpfSxlbmFibGVkOnQ9PntzPXR9fX0oZnVuY3Rpb24oKXtsZXQgdD1wcm9jZXNzLmhydGltZSgpO3JldHVybntnZXRUaW1lTXM6KCk9Pntjb25zdFtuLGVdPXByb2Nlc3MuaHJ0aW1lKHQpO3JldHVybiBNYXRoLmZsb29yKDFlMypuK2UvMWU2KX0scmVzZXQ6KCk9Pnt0PXByb2Nlc3MuaHJ0aW1lKCl9fX0sYW4ucG9sbEludGVydmFsLGFuLmFuclRocmVzaG9sZCxmdW5jdGlvbigpe2RuKCJXYXRjaGRvZyB0aW1lb3V0IiksU24/KGRuKCJQYXVzaW5nIGRlYnVnZ2VyIHRvIGNhcHR1cmUgc3RhY2sgdHJhY2UiKSxTbigpKTooZG4oIkNhcHR1cmluZyBldmVudCB3aXRob3V0IGEgc3RhY2sgdHJhY2UiKSxfbigpLnRoZW4obnVsbCwoKT0+e2RuKCJTZW5kaW5nIEFOUiBldmVudCBmYWlsZWQgb24gd2F0Y2hkb2cgdGltZW91dC4iKX0pKX0pO2U/Lm9uKCJtZXNzYWdlIix0PT57dC5zZXNzaW9uJiYoZm49SCh0LnNlc3Npb24pKSx0LmRlYnVnSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==",wK=50,GK=5e3;function nE(e,...t){g.log(`[ANR] ${e}`,...t)}function UK(){return te}function DK(){let e=Cn(J(),ne());return e.attachments=[],e.eventProcessors=[],e}async function BK(e){let t={message:"ANR"},n={};for(let r of e.getEventProcessors()){if(t===null)break;t=await r(t,n)}return t?.contexts||{}}var u1="Anr",HK=((e={})=>{if(nn.major<16||nn.major===16&&nn.minor<17)throw new Error("ANR detection requires Node 16.17.0 or later");let t,n,r=UK();return r.__SENTRY_GET_SCOPES__=DK,{name:u1,startWorker:()=>{t||n&&(t=FK(n,e))},stopWorker:()=>{t&&t.then(o=>{o(),t=void 0})},async setup(o){n=o,e.captureStackTrace&&await Ja()&&(g.warn("ANR captureStackTrace has been disabled because the debugger was already enabled"),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}),d1=HK;async function FK(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await BK(e);delete r.app?.app_memory,delete r.device?.free_memory;let o=e.getOptions(),i=e.getSdkMetadata()||{};i.sdk&&(i.sdk.integrations=o.integrations.map(l=>l.name));let s={debug:g.isEnabled(),dsn:n,tunnel:o.tunnel,environment:o.environment||"production",release:o.release,dist:o.dist,sdkMetadata:i,appRootPath:t.appRootPath,pollInterval:t.pollInterval||wK,anrThreshold:t.anrThreshold||GK,captureStackTrace:!!t.captureStackTrace,maxAnrEvents:t.maxAnrEvents||1,staticTags:t.staticTags||{},contexts:r};if(s.captureStackTrace){let l=await import("inspector");l.url()||l.open(0)}let c=new kK(new URL(`data:application/javascript;base64,${MK}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{c.terminate()});let a=setInterval(()=>{try{let l=J().getSession(),p=l?{...l,toJSON:void 0}:void 0;c.postMessage({session:p,debugImages:Jc(o.stackParser)})}catch{}},s.pollInterval);return a.unref(),c.on("message",l=>{l==="session-ended"&&(nE("ANR event sent from ANR worker. Clearing session in this thread."),J().setSession(void 0))}),c.once("error",l=>{clearInterval(a),nE("ANR worker error",l)}),c.once("exit",l=>{clearInterval(a),nE("ANR worker exit",l)}),c.unref(),()=>{c.terminate(),clearInterval(a)}}function m1(e){let t=O()?.getIntegrationByName(u1);if(!t)return e();t.stopWorker();let n=e();return LK(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}var rE={};rv(rE,{debug:()=>YK,error:()=>XK,fatal:()=>KK,fmt:()=>Sb,info:()=>jK,trace:()=>VK,warn:()=>ZK});import{format as WK}from"util";function ko(e,...t){let[n,r,o,i]=t;if(Array.isArray(r)){let s={...o};s["sentry.message.template"]=n,r.forEach((a,l)=>{s[`sentry.message.parameter.${l}`]=a});let c=WK(n,...r);ur({level:e,message:c,attributes:s},i?.scope)}else ur({level:e,message:n,attributes:r},o?.scope??i?.scope)}function VK(...e){ko("trace",...e)}function YK(...e){ko("debug",...e)}function jK(...e){ko("info",...e)}function ZK(...e){ko("warn",...e)}function XK(...e){ko("error",...e)}function KK(...e){ko("fatal",...e)}import{monitorEventLoopDelay as qK,performance as oE}from"perf_hooks";var f1="NodeRuntimeMetrics",g1=3e4,Vm=1e3,_1=10;function iE(e,t,n){return Number.isFinite(e)?e<Vm?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${Vm}ms. Using minimum of ${Vm}ms.`),Vm):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var h1=(e={})=>{let t=iE(e.collectionIntervalMs??g1,f1,g1),n={cpuUtilization:!0,memHeapUsed:!0,memHeapTotal:!0,memRss:!0,eventLoopDelayP50:!0,eventLoopDelayP99:!0,eventLoopUtilization:!0,uptime:!0,cpuTime:!1,memExternal:!1,eventLoopDelayMin:!1,eventLoopDelayMax:!1,eventLoopDelayMean:!1,eventLoopDelayP90:!1,...e.collect},r=n.eventLoopDelayP99||n.eventLoopDelayMin||n.eventLoopDelayMax||n.eventLoopDelayMean||n.eventLoopDelayP50||n.eventLoopDelayP90,o=n.cpuUtilization||n.cpuTime,i,s,c,a=0,l,p=_1*1e6,u=b=>Math.max(0,(b-p)/1e9),d={attributes:{"sentry.origin":"auto.node.runtime_metrics"}},m={unit:"byte",attributes:{"sentry.origin":"auto.node.runtime_metrics"}},_={unit:"second",attributes:{"sentry.origin":"auto.node.runtime_metrics"}};function h(){let b=tt(),N=b-a;if(o&&s!==void 0){let L=process.cpuUsage(s);n.cpuTime&&(ft.gauge("node.runtime.cpu.user",L.user/1e6,_),ft.gauge("node.runtime.cpu.system",L.system/1e6,_)),n.cpuUtilization&&N>0&&ft.gauge("node.runtime.cpu.utilization",(L.user+L.system)/(N*1e3),d),s=process.cpuUsage()}if(n.memRss||n.memHeapUsed||n.memHeapTotal||n.memExternal){let L=process.memoryUsage();n.memRss&&ft.gauge("node.runtime.mem.rss",L.rss,m),n.memHeapUsed&&ft.gauge("node.runtime.mem.heap_used",L.heapUsed,m),n.memHeapTotal&&ft.gauge("node.runtime.mem.heap_total",L.heapTotal,m),n.memExternal&&(ft.gauge("node.runtime.mem.external",L.external,m),ft.gauge("node.runtime.mem.array_buffers",L.arrayBuffers,m))}if(r&&l&&(n.eventLoopDelayMin&&ft.gauge("node.runtime.event_loop.delay.min",u(l.min),_),n.eventLoopDelayMax&&ft.gauge("node.runtime.event_loop.delay.max",u(l.max),_),n.eventLoopDelayMean&&ft.gauge("node.runtime.event_loop.delay.mean",u(l.mean),_),n.eventLoopDelayP50&&ft.gauge("node.runtime.event_loop.delay.p50",u(l.percentile(50)),_),n.eventLoopDelayP90&&ft.gauge("node.runtime.event_loop.delay.p90",u(l.percentile(90)),_),n.eventLoopDelayP99&&ft.gauge("node.runtime.event_loop.delay.p99",u(l.percentile(99)),_),l.reset()),n.eventLoopUtilization&&c!==void 0){let L=oE.eventLoopUtilization(),R=oE.eventLoopUtilization(L,c);ft.gauge("node.runtime.event_loop.utilization",R.utilization,d),c=L}n.uptime&&N>0&&ft.count("node.runtime.process.uptime",N/1e3,_),a=b}return{name:f1,setup(){if(r){l?.disable();try{l=qK({resolution:_1}),l.enable()}catch{l=void 0}}o&&(s=process.cpuUsage()),n.eventLoopUtilization&&(c=oE.eventLoopUtilization()),a=tt(),i&&clearInterval(i),i=xn(setInterval(h,t))}}};var QK=["trace","debug","info","warn","error","fatal"],b1=Symbol.for("level"),JK=Symbol.for("message"),$K=Symbol.for("splat");function y1(e,t){class n extends e{constructor(o){super(o),this._levels=new Set(t?.levels??QK)}log(o,i){try{if(setImmediate(()=>{this.emit("logged",o)}),!V(o))return;let s=o[b1],{level:c,message:a,timestamp:l,...p}=o;p[b1]=void 0,p[JK]=void 0,p[$K]=void 0;let u=t?.customLevelMap?.[s],d=zK[s],m=u??d??"info";this._levels.has(m)?ko(m,a,{...p,"sentry.origin":"auto.log.winston"}):!u&&!d&&We&&g.log(`Winston log level ${s} is not captured by Sentry. Please add ${s} to the "customLevelMap" option of the Sentry Winston transport.`)}catch{}i&&i()}}return n}var zK={silly:"trace",debug:"debug",verbose:"debug",http:"debug",info:"info",notice:"info",warn:"warn",warning:"warn",error:"error",emerg:"fatal",alert:"fatal",crit:"fatal"};import*as T1 from"diagnostics_channel";var sE=Symbol("sentry-track-pino-logger");function S1(e,t,n){let r=Object.getOwnPropertySymbols(e),o=`Symbol(${t})`;for(let i of r)if(i.toString()===o){let s=e[i];return typeof s=="string"?s:n}return n}var E1={error:{levels:[],handled:!0},log:{levels:["trace","debug","info","warn","error","fatal"]}};function eq(e){let{level:t,time:n,pid:r,hostname:o,...i}=e;return i}var tq=(e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...E1.error,...e.error},log:{...E1.log,...e.log}};function n(r){let o=r[sE];return o==="track"||o!=="ignore"&&t.autoInstrument}return{name:"Pino",setup:r=>{let o=!!r.getOptions().enableLogs,i=T1.tracingChannel("pino_asJson");function s(c,a,l){if(!n(c))return;let p=eq(l),[u,d,m]=a,_=c?.levels?.labels?.[m]||"info",h=S1(c,"pino.messageKey","msg"),b=d||p?.[h]||"";if(o&&t.log.levels.includes(_)){let N={...p,"sentry.origin":"auto.log.pino","pino.logger.level":m};ur({level:_,message:b,attributes:N})}if(t.error.levels.includes(_)){let N=S1(c,"pino.errorKey","err"),L={};for(let[v,P]of Object.entries(p))v!==N&&v!==h&&(L[v]=P);b&&(L[h]=b);let R={level:ei(_),contexts:{pino:L}};Be(v=>{v.addEventProcessor(G=>(G.logger="pino",Hn(G,{handled:t.error.handled,type:"auto.log.pino"}),G));let P=u[N];if(P){me(P,R);return}$c(b,R)})}}i.end.subscribe(c=>{let{instance:a,arguments:l,result:p}=c;s(a,l,JSON.parse(p))})}}},I1=Object.assign(tq,{trackLogger(e){V(e)&&"levels"in e&&(e[sE]="track")},untrackLogger(e){V(e)&&"levels"in e&&(e[sE]="ignore")}});function aE(e,t){e.setAttribute(S,t)}var nq=[["january","1"],["february","2"],["march","3"],["april","4"],["may","5"],["june","6"],["july","7"],["august","8"],["september","9"],["october","10"],["november","11"],["december","12"],["jan","1"],["feb","2"],["mar","3"],["apr","4"],["may","5"],["jun","6"],["jul","7"],["aug","8"],["sep","9"],["oct","10"],["nov","11"],["dec","12"],["sunday","0"],["monday","1"],["tuesday","2"],["wednesday","3"],["thursday","4"],["friday","5"],["saturday","6"],["sun","0"],["mon","1"],["tue","2"],["wed","3"],["thu","4"],["fri","5"],["sat","6"]];function fs(e){return nq.reduce((t,[n,r])=>t.replace(new RegExp(n,"gi"),r),e)}var A1="Automatic instrumentation of CronJob only supports crontab string";function N1(e,t){let n=!1;return new Proxy(e,{construct(r,o){let[i,s,c,a,l,...p]=o;if(typeof i!="string")throw new Error(A1);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let u=fs(i);async function d(m,_){return Fr(t,async()=>{try{await s(m,_)}catch(h){throw me(h,{mechanism:{handled:!1,type:"auto.function.cron.instrumentCron"}}),h}},{schedule:{type:"crontab",value:u},timezone:l||void 0})}return new r(i,d,c,a,l,...p)},get(r,o){return o==="from"?i=>{let{cronTime:s,onTick:c,timeZone:a}=i;if(typeof s!="string")throw new Error(A1);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let l=fs(s);return i.onTick=async(p,u)=>Fr(t,async()=>{try{await c(p,u)}catch(d){throw me(d,{mechanism:{handled:!1,type:"auto.function.cron.instrumentCron"}}),d}},{schedule:{type:"crontab",value:l},timezone:a||void 0}),r.from(i)}:r[o]}})}function v1(e,t={}){return new Proxy(e,{get(n,r){return r==="schedule"&&n.schedule?new Proxy(n.schedule,{apply(o,i,s){let[c,a,l]=s,p=l?.name,u=l?.timezone;if(!p)throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');let d=async(...m)=>Fr(p,async()=>{try{return await a(...m)}catch(_){throw me(_,{mechanism:{handled:!1,type:"auto.function.node-cron.instrumentNodeCron"}}),_}},{schedule:{type:"crontab",value:fs(c)},timezone:u,...t});return o.apply(i,[c,d,l])}}):n[r]}})}function R1(e){return new Proxy(e,{get(t,n){return n==="scheduleJob"?new Proxy(t.scheduleJob,{apply(r,o,i){let[s,c,a]=i;if(typeof s!="string"||typeof c!="string"||typeof a!="function")throw new Error("Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string");let l=s,p=c;async function u(){return Fr(l,async()=>{await a?.()},{schedule:{type:"crontab",value:fs(p)}})}return r.apply(o,[l,p,u])}}):t[n]}})}var C1={instrumentCron:N1,instrumentNodeCron:v1,instrumentNodeSchedule:R1};var O1="Http",x1=Object.assign(ls,{id:`${O1}.sentry`}),cE=(e={})=>{let t=e.spans??!0,n=e.disableIncomingRequestSpans,r=t&&!n,o={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},i={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},s=wa(o),c=Ga(i);return{name:O1,setup(a){let l=a.getOptions();r&&Ue(l)&&c.setup(a)},setupOnce(){s.setupOnce();let a={breadcrumbs:e.breadcrumbs,spans:t,propagateTraceInOutgoingRequests:e.tracePropagation??!0,createSpansForOutgoingRequests:t,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(l,p)=>{let u=_r(p);if(u.startsWith("data:")){let d=il(u);l.setAttribute("http.url",d),l.setAttribute(pt,d),l.updateName(`${p.method||"GET"} ${d}`)}e.instrumentation?.requestHook?.(l,p)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan};ls(a)},processEvent(a){return c.processEvent(a)}}};var rq=((e={})=>({name:"NodeFetch",setupOnce(){let t=O()?.getOptions();Kl({...e,spans:oq(e,t)})}})),lE=rq;function oq(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&Ue(t))}import*as jm from"fs";import{promisify as sq}from"util";var P1=["access","appendFile","chmod","chown","copyFile","cp","lchown","link","lstat","lutimes","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"],k1=["access","appendFile","chmod","chown","copyFile","cp","exists","lchown","link","lstat","lutimes","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","realpath.native","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"],L1=["accessSync","appendFileSync","chmodSync","chownSync","copyFileSync","cpSync","existsSync","lchownSync","linkSync","lstatSync","lutimesSync","mkdirSync","mkdtempSync","opendirSync","openSync","readdirSync","readFileSync","readlinkSync","realpathSync","realpathSync.native","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","writeFileSync"];function iq(e){let t=e.split(".");if(t.length>1){if(t.length!==2)throw Error(`Invalid member function name ${e}`);return t}else return[e]}function pE(e,t){if(!t)throw new Error(JSON.stringify({member:t}));let n=iq(t),[r,o]=n;return o?{objectToPatch:e[r],functionNameToPatch:o}:{objectToPatch:e,functionNameToPatch:r}}var aq="auto.file.fs",cq="file",lq=["rename","renameSync"],pq=["copyFile","cp","copyFileSync","cpSync"],uq=["link","linkSync"],dq=["mkdtemp","mkdtempSync"],mq=["symlink","symlinkSync"],fq=["access","appendFile","chmod","chown","exists","mkdir","lchown","lstat","lutimes","open","opendir","readdir","readFile","readlink","realpath","realpath.native","rm","rmdir","stat","truncate","unlink","utimes","writeFile","accessSync","appendFileSync","chmodSync","chownSync","existsSync","lchownSync","lstatSync","lutimesSync","opendirSync","mkdirSync","openSync","readdirSync","readFileSync","readlinkSync","realpathSync","realpathSync.native","rmdirSync","rmSync","statSync","truncateSync","unlinkSync","utimesSync","writeFileSync"];function Zm(e,t,n){let r={[H]:cq,[S]:aq};return n.recordFilePaths&&(typeof t[0]=="string"&&fq.includes(e)?r.path_argument=t[0]:typeof t[0]=="string"&&typeof t[1]=="string"?mq.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):uq.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):pq.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):lq.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]=="string"&&dq.includes(e)&&(r.prefix_argument=t[0])),r}function Xm(e,t){return Object.assign(e,t)}var M1=new WeakMap;function Ym(e,t,n){let r=e[t];if(typeof r!="function")return;let o=M1.get(e);o||(o=new Set,M1.set(e,o)),!o.has(t)&&(o.add(t),e[t]=n(r))}function gq(e,t,n){return Xm(function(...o){let i=Zm(e,o,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:i},s=>{try{return Vn(()=>t.apply(this,o))}catch(c){throw ap(s,c,n),c}})},t)}function _q(e,t,n){return Xm(function(...o){let i=o.length-1,s=o[i];if(typeof s!="function")return t.apply(this,o);let c=Zm(e,o,n),a=M({name:`fs.${e}`,onlyIfParent:!0,attributes:c}),l=Q();o[i]=function(...p){let u=p[0];return u&&ap(a,u,n),a.end(),l?se(l,()=>s.apply(this,p)):s.apply(this,p)};try{return Vn(()=>t.apply(this,o))}catch(p){throw ap(a,p,n),a.end(),p}},t)}function hq(e,t){let n="exists",o=Xm(function(...s){let c=s.length-1,a=s[c];if(typeof a!="function")return e.apply(this,s);let l=Zm(n,s,t),p=M({name:`fs.${n}`,onlyIfParent:!0,attributes:l}),u=Q();s[c]=function(...d){return p.end(),u?se(u,()=>a.apply(this,d)):a.apply(this,d)};try{return Vn(()=>e.apply(this,s))}catch(d){throw ap(p,d,t),p.end(),d}},e),i=function(s){return new Promise(c=>o(s,c))};return Object.defineProperty(i,"name",{value:n}),Object.defineProperty(o,sq.custom,{value:i}),o}function bq(e,t,n){return Xm(async function(...o){let i=Zm(e,o,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:i},async s=>{try{return await Vn(()=>t.apply(this,o))}catch(c){throw ap(s,c,n),c}})},t)}function w1(e={}){for(let n of L1){let{objectToPatch:r,functionNameToPatch:o}=pE(jm,n);Ym(r,o,i=>gq(n,i,e))}for(let n of k1){let{objectToPatch:r,functionNameToPatch:o}=pE(jm,n);n==="exists"?Ym(r,o,i=>hq(i,e)):Ym(r,o,i=>_q(n,i,e))}let t=jm.promises;for(let n of P1)Ym(t,n,r=>bq(n,r,e))}function ap(e,t,n){e.setStatus({code:2,message:"internal_error"}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute("fs_error",t.message)}var yq="FileSystem",Sq=(e={})=>({name:yq,setupOnce(){w1(e)}});var Ye=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function to(e){let t=Q();if(!t)return;let n=Re(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute("http.route",e)}var G1="Express",Eq=[">=4.0.0 <6"];function Tq(e,t){Ly(e,t),br(e.use,"express")}var dE=de(G1,e=>new uE(e)),uE=class extends ae{constructor(t={}){super("sentry-express",q,t)}init(){return new re("express",Eq,n=>{try{Py(n,()=>({...this.getConfig(),onRouteResolved(r){r&&to(r)}}))}catch(r){Ye&&g.error("Failed to patch express module:",r)}return n},n=>n)}},Iq=(e=>({name:G1,setupOnce(){dE(e)},getShouldHandleError(){return e?.shouldHandleError}})),mE=Iq;at();var di=(e=>(e.FASTIFY_NAME="fastify.name",e.FASTIFY_TYPE="fastify.type",e.HOOK_NAME="hook.name",e.PLUGIN_NAME="plugin.name",e))(di||{}),Km=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(Km||{}),qm=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request handler",e))(qm||{});at();var cp=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function fE(e,t,n,r={}){let o=t.startSpan(n,{attributes:r}),i=e[cp]||[];return i.push(o),Object.defineProperty(e,cp,{enumerable:!1,configurable:!0,value:i}),o}function Qm(e,t){let n=e[cp]||[];n.length&&(n.forEach(r=>{t&&(r.setStatus({code:Dn.ERROR,message:t.message}),r.recordException(t)),r.end()}),delete e[cp])}function D1(e,t,n){let r,o;try{o=e(),U1(o)&&o.then(i=>t(void 0,i),i=>t(i))}catch(i){r=i}finally{if(!U1(o)&&(t(r,o),r))throw r;return o}}function U1(e){return typeof e=="object"&&e&&typeof Object.getOwnPropertyDescriptor(e,"then")?.value=="function"||!1}var Aq="@sentry/instrumentation-fastify-v3",B1="anonymous",Nq=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),Jm=class extends ae{constructor(t={}){super(Aq,q,t)}init(){return[new re("fastify",[">=3.0.0 <3.21.0"],t=>this._patchConstructor(t))]}_hookOnRequest(){let t=this;return function(r,o,i){if(!t.isEnabled())return i();t._wrap(o,"send",t._patchSend());let s=r,c=s.routeOptions?s.routeOptions.url:r.routerPath;c&&to(c);let a=r.method||"GET";J().setTransactionName(`${a} ${c}`),i()}}_wrapHandler(t,n,r,o){let i=this;return this._diag.debug("Patching fastify route.handler function"),function(...s){if(!i.isEnabled())return r.apply(this,s);let c=r.name||t||B1,a=`${qm.MIDDLEWARE} - ${c}`,l=s[1],p=fE(l,i.tracer,a,{[di.FASTIFY_TYPE]:Km.MIDDLEWARE,[di.PLUGIN_NAME]:t,[di.HOOK_NAME]:n}),u=o&&s[s.length-1];return u&&(s[s.length-1]=function(...d){Qm(l),u.apply(this,d)}),pe.with(he.setSpan(pe.active(),p),()=>D1(()=>r.apply(this,s),d=>{d instanceof Error&&(p.setStatus({code:Dn.ERROR,message:d.message}),p.recordException(d)),o||Qm(l)}))}}_wrapAddHook(){let t=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let i=o[0],s=o[1],c=this.pluginName;if(!Nq.has(i))return n.apply(this,o);let a=typeof o[o.length-1]=="function"&&s.constructor.name!=="AsyncFunction";return n.apply(this,[i,t._wrapHandler(c,i,s,a)])}}}_patchConstructor(t){let n=this;function r(...o){let i=t.fastify.apply(this,o);return i.addHook("onRequest",n._hookOnRequest()),i.addHook("preHandler",n._hookPreHandler()),vq(),n._wrap(i,"addHook",n._wrapAddHook()),i}return t.errorCodes!==void 0&&(r.errorCodes=t.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let t=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...i){let s=i[0];return t.isEnabled()?$r(()=>r.apply(this,i),c=>{!c&&s instanceof Error&&(c=s),Qm(this,c)}):r.apply(this,i)}}}_hookPreHandler(){let t=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,i){if(!t.isEnabled())return i();let s=r,c=s.routeOptions?.handler||s.context?.handler,a=c?.name.startsWith("bound ")?c.name.substring(6):c?.name,l=`${qm.REQUEST_HANDLER} - ${a||this.pluginName||B1}`,p={[di.PLUGIN_NAME]:this.pluginName,[di.FASTIFY_TYPE]:Km.REQUEST_HANDLER,[He]:s.routeOptions?s.routeOptions.url:r.routerPath};a&&(p[di.FASTIFY_NAME]=a);let u=fE(o,t.tracer,l,p);H1(u);let{requestHook:d}=t.getConfig();return d&&$r(()=>d(u,{request:r}),m=>{m&&t._diag.error("request hook failed",m)},!0),pe.with(he.setSpan(pe.active(),u),()=>{i()})}}};function vq(){let e=O();e&&e.on("spanStart",t=>{H1(t)})}function H1(e){let t=ie(e).data,n=t["fastify.type"];if(t[H]||!n)return;e.setAttributes({[S]:"auto.http.otel.fastify",[H]:`${n}.fastify`});let r=t["fastify.name"]||t["plugin.name"]||t["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(o)}}import*as bE from"diagnostics_channel";var F1="execute_tool";var W1="invoke_agent";var Lo="graphql";var $=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var _E=()=>{};function ee(e,t,n){let r=Rq(e,t,n),o=n?.beforeSpanEnd,i=n?.deferSpanEnd,s=p=>typeof n?.captureError=="function"?n.captureError(p):{mechanism:{type:"auto.diagnostic_channels.bind_span",handled:!1}},c=(p,u)=>{n?.captureError&&me(u,s(u));let{message:d,attributes:m}=Cq(u);p.setStatus({code:2,message:d}),p.setAttributes(m)},a=(p,u)=>{let d=!1;return m=>{d||(d=!0,m!==void 0&&c(p,m),gE(u,o))}},l={start:_E,asyncStart:_E,end(p){if("error"in p||"result"in p){let u=p._sentrySpan;if(u&&i?.({span:u,data:p,end:a(u,p)}))return;gE(p,o)}},error(p){let u=p._sentrySpan;u&&c(u,p.error)},asyncEnd(p){let u=p._sentrySpan;u&&i?.({span:u,data:p,end:a(u,p)})||gE(p,o)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function Rq(e,t,n){let r=St(Je()).getTracingChannelBinding?.();if(!r)return $&&g.log("[TracingChannel] Could not access async context binding."),{channel:e,unbind:_E};let o=r.asyncLocalStorage;return e.start.bindStore(o,i=>{i._sentryCallerStore=o.getStore();let c=!n?.requiresParentSpan||Q()?t(i):void 0;return c?(i._sentrySpan=c,r.getStoreWithActiveSpan(c)):i._sentryCallerStore}),e.asyncStart.bindStore(o,i=>i._sentryCallerStore),{channel:e,unbind:()=>{e.start.unbindStore(o),e.asyncStart.unbindStore(o)}}}function gE(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function Cq(e){let t=V(e),n=t?"message"in e?e.message:void 0:e,r=n?String(n):void 0,o=t&&"name"in e?String(e.name):"unknown";return{message:r,attributes:{[Dr]:o}}}var hE="original-description",Oq=new Set(["Int","Float","String","BlockString"]);function $m(e,t,n){let r=Re(e);if(r===e)return;let o=ie(r),i=n?`${t} ${n}`:t,s=o.data[Gh],c;Array.isArray(s)?c=[...s,i]:typeof s=="string"?c=[s,i]:c=i,r.setAttribute(Gh,c);let a=o.data[hE]??o.description;o.data[hE]||r.setAttribute(hE,a),r.updateName(`${a} (${xq(c)})`)}function xq(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(", "):`${t.slice(0,5).join(", ")}, +${t.length-5}`}return e}function zm(e,t,n){return e&&t?`${e} ${t}`:e||n}function ef(e){if(V(e)&&"errors"in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function Pq(e){let t=e?.loc,n=t?.source?.body;if(!(typeof n!="string"||!t?.startToken))try{let r=[];for(let i=t.startToken;i;i=i.next)Oq.has(i.kind)&&r.push({start:i.start,end:i.end,kind:i.kind});let o=n;for(let i=r.length-1;i>=0;i--){let{start:s,end:c,kind:a}=r[i],l=a==="String"||a==="BlockString"?'"*"':"*";o=o.slice(0,s)+l+o.slice(c)}return o}catch{return}}function za(e){if(O()?.getDataCollectionOptions().graphQL.document===!0)return Pq(e)}var kq="graphql:parse",Lq="graphql:validate",Mq="graphql:execute",wq="graphql:subscribe",Gq="graphql:resolve",tf="auto.graphql.diagnostic_channel",Uq="graphql.parse",Dq="graphql.validate",Bq="graphql.execute",Hq="graphql.subscribe",Fq="graphql.resolve",Wq="graphql.field.name",Vq="graphql.field.path",Yq="graphql.field.type",jq="graphql.parent.name";function Y1(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,o=t.useOperationNameForRootSpan!==!1;Zq(e),Xq(e),V1(e,Mq,Bq,o),V1(e,wq,Hq,o),n||Kq(e,r)}function Zq(e){ee(e(kq),()=>M({name:Uq,attributes:{[S]:tf,[H]:Lo}}))}function Xq(e){ee(e(Lq),t=>M({name:Dq,attributes:{[S]:tf,[H]:Lo,[oa]:za(t.document)}}),{beforeSpanEnd:(t,n)=>{Array.isArray(n.result)&&n.result.length>0&&t.setStatus({code:2,message:"invalid_argument"})}})}function V1(e,t,n,r){ee(e(t),o=>{let i=M({name:zm(o.operationType,o.operationName,n),attributes:{[S]:tf,[H]:Lo,[Ru]:o.operationType,[vu]:o.operationName||void 0,[oa]:za(o.document)}});return r&&o.operationType&&$m(i,o.operationType,o.operationName),i},{beforeSpanEnd:(o,i)=>{ef(i.result)&&o.setStatus({code:2,message:"internal_error"})}})}function Kq(e,t){ee(e(Gq),n=>{if(!(t&&n.isDefaultResolver))return M({name:`${Fq} ${n.fieldPath}`,attributes:{[S]:tf,[H]:Lo,[Wq]:n.fieldName,[Vq]:n.fieldPath,[Yq]:n.fieldType,[jq]:n.parentType}})})}var qq=((e={})=>({name:"Graphql",setupOnce(){bE.tracingChannel&&ue(()=>{Y1(bE.tracingChannel,e)})}})),lp=qq;import*as SE from"diagnostics_channel";var Qq="mongoose:query",Jq="mongoose:aggregate",$q="mongoose:model:save",zq="mongoose:model:insertMany",e4="mongoose:model:bulkWrite",t4="mongoose:cursor:next",n4="auto.db.mongoose.diagnostic_channel",r4="mongodb",o4=10,j1=!1;function nf(e){if(!j1){j1=!0;try{ec(e,Qq),ec(e,Jq),ec(e,$q),ec(e,zq),ec(e,e4),ec(e,t4)}catch{$&&g.log("Mongoose node:diagnostics_channel subscription failed.")}}}function ec(e,t){ee(e(t),n=>{let r=n.collection,o=s4(n.args?.pipeline??n.args?.filter),i=i4(n);return M({name:r?`mongoose.${r}.${n.operation}`:`mongoose.${n.operation}`,attributes:{[S]:n4,[H]:"db",[mt]:r4,[lr]:n.operation,[ta]:r??void 0,[bo]:n.database??void 0,[Ur]:o??void 0,[ra]:i??void 0,[_t]:n.serverAddress??void 0,[ht]:n.serverPort??void 0}})})}function i4(e){let t=e.args,n=e.operation==="insertMany"?t?.docs:e.operation==="bulkWrite"?t?.ops:void 0;return Array.isArray(n)&&n.length>1?n.length:void 0}function s4(e){if(e!=null)try{let t=yE(e,0),n=JSON.stringify(t);return n==null||n==="{}"||n==="[]"?void 0:n}catch{return}}function yE(e,t){if(t>o4)return"?";if(Array.isArray(e))return e.map(n=>yE(n,t+1));if(V(e)){let n={};for(let r of Object.keys(e))n[r]=yE(e[r],t+1);return n}return"?"}var a4=(()=>({name:"Mongoose",setupOnce(){SE.tracingChannel&&ue(()=>{nf(SE.tracingChannel)})}})),EE=a4;var c4="db.system",l4="db.name",Z1="db.operation",p4="db.statement",u4="db.mongodb.collection",d4="db.connection_string",m4="net.peer.name",f4="net.peer.port",g4="mongodb";function _4(e){return JSON.stringify(TE(e))}function TE(e){if(Array.isArray(e))return e.map(t=>TE(t));if(h4(e)){let t={};return Object.entries(e).map(([n,r])=>[n,TE(r)]).reduce((n,r)=>(y4(r)&&(n[r[0]]=r[1]),n),t)}return"?"}function h4(e){return V(e)&&!b4(e)}function b4(e){return typeof Buffer<"u"&&Buffer.isBuffer(e)}function y4(e){return Array.isArray(e)}function pp(e,t,n,r,o){let i,s;if(e){let a=typeof e.address=="string"?e.address.split(":"):"";a.length===2&&(i=a[0],s=a[1])}let c;return n?.documents?.[0]?c=n.documents[0]:n?.cursors?c=n.cursors:c=n,X1(t.db,t.collection,i,s,c,r,o)}function X1(e,t,n,r,o,i,s){let c={[S]:s,[c4]:g4,[l4]:e,[u4]:t,[Z1]:i,[d4]:`mongodb://${n}:${r}/${e}`};if(n&&r){c[m4]=n;let a=parseInt(r,10);isNaN(a)||(c[f4]=a)}if(o)try{c[p4]=_4(o)}catch{}return c}function up(e){if(e.createIndexes!==void 0)return"createIndexes";if(e.findandmodify!==void 0)return"findAndModify";if(e.ismaster!==void 0)return"isMaster";if(e.count!==void 0)return"count";if(e.aggregate!==void 0)return"aggregate"}function dp(e,t,n,r,o){let i,s;if(t?.s&&(i=t.s.options?.host??t.s.host,s=(t.s.options?.port??t.s.port)?.toString(),i==null||s==null)){let p=t.description?.address;if(p){let u=p.split(":");i=u[0],s=u[1]}}let[c,a]=e.toString().split("."),l=n?.query??n?.q??n;return X1(c,a,i,s,l,r,o)}function yr(e){return M({name:`mongodb.${e[Z1]||"command"}`,op:"db",kind:D.CLIENT,attributes:e})}import*as IE from"diagnostics_channel";var S4="mysql2:query",E4="mysql2:execute",T4="mysql2:connect",I4="mysql2:pool:connect",Q1="auto.db.mysql2.diagnostic_channel",J1="mysql",A4=/^\s*(\w+)/;function rf(e){K1(e,S4),K1(e,E4),q1(e,T4,"mysql2.connect"),q1(e,I4,"mysql2.pool.connect")}function K1(e,t){ee(e(t),n=>{let r=n.query?La(n.query):void 0,o=r?.match(A4)?.[1]?.toUpperCase();return M({name:r||"mysql2.query",attributes:{[S]:Q1,[H]:"db",[mt]:J1,[Ur]:r,[lr]:o,[bo]:n.database||void 0,[_t]:n.serverAddress,[ht]:n.serverPort}})},{requiresParentSpan:!0})}function q1(e,t,n){ee(e(t),r=>M({name:n,attributes:{[S]:Q1,[H]:"db",[mt]:J1,[bo]:r.database||void 0,[_t]:r.serverAddress,[ht]:r.serverPort}}),{requiresParentSpan:!0})}var N4=(()=>({name:"Mysql2",setupOnce(){IE.tracingChannel&&ue(()=>{rf(IE.tracingChannel)})}})),AE=N4;var v4="PRISMA_INSTRUMENTATION",R4="V7_PRISMA_INSTRUMENTATION",$1=globalThis;function z1(e){let t={helper:e};$1[R4]=t,$1[v4]=t}var C4=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES==="true"}catch{return!1}})(),O4="00-10-10-00",x4="auto.db.otel.prisma",tM=1e3,NE=new Yt(tM),tc=[];function vE(e,t){NE.set(e,t)}function RE(e,t){let n={...t,[S]:x4};return e==="prisma:engine:db_query"&&n[Pe]==null&&(n[Pe]="prisma"),n}function CE(e,t){let n=t["db.query.text"];return(e==="prisma:engine:db_query"||e==="prisma:client:db_query")&&typeof n=="string"?n:e}function P4(){let e=!0;for(;e;){e=!1;for(let t=tc.length-1;t>=0;t--){let n=tc[t],r=NE.get(n.parent_span_id);if(!r)continue;let o=RE(n.name,n.attributes),i=M({name:CE(n.name,o),attributes:o,kind:n.kind==="client"?D.CLIENT:D.INTERNAL,startTime:n.start_time,parentSpan:r});vE(n.span_id,i),n.links&&i.addLinks(n.links.flatMap(s=>{let c=NE.get(s.span_id);return c?[{context:c.spanContext()}]:[]})),i.end(n.end_time),tc.splice(t,1),e=!0}}}var of=class{constructor({ignoreSpanTypes:t}){this.ignoreSpanTypes=t}isEnabled(){return!0}getTraceParent(t){let n=(t??Q())?.spanContext();return n?`00-${n.traceId}-${n.spanId}-0${n.traceFlags}`:O4}dispatchEngineSpans(t){let n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)nM(o,t,n,this.ignoreSpanTypes)}createEngineSpan(t){tc.push(...t.spans),P4();let n=tc.length-tM;n>0&&($&&g.log(`[Prisma] Dropping ${n} unresolved v5 engine span(s) whose parent was never registered.`),tc.splice(0,n))}getActiveContext(){return Q()}runInChildSpan(t,n){let r=typeof t=="string"?{name:t}:t;if(r.internal&&!C4)return n();let o=`prisma:client:${r.name}`;if(rM(o,this.ignoreSpanTypes))return n();let i=Q(),s=RE(o,r.attributes),c={name:CE(o,s),attributes:s,kind:r.kind,links:r.links,startTime:r.startTime,parentSpan:i};if(r.active===!1){let a=M(c);return vE(a.spanContext().spanId,a),eM(a,()=>n(a,i))}return ke(c,a=>(vE(a.spanContext().spanId,a),eM(a,()=>n(a,i))))}};function nM(e,t,n,r){if(rM(e.name,r))return;let o=RE(e.name,e.attributes);ke({name:CE(e.name,o),attributes:o,kind:e.kind==="client"?D.CLIENT:D.INTERNAL,startTime:e.startTime},i=>{n.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let a=n.get(c);return a?{context:{spanId:a,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let s=t.filter(c=>c.parentId===e.id);for(let c of s)nM(c,t,n,r);i.end(e.endTime)})}function eM(e,t){let n;try{n=t()}catch(r){throw e.end(),r}return k4(n)?n.then(r=>(e.end(),r),r=>{throw e.end(),r}):(e.end(),n)}function k4(e){return e!=null&&typeof e.then=="function"}function rM(e,t){return t.some(n=>typeof n=="string"?n===e:n.test(e))}var L4="Prisma";function oM(e){z1(new of({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var M4=(e=>({name:L4,setupOnce(){oM(e)}})),sf=M4;import*as PE from"diagnostics_channel";var w4="node-redis:command",G4="node-redis:batch",U4="node-redis:connect",D4="ioredis:command",B4="ioredis:connect",OE="auto.db.redis.diagnostic_channel",xE="redis";function aM(e,t){iM(e,w4,n=>n.args.slice(1),t),H4(e,G4,n=>n.batchMode==="PIPELINE"?"PIPELINE":"MULTI"),sM(e,U4),iM(e,D4,n=>n.args,t),sM(e,B4)}function iM(e,t,n,r){ee(e(t),o=>{let i=n(o),s=i.length?`${o.command} ${i.join(" ")}`:o.command;return M({name:`redis-${o.command}`,attributes:{[S]:OE,[H]:"db.redis",[mt]:xE,[Ur]:s,...o.serverAddress!=null?{[_t]:o.serverAddress}:{},...o.serverPort!=null?{[ht]:o.serverPort}:{}}})},{beforeSpanEnd(o,i){"error"in i||F4(r,o,i.command,n(i),i.result)}})}function H4(e,t,n){ee(e(t),r=>M({name:n(r),attributes:{[S]:OE,[H]:"db.redis",[mt]:xE,...Number(r.batchSize)>1?{[ra]:r.batchSize}:{},...r.serverAddress!=null?{[_t]:r.serverAddress}:{},...r.serverPort!=null?{[ht]:r.serverPort}:{}}}))}function sM(e,t){ee(e(t),n=>M({name:"redis-connect",attributes:{[S]:OE,[H]:"db.redis.connect",[mt]:xE,...n.serverAddress!=null?{[_t]:n.serverAddress}:{},...n.serverPort!=null?{[ht]:n.serverPort}:{}}}))}function F4(e,t,n,r,o){if(e)try{e(t,n,r,o)}catch{}}var W4=((e={})=>({name:"Redis",setupOnce(){PE.tracingChannel&&ue(()=>{aM(PE.tracingChannel,e.responseHook)})}})),kE=W4;var V4=[{regex:/^ECHO/i,args:0},{regex:/^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i,args:1},{regex:/^(HSET|HMSET|LSET|LINSERT)/i,args:2},{regex:/^(ACL|BIT|B[LRZ]|CLIENT|CLUSTER|CONFIG|COMMAND|DECR|DEL|EVAL|EX|FUNCTION|GEO|GET|HINCR|HMGET|HSCAN|INCR|L[TRLM]|MEMORY|P[EFISTU]|RPOP|S[CDIMORSU]|XACK|X[CDGILPRT]|Z[CDILMPRS])/i,args:-1}],no=(e,t)=>{if(Array.isArray(t)&&t.length){let n=V4.find(({regex:o})=>o.test(e))?.args??0,r=n>=0?t.slice(0,n):t.slice();return t.length>r.length&&r.push(`[${t.length-n} other arguments]`),`${e} ${r.join(" ")}`}return e};function Fe(e){return typeof e=="string"?e:void 0}function af(e){return typeof e=="number"&&!isNaN(e)?e:void 0}function LE(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function cf(e){return V(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"}function lf(e,t,n){let r=e.getReader(),o={toolCalls:[]},i="",s=!1,c=()=>{s||(s=!0,i&&(o.text=i),t(o))},a=l=>{s||(s=!0,n(l))};return new ReadableStream({async pull(l){try{let{done:p,value:u}=await r.read();if(p){c(),l.close();return}i+=Y4(o,u)??"",l.enqueue(u)}catch(p){a(p),l.error(p)}},cancel(l){return c(),r.cancel(l)}})}function Y4(e,t){if(!V(t))return;let{type:n,delta:r,textDelta:o,id:i,modelId:s,toolCallId:c,toolName:a,input:l,args:p,finishReason:u,usage:d,providerMetadata:m}=t;switch(n){case"text-delta":{let _=r??o;return typeof _=="string"?_:void 0}case"tool-call":e.toolCalls.push({toolCallId:c,toolName:a,input:l??p});return;case"response-metadata":typeof i=="string"&&(e.responseId=i),typeof s=="string"&&(e.responseModel=s);return;case"finish":e.finishReason=u,e.usage=d,m!==void 0&&(e.providerMetadata=m);return;default:return}}var j4="ai:telemetry",lM="auto.vercelai.channel",Z4="gen_ai.tool.call.id",X4="gen_ai.tool.description",K4="embeddings",q4="rerank",Q4="generate_content",J4="WorkersAI",pM="vercel.ai.operationId",$4="vercel.ai.model.provider",z4="vercel.ai.settings.maxRetries",wE=new Map,pf=new Map,GE=new Map,uM=new Set(["generateText","streamText","generateObject","embed","embedMany","rerank"]);function UE(e){if(!uM.has(e.type))return;let t=Fe(e.event.callId);t&&DE(t)}function DE(e){wE.delete(e),pf.delete(e),GE.delete(e)}function eQ(e,t){if(uM.has(t))for(let n of md)delete e[n]}function tQ(e,t){if(!e||!Array.isArray(t))return;let n=pf.get(e);for(let r of t)V(r)&&typeof r.name=="string"&&typeof r.description=="string"&&(n=n??new Map,n.has(r.name)||n.set(r.name,r.description));n&&pf.set(e,n)}function nQ(e,t,n){let r=e?pf.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let o=n.find(i=>V(i)&&i.name===t);return V(o)?Fe(o.description):void 0}if(V(n)){let o=n[t];return V(o)?Fe(o.description):void 0}}function dM(e,t={}){ee(e(j4),n=>fp(n,t),{beforeSpanEnd:(n,r)=>{nc(n,r,t),UE(r)},deferSpanEnd:({data:n,end:r})=>rQ(n,t,r)})}function rQ(e,t,n){if(e.type!=="languageModelCall"||!V(e.result))return!1;let r=e.result,o=r.stream;if(!cf(o))return!1;let i=Fe(e.event.callId),{recordOutputs:s}=FE(e.event,t);return r.stream=lf(o,c=>{e.result={...r,...BE(c)},n(),oQ(i,c,s)},c=>n(c)),!0}function BE(e){let t=[];e.text&&t.push({type:"text",text:e.text});for(let n of e.toolCalls)t.push({type:"tool-call",...n});return{content:t,...e.usage!==void 0?{usage:e.usage}:{},...e.finishReason!==void 0?{finishReason:e.finishReason}:{},...e.providerMetadata!==void 0?{providerMetadata:e.providerMetadata}:{},...e.responseId||e.responseModel?{response:{...e.responseId?{id:e.responseId}:{},...e.responseModel?{modelId:e.responseModel}:{}}}:{}}}function oQ(e,t,n){let r=e?GE.get(e):void 0;if(!r)return;let o=V(t.usage)?t.usage:void 0;if(o){let i=Xn(o.inputTokens)??Xn(o.promptTokens)??Xn(o.tokens),s=Xn(o.outputTokens)??Xn(o.completionTokens);ME(r,zt,i),ME(r,Tt,s),ME(r,Lh,Xn(o.totalTokens)??LE(i,s))}if(n){let i=_M(t.text,t.toolCalls),s=fM(i,mM({finishReason:t.finishReason}));s&&r.setAttribute(kh,s)}}function ME(e,t,n){if(n===void 0)return;let r=ie(e).data[t];e.setAttribute(t,(typeof r=="number"?r:0)+n)}function fp(e,t){let{type:n,event:r}=e;if(n==="step"||!r||typeof r!="object")return;let{recordInputs:o,enableTruncation:i}=FE(r,t),s=Fe(r.provider),c=Fe(r.modelId),a=Fe(r.callId),l=af(r.maxRetries);o&&tQ(a,r.tools);let p={[S]:lM,...s?{[Qc]:s,[$4]:s}:{},...c?{[qc]:c}:{},...l!==void 0?{[z4]:l}:{}};switch(n){case"generateText":case"streamText":case"generateObject":return iQ(r,p,o,i,a,n==="streamText");case"languageModelCall":return vo([J4]),sQ(r,p,o,i,a,c);case"executeTool":return aQ(r,o);case"embed":case"embedMany":{let u=n==="embedMany"?r.values:r.value;return mp(K4,c,{...p,...o&&u!==void 0?{[qR]:Ge(u)}:{}})}case"rerank":return mp(q4,c,p);default:return}}function mp(e,t,n){return M({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[Nu]:e,...n}})}function iQ(e,t,n,r,o,i){let s=Fe(e.functionId),c=Fe(e.operationId)??(i?"ai.streamText":"ai.generateText");o&&wE.set(o,{operationId:c,isStream:i});let a=mp(W1,s,{...t,[pM]:c,[t0]:i,...s?{[QR]:s}:{},...n?hM(e,r):{}});return i&&o&&GE.set(o,a),a}function sQ(e,t,n,r,o,i){let s=o?wE.get(o):void 0,c=s?`${s.operationId}.${s.isStream?"doStream":"doGenerate"}`:"ai.generateText.doGenerate";return mp(Q4,i,{...t,[pM]:c,...n?hM(e,r):{},...n&&Array.isArray(e.tools)?{[$R]:Ge(e.tools)}:{}})}function aQ(e,t){let n=V(e.toolCall)?e.toolCall:{},r=Fe(n.toolName),o=Fe(e.toolCallId)??Fe(n.toolCallId),i=n.input??n.args,s=t&&r?nQ(Fe(e.callId),r,e.tools):void 0;return mp(F1,r,{[S]:lM,[i0]:"function",...r?{[r0]:r}:{},...o?{[Z4]:o}:{},...s?{[X4]:s}:{},...t&&i!==void 0?{[n0]:Ge(i)}:{}})}function nc(e,t,n){let{type:r,result:o}=t;if(!V(o))return;let{recordOutputs:i}=FE(t.event,n);if(r==="executeTool"){i&&e.setAttribute(o0,Ge(o.output??o));let m=V(o.output)?o.output:void 0;m?.type==="tool-error"&&HE(e,t,m.error);return}let s=V(o.usage)?o.usage:void 0;if(s){let m=Xn(s.inputTokens)??Xn(s.promptTokens)??Xn(s.tokens),_=Xn(s.outputTokens)??Xn(s.completionTokens),h=Xn(s.totalTokens)??LE(m,_);m!==void 0&&e.setAttribute(zt,m),_!==void 0&&e.setAttribute(Tt,_),h!==void 0&&e.setAttribute(Lh,h)}let c=mM(o);c&&r==="languageModelCall"&&e.setAttribute(Ct,Ge([c]));let a=V(o.response)?o.response:void 0,l=Fe(a?.id)??Fe(o.responseId);l&&e.setAttribute(zR,l);let p=Fe(a?.modelId)??Fe(t.event.modelId);p&&e.setAttribute(e0,p);let u=o.providerMetadata,d=dd(u);if(Hi in d&&ie(e).data[Hi]&&delete d[Hi],eQ(d,r),e.setAttributes(d),i){let m=r==="languageModelCall"&&Array.isArray(o.content)?lQ(o.content):_M(o.text,o.toolCalls),_=fM(m,c);_&&e.setAttribute(kh,_)}}function cQ(e){return e==="tool-calls"?"tool_call":e??"stop"}function mM(e){let t=e.finishReason;return typeof t=="string"?t:V(t)?Fe(t.unified):void 0}function Xn(e){return af(e)??(V(e)?af(e.total):void 0)}function fM(e,t){if(e.length)return Ge([{role:"assistant",parts:e,finish_reason:cQ(t)}])}function gM(e){let t=e.input??e.args;return{type:"tool_call",id:Fe(e.toolCallId),name:Fe(e.toolName),arguments:typeof t=="string"?t:Ge(t??{})}}function lQ(e){let t=[];for(let n of e)V(n)&&(n.type==="text"&&typeof n.text=="string"?t.push({type:"text",content:n.text}):n.type==="tool-call"&&t.push(gM(n)));return t}function _M(e,t){let n=[];if(typeof e=="string"&&e.length&&n.push({type:"text",content:e}),Array.isArray(t))for(let r of t)V(r)&&n.push(gM(r));return n}function HE(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:"tool_error"});let r=V(t.event.toolCall)?t.event.toolCall:{},o=Fe(r.toolName),i=Fe(t.event.toolCallId)??Fe(r.toolCallId);Be(s=>{s.setContext("trace",Lr(e)),o&&s.setTag("vercel.ai.tool.name",o),i&&s.setTag("vercel.ai.tool.callId",i),s.setLevel("error"),me(n instanceof Error?n:new Error(typeof n=="string"?n:"Tool execution failed"),{mechanism:{type:"auto.vercelai.channel",handled:!1}})})}function FE(e,t){let n=O()?.getDataCollectionOptions().genAI;return{recordInputs:cM(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:cM(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:ze(t.enableTruncation)}}function cM(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n===!0}function hM(e,t){let n={},r=Fe(e.instructions);r&&(n[en]=Ge([{type:"text",content:r}]));let o=e.messages??e.prompt;return o!==void 0&&(n[JR]=t?Wt(o):Ge(o),n[Ot]=Array.isArray(o)?o.length:1),n}import*as WE from"diagnostics_channel";var pQ=((e={})=>({name:"VercelAI",setupOnce(){WE.tracingChannel&&ue(()=>{dM(WE.tracingChannel,e)})}})),gp=pQ;import*as EM from"diagnostics_channel";var VE="@sentry/instrumentation-fastify",uQ=">=3.21.0 <6",TM="auto.http.otel.fastify",dQ="hook.fastify",IM="request_handler.fastify",AM=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],mi="hook.name",fi="fastify.type",gs="hook.callback.name",mQ="fastify.root",fQ="route-hook",rc="hook",NM="request-handler",gi="anonymous",Mo=Symbol("sentry fastify request span"),vM=Symbol("sentry fastify addHook original"),RM=Symbol("sentry fastify setNotFoundHandler original");function CM(e){return e.routeOptions?.url??e.routerPath}function OM(e){return e.routeOptions?.config??e.routeConfig}function gQ(e){return V(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||"routerPath"in e)}function xM(e,t,n){e.decorate(vM,e.addHook),e.decorate(RM,e.setNotFoundHandler),e.decorateRequest("opentelemetry",function(){return{span:this[Mo]}}),e.decorateRequest(Mo,null),e.addHook("onRoute",_Q),e.addHook("onRequest",hQ),e.addHook("onResponse",bQ),e.addHook=EQ,e.setNotFoundHandler=TQ,n()}var YE=xM;YE[Symbol.for("skip-override")]=!0;YE[Symbol.for("fastify.display-name")]=VE;YE[Symbol.for("plugin-meta")]={fastify:uQ,name:VE};function _Q(e){if(e.config?.otel!==!1){for(let t of AM){let n=e[t];typeof n=="function"?e[t]=_i(n,t,bM(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(r=>_i(r,t,bM(this.pluginName,t,r,e.url))))}e.onSend=yM(e.onSend,yQ),e.onError=yM(e.onError,SQ),e.handler=_i(e.handler,"handler",{[mi]:`${this.pluginName} - route-handler`,[fi]:NM,[He]:e.url,[gs]:e.handler.name.length>0?e.handler.name:gi})}}function bM(e,t,n,r){return{[mi]:`${e} - route -> ${t}`,[fi]:fQ,[He]:r,[gs]:n.name?.length>0?n.name:gi}}function yM(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function hQ(e,t,n){if(OM(e)?.otel===!1)return n();let r={[S]:TM,[mQ]:VE,[Hr]:e.method,[Qo]:e.url},o=CM(e);if(o!=null){r[He]=o;let s=Q(),c=s&&Re(s);c&&ie(c).data[H]==="http.server"&&c.setAttribute(He,o)}let i=M({name:"request",op:IM,attributes:r});e[Mo]=i,se(i,()=>{n()})}function bQ(e,t,n){let r=e[Mo];r!=null&&(r.setAttributes({[yn]:t.statusCode}),r.end()),e[Mo]=null,n()}function yQ(e,t,n,r){let o=e[Mo];o!=null&&(t.statusCode>=500&&o.setStatus({code:2}),o.setAttributes({[yn]:t.statusCode}),o.end()),e[Mo]=null,r(null,n)}function SQ(e,t,n,r){let o=e[Mo];o?.setStatus({code:2,message:n.message}),r()}function EQ(e,t){let n=this[vM];return AM.includes(e)?n.call(this,e,_i(t,e,{[mi]:`${this.pluginName} - ${e}`,[fi]:rc,[gs]:t.name?.length>0?t.name:gi})):n.call(this,e,t)}function TQ(e,t){let n=this[RM];if(typeof e=="function"){n.call(this,_i(e,"notFoundHandler",{[mi]:`${this.pluginName} - not-found-handler`,[fi]:rc,[gs]:e.name?.length>0?e.name:gi}));return}if(e.preValidation!=null&&(e.preValidation=_i(e.preValidation,"notFoundHandler - preValidation",{[mi]:`${this.pluginName} - not-found-handler - preValidation`,[fi]:rc,[gs]:e.preValidation.name?.length>0?e.preValidation.name:gi})),e.preHandler!=null&&(e.preHandler=_i(e.preHandler,"notFoundHandler - preHandler",{[mi]:`${this.pluginName} - not-found-handler - preHandler`,[fi]:rc,[gs]:e.preHandler.name?.length>0?e.preHandler.name:gi})),t==null){n.call(this,e);return}n.call(this,e,_i(t,"notFoundHandler",{[mi]:`${this.pluginName} - not-found-handler`,[fi]:rc,[gs]:t.name?.length>0?t.name:gi}))}function IQ(e){for(let t of e)if(gQ(t))return t;return null}function _i(e,t,n={}){return function(...o){let i=IQ(o);if(i===null||OM(i)?.otel===!1)return e.call(this,...o);let s=i[Mo]??void 0,c=e.name?.length>0?e.name:this.pluginName??gi,a=n[fi],l=a===rc?dQ:a===NM?IM:void 0,p=l?AQ(n[mi]):`${t} - ${c}`;return Se({name:p,op:l,attributes:{...n,[S]:TM},parentSpan:s},()=>e.call(this,...o))}}function AQ(e=""){return e.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"").replace(/^@sentry\/instrumentation-fastify -> /,"")}function NQ(e){e.addHook("onRequest",async(t,n)=>{let r=CM(t),o=t.method||"GET";J().setTransactionName(`${o} ${r}`)})}var SM=!1,PM=Object.assign(function(){SM||(SM=!0,EM.subscribe("fastify.initialization",t=>{let n=t.fastify;n?.register(xM).after(r=>{r?$&&g.error("Failed to setup Fastify instrumentation",r):n&&NQ(n)})}))},{id:"Fastify.v5"});var uf="Fastify";function df(e,t,n){let r=n.statusCode;return r>=500||r<=299}import*as kM from"diagnostics_channel";function vQ(){return O()?.getIntegrationByName(uf)}function LM(){kM.subscribe("tracing:fastify.request.handler:error",e=>{let{error:t,request:n,reply:r}=e;mf.call(mf,t,n,r,"diagnostics-channel")})}function mf(e,t,n,r){let o=vQ()?.getShouldHandleError()||df;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){$&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(e,t,n)&&me(e,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var RQ=(({shouldHandleError:e}={})=>{let t;return{name:uf,setupOnce(){t=e||df,LM(),PM()},getShouldHandleError(){return t},setShouldHandleError(n){t=n}}}),jE=RQ;var ff=mf;var CQ="db.mongodb.collection",OQ="db.name",xQ="db.user",PQ="net.peer.name",kQ="net.peer.port",LQ="db.operation",MQ="db.system";function wo({collection:e,modelName:t,operation:n,origin:r,parentSpan:o}){let i={[CQ]:e?.name,[OQ]:e?.conn?.name,[xQ]:e?.conn?.user,[PQ]:e?.conn?.host,[kQ]:e?.conn?.port,[LQ]:n,[MQ]:"mongoose",[S]:r};return M({name:`mongoose.${t}.${n}`,op:"db",kind:D.CLIENT,attributes:i,parentSpan:o})}var MM="Fastify",ZE=de(`${MM}.v3`,()=>new Jm);function wQ(){let e=O();if(e)return e.getIntegrationByName(MM)}var GQ=(e=>{let t=jE(e);return Bt(t,{setupOnce(){ZE()}})}),XE=(e={})=>GQ(e);function UQ(e,t){t?.shouldHandleError&&wQ()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(r,o,i){r.addHook("onError",async(s,c,a)=>{ff.call(ff,a,s,c,"onError-hook")}),i()},{[Symbol.for("skip-override")]:!0,[Symbol.for("fastify.display-name")]:"sentry-fastify-error-handler"});e.register(n)}import{normalize as DQ}from"path";var Ae=class{constructor(t,n,r,o){this.name=DQ(t),this.supportedVersions=n,this.patch=r,this.unpatch=o}};var KE=(e=>(e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription",e))(KE||{}),hi=(e=>(e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment",e))(hi||{}),Go=(e=>(e.EXECUTE="graphql.execute",e.PARSE="graphql.parse",e.RESOLVE="graphql.resolve",e.VALIDATE="graphql.validate",e.SCHEMA_VALIDATE="graphql.validateSchema",e.SCHEMA_PARSE="graphql.parseSchema",e))(Go||{});var Tn=(e=>(e.SOURCE="graphql.source",e.FIELD_NAME="graphql.field.name",e.FIELD_PATH="graphql.field.path",e.FIELD_TYPE="graphql.field.type",e.PARENT_NAME="graphql.parent.name",e.OPERATION_TYPE="graphql.operation.type",e.OPERATION_NAME="graphql.operation.name",e))(Tn||{});var _p=Symbol.for("opentelemetry.patched"),ro=Symbol.for("opentelemetry.graphql_data");var wM="Operation$operationName$not supported";var GM=Object.values(KE),qE=e=>typeof e?.then=="function";function gf(e,t,n,r){if(O()?.getDataCollectionOptions().graphQL.document===!0){let o=XQ(t,n,r);e.setAttribute(Tn.SOURCE,o)}}function BQ(e,t,n){let r=HM(e,n);if(r)return{field:r,spanAdded:!1};let o=WQ(e,n);return r={span:HQ(e,t,n,o)},FQ(e,n,r),{field:r,spanAdded:!0}}function HQ(e,t,n,r){let o={[Tn.FIELD_NAME]:t.fieldName,[Tn.FIELD_PATH]:n.join("."),[Tn.FIELD_TYPE]:t.returnType.toString(),[Tn.PARENT_NAME]:t.parentType.name},i=M({name:`${Go.RESOLVE} ${o[Tn.FIELD_PATH]}`,attributes:o,parentSpan:r}),s=e[ro].source,c=t.fieldNodes.find(a=>a.kind==="Field");return c&&gf(i,s.loc,c.loc?.start,c.loc?.end),i}function _s(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function QE(e,t){if(!(!e||!Array.isArray(e.definitions)))return t?e.definitions.filter(n=>GM.indexOf(n?.operation)!==-1).find(n=>t===n?.name?.value):e.definitions.find(n=>GM.indexOf(n?.operation)!==-1)}function FQ(e,t,n){return e[ro].fields[t.join(".")]=n}function HM(e,t){return e[ro].fields[t.join(".")]}function WQ(e,t){for(let n=t.length-1;n>0;n--){let r=HM(e,t.slice(0,n));if(r)return r.span}return VQ(e)}function VQ(e){return e[ro].span}function YQ(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function jQ(e){return FM(`
|
|
37
|
+
`,e)}function UM(e){return FM(" ",e)}function FM(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}var ZQ=[hi.FLOAT,hi.STRING,hi.INT,hi.BLOCK_STRING];function XQ(e,t,n){let r="";if(e?.startToken){let o=typeof t=="number"?t:e.start,i=typeof n=="number"?n:e.end,s=e.startToken.next,c=1;for(;s;){if(s.start<o){s=s.next,c=s?.line;continue}if(s.end>i){s=s.next,c=s?.line;continue}let a=s.value||s.kind,l="";ZQ.indexOf(s.kind)>=0&&(a="*"),s.kind===hi.STRING&&(a=`"${a}"`),s.kind===hi.EOF&&(a=""),s.line>c?(r+=jQ(s.line-c),c=s.line,l=UM(s.column-1)):s.line===s.prev?.line&&(l=UM(s.start-(s.prev?.end||0))),r+=l+a,s&&(s=s.next)}}return r}function _f(e,t){if(!e||e[_p])return;let n=e.getFields();e[_p]=!0,Object.keys(n).forEach(r=>{let o=n[r];if(o&&(o.resolve&&(o.resolve=JE(t,o.resolve)),o.type)){let i=WM(o.type);for(let s of i)_f(s,t)}})}function WM(e){return"ofType"in e?WM(e.ofType):KQ(e)?e.getTypes():qQ(e)?[e]:[]}function KQ(e){return"getTypes"in e&&typeof e.getTypes=="function"}function qQ(e){return"getFields"in e&&typeof e.getFields=="function"}var DM=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},BM=(e,t)=>{t&&e.end()};function JE(e,t,n=!1){if(r[_p]||typeof t!="function")return t;function r(o,i,s,c){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(V(o)||typeof o=="function")&&typeof o[c.fieldName]!="function")return t.call(this,o,i,s,c);if(!s[ro])return t.call(this,o,i,s,c);let l=YQ(c?.path),{field:p,spanAdded:u}=BQ(s,c,l),d=p.span,m=u;return se(d,()=>{try{let _=t.call(this,o,i,s,c);return qE(_)?_.then(h=>(BM(d,m),h),h=>{throw DM(d,h,m),h}):(BM(d,m),_)}catch(_){throw DM(d,_,m),_}})}return r[_p]=!0,r}var QQ="@sentry/instrumentation-graphql",JQ="auto.graphql.otel.graphql",VM={ignoreResolveSpans:!1},hf=[">=14.0.0 <17"],bf=class extends ae{constructor(t={}){super(QQ,q,{...VM,...t})}setConfig(t={}){super.setConfig({...VM,...t})}init(){let t=new re("graphql",hf);return t.files.push(this._addPatchingExecute()),t.files.push(this._addPatchingParser()),t.files.push(this._addPatchingValidate()),t}_addPatchingExecute(){return new Ae("graphql/execution/execute.js",hf,t=>(w(t.execute)&&this._unwrap(t,"execute"),this._wrap(t,"execute",this._patchExecute(t.defaultFieldResolver)),t),t=>{t&&this._unwrap(t,"execute")})}_addPatchingParser(){return new Ae("graphql/language/parser.js",hf,t=>(w(t.parse)&&this._unwrap(t,"parse"),this._wrap(t,"parse",this._patchParse()),t),t=>{t&&this._unwrap(t,"parse")})}_addPatchingValidate(){return new Ae("graphql/validation/validate.js",hf,t=>(w(t.validate)&&this._unwrap(t,"validate"),this._wrap(t,"validate",this._patchValidate()),t),t=>{t&&this._unwrap(t,"validate")})}_patchExecute(t){let n=this;return function(o){return function(){let s;if(arguments.length>=2){let l=arguments;s=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],t)}else{let l=arguments[0];s=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,t)}let c=QE(s.document,s.operationName),a=n._createExecuteSpan(c,s);return s.contextValue[ro]={source:s.document?s.document||s.document[ro]:void 0,span:a,fields:{}},se(a,()=>$r(()=>o.apply(this,[s]),(l,p)=>{n._handleExecutionResult(a,l,p)}))}}}_handleExecutionResult(t,n,r){if(r===void 0||n){_s(t,n);return}qE(r)?r.then(o=>{this._updateSpanFromResult(t,o),_s(t)},o=>{_s(t,o)}):(this._updateSpanFromResult(t,r),_s(t))}_updateSpanFromResult(t,n){if(n.errors?.length&&!ie(t).status&&t.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let r=ie(t).data,o=r[Tn.OPERATION_TYPE],i=r[Tn.OPERATION_NAME];if(!o)return;let s=Re(t),a=ie(s).data[us]||[],l=i?`${o} ${i}`:`${o}`;Array.isArray(a)?(a.push(l),s.setAttribute(us,a)):typeof a=="string"?s.setAttribute(us,[a,l]):s.setAttribute(us,l),ie(s).data["original-description"]||s.setAttribute("original-description",ie(s).description),s.updateName(`${ie(s).data["original-description"]} (${$Q(a)})`)}_patchParse(){let t=this;return function(r){return function(i,s){return t._parse(this,r,i,s)}}}_patchValidate(){let t=this;return function(r){return function(i,s,c,a,l){return t._validate(this,r,i,s,c,l,a)}}}_parse(t,n,r,o){let i=M({name:Go.PARSE});return se(i,()=>$r(()=>n.call(t,r,o),(s,c)=>{c&&(QE(c)?c.loc&&gf(i,c.loc):i.updateName(Go.SCHEMA_PARSE)),_s(i,s)}))}_validate(t,n,r,o,i,s,c){let a=M({name:Go.VALIDATE});return se(a,()=>$r(()=>n.call(t,r,o,i,c,s),(l,p)=>{o.loc||a.updateName(Go.SCHEMA_VALIDATE),_s(a,l)}))}_createExecuteSpan(t,n){let r=M({name:Go.EXECUTE,attributes:{[S]:JQ}});if(t){let{operation:o,name:i}=t;r.setAttribute(Tn.OPERATION_TYPE,o);let s=i?.value;s?(r.setAttribute(Tn.OPERATION_NAME,s),r.updateName(`${o} ${s}`)):r.updateName(o)}else{let o=" ";n.operationName&&(o=` "${n.operationName}" `),o=wM.replace("$operationName$",o),r.setAttribute(Tn.OPERATION_NAME,o)}return n.document?.loc&&gf(r,n.document.loc),r}_wrapExecuteArgs(t,n,r,o,i,s,c,a,l){if(o||(o={}),o[ro]||this.getConfig().ignoreResolveSpans)return{schema:t,document:n,rootValue:r,contextValue:o,variableValues:i,operationName:s,fieldResolver:c,typeResolver:a};let p=c==null;return c=JE(()=>this.getConfig(),c??l,p),t&&(_f(t.getQueryType(),()=>this.getConfig()),_f(t.getMutationType(),()=>this.getConfig())),{schema:t,document:n,rootValue:r,contextValue:o,variableValues:i,operationName:s,fieldResolver:c,typeResolver:a}}};function $Q(e){if(Array.isArray(e)){let t=e.slice().sort();return t.length<=5?t.join(", "):`${t.slice(0,5).join(", ")}, +${t.length-5}`}return`${e}`}var YM="Graphql",zE=de(YM,bf,e=>$E(e)),zQ=((e={})=>Bt(lp($E(e)),{name:YM,setupOnce(){zE($E(e))}})),eT=zQ;function $E(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var oc="messaging.destination.partition.id",tT="messaging.kafka.message.key",nT="messaging.kafka.message.tombstone",jM="messaging.kafka.offset",rT="process",hp="receive",ZM="send",oT="kafka",XM="_OTHER";at();var eJ="auto.kafkajs.otel.producer",tJ="auto.kafkajs.otel.consumer";function bp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function KM(e){let t=bp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:o}=Nn(t,bp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:o?vr.SAMPLED:vr.NONE}}]}function yf({topic:e,message:t,operationType:n,links:r,attributes:o}){let i=n===hp?"poll":n;return M({name:`${i} ${e}`,kind:n===hp?D.CLIENT:D.CONSUMER,links:r,attributes:{...o,[Ut]:oT,[On]:e,[pr]:n,[aa]:i,[tT]:t?.key?String(t.key):void 0,[nT]:t?.key&&t.value===null?!0:void 0,[jM]:t?.offset,...t?{[S]:tJ}:{}}})}function iT(e,t){let n=M({name:`send ${e}`,kind:D.PRODUCER,attributes:{[Ut]:oT,[On]:e,[tT]:t.key?String(t.key):void 0,[nT]:t.key&&t.value===null?!0:void 0,[oc]:t.partition!==void 0?String(t.partition):void 0,[aa]:"send",[pr]:ZM,[S]:eJ}});t.headers=t.headers??{};let r=$e({span:n});return r["sentry-trace"]&&(t.headers["sentry-trace"]=r["sentry-trace"]),r.baggage&&(t.headers.baggage=r.baggage),n}function hs(e,t){return Promise.resolve(t).catch(n=>{let r,o=XM;throw typeof n=="string"||n===void 0?r=n:typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"message")&&(r=n.message,o=n.constructor.name),e.forEach(i=>{i.setAttribute(Dr,o),i.setStatus({code:2,message:r})}),n}).finally(()=>{e.forEach(n=>n.end())})}var nJ="@sentry/instrumentation-kafkajs",Sf=class extends ae{constructor(t={}){super(nJ,q,t)}init(){let t=r=>{w(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),w(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new re("kafkajs",[">=0.3.0 <3"],r=>(t(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),t)}_getConsumerPatch(){let t=this;return n=>function(...o){let i=n.apply(this,o);return w(i.run)&&t._unwrap(i,"run"),t._wrap(i,"run",t._getConsumerRunPatch()),i}}_getProducerPatch(){let t=this;return n=>function(...o){let i=n.apply(this,o);return w(i.sendBatch)&&t._unwrap(i,"sendBatch"),t._wrap(i,"sendBatch",t._getSendBatchPatch()),w(i.send)&&t._unwrap(i,"send"),t._wrap(i,"send",t._getSendPatch()),w(i.transaction)&&t._unwrap(i,"transaction"),t._wrap(i,"transaction",t._getProducerTransactionPatch()),i}}_getConsumerRunPatch(){let t=this;return n=>function(...o){let i=o[0];return i?.eachMessage&&(w(i.eachMessage)&&t._unwrap(i,"eachMessage"),t._wrap(i,"eachMessage",t._getConsumerEachMessagePatch())),i?.eachBatch&&(w(i.eachBatch)&&t._unwrap(i,"eachBatch"),t._wrap(i,"eachBatch",t._getConsumerEachBatchPatch())),n.call(this,i)}}_getConsumerEachMessagePatch(){return t=>function(...r){let o=r[0],i=bp(o.message.headers,"sentry-trace"),s=bp(o.message.headers,"baggage");return vn({sentryTrace:i,baggage:s},()=>{let c=yf({topic:o.topic,message:o.message,operationType:rT,attributes:{[oc]:String(o.partition)}}),a=se(c,()=>t.apply(this,r));return hs([c],a)})}}_getConsumerEachBatchPatch(){return t=>function(...r){let o=r[0],i=Rn(()=>yf({topic:o.batch.topic,message:void 0,operationType:hp,attributes:{[ia]:o.batch.messages.length,[oc]:String(o.batch.partition)}}));return se(i,()=>{let s=[i];o.batch.messages.forEach(a=>{s.push(yf({topic:o.batch.topic,message:a,operationType:rT,links:KM(a.headers),attributes:{[oc]:String(o.batch.partition)}}))});let c=t.apply(this,r);return hs(s,c)})}}_getProducerTransactionPatch(){let t=this;return n=>function(...o){let i=M({name:"transaction"}),s=n.apply(this,o);return s.then(c=>{let a=c.send;c.send=function(...m){return se(i,()=>t._getSendPatch()(a).apply(this,m).catch(h=>{throw i.setStatus({code:2,message:h?.message}),h}))};let l=c.sendBatch;c.sendBatch=function(...m){return se(i,()=>t._getSendBatchPatch()(l).apply(this,m).catch(h=>{throw i.setStatus({code:2,message:h?.message}),h}))};let p=c.commit;c.commit=function(...m){let _=p.apply(this,m).then(()=>{i.setStatus({code:1})});return hs([i],_)};let u=c.abort;c.abort=function(...m){let _=u.apply(this,m);return hs([i],_)}}).catch(c=>{i.setStatus({code:2,message:c?.message}),i.end()}),s}}_getSendBatchPatch(){return t=>function(...r){let i=r[0].topicMessages||[],s=[];i.forEach(a=>{a.messages.forEach(l=>{s.push(iT(a.topic,l))})});let c=t.apply(this,r);return hs(s,c)}}_getSendPatch(){return t=>function(...r){let o=r[0],i=o.messages.map(c=>iT(o.topic,c)),s=t.apply(this,r);return hs(i,s)}}};var qM="Kafka",sT=de(qM,()=>new Sf),rJ=(()=>({name:qM,setupOnce(){sT()}})),aT=rJ;var oJ="@sentry/instrumentation-lru-memoizer",Ef=class extends ae{constructor(){super(oJ,q,{})}init(){return[new re("lru-memoizer",[">=1.3 <4"],t=>Object.assign(function(...r){let o=t.apply(this,r);return function(...i){let s=i.pop(),c=ne(),a=typeof s=="function"?function(...l){return Be(c,()=>s.apply(this,l))}:s;return o.apply(this,[...i,a])}},{sync:t.sync}),void 0)]}};var QM="LruMemoizer",cT=de(QM,()=>new Ef),iJ=(()=>({name:QM,setupOnce(){cT()}})),lT=iJ;var JM="auto.db.otel.mongo";function pT(e,t,n,r){return pp(e,t,n,r,JM)}function yp(e,t,n,r){return dp(e,t,n,r,JM)}function bs(e,t){let n=Q(),r=!1;return function(...i){if(!r){r=!0;let s=i[0];e&&(s instanceof Error&&e.setStatus({code:2,message:s.message}),e.end())}return se(n??null,()=>t.apply(this,i))}}function ys(){return!Q()}function Tf(e){return t=>function(r,o,i,s,c){let a=typeof s=="function"?s:c;if(ys()||typeof a!="function"||typeof i!="object")return typeof s=="function"?t.call(this,r,o,i,s):t.call(this,r,o,i,s,c);let l=yr(yp(o,r,i[0],e)),p=bs(l,a);return typeof s=="function"?t.call(this,r,o,i,p):t.call(this,r,o,i,s,p)}}function $M(){return e=>function(n,r,o,i,s){let c=typeof i=="function"?i:s;if(ys()||typeof c!="function"||typeof o!="object")return typeof i=="function"?e.call(this,n,r,o,i):e.call(this,n,r,o,i,s);let a=up(o),l=yr(yp(r,n,o,a)),p=bs(l,c);return typeof i=="function"?e.call(this,n,r,o,p):e.call(this,n,r,o,i,p)}}function zM(){return e=>function(n,r,o,i){let s=i,c=Object.keys(r)[0];if(typeof r!="object"||r.ismaster||r.hello)return e.call(this,n,r,o,i);let a;ys()||(a=yr(pT(this,n,r,c)));let l=bs(a,s);return e.call(this,n,r,o,l)}}function ew(){return e=>function(...n){let[r,o]=n,i=Object.keys(o)[0],s=()=>{};if(typeof o!="object"||o.ismaster||o.hello)return e.apply(this,n);let c;ys()||(c=yr(pT(this,r,o,i)));let a=bs(c,s),l=e.apply(this,n);return l.then(p=>a(null,p),p=>a(p)),l}}function tw(){return e=>function(n,r,o,i,s,c){let a=typeof s=="function"?s:c;if(ys()||typeof a!="function"||typeof o!="object")return typeof s=="function"?e.call(this,n,r,o,i,s):e.call(this,n,r,o,i,s,c);let l=yr(yp(r,n,o,"find")),p=bs(l,a);return typeof s=="function"?e.call(this,n,r,o,i,p):e.call(this,n,r,o,i,s,p)}}function nw(){return e=>function(n,r,o,i,s,c){let a=typeof s=="function"?s:c;if(ys()||typeof a!="function")return typeof s=="function"?e.call(this,n,r,o,i,s):e.call(this,n,r,o,i,s,c);let l=yr(yp(r,n,o.cmd,"getMore")),p=bs(l,a);return typeof s=="function"?e.call(this,n,r,o,i,p):e.call(this,n,r,o,i,s,p)}}function rw(){return e=>function(n){let r=Q();return e.call(this,function(...o){return se(r??null,()=>n.apply(this,o))})}}var sJ="@sentry/instrumentation-mongodb",If=class extends ae{constructor(t={}){super(sJ,q,t)}init(){let{v3PatchConnection:t,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnectionCallback:r,v4PatchConnectionPromise:o,v4UnpatchConnection:i}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:s,v4UnpatchConnectionPool:c}=this._getV4ConnectionPoolPatches();return[new re("mongodb",[">=3.3.0 <4"],void 0,void 0,[new Ae("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],t,n)]),new re("mongodb",[">=4.0.0 <8"],void 0,void 0,[new Ae("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],r,i),new Ae("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],o,i),new Ae("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],s,c)])]}_getV3ConnectionPatches(){return{v3PatchConnection:t=>(w(t.insert)&&this._unwrap(t,"insert"),this._wrap(t,"insert",Tf("insert")),w(t.remove)&&this._unwrap(t,"remove"),this._wrap(t,"remove",Tf("remove")),w(t.update)&&this._unwrap(t,"update"),this._wrap(t,"update",Tf("update")),w(t.command)&&this._unwrap(t,"command"),this._wrap(t,"command",$M()),w(t.query)&&this._unwrap(t,"query"),this._wrap(t,"query",tw()),w(t.getMore)&&this._unwrap(t,"getMore"),this._wrap(t,"getMore",nw()),t),v3UnpatchConnection:t=>{t!==void 0&&(this._unwrap(t,"insert"),this._unwrap(t,"remove"),this._unwrap(t,"update"),this._unwrap(t,"command"),this._unwrap(t,"query"),this._unwrap(t,"getMore"))}}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:t=>{let n=t.ConnectionPool.prototype;return w(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",rw()),t},v4UnpatchConnectionPool:t=>{t!==void 0&&this._unwrap(t.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:t=>(w(t.Connection.prototype.command)&&this._unwrap(t.Connection.prototype,"command"),this._wrap(t.Connection.prototype,"command",zM()),t),v4PatchConnectionPromise:t=>(w(t.Connection.prototype.command)&&this._unwrap(t.Connection.prototype,"command"),this._wrap(t.Connection.prototype,"command",ew()),t),v4UnpatchConnection:t=>{t!==void 0&&this._unwrap(t.Connection.prototype,"command")}}}};var ow="Mongo",uT=de(ow,()=>new If),aJ=(()=>({name:ow,setupOnce(){uT()}})),dT=aJ;function iw(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
|
|
38
|
+
Mongoose Error Code: ${t.code}`:""}`})}function sw(e,t){return e instanceof Promise?e.catch(n=>{throw iw(t,n),n}).finally(()=>t.end()):(t.end(),e)}function aw(e,t,n,r,o){let i=0;return o.length===2?i=1:o.length===3&&(i=2),o[i]=(s,c)=>(s&&iw(r,s),r.end(),e(s,c)),t.apply(n,o)}var cJ="@sentry/instrumentation-mongoose",Sp="auto.db.otel.mongoose",vf=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],lJ=["remove","count","findOneAndRemove",...vf],pJ=["count","findOneAndRemove",...vf],uJ=[...vf];function cw(e){return e?e.startsWith("6.")||e.startsWith("5.")?lJ:e.startsWith("7.")?pJ:uJ:vf}function lw(e){return e&&(e.startsWith("5.")||e.startsWith("6."))||!1}function pw(e){return!e||!e.startsWith("8.")?!1:parseInt(e.split(".")[1],10)>=21}var Af=Symbol("stored-parent-span"),uw=Symbol("already-instrumented"),Nf=class extends ae{constructor(t={}){super(cJ,q,t)}init(){return new re("mongoose",[">=5.9.7 <9.7.0"],this.patch.bind(this),this.unpatch.bind(this))}patch(t,n){let r=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save")),r.Model.prototype.$save=r.Model.prototype.save,lw(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove")),pw(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne")),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne"))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec()),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec()),cw(n).forEach(i=>{this._wrap(r.Query.prototype,i,this.patchAndCaptureSpanContext(i))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany")),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite")),r}unpatch(t,n){let r=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t,o=cw(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,lw(n)&&this._unwrap(r.Model.prototype,"remove"),pw(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(i=>{this._unwrap(r.Query.prototype,i)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(){let t=this;return n=>function(o){let i=this[Af],s=wo({collection:this._model.collection,modelName:this._model?.modelName,operation:"aggregate",origin:Sp,parentSpan:i});return t._handleResponse(s,n,this,arguments,o)}}patchQueryExec(){let t=this;return n=>function(o){if(this[uw])return n.apply(this,arguments);let i=this[Af],s=wo({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:Sp,parentSpan:i});return t._handleResponse(s,n,this,arguments,o)}}patchOnModelMethods(t){let n=this;return r=>function(i,s){let c=wo({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Sp});return i instanceof Function&&(s=i),n._handleResponse(c,r,this,arguments,s)}}_patchDocumentUpdateMethods(t){let n=this;return r=>function(i,s,c){let a=c;typeof i=="function"?a=i:typeof s=="function"&&(a=s);let l=wo({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:Sp}),p=n._handleResponse(l,r,this,arguments,a);return p&&typeof p=="object"&&(p[uw]=!0),p}}patchModelStatic(t){let n=this;return r=>function(i,s,c){typeof s=="function"&&(c=s);let a=wo({collection:this.collection,modelName:this.modelName,operation:t,origin:Sp});return n._handleResponse(a,r,this,arguments,c)}}patchModelAggregate(){return t=>function(){let r=Q(),o=t.apply(this,arguments);return o&&(o[Af]=r),o}}patchAndCaptureSpanContext(t){return n=>function(){return this[Af]=Q(),n.apply(this,arguments)}}_handleResponse(t,n,r,o,i){return se(t,()=>{if(i instanceof Function)return aw(i,n,r,t,o);{let s=n.apply(r,o);return sw(s,t)}})}};var dw="Mongoose",mT=de(dw,()=>new Nf),dJ=(()=>Bt(EE(),{name:dw,setupOnce(){mT()}})),fT=dJ;var mw="db.connection_string",fw="mysql";function gw(e){let t=e?.connectionConfig||e||{},{host:n,port:r,database:o,user:i}=t;return{host:n,port:r,database:o,user:i}}function _w(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function hw(e){return typeof e=="string"?e:e.sql}function bw(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var mJ="@sentry/instrumentation-mysql",fJ="auto.db.otel.mysql",Rf=class extends ae{constructor(t={}){super(mJ,q,t)}init(){return[new re("mysql",[">=2.0.0 <3"],t=>(w(t.createConnection)&&this._unwrap(t,"createConnection"),this._wrap(t,"createConnection",this._patchCreateConnection()),w(t.createPool)&&this._unwrap(t,"createPool"),this._wrap(t,"createPool",this._patchCreatePool()),w(t.createPoolCluster)&&this._unwrap(t,"createPoolCluster"),this._wrap(t,"createPoolCluster",this._patchCreatePoolCluster()),t),t=>{t!==void 0&&(this._unwrap(t,"createConnection"),this._unwrap(t,"createPool"),this._unwrap(t,"createPoolCluster"))})]}_patchCreateConnection(){return t=>{let n=this;return function(o){let i=t(...arguments);return n._wrap(i,"query",n._patchQuery(i)),i}}}_patchCreatePool(){return t=>{let n=this;return function(o){let i=t(...arguments);return n._wrap(i,"query",n._patchQuery(i)),n._wrap(i,"getConnection",n._patchGetConnection(i)),i}}}_patchCreatePoolCluster(){return t=>{let n=this;return function(o){let i=t(...arguments);return n._wrap(i,"getConnection",n._patchGetConnection(i)),i}}}_patchGetConnection(t){return n=>{let r=this;return function(i,s,c){if(!r._enabled)return r._unwrap(t,"getConnection"),n.apply(t,arguments);if(arguments.length===1&&typeof i=="function"){let a=r._getConnectionCallbackPatchFn(i);return n.call(t,a)}if(arguments.length===2&&typeof s=="function"){let a=r._getConnectionCallbackPatchFn(s);return n.call(t,i,a)}if(arguments.length===3&&typeof c=="function"){let a=r._getConnectionCallbackPatchFn(c);return n.call(t,i,s,a)}return n.apply(t,arguments)}}}_getConnectionCallbackPatchFn(t){let n=this,r=ne();return function(o,i){i&&(w(i.query)||n._wrap(i,"query",n._patchQuery(i))),typeof t=="function"&&Be(r,()=>t.call(this,o,i))}}_patchQuery(t){return n=>{let r=this;return function(o,i,s){if(!r._enabled)return r._unwrap(t,"query"),n.apply(t,arguments);let{host:c,port:a,database:l,user:p}=gw(t.config),u=parseInt(String(a),10),d={[S]:fJ,[Pe]:fw,[mw]:_w(c,a,l),[Et]:l,[Gt]:p,[Ve]:hw(o),[Le]:c};isNaN(u)||(d[xe]=u);let m=M({name:bw(o),kind:D.CLIENT,attributes:d}),_=Array.from(arguments).findIndex(b=>typeof b=="function"),h=ne();if(_===-1){let b=se(m,()=>n.apply(t,arguments));return bn(b,h),b.on("error",N=>{m.setStatus({code:2,message:N.message})}).on("end",()=>{m.end()})}else return r._wrap(arguments,_,r._patchCallbackQuery(m,h)),se(m,()=>n.apply(t,arguments))}}}_patchCallbackQuery(t,n){return r=>function(o,i,s){return o&&t.setStatus({code:2,message:o.message}),t.end(),Be(n,()=>r(...arguments))}}};var yw="Mysql",gT=de(yw,()=>new Rf({})),gJ=(()=>({name:yw,setupOnce(){gT()}})),_T=gJ;var Sw="db.connection_string",Ew="mysql";function Tw(e){let{host:t,port:n,database:r,user:o}=_J(e),i={[Sw]:hJ(t,n,r),[Et]:r,[Gt]:o,[Le]:t},s=parseInt(n,10);return isNaN(s)||(i[xe]=s),i}function _J(e){let{host:t,port:n,database:r,user:o}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:o}}function hJ(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function Iw(e,t,n){let[r,o]=typeof e=="string"?[e,n]:[e.sql,bJ(e)?n||e.values:n];try{return t&&o?t(r,o):r}catch{return"Could not determine the query due to an error in formatting"}}function bJ(e){return"values"in e}function Aw(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var Nw=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function hT(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:t}var yJ="@sentry/instrumentation-mysql2",SJ="auto.db.otel.mysql2",bT=[">=1.4.2 <3.20.0"],Cf=class extends ae{constructor(t={}){super(yJ,q,t)}init(){let t;function n(i){!t&&i.format&&(t=i.format)}let r=i=>{w(i.query)&&this._unwrap(i,"query"),this._wrap(i,"query",this._patchQuery(t)),w(i.execute)&&this._unwrap(i,"execute"),this._wrap(i,"execute",this._patchQuery(t))},o=i=>{this._unwrap(i,"query"),this._unwrap(i,"execute")};return[new re("mysql2",bT,i=>(n(i),i),()=>{},[new Ae("mysql2/promise.js",bT,i=>(n(i),i),()=>{}),new Ae("mysql2/lib/connection.js",bT,i=>{let s=hT(i);return r(s),i},i=>{if(i===void 0)return;let s=hT(i);o(s)})])]}_patchQuery(t){let n=this;return r=>function(o,i,s){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let a={...Tw(this.config),[Pe]:Ew,[Ve]:Iw(o,t,c),[S]:SJ},l=M({name:Aw(o),kind:D.CLIENT,attributes:a}),p=Nw(u=>{u&&l.setStatus({code:2,message:u.message}),l.end()});if(arguments.length===1){typeof o.onResult=="function"&&n._wrap(o,"onResult",n._patchCallbackQuery(p));let u=r.apply(this,arguments);return u.once("error",d=>{p(d)}).once("result",()=>{p()}),u}return typeof arguments[1]=="function"?n._wrap(arguments,1,n._patchCallbackQuery(p)):typeof arguments[2]=="function"&&n._wrap(arguments,2,n._patchCallbackQuery(p)),r.apply(this,arguments)}}_patchCallbackQuery(t){return n=>function(...r){return t(r[0]),n(...r)}}};var vw="Mysql2",yT=de(vw,()=>new Cf),EJ=(()=>Bt(AE(),{name:vw,setupOnce(){yT()}})),ST=EJ;import*as Ww from"diagnostics_channel";var Of,Rw;function Cw(e){Of=e}function ic(){return!!Of}function ET(){if(Of)return Rw??(Rw=Of())}var TJ=["get","set","setex"],TT=["get","mget"],IJ=["set","setex"],IT=["del","unlink"];function Ss(e,t){return e.includes(t.toLowerCase())}function AT(e){return Ss(TT,e)?"cache.get":Ss(IJ,e)?"cache.put":Ss(IT,e)?"cache.remove":void 0}function AJ(e,t){return t.some(n=>e.startsWith(n))}function xw(e,t){try{if(t.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?Ow(o.map(i=>n(i))):["<unknown>"],r=t[0];return Ss(TJ,e)&&r!=null?n(r):Ow(t.map(o=>n(o)))}catch{return}}function Pw(e,t,n){if(!AT(e))return!1;for(let r of t)if(AJ(r,n))return!0;return!1}function kw(e){let t=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(e)?e.reduce((n,r)=>{let o=t(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):t(e)}function Ow(e){let t=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):t.push(o)})};return n(e),t}var Ep={};function Lw(e){Ep=e}var Es=(e,t,n,r)=>{let o=xw(t,n),i=AT(t);if(!o||!i||!Ep.cachePrefixes||!Pw(t,o,Ep.cachePrefixes))return;let s=ie(e).data,c=s["net.peer.name"]??s["server.address"],a=s["net.peer.port"]??s["server.port"];a&&c&&e.setAttributes({"network.peer.address":c,"network.peer.port":a});let l=Ss(IT,t)?void 0:kw(r);l&&e.setAttribute($_,l),Ss(TT,t)&&l!==void 0&&e.setAttribute(Q_,l>0),e.setAttributes({[H]:i,[J_]:o});let p=o.join(", ");e.updateName(Ep.maxCacheKeyLength?gn(p,Ep.maxCacheKeyLength):p)};var sc="db.connection_string",ac="redis";var NJ="@sentry/instrumentation-ioredis",Mw="auto.db.otel.redis",vJ=[">=2.0.0 <5.11.0"];function Ts(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var xf=class extends ae{constructor(t={}){super(NJ,q,t)}init(){return[new re("ioredis",vJ,t=>{let n=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;return w(n.prototype.sendCommand)&&this._unwrap(n.prototype,"sendCommand"),this._wrap(n.prototype,"sendCommand",this._patchSendCommand()),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"connect",this._patchConnection()),t},t=>{if(t===void 0)return;let n=t[Symbol.toStringTag]==="Module"&&t.default?t.default:t;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(){let t=this;return n=>function(...r){let o=r[0];if(r.length<1||typeof o!="object"||!Q())return n.apply(this,r);let{host:i,port:s}=this.options,c={[Pe]:ac,[Ve]:no(o.name,o.args),[sc]:`redis://${i}:${s}`,[Le]:i,[xe]:s,[S]:Mw},a=M({name:o.name,kind:D.CLIENT,attributes:c});try{let l=n.apply(this,r),p=o.resolve;o.resolve=function(d){t._callResponseHook(a,o,d),Ts(a,null),p(d)};let u=o.reject;return o.reject=function(d){Ts(a,d),u(d)},l}catch(l){throw Ts(a,l),l}}}_patchConnection(){return t=>function(...n){if(!Q())return t.apply(this,n);let{host:r,port:o}=this.options,i={[Pe]:ac,[Ve]:"connect",[sc]:`redis://${r}:${o}`,[Le]:r,[xe]:o,[S]:Mw},s=M({name:"connect",kind:D.CLIENT,attributes:i});try{let c=t.apply(this,n);return c instanceof Promise?c.then(a=>(Ts(s,null),a),a=>(Ts(s,a),Promise.reject(a))):(Ts(s,null),c)}catch(c){throw Ts(s,c),c}}}_callResponseHook(t,n,r){let{responseHook:o}=this.getConfig();if(o)try{o(t,n.name,n.args,r)}catch{}}};var vT="@sentry/instrumentation-redis",Uw="auto.db.otel.redis",Tp=Symbol("opentelemetry.instrumentation.redis.open_spans"),ww=Symbol("opentelemetry.instrumentation.redis.multi_command_options");function Pf(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function Dw(e,t,n,r,o){if(e)try{e(t,n,r,o)}catch{}}function RJ(e){if(!(typeof e!="string"||!e))try{let t=new URL(e);return t.searchParams.delete("user_pwd"),t.username="",t.password="",t.href}catch(t){Ye&&g.error("failed to sanitize redis connection url",t)}}function Gw(e){return{[Pe]:ac,[Le]:e?.socket?.host,[xe]:e?.socket?.port,[sc]:RJ(e?.url),[S]:Uw}}var Bw=class Hw extends ae{constructor(t={}){super(vT,q,t)}init(){return[new re("redis",[">=2.6.0 <4"],t=>(w(t.RedisClient.prototype.internal_send_command)&&this._unwrap(t.RedisClient.prototype,"internal_send_command"),this._wrap(t.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),t),t=>{t!==void 0&&this._unwrap(t.RedisClient.prototype,"internal_send_command")})]}_getPatchInternalSendCommand(){let t=this;return function(r){return function(i){if(arguments.length!==1||typeof i!="object")return r.apply(this,arguments);let s={[Pe]:ac,[Ve]:no(i.command,i.args),[S]:Uw};this.connection_options&&(s[Le]=this.connection_options.host,s[xe]=this.connection_options.port),this.address&&(s[sc]=`redis://${this.address}`);let c=M({name:`${Hw.COMPONENT}-${i.command}`,kind:D.CLIENT,attributes:s}),a=arguments[0].callback;if(a){let l=Q();arguments[0].callback=function(u,d){return Dw(t.getConfig().responseHook,c,i.command,i.args,d),Pf(c,u),se(l??null,()=>a.apply(this,arguments))}}try{return r.apply(this,arguments)}catch(l){throw Pf(c,l),l}}}}};Bw.COMPONENT="redis";var CJ=Bw,Fw=class NT extends ae{constructor(t={}){super(vT,q,t)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(t){let n=new Ae(`${t}/dist/lib/commander.js`,["^1.0.0"],(i,s)=>{let c=i.transformCommandArguments;if(!c)return Ye&&g.error("internal instrumentation error, missing transformCommandArguments function"),i;let a=s?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return w(i?.[a])&&this._unwrap(i,a),this._wrap(i,a,this._getPatchExtendWithCommands(c)),i},i=>{w(i?.extendWithCommands)&&this._unwrap(i,"extendWithCommands"),w(i?.attachCommands)&&this._unwrap(i,"attachCommands")}),r=new Ae(`${t}/dist/lib/client/multi-command.js`,["^1.0.0",">=5.0.0 <5.12.0"],i=>{let s=i?.default?.prototype;return w(s?.exec)&&this._unwrap(s,"exec"),this._wrap(s,"exec",this._getPatchMultiCommandsExec()),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),this._wrap(s,"execAsPipeline",this._getPatchMultiCommandsExec()),w(s?.addCommand)&&this._unwrap(s,"addCommand"),this._wrap(s,"addCommand",this._getPatchMultiCommandsAddCommand()),i},i=>{let s=i?.default?.prototype;w(s?.exec)&&this._unwrap(s,"exec"),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),w(s?.addCommand)&&this._unwrap(s,"addCommand")}),o=new Ae(`${t}/dist/lib/client/index.js`,["^1.0.0",">=5.0.0 <5.12.0"],i=>{let s=i?.default?.prototype;return s?.multi&&(w(s?.multi)&&this._unwrap(s,"multi"),this._wrap(s,"multi",this._getPatchRedisClientMulti())),s?.MULTI&&(w(s?.MULTI)&&this._unwrap(s,"MULTI"),this._wrap(s,"MULTI",this._getPatchRedisClientMulti())),w(s?.sendCommand)&&this._unwrap(s,"sendCommand"),this._wrap(s,"sendCommand",this._getPatchRedisClientSendCommand()),w(s?.connect)&&this._unwrap(s,"connect"),this._wrap(s,"connect",this._getPatchedClientConnect()),i},i=>{let s=i?.default?.prototype;w(s?.multi)&&this._unwrap(s,"multi"),w(s?.MULTI)&&this._unwrap(s,"MULTI"),w(s?.sendCommand)&&this._unwrap(s,"sendCommand"),w(s?.connect)&&this._unwrap(s,"connect")});return new re(t,["^1.0.0",">=5.0.0 <5.12.0"],i=>i,()=>{},[n,r,o])}_getPatchExtendWithCommands(t){let n=this;return function(o){return function(s){if(s?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let c=s.executor;return s.executor=function(a,l){let p=t(a,l).args;return n._traceClientCommand(c,this,arguments,p)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let t=this;return function(r){return function(){let i=r.apply(this,arguments);return typeof i?.then!="function"?(Ye&&g.error("non-promise result when patching exec/execAsPipeline"),i):i.then(s=>{let c=this[Tp];return t._endSpansWithRedisReplies(c,s),s}).catch(s=>{let c=this[Tp];if(!c)Ye&&g.error("cannot find open spans to end for multi/pipeline");else{let a=s.constructor.name==="MultiErrorReply"?s.replies:new Array(c.length).fill(s);t._endSpansWithRedisReplies(c,a)}return Promise.reject(s)})}}}_getPatchMultiCommandsAddCommand(){let t=this;return function(r){return function(i){return t._traceClientCommand(r,this,arguments,i)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[ww]=this.options,o}}}_getPatchRedisClientSendCommand(){let t=this;return function(r){return function(i){return t._traceClientCommand(r,this,arguments,i)}}}_getPatchedClientConnect(){return function(n){return function(){let o=Gw(this.options),i=M({name:`${NT.COMPONENT}-connect`,kind:D.CLIENT,attributes:o});return se(i,()=>n.apply(this)).then(c=>(i.end(),c),c=>(Pf(i,c),Promise.reject(c)))}}}_traceClientCommand(t,n,r,o){let i=n.options||n[ww],s=o[0],c=o.slice(1),a=Gw(i),l=no(s,c);l!=null&&(a[Ve]=l);let p=M({name:`${NT.COMPONENT}-${s}`,kind:D.CLIENT,attributes:a}),u=se(p,()=>t.apply(n,r));if(u instanceof Promise)u.then(d=>{this._endSpanWithResponse(p,s,c,d,void 0)},d=>{this._endSpanWithResponse(p,s,c,null,d)});else{let d=u;d[Tp]=d[Tp]||[],d[Tp].push({span:p,commandName:s,commandArgs:c})}return u}_endSpansWithRedisReplies(t,n){if(!t){Ye&&g.error("cannot find open spans to end for redis multi/pipeline");return}if(n.length!==t.length){Ye&&g.error("number of multi command spans does not match response from redis");return}for(let r=0;r<t.length;r++){let{span:o,commandName:i,commandArgs:s}=t[r],c=n[r],[a,l]=c instanceof Error?[null,c]:[c,void 0];this._endSpanWithResponse(o,i,s,a,l)}}_endSpanWithResponse(t,n,r,o,i){i||Dw(this.getConfig().responseHook,t,n,r,o),Pf(t,i)}};Fw.COMPONENT="redis";var OJ=Fw,kf=class extends ae{constructor(t={}){super(vT,q,t),this.initialized=!1,this.instrumentationV2_V3=new CJ(this.getConfig()),this.instrumentationV4_V5=new OJ(this.getConfig()),this.initialized=!0}setConfig(t={}){super.setConfig(t),this.initialized&&(this.instrumentationV2_V3.setConfig(t),this.instrumentationV4_V5.setConfig(t))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(t){super.setTracerProvider(t),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(t),this.instrumentationV4_V5.setTracerProvider(t))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}};var Lf="Redis",xJ=de(`${Lf}.IORedis`,()=>new xf({responseHook:Es})),PJ=de(`${Lf}.Redis`,()=>new kf({responseHook:Es})),RT=Object.assign(()=>{(!ic()||!Ww.tracingChannel)&&(xJ(),PJ())},{id:Lf}),kJ=((e={})=>Bt(kE({responseHook:Es}),{name:Lf,setupOnce(){Lw(e),RT()}})),CT=kJ;var Is=(e=>(e.QUERY_PREFIX="pg.query",e.CONNECT="pg.connect",e.POOL_CONNECT="pg-pool.connect",e))(Is||{});var Ip=(e=>(e.PG_PLAN="db.postgresql.plan",e.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",e.MAX_CLIENT="db.postgresql.max.client",e))(Ip||{});var OT="db.connection_string",xT="postgresql";var LJ="auto.db.otel.postgres";function MJ(e,t){if(!t)return Is.QUERY_PREFIX;let n=typeof t.name=="string"&&t.name?t.name:wJ(t.text);return`${Is.QUERY_PREFIX}:${n}${e?` ${e}`:""}`}function wJ(e){let t=e.trim(),n=t.indexOf(" "),r=n===-1?t:t.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}function GJ(e){try{let t=new URL(e);return t.username="",t.password="",t.toString()}catch{return"postgresql://localhost:5432/"}}function Vw(e){if("connectionString"in e&&e.connectionString)return GJ(e.connectionString);let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}function Yw(e){if(Number.isInteger(e))return e}function PT(e){return{[Pe]:xT,[Et]:e.database,[OT]:Vw(e),[Gt]:e.user,[Le]:e.host,[xe]:Yw(e.port)}}function jw(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[Ip.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[Ip.MAX_CLIENT]:e.maxClient,[Pe]:xT,[Et]:t?.pathname.slice(1)??e.database,[OT]:Vw(e),[Le]:t?.hostname??e.host,[xe]:Number(t?.port)||Yw(e.port),[Gt]:t?.username??e.user}}function Mf(){return Q()===void 0}function Zw(e){let{connectionParameters:t}=this,n=t.database,r=MJ(n,e),o=M({name:r,kind:D.CLIENT,attributes:{...PT(t),[S]:LJ}});return e&&(e.text&&o.setAttribute(Ve,e.text),typeof e.name=="string"&&o.setAttribute(Ip.PG_PLAN,e.name)),o}function kT(e,t){return function(r,o){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,o)}}function Xw(e,t){return function(r,o,i){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,o,i)}}function Kw(e,t){return function(...r){let o=r[0];o instanceof Error&&e.setStatus({code:2,message:o.message}),e.end(),t.apply(this,r)}}function wf(e){return typeof e=="object"&&e!==null&&"message"in e?String(e.message):void 0}function qw(e){return typeof e=="object"&&typeof e?.text=="string"}var UJ="@sentry/instrumentation-pg";function cc(e){return e[Symbol.toStringTag]==="Module"?e.default:e}function Gf(e,t){return function(...n){return se(e,()=>t.apply(this,n))}}var Uf=class extends ae{constructor(t={}){super(UJ,q,t)}init(){let t=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new Ae("pg/lib/native/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new Ae("pg/lib/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),i=new re("pg",t,c=>{let a=cc(c);return this._patchPgClient(a.Client),c},c=>{let a=cc(c);return this._unpatchPgClient(a.Client),c},[o,r]),s=new re("pg-pool",n,c=>{let a=cc(c);return w(a.prototype.connect)&&this._unwrap(a.prototype,"connect"),this._wrap(a.prototype,"connect",this._getPoolConnectPatch()),a},c=>{let a=cc(c);w(a.prototype.connect)&&this._unwrap(a.prototype,"connect")});return[i,s]}_patchPgClient(t){if(!t)return;let n=cc(t);return w(n.prototype.query)&&this._unwrap(n.prototype,"query"),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),t}_unpatchPgClient(t){let n=cc(t);return w(n.prototype.query)&&this._unwrap(n.prototype,"query"),w(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),t}_getClientConnectPatch(){let t=this;return n=>function(o){if(Mf()||t.getConfig().ignoreConnectSpans)return n.call(this,o);let i=M({name:Is.CONNECT,kind:D.CLIENT,attributes:PT(this)}),s=o;if(s){let a=Q();s=Kw(i,s),a&&(s=Gf(a,s))}let c=se(i,()=>n.call(this,s));return Qw(i,c)}}_getClientQueryPatch(){return t=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...r){if(Mf())return t.apply(this,r);let o=r[0],i=typeof o=="string",s=qw(o),c=i?{text:o,values:Array.isArray(r[1])?r[1]:void 0}:s?{...o,name:o.name,text:o.text,values:o.values??(Array.isArray(r[1])?r[1]:void 0)}:void 0,a=Zw.call(this,c);if(r.length>0){let p=Q();if(typeof r[r.length-1]=="function")r[r.length-1]=kT(a,r[r.length-1]),p&&(r[r.length-1]=Gf(p,r[r.length-1]));else if(typeof c?.callback=="function"){let u=kT(a,c.callback);p&&(u=Gf(p,u)),r[0].callback=u}}let l;try{l=t.apply(this,r)}catch(p){throw a.setStatus({code:2,message:wf(p)}),a.end(),p}return l instanceof Promise?l.then(p=>(a.end(),p)).catch(p=>(a.setStatus({code:2,message:wf(p)}),a.end(),Promise.reject(p))):l})}_getPoolConnectPatch(){let t=this;return n=>function(o){if(Mf()||t.getConfig().ignoreConnectSpans)return n.call(this,o);let i=M({name:Is.POOL_CONNECT,kind:D.CLIENT,attributes:jw(this.options)}),s=o;if(s){let a=Q();s=Xw(i,s),a&&(s=Gf(a,s))}let c=se(i,()=>n.call(this,s));return Qw(i,c)}}};function Qw(e,t){return t instanceof Promise?t.then(r=>(e.end(),r)).catch(r=>(e.setStatus({code:2,message:wf(r)}),e.end(),Promise.reject(r))):t}var Jw="Postgres",LT=de(Jw,Uf,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),DJ=(e=>({name:Jw,setupOnce(){LT(e)}})),MT=DJ;at();var GT="PostgresJs",$w=[">=3.0.0 <4"],BJ="db.response.status_code",HJ=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,FJ=Symbol.for("sentry.query.from.instrumented.sql"),UT=de(GT,e=>new wT({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),wT=class extends ae{constructor(t){super("sentry-postgres-js",q,t)}init(){let t=new re("postgres",$w,n=>{try{return this._patchPostgres(n)}catch(r){return Ye&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{t.files.push(new Ae(`postgres/${n}/query.js`,$w,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),t}_patchPostgres(t){let n=typeof t=="function",r=n?t:t.default;if(typeof r!="function")return Ye&&g.warn("postgres module does not export a function. Skipping instrumentation."),t;let o=this,i=function(...s){let c=Reflect.construct(r,s);if(!c||typeof c!="function")return Ye&&g.warn("postgres() did not return a valid instance"),c;let a=o.getConfig();return Uy(c,{requireParentSpan:a.requireParentSpan,requestHook:a.requestHook})};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.prototype,r.prototype);for(let s of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(s)){let c=Object.getOwnPropertyDescriptor(r,s);c&&Object.defineProperty(i,s,c)}return n?i:(kl(t,"default",i),t)}_shouldCreateSpans(){let t=this.getConfig();return he.getSpan(pe.active())!==void 0||!t.requireParentSpan}_setOperationName(t,n,r){if(r){t.setAttribute(lr,r);return}let o=n?.match(HJ);o?.[1]&&t.setAttribute(lr,o[1].toUpperCase())}_reconstructQuery(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(t){return t?t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(t){let n=this,r=t.Query.prototype.handle;return t.Query.prototype.handle=async function(...o){if(this.executed||this[FJ])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let i=n._reconstructQuery(this.strings),s=n._sanitizeSqlQuery(i);return ke({name:s||"postgresjs.query",op:"db"},c=>{aE(c,"auto.db.postgresjs"),c.setAttributes({[mt]:"postgres",[Ur]:s});let a=n.getConfig(),{requestHook:l}=a;l&&$r(()=>l(c,s,void 0),d=>{d&&(c.setAttribute("sentry.hook.error","requestHook failed"),Ye&&g.error(`Error in requestHook for ${GT} integration:`,d))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(d,m,_)=>{try{n._setOperationName(c,s,_?.[0]?.command),c.end()}catch(h){Ye&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(d,m,_)}});let u=this.reject;this.reject=new Proxy(u,{apply:(d,m,_)=>{try{c.setStatus({code:2,message:_?.[0]?.message||"unknown_error"}),c.setAttribute(BJ,_?.[0]?.code||"unknown"),c.setAttribute(Dr,_?.[0]?.name||"unknown"),n._setOperationName(c,s),c.end()}catch(h){Ye&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(d,m,_)}});try{return r.apply(this,o)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})},t.Query.prototype.handle.__sentry_original__=r,t}_unpatchQueryPrototype(t){return t.Query.prototype.handle.__sentry_original__&&(t.Query.prototype.handle=t.Query.prototype.handle.__sentry_original__),t}},WJ=(e=>({name:GT,setupOnce(){UT(e)}})),DT=WJ;at();var wn=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(wn||{});var zw="@hapi/hapi",Ap=Symbol("hapi-handler-patched"),Np={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},eG=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"]);function tG(e){return e.name?e.name:e.pkg.name}var Df=e=>typeof e=="string"&&eG.has(e),nG=e=>{let t=e?.type;return t!==void 0&&Df(t)},rG=e=>Array.isArray(e)&&e.length<=3&&Df(e[0])&&typeof e[1]=="function",oG=e=>!Array.isArray(e),iG=(e,t)=>{let n={[He]:e.path,[Br]:e.method},r;return t?(n[wn.HAPI_TYPE]=Np.PLUGIN,n[wn.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[wn.HAPI_TYPE]=Np.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},sG=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[wn.EXT_TYPE]:e,[wn.HAPI_TYPE]:Np.EXT,[wn.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[wn.EXT_TYPE]:e,[wn.HAPI_TYPE]:Np.EXT},name:r}},BT=e=>"plugin"in e?"plugin"in e.plugin?e.plugin.plugin:e.plugin:e;var VJ="@sentry/instrumentation-hapi",Bf=class extends ae{constructor(t={}){super(VJ,q,t)}init(){return new re(zw,[">=17.0.0 <22"],t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;return w(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),w(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;this._massUnwrap([n],["server","Server"])})}_getServerPatch(t){let n=this,r=this;return function(i){let s=t.apply(this,[i]);return r._wrap(s,"route",c=>n._getServerRoutePatch.bind(n)(c)),r._wrap(s,"ext",c=>n._getServerExtPatch.bind(n)(c)),r._wrap(s,"register",n._getServerRegisterPatch.bind(n)),s}}_getServerRegisterPatch(t){let n=this;return function(o,i){if(Array.isArray(o))for(let s of o){let c=BT(s);n._wrapRegisterHandler(c)}else{let s=BT(o);n._wrapRegisterHandler(s)}return t.apply(this,[o,i])}}_getServerExtPatch(t,n){let r=this;return function(...i){if(Array.isArray(i[0])){let s=i[0];for(let c=0;c<s.length;c++){let a=s[c];if(Df(a.type)){let l=a,p=r._wrapExtMethods(l.method,a.type,n);l.method=p,s[c]=l}}return t.apply(this,i)}else if(rG(i)){let s=i,c=s[1],a=r._wrapExtMethods(c,s[0],n);return t.apply(this,[s[0],a,s[2]])}else if(nG(i[0])){let s=i[0],c=r._wrapExtMethods(s.method,s.type,n);return s.method=c,t.call(this,s)}return t.apply(this,i)}}_getServerRoutePatch(t,n){let r=this;return function(o){if(Array.isArray(o))for(let i=0;i<o.length;i++){let s=r._wrapRouteHandler.call(r,o[i],n);o[i]=s}else o=r._wrapRouteHandler.call(r,o,n);return t.apply(this,[o])}}_wrapRegisterHandler(t){let n=this,r=tG(t),o=t.register,i=this,s=function(c,a){return i._wrap(c,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),i._wrap(c,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),o.call(this,c,a)};t.register=s}_wrapExtMethods(t,n,r){let o=this;if(t instanceof Array){for(let i=0;i<t.length;i++)t[i]=o._wrapExtMethods(t[i],n);return t}else if(oG(t))return t[Ap]===!0?t:(t[Ap]=!0,function(...s){if(he.getSpan(pe.active())===void 0)return t.apply(this,s);let c=sG(n,r,t.name);return Se({name:c.name,op:`${c.attributes[wn.HAPI_TYPE]}.hapi`,attributes:{...c.attributes,[S]:"auto.http.otel.hapi"}},()=>t.apply(void 0,s))});return t}_wrapRouteHandler(t,n){if(t[Ap]===!0)return t;t[Ap]=!0;let r=o=>function(...i){if(he.getSpan(pe.active())===void 0)return o.call(this,...i);to(t.path);let s=iG(t,n);return Se({name:s.name,op:`${s.attributes[wn.HAPI_TYPE]}.hapi`,attributes:{...s.attributes,[S]:"auto.http.otel.hapi"}},()=>o.call(this,...i))};if(typeof t.handler=="function")t.handler=r(t.handler);else if(typeof t.options=="function"){let o=t.options;t.options=function(i){let s=o(i);return typeof s.handler=="function"&&(s.handler=r(s.handler)),s}}else typeof t.options?.handler=="function"&&(t.options.handler=r(t.options.handler));return t}};var aG="Hapi",Hf=de(aG,()=>new Bf),YJ=(()=>({name:aG,setupOnce(){Hf()}})),HT=YJ;function jJ(e){return!!(e&&typeof e=="object"&&"error"in e&&e.error)}function ZJ(e){me(e,{mechanism:{type:"auto.function.hapi",handled:!1}})}var XJ={name:"SentryHapiErrorPlugin",version:q,register:async function(e){e.events.on({name:"request",channels:["error"]},(n,r)=>{if(J()!==Rt()){let o=n.route;o.path&&J().setTransactionName(`${o.method.toUpperCase()} ${o.path}`)}else Ye&&g.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");jJ(r)&&ZJ(r.error)})}};async function KJ(e){await e.register(XJ),br(e.register,"hapi")}var bi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},vp={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};at();var qJ="@sentry/instrumentation-hono",QJ="0.0.1",Ff=class extends ae{constructor(t={}){super(qJ,QJ,t)}init(){return[new re("hono",[">=4.0.0 <5"],t=>this._patch(t))]}_patch(t){let n=this;class r extends t.Hono{constructor(...i){super(...i),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{t.Hono=r}catch{return{...t,Hono:r}}return t}_patchHandler(){let t=this;return function(n){return function(...o){if(typeof o[0]=="string"){let i=o[0];if(o.length===1)return n.apply(this,[i]);let s=o.slice(1);return n.apply(this,[i,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,o.map(i=>t._wrapHandler(i)))}}}_patchOnHandler(){let t=this;return function(n){return function(...o){let i=o.slice(2);return n.apply(this,[...o.slice(0,2),...i.map(s=>t._wrapHandler(s))])}}}_patchMiddlewareHandler(){let t=this;return function(n){return function(...o){if(typeof o[0]=="string"){let i=o[0];if(o.length===1)return n.apply(this,[i]);let s=o.slice(1);return n.apply(this,[i,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,o.map(i=>t._wrapHandler(i)))}}}_wrapHandler(t){let n=this;return function(r,o){if(!n.isEnabled())return t.apply(this,[r,o]);let i=r.req.path,s=n.tracer.startSpan(i);return pe.with(he.setSpan(pe.active(),s),()=>n._safeExecute(()=>{let c=t.apply(this,[r,o]);if(bt(c))return c.then(a=>{let l=n._determineHandlerType(a);return s.setAttributes({[bi.HONO_TYPE]:l,[bi.HONO_NAME]:l===vp.REQUEST_HANDLER?i:t.name||"anonymous"}),n.getConfig().responseHook?.(s),a});{let a=n._determineHandlerType(c);return s.setAttributes({[bi.HONO_TYPE]:a,[bi.HONO_NAME]:a===vp.REQUEST_HANDLER?i:t.name||"anonymous"}),n.getConfig().responseHook?.(s),c}},()=>s.end(),c=>{n._handleError(s,c),s.end()}))}}_safeExecute(t,n,r){try{let o=t();return bt(o)?o.then(()=>n(),i=>r(i)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(t){return t===void 0?vp.MIDDLEWARE:vp.REQUEST_HANDLER}_handleError(t,n){n instanceof Error&&(t.setStatus({code:Dn.ERROR,message:n.message}),t.recordException(n))}};var cG="Hono";function JJ(e){let t=ie(e).data,n=t[bi.HONO_TYPE];if(t[H]||!n)return;e.setAttributes({[S]:"auto.http.otel.hono",[H]:`${n}.hono`});let r=t[bi.HONO_NAME];if(typeof r=="string"&&e.updateName(r),J()===Rt()){Ye&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=t[He],i=t[Hr];typeof o=="string"&&typeof i=="string"&&J().setTransactionName(`${i} ${o}`)}var FT=de(cG,()=>new Ff({responseHook:e=>{JJ(e)}})),$J=(()=>({name:cG,setupOnce(){FT()}})),WT=$J;function zJ(){return async function(t,n){let r=es(t.req);J().setSDKProcessingMetadata({normalizedRequest:r}),await n()}}function e$(e){return e.res.status>=500}function t$(e){return async function(n,r){await r(),(e?.shouldHandleError||e$)(n)&&(n.res.sentry=me(n.error,{mechanism:{type:"auto.middleware.hono",handled:!1}}))}}function n$(e,t){e.use(zJ()),e.use(t$(t)),br(e.use,"hono")}at();var As=(e=>(e.ROUTER="router",e.MIDDLEWARE="middleware",e))(As||{});var yi=(e=>(e.KOA_TYPE="koa.type",e.KOA_NAME="koa.name",e))(yi||{});var lG=(e,t,n,r)=>n?{attributes:{[yi.KOA_NAME]:r?.toString(),[yi.KOA_TYPE]:As.ROUTER,[He]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[yi.KOA_NAME]:t.name??"middleware",[yi.KOA_TYPE]:As.MIDDLEWARE,[Iu]:t.name??"middleware"},name:`middleware - ${t.name}`},pG=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e));var VT=Symbol("koa-layer-patched");var r$="@sentry/instrumentation-koa",Wf=class extends ae{constructor(t={}){super(r$,q,t)}init(){return new re("koa",[">=2.0.0 <4"],t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;return n==null?n:(w(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),t)},t=>{let n=t[Symbol.toStringTag]==="Module"?t.default:t;n&&w(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(t){let n=this._patchRouterDispatch.bind(this),r=this._patchLayer.bind(this);return function(i){let s=i.router?n(i):r(i,!1);return t.apply(this,[s])}}_patchRouterDispatch(t){let r=t.router?.stack??[];for(let o of r){let i=o.path,s=o.stack;for(let c=0;c<s.length;c++){let a=s[c];s[c]=this._patchLayer(a,!0,i)}}return t}_patchLayer(t,n,r){let o=n?As.ROUTER:As.MIDDLEWARE;return t[VT]===!0||pG(o,this.getConfig())||t.constructor.name==="GeneratorFunction"||t.constructor.name==="AsyncGeneratorFunction"?t:(t[VT]=!0,(i,s)=>{if(he.getSpan(pe.active())===void 0)return t(i,s);let a=lG(i,t,n,r);i._matchedRoute&&to(i._matchedRoute.toString());let l=a.attributes[yi.KOA_NAME],p=typeof l=="string"?l||"< unknown >":a.name;return Se({name:p,op:`${o}.koa`,attributes:{...a.attributes,[S]:"auto.http.otel.koa"}},()=>{let u=a.attributes[He];if(J()===Rt())Ye&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(u){let d=i.request?.method?.toUpperCase()||"GET";J().setTransactionName(`${d} ${u}`)}return t(i,s)})})}};var uG="Koa",YT=de(uG,Wf,(e={})=>({ignoreLayersType:e.ignoreLayersType})),o$=((e={})=>({name:uG,setupOnce(){YT(e)}})),jT=o$,i$=e=>{e.use(async(t,n)=>{try{await n()}catch(r){throw me(r,{mechanism:{handled:!1,type:"auto.middleware.koa"}}),r}}),br(e.use,"koa")};var Vf=(e=>(e.CONNECT_TYPE="connect.type",e.CONNECT_NAME="connect.name",e))(Vf||{}),Yf=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(Yf||{});var Uo=Symbol("opentelemetry.instrumentation-connect.request-route-stack");var dG=e=>{Array.isArray(e[Uo])===!1&&Object.defineProperty(e,Uo,{enumerable:!1,value:[]}),e[Uo].push("/");let t=e[Uo].length;return()=>{t===e[Uo].length?e[Uo].pop():Ye&&g.warn("Connect: Trying to pop the stack multiple time")}},mG=(e,t)=>{t&&e[Uo].splice(-1,1,t)},fG=e=>e[Uo].reduce((t,n)=>t.replace(/\/+$/,"")+n);var s$="@sentry/instrumentation-connect",a$="anonymous",jf=class extends ae{constructor(t={}){super(s$,q,t)}init(){return[new re("connect",[">=3.0.0 <4"],t=>this._patchConstructor(t))]}_patchApp(t){w(t.use)||this._wrap(t,"use",this._patchUse.bind(this)),w(t.handle)||this._wrap(t,"handle",this._patchHandle.bind(this))}_patchConstructor(t){let n=this._patchApp.bind(this);return function(...r){let o=Reflect.apply(t,this,r);return n(o),o}}_patchNext(t,n,r){return function(i){et(i)&&n.setStatus({code:2,message:"internal_error"});let s=t.apply(this,[i]);return r(),s}}_startSpan(t,n){let r=t?Yf.REQUEST_HANDLER:Yf.MIDDLEWARE,o=t||n.name||a$;return M({name:o,op:`${r}.connect`,attributes:{[S]:"auto.http.otel.connect",[He]:t.length>0?t:"/",[Vf.CONNECT_TYPE]:r,[Vf.CONNECT_NAME]:o}})}_patchMiddleware(t,n){let r=this.isEnabled.bind(this),o=this._startSpan.bind(this),i=this._patchNext.bind(this),s=n.length===4;function c(){if(!r())return Reflect.apply(n,this,arguments);let[a,l,p]=s?[1,2,3]:[0,1,2],u=arguments[a],d=arguments[l],m=arguments[p];mG(u,t),t&&to(fG(u));let _=o(t,n),h=!1;function b(){h||(h=!0,_.end()),d.removeListener("close",b)}d.addListener("close",b),arguments[p]=i(m,_,b);try{return Reflect.apply(n,this,arguments)}catch(N){throw _.setStatus({code:2,message:"internal_error"}),b(),N}}return Object.defineProperty(c,"length",{value:n.length,writable:!1,configurable:!0}),c}_patchUse(t){let n=this._patchMiddleware.bind(this);return function(...r){let o=r[r.length-1],i=r[r.length-2]||"";return r[r.length-1]=n(i,o),t.apply(this,r)}}_patchHandle(t){let n=this._patchOut.bind(this);return function(){let[r,o]=[0,2],i=arguments[r],s=arguments[o],c=dG(i);return typeof s=="function"&&(arguments[o]=n(s,c)),Reflect.apply(t,this,arguments)}}_patchOut(t,n){return function(...o){return n(),Reflect.apply(t,this,o)}}};var gG="Connect",ZT=de(gG,()=>new jf),c$=(()=>({name:gG,setupOnce(){ZT()}})),XT=c$;function l$(e,t,n,r){me(e,{mechanism:{handled:!1,type:"auto.middleware.connect"}}),r(e)}var p$=e=>{e.use(l$),br(e.use,"connect")};var _G="db.sql.table",hG="sqlite",bG="postgresql";var yG=e=>{if(e){if(e.client){if(e.client._formatQuery)return e.client._formatQuery.bind(e.client);if(e.client.SqlString)return e.client.SqlString.format.bind(e.client.SqlString)}if(e.builder)return e.builder.toString.bind(e.builder)}return()=>"<noop formatter>"},u$=new Map([["sqlite3",hG],["pg",bG]]),SG=e=>u$.get(e)||e,EG=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,TG=(e,t)=>typeof e=="string"&&typeof t=="number"&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,IG=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}},AG=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},NG=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},KT=e=>{let t=e?._single?.table;return typeof t=="object"?KT(t):t};var d$="@sentry/instrumentation-knex",m$="auto.db.otel.knex",f$="knex",qT=[">=0.22.0 <4",">=0.10.0 <0.18.0",">=0.19.0 <0.22.0",">=0.18.0 <0.19.0"],g$=1022,vG=Symbol("sentry.instrumentation-knex.parent-span"),Zf=class extends ae{constructor(t={}){super(d$,q,t)}init(){let t=new re(f$,qT);return t.files.push(this._getClientNodeModuleFileInstrumentation("src"),this._getClientNodeModuleFileInstrumentation("lib"),this._getRunnerNodeModuleFileInstrumentation("src"),this._getRunnerNodeModuleFileInstrumentation("lib"),this._getRunnerNodeModuleFileInstrumentation("lib/execution")),t}_getRunnerNodeModuleFileInstrumentation(t){return new Ae(`knex/${t}/runner.js`,qT,(n,r)=>(this._ensureWrapped(n.prototype,"query",this._createQueryWrapper(r)),n),n=>(this._unwrap(n.prototype,"query"),n))}_getClientNodeModuleFileInstrumentation(t){return new Ae(`knex/${t}/client.js`,qT,n=>(this._ensureWrapped(n.prototype,"queryBuilder",this._storeContext.bind(this)),this._ensureWrapped(n.prototype,"schemaBuilder",this._storeContext.bind(this)),this._ensureWrapped(n.prototype,"raw",this._storeContext.bind(this)),n),n=>(this._unwrap(n.prototype,"queryBuilder"),this._unwrap(n.prototype,"schemaBuilder"),this._unwrap(n.prototype,"raw"),n))}_createQueryWrapper(t){return function(r){return function(i){let s=this.client.config,c=KT(this.builder),a=i?.method,l=s?.connection?.connectionString,p=s?.connection?.filename||s?.connection?.database||IG(l),u={[S]:m$,"knex.version":t,[Pe]:SG(this.client.driverName),[_G]:c,[na]:a,[Gt]:s?.connection?.user,[Et]:p,[Le]:s?.connection?.host??AG(l),[xe]:s?.connection?.port??NG(l),[ca]:s?.connection?.filename===":memory:"?"inproc":void 0,[Ve]:TG(i?.sql,g$)},d=this.builder[vG]||Q(),m=arguments;return Se({name:EG(p,a,c),kind:D.CLIENT,attributes:u,parentSpan:d,onlyIfParent:!0},_=>r.apply(this,m).catch(h=>{let N=yG(this)(i.sql,i.bindings||[]),L=h.message.replace(`${N} - `,"");throw _.setStatus({code:2,message:L}),h}))}}}_storeContext(t){return function(){let r=t.apply(this,arguments);return Object.defineProperty(r,vG,{value:Q()}),r}}_ensureWrapped(t,n,r){w(t[n])&&this._unwrap(t,n),this._wrap(t,n,r)}};import*as Kn from"diagnostics_channel";var _$="sentrySubscribeOrchestrionChannel";function fe(e){let t=new Set,n=[];for(let{module:r}of e){let o=`${r.name}\0${r.versionRange}\0${String(r.filePath)}`;t.has(o)||(t.add(o),n.push({channelName:r.name,module:r,astQuery:"Program",transform:_$}))}return n}var oo={name:"amqplib",versionRange:">=0.5.5 <2"},QT=[{channelName:"publish",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"publish",kind:"Sync"}},{channelName:"confirmPublish",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"ConfirmChannel",methodName:"publish",kind:"Callback"}},{channelName:"consume",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"consume",kind:"Async"}},{channelName:"dispatch",module:{...oo,filePath:"lib/channel.js"},functionQuery:{className:"BaseChannel",methodName:"dispatchMessage",kind:"Sync"}},{channelName:"ack",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ack",kind:"Sync"}},{channelName:"nack",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nack",kind:"Sync"}},{channelName:"reject",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"reject",kind:"Sync"}},{channelName:"ackAll",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ackAll",kind:"Sync"}},{channelName:"nackAll",module:{...oo,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nackAll",kind:"Sync"}},{channelName:"connect",module:{...oo,filePath:"lib/connect.js"},functionQuery:{functionName:"connect",kind:"Callback"}}],RG={AMQPLIB_PUBLISH:"orchestrion:amqplib:publish",AMQPLIB_CONFIRM_PUBLISH:"orchestrion:amqplib:confirmPublish",AMQPLIB_CONSUME:"orchestrion:amqplib:consume",AMQPLIB_DISPATCH:"orchestrion:amqplib:dispatch",AMQPLIB_ACK:"orchestrion:amqplib:ack",AMQPLIB_NACK:"orchestrion:amqplib:nack",AMQPLIB_REJECT:"orchestrion:amqplib:reject",AMQPLIB_ACK_ALL:"orchestrion:amqplib:ackAll",AMQPLIB_NACK_ALL:"orchestrion:amqplib:nackAll",AMQPLIB_CONNECT:"orchestrion:amqplib:connect"},CG=fe(QT);var JT=[...["resources/messages/messages.js","resources/messages/messages.mjs"].flatMap(e=>["create","countTokens"].map(t=>({channelName:"chat",module:{name:"@anthropic-ai/sdk",versionRange:">=0.19.2 <1",filePath:e},functionQuery:{className:"Messages",methodName:t,kind:"Auto"}}))),...["resources/completions.js","resources/completions.mjs"].map(e=>({channelName:"chat",module:{name:"@anthropic-ai/sdk",versionRange:">=0.19.2 <1",filePath:e},functionQuery:{className:"Completions",methodName:"create",kind:"Auto"}})),...["resources/beta/messages/messages.js","resources/beta/messages/messages.mjs"].map(e=>({channelName:"chat",module:{name:"@anthropic-ai/sdk",versionRange:">=0.19.2 <1",filePath:e},functionQuery:{className:"Messages",methodName:"create",kind:"Auto"}})),...["resources/models.js","resources/models.mjs"].map(e=>({channelName:"models",module:{name:"@anthropic-ai/sdk",versionRange:">=0.19.2 <1",filePath:e},functionQuery:{className:"Models",methodName:"retrieve",kind:"Auto"}})),...["resources/messages/messages.js","resources/messages/messages.mjs"].map(e=>({channelName:"messages-stream",module:{name:"@anthropic-ai/sdk",versionRange:">=0.19.2 <1",filePath:e},functionQuery:{className:"Messages",methodName:"stream",kind:"Sync"}}))],OG={ANTHROPIC_CHAT:"orchestrion:@anthropic-ai/sdk:chat",ANTHROPIC_MODELS:"orchestrion:@anthropic-ai/sdk:models",ANTHROPIC_MESSAGES_STREAM:"orchestrion:@anthropic-ai/sdk:messages-stream"},xG=fe(JT);var $T=[{channelName:"send",module:{name:"@smithy/core",versionRange:">=3.24.0 <4",filePath:"dist-cjs/submodules/client/index.js"},functionQuery:{className:"Client",methodName:"send",kind:"Async"}},{channelName:"send",module:{name:"@smithy/smithy-client",versionRange:">=1.0.3 <5",filePath:"dist-cjs/index.js"},functionQuery:{className:"Client",methodName:"send",kind:"Async"}},{channelName:"send",module:{name:"@aws-sdk/smithy-client",versionRange:"^3.1.0",filePath:"dist-cjs/index.js"},functionQuery:{className:"Client",methodName:"send",kind:"Async"}}],PG={AWS_SMITHY_CORE_SEND:"orchestrion:@smithy/core:send",AWS_SMITHY_CLIENT_SEND:"orchestrion:@smithy/smithy-client:send",AWS_SDK_SMITHY_CLIENT_SEND:"orchestrion:@aws-sdk/smithy-client:send"},kG=fe($T);var lc={name:"dataloader",versionRange:">=2.0.0 <3",filePath:"index.js"},zT=[{channelName:"construct",module:lc,functionQuery:{functionName:"DataLoader",kind:"Sync"}},{channelName:"load",module:lc,functionQuery:{expressionName:"load",kind:"Async"}},{channelName:"loadMany",module:lc,functionQuery:{expressionName:"loadMany",kind:"Async"}},{channelName:"prime",module:lc,functionQuery:{expressionName:"prime",kind:"Sync"}},{channelName:"clear",module:lc,functionQuery:{expressionName:"clear",kind:"Sync"}},{channelName:"clearAll",module:lc,functionQuery:{expressionName:"clearAll",kind:"Sync"}}],LG={DATALOADER_CONSTRUCT:"orchestrion:dataloader:construct",DATALOADER_LOAD:"orchestrion:dataloader:load",DATALOADER_LOAD_MANY:"orchestrion:dataloader:loadMany",DATALOADER_PRIME:"orchestrion:dataloader:prime",DATALOADER_CLEAR:"orchestrion:dataloader:clear",DATALOADER_CLEAR_ALL:"orchestrion:dataloader:clearAll"},MG=fe(zT);var eI=[{channelName:"handle",module:{name:"express",versionRange:">=4.0.0 <5",filePath:"lib/router/layer.js"},functionQuery:{expressionName:"handle_request",kind:"Callback"}},{channelName:"handle",module:{name:"router",versionRange:">=2.0.0 <3",filePath:"lib/layer.js"},functionQuery:{expressionName:"handleRequest",kind:"Callback"}},{channelName:"register",module:{name:"express",versionRange:">=4.0.0 <5",filePath:"lib/router/index.js"},functionQuery:{expressionName:"route",kind:"Sync"}},{channelName:"register",module:{name:"express",versionRange:">=4.0.0 <5",filePath:"lib/router/index.js"},functionQuery:{expressionName:"use",kind:"Sync"}},{channelName:"register",module:{name:"router",versionRange:">=2.0.0 <3",filePath:"index.js"},functionQuery:{expressionName:"route",kind:"Sync"}},{channelName:"register",module:{name:"router",versionRange:">=2.0.0 <3",filePath:"index.js"},functionQuery:{expressionName:"use",kind:"Sync"}}],wG={EXPRESS_HANDLE:"orchestrion:express:handle",ROUTER_HANDLE:"orchestrion:router:handle",EXPRESS_REGISTER:"orchestrion:express:register",ROUTER_REGISTER:"orchestrion:router:register"},GG=fe(eI);var h$=">=3.0.0 <5",b$=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,y$=[{functionName:"addDoc",channelName:"add-doc"},{functionName:"getDocs",channelName:"get-docs"},{functionName:"setDoc",channelName:"set-doc"},{functionName:"deleteDoc",channelName:"delete-doc"}],S$=">=6.0.0 <7",E$=[{file:"lib/v2/providers/https.js",functionName:"onRequest",channelName:"http-request"},{file:"lib/v2/providers/https.js",functionName:"onCall",channelName:"http-call"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentCreated",channelName:"firestore-created"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentCreatedWithAuthContext",channelName:"firestore-created"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentUpdated",channelName:"firestore-updated"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentUpdatedWithAuthContext",channelName:"firestore-updated"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentDeleted",channelName:"firestore-deleted"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentDeletedWithAuthContext",channelName:"firestore-deleted"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentWritten",channelName:"firestore-written"},{file:"lib/v2/providers/firestore.js",functionName:"onDocumentWrittenWithAuthContext",channelName:"firestore-written"},{file:"lib/v2/providers/scheduler.js",functionName:"onSchedule",channelName:"scheduler"},{file:"lib/v2/providers/storage.js",functionName:"onObjectFinalized",channelName:"storage-finalized"},{file:"lib/v2/providers/storage.js",functionName:"onObjectArchived",channelName:"storage-archived"},{file:"lib/v2/providers/storage.js",functionName:"onObjectDeleted",channelName:"storage-deleted"},{file:"lib/v2/providers/storage.js",functionName:"onObjectMetadataUpdated",channelName:"storage-metadata-updated"}],tI=[...y$.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:"@firebase/firestore",versionRange:h$,filePath:b$},functionQuery:{functionName:e,kind:"Auto"}})),...E$.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:"firebase-functions",versionRange:S$,filePath:e},functionQuery:{functionName:t,kind:"Sync"}}))],UG={FIREBASE_FIRESTORE_ADD_DOC:"orchestrion:@firebase/firestore:add-doc",FIREBASE_FIRESTORE_GET_DOCS:"orchestrion:@firebase/firestore:get-docs",FIREBASE_FIRESTORE_SET_DOC:"orchestrion:@firebase/firestore:set-doc",FIREBASE_FIRESTORE_DELETE_DOC:"orchestrion:@firebase/firestore:delete-doc",FIREBASE_FUNCTIONS_HTTP_REQUEST:"orchestrion:firebase-functions:http-request",FIREBASE_FUNCTIONS_HTTP_CALL:"orchestrion:firebase-functions:http-call",FIREBASE_FUNCTIONS_FIRESTORE_CREATED:"orchestrion:firebase-functions:firestore-created",FIREBASE_FUNCTIONS_FIRESTORE_UPDATED:"orchestrion:firebase-functions:firestore-updated",FIREBASE_FUNCTIONS_FIRESTORE_DELETED:"orchestrion:firebase-functions:firestore-deleted",FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN:"orchestrion:firebase-functions:firestore-written",FIREBASE_FUNCTIONS_SCHEDULER:"orchestrion:firebase-functions:scheduler",FIREBASE_FUNCTIONS_STORAGE_FINALIZED:"orchestrion:firebase-functions:storage-finalized",FIREBASE_FUNCTIONS_STORAGE_ARCHIVED:"orchestrion:firebase-functions:storage-archived",FIREBASE_FUNCTIONS_STORAGE_DELETED:"orchestrion:firebase-functions:storage-deleted",FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED:"orchestrion:firebase-functions:storage-metadata-updated"},DG=fe(tI);var nI=[{channelName:"acquire",module:{name:"generic-pool",versionRange:">=3.0.0 <4",filePath:"lib/Pool.js"},functionQuery:{className:"Pool",methodName:"acquire",kind:"Auto"}},{channelName:"acquire",module:{name:"generic-pool",versionRange:">=2.4.0 <3",filePath:"lib/generic-pool.js"},functionQuery:{expressionName:"acquire",kind:"Callback"}}],BG={GENERIC_POOL_ACQUIRE:"orchestrion:generic-pool:acquire"},HG=fe(nI);var rI=["dist/node/index.js","dist/node/index.mjs","dist/node/index.cjs"],oI=[...rI.flatMap(e=>["generateContent","generateContentStream"].map(t=>({channelName:"generate-content",module:{name:"@google/genai",versionRange:">=0.10.0 <2",filePath:e},functionQuery:{expressionName:t,kind:"Auto"}}))),...rI.map(e=>({channelName:"embed-content",module:{name:"@google/genai",versionRange:">=0.10.0 <2",filePath:e},functionQuery:{className:"Models",methodName:"embedContent",kind:"Auto"}})),...rI.flatMap(e=>["sendMessage","sendMessageStream"].map(t=>({channelName:"chat",module:{name:"@google/genai",versionRange:">=0.10.0 <2",filePath:e},functionQuery:{className:"Chat",methodName:t,kind:"Auto"}})))],FG={GOOGLE_GENAI_GENERATE_CONTENT:"orchestrion:@google/genai:generate-content",GOOGLE_GENAI_EMBED_CONTENT:"orchestrion:@google/genai:embed-content",GOOGLE_GENAI_CHAT:"orchestrion:@google/genai:chat"},WG=fe(oI);var iI=[{channelName:"parse",module:{name:"graphql",versionRange:">=14.0.0 <17",filePath:"language/parser.js"},functionQuery:{functionName:"parse",kind:"Sync"}},{channelName:"validate",module:{name:"graphql",versionRange:">=14.0.0 <17",filePath:"validation/validate.js"},functionQuery:{functionName:"validate",kind:"Sync"}},{channelName:"execute",module:{name:"graphql",versionRange:">=14.0.0 <17",filePath:"execution/execute.js"},functionQuery:{functionName:"execute",kind:"Auto"}}],VG={GRAPHQL_PARSE:"orchestrion:graphql:parse",GRAPHQL_VALIDATE:"orchestrion:graphql:validate",GRAPHQL_EXECUTE:"orchestrion:graphql:execute"},YG=fe(iI);var sI=[{channelName:"route",module:{name:"@hapi/hapi",versionRange:">=17.0.0 <22.0.0",filePath:"lib/server.js"},functionQuery:{methodName:"route",kind:"Sync"}},{channelName:"ext",module:{name:"@hapi/hapi",versionRange:">=17.0.0 <22.0.0",filePath:"lib/server.js"},functionQuery:{methodName:"ext",kind:"Sync"}}],jG={HAPI_ROUTE:"orchestrion:@hapi/hapi:route",HAPI_EXT:"orchestrion:@hapi/hapi:ext"},ZG=fe(sI);var aI=[...["lib/redis.js","built/redis.js","built/redis/index.js"].flatMap(e=>[{channelName:"command",module:{name:"ioredis",versionRange:">=2.0.0 <5.0.0",filePath:e},functionQuery:{expressionName:"sendCommand",kind:"Async"}},{channelName:"connect",module:{name:"ioredis",versionRange:">=2.0.0 <5.0.0",filePath:e},functionQuery:{expressionName:"connect",kind:"Async"}}]),{channelName:"command",module:{name:"ioredis",versionRange:">=5.0.0 <5.11.0",filePath:"built/Redis.js"},functionQuery:{className:"Redis",methodName:"sendCommand",kind:"Async"}},{channelName:"connect",module:{name:"ioredis",versionRange:">=5.0.0 <5.11.0",filePath:"built/Redis.js"},functionQuery:{className:"Redis",methodName:"connect",kind:"Async"}}],XG={IOREDIS_COMMAND:"orchestrion:ioredis:command",IOREDIS_CONNECT:"orchestrion:ioredis:connect"},KG=fe(aI);var cI=[{channelName:"send_batch",module:{name:"kafkajs",versionRange:">=2.0.0 <3",filePath:"src/producer/messageProducer.js"},functionQuery:{expressionName:"sendBatch",kind:"Async"}},{channelName:"consumer_run",module:{name:"kafkajs",versionRange:">=2.0.0 <3",filePath:"src/consumer/index.js"},functionQuery:{expressionName:"run",kind:"Async"}}],qG={KAFKAJS_SEND_BATCH:"orchestrion:kafkajs:send_batch",KAFKAJS_CONSUMER_RUN:"orchestrion:kafkajs:consumer_run"},QG=fe(cI);var JG="knex",T$=[{filePath:"lib/execution/runner.js",versionRange:">=0.22.0 <4"},{filePath:"lib/runner.js",versionRange:">=0.10.0 <0.22.0"},{filePath:"src/runner.js",versionRange:">=0.18.0 <0.19.0"}],I$=[{filePath:"lib/client.js",versionRange:">=0.10.0 <4"},{filePath:"src/client.js",versionRange:">=0.18.0 <0.19.0"}],A$=["queryBuilder","schemaBuilder","raw"];function N$(e,t){return{channelName:"query",module:{name:JG,versionRange:t,filePath:e},functionQuery:{className:"Runner",methodName:"query",kind:"Async"}}}function v$(e,t,n){return{channelName:e,module:{name:JG,versionRange:n,filePath:t},functionQuery:{className:"Client",methodName:e,kind:"Sync"}}}var lI=[...T$.map(({filePath:e,versionRange:t})=>N$(e,t)),...I$.flatMap(({filePath:e,versionRange:t})=>A$.map(n=>v$(n,e,t)))],$G={KNEX_QUERY:"orchestrion:knex:query",KNEX_QUERY_BUILDER:"orchestrion:knex:queryBuilder",KNEX_SCHEMA_BUILDER:"orchestrion:knex:schemaBuilder",KNEX_RAW:"orchestrion:knex:raw"},zG=fe(lI);var pI=[{channelName:"use",module:{name:"koa",versionRange:">=2.0.0 <4",filePath:"lib/application.js"},functionQuery:{className:"Application",methodName:"use",kind:"Sync"}}],eU={KOA_USE:"orchestrion:koa:use"},tU=fe(pI);var R$=["dist/language_models/chat_models.cjs","dist/language_models/chat_models.js"].flatMap(e=>{let t={name:"@langchain/core",versionRange:">=0.1.0 <2.0.0",filePath:e};return[{channelName:"chatModelInvoke",module:t,functionQuery:{className:"BaseChatModel",methodName:"invoke",kind:"Async"}},{channelName:"chatModelStream",module:t,functionQuery:{className:"BaseChatModel",methodName:"_streamIterator",kind:"Async"}}]}),uI="embedQuery",Xf="embedDocuments",nU=[{name:"@langchain/openai",versionRange:">=0.1.0 <2.0.0",methods:[uI,Xf]},{name:"@langchain/google-genai",versionRange:">=0.1.0 <3.0.0",methods:[uI,Xf]},{name:"@langchain/mistralai",versionRange:">=0.1.0 <2.0.0",methods:[uI,Xf]},{name:"@langchain/google-common",versionRange:">=0.1.0 <3.0.0",methods:[Xf]}],C$=nU.flatMap(({name:e,versionRange:t,methods:n})=>["dist/embeddings.cjs","dist/embeddings.js"].flatMap(r=>n.map(o=>({channelName:o,module:{name:e,versionRange:t,filePath:r},functionQuery:{methodName:o,kind:"Async"}})))),dI=[...R$,...C$],rU=nU.flatMap(({name:e,methods:t})=>t.map(n=>`orchestrion:${e}:${n}`)),oU={LANGCHAIN_CHAT_MODEL_INVOKE:"orchestrion:@langchain/core:chatModelInvoke",LANGCHAIN_CHAT_MODEL_STREAM:"orchestrion:@langchain/core:chatModelStream"},iU=fe(dI);var sU=e=>({name:"@langchain/langgraph",versionRange:">=0.0.0 <2.0.0",filePath:e}),O$=["dist/graph/state.cjs","dist/graph/state.js"].map(e=>({channelName:"stateGraphCompile",module:sU(e),functionQuery:{className:"StateGraph",methodName:"compile",kind:"Sync"}})),x$=["dist/prebuilt/react_agent_executor.cjs","dist/prebuilt/react_agent_executor.js"].map(e=>({channelName:"createReactAgent",module:sU(e),functionQuery:{functionName:"createReactAgent",kind:"Sync"}})),mI=[...O$,...x$],aU={LANGGRAPH_STATE_GRAPH_COMPILE:"orchestrion:@langchain/langgraph:stateGraphCompile",LANGGRAPH_CREATE_REACT_AGENT:"orchestrion:@langchain/langgraph:createReactAgent"},cU=fe(mI);var fI=[{channelName:"load",module:{name:"lru-memoizer",versionRange:">=2.1.0 <4",filePath:"lib/async.js"},functionQuery:{functionName:"memoizedFunction",kind:"Callback"}}],lU={LRU_MEMOIZER_LOAD:"orchestrion:lru-memoizer:load"},pU=fe(fI);var Ns={name:"mongodb"},gI=[{channelName:"command",module:{...Ns,versionRange:">=6.4.0 <8",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Async"}},{channelName:"command",module:{...Ns,versionRange:">=4.0.0 <6.4",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Callback"}},{channelName:"checkout",module:{...Ns,versionRange:">=4.0.0 <6.4",filePath:"lib/cmap/connection_pool.js"},functionQuery:{methodName:"checkOut",kind:"Callback"}},...["insert","update","remove"].map(e=>({channelName:`v3_${e}`,module:{...Ns,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/index.js"},functionQuery:{expressionName:e,kind:"Callback"}})),{channelName:"v3_command",module:{...Ns,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/command.js"},functionQuery:{functionName:"command",kind:"Callback"}},{channelName:"v3_query",module:{...Ns,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/query.js"},functionQuery:{functionName:"query",kind:"Callback"}},{channelName:"v3_get_more",module:{...Ns,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/get_more.js"},functionQuery:{functionName:"getMore",kind:"Callback"}}],uU={MONGODB_COMMAND:"orchestrion:mongodb:command",MONGODB_CHECKOUT:"orchestrion:mongodb:checkout",MONGODB_V3_INSERT:"orchestrion:mongodb:v3_insert",MONGODB_V3_UPDATE:"orchestrion:mongodb:v3_update",MONGODB_V3_REMOVE:"orchestrion:mongodb:v3_remove",MONGODB_V3_COMMAND:"orchestrion:mongodb:v3_command",MONGODB_V3_QUERY:"orchestrion:mongodb:v3_query",MONGODB_V3_GET_MORE:"orchestrion:mongodb:v3_get_more"},dU=fe(gI);var Si={name:"mongoose",versionRange:">=5.9.7 <9.7.0"},mU=["find","findOne","deleteOne","deleteMany","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace","remove","count","findOneAndRemove"],_I=[{channelName:"query_exec",module:{...Si,filePath:"lib/query.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"aggregate_exec",module:{...Si,filePath:"lib/aggregate.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"model_save",module:{...Si,filePath:"lib/model.js"},functionQuery:{expressionName:"save",kind:"Auto"}},{channelName:"model_insert_many",module:{...Si,filePath:"lib/model.js"},functionQuery:{expressionName:"insertMany",kind:"Auto"}},{channelName:"model_bulk_write",module:{...Si,filePath:"lib/model.js"},functionQuery:{expressionName:"bulkWrite",kind:"Auto"}},{channelName:"model_remove",module:{...Si,filePath:"lib/model.js"},functionQuery:{expressionName:"remove",kind:"Auto"}},{channelName:"model_aggregate",module:{...Si,filePath:"lib/model.js"},functionQuery:{expressionName:"aggregate",kind:"Sync"}},...mU.map(e=>({channelName:`ctx_${e}`,module:{...Si,filePath:"lib/query.js"},functionQuery:{expressionName:e,kind:"Sync"}}))],fU={MONGOOSE_QUERY_EXEC:"orchestrion:mongoose:query_exec",MONGOOSE_AGGREGATE_EXEC:"orchestrion:mongoose:aggregate_exec",MONGOOSE_MODEL_SAVE:"orchestrion:mongoose:model_save",MONGOOSE_MODEL_INSERT_MANY:"orchestrion:mongoose:model_insert_many",MONGOOSE_MODEL_BULK_WRITE:"orchestrion:mongoose:model_bulk_write",MONGOOSE_MODEL_REMOVE:"orchestrion:mongoose:model_remove",MONGOOSE_MODEL_AGGREGATE:"orchestrion:mongoose:model_aggregate"},gU=mU.map(e=>`orchestrion:mongoose:ctx_${e}`),_U=fe(_I);var hI=[{channelName:"query",module:{name:"mysql2",versionRange:">=1.4.2 <3.11.5",filePath:"lib/connection.js"},functionQuery:{className:"Connection",methodName:"query",kind:"Callback"}},{channelName:"execute",module:{name:"mysql2",versionRange:">=1.4.2 <3.11.5",filePath:"lib/connection.js"},functionQuery:{className:"Connection",methodName:"execute",kind:"Callback"}},{channelName:"query",module:{name:"mysql2",versionRange:">=3.11.5 <3.20.0",filePath:"lib/base/connection.js"},functionQuery:{className:"BaseConnection",methodName:"query",kind:"Callback"}},{channelName:"execute",module:{name:"mysql2",versionRange:">=3.11.5 <3.20.0",filePath:"lib/base/connection.js"},functionQuery:{className:"BaseConnection",methodName:"execute",kind:"Callback"}}],hU={MYSQL2_QUERY:"orchestrion:mysql2:query",MYSQL2_EXECUTE:"orchestrion:mysql2:execute"},bU=fe(hI);var bI=[{channelName:"query",module:{name:"mysql",versionRange:">=2.0.0 <3",filePath:"lib/Connection.js"},functionQuery:{expressionName:"query",kind:"Auto"}}],yU={MYSQL_QUERY:"orchestrion:mysql:query"},SU=fe(bI);var yI=[{channelName:"nestFactoryCreate",module:{name:"@nestjs/core",versionRange:">=8.0.0 <12",filePath:"nest-factory.js"},functionQuery:{className:"NestFactoryStatic",methodName:"create",kind:"Async"}},{channelName:"routerExecutionContextCreate",module:{name:"@nestjs/core",versionRange:">=8.0.0 <12",filePath:"router/router-execution-context.js"},functionQuery:{className:"RouterExecutionContext",methodName:"create",kind:"Sync"}},{channelName:"injectableDecorator",module:{name:"@nestjs/common",versionRange:">=8.0.0 <12",filePath:"decorators/core/injectable.decorator.js"},astQuery:'FunctionDeclaration[id.name="Injectable"] ReturnStatement > ArrowFunctionExpression',functionQuery:{kind:"Sync"}},{channelName:"catchDecorator",module:{name:"@nestjs/common",versionRange:">=8.0.0 <12",filePath:"decorators/core/catch.decorator.js"},astQuery:'FunctionDeclaration[id.name="Catch"] ReturnStatement > ArrowFunctionExpression',functionQuery:{kind:"Sync"}},{channelName:"cronDecorator",module:{name:"@nestjs/schedule",versionRange:">=2.0.0",filePath:"dist/decorators/cron.decorator.js"},functionQuery:{functionName:"Cron",kind:"Sync"}},{channelName:"intervalDecorator",module:{name:"@nestjs/schedule",versionRange:">=2.0.0",filePath:"dist/decorators/interval.decorator.js"},functionQuery:{functionName:"Interval",kind:"Sync"}},{channelName:"timeoutDecorator",module:{name:"@nestjs/schedule",versionRange:">=2.0.0",filePath:"dist/decorators/timeout.decorator.js"},functionQuery:{functionName:"Timeout",kind:"Sync"}},{channelName:"onEventDecorator",module:{name:"@nestjs/event-emitter",versionRange:">=2.0.0",filePath:"dist/decorators/on-event.decorator.js"},functionQuery:{expressionName:"OnEvent",kind:"Sync"}},{channelName:"processorDecorator",module:{name:"@nestjs/bullmq",versionRange:">=10.0.0",filePath:"dist/decorators/processor.decorator.js"},functionQuery:{functionName:"Processor",kind:"Sync"}}],EU={NESTJS_APP_CREATION:"orchestrion:@nestjs/core:nestFactoryCreate",NESTJS_ROUTER_CONTEXT:"orchestrion:@nestjs/core:routerExecutionContextCreate",NESTJS_INJECTABLE:"orchestrion:@nestjs/common:injectableDecorator",NESTJS_CATCH:"orchestrion:@nestjs/common:catchDecorator",NESTJS_SCHEDULE_CRON:"orchestrion:@nestjs/schedule:cronDecorator",NESTJS_SCHEDULE_INTERVAL:"orchestrion:@nestjs/schedule:intervalDecorator",NESTJS_SCHEDULE_TIMEOUT:"orchestrion:@nestjs/schedule:timeoutDecorator",NESTJS_ONEVENT:"orchestrion:@nestjs/event-emitter:onEventDecorator",NESTJS_PROCESSOR:"orchestrion:@nestjs/bullmq:processorDecorator"},TU=fe(yI);var SI=[...["resources/chat/completions/completions.js","resources/chat/completions/completions.mjs"].map(e=>({channelName:"chat",module:{name:"openai",versionRange:">=4.0.0 <8",filePath:e},functionQuery:{className:"Completions",methodName:"create",kind:"Auto"}})),...["resources/responses/responses.js","resources/responses/responses.mjs"].map(e=>({channelName:"chat",module:{name:"openai",versionRange:">=4.0.0 <8",filePath:e},functionQuery:{className:"Responses",methodName:"create",kind:"Auto"}})),...["resources/embeddings.js","resources/embeddings.mjs"].map(e=>({channelName:"embeddings",module:{name:"openai",versionRange:">=4.0.0 <8",filePath:e},functionQuery:{className:"Embeddings",methodName:"create",kind:"Auto"}})),...["resources/conversations/conversations.js","resources/conversations/conversations.mjs"].map(e=>({channelName:"chat",module:{name:"openai",versionRange:">=4.0.0 <8",filePath:e},functionQuery:{className:"Conversations",methodName:"create",kind:"Auto"}}))],IU={OPENAI_CHAT:"orchestrion:openai:chat",OPENAI_EMBEDDINGS:"orchestrion:openai:embeddings"},AU=fe(SI);var EI=[{channelName:"query",module:{name:"pg",versionRange:">=8.0.3 <9",filePath:"lib/client.js"},functionQuery:{className:"Client",methodName:"query",kind:"Auto"}},{channelName:"connect",module:{name:"pg",versionRange:">=8.0.3 <9",filePath:"lib/client.js"},functionQuery:{className:"Client",methodName:"connect",kind:"Auto"}},{channelName:"query",module:{name:"pg",versionRange:">=8.0.3 <9",filePath:"lib/native/client.js"},functionQuery:{expressionName:"query",kind:"Auto"}},{channelName:"connect",module:{name:"pg",versionRange:">=8.0.3 <9",filePath:"lib/native/client.js"},functionQuery:{expressionName:"connect",kind:"Auto"}},{channelName:"connect",module:{name:"pg-pool",versionRange:">=2.0.0 <4",filePath:"index.js"},functionQuery:{className:"Pool",methodName:"connect",kind:"Auto"}}],NU={PG_QUERY:"orchestrion:pg:query",PG_CONNECT:"orchestrion:pg:connect",PGPOOL_CONNECT:"orchestrion:pg-pool:connect"},vU=fe(EI);var P$=e=>[{channelName:"handle",module:{name:"postgres",versionRange:">=3.0.0 <4",filePath:`${e}/query.js`},functionQuery:{className:"Query",methodName:"handle",kind:"Async"}},{channelName:"connection",module:{name:"postgres",versionRange:">=3.0.0 <4",filePath:`${e}/connection.js`},functionQuery:{functionName:"Connection",kind:"Sync"}},{channelName:"execute",module:{name:"postgres",versionRange:">=3.0.0 <4",filePath:`${e}/connection.js`},functionQuery:{functionName:"execute",kind:"Sync"}},{channelName:"connect",module:{name:"postgres",versionRange:">=3.0.0 <4",filePath:`${e}/connection.js`},functionQuery:{methodName:"connect",kind:"Sync"}}],TI=["src","cjs/src"].flatMap(P$),RU={POSTGRESJS_HANDLE:"orchestrion:postgres:handle",POSTGRESJS_CONNECTION:"orchestrion:postgres:connection",POSTGRESJS_EXECUTE:"orchestrion:postgres:execute",POSTGRESJS_CONNECT:"orchestrion:postgres:connect"},CU=fe(TI);var II=[{channelName:"command",module:{name:"redis",versionRange:">=2.6.0 <4",filePath:"index.js"},functionQuery:{expressionName:"internal_send_command",kind:"Sync"}},{channelName:"executor",module:{name:"@redis/client",versionRange:"^1.0.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"commandsExecutor",kind:"Async"}},{channelName:"command",module:{name:"@redis/client",versionRange:"^1.0.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"sendCommand",kind:"Async"}},{channelName:"connect",module:{name:"@redis/client",versionRange:"^1.0.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"connect",kind:"Async"}},{channelName:"command",module:{name:"@redis/client",versionRange:">=5.0.0 <5.12.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"sendCommand",kind:"Async"}},{channelName:"connect",module:{name:"@redis/client",versionRange:">=5.0.0 <5.12.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"connect",kind:"Async"}},{channelName:"multi",module:{name:"@redis/client",versionRange:">=5.0.0 <5.12.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"_executeMulti",kind:"Async"}},{channelName:"pipeline",module:{name:"@redis/client",versionRange:">=5.0.0 <5.12.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"_executePipeline",kind:"Async"}},{channelName:"batch",module:{name:"@redis/client",versionRange:"^1.0.0",filePath:"dist/lib/client/index.js"},functionQuery:{className:"RedisClient",methodName:"multiExecutor",kind:"Async"}}],OU={REDIS_COMMAND:"orchestrion:redis:command",NODE_REDIS_COMMAND:"orchestrion:@redis/client:command",NODE_REDIS_EXECUTOR:"orchestrion:@redis/client:executor",NODE_REDIS_CONNECT:"orchestrion:@redis/client:connect",NODE_REDIS_MULTI:"orchestrion:@redis/client:multi",NODE_REDIS_PIPELINE:"orchestrion:@redis/client:pipeline",NODE_REDIS_BATCH:"orchestrion:@redis/client:batch"},xU=fe(II);var k$=e=>[{channelName:"requestHandler",module:{name:"@remix-run/server-runtime",versionRange:">=2.0.0 <3",filePath:`${e}/server.js`},astQuery:'FunctionExpression[id.name="requestHandler"]',functionQuery:{kind:"Async"}},{channelName:"matchServerRoutes",module:{name:"@remix-run/server-runtime",versionRange:">=2.0.0 <3",filePath:`${e}/routeMatching.js`},functionQuery:{functionName:"matchServerRoutes",kind:"Sync"}},{channelName:"callRouteLoader",module:{name:"@remix-run/server-runtime",versionRange:">=2.9.0 <3",filePath:`${e}/data.js`},functionQuery:{functionName:"callRouteLoader",kind:"Async"}},{channelName:"callRouteAction",module:{name:"@remix-run/server-runtime",versionRange:">=2.9.0 <3",filePath:`${e}/data.js`},functionQuery:{functionName:"callRouteAction",kind:"Async"}},{channelName:"callRouteLoader",module:{name:"@remix-run/server-runtime",versionRange:">=2.0.0 <2.9.0",filePath:`${e}/data.js`},functionQuery:{functionName:"callRouteLoaderRR",kind:"Async"}},{channelName:"callRouteAction",module:{name:"@remix-run/server-runtime",versionRange:">=2.0.0 <2.9.0",filePath:`${e}/data.js`},functionQuery:{functionName:"callRouteActionRR",kind:"Async"}}],AI=["dist","dist/esm"].flatMap(k$),PU={REMIX_REQUEST_HANDLER:"orchestrion:@remix-run/server-runtime:requestHandler",REMIX_MATCH_SERVER_ROUTES:"orchestrion:@remix-run/server-runtime:matchServerRoutes",REMIX_CALL_ROUTE_LOADER:"orchestrion:@remix-run/server-runtime:callRouteLoader",REMIX_CALL_ROUTE_ACTION:"orchestrion:@remix-run/server-runtime:callRouteAction"},kU=fe(AI);var L$="tedious",M$="lib/connection.js",w$=">=1.11.0 <20",G$=["connect","execSql","execSqlBatch","callProcedure","execBulkLoad","prepare","execute"],NI=G$.map(e=>({channelName:e,module:{name:L$,versionRange:w$,filePath:M$},functionQuery:{className:"Connection",methodName:e,kind:"Sync"}})),LU={TEDIOUS_CONNECT:"orchestrion:tedious:connect",TEDIOUS_EXEC_SQL:"orchestrion:tedious:execSql",TEDIOUS_EXEC_SQL_BATCH:"orchestrion:tedious:execSqlBatch",TEDIOUS_CALL_PROCEDURE:"orchestrion:tedious:callProcedure",TEDIOUS_EXEC_BULK_LOAD:"orchestrion:tedious:execBulkLoad",TEDIOUS_PREPARE:"orchestrion:tedious:prepare",TEDIOUS_EXECUTE:"orchestrion:tedious:execute"},MU=fe(NI);var vI=[...vs(">=4.0.0 <7.0.0","generateText","generateText","Async"),...vs(">=4.0.0 <7.0.0","streamText","streamText","Sync"),...vs(">=4.0.0 <7.0.0","generateObject","generateObject","Async"),...vs(">=4.0.0 <7.0.0","embed","embed","Async"),...vs(">=4.0.0 <7.0.0","embedMany","embedMany","Async"),...vs(">=5.0.0 <7.0.0","resolveLanguageModel","resolveLanguageModel","Sync"),...vs(">=6.0.0 <7.0.0","executeToolCall","executeToolCall","Async")],wU={VERCEL_AI_GENERATE_TEXT:"orchestrion:ai:generateText",VERCEL_AI_STREAM_TEXT:"orchestrion:ai:streamText",VERCEL_AI_GENERATE_OBJECT:"orchestrion:ai:generateObject",VERCEL_AI_EMBED:"orchestrion:ai:embed",VERCEL_AI_EMBED_MANY:"orchestrion:ai:embedMany",VERCEL_AI_EXECUTE_TOOL_CALL:"orchestrion:ai:executeToolCall",VERCEL_AI_RESOLVE_LANGUAGE_MODEL:"orchestrion:ai:resolveLanguageModel"};function vs(e,t,n,r){return["dist/index.js","dist/index.mjs"].map(o=>({channelName:t,module:{name:"ai",versionRange:e,filePath:o},functionQuery:{functionName:n,kind:r}}))}var GU=fe(vI);var A={...RG,...OG,...PG,...LG,...wG,...UG,...BG,...FG,...VG,...jG,...XG,...qG,...$G,...eU,...oU,...aU,...lU,...uU,...fU,...hU,...yU,...EU,...IU,...NU,...RU,...OU,...PU,...LU,...wU};var U$="Amqplib",D$="auto.amqplib.orchestrion.publisher",B$="auto.amqplib.orchestrion.consumer",H$="messaging.operation",jU="messaging.destination",ZU="messaging.destination_kind",XU="messaging.rabbitmq.routing_key",UU="messaging.protocol",F$="messaging.protocol_version",W$="messaging.url",KU="messaging.message_id",qU="messaging.conversation_id",QU="messaging.rabbitmq.destination.routing_key",JU="messaging.message.conversation_id",$U="topic",DU="process",V$="send",zU=1e3*60,qn={Ack:"ack",AckAll:"ackAll",Reject:"reject",Nack:"nack",NackAll:"nackAll",ChannelClosed:"channel closed",ChannelError:"channel error",InstrumentationTimeout:"instrumentation timeout"},CI=Symbol("sentry.amqplib.message.stored-span"),Rs=Symbol("sentry.amqplib.channel.spans-not-ended"),OI=Symbol("sentry.amqplib.channel.consume-timeout-timer"),PI=Symbol("sentry.amqplib.channel.consumer-info"),xI=Symbol("sentry.amqplib.channel.is-confirm-publishing"),eD=Symbol("sentry.amqplib.connection.attributes"),tD=()=>{},BU=!1,Y$=(()=>({name:U$,setupOnce(){!Kn.tracingChannel||BU||(BU=!0,$&&g.log("[orchestrion:amqplib] subscribing to amqplib tracing channels"),ue(()=>{Q$(),j$(),Z$(),X$(),K$(),q$()}))}}));function j$(){ee(Kn.tracingChannel(A.AMQPLIB_PUBLISH),e=>{if(!e.self?.[xI])return rD(e)})}function Z$(){let e=Kn.tracingChannel(A.AMQPLIB_CONFIRM_PUBLISH);ee(e,t=>(t.self&&(t.self[xI]=!0),rD(t))),e.end.subscribe(t=>{let n=t.self;n&&(n[xI]=!1)})}function X$(){let e=Kn.tracingChannel(A.AMQPLIB_CONSUME);e.start.subscribe(tD),e.asyncEnd.subscribe(t=>{let n=t,r=n.self,i=n.result?.consumerTag;if(!r||!i)return;nD(r);let s=n.arguments[0],c=typeof s=="string"?s:"<unknown>",a=n.arguments[2];r[PI]?.set(i,{noAck:!!a?.noAck,queue:c})})}function K$(){ee(Kn.tracingChannel(A.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;nD(t);let o=n?.consumerTag?t[PI]?.get(n.consumerTag):void 0,i=o?.queue??r.fields?.routingKey??"<unknown>",s=o?.noAck??!1,c=r.properties?.headers,a=YU(c,"sentry-trace"),l=YU(c,"baggage"),p=vn({sentryTrace:a,baggage:l},()=>$$(i,r,t));return s||(t[Rs]?.push({msg:r,timeOfConsume:lt()}),r[CI]=p),e._sentryNoAck=s,p},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function q$(){Kn.tracingChannel(A.AMQPLIB_ACK).start.subscribe(e=>RI(e,!1,qn.Ack)),Kn.tracingChannel(A.AMQPLIB_NACK).start.subscribe(e=>RI(e,!0,qn.Nack)),Kn.tracingChannel(A.AMQPLIB_REJECT).start.subscribe(e=>RI(e,!0,qn.Reject)),Kn.tracingChannel(A.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&Kf(t.self,!1,qn.AckAll,void 0)}),Kn.tracingChannel(A.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&Kf(t.self,!0,qn.NackAll,t.arguments[0])})}function Q$(){let e=Kn.tracingChannel(A.AMQPLIB_CONNECT);e.start.subscribe(tD),e.asyncEnd.subscribe(t=>{let n=t,r=n.result;!r||typeof r!="object"||(r[eD]={...ez(n.arguments?.[0]),...z$(r)})})}function RI(e,t,n){let r=e.self;if(!r)return;let o=e.arguments[0];if(!o)return;let i=e.arguments[1],s=e.arguments[2],c=n===qn.Reject?i:s,a=r[Rs]??[],l=a.findIndex(p=>p.msg===o);if(l<0)Rp(o,t,n,c);else if(n!==qn.Reject&&i){for(let p=0;p<=l;p++)Rp(a[p].msg,t,n,c);a.splice(0,l+1)}else Rp(o,t,n,c),a.splice(l,1)}function nD(e){if(Object.prototype.hasOwnProperty.call(e,Rs))return;e[Rs]=[],e[PI]=new Map;let t=setInterval(()=>J$(e),zU);t.unref?.(),e[OI]=t,typeof e.on=="function"&&(e.on("close",()=>{Kf(e,!0,qn.ChannelClosed,void 0),HU(e)}),e.on("error",()=>{Kf(e,!0,qn.ChannelError,void 0),HU(e)}))}function HU(e){let t=e[OI];t&&(clearInterval(t),e[OI]=void 0)}function J$(e){let t=lt(),n=e[Rs]??[],r;for(r=0;r<n.length;r++){let o=n[r];if((t-o.timeOfConsume)*1e3<zU)break;Rp(o.msg,null,qn.InstrumentationTimeout,!0)}n.splice(0,r)}function Kf(e,t,n,r){(e[Rs]??[]).forEach(i=>{Rp(i.msg,t,n,r)}),e[Rs]=[]}function Rp(e,t,n,r){let o=e[CI];o&&(t!==!1&&o.setStatus({code:2,message:n!==qn.ChannelClosed&&n!==qn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),o.end(),e[CI]=void 0)}function rD(e){let t=e.arguments[0],n=e.arguments[1],r=typeof t=="string"?t:"",o=typeof n=="string"?n:"",i=e.arguments[3],s=M({name:`publish ${tz(r)}`,op:"message",kind:D.PRODUCER,attributes:{...oD(e.self),[jU]:r,[On]:r,[ZU]:$U,[XU]:o,[QU]:o,[pr]:V$,[KU]:i?.messageId,[sa]:i?.messageId,[qU]:i?.correlationId,[JU]:i?.correlationId,[S]:D$}});(!i||typeof i!="object")&&(i={},e.arguments[3]=i);let c=i.headers&&typeof i.headers=="object"?i.headers:i.headers={},a=$e({span:s});return a["sentry-trace"]&&(c["sentry-trace"]=a["sentry-trace"]),a.baggage&&(c.baggage=a.baggage),s}function $$(e,t,n){return M({name:`${e} process`,op:"message",kind:D.CONSUMER,attributes:{...oD(n),[jU]:t.fields?.exchange,[On]:t.fields?.exchange,[ZU]:$U,[XU]:t.fields?.routingKey,[QU]:t.fields?.routingKey,[H$]:DU,[pr]:DU,[KU]:t.properties?.messageId,[sa]:t.properties?.messageId,[qU]:t.properties?.correlationId,[JU]:t.properties?.correlationId,[S]:B$}})}function oD(e){let t=e?.connection,n=t?.[eD];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r=="string"&&r?{[Ut]:r.toLowerCase()}:{}}function z$(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t=="string"&&t?{[Ut]:t.toLowerCase()}:{}}function ez(e){let t={[F$]:"0.9.1",[f0]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,o=WU(r.protocol),i=VU(r.hostname),s=FU(r.port,o);t[UU]=o,t[wh]=o,t[_t]=i,t[ht]=s,t[Le]=i,t[xe]=s}else if(typeof n=="string"){let r=nz(n);t[W$]=r,t[pt]=r;try{let o=new URL(r),i=WU(o.protocol),s=VU(o.hostname),c=FU(o.port?parseInt(o.port,10):void 0,i);t[UU]=i,t[wh]=i,t[_t]=s,t[ht]=c,t[Le]=s,t[xe]=c}catch{}}return t}function tz(e){return e!==""?e:"<default>"}function nz(e){return e.replace(/:[^:@/]*@/,":***@")}function FU(e,t){return e||(t==="AMQP"?5672:5671)}function WU(e){let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()}function VU(e){return e||"localhost"}function YU(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}var iD=Y$;import*as kI from"diagnostics_channel";var aD="Anthropic_AI",rz="auto.ai.orchestrion.anthropic",oz=[{channel:A.ANTHROPIC_CHAT,operation:"chat",methodPath:"messages.create",stream:"async-iterable"},{channel:A.ANTHROPIC_MODELS,operation:"models",methodPath:"models.retrieve",stream:"none"},{channel:A.ANTHROPIC_MESSAGES_STREAM,operation:"chat",methodPath:"messages.stream",stream:"message-stream"}],sD=!1,iz=((e={})=>({name:aD,setupOnce(){!kI.tracingChannel||sD||(sD=!0,ue(()=>{for(let{channel:t,operation:n,methodPath:r,stream:o}of oz)$&&g.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),ee(kI.tracingChannel(t),i=>sz(i,n,r,e),{beforeSpanEnd:(i,s)=>{bd(i,s.result,Ze(e).recordOutputs)},deferSpanEnd:({span:i,data:s})=>lz(i,s,o,e)})}))}}));function sz(e,t,n,r){let o=e.arguments??[];if(Pn(aD)||o[1]?.headers?.["X-Stainless-Helper-Method"]==="stream")return;let s=typeof o[0]=="object"&&o[0]!==null?o[0]:void 0,{recordInputs:c}=Ze(r),a=ze(r.enableTruncation),l=hd(o,n,t),p=l[De]||"unknown";l[S]=rz;let u=M({name:`${t} ${p}`,op:`gen_ai.${t}`,attributes:l});return c&&s&&Ia(u,s,a),u}function az(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function cz(e){return!!e&&typeof e.on=="function"}function lz(e,t,n,r){let{recordOutputs:o}=Ze(r),i=t.result;if(n==="async-iterable"&&az(i)){let s=i[Symbol.asyncIterator].bind(i),c=yl({[Symbol.asyncIterator]:s},e,o);return i[Symbol.asyncIterator]=()=>c,!0}return n==="message-stream"&&cz(i)?(Sl(i,e,o),!0):!1}var cD=iz;import*as BI from"diagnostics_channel";var lD="auto.aws.orchestrion.aws_sdk",pD="dynamodb",uD="messaging.destination_kind",dD="topic",LI="chat",MI="aws.bedrock";var pz=new TextDecoder,qf=class{requestPreSpanHook(t){switch(t.commandName){case"Converse":return this._requestPreSpanHookConverse(t,!1);case"ConverseStream":return this._requestPreSpanHookConverse(t,!0);case"InvokeModel":return this._requestPreSpanHookInvokeModel(t,!1);case"InvokeModelWithResponseStream":return this._requestPreSpanHookInvokeModel(t,!0)}return{}}responseHook(t,n){let r=t.request.commandName;if(!n.isRecording()){(r==="ConverseStream"||r==="InvokeModelWithResponseStream")&&n.end();return}switch(r){case"Converse":return this._responseHookConverse(t,n);case"ConverseStream":return this._responseHookConverseStream(t,n);case"InvokeModel":return this._responseHookInvokeModel(t,n);case"InvokeModelWithResponseStream":return this._responseHookInvokeModelWithResponseStream(t,n)}}_requestPreSpanHookConverse(t,n){let r=LI,o={[Qc]:MI,[Nu]:LI},i=t.commandInput.modelId;i&&(o[qc]=i,r&&(r+=` ${i}`));let s=t.commandInput.inferenceConfig;if(s){let{maxTokens:c,temperature:a,topP:l,stopSequences:p}=s;c!==void 0&&(o[yo]=c),a!==void 0&&(o[So]=a),l!==void 0&&(o[Eo]=l),p!==void 0&&(o[qo]=p)}return{spanName:r,isStream:n,spanAttributes:o}}_requestPreSpanHookInvokeModel(t,n){let r={[Qc]:MI},o=t.commandInput?.modelId;if(o&&(r[qc]=o),t.commandInput?.body){let i=JSON.parse(t.commandInput.body);o.includes("amazon.titan")?(i.textGenerationConfig?.temperature!==void 0&&(r[So]=i.textGenerationConfig.temperature),i.textGenerationConfig?.topP!==void 0&&(r[Eo]=i.textGenerationConfig.topP),i.textGenerationConfig?.maxTokenCount!==void 0&&(r[yo]=i.textGenerationConfig.maxTokenCount),i.textGenerationConfig?.stopSequences!==void 0&&(r[qo]=i.textGenerationConfig.stopSequences)):o.includes("amazon.nova")?(i.inferenceConfig?.temperature!==void 0&&(r[So]=i.inferenceConfig.temperature),i.inferenceConfig?.top_p!==void 0&&(r[Eo]=i.inferenceConfig.top_p),i.inferenceConfig?.max_new_tokens!==void 0&&(r[yo]=i.inferenceConfig.max_new_tokens),i.inferenceConfig?.stopSequences!==void 0&&(r[qo]=i.inferenceConfig.stopSequences)):o.includes("anthropic.claude")?(i.max_tokens!==void 0&&(r[yo]=i.max_tokens),i.temperature!==void 0&&(r[So]=i.temperature),i.top_p!==void 0&&(r[Eo]=i.top_p),i.stop_sequences!==void 0&&(r[qo]=i.stop_sequences)):o.includes("meta.llama")?(i.max_gen_len!==void 0&&(r[yo]=i.max_gen_len),i.temperature!==void 0&&(r[So]=i.temperature),i.top_p!==void 0&&(r[Eo]=i.top_p)):o.includes("cohere.command-r")?(i.max_tokens!==void 0&&(r[yo]=i.max_tokens),i.temperature!==void 0&&(r[So]=i.temperature),i.p!==void 0&&(r[Eo]=i.p),i.message!==void 0&&(r[zt]=Math.ceil(i.message.length/6)),i.stop_sequences!==void 0&&(r[qo]=i.stop_sequences)):o.includes("cohere.command")?(i.max_tokens!==void 0&&(r[yo]=i.max_tokens),i.temperature!==void 0&&(r[So]=i.temperature),i.p!==void 0&&(r[Eo]=i.p),i.prompt!==void 0&&(r[zt]=Math.ceil(i.prompt.length/6)),i.stop_sequences!==void 0&&(r[qo]=i.stop_sequences)):o.includes("mistral")&&(i.prompt!==void 0&&(r[zt]=Math.ceil(i.prompt.length/6)),i.max_tokens!==void 0&&(r[yo]=i.max_tokens),i.temperature!==void 0&&(r[So]=i.temperature),i.top_p!==void 0&&(r[Eo]=i.top_p),i.stop!==void 0&&(r[qo]=i.stop))}return{isStream:n,spanAttributes:r}}_responseHookConverse(t,n){let{stopReason:r,usage:o}=t.data;mD(n,r),fD(n,o)}_responseHookConverseStream(t,n){t.data.stream=dz(t.data.stream,n)}_responseHookInvokeModel(t,n){let r=t.request.commandInput?.modelId;if(t.data?.body){let o=pz.decode(t.data.body),i=JSON.parse(o);r.includes("amazon.titan")?(i.inputTextTokenCount!==void 0&&n.setAttribute(zt,i.inputTextTokenCount),i.results?.[0]?.tokenCount!==void 0&&n.setAttribute(Tt,i.results[0].tokenCount),i.results?.[0]?.completionReason!==void 0&&n.setAttribute(Ct,[i.results[0].completionReason])):r.includes("amazon.nova")?(i.usage!==void 0&&(i.usage.inputTokens!==void 0&&n.setAttribute(zt,i.usage.inputTokens),i.usage.outputTokens!==void 0&&n.setAttribute(Tt,i.usage.outputTokens)),i.stopReason!==void 0&&n.setAttribute(Ct,[i.stopReason])):r.includes("anthropic.claude")?(i.usage?.input_tokens!==void 0&&n.setAttribute(zt,i.usage.input_tokens),i.usage?.output_tokens!==void 0&&n.setAttribute(Tt,i.usage.output_tokens),i.stop_reason!==void 0&&n.setAttribute(Ct,[i.stop_reason])):r.includes("meta.llama")?(i.prompt_token_count!==void 0&&n.setAttribute(zt,i.prompt_token_count),i.generation_token_count!==void 0&&n.setAttribute(Tt,i.generation_token_count),i.stop_reason!==void 0&&n.setAttribute(Ct,[i.stop_reason])):r.includes("cohere.command-r")?(i.text!==void 0&&n.setAttribute(Tt,Math.ceil(i.text.length/6)),i.finish_reason!==void 0&&n.setAttribute(Ct,[i.finish_reason])):r.includes("cohere.command")?(i.generations?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(i.generations[0].text.length/6)),i.generations?.[0]?.finish_reason!==void 0&&n.setAttribute(Ct,[i.generations[0].finish_reason])):r.includes("mistral")&&(i.outputs?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(i.outputs[0].text.length/6)),i.outputs?.[0]?.stop_reason!==void 0&&n.setAttribute(Ct,[i.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(t,n){let r=t.data?.body,o=t.request.commandInput?.modelId;if(!r||!o)return;let i=uz(o);t.data.body=(async function*(){try{for await(let s of r){if(i){let c=mz(s?.chunk?.bytes);c&&i(c,n)}yield s}}finally{n.end()}})()}};function uz(e){if(e.includes("amazon.titan"))return _z;if(e.includes("anthropic.claude"))return gz;if(e.includes("amazon.nova"))return fz;if(e.includes("meta.llama"))return hz;if(e.includes("cohere.command-r"))return Sz;if(e.includes("cohere.command"))return yz;if(e.includes("mistral"))return bz}async function*dz(e,t){try{let n;for await(let r of e)mD(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;fD(t,n)}finally{t.end()}}function mD(e,t){t!==void 0&&e.setAttribute(Ct,[t])}function fD(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(zt,n),r!==void 0&&e.setAttribute(Tt,r)}}function mz(e){if(!e||!(e instanceof Uint8Array))return null;try{let t=Buffer.from(e).toString("utf-8");return JSON.parse(t)}catch(t){return $&&g.warn("[orchestrion:aws-sdk] failed to parse streamed bedrock chunk",t),null}}function fz(e,t){e.metadata?.usage!==void 0&&(e.metadata?.usage.inputTokens!==void 0&&t.setAttribute(zt,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(Tt,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(Ct,[e.messageStop.stopReason])}function gz(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(zt,e.message.usage.input_tokens),e.message?.usage?.output_tokens!==void 0&&t.setAttribute(Tt,e.message.usage.output_tokens),e.delta?.stop_reason!==void 0&&t.setAttribute(Ct,[e.delta.stop_reason])}function _z(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(zt,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(Tt,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(Ct,[e.completionReason])}function hz(e,t){e.prompt_token_count!==void 0&&t.setAttribute(zt,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(Tt,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(Ct,[e.stop_reason])}function bz(e,t){e.outputs?.[0]?.text!==void 0&&t.setAttribute(Tt,Math.ceil(e.outputs[0].text.length/6)),e.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(Ct,[e.outputs[0].stop_reason])}function yz(e,t){e.generations?.[0]?.text!==void 0&&t.setAttribute(Tt,Math.ceil(e.generations[0].text.length/6)),e.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(Ct,[e.generations[0].finish_reason])}function Sz(e,t){e.text!==void 0&&t.setAttribute(Tt,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(Ct,[e.finish_reason])}function pc(e){return Array.isArray(e)?e:[e]}var Qf=class{requestPreSpanHook(t){let n=t.commandName,r=t.commandInput?.TableName,o={};return o[Pe]=pD,o[Et]=r,o[na]=n,t.commandInput?.TableName?o[Oh]=[t.commandInput.TableName]:t.commandInput?.RequestItems&&(o[Oh]=Object.keys(t.commandInput.RequestItems)),(n==="CreateTable"||n==="UpdateTable")&&t.commandInput?.ProvisionedThroughput&&(o[PR]=t.commandInput.ProvisionedThroughput.ReadCapacityUnits,o[kR]=t.commandInput.ProvisionedThroughput.WriteCapacityUnits),(n==="GetItem"||n==="Scan"||n==="Query")&&t.commandInput?.ConsistentRead&&(o[ER]=t.commandInput.ConsistentRead),(n==="Query"||n==="Scan")&&t.commandInput?.ProjectionExpression&&(o[xR]=t.commandInput.ProjectionExpression),n==="CreateTable"&&(t.commandInput?.GlobalSecondaryIndexes&&(o[NR]=pc(t.commandInput.GlobalSecondaryIndexes).map(i=>JSON.stringify(i))),t.commandInput?.LocalSecondaryIndexes&&(o[OR]=pc(t.commandInput.LocalSecondaryIndexes).map(i=>JSON.stringify(i)))),(n==="ListTables"||n==="Query"||n==="Scan")&&t.commandInput?.Limit&&(o[CR]=t.commandInput.Limit),n==="ListTables"&&t.commandInput?.ExclusiveStartTableName&&(o[AR]=t.commandInput.ExclusiveStartTableName),n==="Query"&&(t.commandInput?.ScanIndexForward&&(o[MR]=t.commandInput.ScanIndexForward),t.commandInput?.IndexName&&(o[Rh]=t.commandInput.IndexName),t.commandInput?.Select&&(o[Ch]=t.commandInput.Select)),n==="Scan"&&(t.commandInput?.Segment&&(o[wR]=t.commandInput?.Segment),t.commandInput?.TotalSegments&&(o[UR]=t.commandInput?.TotalSegments),t.commandInput?.IndexName&&(o[Rh]=t.commandInput.IndexName),t.commandInput?.Select&&(o[Ch]=t.commandInput.Select)),n==="UpdateTable"&&(t.commandInput?.AttributeDefinitions&&(o[SR]=pc(t.commandInput.AttributeDefinitions).map(i=>JSON.stringify(i))),t.commandInput?.GlobalSecondaryIndexUpdates&&(o[vR]=pc(t.commandInput.GlobalSecondaryIndexUpdates).map(i=>JSON.stringify(i)))),{spanAttributes:o,spanKind:D.CLIENT,spanOp:"db"}}responseHook(t,n){t.data?.ConsumedCapacity&&n.setAttribute(TR,pc(t.data.ConsumedCapacity).map(r=>JSON.stringify(r))),t.data?.ItemCollectionMetrics&&n.setAttribute(RR,pc(t.data.ItemCollectionMetrics).map(r=>JSON.stringify(r))),t.data?.TableNames&&n.setAttribute(GR,t.data?.TableNames.length),t.data?.Count&&n.setAttribute(IR,t.data?.Count),t.data?.ScannedCount&&n.setAttribute(LR,t.data?.ScannedCount)}};var Jf=class{requestPreSpanHook(t){let n=t.commandInput?.StreamName,r={};return n&&(r[DR]=n),{spanAttributes:r,spanKind:D.CLIENT}}};var $f="Invoke",zf=class{requestPreSpanHook(t){let n=t.commandInput?.FunctionName,r={},o;return t.commandName===$f&&(r[jR]=n,r[ZR]="aws",o=`${n} ${$f}`),{spanAttributes:r,spanKind:D.CLIENT,spanName:o}}requestPostSpanHook(t,n){t.commandName===$f&&t.commandInput&&(t.commandInput.ClientContext=Ez(t.commandInput.ClientContext,n))}responseHook(t,n){t.request.commandName===$f&&(n.setAttribute(YR,t.requestId),t.request.region&&n.setAttribute(XR,t.request.region))}};function Ez(e,t){try{let n=$e({span:t}),r=e?JSON.parse(Buffer.from(e,"base64").toString("utf8")):{},o={...r,custom:{...r.custom,...n}},i=Buffer.from(JSON.stringify(o)).toString("base64");return i.length>3583?($&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations."),e):i}catch(n){return $&&g.log("[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext",n),e}}var eg=class{requestPreSpanHook(t){let n=t.commandInput?.Bucket,r={};return n&&(r[FR]=n),{spanAttributes:r,spanKind:D.CLIENT}}};var tg=class{requestPreSpanHook(t){let n=t.commandInput?.SecretId,r={};return typeof n=="string"&&n.startsWith("arn:aws:secretsmanager:")&&(r[xh]=n),{spanAttributes:r,spanKind:D.CLIENT}}responseHook(t,n){let r=t.data?.ARN;r&&n.setAttribute(xh,r)}};var Tz=10,wI="sentry-trace",GI="baggage",Iz=[wI,GI];function Cp(e,t){let n=e??{},r=Object.keys(t);if(Object.keys(n).length+r.length<=Tz)for(let o of r){let i=t[o];i&&(n[o]={DataType:"String",StringValue:i})}else $&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes");return n}function gD(e){let t=e.MessageAttributes??{},n=t[wI]?.StringValue??t[wI]?.Value;if(n)return{sentryTrace:n,baggage:t[GI]?.StringValue??t[GI]?.Value}}function _D(e=[]){return sl([...e,...Iz])}var ng=class{requestPreSpanHook(t){let n=D.CLIENT,r=`SNS ${t.commandName}`,o={[Ut]:"aws.sns"};if(t.commandName==="Publish"){n=D.PRODUCER,o[uD]=dD;let{TopicArn:s,TargetArn:c,PhoneNumber:a}=t.commandInput,l=Az(s,c,a);o[u0]=l,o[On]=s||c||a||"unknown",r=`${a?"phone_number":l} send`}let i=t.commandInput?.TopicArn;return i&&(o[Ph]=i),{spanAttributes:o,spanKind:n,spanName:r}}requestPostSpanHook(t,n){if(t.commandName==="Publish"){let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=Cp(r,$e({span:n}))}}responseHook(t,n){let r=t.data?.TopicArn;r&&n.setAttribute(Ph,r)}};function Az(e,t,n){if(e||t){let r=e??t;try{return r.substring(r.lastIndexOf(":")+1)}catch{return r}}else return n||"unknown"}var rg=class{requestPreSpanHook(t){let n=vz(t.commandInput),r=Rz(n),o=D.CLIENT,i,s={[Ut]:"aws_sqs",[On]:r,[pt]:n};switch(t.commandName){case"ReceiveMessage":o=D.CONSUMER,i=`${r} receive`,s[pr]="receive",t.commandInput.MessageAttributeNames=_D(t.commandInput.MessageAttributeNames);break;case"SendMessage":case"SendMessageBatch":o=D.PRODUCER,i=`${r} send`;break}return{spanAttributes:s,spanKind:o,spanName:i}}requestPostSpanHook(t,n){switch(t.commandName){case"SendMessage":{let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=Cp(r,$e({span:n}))}break;case"SendMessageBatch":{let r=t.commandInput?.Entries;if(Array.isArray(r)){let o=$e({span:n});r.forEach(i=>{i.MessageAttributes=Cp(i.MessageAttributes??{},o)})}}break}}responseHook(t,n){switch(t.request.commandName){case"SendMessage":n.setAttribute(sa,t?.data?.MessageId);break;case"SendMessageBatch":break;case"ReceiveMessage":{let r=t?.data?.Messages||[];n.setAttribute(ia,r.length);for(let o of r)Nz(n,o);break}}}};function Nz(e,t){let n=gD(t);if(!n)return;let{parentSpanId:r,traceId:o,sampled:i}=Nn(n.sentryTrace,n.baggage);o&&r&&e.addLink({context:{traceId:o,spanId:r,traceFlags:i?1:0},attributes:{[sa]:t.MessageId}})}function vz(e){return e?.QueueUrl}function Rz(e){if(!e)return;let t=e.split("/");if(t.length!==0)return t[t.length-1]}var og=class{requestPreSpanHook(t){let n=t.commandInput?.stateMachineArn,r=t.commandInput?.activityArn,o={};return n&&(o[VR]=n),r&&(o[WR]=r),{spanAttributes:o,spanKind:D.CLIENT}}};var ig=class{constructor(){this._services=new Map([["SecretsManager",new tg],["SFN",new og],["SQS",new rg],["SNS",new ng],["DynamoDB",new Qf],["Lambda",new zf],["S3",new eg],["Kinesis",new Jf],["BedrockRuntime",new qf]])}requestPreSpanHook(t){let n=this._services.get(t.serviceName);return n?n.requestPreSpanHook(t):{}}requestPostSpanHook(t,n){this._services.get(t.serviceName)?.requestPostSpanHook?.(t,n)}responseHook(t,n){this._services.get(t.request.serviceName)?.responseHook?.(t,n)}};function UI(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function hD(e,t,n,r){return{serviceName:e?.replace(/\s+/g,""),commandName:UI(t,"Command"),commandInput:n,region:r}}function bD(e){return{[E0]:"aws-api",[S0]:e.commandName,[xu]:e.serviceName,[Tu]:e.region}}var Cz="Aws";function DI(e){try{return e()}catch(t){$&&g.warn("[orchestrion:aws-sdk] error building span",t);return}}function yD(e,t){t&&(t.requestId&&e.setAttribute(HR,t.requestId),t.httpStatusCode&&e.setAttribute(To,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(BR,t.extendedRequestId))}var Oz=(()=>{let e=new ig;return{name:Cz,setupOnce(){if(!BI.tracingChannel)return;let t=o=>DI(()=>{let i=o.arguments[0],s=i?.constructor?.name;if(!i||!s)return;let c=o.self?.config,a=c?.serviceId??UI(o.self?.constructor?.name||"AWS","Client");i.input||(i.input={});let l=hD(a,s,i.input,void 0),p=e.requestPreSpanHook(l),u=M({name:p.spanName??`${l.serviceName}.${l.commandName}`,kind:p.spanKind??D.CLIENT,op:p.spanOp||"rpc",attributes:{[S]:lD,...bD(l),...p.spanAttributes}});o._sentryNormalizedRequest=l,o._sentryRequestMetadata=p;let d;try{d=c?.region?.()}catch{}let m={settled:!1,promise:Promise.resolve(d).then(_=>{_&&(l.region=_,u.setAttribute(Tu,_))}).catch(()=>{}).finally(()=>{m.settled=!0})};return o._sentryRegion=m,DI(()=>e.requestPostSpanHook(l,u)),u}),n={deferSpanEnd({span:o,data:i,end:s}){let c=i._sentryNormalizedRequest,a=i._sentryRequestMetadata;if(!c)return!1;let l="error"in i;if(DI(()=>{if(l){let m=i.error,_=m?.$metadata;yD(o,{requestId:m?.RequestId??_?.requestId,httpStatusCode:_?.httpStatusCode,extendedRequestId:m?.extendedRequestId??_?.extendedRequestId});return}let u=i.result;yD(o,u?.$metadata);let d={data:u,request:c,requestId:u?.$metadata?.requestId};e.responseHook(d,o)}),a?.isStream&&!l)return!0;let p=i._sentryRegion;return p&&!p.settled?(p.promise.then(()=>s()),!0):!1}},r=[A.AWS_SMITHY_CORE_SEND,A.AWS_SMITHY_CLIENT_SEND,A.AWS_SDK_SMITHY_CLIENT_SEND];$&&g.log(`[orchestrion:aws-sdk] subscribing to channels "${r.join('", "')}"`),ue(()=>{for(let o of r)ee(BI.tracingChannel(o),t,n)})}}}),SD=Oz;import*as Op from"diagnostics_channel";var xz="Dataloader",ED="dataloader",Pz="auto.db.orchestrion.dataloader",kz="cache.get",TD=Symbol("sentry.dataloader.wrapped");function Lz(e,t){let n=e?.name;return n?`${ED}.${t} ${n}`:`${ED}.${t}`}function Mz(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}function ID(e,t,n){let r=t==="load"||t==="loadMany"||t==="batch";return{name:Lz(e,t),kind:t==="batch"?void 0:D.CLIENT,op:r?kz:void 0,onlyIfParent:!0,attributes:{[S]:Pz,[ea]:r?Mz(n):void 0}}}var wz=(()=>({name:xz,setupOnce(){Op.tracingChannel&&($&&g.log("[orchestrion:dataloader] subscribing to dataloader tracing channels"),ue(()=>{Gz(),Uz(),sg(A.DATALOADER_LOAD_MANY,"loadMany"),sg(A.DATALOADER_PRIME,"prime"),sg(A.DATALOADER_CLEAR,"clear"),sg(A.DATALOADER_CLEAR_ALL,"clearAll")}))}}));function Gz(){Op.tracingChannel(A.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!="function"||n[TD])return;let r=n,o=function(...i){return Se({...ID(this,"batch",i[0]),links:this._batch?.spanLinks},()=>r.apply(this,i))};o[TD]=!0,t.arguments[0]=o})}function Uz(){let e=Op.tracingChannel(A.DATALOADER_LOAD);ee(e,t=>AD(t.self,"load",t.arguments[0]),{requiresParentSpan:!0}),e.end.subscribe(t=>{let n=t,r=n._sentrySpan,o=n.self?._batch;r&&o&&r.isRecording()&&(o.spanLinks??(o.spanLinks=[])).push({context:r.spanContext()})})}function sg(e,t){ee(Op.tracingChannel(e),n=>AD(n.self,t,n.arguments[0]),{requiresParentSpan:!0})}function AD(e,t,n){return M(ID(e,t,n))}var HI=wz;import*as FI from"diagnostics_channel";var Dz="GenericPool",Bz=(()=>({name:Dz,setupOnce(){FI.tracingChannel&&ue(()=>Hz())}})),ND=Bz;function Hz(){ee(FI.tracingChannel(A.GENERIC_POOL_ACQUIRE),()=>M({name:"generic-pool.acquire",attributes:{[S]:"auto.db.orchestrion.generic_pool"}}))}import*as WI from"diagnostics_channel";var CD="Google_GenAI",vD="auto.ai.orchestrion.google_genai",Fz=[{channel:A.GOOGLE_GENAI_GENERATE_CONTENT,operation:"generate_content"},{channel:A.GOOGLE_GENAI_EMBED_CONTENT,operation:"embeddings"},{channel:A.GOOGLE_GENAI_CHAT,operation:"chat"}],RD=!1,Wz=((e={})=>({name:CD,setupOnce(){!WI.tracingChannel||RD||(RD=!0,ue(()=>{for(let{channel:t,operation:n}of Fz)$&&g.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),ee(WI.tracingChannel(t),r=>Vz(r,n,e),{beforeSpanEnd:(r,o)=>{n!=="embeddings"&&Ed(r,o.result,Ze(e).recordOutputs)},deferSpanEnd:({span:r,data:o})=>jz(r,o,e)})}))}}));function Vz(e,t,n){if(Pn(CD))return;if(t!=="chat"){let p=Q();if(p){let{op:u,origin:d}=ie(p);if(d===vD&&u==="gen_ai.chat")return}}let o=(e.arguments??[])[0],{recordInputs:i}=Ze(n),s=ze(n.enableTruncation),c=Sd(t,o,e.self),a=c[De]||"unknown";c[S]=vD;let l=M({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return i&&o&&Tl(l,o,t,s),l}function Yz(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function jz(e,t,n){let r=t.result;if(!Yz(r))return!1;let{recordOutputs:o}=Ze(n),i=r[Symbol.asyncIterator].bind(r),s=El({[Symbol.asyncIterator]:i},e,o??!1);return r[Symbol.asyncIterator]=()=>s,!0}var OD=Wz;import*as kp from"diagnostics_channel";var ag="auto.graphql.diagnostic_channel",xD="graphql.parse",PD="graphql.validate",kD="graphql.execute",LD="graphql.resolve",MD="graphql.field.name",wD="graphql.field.path",GD="graphql.field.type",UD="graphql.parent.name",Ei=Symbol.for("opentelemetry.graphql_data"),xp=Symbol.for("opentelemetry.patched");function Zz(e){return typeof e?.then=="function"}function lg(e,t){if(!e||e[xp])return;e[xp]=!0;let n=e.getFields();Object.keys(n).forEach(r=>{let o=n[r];if(o&&(o.resolve&&(o.resolve=VI(t,o.resolve)),o.type))for(let i of BD(o.type))lg(i,t)})}function VI(e,t,n=!1){if(typeof t!="function"||t[xp])return t;function r(o,i,s,c){if(!t)return;let a=s??{};if(e().ignoreTrivialResolveSpans&&n&&(V(o)||typeof o=="function")&&typeof o[c.fieldName]!="function")return t.call(this,o,i,a,c);if(!a[Ei])return t.call(this,o,i,a,c);let p=Jz(c.path),{field:u,spanAdded:d}=Xz(a,c,p),m=u.span;return se(m,()=>{try{let _=t.call(this,o,i,a,c);return Zz(_)?_.then(h=>(cg(m,d),h),h=>{throw cg(m,d,h),h}):(cg(m,d),_)}catch(_){throw cg(m,d,_),_}})}return r[xp]=!0,r}function cg(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function Xz(e,t,n){let r=DD(e,n);if(r)return{field:r,spanAdded:!1};let o={span:Kz(t,n,Qz(e,n))};return qz(e,n,o),{field:o,spanAdded:!0}}function Kz(e,t,n){let r={[S]:ag,[H]:Lo,[MD]:e.fieldName,[wD]:t.join("."),[GD]:e.returnType.toString(),[UD]:e.parentType.name};return M({name:`${LD} ${t.join(".")}`,attributes:r,parentSpan:n})}function qz(e,t,n){let r=e[Ei];r&&(r.fields[t.join(".")]=n)}function DD(e,t){return e[Ei]?.fields[t.join(".")]}function Qz(e,t){for(let n=t.length-1;n>0;n--){let r=DD(e,t.slice(0,n));if(r)return r.span}return e[Ei]?.span}function Jz(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function BD(e){return"ofType"in e&&e.ofType?BD(e.ofType):$z(e)?e.getTypes():zz(e)?[e]:[]}function $z(e){return"getTypes"in e&&typeof e.getTypes=="function"}function zz(e){return"getFields"in e&&typeof e.getFields=="function"}function HD(e,t){let n=e?.definitions;if(!n||!Array.isArray(n))return;let r=o=>!!o?.operation&&["query","mutation","subscription"].indexOf(o.operation)!==-1;return t?n.filter(r).find(o=>t===o?.name?.value):n.find(r)}var YI={[S]:ag,[H]:Lo};function FD(){return M({name:xD,attributes:{...YI}})}function WD(e){return M({name:PD,attributes:{...YI,[oa]:za(e)}})}function VD(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:"invalid_argument"})}function e7(e){if(e.length>=2)return{schema:e[0],document:e[1],contextValue:e[3]??{},operationName:e[5],fieldResolver:e[6],writeBack:(n,r)=>{e[3]=n,e[6]=r}};let t=e[0]??{};return{schema:t.schema,document:t.document,contextValue:t.contextValue??{},operationName:t.operationName,fieldResolver:t.fieldResolver,writeBack:(n,r)=>{t.contextValue=n,t.fieldResolver=r}}}function YD(e,t,n,r){let o=e7(e),{schema:i,document:s}=o,{contextValue:c,fieldResolver:a}=o,l=!!c[Ei];if(!n.ignoreResolveSpans&&!l){let _=a==null,h=t?.defaultFieldResolver,b=a??h;b&&(a=VI(r,b,_)),i&&(lg(i.getQueryType(),r),lg(i.getMutationType(),r))}let p=HD(s,o.operationName),u=p?.operation,d=p?.name?.value??o.operationName??void 0,m=M({name:zm(u,d||void 0,kD),attributes:{...YI,[Ru]:u,[vu]:d||void 0,[oa]:za(s)}});return n.useOperationNameForRootSpan&&u&&$m(m,u,d||void 0),c[Ei]={source:s,span:m,fields:{}},o.writeBack(c,a),m}function jD(e,t){ef(t)&&e.setStatus({code:2,message:"internal_error"})}var ZD="Graphql";function t7(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function Pp(e){try{return e()}catch(t){$&&g.warn("[orchestrion:graphql] error building span",t);return}}var n7=((e={})=>{let t=t7(e),n=()=>t;return{name:ZD,setupOnce(){kp.tracingChannel&&ue(()=>{ee(kp.tracingChannel(A.GRAPHQL_PARSE),()=>Pp(()=>FD())),ee(kp.tracingChannel(A.GRAPHQL_VALIDATE),r=>Pp(()=>WD(r.arguments[1])),{beforeSpanEnd:(r,o)=>{Pp(()=>VD(r,o.result))}}),ee(kp.tracingChannel(A.GRAPHQL_EXECUTE),r=>Pp(()=>YD(r.arguments,r.self,t,n)),{beforeSpanEnd:(r,o)=>{Pp(()=>jD(r,o.result))}})})}}}),r7=n7,XD=e=>{let t=r7(e);return Bt(lp(e),{name:ZD,setupOnce:()=>t.setupOnce?.()})};import*as ug from"diagnostics_channel";var o7=["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"],uc=Symbol("hapi-handler-patched"),Lp={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},KD=new Set(o7),Sr=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(Sr||{});function i7(e){let t=Q();if(!t)return;let n=Re(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute(He,e)}var jI=e=>typeof e=="string"&&KD.has(e),s7=e=>{let t=e?.type;return t!==void 0&&jI(t)},a7=e=>Array.isArray(e)&&e.length<=3&&jI(e[0])&&typeof e[1]=="function",c7=e=>!Array.isArray(e),l7=(e,t)=>{let n={[He]:e.path,[Br]:e.method},r;return t?(n[Sr.HAPI_TYPE]=Lp.PLUGIN,n[Sr.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[Sr.HAPI_TYPE]=Lp.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},p7=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[Sr.EXT_TYPE]:e,[Sr.HAPI_TYPE]:Lp.EXT,[Sr.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[Sr.EXT_TYPE]:e,[Sr.HAPI_TYPE]:Lp.EXT},name:r}};function QD(e,t){return Se({name:e.name,op:`${e.attributes[Sr.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[S]:"auto.http.orchestrion.hapi"}},t)}function qD(e,t){if(e[uc]===!0)return e;e[uc]=!0;let n=r=>function(...o){if(!Q())return r.call(this,...o);i7(e.path);let i=l7(e,t);return QD(i,()=>r.call(this,...o))};if(typeof e.handler=="function")e.handler=n(e.handler);else if(typeof e.options=="function"){let r=e.options;e.options=function(o){let i=r(o);return typeof i.handler=="function"&&(i.handler=n(i.handler)),i}}else typeof e.options?.handler=="function"&&(e.options.handler=n(e.options.handler));return e}function pg(e,t,n){if(Array.isArray(e)){for(let r=0;r<e.length;r++)e[r]=pg(e[r],t);return e}else if(c7(e)){if(e[uc]===!0)return e;e[uc]=!0;let r=function(...o){if(!Q())return e.apply(this,o);let i=p7(t,n,e.name);return QD(i,()=>e.apply(void 0,o))};return r[uc]=!0,r}return e}function JD(e,t){let n=e[0];if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=qD(n[r],t);else e[0]=qD(n,t)}function $D(e,t){if(Array.isArray(e[0])){let n=e[0];for(let r=0;r<n.length;r++){let o=n[r];if(jI(o.type)){let i=o,s=pg(i.method,o.type,t);i.method=s,n[r]=i}}return}else if(a7(e)){let n=e,r=n[1],o=pg(r,n[0],t);e[1]=o;return}else if(s7(e[0])){let n=e[0],r=pg(n.method,n.type,t);n.method=r}}var u7="Hapi",d7=(()=>({name:u7,setupOnce(){ug.tracingChannel&&($&&g.log(`[orchestrion:hapi] subscribing to channels "${A.HAPI_ROUTE}" / "${A.HAPI_EXT}"`),ug.tracingChannel(A.HAPI_ROUTE).subscribe({start(e){let t=e;JD(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),ug.tracingChannel(A.HAPI_EXT).subscribe({start(e){let t=e;$D(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}})),zD=d7;import*as ZI from"diagnostics_channel";var m7="Koa",f7="auto.http.orchestrion.koa",dg={ROUTER:"router",MIDDLEWARE:"middleware"},eB=Symbol("sentry.koa.layer-patched"),tB=!1,g7=((e={})=>{let t=e.ignoreLayersType??[];return{name:m7,setupOnce(){!ZI.tracingChannel||tB||(tB=!0,$&&g.log(`[orchestrion:koa] subscribing to channel "${A.KOA_USE}"`),ZI.tracingChannel(A.KOA_USE).subscribe({start(n){_7(n,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function _7(e,t){let n=e.arguments[0];typeof n=="function"&&(e.arguments[0]=h7(n,t))}function h7(e,t){return e.router?b7(e,t):nB(e,!1,t)}function b7(e,t){let r=e.router?.stack??[];for(let o of r){let i=o.path,s=o.stack;s.forEach((c,a)=>{s[a]=nB(c,!0,t,i)})}return e}function nB(e,t,n,r){let o=t?dg.ROUTER:dg.MIDDLEWARE;return e[eB]===!0||n.includes(o)||e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?e:(e[eB]=!0,(i,s)=>{if(!Q())return e(i,s);let c=y7(i,e,t,r);i._matchedRoute&&S7(i._matchedRoute.toString());let a=c.attributes[Ou],l=typeof a=="string"?a||"< unknown >":c.name;return Se({name:l,op:`${o}.koa`,attributes:{...c.attributes,[S]:f7}},()=>{let p=c.attributes[He];if(J()===Rt())$&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(p){let u=i.request?.method?.toUpperCase()||"GET";J().setTransactionName(`${u} ${p}`)}return e(i,s)})})}function y7(e,t,n,r){return n?{attributes:{[Ou]:r?.toString(),[Mh]:dg.ROUTER,[He]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[Ou]:t.name||"middleware",[Mh]:dg.MIDDLEWARE,[Iu]:t.name||"middleware"},name:`middleware - ${t.name}`}}function S7(e){let t=Q();if(!t)return;let n=Re(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute(He,e)}var rB=g7;import*as mg from"diagnostics_channel";var E7="IORedis",T7="auto.db.orchestrion.redis",I7="db.connection_string";function iB(e){return{host:e?.options?.host,port:e?.options?.port}}function sB(e,t){return{[Pe]:"redis",[I7]:`redis://${e}:${t}`,[Le]:e,[xe]:t,[S]:T7}}var oB=new WeakSet;function A7(e){let t=e.arguments?.[0];if(!t||typeof t!="object"||oB.has(t))return;oB.add(t);let{host:n,port:r}=iB(e.self),o=no(t.name,t.args??[]);return M({name:o,op:"db",attributes:{...sB(n,r),[Ve]:o}})}var N7=((e={})=>{let t=e.responseHook;return{name:E7,setupOnce(){if(!mg.tracingChannel)return;$&&g.log(`[orchestrion:ioredis] subscribing to "${A.IOREDIS_COMMAND}"/"${A.IOREDIS_CONNECT}"`);let n=mg.tracingChannel(A.IOREDIS_COMMAND),r=mg.tracingChannel(A.IOREDIS_CONNECT);ue(()=>{ee(n,A7,{requiresParentSpan:!0,beforeSpanEnd(o,i){if("error"in i||!t)return;let s=i.arguments?.[0];s&&v7(t,o,s,i.result)}}),ee(r,o=>{let{host:i,port:s}=iB(o.self);return M({name:"connect",op:"db",attributes:{...sB(i,s),[Ve]:"connect"}})},{requiresParentSpan:!0})})}}});function v7(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var XI=N7;import*as gg from"diagnostics_channel";var dc="messaging.destination.partition.id",KI="messaging.kafka.message.key",qI="messaging.kafka.message.tombstone",aB="messaging.kafka.offset",QI="process",Mp="receive",cB="send",JI="kafka",lB="_OTHER";var R7="auto.kafkajs.orchestrion.producer",C7="auto.kafkajs.orchestrion.consumer",O7=1,x7=0;function wp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function pB(e){let t=wp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:o}=Nn(t,wp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:o?O7:x7}}]}function fg({topic:e,message:t,operationType:n,links:r,attributes:o}){let i=n===Mp?"poll":n;return M({name:`${i} ${e}`,op:"message",kind:n===Mp?D.CLIENT:D.CONSUMER,links:r,attributes:{...o,[Ut]:JI,[On]:e,[pr]:n,[aa]:i,[KI]:t?.key?String(t.key):void 0,[qI]:t?.key&&t.value===null?!0:void 0,[aB]:t?.offset,...t?{[S]:C7}:{}}})}function uB(e,t){let n=M({name:`send ${e}`,op:"message",kind:D.PRODUCER,attributes:{[Ut]:JI,[On]:e,[KI]:t.key?String(t.key):void 0,[qI]:t.key&&t.value===null?!0:void 0,[dc]:t.partition!==void 0?String(t.partition):void 0,[aa]:"send",[pr]:cB,[S]:R7}});t.headers=t.headers??{};let r=$e({span:n});return r["sentry-trace"]&&(t.headers["sentry-trace"]=r["sentry-trace"]),r.baggage&&(t.headers.baggage=r.baggage),n}function $I(e,t){let n,r=lB;typeof t=="string"||t===void 0?n=t:typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(t,"message")&&(n=t.message,r=t.constructor.name),e.forEach(o=>{o.setAttribute(Dr,r),o.setStatus({code:2,message:n})})}function zI(e,t){return Promise.resolve(t).catch(n=>{throw $I(e,n),n}).finally(()=>{e.forEach(n=>n.end())})}var eA=Symbol("sentry-kafkajs-consumer-callback-wrapped");function tA(e){return typeof e=="function"&&e[eA]===!0}function dB(e){let t=function(r){let o=wp(r.message.headers,"sentry-trace"),i=wp(r.message.headers,"baggage");return vn({sentryTrace:o,baggage:i},()=>{let s=fg({topic:r.topic,message:r.message,operationType:QI,attributes:{[dc]:String(r.partition)}}),c=se(s,()=>e.call(this,r));return zI([s],c)})};return t[eA]=!0,t}function mB(e){let t=function(r){let o=Rn(()=>fg({topic:r.batch.topic,message:void 0,operationType:Mp,attributes:{[ia]:r.batch.messages.length,[dc]:String(r.batch.partition)}}));return se(o,()=>{let i=[o];r.batch.messages.forEach(c=>{i.push(fg({topic:r.batch.topic,message:c,operationType:QI,links:pB(c.headers),attributes:{[dc]:String(r.batch.partition)}}))});let s=e.call(this,r);return zI(i,s)})};return t[eA]=!0,t}var P7="Kafka";function k7(){let e=gg.tracingChannel(A.KAFKAJS_SEND_BATCH),t={start(n){let r=[];(n.arguments[0]?.topicMessages??[]).forEach(o=>{o.messages.forEach(i=>{r.push(uB(o.topic,i))})}),n._sentrySpans=r},error(n){n._sentrySpans&&$I(n._sentrySpans,n.error)},asyncEnd(n){n._sentrySpans?.forEach(r=>r.end())}};e.subscribe(t)}function L7(){let e=gg.tracingChannel(A.KAFKAJS_CONSUMER_RUN),t={start(n){let r=n.arguments[0];!r||typeof r!="object"||(typeof r.eachMessage=="function"&&!tA(r.eachMessage)&&(r.eachMessage=dB(r.eachMessage)),typeof r.eachBatch=="function"&&!tA(r.eachBatch)&&(r.eachBatch=mB(r.eachBatch)))}};e.subscribe(t)}var M7=(()=>({name:P7,setupOnce(){gg.tracingChannel&&($&&g.log(`[orchestrion:kafkajs] subscribing to channels "${A.KAFKAJS_SEND_BATCH}", "${A.KAFKAJS_CONSUMER_RUN}"`),k7(),L7())}})),fB=M7;import*as _g from"diagnostics_channel";var w7="Knex",G7="auto.db.orchestrion.knex",U7=1021,D7="db.sql.table",B7="sqlite",H7="postgresql",rA=Symbol("sentry.orchestrion.knex.parent-span"),F7=(()=>({name:w7,setupOnce(){_g.tracingChannel&&($&&g.log(`[orchestrion:knex] subscribing to channel "${A.KNEX_QUERY}"`),ue(()=>{nA(A.KNEX_QUERY_BUILDER),nA(A.KNEX_SCHEMA_BUILDER),nA(A.KNEX_RAW),W7()}))}}));function nA(e){_g.tracingChannel(e).end.subscribe(t=>{let n=t.result;if(!n||typeof n!="object"||rA in n)return;let r=Q();r&&Object.defineProperty(n,rA,{value:r})})}function W7(){ee(_g.tracingChannel(A.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[rA]??Q();if(!r)return;let o=e.arguments[0],i=t?.client,s=i?.config?.connection,c=s?.connectionString,a=gB(n),l=o?.method,p=s?.filename||s?.database||X7(c),u={[S]:G7,"knex.version":e.moduleVersion,[Pe]:j7(i?.driverName),[D7]:a,[na]:l,[Gt]:s?.user,[Et]:p,[Le]:s?.host??K7(c),[xe]:s?.port??q7(c),[ca]:s?.filename===":memory:"?"inproc":void 0,[Ve]:o?.sql!=null?gn(o.sql,U7):void 0};return M({name:Z7(p,l,a)??"knex.query",kind:D.CLIENT,op:"db",parentSpan:r,attributes:u})},{beforeSpanEnd(e,t){if("error"in t){let n=V7(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function V7(e){let t=e.error;if(!t||typeof t!="object"||typeof t.message!="string")return;let n=t.message,r=e.arguments[0];if(!r?.sql)return n;try{let i=Y7(e.self)(r.sql,r.bindings||[]);return n.replace(`${i} - `,"")}catch{return n}}function Y7(e){if(e){let t=e.client;if(t){if(t._formatQuery)return t._formatQuery.bind(t);if(t.SqlString)return t.SqlString.format.bind(t.SqlString)}if(e.builder?.toString)return e.builder.toString.bind(e.builder)}return()=>"<noop formatter>"}function j7(e){return e==="sqlite3"?B7:e==="pg"?H7:e}function Z7(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function gB(e){let t=e?._single?.table;return t&&typeof t=="object"?gB(t):typeof t=="string"?t:void 0}function X7(e){if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}}function K7(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function q7(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var oA=F7;import*as hg from"diagnostics_channel";var Q7=Na,J7=[Xr,Kr,qr],_B=!1;function hB(){vo(J7)}var $7=((e={})=>({name:Q7,setupOnce(){if(!hg.tracingChannel||_B)return;_B=!0;let t=gr(e),n=r=>{hB();let o=r.arguments;if(!Array.isArray(o))return;let i=o[1];(!i||typeof i!="object"||Array.isArray(i))&&(i={},o[1]=i),i.callbacks=os(i.callbacks,t)};for(let r of[A.LANGCHAIN_CHAT_MODEL_INVOKE,A.LANGCHAIN_CHAT_MODEL_STREAM])$&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),hg.tracingChannel(r).start.subscribe(n);ue(()=>{for(let r of rU)$&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),ee(hg.tracingChannel(r),o=>z7(o,e))})}}));function z7(e,t){hB();let n=(e.arguments??[])[0];return M(Ad(e.self,n,t))}var bB=$7;import*as yg from"diagnostics_channel";var e6=Ca,yB=!1,bg=!1,t6=((e={})=>({name:e6,setupOnce(){if(!yg.tracingChannel||yB)return;yB=!0;let t=Ze(e),n=gr(t);ue(()=>{$&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_STATE_GRAPH_COMPILE}"`),ee(yg.tracingChannel(A.LANGGRAPH_STATE_GRAPH_COMPILE),o=>{if(bg)return;let i=iA(o.arguments),s=typeof i?.name=="string"?i.name:void 0;return M(Rd(s))},{beforeSpanEnd:(o,i)=>{SB(i.result,iA(i.arguments)??{},t,null,n)}}),$&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_CREATE_REACT_AGENT}"`);let r=yg.tracingChannel(A.LANGGRAPH_CREATE_REACT_AGENT);r.start.subscribe(o=>{bg=!0;try{let{arguments:i}=o,s=iA(i);s&&Array.isArray(s.tools)&&s.tools.length>0&&Rl(s.tools,t,Oa(i)??void 0)}catch(i){$&&g.error("[orchestrion:langgraph] failed to wrap createReactAgent tools",i)}}),r.end.subscribe(o=>{bg=!1;let{arguments:i,result:s}=o,c=Oa(i)??void 0;SB(s,c?{name:c}:{},t,vl(i),n)}),r.error.subscribe(()=>{bg=!1})})}}));function iA(e){let t=(e??[])[0];return typeof t=="object"&&t!==null?t:void 0}function SB(e,t,n,r,o){if(!e||typeof e!="object")return;let i=e,s=i.invoke;typeof s=="function"&&(i.invoke=Cl(s.bind(i),i,t,n,r,o))}var EB=t6;import*as sA from"diagnostics_channel";var n6="LruMemoizer",r6=(()=>({name:n6,setupOnce(){sA.tracingChannel&&($&&g.log(`[orchestrion:lru-memoizer] subscribing to channel "${A.LRU_MEMOIZER_LOAD}"`),ue(()=>{ee(sA.tracingChannel(A.LRU_MEMOIZER_LOAD),()=>{})}))}})),TB=r6;import*as Gp from"diagnostics_channel";var o6="Mongo",IB="auto.db.orchestrion.mongo",i6=new Set(["insert","update","delete","find","getMore","killCursors"]),s6=(()=>({name:o6,setupOnce(){Gp.tracingChannel&&ue(()=>{a6(),c6(),l6()})}}));function a6(){ee(Gp.tracingChannel(A.MONGODB_COMMAND),e=>{let t=e.arguments??[],n=t[0],r=t[1];if(!n||!r||typeof r!="object"||r.ismaster||r.hello)return;let o=Object.keys(r)[0];return yr(pp(e.self,n,r,o,IB))},{requiresParentSpan:!0})}function c6(){ee(Gp.tracingChannel(A.MONGODB_CHECKOUT),()=>{})}function l6(){for(let e of["insert","update","remove"]){let t=e==="insert"?A.MONGODB_V3_INSERT:e==="update"?A.MONGODB_V3_UPDATE:A.MONGODB_V3_REMOVE;Sg(t,n=>({topology:n[0],ns:n[1],command:n[2]?.[0],operation:e}))}Sg(A.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&i6.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?up(t):void 0}}),Sg(A.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:"find"})),Sg(A.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:"getMore"}))}function Sg(e,t){ee(Gp.tracingChannel(e),n=>{let r=n.arguments;if(!r)return;let o=t(r);if(!(!o||typeof o.ns!="string"))return yr(dp(o.ns,o.topology,o.command,o.operation,IB))},{requiresParentSpan:!0})}var AB=s6;import*as Up from"diagnostics_channel";var p6="Mongoose",u6="auto.db.orchestrion.mongoose",aA=new WeakMap,NB=!1,d6=(()=>({name:p6,setupOnce(){Up.tracingChannel&&ue(()=>{nf(Up.tracingChannel),m6()})}}));function m6(){if(!NB){NB=!0,$&&g.log("[orchestrion:mongoose] subscribing to injected channels");for(let e of gU)vB(e).subscribe({start(t){RB(t.self)}});vB(A.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t=="object"&&RB(t)}}),fc(A.MONGOOSE_QUERY_EXEC,e=>{let t=e;return mc(t.mongooseCollection,t.model?.modelName,t.op??"exec",aA.get(e))}),fc(A.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return mc(t?.collection,t?.modelName,"aggregate",aA.get(e))}),fc(A.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return mc(t.collection,t.modelName,"save")}),fc(A.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return mc(t.collection,t.modelName,"remove")}),fc(A.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return mc(t.collection,t.modelName,"insertMany")}),fc(A.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return mc(t.collection,t.modelName,"bulkWrite")})}}function mc(e,t,n,r){return wo({collection:e,modelName:t,operation:n,origin:u6,parentSpan:r})}function vB(e){return Up.tracingChannel(e)}function fc(e,t){ee(Up.tracingChannel(e),n=>{let r=n.self;if(r)return t(r)})}function RB(e){let t=Q();e&&t&&aA.set(e,t)}var CB=d6;import*as cA from"diagnostics_channel";var f6="Mysql",g6="db.system",_6="db.connection_string",h6="db.name",b6="db.user",y6="db.statement",S6="net.peer.name",E6="net.peer.port",T6=(()=>({name:f6,setupOnce(){cA.tracingChannel&&($&&g.log(`[orchestrion:mysql] subscribing to channel "${A.MYSQL_QUERY}"`),ue(()=>{ee(cA.tracingChannel(A.MYSQL_QUERY),e=>{let t=A6(e.arguments[0]),{host:n,port:r,database:o,user:i}=N6(e.self),s=typeof r=="string"?parseInt(r,10):r,c=typeof s=="number"&&!isNaN(s);return e._sentryCallerScope=ne(),M({name:t??"mysql.query",kind:D.CLIENT,op:"db",attributes:{[g6]:"mysql",[S]:"auto.db.orchestrion.mysql",[_6]:v6(n,c?s:void 0,o),...o?{[h6]:o}:{},...i?{[b6]:i}:{},...t?{[y6]:t}:{},...n?{[S6]:n}:{},...c?{[E6]:s}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!="object"||!I6(n))return!1;let r=e._sentryCallerScope;return r&&bn(n,r),n.on("error",o=>t(o)),n.on("end",()=>t()),!0}})}))}}));function I6(e){return"on"in e&&typeof e.on=="function"}function A6(e){if(typeof e=="string")return e;if(V(e)&&"sql"in e){let t=e.sql;return typeof t=="string"?t:void 0}}function N6(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function v6(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var OB=T6;import*as Eg from"diagnostics_channel";var R6="Mysql2",C6="auto.db.orchestrion.mysql2",O6="mysql";function x6(){rf(Eg.tracingChannel),xB(A.MYSQL2_QUERY),xB(A.MYSQL2_EXECUTE)}function xB(e){ee(Eg.tracingChannel(e),t=>{let n=P6(t.arguments);return M({name:n??"mysql2.query",kind:D.CLIENT,attributes:{[S]:C6,[H]:"db",[Pe]:O6,...L6(t.self?.config),[Ve]:n||void 0}})},{requiresParentSpan:!0})}function P6(e){return k6(e[0])}function k6(e){if(typeof e=="string")return e;if(V(e)&&"sql"in e){let t=e.sql;return typeof t=="string"?t:void 0}}function L6(e){let{host:t,port:n,database:r,user:o}=e?.connectionConfig??e??{},i=typeof n=="string"?parseInt(n,10):n,s=typeof i=="number"&&!isNaN(i);return{[Et]:r||void 0,[Gt]:o||void 0,[Le]:t||void 0,[xe]:s?i:void 0}}var M6=(()=>({name:R6,setupOnce(){Eg.tracingChannel&&ue(()=>{x6()})}})),PB=M6;import*as lA from"diagnostics_channel";var LB="OpenAI",w6="auto.ai.orchestrion.openai",G6=[{channel:A.OPENAI_CHAT,operation:"chat"},{channel:A.OPENAI_EMBEDDINGS,operation:"embeddings"}],kB=!1,U6=((e={})=>({name:LB,setupOnce(){!lA.tracingChannel||kB||(kB=!0,ue(()=>{for(let{channel:t,operation:n}of G6)$&&g.log(`[orchestrion:openai] subscribing to channel "${t}"`),ee(lA.tracingChannel(t),r=>D6(r,n,e),{beforeSpanEnd:(r,o)=>{_l(r,o.result,Ze(e).recordOutputs)},deferSpanEnd:({span:r,data:o})=>H6(r,o,e)})}))}}));function D6(e,t,n){if(Pn(LB))return;let r=e.arguments??[],o=r[0],{recordInputs:i}=Ze(n),s=ze(n.enableTruncation),c=fd(r,t);c[S]=w6;let a=o?.model||"unknown",l=M({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return i&&o&&bl(l,o,t,s),l}function B6(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function H6(e,t,n){let r=t.result;if(!B6(r))return!1;let{recordOutputs:o}=Ze(n),i=r[Symbol.asyncIterator].bind(r),s=hl({[Symbol.asyncIterator]:i},e,o??!1);return r[Symbol.asyncIterator]=()=>s,!0}var MB=U6;import*as uA from"diagnostics_channel";var F6="Postgres",W6="auto.db.orchestrion.postgres",wB="db.system",GB="db.name",UB="db.connection_string",DB="db.user",V6="db.statement",BB="net.peer.name",HB="net.peer.port",Y6="db.postgresql.plan",j6="db.postgresql.idle.timeout.millis",Z6="db.postgresql.max.client",FB="postgresql",X6="pg.query",K6="pg.connect",q6="pg-pool.connect",Q6=((e={})=>({name:F6,setupOnce(){uA.tracingChannel&&ue(()=>{pA(A.PG_QUERY,J6,{deferStreamedResult:!0}),e.ignoreConnectSpans||(pA(A.PG_CONNECT,$6),pA(A.PGPOOL_CONNECT,z6))})}}));function pA(e,t,{deferStreamedResult:n=!1}={}){$&&g.log(`[orchestrion:pg] subscribing to channel "${e}"`),ee(uA.tracingChannel(e),r=>(r._sentryCallerScope=ne(),M({...t(r),kind:D.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:r,end:o}){let i=r.result;if(!i||typeof i!="object"||!e8(i))return!1;let s=r._sentryCallerScope;return s&&bn(i,s),i.on("error",c=>o(c)),i.on("end",()=>o()),!0}}:{requiresParentSpan:!0})}function J6(e){let t=e.self?.connectionParameters??{},n=t8(e.arguments);return{name:n?.text??X6,op:"db",attributes:{...WB(t),[S]:W6,[V6]:n?.text||void 0,[Y6]:typeof n?.name=="string"?n.name:void 0}}}function $6(e){let t=e.self?.connectionParameters??{};return{name:K6,op:"db",attributes:WB(t)}}function z6(e){let t=e.self?.options??{};return{name:q6,op:"db",attributes:n8(t)}}function e8(e){return"on"in e&&typeof e.on=="function"}function t8(e){let t=e[0];if(typeof t=="string")return{text:t};if(V(t)&&typeof t.text=="string"){let n=t;return{text:n.text,name:n.name}}}function WB(e){return{[wB]:FB,[UB]:VB(e),[GB]:e.database,[DB]:e.user,[BB]:e.host,[HB]:Number.isInteger(e.port)?e.port:void 0}}function n8(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}let n=t?.pathname.slice(1)||e.database,r=t?.hostname||e.host,o=Number(t?.port)||(Number.isInteger(e.port)?e.port:void 0),i=t?.username||e.user;return{[wB]:FB,[UB]:VB(e),[j6]:e.idleTimeoutMillis,[Z6]:e.max,[GB]:n,[HB]:o,[BB]:r||void 0,[DB]:i||void 0}}function VB(e){if(e.connectionString)try{let o=new URL(e.connectionString);return o.username="",o.password="",o.toString()}catch{return"postgresql://localhost:5432/"}let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}var YB=Q6;import*as gc from"diagnostics_channel";var r8="PostgresJs",o8="auto.db.orchestrion.postgresjs",i8="db.response.status_code",Qn=()=>{},s8=Symbol.for("sentry.query.from.instrumented.sql"),XB=Symbol("sentryPostgresJsSpan"),jB=Symbol("sentryPostgresJsConnectionAttrsSet"),KB=Symbol("sentryPostgresJsSpanEnded"),qB=new WeakMap,Tg=[];function a8(e){Tg.some(n=>n.ATTR_SERVER_ADDRESS===e.ATTR_SERVER_ADDRESS&&n.ATTR_SERVER_PORT===e.ATTR_SERVER_PORT&&n.ATTR_DB_NAMESPACE===e.ATTR_DB_NAMESPACE)||Tg.push(e)}function c8(){return Tg.length===1?Tg[0]:void 0}function l8(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!="object"||!n)return;let r=jd(n);qB.set(t,r),a8(r)}function QB(e,t,n){let r=t;r[jB]||(r[jB]=!0,Yd(e,n))}function ZB(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[XB],o=qB.get(t);r&&o&&QB(r,n,o)}function p8(e,t,n){let r=e.self;if(!r)return;let o=()=>{e[KB]=!0},i=r.resolve;typeof i=="function"&&(r.resolve=function(...c){o();try{let a=c[0]?.command;ka(t,n,a),t.end()}catch(a){$&&g.error("[orchestrion:postgresjs] error ending span in resolve:",a)}return i.apply(this,c)});let s=r.reject;typeof s=="function"&&(r.reject=function(...c){o();try{let a=c[0];t.setStatus({code:2,message:a?.message||"unknown_error"}),t.setAttribute(i8,a?.code||"unknown"),t.setAttribute(Dr,a?.name||"unknown"),ka(t,n),t.end()}catch(a){$&&g.error("[orchestrion:postgresjs] error ending span in reject:",a)}return s.apply(this,c)})}var u8=((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:r8,setupOnce(){gc.tracingChannel&&($&&g.log(`[orchestrion:postgresjs] subscribing to "${A.POSTGRESJS_HANDLE}"`),gc.tracingChannel(A.POSTGRESJS_CONNECTION).subscribe({start:Qn,asyncStart:Qn,asyncEnd:Qn,error:Qn,end:l8}),gc.tracingChannel(A.POSTGRESJS_EXECUTE).subscribe({end:Qn,asyncStart:Qn,asyncEnd:Qn,error:Qn,start:ZB}),gc.tracingChannel(A.POSTGRESJS_CONNECT).subscribe({end:Qn,asyncStart:Qn,asyncEnd:Qn,error:Qn,start:ZB}),ue(()=>{ee(gc.tracingChannel(A.POSTGRESJS_HANDLE),r=>{let o=r.self;if(!o||o.executed===!0||o[s8])return;let i=Vd(o.strings),s=La(i),c=M({name:s||"postgresjs.query",op:"db",kind:D.CLIENT,attributes:{[S]:o8,[mt]:"postgres",[Ur]:s}});o[XB]=c;let a=c8();if(a&&QB(c,o,a),n)try{n(c,s,a)}catch(l){c.setAttribute("sentry.hook.error","requestHook failed"),$&&g.error("[orchestrion:postgresjs] error in requestHook:",l)}return p8(r,c,s),c},{requiresParentSpan:t!==!1,deferSpanEnd({data:r}){return r[KB]?!0:!("error"in r)}})}))}}}),JB=u8;import{EventEmitter as d8}from"events";import*as Ag from"diagnostics_channel";var m8="Tedious",f8="auto.db.orchestrion.tedious",g8="mssql",_8="db.sql.table",zB=Symbol("sentry.orchestrion.tedious.current-database");function Ig(e){Object.defineProperty(this,zB,{value:e,writable:!0,configurable:!0})}function $B(){this.removeListener("databaseChange",Ig)}function h8(){Ag.tracingChannel(A.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(Ig.call(t,t.config?.options?.database),t.removeListener("databaseChange",Ig),t.on("databaseChange",Ig),t.removeListener("end",$B),t.once("end",$B))})}function _c(e,t){Ag.tracingChannel(e).start.subscribe(n=>{let r=n,o=r.self,i=r.arguments[0];if(!o||!(i instanceof d8))return;let s=0,c=0,a=()=>{c++},l=()=>{s++},p=o[zB],u=b8(i),d={[S]:f8,[Pe]:g8,[Et]:p,[Gt]:o.config?.userName??o.config?.authentication?.options?.userName,[Ve]:u,[_8]:i.table,[Le]:o.config?.server,[xe]:o.config?.options?.port},m=M({name:y8(t,p,u,i.table),kind:D.CLIENT,op:"db",attributes:d}),_=S8(h=>{i.removeListener("done",a),i.removeListener("doneInProc",a),i.removeListener("doneProc",l),i.removeListener("error",_),o.removeListener("end",_),m.setAttribute("tedious.procedure_count",s),m.setAttribute("tedious.statement_count",c),h&&m.setStatus({code:2,message:h.message}),m.end()});if(i.on("done",a),i.on("doneInProc",a),i.on("doneProc",l),i.once("error",_),o.on("end",_),typeof i.callback=="function"){let h=i.callback;i.callback=function(...b){return _(b[0]),h.apply(this,b)}}})}function b8(e){if(e.sqlTextOrProcedure==="sp_prepare"&&e.parametersByName?.stmt?.value!=null){let t=e.parametersByName.stmt.value;return typeof t=="string"?t:void 0}return e.sqlTextOrProcedure}function y8(e,t,n,r){return e==="execBulkLoad"&&r&&t?`${e} ${r} ${t}`:e==="callProcedure"?t?`${e} ${n} ${t}`:`${e} ${n}`:t?`${e} ${t}`:e}function S8(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var E8=(()=>({name:m8,setupOnce(){Ag.tracingChannel&&($&&g.log(`[orchestrion:tedious] subscribing to channel "${A.TEDIOUS_EXEC_SQL}"`),ue(()=>{h8(),_c(A.TEDIOUS_EXEC_SQL,"execSql"),_c(A.TEDIOUS_EXEC_SQL_BATCH,"execSqlBatch"),_c(A.TEDIOUS_CALL_PROCEDURE,"callProcedure"),_c(A.TEDIOUS_EXEC_BULK_LOAD,"execBulkLoad"),_c(A.TEDIOUS_PREPARE,"prepare"),_c(A.TEDIOUS_EXECUTE,"execute")}))}})),eH=E8;import*as hA from"diagnostics_channel";var tH=Symbol("SentryVercelAiModelPatched"),nH=Symbol("SentryVercelAiToolPatched"),T8=0;function Ng(){return`v6-${++T8}`}var vg=new WeakMap,aH=new WeakSet,cH=new WeakSet,gA=new WeakMap,_A=new WeakMap,mA=new WeakMap,lH=new WeakSet,rH=!1;function pH(e,t={}){if(!rH){rH=!0;try{hc(e,A.VERCEL_AI_GENERATE_TEXT,dA("generateText"),t),hc(e,A.VERCEL_AI_STREAM_TEXT,dA("streamText"),t),hc(e,A.VERCEL_AI_GENERATE_OBJECT,dA("generateObject"),t),hc(e,A.VERCEL_AI_EMBED,(n,r)=>({type:"embed",event:{callId:Ng(),...fA(n.model),maxRetries:n.maxRetries,value:n.value,...Dp(r)}}),t),hc(e,A.VERCEL_AI_EMBED_MANY,(n,r)=>({type:"embedMany",event:{callId:Ng(),...fA(n.model),maxRetries:n.maxRetries,values:n.values,...Dp(r)}}),t),hc(e,A.VERCEL_AI_EXECUTE_TOOL_CALL,(n,r)=>({type:"executeTool",event:{callId:Ng(),toolCall:n.toolCall,tools:n.tools,...Dp(r)}}),t),v8(e,A.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{$&&g.log("Vercel AI orchestrion channel subscription failed.")}}}function hc(e,t,n,r){let o=e(t),i=s=>{let c=V(s.arguments[0])?s.arguments[0]:{},a=V(c.experimental_telemetry)?c.experimental_telemetry:{};if(a.isEnabled===!1&&!lH.has(a))return;let l=n(c,a);N8(c,a);let p=Q(),u=fp(l,r);if(u){vg.set(s,l),aH.add(u);let d=V(c.model)&&c.model.specificationVersion==="v1";mA.set(u,{callSiteSpan:p,toolErrorsBubbleToCaller:d}),l.type==="executeTool"&&cH.add(u);let m=Fe(l.event.callId);m&&gA.set(u,m),_A.set(u,Dp(a)),V(c.tools)&&R8(c.tools,r),d&&dH(c.model,r)}return u};ee(o,s=>i(s),{beforeSpanEnd:(s,c)=>{let a=vg.get(c);if(a){if("error"in c){let l=mA.get(s)?.callSiteSpan;l&&V(c.error)&&we(c.error,"_sentry_active_span",l)}else a.result=a.type==="executeTool"?{output:c.result}:c.result,nc(s,a,r);a.type!=="streamText"&&UE(a),vg.delete(c)}},deferSpanEnd:({data:s,end:c})=>I8(s,c)})}function I8(e,t){if(vg.get(e)?.type!=="streamText"||"error"in e||!A8(e.result))return!1;let n=e.result;return(async()=>{try{let[r,o,i,s,c]=await Promise.all([n.totalUsage??n.usage,n.text,n.toolCalls,n.finishReason,n.response]);e.result={usage:r,text:o,toolCalls:i,finishReason:s,response:c},t()}catch(r){t(r)}})(),!0}function A8(e){return V(e)&&(oH(e.totalUsage)||oH(e.usage))}function oH(e){return V(e)&&typeof e.then=="function"}function N8(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};lH.add(n),e.experimental_telemetry=n}function v8(e,t,n){e(t).subscribe({end(r){let o=r;V(o.result)&&dH(o.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function uH(){let e=Q();return e&&aH.has(e)?e:void 0}function dH(e,t){e[tH]||(e[tH]=!0,iH(e,"doGenerate",t),iH(e,"doStream",t))}function iH(e,t,n){let r=e[t];typeof r=="function"&&(e[t]=function(...o){let i=uH();if(!i)return Promise.resolve(r.apply(this,o));let s=V(o[0])?o[0]:{},c=gA.get(i),a={type:"languageModelCall",event:{callId:c,provider:e.provider,modelId:e.modelId,tools:s.tools??(V(s.mode)?s.mode.tools:void 0),messages:s.prompt,..._A.get(i)}},l=se(i,()=>fp(a,n));if(!l)return Promise.resolve(r.apply(this,o));let p=()=>{t==="doStream"&&c&&DE(c)},u=d=>{throw l.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),l.end(),p(),d};try{return Promise.resolve(r.apply(this,o)).then(m=>t==="doStream"&&V(m)&&cf(m.stream)?(m.stream=lf(m.stream,_=>{a.result={...m,...BE(_)},nc(l,a,n),l.end(),p()},_=>{l.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),l.end(),p()}),m):(a.result=m,nc(l,a,n),l.end(),p(),m),u)}catch(d){return u(d)}})}function R8(e,t){try{for(let[n,r]of Object.entries(e))V(r)&&C8(n,r,e,t)}catch{$&&g.log("Vercel AI orchestrion tool patching failed.")}}function C8(e,t,n,r){let o=t.execute;typeof o!="function"||t[nH]||(t[nH]=!0,t.execute=function(i,...s){let c=uH();if(!c||cH.has(c))return o.apply(this,[i,...s]);let a=V(s[0])?s[0]:{},l={type:"executeTool",event:{callId:gA.get(c),toolCall:{toolName:e,toolCallId:Fe(a.toolCallId),input:i},tools:n,..._A.get(c)}},p=se(c,()=>fp(l,r));if(!p)return o.apply(this,[i,...s]);let u=d=>{throw mA.get(c)?.toolErrorsBubbleToCaller?p.setStatus({code:2,message:d instanceof Error?d.message:"tool_error"}):HE(p,l,d),p.end(),d};try{return Promise.resolve(o.apply(this,[i,...s])).then(m=>(l.result={output:m},nc(p,l,r),p.end(),m),u)}catch(d){return u(d)}})}function dA(e){return(t,n)=>({type:e,event:{callId:Ng(),operationId:`ai.${e}`,functionId:Fe(n.functionId),...fA(t.model),maxRetries:t.maxRetries,instructions:Fe(t.system),messages:O8(t),...Dp(n)}})}function O8(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt=="string"?[{role:"user",content:e.prompt}]:e.messages??e.prompt}function Dp(e){let t=e.isEnabled===!0?!0:void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function fA(e){return{provider:sH(e,"provider"),modelId:sH(e,"modelId")}}function sH(e,t){return V(e)?Fe(e[t]):void 0}var x8=((e={})=>{let t=gp(e);return Bt(t,{options:e,setupOnce(){hA.tracingChannel&&ue(()=>{pH(hA.tracingChannel,e)})}})}),mH=x8;import*as bA from"diagnostics_channel";var _H=new WeakMap;function hH(e,t){_H.set(e,t)}function bH(e){return _H.get(e)}var fH=new WeakMap;function Rg(e){let t=fH.get(e);return t||(t=[],fH.set(e,t)),t}function yH(e,t){Rg(e).push(t)}function SH(e){Rg(e).pop()}function EH(e){let t=e[0];return Array.isArray(t)?t.map(n=>gH(n)??"").join(","):gH(t)}function gH(e){return typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0}function TH(e){let t=Rg(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}function IH(e,t){let n=Rg(e);if(n.length===0)return;let r=typeof e.originalUrl=="string"?e.originalUrl:"";if(n.every(s=>s==="/"))return r==="/"?"/":void 0;if(t==="*"||t.includes("/")&&(t.includes(",")||t.includes("\\")||t.includes("*")||t.includes("[")))return t;let o=t.startsWith("/")?t:`/${t}`;return o.length>0&&(r===o||r.startsWith(o)||P8(o))?o:void 0}function P8(e){return e.includes(":")||e.includes("*")}var k8="auto.http.express",L8="express.name",M8="express.type",Ti=()=>{},AH=!1;function NH(e,t){if(!AH){AH=!0;for(let n of[A.EXPRESS_REGISTER,A.ROUTER_REGISTER])t(n).subscribe({start:Ti,asyncStart:Ti,asyncEnd:Ti,error:Ti,end:w8});for(let n of[A.EXPRESS_HANDLE,A.ROUTER_HANDLE]){$&&g.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);ee(r,o=>U8(o,e),{beforeSpanEnd(o,i){i._sentryCleanup?.()}}),r.subscribe({start:Ti,asyncEnd:Ti,end:Ti,error:Ti,asyncStart:G8})}}}function w8(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&hH(n,EH(e.arguments??[]))}function G8(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&SH(t)}function U8(e,t){let n=e.self,r=e.arguments;if(!n||!Array.isArray(r)||n.handle?.length===4||n.method&&!n.route)return;let o=r[0],i=r[1];if(!o||!Q())return;let s=D8(n),c=bH(n);c!=null&&(yH(o,c),e._sentryStoredLayer=!0);let a=s==="request_handler"?TH(o):void 0,l=s==="request_handler"&&a!=null?IH(o,a):void 0,p=s==="request_handler"?a||"request handler":s==="router"?n.path??"/":n.name??"<anonymous>";if(l&&B8(l),s==="request_handler"&&a){let d=J();if(d!==Rt()){let m=typeof o.method=="string"?o.method.toUpperCase():"GET";d.setTransactionName(`${m} ${a}`)}else $&&g.warn("[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name")}if(H8(p,s,t))return;let u=M({name:p,attributes:{[S]:k8,[H]:`${s}.express`,[L8]:p,[M8]:s,...l?{[He]:l}:{}}});if(i&&typeof i.once=="function"){let d=()=>{u.end()};i.once("finish",d),e._sentryCleanup=()=>i.removeListener("finish",d)}return u}function D8(e){return e.name==="router"?"router":e.name==="bound dispatch"||e.name==="handle"?"request_handler":"middleware"}function B8(e){let t=Q(),n=t&&Re(t);n&&ie(n).data[H]==="http.server"&&n.setAttribute(He,e)}function H8(e,t,n){let{ignoreLayers:r,ignoreLayersType:o}=n;if(Array.isArray(o)&&o.includes(t))return!0;if(!Array.isArray(r))return!1;try{return _n(e,r,!0)}catch{return!1}}var F8="Express",W8=((e={})=>({name:F8,setupOnce(){bA.tracingChannel&&ue(()=>{NH(e,bA.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})),vH=W8;import*as MH from"diagnostics_channel";import*as yA from"diagnostics_channel";import*as RH from"net";function CH(e,t){return M({name:`${e} ${t.path}`,op:"db.query",kind:D.CLIENT,attributes:{[S]:"auto.firebase.orchestrion.firestore",[lr]:e,...Y8(t)}})}function V8(e){let t,n;if(typeof e.host=="string")if(e.host.startsWith("[")){if(e.host.endsWith("]"))t=e.host.replace(/^\[|\]$/g,"");else if(e.host.includes("]:")){let r=e.host.lastIndexOf(":");r!==-1&&(t=e.host.slice(1,r).replace(/^\[|\]$/g,""),n=e.host.slice(r+1))}}else if(RH.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(":");r!==-1?(t=e.host.slice(0,r),n=e.host.slice(r+1)):t=e.host}return{address:t,port:n?parseInt(n,10):void 0}}function Y8(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},o={[ta]:e.path,[bo]:t.name,[mt]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":n.projectId,"firebase.firestore.options.appId":n.appId,"firebase.firestore.options.messagingSenderId":n.messagingSenderId,"firebase.firestore.options.storageBucket":n.storageBucket},{address:i,port:s}=V8(r);return i&&(o[_t]=i),s&&(o[ht]=s),o}var OH="auto.firebase.orchestrion.functions",xH="__sentryFirebaseWrapped";function PH(e,t){let n=e.arguments;if(!Array.isArray(n)||n.length===0)return;let r=typeof n[0]=="function"?0:1,o=n[r];typeof o!="function"||o[xH]||(n[r]=j8(o,t))}function j8(e,t){let n=async function(...r){let o=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",i={[S]:OH,[KR]:o,[Au]:t,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(i["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(i["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),ke({name:`firebase.function.${t}`,op:"function.firebase",kind:D.SERVER,attributes:i},async s=>{try{let c=await e.apply(this,r);return s.end(),c}catch(c){throw s.setStatus({code:2}),me(c,{mechanism:{type:OH,handled:!1}}),s.end(),await Xi(2e3),c}})};return n[xH]=!0,n}var Z8=[{channel:A.FIREBASE_FIRESTORE_ADD_DOC,spanName:"addDoc",useParent:!1},{channel:A.FIREBASE_FIRESTORE_GET_DOCS,spanName:"getDocs",useParent:!1},{channel:A.FIREBASE_FIRESTORE_SET_DOC,spanName:"setDoc",useParent:!0},{channel:A.FIREBASE_FIRESTORE_DELETE_DOC,spanName:"deleteDoc",useParent:!0}],X8=[{channel:A.FIREBASE_FUNCTIONS_HTTP_REQUEST,triggerType:"http.request"},{channel:A.FIREBASE_FUNCTIONS_HTTP_CALL,triggerType:"http.call"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_CREATED,triggerType:"firestore.document.created"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED,triggerType:"firestore.document.updated"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_DELETED,triggerType:"firestore.document.deleted"},{channel:A.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN,triggerType:"firestore.document.written"},{channel:A.FIREBASE_FUNCTIONS_SCHEDULER,triggerType:"scheduler.scheduled"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_FINALIZED,triggerType:"storage.object.finalized"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED,triggerType:"storage.object.archived"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_DELETED,triggerType:"storage.object.deleted"},{channel:A.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED,triggerType:"storage.object.metadataUpdated"}],Cg=()=>{};function kH(e){try{return e()}catch(t){$&&g.warn("[orchestrion:firebase] error handling channel event",t);return}}function LH(){for(let{channel:e,spanName:t,useParent:n}of Z8)ee(yA.tracingChannel(e),r=>kH(()=>{let o=r.arguments[0];if(!o)return;let i=n&&o.parent||o;return CH(t,i)}));for(let{channel:e,triggerType:t}of X8)yA.tracingChannel(e).subscribe({start:n=>{kH(()=>PH(n,t))},end:Cg,asyncStart:Cg,asyncEnd:Cg,error:Cg})}var K8="Firebase",q8=(()=>({name:K8,setupOnce(){MH.tracingChannel&&ue(()=>{LH()})}})),wH=q8;function Bp(){return!!te.__SENTRY_ORCHESTRION__}function SA(){let{runtime:e,bundler:t}=te.__SENTRY_ORCHESTRION__??{};if(!e&&!t){g.warn("[Sentry] No diagnostics-channel injection detected. Channel-based integrations will not record spans. Make sure the diagnostics channels are injected via the runtime `--import` hook or a bundler plugin before the instrumented modules load.");return}g.log(e?`[Sentry] Runtime hook registered, injected libraries=${JSON.stringify(e)}`:"[Sentry] Runtime hook not registered"),g.log(t?`[Sentry] Bundler plugin ran, injected libraries=${JSON.stringify(t)}`:"[Sentry] Bundler plugin did not run")}import*as bc from"diagnostics_channel";var Q8="RedisChannel",TA="auto.db.orchestrion.redis",DH="db.connection_string",IA="redis";function GH(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function BH(e,t,n,r,o){if(e)try{e(t,n,r,o)}catch{}}function J8(e){let t=e[0];return V(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function $8(e){if(!(typeof e!="string"||!e))try{let t=new URL(e);return t.searchParams.delete("user_pwd"),t.username="",t.password="",t.href}catch{return}}function HH(e){return{[Pe]:IA,[Le]:e?.socket?.host,[xe]:e?.socket?.port,[DH]:$8(e?.url),[S]:TA}}function FH(e,t,n){return M({name:`redis-${e}`,kind:D.CLIENT,attributes:{...n,[H]:"db",[Ve]:no(e,t)}})}function z8(e){let t=bc.tracingChannel(A.REDIS_COMMAND),n=()=>{};t.subscribe({end:n,asyncStart:n,asyncEnd:n,start(r){let o=r.arguments?.[0];if(!o||typeof o!="object")return;let i=o.callback;if(typeof i!="function")return;let s=r.self,c={[Pe]:IA,[S]:TA};c[Le]=s?.connection_options?.host,c[xe]=s?.connection_options?.port,s?.address&&(c[DH]=`redis://${s.address}`);let a=FH(o.command,o.args??[],c);r._sentrySpan=a;let l=Q();o.callback=function(p,u){p||BH(e,a,o.command,o.args??[],u),GH(a,p);let d=arguments;return se(l??null,()=>i.apply(this,d))}},error(r){let o=r._sentrySpan;o&&GH(o,r.error)}})}function UH(e,t,n){let r=bc.tracingChannel(e);ee(r,o=>{let i=t(o);if(!i?.length)return;let s=String(i[0]),c=o.self?.options;return FH(s,i.slice(1),HH(c))},{beforeSpanEnd(o,i){if("error"in i||!n)return;let s=t(i);s?.length&&BH(n,o,String(s[0]),s.slice(1),i.result)}})}function eee(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function tee(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(!(typeof t?.transformArguments!="function"||!Array.isArray(n)))try{return t.transformArguments(...J8(n))}catch{return}}function nee(){let e=bc.tracingChannel(A.NODE_REDIS_CONNECT);ee(e,t=>{let n=t.self?.options;return M({name:"redis-connect",kind:D.CLIENT,attributes:{...HH(n),[H]:"db"}})})}function EA(e,t){let n=bc.tracingChannel(e);ee(n,r=>{let o=r.arguments?.[0],i=Array.isArray(o)?o.length:void 0,s=r.self?.options?.socket;return M({name:t(r),kind:D.CLIENT,attributes:{[S]:TA,[H]:"db.redis",[mt]:IA,...i&&i>1?{[ra]:i}:{},...s?.host!=null?{[_t]:s.host}:{},...s?.port!=null?{[ht]:s.port}:{}}})})}var ree=((e={})=>{let t=e.responseHook;return{name:Q8,setupOnce(){bc.tracingChannel&&($&&g.log(`[orchestrion:redis] subscribing to "${A.REDIS_COMMAND}" and node-redis channels`),z8(t),ue(()=>{UH(A.NODE_REDIS_COMMAND,eee,t),UH(A.NODE_REDIS_EXECUTOR,tee,t),nee(),EA(A.NODE_REDIS_MULTI,()=>"MULTI"),EA(A.NODE_REDIS_PIPELINE,()=>"PIPELINE"),EA(A.NODE_REDIS_BATCH,n=>n.arguments?.[2]!==void 0?"MULTI":"PIPELINE")}))}}}),AA=ree;var NA={postgresIntegration:YB,postgresJsIntegration:JB,mongoIntegration:AB,mysqlIntegration:OB,mysql2Integration:PB,genericPoolIntegration:ND,mongooseIntegration:CB,lruMemoizerIntegration:TB,openaiIntegration:MB,anthropicIntegration:cD,googleGenAIIntegration:OD,langChainIntegration:bB,langGraphIntegration:EB,vercelAiIntegration:mH,amqplibIntegration:iD,hapiIntegration:zD,koaIntegration:rB,expressIntegration:vH,graphqlIntegration:XD,kafkajsIntegration:fB,tediousIntegration:eH,awsIntegration:SD,firebaseIntegration:wH};var WH="Knex",oee=de(WH,()=>new Zf),iee=(()=>({name:WH,setupOnce(){Bp()?oA().setupOnce?.():oee()}})),see=iee;import{EventEmitter as aee}from"events";var VH="db.sql.table",YH="mssql";function jH(e,t,n,r){return e==="execBulkLoad"&&r&&t?`${e} ${r} ${t}`:e==="callProcedure"?t?`${e} ${n} ${t}`:`${e} ${n}`:t?`${e} ${t}`:`${e}`}var ZH=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};var cee="@sentry/instrumentation-tedious",KH=Symbol("opentelemetry.instrumentation-tedious.current-database"),XH=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function Og(e){Object.defineProperty(this,KH,{value:e,writable:!0})}var qH=class QH extends ae{constructor(t={}){super(cee,q,t)}init(){return[new re(QH.COMPONENT,[">=1.11.0 <20"],t=>{let n=t.Connection.prototype;for(let r of XH)w(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r));return w(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),t},t=>{if(t===void 0)return;let n=t.Connection.prototype;for(let r of XH)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(t){return function(){return Og.call(this,this.config?.options?.database),this.removeListener("databaseChange",Og),this.on("databaseChange",Og),this.once("end",()=>{this.removeListener("databaseChange",Og)}),t.apply(this,arguments)}}_patchQuery(t){return n=>{let r=this;function o(i){if(!(i instanceof aee))return r._diag.warn(`Unexpected invocation of patched ${t} method. Span not recorded`),n.apply(this,arguments);let s=0,c=0,a=()=>c++,l=()=>s++,p=this[KH],u=(h=>h.sqlTextOrProcedure==="sp_prepare"&&h.parametersByName?.stmt?.value?h.parametersByName.stmt.value:h.sqlTextOrProcedure)(i),d={[S]:"auto.db.otel.tedious",[Pe]:YH,[Et]:p,[Gt]:this.config?.userName??this.config?.authentication?.options?.userName,[Ve]:u,[VH]:i.table,[Le]:this.config?.server,[xe]:this.config?.options?.port},m=M({name:jH(t,p,u,i.table),kind:D.CLIENT,attributes:d}),_=ZH(h=>{i.removeListener("done",a),i.removeListener("doneInProc",a),i.removeListener("doneProc",l),i.removeListener("error",_),this.removeListener("end",_),m.setAttribute("tedious.procedure_count",s),m.setAttribute("tedious.statement_count",c),h&&m.setStatus({code:2,message:h.message}),m.end()});return i.on("done",a),i.on("doneInProc",a),i.on("doneProc",l),i.once("error",_),this.on("end",_),typeof i.callback=="function"?r._wrap(i,"callback",r._patchCallbackQuery(_)):r._diag.error("Expected request.callback to be a function"),se(m,()=>n.apply(this,arguments))}return Object.defineProperty(o,"length",{value:n.length,writable:!1}),o}}_patchCallbackQuery(t){return n=>function(r,o,i){return t(r),n.apply(this,arguments)}}};qH.COMPONENT="tedious";var JH=qH;var $H="Tedious",vA=de($H,()=>new JH({})),lee=(()=>({name:$H,setupOnce(){vA()}})),RA=lee;var CA="generic-pool",pee="@sentry/instrumentation-generic-pool",xg=class extends ae{constructor(t={}){super(pee,q,t),this._isDisabled=!1}init(){return[new re(CA,[">=3.0.0 <4"],t=>{let n=t.Pool;return w(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),t},t=>{let n=t.Pool;return this._unwrap(n.prototype,"acquire"),t}),new re(CA,[">=2.4.0 <3"],t=>{let n=t.Pool;return w(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),t},t=>{let n=t.Pool;return this._unwrap(n.prototype,"acquire"),t}),new re(CA,[">=2.0.0 <2.4"],t=>(this._isDisabled=!1,w(t.Pool)&&this._unwrap(t,"Pool"),this._wrap(t,"Pool",this._poolWrapper.bind(this)),t),t=>(this._isDisabled=!0,t))]}_acquirePatcher(t){return function(...r){return Se({name:"generic-pool.acquire",attributes:{[S]:"auto.db.otel.generic_pool"}},()=>t.call(this,...r))}}_poolWrapper(t){let n=this._wrap.bind(this),r=this._acquireWithCallbacksPatcher.bind(this);return function(...i){let s=t.apply(this,i);return n(s,"acquire",r),s}}_acquireWithCallbacksPatcher(t){let n=()=>this._isDisabled;return function(o,i){return n()?t.call(this,o,i):ke({name:"generic-pool.acquire",attributes:{[S]:"auto.db.otel.generic_pool"}},s=>{t.call(this,(c,a)=>{c&&s.setStatus({code:2,message:"internal_error"}),s.end(),o&&o(c,a)},i)})}}};var zH="GenericPool",OA=de(zH,()=>new xg({})),uee=(()=>({name:zH,setupOnce(){OA()}})),xA=uee;var kA="dataloader",dee="@sentry/instrumentation-dataloader",yc="auto.db.otel.dataloader";function mee(e){return e[Symbol.toStringTag]==="Module"}function eF(e){return mee(e)?e.default:e}function Sc(e,t){let n=e.name;return n?`${kA}.${t} ${n}`:`${kA}.${t}`}function Ec(e){if(e==="load"||e==="loadMany"||e==="batch")return"cache.get"}function PA(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}var Pg=class extends ae{constructor(t={}){super(dee,q,t)}init(){return[new re(kA,[">=2.0.0 <3"],t=>{let n=eF(t);return this._patchLoad(n.prototype),this._patchLoadMany(n.prototype),this._patchPrime(n.prototype),this._patchClear(n.prototype),this._patchClearAll(n.prototype),this._getPatchedConstructor(n)},t=>{let n=eF(t);["load","loadMany","prime","clear","clearAll"].forEach(r=>{w(n.prototype[r])&&this._unwrap(n.prototype,r)})})]}_wrapBatchLoadFn(t){let n=this;return function(...o){return n.isEnabled()?Se({name:Sc(this,"batch"),links:this._batch?.spanLinks,attributes:{[S]:yc,[H]:Ec("batch"),[ea]:PA(o[0])},onlyIfParent:!0},()=>t.apply(this,o)):t.call(this,...o)}}_getPatchedConstructor(t){let n=this,r=t.prototype;if(!n.isEnabled())return t;function o(...i){return typeof i[0]=="function"&&(w(i[0])&&n._unwrap(i,0),i[0]=n._wrapBatchLoadFn(i[0])),t.apply(this,i)}return o.prototype=r,o}_patchLoad(t){w(t.load)&&this._unwrap(t,"load"),this._wrap(t,"load",this._getPatchedLoad.bind(this))}_getPatchedLoad(t){return function(...r){return Se({name:Sc(this,"load"),kind:D.CLIENT,attributes:{[S]:yc,[H]:Ec("load"),[ea]:PA(r[0])},onlyIfParent:!0},o=>{let i=t.call(this,...r);return this._batch&&o.isRecording()&&(this._batch.spanLinks||(this._batch.spanLinks=[]),this._batch.spanLinks.push({context:o.spanContext()})),i})}}_patchLoadMany(t){w(t.loadMany)&&this._unwrap(t,"loadMany"),this._wrap(t,"loadMany",this._getPatchedLoadMany.bind(this))}_getPatchedLoadMany(t){return function(...r){return Se({name:Sc(this,"loadMany"),kind:D.CLIENT,attributes:{[S]:yc,[H]:Ec("loadMany"),[ea]:PA(r[0])},onlyIfParent:!0},()=>t.call(this,...r))}}_patchPrime(t){w(t.prime)&&this._unwrap(t,"prime"),this._wrap(t,"prime",this._getPatchedPrime.bind(this))}_getPatchedPrime(t){return function(...r){return Se({name:Sc(this,"prime"),kind:D.CLIENT,attributes:{[S]:yc,[H]:Ec("prime")},onlyIfParent:!0},()=>t.call(this,...r))}}_patchClear(t){w(t.clear)&&this._unwrap(t,"clear"),this._wrap(t,"clear",this._getPatchedClear.bind(this))}_getPatchedClear(t){return function(...r){return Se({name:Sc(this,"clear"),kind:D.CLIENT,attributes:{[S]:yc,[H]:Ec("clear")},onlyIfParent:!0},()=>t.call(this,...r))}}_patchClearAll(t){w(t.clearAll)&&this._unwrap(t,"clearAll"),this._wrap(t,"clearAll",this._getPatchedClearAll.bind(this))}_getPatchedClearAll(t){return function(...r){return Se({name:Sc(this,"clearAll"),kind:D.CLIENT,attributes:{[S]:yc,[H]:Ec("clearAll")},onlyIfParent:!0},()=>t.call(this,...r))}}};var tF="Dataloader",fee=de(tF,()=>new Pg),gee=(()=>({name:tF,setupOnce(){Bp()?HI().setupOnce?.():fee()}})),_ee=gee;var dn=(e=>(e.AutoAck="auto ack",e.Ack="ack",e.AckAll="ackAll",e.Reject="reject",e.Nack="nack",e.NackAll="nackAll",e.ChannelClosed="channel closed",e.ChannelError="channel error",e.InstrumentationTimeout="instrumentation timeout",e))(dn||{});at();var nF="messaging.operation",LA="messaging.destination",MA="messaging.destination_kind",wA="messaging.rabbitmq.routing_key",GA="messaging.protocol",rF="messaging.protocol_version",oF="messaging.url",UA="messaging.message_id",DA="messaging.conversation_id",BA="topic",iF="process";var hee="auto.amqplib.otel.publisher",bee="auto.amqplib.otel.consumer",kg=Symbol("opentelemetry.amqplib.message.stored-span"),Ii=Symbol("opentelemetry.amqplib.channel.spans-not-ended"),Lg=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer"),Mg=Symbol("opentelemetry.amqplib.connection.attributes"),wg=Symbol("sentry.amqplib.channel.is-confirm-publishing"),yee=e=>e!==""?e:"<default>",See=e=>e.replace(/:[^:@/]*@/,":***@"),sF=(e,t)=>e||(t==="AMQP"?5672:5671),aF=e=>{let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()},cF=e=>e||"localhost",lF=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Ut]:t}:{}},pF=e=>{let t={[rF]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,o=aF(r?.protocol);t[GA]=o,t[Le]=cF(r?.hostname),t[xe]=sF(r.port,o)}else{let r=See(n);t[oF]=r;try{let o=new URL(r),i=aF(o.protocol);t[GA]=i,t[Le]=cF(o.hostname),t[xe]=sF(o.port?parseInt(o.port):void 0,i)}catch{}}return t};function HA(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}function FA(e,t,n,r){let o=yee(e),i=M({name:`publish ${o}`,kind:vt.PRODUCER,attributes:{...n.connection[Mg],[LA]:e,[MA]:BA,[wA]:t,[UA]:r?.messageId,[DA]:r?.correlationId,[S]:hee}}),s=r??{};s.headers=s.headers??{};let c=$e({span:i});return c["sentry-trace"]&&(s.headers["sentry-trace"]=c["sentry-trace"]),c.baggage&&(s.headers.baggage=c.baggage),{span:i,modifiedOptions:s}}function uF(e,t,n){return M({name:`${e} process`,kind:vt.CONSUMER,attributes:{...n?.connection?.[Mg],[LA]:t.fields?.exchange,[MA]:BA,[wA]:t.fields?.routingKey,[nF]:iF,[UA]:t?.properties.messageId,[DA]:t?.properties.correlationId,[S]:bee}})}var dF=1e3*60;function Hp(e,t,n,r){let o=e[kg];o&&(t!==!1&&o.setStatus({code:2,message:n!==dn.ChannelClosed&&n!==dn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),o.end(),e[kg]=void 0)}function WA(e,t,n,r){(e[Ii]??[]).forEach(i=>{Hp(i.msg,t,n,r)}),e[Ii]=[]}function Eee(e){let t=lt(),n=e[Ii]??[],r;for(r=0;r<n.length;r++){let o=n[r];if((t-o.timeOfConsume)*1e3<dF)break;Hp(o.msg,null,dn.InstrumentationTimeout,!0)}n.splice(0,r)}function mF(e){return function(n,r,o){return e.call(this,n,r,function(i,s){if(i==null){let c=pF(n),a=lF(s);s[Mg]={...c,...a}}o.apply(this,arguments)})}}function fF(e){return function(n){if(n==="close"){WA(this,!0,dn.ChannelClosed,void 0);let r=this[Lg];r&&clearInterval(r),this[Lg]=void 0}else n==="error"&&WA(this,!0,dn.ChannelError,void 0);return e.apply(this,arguments)}}function VA(e,t){return n=>function(o){return WA(this,e,t,o),n.apply(this,arguments)}}function Gg(e,t){return n=>function(o,i,s){let c=this,a=t===dn.Reject?i:s,l=c[Ii]??[],p=l.findIndex(u=>u.msg===o);if(p<0)Hp(o,e,t,a);else if(t!==dn.Reject&&i){for(let u=0;u<=p;u++)Hp(l[u].msg,e,t,a);l.splice(0,p+1)}else Hp(o,e,t,a),l.splice(p,1);return n.apply(this,arguments)}}function gF(e){return function(n,r,o){let i=this;if(!Object.prototype.hasOwnProperty.call(i,Ii)){let a=setInterval(()=>{Eee(i)},dF);a.unref(),i[Lg]=a,i[Ii]=[]}let s=function(a){if(!a)return r.call(this,a);let l=a.properties.headers??{},p=HA(l,"sentry-trace"),u=HA(l,"baggage");vn({sentryTrace:p,baggage:u},()=>{let d=uF(n,a,i);o?.noAck||(i[Ii].push({msg:a,timeOfConsume:lt()}),a[kg]=d),se(d,()=>{r.call(this,a)}),o?.noAck&&d.end()})},c=Array.prototype.slice.call(arguments);return c[1]=s,e.apply(this,c)}}function _F(e){return function(n,r,o,i,s){let c=this,{span:a,modifiedOptions:l}=FA(n,r,c,i),p=function(d,m){try{se(a,()=>{s?.call(this,d,m)})}finally{d&&a.setStatus({code:2,message:"message confirmation has been nack'ed"}),a.end()}},u=[...arguments];u[3]=l,u[4]=p,c[wg]=!0;try{return e.apply(this,u)}finally{c[wg]=!1}}}function hF(e){return function(n,r,o,i){if(this[wg])return e.apply(this,arguments);let s=this,{span:c,modifiedOptions:a}=FA(n,r,s,i),l=[...arguments];l[3]=a;let p=e.apply(this,l);return c.end(),p}}var Tee="@sentry/instrumentation-amqplib",Ug=[">=0.5.5 <2"],Dg=class extends ae{constructor(t={}){super(Tee,q,t)}init(){let t=new Ae("amqplib/lib/channel_model.js",Ug,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ae("amqplib/lib/callback_model.js",Ug,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ae("amqplib/lib/connect.js",Ug,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new re("amqplib",Ug,void 0,void 0,[t,r,n])}patchConnect(t){let n=this.unpatchConnect(t);return w(n.connect)||this._wrap(n,"connect",mF),n}unpatchConnect(t){return w(t.connect)&&this._unwrap(t,"connect"),t}patchChannelModel(t){return w(t.Channel.prototype.publish)||this._wrap(t.Channel.prototype,"publish",hF),w(t.Channel.prototype.consume)||this._wrap(t.Channel.prototype,"consume",gF),w(t.Channel.prototype.ack)||this._wrap(t.Channel.prototype,"ack",Gg(!1,dn.Ack)),w(t.Channel.prototype.nack)||this._wrap(t.Channel.prototype,"nack",Gg(!0,dn.Nack)),w(t.Channel.prototype.reject)||this._wrap(t.Channel.prototype,"reject",Gg(!0,dn.Reject)),w(t.Channel.prototype.ackAll)||this._wrap(t.Channel.prototype,"ackAll",VA(!1,dn.AckAll)),w(t.Channel.prototype.nackAll)||this._wrap(t.Channel.prototype,"nackAll",VA(!0,dn.NackAll)),w(t.Channel.prototype.emit)||this._wrap(t.Channel.prototype,"emit",fF),w(t.ConfirmChannel.prototype.publish)||this._wrap(t.ConfirmChannel.prototype,"publish",_F),t}unpatchChannelModel(t){return w(t.Channel.prototype.publish)&&this._unwrap(t.Channel.prototype,"publish"),w(t.Channel.prototype.consume)&&this._unwrap(t.Channel.prototype,"consume"),w(t.Channel.prototype.ack)&&this._unwrap(t.Channel.prototype,"ack"),w(t.Channel.prototype.nack)&&this._unwrap(t.Channel.prototype,"nack"),w(t.Channel.prototype.reject)&&this._unwrap(t.Channel.prototype,"reject"),w(t.Channel.prototype.ackAll)&&this._unwrap(t.Channel.prototype,"ackAll"),w(t.Channel.prototype.nackAll)&&this._unwrap(t.Channel.prototype,"nackAll"),w(t.Channel.prototype.emit)&&this._unwrap(t.Channel.prototype,"emit"),w(t.ConfirmChannel.prototype.publish)&&this._unwrap(t.ConfirmChannel.prototype,"publish"),t}};var bF="Amqplib",YA=de(bF,()=>new Dg),Iee=(()=>({name:bF,setupOnce(){YA()}})),jA=Iee;var Bg="VercelAI";var Aee=[">=3.0.0 <7"],yF=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function Nee(e){if(typeof e!="object"||e===null)return!1;let t=e;return"type"in t&&"error"in t&&"toolName"in t&&"toolCallId"in t&&t.type==="tool-error"&&t.error instanceof Error}function vee(e){if(typeof e!="object"||e===null||!("content"in e))return;let t=e;Array.isArray(t.content)&&(Ree(t.content),Cee(t.content))}function Ree(e){for(let t of e){if(!Nee(t))continue;let n=oy(t.toolCallId);n?Be(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",t.toolName),r.setTag("vercel.ai.tool.callId",t.toolCallId),r.setLevel("error"),me(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Be(r=>{r.setTag("vercel.ai.tool.name",t.toolName),r.setTag("vercel.ai.tool.callId",t.toolCallId),r.setLevel("error"),me(t.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function Cee(e){for(let t of e)typeof t=="object"&&t!==null&&"toolCallId"in t&&typeof t.toolCallId=="string"&&iy(t.toolCallId)}function Oee(e,t,n,r,o){let i=e?.recordInputs!==void 0?e.recordInputs:t.recordInputs!==void 0?t.recordInputs:n===!0?!0:r,s=e?.recordOutputs!==void 0?e.recordOutputs:t.recordOutputs!==void 0?t.recordOutputs:n===!0?!0:o;return{recordInputs:i,recordOutputs:s}}var Hg=class extends ae{constructor(t={}){super("@sentry/instrumentation-vercel-ai",q,t),this._isPatched=!1,this._callbacks=[]}init(){return new re("ai",Aee,this._patch.bind(this))}callWhenPatched(t){this._isPatched?t():this._callbacks.push(t)}_patch(t){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,i,s)=>{let c=s[0].experimental_telemetry||{},a=c.isEnabled,l=O(),p=l?.getIntegrationByName(Bg),u=p?.options,d=p?l?.getDataCollectionOptions().genAI:void 0,{recordInputs:m,recordOutputs:_}=Oee(u,c,a,!!d?.inputs,!!d?.outputs);return s[0].experimental_telemetry={...c,isEnabled:a!==void 0?a:!0,recordInputs:m,recordOutputs:_},cr(()=>Reflect.apply(o,i,s),h=>{h&&typeof h=="object"&&we(h,"_sentry_active_span",Q())},()=>{},h=>{vee(h)})}});if(Object.prototype.toString.call(t)==="[object Module]"){for(let r of yF)t[r]!=null&&(t[r]=n(t[r]));return t}else{let r=yF.reduce((o,i)=>(t[i]!=null&&(o[i]=n(t[i])),o),{});return{...t,...r}}}};var ZA=de(Bg,()=>new Hg({}));function xee(e){return!!e.getIntegrationByName("Modules")?.getModules?.()?.ai}var Pee=((e={})=>{let t,n=gp(e);return Bt(n,{options:e,setupOnce(){t=ZA()},afterAllSetup(r){e.force??xee(r)?ud(r):t?.callWhenPatched(()=>ud(r))}})}),XA=Pee;var kee=[">=4.0.0 <8"],Fg=class extends ae{constructor(t={}){super("@sentry/instrumentation-openai",q,t)}init(){return new re("openai",kee,this._patch.bind(this))}_patch(t){let n=t;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(t,n){let r=t[n];if(!r)return t;let o=this.getConfig(),i=function(...s){if(Pn(Xr))return Reflect.construct(r,s);let c=Reflect.construct(r,s);return gd(c,o)};Object.setPrototypeOf(i,r),Object.setPrototypeOf(i.prototype,r.prototype);for(let s of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(s)){let c=Object.getOwnPropertyDescriptor(r,s);c&&Object.defineProperty(i,s,c)}try{t[n]=i}catch{Object.defineProperty(t,n,{value:i,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=i}catch{Object.defineProperty(t,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return t}};var KA=de(Xr,e=>new Fg(e)),Lee=((e={})=>({name:Xr,setupOnce(){KA(e)}})),qA=Lee;var Mee=[">=0.19.2 <1.0.0"],Wg=class extends ae{constructor(t={}){super("@sentry/instrumentation-anthropic-ai",q,t)}init(){return new re("@anthropic-ai/sdk",Mee,this._patch.bind(this))}_patch(t){let n=t.Anthropic,r=this.getConfig(),o=function(...i){if(Pn(Kr))return Reflect.construct(n,i);let s=Reflect.construct(n,i);return yd(s,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let i of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(i)){let s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(o,i,s)}try{t.Anthropic=o}catch{Object.defineProperty(t,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(t.default===n)try{t.default=o}catch{Object.defineProperty(t,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return t}};var QA=de(Kr,e=>new Wg(e)),wee=((e={})=>({name:Kr,options:e,setupOnce(){QA(e)}})),JA=wee;var SF=[">=0.10.0 <2"],Vg=class extends ae{constructor(t={}){super("@sentry/instrumentation-google-genai",q,t)}init(){return new re("@google/genai",SF,n=>this._patch(n),n=>n,[new Ae("@google/genai/dist/node/index.cjs",SF,n=>this._patch(n),n=>n)])}_patch(t){let n=t.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return t;let o=function(...i){if(Pn(qr))return Reflect.construct(n,i);let s=Reflect.construct(n,i);return Td(s,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let i of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(i)){let s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(o,i,s)}return kl(t,"GoogleGenAI",o),t}};var $A=de(qr,e=>new Vg(e)),Gee=((e={})=>({name:qr,setupOnce(){$A(e)}})),zA=Gee;var Yg=[">=0.1.0 <2.0.0"];function Uee(e,t,n){return new Proxy(e,{apply(r,o,i){let c=i[1];return(!c||typeof c!="object"||Array.isArray(c))&&(c={},i[1]=c),c.callbacks=os(c.callbacks,t),Reflect.apply(r,o,i)}})}var jg=class extends ae{constructor(t={}){super("@sentry/instrumentation-langchain",q,t)}init(){let t=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)t.push(new re(r,Yg,this._patch.bind(this),o=>o,[new Ae(`${r}/dist/index.cjs`,Yg,this._patch.bind(this),o=>o)]));return t.push(new re("langchain",Yg,this._patch.bind(this),r=>r,[new Ae("langchain/dist/chat_models/universal.cjs",Yg,this._patch.bind(this),r=>r)])),t}_patch(t){vo([Xr,Kr,qr]);let n=this.getConfig(),r=gr(n);return this._patchRunnableMethods(t,r),this._patchEmbeddingsMethods(t,n),t}_patchRunnableMethods(t,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=t.universal_exports??t,i=Object.values(o).find(a=>typeof a=="function"&&r.includes(a.name));if(!i)return;let s=i.prototype;if(s.__sentry_patched__)return;s.__sentry_patched__=!0;let c=["invoke","stream","batch"];for(let a of c){let l=s[a];typeof l=="function"&&(s[a]=Uee(l,n))}}_patchEmbeddingsMethods(t,n){let r=t.universal_exports??t;for(let o of Object.values(r)){if(typeof o!="function"||!o.prototype)continue;let i=o.prototype;typeof i.embedQuery!="function"||typeof i.embedDocuments!="function"||i.__sentry_patched__||(i.__sentry_patched__=!0,Nd(i,n))}}};var eN=de(Na,e=>new jg(e)),Dee=((e={})=>({name:Na,setupOnce(){eN(e)}})),tN=Dee;var Fp=[">=0.0.0 <2.0.0"],Zg=class extends ae{constructor(t={}){super("@sentry/instrumentation-langgraph",q,t)}init(){return[new re("@langchain/langgraph",Fp,this._patch.bind(this),t=>t,[new Ae("@langchain/langgraph/dist/index.cjs",Fp,this._patch.bind(this),t=>t),new Ae("@langchain/langgraph/dist/prebuilt/index.cjs",Fp,this._patch.bind(this),t=>t)]),new re("@langchain/langgraph/prebuilt",Fp,this._patch.bind(this),t=>t,[new Ae("@langchain/langgraph/dist/prebuilt/index.cjs",Fp,this._patch.bind(this),t=>t)])]}_patch(t){let r=O()?.getDataCollectionOptions().genAI,o={...this.getConfig(),recordInputs:this.getConfig().recordInputs??r?.inputs??!1,recordOutputs:this.getConfig().recordOutputs??r?.outputs??!1};if(t.StateGraph&&typeof t.StateGraph=="function"&&Ol(t.StateGraph.prototype,o),t.createReactAgent&&typeof t.createReactAgent=="function"){let i=t.createReactAgent;Object.defineProperty(t,"createReactAgent",{value:my(i,o),writable:!0,enumerable:!0,configurable:!0})}return t}};var nN=de(Ca,e=>new Zg(e)),Bee=((e={})=>({name:Ca,setupOnce(){nN(e)}})),rN=Bee;var Hee=e=>(It()||Me(()=>{console.warn("The launchDarklyIntegration() can only be used in the browser.")}),{name:"LaunchDarkly"});function Fee(){return It()||Me(()=>{console.warn("The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.")}),{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:()=>null}}var Wee=e=>(It()||Me(()=>{console.warn("The openFeatureIntegration() can only be used in the browser.")}),{name:"OpenFeature"}),oN=class{constructor(){It()||Me(()=>{console.warn("The OpenFeatureIntegrationHook can only be used in the browser.")})}after(){}error(){}};var Vee=e=>(It()||Me(()=>{console.warn("The statsigIntegration() can only be used in the browser.")}),{name:"Statsig"});var Yee=e=>(It()||Me(()=>{console.warn("The unleashIntegration() can only be used in the browser.")}),{name:"Unleash"});var jee=Hb;import*as TF from"net";function IF(e,t,n){let r=new re("@firebase/firestore",e,i=>EF(i,t,n)),o=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let i of o)r.files.push(new Ae(i,e,s=>EF(s,t,n),s=>AF(s,n)));return r}function EF(e,t,n){return AF(e,n),t(e,"addDoc",Zee()),t(e,"getDocs",Kee()),t(e,"setDoc",qee()),t(e,"deleteDoc",Xee()),e}function AF(e,t){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])w(e[n])&&t(e,n);return e}function Zee(){return function(t){return function(n,r){return Xg("addDoc",n,()=>t(n,r))}}}function Xee(){return function(t){return function(n){return Xg("deleteDoc",n.parent||n,()=>t(n))}}}function Kee(){return function(t){return function(n){return Xg("getDocs",n,()=>t(n))}}}function qee(){return function(t){return function(n,r,o){return Xg("setDoc",n.parent||n,()=>typeof o<"u"?t(n,r,o):t(n,r))}}}function Xg(e,t,n){return Se({name:`${e} ${t.path}`,op:"db.query",kind:D.CLIENT,attributes:{[S]:"auto.firebase.otel.firestore",[lr]:e,...Jee(t)}},n)}function Qee(e){let t,n;if(typeof e.host=="string")if(e.host.startsWith("[")){if(e.host.endsWith("]"))t=e.host.replace(/^\[|\]$/g,"");else if(e.host.includes("]:")){let r=e.host.lastIndexOf(":");r!==-1&&(t=e.host.slice(1,r).replace(/^\[|\]$/g,""),n=e.host.slice(r+1))}}else if(TF.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(":");r!==-1?(t=e.host.slice(0,r),n=e.host.slice(r+1)):t=e.host}return{address:t,port:n?parseInt(n,10):void 0}}function Jee(e){let t=e.firestore.app,n=t.options,o=(e.firestore.toJSON()||{}).settings||{},i={[ta]:e.path,[bo]:t.name,[mt]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":n.projectId,"firebase.firestore.options.appId":n.appId,"firebase.firestore.options.messagingSenderId":n.messagingSenderId,"firebase.firestore.options.storageBucket":n.storageBucket},{address:s,port:c}=Qee(o);return s&&(i[_t]=s),c&&(i[ht]=c),i}function NF(e,t,n){let r=new re("firebase-functions",e);return[{name:"firebase-functions/lib/v2/providers/https.js",triggerType:"function"},{name:"firebase-functions/lib/v2/providers/firestore.js",triggerType:"firestore"},{name:"firebase-functions/lib/v2/providers/scheduler.js",triggerType:"scheduler"},{name:"firebase-functions/lib/v2/storage.js",triggerType:"storage"}].forEach(({name:i,triggerType:s})=>{r.files.push(new Ae(i,e,c=>$ee(c,t,n,s),c=>vF(c,n)))}),r}function mn(e){return function(n){return function(...r){let o=typeof r[0]=="function"?r[0]:r[1],i=typeof r[0]=="function"?void 0:r[0];if(!o)return n.call(this,...r);let s=async function(...c){let a=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",l={[S]:"auto.firebase.otel.functions","faas.name":a,"faas.trigger":e,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(l["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(l["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),ke({name:`firebase.function.${e}`,op:"http.request",kind:D.SERVER,attributes:l},async p=>{try{let u=await o.apply(this,c);return p.end(),u}catch(u){throw p.setStatus({code:2}),me(u,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),p.end(),await Xi(2e3),u}})};return i?n.call(this,i,s):n.call(this,s)}}}function $ee(e,t,n,r){switch(vF(e,n),r){case"function":t(e,"onRequest",mn("http.request")),t(e,"onCall",mn("http.call"));break;case"firestore":t(e,"onDocumentCreated",mn("firestore.document.created")),t(e,"onDocumentUpdated",mn("firestore.document.updated")),t(e,"onDocumentDeleted",mn("firestore.document.deleted")),t(e,"onDocumentWritten",mn("firestore.document.written")),t(e,"onDocumentCreatedWithAuthContext",mn("firestore.document.created")),t(e,"onDocumentUpdatedWithAuthContext",mn("firestore.document.updated")),t(e,"onDocumentDeletedWithAuthContext",mn("firestore.document.deleted")),t(e,"onDocumentWrittenWithAuthContext",mn("firestore.document.written"));break;case"scheduler":t(e,"onSchedule",mn("scheduler.scheduled"));break;case"storage":t(e,"onObjectFinalized",mn("storage.object.finalized")),t(e,"onObjectArchived",mn("storage.object.archived")),t(e,"onObjectDeleted",mn("storage.object.deleted")),t(e,"onObjectMetadataUpdated",mn("storage.object.metadataUpdated"));break}return e}function vF(e,t){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)w(e[r])&&t(e,r);return e}var zee=[">=3.0.0 <5"],ete=[">=6.0.0 <7"],Kg=class extends ae{constructor(t={}){super("@sentry/instrumentation-firebase",q,t)}init(){let t=[];return t.push(IF(zee,this._wrap,this._unwrap)),t.push(NF(ete,this._wrap,this._unwrap)),t}};var RF="Firebase",iN=de(RF,()=>new Kg),tte=(()=>({name:RF,setupOnce(){iN()}})),sN=tte;function aN(){return[mE(),XE(),eT(),WT(),dT(),fT(),_T(),ST(),CT(),MT(),sf(),HT(),jT(),XT(),RA(),xA(),aT(),jA(),lT(),tN(),rN(),XA(),qA(),JA(),zA(),DT(),sN()]}function CF(){return[x1,dE,ZT,ZE,Hf,FT,sT,YT,cT,uT,mT,gT,yT,LT,Hf,zE,RT,vA,OA,YA,eN,ZA,KA,UT,iN,QA,$A,nN]}at();var cN=1e6,qg=Symbol.for("opentelemetry.js.api.1");function OF(e){if(he.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[qg];if(n&&!n.trace){if(Ye&&g.warn("Replaced a pre-existing OpenTelemetry API registry that was created by a different @opentelemetry/api version and would have blocked tracing. If you want to manage OpenTelemetry yourself, set `skipOpenTelemetrySetup: true` in `Sentry.init()`."),t[qg]=void 0,!he.setGlobalTracerProvider(e))return!1;let r=t[qg];if(r){let{propagation:o,context:i,...s}=n;t[qg]={...s,...r}}return!0}return!1}function lN(e,t={}){e.getOptions().debug&&ZS();let[n,r]=ote(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function nte(e={}){let{debug:t}=e;t&&g.enable(),sp(),rte(e.integrations).forEach(n=>{n(),t&&g.log(`[Sentry] Preloaded ${n.id} instrumentation`)})}function rte(e){let t=CF();return e?t.filter(n=>{let r=n.id;return e.some(o=>r===o||r.startsWith(`${o}.`))}):t}function ote(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||!!t.spanProcessors?.length))return ite(e);let r=new lv({sampler:new $l(e),resource:ym("node"),forceFlushTimeoutMillis:500,spanProcessors:[new Jl({timeout:ste(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});OF(r),uo.setGlobalPropagator(new Qa);let o=new ep;return pe.setGlobalContextManager(o),[r,o.getAsyncLocalStorageLookup()]}function ite(e){let t=new zl({resource:ym("node")});if(!OF(t))return Ye&&g.warn("Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered."),[void 0,void 0];ms("SentryTracerProvider"),uo.setGlobalPropagator(new Qa);let n=new ep;return pe.setGlobalContextManager(n),e.on("spanEnd",r=>{bm(r,{finalizeStatus:!0})}),rt(e)&&e.on("preprocessSpan",hm),e.on("preprocessEvent",r=>{r.type==="transaction"&&(r.contexts={...r.contexts,otel:{resource:t.resource?.attributes,...r.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function ste(e){if(e!=null){if(e>cN)return Ye&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${cN}`),cN;if(e<=0||Number.isNaN(e)){Ye&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function xF(){return Fm().filter(t=>t.name!=="Http"&&t.name!=="NodeFetch").concat(cE(),lE())}function PF(e){return[...xF(),...Ue(e)?aN():[]]}function ate(e,t){if(ic()&&Ue(t)){let n=ET();if(n){let r=new Set(n.replacedOtelIntegrationNames);return[...e.filter(o=>!r.has(o.name)),...n.integrations]}}return e}function cte(e={}){return kF(e,PF)}function kF(e={},t){$i(e,"node");let n=ic()&&Ue(e)?ET():void 0;n&&n.register();let r=e.defaultIntegrations??t(e);if(n&&Array.isArray(r)&&r.length>0){let i=new Set(n.replacedOtelIntegrationNames);r=[...r.filter(s=>!i.has(s.name)),...n.integrations]}let o=tE({...e,defaultIntegrations:r});return o&&!e.skipOpenTelemetrySetup&&(lN(o,{spanProcessors:e.openTelemetrySpanProcessors}),Wm()),n&&n.detect(),o}function lte(e={}){return kF(e,()=>[])}import*as gne from"module";import"url";import{isMainThread as _ne,parentPort as hne}from"worker_threads";var Wp=[...QT,...JT,...$T,...zT,...eI,...tI,...nI,...oI,...iI,...sI,...aI,...cI,...lI,...pI,...dI,...mI,...fI,...gI,..._I,...hI,...bI,...yI,...SI,...EI,...TI,...II,...AI,...NI,...vI],$2e=[...CG,...xG,...kG,...MG,...GG,...DG,...HG,...WG,...YG,...ZG,...KG,...QG,...zG,...tU,...iU,...cU,...pU,...dU,..._U,...bU,...SU,...TU,...AU,...vU,...CU,...xU,...kU,...MU,...GU];function pte(e=[]){return[...sl([...Wp,...e].map(t=>t.module.name)),"@remix-run/node"]}var z2e=pte();function Ai(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var MF=ute;function ute(e,t){let[n]=wF(e,"");for(let r of mte(t))if(dte(r,n))return!0;return!1}function dte(e,t){for(let[n,r]of e)if(!_te(t,r,n))return!1;return!0}function LF(e){return e==="latest"&&(e=">=0"),e.match(/^([^\d+]*)(\d.*)$/)||[null,"","*.*.*"]}function mte(e){let t=[],n=[],r=e.trim().split(/\s+/);for(let o=0;o<r.length;o++){let i=r[o];if(i==="-")continue;if(i==="||"){t.push(n),n=[];continue}if(/^[<>=~v^]+$/.test(i)&&o+1<r.length){r[o+1]=i+r[o+1];continue}let s=LF(i),c=s[1]||"=";c.endsWith("v")&&(c=c.slice(0,-1));let[a,l]=wF(s[2],c);if(o+2<r.length&&r[o+1]==="-"){let p=LF(r[o+2]);r[o+2]="<="+(p[2].indexOf("-")===-1?p[2]+".*.*":p[2]),l=">="}if(l[0]==="~"){let p=s[2].split("-")[0].split(".").length;n.push([">=",a]),n.push(["<",p===1?Tc(a,0):Tc(a,1)])}else if(l[0]==="^"){let p=a[0]!==0?0:a[1]!==0?1:2;n.push([">=",a]),n.push(["<",p===0?Tc(a,0):p===1?Tc(a,1):Tc(a,2)])}else n.push([l.replace("~","").replace("^",""),a])}return n.length&&t.push(n),t}function Tc(e,t){let n=e.slice(0);if(e[t]===-1)return n;for(n[t++]++;t<3;t++)n[t]=0;return n}function fte(e){return e==="x"||e==="X"||e==="*"||e==="latest"?-1:Number(e)}function gte(e){return/^\d+$/.test(e)?Number(e):e}function Ni(e,t,n){return n===-1?e!=="<":e==="="?t===n:e===">"?t>n:e===">="?t>=n:e==="<"?t<n:e==="<="?t<=n:!1}function wF(e,t){e=e.split("+")[0];let[n,r]=e.split("-"),o=n.split(".").map(fte).slice(0,3),i=Math.max(o.length-1,0);return t===">"?(t=">=",o.push(0,0,0),o[i]++):t===""?o.push(0,0,0):o.push(-1,-1,-1),r?[o.slice(0,3).concat(r.split(".").map(gte)),t]:[o.slice(0,3),t]}function _te(e,t,n){if(!Ni("=",e[0],t[0]))return Ni(n,e[0],t[0]);if(!Ni("=",e[1],t[1]))return Ni(n,e[1],t[1]);if(!Ni("=",e[2],t[2])||e.length===3&&t.length===3)return Ni(n,e[2],t[2]);if(n[0]==="<"&&(t.length===3||e.length===3))return!1;if(n[0]===">"){if(e.length===3)return!0;if(t.length===3)return!1}for(let r=3;r<Math.max(e.length,t.length);r++)if(Ni(n,e[r]||"",t[r]||""))return!0;return!1}function uN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mN(e,t){return(function(n){if(Array.isArray(n))return n})(e)||(function(n,r){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var i,s,c,a,l=[],p=!0,u=!1;try{if(c=(o=o.call(n)).next,r!==0)for(;!(p=(i=c.call(o)).done)&&(l.push(i.value),l.length!==r);p=!0);}catch(d){u=!0,s=d}finally{try{if(!p&&o.return!=null&&(a=o.return(),Object(a)!==a))return}finally{if(u)throw s}}return l}})(e,t)||HF(e,t)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
39
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function hte(e){return(function(t){if(Array.isArray(t))return uN(t)})(e)||(function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)})(e)||HF(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
40
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Vp(e){return(Vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function HF(e,t){if(e){if(typeof e=="string")return uN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uN(e,t):void 0}}function FF(e,t){return e(t={exports:{}},t.exports),t.exports}var Qg=FF((function(e,t){(function n(r){var o,i,s,c,a,l;function p(R){var v,P,G={};for(v in R)R.hasOwnProperty(v)&&(P=R[v],G[v]=typeof P=="object"&&P!==null?p(P):P);return G}function u(R,v){this.parent=R,this.key=v}function d(R,v,P,G){this.node=R,this.path=v,this.wrap=P,this.ref=G}function m(){}function _(R){return R!=null&&typeof R=="object"&&typeof R.type=="string"}function h(R,v){return(R===o.ObjectExpression||R===o.ObjectPattern)&&v==="properties"}function b(R,v){for(var P=R.length-1;P>=0;--P)if(R[P].node===v)return!0;return!1}function N(R,v){return new m().traverse(R,v)}function L(R,v){var P;return P=(function(G,I){var B,k,U,ce;for(k=G.length,U=0;k;)I(G[ce=U+(B=k>>>1)])?k=B:(U=ce+1,k-=B+1);return U})(v,(function(G){return G.range[0]>R.range[0]})),R.extendedRange=[R.range[0],R.range[1]],P!==v.length&&(R.extendedRange[1]=v[P].range[0]),(P-=1)>=0&&(R.extendedRange[0]=v[P].range[1]),R}return o={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},i={Break:c={},Skip:a={},Remove:l={}},u.prototype.replace=function(R){this.parent[this.key]=R},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},m.prototype.path=function(){var R,v,P,G,I;function B(k,U){if(Array.isArray(U))for(P=0,G=U.length;P<G;++P)k.push(U[P]);else k.push(U)}if(!this.__current.path)return null;for(I=[],R=2,v=this.__leavelist.length;R<v;++R)B(I,this.__leavelist[R].path);return B(I,this.__current.path),I},m.prototype.type=function(){return this.current().type||this.__current.wrap},m.prototype.parents=function(){var R,v,P;for(P=[],R=1,v=this.__leavelist.length;R<v;++R)P.push(this.__leavelist[R].node);return P},m.prototype.current=function(){return this.__current.node},m.prototype.__execute=function(R,v){var P,G;return G=void 0,P=this.__current,this.__current=v,this.__state=null,R&&(G=R.call(this,v.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=P,G},m.prototype.notify=function(R){this.__state=R},m.prototype.skip=function(){this.notify(a)},m.prototype.break=function(){this.notify(c)},m.prototype.remove=function(){this.notify(l)},m.prototype.__initialize=function(R,v){this.visitor=v,this.root=R,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,v.fallback==="iteration"?this.__fallback=Object.keys:typeof v.fallback=="function"&&(this.__fallback=v.fallback),this.__keys=s,v.keys&&(this.__keys=Object.assign(Object.create(this.__keys),v.keys))},m.prototype.traverse=function(R,v){var P,G,I,B,k,U,ce,ge,Ne,Te,Oe,qe;for(this.__initialize(R,v),qe={},P=this.__worklist,G=this.__leavelist,P.push(new d(R,null,null,null)),G.push(new d(null,null,null,null));P.length;)if((I=P.pop())!==qe){if(I.node){if(U=this.__execute(v.enter,I),this.__state===c||U===c)return;if(P.push(qe),G.push(I),this.__state===a||U===a)continue;if(k=(B=I.node).type||I.wrap,!(Te=this.__keys[k])){if(!this.__fallback)throw new Error("Unknown node type "+k+".");Te=this.__fallback(B)}for(ge=Te.length;(ge-=1)>=0;)if(Oe=B[ce=Te[ge]]){if(Array.isArray(Oe)){for(Ne=Oe.length;(Ne-=1)>=0;)if(Oe[Ne]&&!b(G,Oe[Ne])){if(h(k,Te[ge]))I=new d(Oe[Ne],[ce,Ne],"Property",null);else{if(!_(Oe[Ne]))continue;I=new d(Oe[Ne],[ce,Ne],null,null)}P.push(I)}}else if(_(Oe)){if(b(G,Oe))continue;P.push(new d(Oe,ce,null,null))}}}}else if(I=G.pop(),U=this.__execute(v.leave,I),this.__state===c||U===c)return},m.prototype.replace=function(R,v){var P,G,I,B,k,U,ce,ge,Ne,Te,Oe,qe,Nt;function In(ao){var co,Oi,xi,Oc;if(ao.ref.remove()){for(Oi=ao.ref.key,Oc=ao.ref.parent,co=P.length;co--;)if((xi=P[co]).ref&&xi.ref.parent===Oc){if(xi.ref.key<Oi)break;--xi.ref.key}}}for(this.__initialize(R,v),Oe={},P=this.__worklist,G=this.__leavelist,U=new d(R,null,null,new u(qe={root:R},"root")),P.push(U),G.push(U);P.length;)if((U=P.pop())!==Oe){if((k=this.__execute(v.enter,U))!==void 0&&k!==c&&k!==a&&k!==l&&(U.ref.replace(k),U.node=k),this.__state!==l&&k!==l||(In(U),U.node=null),this.__state===c||k===c)return qe.root;if((I=U.node)&&(P.push(Oe),G.push(U),this.__state!==a&&k!==a)){if(B=I.type||U.wrap,!(Ne=this.__keys[B])){if(!this.__fallback)throw new Error("Unknown node type "+B+".");Ne=this.__fallback(I)}for(ce=Ne.length;(ce-=1)>=0;)if(Te=I[Nt=Ne[ce]])if(Array.isArray(Te)){for(ge=Te.length;(ge-=1)>=0;)if(Te[ge]){if(h(B,Ne[ce]))U=new d(Te[ge],[Nt,ge],"Property",new u(Te,ge));else{if(!_(Te[ge]))continue;U=new d(Te[ge],[Nt,ge],null,new u(Te,ge))}P.push(U)}}else _(Te)&&P.push(new d(Te,Nt,null,new u(I,Nt)))}}else if(U=G.pop(),(k=this.__execute(v.leave,U))!==void 0&&k!==c&&k!==a&&k!==l&&U.ref.replace(k),this.__state!==l&&k!==l||In(U),this.__state===c||k===c)return qe.root;return qe.root},r.Syntax=o,r.traverse=N,r.replace=function(R,v){return new m().replace(R,v)},r.attachComments=function(R,v,P){var G,I,B,k,U=[];if(!R.range)throw new Error("attachComments needs range information");if(!P.length){if(v.length){for(B=0,I=v.length;B<I;B+=1)(G=p(v[B])).extendedRange=[0,R.range[0]],U.push(G);R.leadingComments=U}return R}for(B=0,I=v.length;B<I;B+=1)U.push(L(p(v[B]),P));return k=0,N(R,{enter:function(ce){for(var ge;k<U.length&&!((ge=U[k]).extendedRange[1]>ce.range[0]);)ge.extendedRange[1]===ce.range[0]?(ce.leadingComments||(ce.leadingComments=[]),ce.leadingComments.push(ge),U.splice(k,1)):k+=1;return k===U.length?i.Break:U[k].extendedRange[0]>ce.range[1]?i.Skip:void 0}}),k=0,N(R,{leave:function(ce){for(var ge;k<U.length&&(ge=U[k],!(ce.range[1]<ge.extendedRange[0]));)ce.range[1]===ge.extendedRange[0]?(ce.trailingComments||(ce.trailingComments=[]),ce.trailingComments.push(ge),U.splice(k,1)):k+=1;return k===U.length?i.Break:U[k].extendedRange[0]>ce.range[1]?i.Skip:void 0}}),R},r.VisitorKeys=s,r.VisitorOption=i,r.Controller=m,r.cloneEnvironment=function(){return n({})},r})(t)})),bte=FF((function(e){e.exports&&(e.exports=(function(){function t(n,r,o,i){this.message=n,this.expected=r,this.found=o,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)}return(function(n,r){function o(){this.constructor=n}o.prototype=r.prototype,n.prototype=new o})(t,Error),t.buildMessage=function(n,r){var o={literal:function(a){return'"'+s(a.text)+'"'},class:function(a){var l,p="";for(l=0;l<a.parts.length;l++)p+=a.parts[l]instanceof Array?c(a.parts[l][0])+"-"+c(a.parts[l][1]):c(a.parts[l]);return"["+(a.inverted?"^":"")+p+"]"},any:function(a){return"any character"},end:function(a){return"end of input"},other:function(a){return a.description}};function i(a){return a.charCodeAt(0).toString(16).toUpperCase()}function s(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(l){return"\\x0"+i(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+i(l)}))}function c(a){return a.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(l){return"\\x0"+i(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+i(l)}))}return"Expected "+(function(a){var l,p,u,d=new Array(a.length);for(l=0;l<a.length;l++)d[l]=(u=a[l],o[u.type](u));if(d.sort(),d.length>0){for(l=1,p=1;l<d.length;l++)d[l-1]!==d[l]&&(d[p]=d[l],p++);d.length=p}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}})(n)+" but "+(function(a){return a?'"'+s(a)+'"':"end of input"})(r)+" found."},{SyntaxError:t,parse:function(n,r){r=r!==void 0?r:{};var o,i,s,c,a={},l={start:QN},p=QN,u=Xe(" ",!1),d=/^[^ [\],():#!=><~+.]/,m=Ir([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),_=Xe(">",!1),h=Xe("~",!1),b=Xe("+",!1),N=Xe(",",!1),L=function(T,F){return[T].concat(F.map((function(Y){return Y[3]})))},R=Xe("!",!1),v=Xe("*",!1),P=Xe("#",!1),G=Xe("[",!1),I=Xe("]",!1),B=/^[><!]/,k=Ir([">","<","!"],!1,!1),U=Xe("=",!1),ce=function(T){return(T||"")+"="},ge=/^[><]/,Ne=Ir([">","<"],!1,!1),Te=Xe(".",!1),Oe=function(T,F,Y){return{type:"attribute",name:T,operator:F,value:Y}},qe=Xe('"',!1),Nt=/^[^\\"]/,In=Ir(["\\",'"'],!0,!1),ao=Xe("\\",!1),co={type:"any"},Oi=function(T,F){return T+F},xi=function(T){return{type:"literal",value:(F=T.join(""),F.replace(/\\(.)/g,(function(Y,y){switch(y){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
41
|
+
`;case"r":return"\r";case"t":return" ";case"v":return"\v";default:return y}})))};var F},Oc=Xe("'",!1),GN=/^[^\\']/,UN=Ir(["\\","'"],!0,!1),Bo=/^[0-9]/,Ho=Ir([["0","9"]],!1,!1),O2=Xe("type(",!1),DN=/^[^ )]/,BN=Ir([" ",")"],!0,!1),Pi=Xe(")",!1),HN=/^[imsu]/,FN=Ir(["i","m","s","u"],!1,!1),WN=Xe("/",!1),VN=/^[^\]\\]/,YN=Ir(["]","\\"],!0,!1),jN=/^[^\/\\[]/,ZN=Ir(["/","\\","["],!0,!1),x2=Xe(":not(",!1),P2=Xe(":matches(",!1),XN=function(T){return{type:"matches",selectors:T}},k2=Xe(":is(",!1),L2=Xe(":has(",!1),M2=Xe(":first-child",!1),w2=Xe(":last-child",!1),G2=Xe(":nth-child(",!1),U2=Xe(":nth-last-child(",!1),D2=Xe(":",!1),f=0,Zp=[{line:1,column:1}],Tr=0,d_=[],z={};if("startRule"in r){if(!(r.startRule in l))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');p=l[r.startRule]}function Xe(T,F){return{type:"literal",text:T,ignoreCase:F}}function Ir(T,F,Y){return{type:"class",parts:T,inverted:F,ignoreCase:Y}}function KN(T){var F,Y=Zp[T];if(Y)return Y;for(F=T-1;!Zp[F];)F--;for(Y={line:(Y=Zp[F]).line,column:Y.column};F<T;)n.charCodeAt(F)===10?(Y.line++,Y.column=1):Y.column++,F++;return Zp[T]=Y,Y}function qN(T,F){var Y=KN(T),y=KN(F);return{start:{offset:T,line:Y.line,column:Y.column},end:{offset:F,line:y.line,column:y.column}}}function j(T){f<Tr||(f>Tr&&(Tr=f,d_=[]),d_.push(T))}function QN(){var T,F,Y,y,C=36*f+0,K=z[C];return K?(f=K.nextPos,K.result):(T=f,(F=Ce())!==a&&(Y=Xp())!==a&&Ce()!==a?T=F=(y=Y).length===1?y[0]:{type:"matches",selectors:y}:(f=T,T=a),T===a&&(T=f,(F=Ce())!==a&&(F=void 0),T=F),z[C]={nextPos:f,result:T},T)}function Ce(){var T,F,Y=36*f+1,y=z[Y];if(y)return f=y.nextPos,y.result;for(T=[],n.charCodeAt(f)===32?(F=" ",f++):(F=a,j(u));F!==a;)T.push(F),n.charCodeAt(f)===32?(F=" ",f++):(F=a,j(u));return z[Y]={nextPos:f,result:T},T}function lo(){var T,F,Y,y=36*f+2,C=z[y];if(C)return f=C.nextPos,C.result;if(F=[],d.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(m)),Y!==a)for(;Y!==a;)F.push(Y),d.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(m));else F=a;return F!==a&&(F=F.join("")),T=F,z[y]={nextPos:f,result:T},T}function m_(){var T,F,Y,y=36*f+3,C=z[y];return C?(f=C.nextPos,C.result):(T=f,(F=Ce())!==a?(n.charCodeAt(f)===62?(Y=">",f++):(Y=a,j(_)),Y!==a&&Ce()!==a?T=F="child":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,(F=Ce())!==a?(n.charCodeAt(f)===126?(Y="~",f++):(Y=a,j(h)),Y!==a&&Ce()!==a?T=F="sibling":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,(F=Ce())!==a?(n.charCodeAt(f)===43?(Y="+",f++):(Y=a,j(b)),Y!==a&&Ce()!==a?T=F="adjacent":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,n.charCodeAt(f)===32?(F=" ",f++):(F=a,j(u)),F!==a&&(Y=Ce())!==a?T=F="descendant":(f=T,T=a)))),z[y]={nextPos:f,result:T},T)}function Xp(){var T,F,Y,y,C,K,X,_e,be=36*f+5,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(T=f,(F=Kp())!==a){for(Y=[],y=f,(C=Ce())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(N)),K!==a&&(X=Ce())!==a&&(_e=Kp())!==a?y=C=[C,K,X,_e]:(f=y,y=a)):(f=y,y=a);y!==a;)Y.push(y),y=f,(C=Ce())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(N)),K!==a&&(X=Ce())!==a&&(_e=Kp())!==a?y=C=[C,K,X,_e]:(f=y,y=a)):(f=y,y=a);Y!==a?T=F=L(F,Y):(f=T,T=a)}else f=T,T=a;return z[be]={nextPos:f,result:T},T}function f_(){var T,F,Y,y,C,K=36*f+6,X=z[K];return X?(f=X.nextPos,X.result):(T=f,(F=m_())===a&&(F=null),F!==a&&(Y=Kp())!==a?(C=Y,T=F=(y=F)?{type:y,left:{type:"exactNode"},right:C}:C):(f=T,T=a),z[K]={nextPos:f,result:T},T)}function Kp(){var T,F,Y,y,C,K,X,_e=36*f+7,be=z[_e];if(be)return f=be.nextPos,be.result;if(T=f,(F=g_())!==a){for(Y=[],y=f,(C=m_())!==a&&(K=g_())!==a?y=C=[C,K]:(f=y,y=a);y!==a;)Y.push(y),y=f,(C=m_())!==a&&(K=g_())!==a?y=C=[C,K]:(f=y,y=a);Y!==a?(X=F,T=F=Y.reduce((function(ye,st){return{type:st[0],left:ye,right:st[1]}}),X)):(f=T,T=a)}else f=T,T=a;return z[_e]={nextPos:f,result:T},T}function g_(){var T,F,Y,y,C,K,X,_e=36*f+8,be=z[_e];if(be)return f=be.nextPos,be.result;if(T=f,n.charCodeAt(f)===33?(F="!",f++):(F=a,j(R)),F===a&&(F=null),F!==a){if(Y=[],(y=JN())!==a)for(;y!==a;)Y.push(y),y=JN();else Y=a;Y!==a?(C=F,X=(K=Y).length===1?K[0]:{type:"compound",selectors:K},C&&(X.subject=!0),T=F=X):(f=T,T=a)}else f=T,T=a;return z[_e]={nextPos:f,result:T},T}function JN(){var T,F=36*f+9,Y=z[F];return Y?(f=Y.nextPos,Y.result):((T=(function(){var y,C,K=36*f+10,X=z[K];return X?(f=X.nextPos,X.result):(n.charCodeAt(f)===42?(C="*",f++):(C=a,j(v)),C!==a&&(C={type:"wildcard",value:C}),y=C,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K,X=36*f+11,_e=z[X];return _e?(f=_e.nextPos,_e.result):(y=f,n.charCodeAt(f)===35?(C="#",f++):(C=a,j(P)),C===a&&(C=null),C!==a&&(K=lo())!==a?y=C={type:"identifier",value:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K,X,_e=36*f+12,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.charCodeAt(f)===91?(C="[",f++):(C=a,j(G)),C!==a&&Ce()!==a&&(K=(function(){var ye,st,Gn,je,$n=36*f+16,rn=z[$n];return rn?(f=rn.nextPos,rn.result):(ye=f,(st=__())!==a&&Ce()!==a&&(Gn=(function(){var Z,le,Ee,W=36*f+14,Ie=z[W];return Ie?(f=Ie.nextPos,Ie.result):(Z=f,n.charCodeAt(f)===33?(le="!",f++):(le=a,j(R)),le===a&&(le=null),le!==a?(n.charCodeAt(f)===61?(Ee="=",f++):(Ee=a,j(U)),Ee!==a?(le=ce(le),Z=le):(f=Z,Z=a)):(f=Z,Z=a),z[W]={nextPos:f,result:Z},Z)})())!==a&&Ce()!==a?((je=(function(){var Z,le,Ee,W,Ie,Qe=36*f+20,Un=z[Qe];if(Un)return f=Un.nextPos,Un.result;if(Z=f,n.substr(f,5)==="type("?(le="type(",f+=5):(le=a,j(O2)),le!==a)if(Ce()!==a){if(Ee=[],DN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(BN)),W!==a)for(;W!==a;)Ee.push(W),DN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(BN));else Ee=a;Ee!==a&&(W=Ce())!==a?(n.charCodeAt(f)===41?(Ie=")",f++):(Ie=a,j(Pi)),Ie!==a?(le={type:"type",value:Ee.join("")},Z=le):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;else f=Z,Z=a;return z[Qe]={nextPos:f,result:Z},Z})())===a&&(je=(function(){var Z,le,Ee,W,Ie,Qe,Un=36*f+22,Ar=z[Un];if(Ar)return f=Ar.nextPos,Ar.result;if(Z=f,n.charCodeAt(f)===47?(le="/",f++):(le=a,j(WN)),le!==a){if(Ee=[],(W=$N())===a&&(W=qp())===a&&(W=zN()),W!==a)for(;W!==a;)Ee.push(W),(W=$N())===a&&(W=qp())===a&&(W=zN());else Ee=a;Ee!==a?(n.charCodeAt(f)===47?(W="/",f++):(W=a,j(WN)),W!==a?((Ie=(function(){var po,ki,nv=36*f+21,h_=z[nv];if(h_)return f=h_.nextPos,h_.result;if(po=[],HN.test(n.charAt(f))?(ki=n.charAt(f),f++):(ki=a,j(FN)),ki!==a)for(;ki!==a;)po.push(ki),HN.test(n.charAt(f))?(ki=n.charAt(f),f++):(ki=a,j(FN));else po=a;return z[nv]={nextPos:f,result:po},po})())===a&&(Ie=null),Ie!==a?(Qe=Ie,le={type:"regexp",value:new RegExp(Ee.join(""),Qe?Qe.join(""):"")},Z=le):(f=Z,Z=a)):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;return z[Un]={nextPos:f,result:Z},Z})()),je!==a?(st=Oe(st,Gn,je),ye=st):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(st=__())!==a&&Ce()!==a&&(Gn=(function(){var Z,le,Ee,W=36*f+13,Ie=z[W];return Ie?(f=Ie.nextPos,Ie.result):(Z=f,B.test(n.charAt(f))?(le=n.charAt(f),f++):(le=a,j(k)),le===a&&(le=null),le!==a?(n.charCodeAt(f)===61?(Ee="=",f++):(Ee=a,j(U)),Ee!==a?(le=ce(le),Z=le):(f=Z,Z=a)):(f=Z,Z=a),Z===a&&(ge.test(n.charAt(f))?(Z=n.charAt(f),f++):(Z=a,j(Ne))),z[W]={nextPos:f,result:Z},Z)})())!==a&&Ce()!==a?((je=(function(){var Z,le,Ee,W,Ie,Qe,Un=36*f+17,Ar=z[Un];if(Ar)return f=Ar.nextPos,Ar.result;if(Z=f,n.charCodeAt(f)===34?(le='"',f++):(le=a,j(qe)),le!==a){for(Ee=[],Nt.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(In)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ao)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(co)),Qe!==a?(Ie=Oi(Ie,Qe),W=Ie):(f=W,W=a)):(f=W,W=a));W!==a;)Ee.push(W),Nt.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(In)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ao)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(co)),Qe!==a?(Ie=Oi(Ie,Qe),W=Ie):(f=W,W=a)):(f=W,W=a));Ee!==a?(n.charCodeAt(f)===34?(W='"',f++):(W=a,j(qe)),W!==a?(le=xi(Ee),Z=le):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;if(Z===a)if(Z=f,n.charCodeAt(f)===39?(le="'",f++):(le=a,j(Oc)),le!==a){for(Ee=[],GN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(UN)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ao)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(co)),Qe!==a?(Ie=Oi(Ie,Qe),W=Ie):(f=W,W=a)):(f=W,W=a));W!==a;)Ee.push(W),GN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(UN)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ao)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(co)),Qe!==a?(Ie=Oi(Ie,Qe),W=Ie):(f=W,W=a)):(f=W,W=a));Ee!==a?(n.charCodeAt(f)===39?(W="'",f++):(W=a,j(Oc)),W!==a?(le=xi(Ee),Z=le):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;return z[Un]={nextPos:f,result:Z},Z})())===a&&(je=(function(){var Z,le,Ee,W,Ie,Qe,Un,Ar=36*f+18,po=z[Ar];if(po)return f=po.nextPos,po.result;for(Z=f,le=f,Ee=[],Bo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Ho));W!==a;)Ee.push(W),Bo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Ho));if(Ee!==a?(n.charCodeAt(f)===46?(W=".",f++):(W=a,j(Te)),W!==a?le=Ee=[Ee,W]:(f=le,le=a)):(f=le,le=a),le===a&&(le=null),le!==a){if(Ee=[],Bo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Ho)),W!==a)for(;W!==a;)Ee.push(W),Bo.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Ho));else Ee=a;Ee!==a?(Qe=Ee,Un=(Ie=le)?[].concat.apply([],Ie).join(""):"",le={type:"literal",value:parseFloat(Un+Qe.join(""))},Z=le):(f=Z,Z=a)}else f=Z,Z=a;return z[Ar]={nextPos:f,result:Z},Z})())===a&&(je=(function(){var Z,le,Ee=36*f+19,W=z[Ee];return W?(f=W.nextPos,W.result):((le=lo())!==a&&(le={type:"literal",value:le}),Z=le,z[Ee]={nextPos:f,result:Z},Z)})()),je!==a?(st=Oe(st,Gn,je),ye=st):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(st=__())!==a&&(st={type:"attribute",name:st}),ye=st)),z[$n]={nextPos:f,result:ye},ye)})())!==a&&Ce()!==a?(n.charCodeAt(f)===93?(X="]",f++):(X=a,j(I)),X!==a?y=C=K:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K,X,_e,be,ye,st,Gn=36*f+26,je=z[Gn];if(je)return f=je.nextPos,je.result;if(y=f,n.charCodeAt(f)===46?(C=".",f++):(C=a,j(Te)),C!==a)if((K=lo())!==a){for(X=[],_e=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=lo())!==a?_e=be=[be,ye]:(f=_e,_e=a);_e!==a;)X.push(_e),_e=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=lo())!==a?_e=be=[be,ye]:(f=_e,_e=a);X!==a?(st=K,C={type:"field",name:X.reduce((function($n,rn){return $n+rn[0]+rn[1]}),st)},y=C):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[Gn]={nextPos:f,result:y},y})())===a&&(T=(function(){var y,C,K,X,_e=36*f+27,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":not("?(C=":not(",f+=5):(C=a,j(x2)),C!==a&&Ce()!==a&&(K=Xp())!==a&&Ce()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Pi)),X!==a?y=C={type:"not",selectors:K}:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K,X,_e=36*f+28,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,9)===":matches("?(C=":matches(",f+=9):(C=a,j(P2)),C!==a&&Ce()!==a&&(K=Xp())!==a&&Ce()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Pi)),X!==a?(C=XN(K),y=C):(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K,X,_e=36*f+29,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,4)===":is("?(C=":is(",f+=4):(C=a,j(k2)),C!==a&&Ce()!==a&&(K=Xp())!==a&&Ce()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Pi)),X!==a?(C=XN(K),y=C):(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K,X,_e=36*f+30,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":has("?(C=":has(",f+=5):(C=a,j(L2)),C!==a&&Ce()!==a&&(K=(function(){var ye,st,Gn,je,$n,rn,Z,le,Ee=36*f+4,W=z[Ee];if(W)return f=W.nextPos,W.result;if(ye=f,(st=f_())!==a){for(Gn=[],je=f,($n=Ce())!==a?(n.charCodeAt(f)===44?(rn=",",f++):(rn=a,j(N)),rn!==a&&(Z=Ce())!==a&&(le=f_())!==a?je=$n=[$n,rn,Z,le]:(f=je,je=a)):(f=je,je=a);je!==a;)Gn.push(je),je=f,($n=Ce())!==a?(n.charCodeAt(f)===44?(rn=",",f++):(rn=a,j(N)),rn!==a&&(Z=Ce())!==a&&(le=f_())!==a?je=$n=[$n,rn,Z,le]:(f=je,je=a)):(f=je,je=a);Gn!==a?ye=st=L(st,Gn):(f=ye,ye=a)}else f=ye,ye=a;return z[Ee]={nextPos:f,result:ye},ye})())!==a&&Ce()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Pi)),X!==a?y=C={type:"has",selectors:K}:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K=36*f+31,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,12)===":first-child"?(C=":first-child",f+=12):(C=a,j(M2)),C!==a&&(C=ev(1)),y=C,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K=36*f+32,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,11)===":last-child"?(C=":last-child",f+=11):(C=a,j(w2)),C!==a&&(C=tv(1)),y=C,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,C,K,X,_e,be=36*f+33,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(y=f,n.substr(f,11)===":nth-child("?(C=":nth-child(",f+=11):(C=a,j(G2)),C!==a)if(Ce()!==a){if(K=[],Bo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Ho)),X!==a)for(;X!==a;)K.push(X),Bo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Ho));else K=a;K!==a&&(X=Ce())!==a?(n.charCodeAt(f)===41?(_e=")",f++):(_e=a,j(Pi)),_e!==a?(C=ev(parseInt(K.join(""),10)),y=C):(f=y,y=a)):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[be]={nextPos:f,result:y},y})())===a&&(T=(function(){var y,C,K,X,_e,be=36*f+34,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(y=f,n.substr(f,16)===":nth-last-child("?(C=":nth-last-child(",f+=16):(C=a,j(U2)),C!==a)if(Ce()!==a){if(K=[],Bo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Ho)),X!==a)for(;X!==a;)K.push(X),Bo.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Ho));else K=a;K!==a&&(X=Ce())!==a?(n.charCodeAt(f)===41?(_e=")",f++):(_e=a,j(Pi)),_e!==a?(C=tv(parseInt(K.join(""),10)),y=C):(f=y,y=a)):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[be]={nextPos:f,result:y},y})())===a&&(T=(function(){var y,C,K,X=36*f+35,_e=z[X];return _e?(f=_e.nextPos,_e.result):(y=f,n.charCodeAt(f)===58?(C=":",f++):(C=a,j(D2)),C!==a&&(K=lo())!==a?y=C={type:"class",name:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})()),z[F]={nextPos:f,result:T},T)}function __(){var T,F,Y,y,C,K,X,_e,be=36*f+15,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(T=f,(F=lo())!==a){for(Y=[],y=f,n.charCodeAt(f)===46?(C=".",f++):(C=a,j(Te)),C!==a&&(K=lo())!==a?y=C=[C,K]:(f=y,y=a);y!==a;)Y.push(y),y=f,n.charCodeAt(f)===46?(C=".",f++):(C=a,j(Te)),C!==a&&(K=lo())!==a?y=C=[C,K]:(f=y,y=a);Y!==a?(X=F,_e=Y,T=F=[].concat.apply([X],_e).join("")):(f=T,T=a)}else f=T,T=a;return z[be]={nextPos:f,result:T},T}function $N(){var T,F,Y,y,C=36*f+23,K=z[C];if(K)return f=K.nextPos,K.result;if(T=f,n.charCodeAt(f)===91?(F="[",f++):(F=a,j(G)),F!==a){if(Y=[],VN.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(YN)),y===a&&(y=qp()),y!==a)for(;y!==a;)Y.push(y),VN.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(YN)),y===a&&(y=qp());else Y=a;Y!==a?(n.charCodeAt(f)===93?(y="]",f++):(y=a,j(I)),y!==a?T=F="["+Y.join("")+"]":(f=T,T=a)):(f=T,T=a)}else f=T,T=a;return z[C]={nextPos:f,result:T},T}function qp(){var T,F,Y,y=36*f+24,C=z[y];return C?(f=C.nextPos,C.result):(T=f,n.charCodeAt(f)===92?(F="\\",f++):(F=a,j(ao)),F!==a?(n.length>f?(Y=n.charAt(f),f++):(Y=a,j(co)),Y!==a?T=F="\\"+Y:(f=T,T=a)):(f=T,T=a),z[y]={nextPos:f,result:T},T)}function zN(){var T,F,Y,y=36*f+25,C=z[y];if(C)return f=C.nextPos,C.result;if(F=[],jN.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(ZN)),Y!==a)for(;Y!==a;)F.push(Y),jN.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(ZN));else F=a;return F!==a&&(F=F.join("")),T=F,z[y]={nextPos:f,result:T},T}function ev(T){return{type:"nth-child",index:{type:"literal",value:T}}}function tv(T){return{type:"nth-last-child",index:{type:"literal",value:T}}}if((o=p())!==a&&f===n.length)return o;throw o!==a&&f<n.length&&j({type:"end"}),i=d_,s=Tr<n.length?n.charAt(Tr):null,c=Tr<n.length?qN(Tr,Tr+1):qN(Tr,Tr),new t(t.buildMessage(i,s),i,s,c)}}})())}));function Er(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var pN=typeof WeakMap=="function"?new WeakMap:null;function jt(e){if(e==null)return function(){return!0};if(pN!=null){var t=pN.get(e);return t!=null||(t=GF(e),pN.set(e,t)),t}return GF(e)}function GF(e){switch(e.type){case"wildcard":return function(){return!0};case"identifier":var t=e.value.toLowerCase();return function(I,B,k){var U=k&&k.nodeTypeKey||"type";return t===I[U].toLowerCase()};case"exactNode":return function(I,B){return B.length===0};case"field":var n=e.name.split(".");return function(I,B){return(function k(U,ce,ge,Ne){for(var Te=ce,Oe=Ne;Oe<ge.length;++Oe){if(Te==null)return!1;var qe=Te[ge[Oe]];if(Array.isArray(qe)){for(var Nt=0;Nt<qe.length;++Nt)if(k(U,qe[Nt],ge,Oe+1))return!0;return!1}Te=qe}return U===Te})(I,B[n.length-1],n,0)};case"matches":var r=e.selectors.map(jt);return function(I,B,k){for(var U=0;U<r.length;++U)if(r[U](I,B,k))return!0;return!1};case"compound":var o=e.selectors.map(jt);return function(I,B,k){for(var U=0;U<o.length;++U)if(!o[U](I,B,k))return!1;return!0};case"not":var i=e.selectors.map(jt);return function(I,B,k){for(var U=0;U<i.length;++U)if(i[U](I,B,k))return!1;return!0};case"has":var s=e.selectors.map(jt);return function(I,B,k){var U=!1,ce=[];return Qg.traverse(I,{enter:function(ge,Ne){Ne!=null&&ce.unshift(Ne);for(var Te=0;Te<s.length;++Te)if(s[Te](ge,ce,k))return U=!0,void this.break()},leave:function(){ce.shift()},keys:k&&k.visitorKeys,fallback:k&&k.fallback||"iteration"}),U};case"child":var c=jt(e.left),a=jt(e.right);return function(I,B,k){return!!(B.length>0&&a(I,B,k))&&c(B[0],B.slice(1),k)};case"descendant":var l=jt(e.left),p=jt(e.right);return function(I,B,k){if(p(I,B,k)){for(var U=0,ce=B.length;U<ce;++U)if(l(B[U],B.slice(U+1),k))return!0}return!1};case"attribute":var u=e.name.split(".");switch(e.operator){case void 0:return function(I){return Er(I,u)!=null};case"=":switch(e.value.type){case"regexp":return function(I){var B=Er(I,u);return typeof B=="string"&&e.value.value.test(B)};case"literal":var d="".concat(e.value.value);return function(I){return d==="".concat(Er(I,u))};case"type":return function(I){return e.value.value===Vp(Er(I,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"!=":switch(e.value.type){case"regexp":return function(I){return!e.value.value.test(Er(I,u))};case"literal":var m="".concat(e.value.value);return function(I){return m!=="".concat(Er(I,u))};case"type":return function(I){return e.value.value!==Vp(Er(I,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"<=":return function(I){return Er(I,u)<=e.value.value};case"<":return function(I){return Er(I,u)<e.value.value};case">":return function(I){return Er(I,u)>e.value.value};case">=":return function(I){return Er(I,u)>=e.value.value}}throw new Error("Unknown operator: ".concat(e.operator));case"sibling":var _=jt(e.left),h=jt(e.right);return function(I,B,k){return h(I,B,k)&&UF(I,_,B,"LEFT_SIDE",k)||e.left.subject&&_(I,B,k)&&UF(I,h,B,"RIGHT_SIDE",k)};case"adjacent":var b=jt(e.left),N=jt(e.right);return function(I,B,k){return N(I,B,k)&&DF(I,b,B,"LEFT_SIDE",k)||e.right.subject&&b(I,B,k)&&DF(I,N,B,"RIGHT_SIDE",k)};case"nth-child":var L=e.index.value,R=jt(e.right);return function(I,B,k){return R(I,B,k)&&BF(I,B,L,k)};case"nth-last-child":var v=-e.index.value,P=jt(e.right);return function(I,B,k){return P(I,B,k)&&BF(I,B,v,k)};case"class":var G=e.name.toLowerCase();return function(I,B,k){if(k&&k.matchClass)return k.matchClass(e.name,I,B);if(k&&k.nodeTypeKey)return!1;switch(G){case"statement":if(I.type.slice(-9)==="Statement")return!0;case"declaration":return I.type.slice(-11)==="Declaration";case"pattern":if(I.type.slice(-7)==="Pattern")return!0;case"expression":return I.type.slice(-10)==="Expression"||I.type.slice(-7)==="Literal"||I.type==="Identifier"&&(B.length===0||B[0].type!=="MetaProperty")||I.type==="MetaProperty";case"function":return I.type==="FunctionDeclaration"||I.type==="FunctionExpression"||I.type==="ArrowFunctionExpression"}throw new Error("Unknown class name: ".concat(e.name))}}throw new Error("Unknown selector type: ".concat(e.type))}function fN(e,t){var n=t&&t.nodeTypeKey||"type",r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:Qg.VisitorKeys[r]?Qg.VisitorKeys[r]:t&&typeof t.fallback=="function"?t.fallback(e):Object.keys(e).filter((function(o){return o!==n}))}function dN(e,t){var n=t&&t.nodeTypeKey||"type";return e!==null&&Vp(e)==="object"&&typeof e[n]=="string"}function UF(e,t,n,r,o){var i=mN(n,1)[0];if(!i)return!1;for(var s=fN(i,o),c=0;c<s.length;++c){var a=i[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;var p=void 0,u=void 0;r==="LEFT_SIDE"?(p=0,u=l):(p=l+1,u=a.length);for(var d=p;d<u;++d)if(dN(a[d],o)&&t(a[d],n,o))return!0}}return!1}function DF(e,t,n,r,o){var i=mN(n,1)[0];if(!i)return!1;for(var s=fN(i,o),c=0;c<s.length;++c){var a=i[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;if(r==="LEFT_SIDE"&&l>0&&dN(a[l-1],o)&&t(a[l-1],n,o)||r==="RIGHT_SIDE"&&l<a.length-1&&dN(a[l+1],o)&&t(a[l+1],n,o))return!0}}return!1}function BF(e,t,n,r){if(n===0)return!1;var o=mN(t,1)[0];if(!o)return!1;for(var i=fN(o,r),s=0;s<i.length;++s){var c=o[i[s]];if(Array.isArray(c)){var a=n<0?c.length+n:n-1;if(a>=0&&a<c.length&&c[a]===e)return!0}}return!1}function WF(e,t,n,r){if(t){var o=[],i=jt(t),s=(function c(a,l){if(a==null||Vp(a)!="object")return[];l==null&&(l=a);for(var p=a.subject?[l]:[],u=Object.keys(a),d=0;d<u.length;++d){var m=u[d],_=a[m];p.push.apply(p,hte(c(_,m==="left"?_:l)))}return p})(t).map(jt);Qg.traverse(e,{enter:function(c,a){if(a!=null&&o.unshift(a),i(c,o,r))if(s.length)for(var l=0,p=s.length;l<p;++l){s[l](c,o,r)&&n(c,a,o);for(var u=0,d=o.length;u<d;++u){var m=o.slice(u+1);s[l](o[u],m,r)&&n(o[u],a,m)}}else n(c,a,o)},leave:function(){o.shift()},keys:r&&r.visitorKeys,fallback:r&&r.fallback||"iteration"})}}function VF(e,t,n){var r=[];return WF(e,t,(function(o){r.push(o)}),n),r}function YF(e){return bte.parse(e)}function io(e,t,n){return VF(e,YF(t),n)}io.parse=YF,io.match=VF,io.traverse=WF,io.matches=function(e,t,n,r){return!t||!!e&&(n||(n=[]),jt(t)(e,n,r))},io.query=io;var Jg={};var jF={};var gN={exports:{}};var _N=io,{parse:fn}=Jg,ZF=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name==="tr_ch_apm_tracingChannel",yte=/[^\w]/g,Cs=e=>`tr_ch_apm$${e.replace(yte,"_")}`,hN=gN.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(ZF))return;let r={module:t==="esm"},o=n.body.findIndex(a=>a.directive==="use strict"),i=t==="esm"?`import tr_ch_apm_dc from "${e}"`:`const tr_ch_apm_dc = require("${e}")`;n.body.splice(o+1,0,fn(i,r).body[0],fn("const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc",r).body[0],fn(`const tr_ch_apm_hasSubscribers = ch => ch.start.hasSubscribers
|
|
42
|
+
|| ch.end.hasSubscribers
|
|
43
|
+
|| ch.asyncStart.hasSubscribers
|
|
44
|
+
|| ch.asyncEnd.hasSubscribers
|
|
45
|
+
|| ch.error.hasSubscribers`,r).body[0])},tracingChannelDeclaration(e,t){let{channelName:n,module:{name:r}}=e,o=Cs(n);if(t.body.some(c=>c.declarations?.[0]?.id?.name===o))return;hN.tracingChannelImport(e,t);let i=t.body.findIndex(ZF),s=`
|
|
46
|
+
const ${o} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
|
|
47
|
+
`;t.body.splice(i+1,0,fn(s).body[0])},traceCallback:$g,tracePromise:$g,traceSync:$g,traceAuto:$g};function Ste(e){return[...(e||[]).filter(r=>r.type!=="RestElement"&&r.type!=="AssignmentPattern").map((r,o)=>({type:"Identifier",name:`__apm$arg${o}`})),{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}]}function $g(e,t,n,r){let o=r[r.length-1];t.type==="ClassDeclaration"||t.type==="ClassExpression"?Tte(e,t,o):Ete(e,t,o)}function Ete(e,t,n){hN.tracingChannelDeclaration(e,n);let{functionQuery:{methodName:r,privateMethodName:o,functionName:i,expressionName:s,propertyName:c}}=e,l=r==="constructor"||!r&&!o&&!i&&!s&&!c?"ArrowFunctionExpression":t.type,p=t.params;t.body=XF(e,{type:l,params:p,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=Ste(p),t.generator=!1,t.async=!1,KF(e,t)}function Tte(e,t,n){let{functionQuery:r,operator:o}=e,{methodName:i}=r;if(!i)return;let s=t.body;if(s.body.some(({key:p})=>p.name===i))return;let c=s.body.find(({kind:p})=>p==="constructor");hN.tracingChannelDeclaration(e,n),c||(c=fn(t.superClass?"class A extends Object { constructor (...args) { super(...args) } }":"class A { constructor () {} }").body[0].body.body[0],s.body.unshift(c));let a=fn(`
|
|
48
|
+
const __apm$${i} = this["${i}"]
|
|
49
|
+
this["${i}"] = function () {}
|
|
50
|
+
if (typeof __apm$${i} === 'function') {
|
|
51
|
+
Object.defineProperty(this["${i}"], 'length', {
|
|
52
|
+
value: __apm$${i}.length,
|
|
53
|
+
configurable: true
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
`).body,l=a[1].expression.right;l.params=[{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}],l.async=o==="tracePromise",l.body=XF(e,{type:"Identifier",name:`__apm$${i}`},n),KF(e,l),c.value.body.body.push(...a)}function XF(e,t,n){let{operator:r,moduleVersion:o}=e,{returnKind:i}=e.functionQuery,s=i?vte(e,i,n):"",c;r==="traceCallback"&&(c=qF(e,t,s)),r==="tracePromise"&&(c=QF(e,t,s)),r==="traceSync"&&(c=Ate(e,t,s)),r==="traceAuto"&&(c=Ite(e,t,s));let a=(t.params||[]).filter(u=>u.type!=="RestElement"&&u.type!=="AssignmentPattern").map((u,d)=>`__apm$arg${d}`).concat("...__apm$args").join(", "),l=c.body[0].body,p=fn(t.type==="ArrowFunctionExpression"?`
|
|
57
|
+
const __apm$arguments = [${a}];
|
|
58
|
+
const __apm$ctx = {
|
|
59
|
+
arguments: __apm$arguments,
|
|
60
|
+
moduleVersion: ${JSON.stringify(o)}
|
|
61
|
+
};
|
|
62
|
+
const __apm$traced = () => {
|
|
63
|
+
const __apm$wrapped = () => {};
|
|
64
|
+
return __apm$wrapped(...__apm$arguments);
|
|
65
|
+
};
|
|
66
|
+
`:`
|
|
67
|
+
const __apm$arguments = [${a}].slice(0, arguments.length);
|
|
68
|
+
const __apm$ctx = {
|
|
69
|
+
arguments: __apm$arguments,
|
|
70
|
+
self: this,
|
|
71
|
+
moduleVersion: ${JSON.stringify(o)}
|
|
72
|
+
};
|
|
73
|
+
const __apm$traced = () => {
|
|
74
|
+
const __apm$wrapped = () => {};
|
|
75
|
+
return __apm$wrapped.apply(this, __apm$arguments);
|
|
76
|
+
};
|
|
77
|
+
`).body;return l.body.unshift(...p),_N.query(l,"[id.name=__apm$wrapped]")[0].init=t,l}function KF(e,t){let n=new Set;_N.traverse(t.body,_N.parse("[object.type=Super]"),(r,o)=>{let{name:i}=r.property,s;if(o.callee){let{expression:c}=fn(`__apm$super['${i}'].call(this)`).body[0];o.callee=s=c.callee,o.arguments.unshift(...c.arguments)}else o.expression=s=fn(`__apm$super['${i}']`).body[0];s.computed=o.callee.computed,s.optional=o.callee.optional,n.add(i)});for(let r of n){let o=fn(`
|
|
78
|
+
class Wrapper {
|
|
79
|
+
wrapper () {
|
|
80
|
+
__apm$super['${r}'] = super['${r}']
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`).body[0].body.body[0].value.body.body[0];t.body.body.unshift(o)}n.size>0&&t.body.body.unshift(fn("const __apm$super = {}").body[0])}function Ite(e,t,n=""){let r=qF(e,t,n),o=QF(e,t,n),[i,s,c,a,l,p]=r.body[0].body.body,u={type:"IfStatement",test:a.test,consequent:{type:"BlockStatement",body:o.body[0].body.body},alternate:null};return r.body[0].body.body=[i,u,s,c,l,p],r}function qF(e,t,n=""){let{channelName:r,functionQuery:{callbackIndex:o=-1}}=e,i=Cs(r);return fn(`
|
|
84
|
+
function wrapper () {
|
|
85
|
+
const __apm$cb = Array.prototype.at.call(__apm$arguments, ${o});
|
|
86
|
+
|
|
87
|
+
if (!${i}.start.hasSubscribers) return __apm$traced();
|
|
88
|
+
|
|
89
|
+
function __apm$wrappedCb(err, res) {
|
|
90
|
+
if (err) {
|
|
91
|
+
__apm$ctx.error = err;
|
|
92
|
+
${i}.error.publish(__apm$ctx);
|
|
93
|
+
} else {
|
|
94
|
+
__apm$ctx.result = res;
|
|
95
|
+
${n}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
${i}.asyncStart.runStores(__apm$ctx, () => {
|
|
99
|
+
try {
|
|
100
|
+
if (__apm$cb) {
|
|
101
|
+
return __apm$cb.apply(this, arguments);
|
|
102
|
+
}
|
|
103
|
+
} finally {
|
|
104
|
+
${i}.asyncEnd.publish(__apm$ctx);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (typeof __apm$cb !== 'function') {
|
|
110
|
+
return __apm$traced();
|
|
111
|
+
}
|
|
112
|
+
Array.prototype.splice.call(__apm$arguments, ${o}, 1, __apm$wrappedCb);
|
|
113
|
+
|
|
114
|
+
return ${i}.start.runStores(__apm$ctx, () => {
|
|
115
|
+
try {
|
|
116
|
+
return __apm$traced();
|
|
117
|
+
} catch (err) {
|
|
118
|
+
__apm$ctx.error = err;
|
|
119
|
+
${i}.error.publish(__apm$ctx);
|
|
120
|
+
throw err;
|
|
121
|
+
} finally {
|
|
122
|
+
__apm$ctx.self ??= this;
|
|
123
|
+
${i}.end.publish(__apm$ctx);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
`)}function QF(e,t,n=""){let{channelName:r}=e,o=Cs(r);return fn(`
|
|
128
|
+
function wrapper () {
|
|
129
|
+
if (!tr_ch_apm_hasSubscribers(${o})) return __apm$traced();
|
|
130
|
+
|
|
131
|
+
return ${o}.start.runStores(__apm$ctx, () => {
|
|
132
|
+
try {
|
|
133
|
+
let promise = __apm$traced();
|
|
134
|
+
if (typeof promise?.then !== 'function') {
|
|
135
|
+
__apm$ctx.result = promise;
|
|
136
|
+
${n}
|
|
137
|
+
return __apm$ctx.result;
|
|
138
|
+
}
|
|
139
|
+
// Mirror Node.js core diagnostics_channel behaviour: for native Promise
|
|
140
|
+
// instances, chain normally (safe since there is no subclass API to
|
|
141
|
+
// preserve). For Promise subclasses and other thenables, side-chain the
|
|
142
|
+
// callbacks for event publishing and return the original so that any
|
|
143
|
+
// subclass-specific methods (e.g. APIPromise.withResponse()) remain
|
|
144
|
+
// accessible to the caller.
|
|
145
|
+
if (promise instanceof Promise && promise.constructor === Promise) {
|
|
146
|
+
return promise.then(
|
|
147
|
+
result => {
|
|
148
|
+
__apm$ctx.result = result;
|
|
149
|
+
${n}
|
|
150
|
+
${o}.asyncStart.publish(__apm$ctx);
|
|
151
|
+
${o}.asyncEnd.publish(__apm$ctx);
|
|
152
|
+
return __apm$ctx.result;
|
|
153
|
+
},
|
|
154
|
+
err => {
|
|
155
|
+
__apm$ctx.error = err;
|
|
156
|
+
${o}.error.publish(__apm$ctx);
|
|
157
|
+
${o}.asyncStart.publish(__apm$ctx);
|
|
158
|
+
${o}.asyncEnd.publish(__apm$ctx);
|
|
159
|
+
throw err;
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
promise.then(
|
|
164
|
+
result => {
|
|
165
|
+
__apm$ctx.result = result;
|
|
166
|
+
${n}
|
|
167
|
+
${o}.asyncStart.publish(__apm$ctx);
|
|
168
|
+
${o}.asyncEnd.publish(__apm$ctx);
|
|
169
|
+
},
|
|
170
|
+
err => {
|
|
171
|
+
__apm$ctx.error = err;
|
|
172
|
+
${o}.error.publish(__apm$ctx);
|
|
173
|
+
${o}.asyncStart.publish(__apm$ctx);
|
|
174
|
+
${o}.asyncEnd.publish(__apm$ctx);
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
return promise;
|
|
178
|
+
} catch (err) {
|
|
179
|
+
__apm$ctx.error = err;
|
|
180
|
+
${o}.error.publish(__apm$ctx);
|
|
181
|
+
throw err;
|
|
182
|
+
} finally {
|
|
183
|
+
__apm$ctx.self ??= this;
|
|
184
|
+
${o}.end.publish(__apm$ctx);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
`)}function Ate(e,t,n=""){let{channelName:r}=e,o=Cs(r);return fn(`
|
|
189
|
+
function wrapper () {
|
|
190
|
+
if (!tr_ch_apm_hasSubscribers(${o})) return __apm$traced();
|
|
191
|
+
|
|
192
|
+
return ${o}.start.runStores(__apm$ctx, () => {
|
|
193
|
+
try {
|
|
194
|
+
__apm$ctx.result = __apm$traced();
|
|
195
|
+
${n}
|
|
196
|
+
} catch (err) {
|
|
197
|
+
__apm$ctx.error = err;
|
|
198
|
+
${o}.error.publish(__apm$ctx);
|
|
199
|
+
throw err;
|
|
200
|
+
} finally {
|
|
201
|
+
__apm$ctx.self ??= this;
|
|
202
|
+
${o}.end.publish(__apm$ctx);
|
|
203
|
+
}
|
|
204
|
+
return __apm$ctx.result;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
`)}function Nte(e,t){let{channelName:n,module:{name:r}}=e,o=Cs(n+":next");if(t.body.some(a=>a.declarations?.[0]?.id?.name===o))return;let i=Cs(n),s=t.body.findIndex(a=>a.declarations?.[0]?.id?.name===i),c=`const ${o} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}:next")`;t.body.splice(s+1,0,fn(c).body[0])}function vte(e,t,n){let{channelName:r}=e,o=t==="Iterator"?"traceSync":"tracePromise",i=Cs(r+":next");return Nte(e,n),`
|
|
208
|
+
const __apm$iter = __apm$ctx.result;
|
|
209
|
+
if (__apm$iter != null && typeof __apm$iter.next === 'function') {
|
|
210
|
+
const __apm$patchIter = function (method) {
|
|
211
|
+
const __apm$orig = __apm$iter[method];
|
|
212
|
+
if (typeof __apm$orig !== 'function') return;
|
|
213
|
+
__apm$iter[method] = function () {
|
|
214
|
+
const __apm$iterArgs = Array.prototype.slice.call(arguments);
|
|
215
|
+
if (!tr_ch_apm_hasSubscribers(${i})) return __apm$orig.apply(this, __apm$iterArgs);
|
|
216
|
+
__apm$ctx.method = method;
|
|
217
|
+
__apm$ctx.arguments = __apm$iterArgs;
|
|
218
|
+
return ${i}.${o}(__apm$orig, __apm$ctx, this, ...__apm$iterArgs);
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
__apm$patchIter('next');
|
|
222
|
+
__apm$patchIter('throw');
|
|
223
|
+
__apm$patchIter('return');
|
|
224
|
+
}
|
|
225
|
+
`}var JF=gN.exports;var bN={};var e2=e=>{throw TypeError(e)},TN=(e,t,n)=>t.has(e)||e2("Cannot "+n),so=(e,t,n)=>(TN(e,t,"read from private field"),n?n.call(e):t.get(e)),Os=(e,t,n)=>t.has(e)?e2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ic=(e,t,n,r)=>(TN(e,t,"write to private field"),t.set(e,n),n),Ac=(e,t,n)=>(TN(e,t,"access private method"),n),Yp,e_,jp,Nc,t_,n_,vi,t2,n2,r2,SN,o2,$F=io,{parse:zF}=Jg,{generate:Rte}=jF,Cte=JF,yN,zg,EN=class{constructor(t,n,r,o,i,s={}){Os(this,vi),Os(this,Yp,null),Os(this,e_,null),Os(this,jp,null),Os(this,Nc,[]),Os(this,t_,null),Os(this,n_,{}),Ic(this,Yp,t),Ic(this,e_,n),Ic(this,jp,r),Ic(this,Nc,o),Ic(this,t_,i),Ic(this,n_,s)}free(){}get moduleName(){return so(this,Yp)}get filePath(){return so(this,jp)}transform(t,n,r){if(Buffer.isBuffer(t)&&(t=t.toString()),!t)return{code:t};let o,i={},s=0;for(let c of so(this,Nc)){let{astQuery:a,functionQuery:l={}}=c;if(!o){let m={loc:!0,ranges:!0,raw:!0,module:n==="esm"};try{o=zF(t,m)}catch{o=zF(t,{...m,module:!m.module})}n==="esm"&&(i=Ac(this,vi,r2).call(this,o))}let p=Ac(this,vi,SN).call(this,l,i),u=a||Ac(this,vi,o2).call(this,p),d={...c,dcModule:so(this,t_),moduleType:n,moduleVersion:so(this,e_),functionQuery:p};d.operator=Ac(this,vi,n2).call(this,d),$F.traverse(o,$F.parse(u),(...m)=>{s++,Ac(this,vi,t2).call(this,d,...m)})}if(s===0&&so(this,Nc).length>0){let c=so(this,Nc).map(({astQuery:a,functionQuery:l={}})=>{if(a)return a;let p=Ac(this,vi,SN).call(this,l,i),d=(h=>h.methodName||h.privateMethodName||h.functionName||h.expressionName||"constructor")(l),m=l.className||l.functionName||l.expressionName,_=p.className||p.functionName||p.expressionName;return m&&m!==_?`${m} (local name: ${_})`:d});throw new Error(`Failed to find injection points for: ${JSON.stringify(c)}`)}if(o){yN??(yN=bN.SourceMapConsumer),zg??(zg=bN.SourceMapGenerator);let c=`${so(this,Yp)}/${so(this,jp)}`,a;if(r){let u=new yN(r);u.file=c,a=zg.fromSourceMap(u)}else a=new zg({file:c});let l=Rte(o,{sourceMap:a}),p=a.toString();return{code:l,map:p}}return{code:t}}};Yp=new WeakMap;e_=new WeakMap;jp=new WeakMap;Nc=new WeakMap;t_=new WeakMap;n_=new WeakMap;vi=new WeakSet;t2=function(e,...t){let n=so(this,n_)[e.operator]??Cte[e.operator],{index:r=0}=e.functionQuery,[o]=t,i=o.init?.type||o.type;i!=="ClassDeclaration"&&i!=="ClassExpression"&&(o.type==="VariableDeclarator"||(e.functionIndex=++e.functionIndex||0,r!==null&&r!==e.functionIndex))||n(e,...t)};n2=function({transform:e,functionQuery:{kind:t}}){if(e)return e;switch(t){case"Async":return"tracePromise";case"Auto":return"traceAuto";case"Callback":return"traceCallback";case"Sync":return"traceSync";default:return"traceSync"}};r2=function(e){let t={};for(let n of e.body)if(n.type==="ExportNamedDeclaration"&&!n.source){for(let r of n.specifiers)if(r.exported&&r.local){let o=r.exported.name??r.exported.value,i=r.local.name??r.local.value;o&&i&&(t[o]=i)}}return t};SN=function(e,t){if(!e.isExportAlias)return e;let{functionName:n,expressionName:r,className:o}=e;return n&&t[n]?{...e,functionName:t[n]}:r&&t[r]?{...e,expressionName:t[r]}:o&&t[o]?{...e,className:t[o]}:e};o2=function(e){let{functionName:t,expressionName:n,className:r,objectName:o,propertyName:i}=e,s=e.privateMethodName?"PrivateIdentifier":"Identifier",c=[],a=e.methodName||e.privateMethodName;if(r?(a??(a="constructor"),c.push(`[id.name="${r}"]`,`[id.name="${r}"] > ClassExpression`,`[id.name="${r}"] > ClassBody > [key.name="${a}"][key.type=${s}] > [async]`,`[id.name="${r}"] > ClassExpression > ClassBody > [key.name="${a}"][key.type=${s}] > [async]`)):a&&c.push(`ClassBody > [key.name="${a}"][key.type=${s}] > [async]`,`Property[key.name="${a}"][key.type=${s}] > [async]`),t?c.push(`FunctionDeclaration[id.name="${t}"][async]`):n&&c.push(`FunctionExpression[id.name="${n}"][async]`,`ArrowFunctionExpression[id.name="${n}"][async]`,`VariableDeclarator[id.name="${n}"] > FunctionExpression[async]`,`VariableDeclarator[id.name="${n}"] > ArrowFunctionExpression[async]`,`AssignmentExpression[left.property.name="${n}"] > FunctionExpression[async]`,`AssignmentExpression[left.property.name="${n}"] > ArrowFunctionExpression[async]`,`AssignmentExpression[left.name="${n}"] > FunctionExpression[async]`,`AssignmentExpression[left.name="${n}"] > ArrowFunctionExpression[async]`),o||i){if(!o||!i)throw new Error(`functionQuery: 'objectName' and 'propertyName' must be used together (got objectName=${o}, propertyName=${i})`);let l=o==="this"?"left.object.type=ThisExpression":`left.object.name="${o}"`;c.push(`AssignmentExpression[${l}][left.property.name="${i}"] > [async]`)}return c.join(", ")};var i2={Transformer:EN};var s2=e=>{throw TypeError(e)},a2=(e,t,n)=>t.has(e)||s2("Cannot "+n),Ri=(e,t,n)=>(a2(e,t,"read from private field"),n?n.call(e):t.get(e)),r_=(e,t,n)=>t.has(e)?s2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),IN=(e,t,n,r)=>(a2(e,t,"write to private field"),t.set(e,n),n),o_,i_,xs,s_,Ote=MF,{Transformer:xte}=i2,AN=class{constructor(t,n){r_(this,o_,[]),r_(this,i_,null),r_(this,xs,{}),r_(this,s_,{}),IN(this,o_,t),IN(this,i_,n||"diagnostics_channel")}free(){IN(this,xs,{})}addTransform(t,n){Ri(this,s_)[t]=n}getTransformer(t,n,r){r=r.replace(/\\/g,"/");let o=`${t}/${r}@${n}`;if(Ri(this,xs)[o])return Ri(this,xs)[o];let i=Ri(this,o_).filter(({module:s})=>s.name===t&&(typeof s.filePath=="string"?s.filePath===r:s.filePath.test(r))&&Ote(n,s.versionRange));if(i.length!==0)return Ri(this,xs)[o]=new xte(t,n,r,i,Ri(this,i_),Ri(this,s_)),Ri(this,xs)[o]}};o_=new WeakMap;i_=new WeakMap;xs=new WeakMap;s_=new WeakMap;var c2={InstrumentationMatcher:AN};var{InstrumentationMatcher:Pte}=c2;function kte(e,t){return new Pte(e,t)}var l2={create:kte};var a_=l2;import zte from"module";import Lte from"path";var NN=Lte.sep,vN=function(e){var t=e.split(NN),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",o=r?t[n+1]+"/"+t[n+2]:t[n+1],i=r?3:2,s="",c=n+i-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+NN;for(var l="",p=t.length-1,u=n+i;u<=p;u++)u===p?l+=t[u]:l+=t[u]+NN;return{name:o,basedir:s,path:l}}},p2=Ai(vN);import ene from"url";import Mte from"fs";import wte from"path";var{readFileSync:Gte}=Mte,{join:Ute}=wte,RN=new Map;function Dte(e){if(RN.has(e))return RN.get(e);try{let t=Ute(e,"package.json"),n=Gte(t),{version:r}=JSON.parse(n);return RN.set(e,r),r}catch{return process.version.slice(1)}}var CN=Dte,u2=Ai(CN);var ON;function Bte(e){ON=e}function Hte(e){ON&&ON(e)}var Do={setDiagnosticsHook:Bte,emitDiagnostics:Hte};var c_={exports:{}};import Jte from"tty";import $te from"util";import Fte from"os";import Wte from"tty";var d2=(e,t=process.argv)=>{let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)};var Vte=Fte,m2=Wte,Jn=d2,{env:kt}=process,Ci;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?Ci=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(Ci=1);"FORCE_COLOR"in kt&&(kt.FORCE_COLOR==="true"?Ci=1:kt.FORCE_COLOR==="false"?Ci=0:Ci=kt.FORCE_COLOR.length===0?1:Math.min(parseInt(kt.FORCE_COLOR,10),3));function xN(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function PN(e,t){if(Ci===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(e&&!t&&Ci===void 0)return 0;let n=Ci||0;if(kt.TERM==="dumb")return n;if(process.platform==="win32"){let r=Vte.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in kt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in kt)||kt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in kt){let r=parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:n}function Yte(e){let t=PN(e,e&&e.isTTY);return xN(t)}var f2={supportsColor:Yte,stdout:xN(PN(!0,m2.isatty(1))),stderr:xN(PN(!0,m2.isatty(2)))};var vc=1e3,Rc=vc*60,Cc=Rc*60,Ps=Cc*24,jte=Ps*7,Zte=Ps*365.25,g2=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return Xte(e);if(n==="number"&&isFinite(e))return t.long?qte(e):Kte(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Xte(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*Zte;case"weeks":case"week":case"w":return n*jte;case"days":case"day":case"d":return n*Ps;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Cc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Rc;case"seconds":case"second":case"secs":case"sec":case"s":return n*vc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Kte(e){var t=Math.abs(e);return t>=Ps?Math.round(e/Ps)+"d":t>=Cc?Math.round(e/Cc)+"h":t>=Rc?Math.round(e/Rc)+"m":t>=vc?Math.round(e/vc)+"s":e+"ms"}function qte(e){var t=Math.abs(e);return t>=Ps?l_(e,t,Ps,"day"):t>=Cc?l_(e,t,Cc,"hour"):t>=Rc?l_(e,t,Rc,"minute"):t>=vc?l_(e,t,vc,"second"):e+" ms"}function l_(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}function Qte(e){n.debug=n,n.default=n,n.coerce=a,n.disable=s,n.enable=o,n.enabled=c,n.humanize=g2,n.destroy=l,Object.keys(e).forEach(p=>{n[p]=e[p]}),n.names=[],n.skips=[],n.formatters={};function t(p){let u=0;for(let d=0;d<p.length;d++)u=(u<<5)-u+p.charCodeAt(d),u|=0;return n.colors[Math.abs(u)%n.colors.length]}n.selectColor=t;function n(p){let u,d=null,m,_;function h(...b){if(!h.enabled)return;let N=h,L=Number(new Date),R=L-(u||L);N.diff=R,N.prev=u,N.curr=L,u=L,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let v=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(G,I)=>{if(G==="%%")return"%";v++;let B=n.formatters[I];if(typeof B=="function"){let k=b[v];G=B.call(N,k),b.splice(v,1),v--}return G}),n.formatArgs.call(N,b),(N.log||n.log).apply(N,b)}return h.namespace=p,h.useColors=n.useColors(),h.color=n.selectColor(p),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==n.namespaces&&(m=n.namespaces,_=n.enabled(p)),_),set:b=>{d=b}}),typeof n.init=="function"&&n.init(h),h}function r(p,u){let d=n(this.namespace+(typeof u>"u"?":":u)+p);return d.log=this.log,d}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let u=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of u)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function i(p,u){let d=0,m=0,_=-1,h=0;for(;d<p.length;)if(m<u.length&&(u[m]===p[d]||u[m]==="*"))u[m]==="*"?(_=m,h=d,m++):(d++,m++);else if(_!==-1)m=_+1,h++,d=h;else return!1;for(;m<u.length&&u[m]==="*";)m++;return m===u.length}function s(){let p=[...n.names,...n.skips.map(u=>"-"+u)].join(",");return n.enable(""),p}function c(p){for(let u of n.skips)if(i(p,u))return!1;for(let u of n.names)if(i(p,u))return!0;return!1}function a(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var _2=Qte;(function(e,t){let n=Jte,r=$te;t.init=p,t.log=c,t.formatArgs=i,t.save=a,t.load=l,t.useColors=o,t.destroy=r.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let d=f2;d&&(d.stderr||d).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(d=>/^debug_/i.test(d)).reduce((d,m)=>{let _=m.substring(6).toLowerCase().replace(/_([a-z])/g,(b,N)=>N.toUpperCase()),h=process.env[m];return/^(yes|on|true|enabled)$/i.test(h)?h=!0:/^(no|off|false|disabled)$/i.test(h)?h=!1:h==="null"?h=null:h=Number(h),d[_]=h,d},{});function o(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function i(d){let{namespace:m,useColors:_}=this;if(_){let h=this.color,b="\x1B[3"+(h<8?h:"8;5;"+h),N=` ${b};1m${m} \x1B[0m`;d[0]=N+d[0].split(`
|
|
226
|
+
`).join(`
|
|
227
|
+
`+N),d.push(b+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else d[0]=s()+m+" "+d[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function c(...d){return process.stderr.write(r.formatWithOptions(t.inspectOpts,...d)+`
|
|
228
|
+
`)}function a(d){d?process.env.DEBUG=d:delete process.env.DEBUG}function l(){return process.env.DEBUG}function p(d){d.inspectOpts={};let m=Object.keys(t.inspectOpts);for(let _=0;_<m.length;_++)d.inspectOpts[m[_]]=t.inspectOpts[m[_]]}e.exports=_2(t);let{formatters:u}=e.exports;u.o=function(d){return this.inspectOpts.colors=this.useColors,r.inspect(d,this.inspectOpts).split(`
|
|
229
|
+
`).map(m=>m.trim()).join(" ")},u.O=function(d){return this.inspectOpts.colors=this.useColors,r.inspect(d,this.inspectOpts)}})(c_,c_.exports);var kN=c_.exports,h2=Ai(kN);import tne from"os";import nne from"path";import rne from"fs";var{create:one}=a_,LN=zte,ine=vN,{pathToFileURL:b2}=ene,sne=CN,{emitDiagnostics:y2}=Do,p_=kN("@apm-js-collab/tracing-hooks:module-patch"),MN=class{constructor({instrumentations:t=[]}={}){this.packages=new Set(t.map(n=>n.module.name)),this.instrumentator=one(t),this.compile=LN.prototype._compile}patch(){let t=this;LN.prototype._compile=function(...r){let[o,i]=r,s=ine(i);if(s&&t.packages.has(s.name)){p_("found resolved module, checking if there is a transformer %s",i);let c=sne(s.basedir,s.name),a=t.instrumentator.getTransformer(s.name,c,s.path);if(a){p_("transforming file %s",i);try{let l=a.transform(o,"cjs");r[0]=l?.code,y2({url:b2(i).href,moduleName:a.moduleName}),process.env.TRACING_DUMP&&ane(r[0],i)}catch(l){p_("Error transforming module %s: %o",i,l),y2({url:b2(i).href,moduleName:a.moduleName,error:l})}finally{a.free()}}}return t.compile.apply(this,r)}}unpatch(){LN.prototype._compile=this.compile}};function ane(e,t){let n=tne,r=nne,o=rne,i=process.env.TRACING_DUMP_DIR??n.tmpdir(),s=r.dirname(t),c=r.basename(t),a=r.join(i,s),l=r.join(a,c);p_("Dumping patched code to: %s",l),o.mkdirSync(a,{recursive:!0}),o.writeFileSync(l,e)}var cne=MN,S2=Ai(cne);import{fileURLToPath as lne}from"url";import{MessageChannel as pne}from"worker_threads";import{readFileSync as une}from"fs";var E2=h2("@apm-js-collab/tracing-hooks:esm-hook"),u_=null,T2=null,I2=null,wN=Do.emitDiagnostics;function A2(){let{port1:e,port2:t}=new pne;return e.on("message",Do.emitDiagnostics),e.unref(),t}function N2(e={}){let t=e?.instrumentations||[];I2=a_.create(t),T2=new Set(t.map(n=>n.module.name)),u_=new Map,wN=e?.diagnosticsPort?dne(e.diagnosticsPort):Do.emitDiagnostics}function dne(e){return t=>{try{let n=t.error===void 0||t.error instanceof Error?t.error:new Error(String(t.error));e.postMessage({...t,error:n})}catch(n){E2("failed to post diagnostics for %s: %o",t.url,n)}}}function mne(e){let t=p2(e.url);if(t&&T2.has(t.name)){let n=lne(t.basedir),r=u2(n),o=I2.getTransformer(t.name,r,t.path);o&&u_.set(e.url,o)}return e}function v2(e,t,n){return mne(n(e,t))}function R2(e,t,n){let r=n(e,t);if(u_.has(e)===!1)return r;if(r.format==="commonjs"){let o=new URL(r.responseURL??e);r.source??=une(o)}return fne(e,r)}function fne(e,t){let n=t.source;if(n){let r=u_.get(e);try{let o=t.format==="module"?"esm":t.format==="commonjs"?"cjs":"unknown",i=typeof n=="string"?n:Buffer.from(n).toString("utf8"),s=r.transform(i,o);t.source=s?.code,t.shortCircuit=!0,wN({url:e,moduleName:r.moduleName})}catch(o){E2("Error transforming module %s: %o",e,o),wN({url:e,moduleName:r.moduleName,error:o})}finally{r.free()}}return t}var gVe=Do.setDiagnosticsHook;function bne(e){if(e){let{major:r=0,minor:o=0}=Bs(e);return r>2||r===2&&o>=8}let{major:t=0,minor:n=0}=Bs(process.versions.node??"0.0.0");return t>25||t===25&&n>=1||t===24&&n>=13}function C2(e){if(!_ne&&!hne||te?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=bne(t.Deno?.version?.deno),r=gne;Do.setDiagnosticsHook(({moduleName:o,error:i})=>{i?g.warn(`[orchestrion] failed to inject diagnostics-channel into ${o}:`,i):(te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[],te.__SENTRY_ORCHESTRION__.runtime.push(o))});try{if(typeof r.registerHooks=="function"&&n)N2({instrumentations:Wp}),r.registerHooks({resolve:v2,load:R2}),g.log("Registered diagnostics-channel injection via Module.registerHooks()");else if(typeof r.register=="function"&&!t.Bun&&!t.Deno){let o=A2(),i;i=import.meta.url,r.register("@sentry/server-utils/orchestrion/hook",{parentURL:i,data:{instrumentations:Wp,diagnosticsPort:o},transferList:[o]}),new S2({instrumentations:Wp}).patch(),g.log("Registered diagnostics-channel injection via Module.register()")}else{g.warn("No available Node API to register diagnostics-channel injection hooks; skipping.");return}}catch(o){g.warn("Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.",o);return}te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[]}function yne(){return NA}function Sne(e){Cw(()=>{let t=Object.values(NA).map(r=>r()),n=t.map(r=>r.name);return{integrations:[...t,XI({responseHook:Es}),AA({responseHook:Es})],replacedOtelIntegrationNames:n,register:()=>C2(),detect:SA}})}export{nn as NODE_VERSION,$a as NodeClient,oN as OpenFeatureIntegrationHook,q as SDK_VERSION,H as SEMANTIC_ATTRIBUTE_SENTRY_OP,S as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Wn as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,ve as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,Kt as Scope,ep as SentryContextManager,iE as _INTERNAL_normalizeCollectionInterval,an as addBreadcrumb,$h as addEventProcessor,ob as addIntegration,jA as amqplibIntegration,d1 as anrIntegration,JA as anthropicAIIntegration,ate as applyDiagnosticsChannelInjectionIntegrations,bn as bindScopeToEmitter,Fee as buildLaunchDarklyFlagUsedHandler,tl as captureCheckIn,Cb as captureConsoleIntegration,zc as captureEvent,me as captureException,Vb as captureFeedback,$c as captureMessage,zh as captureSession,Em as childProcessIntegration,Qh as close,XT as connectIntegration,Lm as consoleIntegration,Yb as consoleLoggingIntegration,Im as contextLinesIntegration,vn as continueTrace,Zb as createConsolaReporter,Dm as createGetModuleFromFilename,gr as createLangChainCallbackHandler,y1 as createSentryWinstonTransport,da as createTransport,C1 as cron,_ee as dataloaderIntegration,Ob as dedupeIntegration,Hm as defaultStackParser,yne as diagnosticsChannelInjectionIntegrations,m1 as disableAnrDetectionForCallback,qi as endSession,Vu as eventFiltersIntegration,Sne as experimentalUseDiagnosticsChannelInjection,ky as expressErrorHandler,mE as expressIntegration,xb as extraErrorDataIntegration,XE as fastifyIntegration,Bb as featureFlagsIntegration,sN as firebaseIntegration,Xi as flush,Sq as fsIntegration,al as functionToStringIntegration,de as generateInstrumentOnce,xA as genericPoolIntegration,Q as getActiveSpan,aN as getAutoPerformanceIntegrations,O as getClient,ne as getCurrentScope,PF as getDefaultIntegrations,xF as getDefaultIntegrationsWithoutPerformance,Di as getGlobalScope,J as getIsolationScope,Re as getRootSpan,Bm as getSentryRelease,Hc as getSpanDescendants,qt as getSpanStatusFromHttpCode,$e as getTraceData,Eb as getTraceMetaTags,zA as googleGenAIIntegration,eT as graphqlIntegration,jee as growthbookIntegration,HT as hapiIntegration,WT as honoIntegration,Vr as httpHeadersToSpanAttributes,cE as httpIntegration,wa as httpServerIntegration,Ga as httpServerSpansIntegration,cl as inboundFiltersIntegration,cte as init,lN as initOpenTelemetry,lte as initWithoutDefaultIntegrations,yd as instrumentAnthropicAiClient,Td as instrumentGoogleGenAIClient,Nd as instrumentLangChainEmbeddings,cx as instrumentLangGraph,gd as instrumentOpenAiClient,Ol as instrumentStateGraph,dy as instrumentStateGraphCompile,Xu as instrumentSupabaseClient,ic as isDiagnosticsChannelInjectionEnabled,Ki as isEnabled,Jh as isInitialized,aT as kafkaIntegration,see as knexIntegration,jT as koaIntegration,tN as langChainIntegration,rN as langGraphIntegration,qh as lastEventId,Hee as launchDarklyIntegration,ll as linkedErrorsIntegration,Rm as localVariablesIntegration,rE as logger,lT as lruMemoizerIntegration,Um as makeNodeTransport,ft as metrics,Cm as modulesIntegration,dT as mongoIntegration,fT as mongooseIntegration,ST as mysql2Integration,_T as mysqlIntegration,lE as nativeNodeFetchIntegration,Tm as nodeContextIntegration,h1 as nodeRuntimeMetricsIntegration,Om as onUncaughtExceptionIntegration,xm as onUnhandledRejectionIntegration,qA as openAIIntegration,Wee as openFeatureIntegration,Bu as parameterize,I1 as pinoIntegration,MT as postgresIntegration,DT as postgresJsIntegration,nte as preloadOpenTelemetry,sf as prismaIntegration,Pm as processSessionIntegration,Wb as profiler,CT as redisIntegration,pl as requestDataIntegration,wb as rewriteFramesIntegration,Xh as setAttribute,Zh as setAttributes,Fh as setContext,B0 as setConversationId,fb as setCurrentClient,Vh as setExtra,Wh as setExtras,Ys as setHttpStatus,bh as setMeasurement,jS as setNodeAsyncContextStrategy,jh as setTag,Yh as setTags,Kh as setUser,p$ as setupConnectErrorHandler,Tq as setupExpressErrorHandler,UQ as setupFastifyErrorHandler,KJ as setupHapiErrorHandler,n$ as setupHonoErrorHandler,i$ as setupKoaErrorHandler,xl as spanStreamingIntegration,uh as spanToBaggageHeader,ie as spanToJSON,Dc as spanToTraceHeader,km as spotlightIntegration,M as startInactiveSpan,Rn as startNewTrace,el as startSession,Se as startSpan,ke as startSpanManual,Vee as statsigIntegration,Gb as supabaseIntegration,Vn as suppressTracing,Mm as systemErrorIntegration,RA as tediousIntegration,fy as trpcMiddleware,Yee as unleashIntegration,ch as updateSpanName,Wm as validateOpenTelemetrySetup,XA as vercelAIIntegration,AC as winterCGHeadersToDict,se as withActiveSpan,or as withIsolationScope,Fr as withMonitor,Be as withScope,dh as withStreamedSpan,Cy as wrapMcpServerWithSentry,Ub as zodErrorsIntegration};
|