@yukino.js/yukino 0.0.13 → 0.0.15
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/README.md +13 -11
- package/dist/a2a-ANR7PFD4.js +15 -0
- package/dist/acp-4E7R254I.js +14 -0
- package/dist/{anthropic-74ALYMH2.js → anthropic-ZO73YJFY.js} +1 -1
- package/dist/browser/dist/index.html +44 -0
- package/dist/browser/dist/static/index.css +2 -0
- package/dist/browser/dist/static/index.js +203 -0
- package/dist/bwrap-LVIPV72Q.js +0 -0
- package/dist/chunk-3KKA6537.js +0 -0
- package/dist/chunk-3RH3COZW.js +365 -0
- package/dist/chunk-4JHZPFU6.js +67 -0
- package/dist/chunk-7MKA3SHV.js +0 -0
- package/dist/{chunk-OREDGNI6.js → chunk-B2RNOTT5.js} +1 -1
- package/dist/{chunk-APJAUOF6.js → chunk-C56EKYBO.js} +1 -1
- package/dist/{chunk-WGFROGUC.js → chunk-CKOUBYG6.js} +0 -0
- package/dist/{chunk-6JUOKMSJ.js → chunk-CW6G3RYM.js} +1 -1
- package/dist/{chunk-556TRLPT.js → chunk-CWWRUTF2.js} +1 -1
- package/dist/chunk-DVB57IVG.js +18 -0
- package/dist/chunk-ETZPOVUC.js +4 -0
- package/dist/chunk-F3JTT3TI.js +110 -0
- package/dist/chunk-FC2LG24U.js +4 -0
- package/dist/chunk-FNQMXCCE.js +4 -0
- package/dist/chunk-HWCLMDQF.js +0 -0
- package/dist/chunk-I74AL3PF.js +0 -0
- package/dist/chunk-IOMQY54U.js +967 -0
- package/dist/chunk-IQT2IFSO.js +4 -0
- package/dist/chunk-K45OXLJJ.js +16 -0
- package/dist/chunk-KJJYW5IY.js +0 -0
- package/dist/chunk-LCWNSYZU.js +0 -0
- package/dist/chunk-LR4ZNAAM.js +4 -0
- package/dist/chunk-LTMY67B2.js +5 -0
- package/dist/chunk-MDPSQ6L7.js +0 -0
- package/dist/chunk-MQAQBW7F.js +0 -0
- package/dist/{chunk-NEU4ER5V.js → chunk-NSNTZXFL.js} +1 -1
- package/dist/chunk-P6DHMU7R.js +0 -0
- package/dist/chunk-VCIRD267.js +0 -0
- package/dist/chunk-VM4YKTHC.js +0 -0
- package/dist/chunk-VU3JWAJR.js +0 -0
- package/dist/chunk-W4GMCNWF.js +0 -0
- package/dist/chunk-XY7ZFVZL.js +4 -0
- package/dist/devtools-UVGRIXO2.js +0 -0
- package/dist/{esm-HW2JMFYC.js → esm-2JJG3HR7.js} +1 -1
- package/dist/esm-7DWXO52B.js +4 -0
- package/dist/{esm-6L5BJ5GT.js → esm-EOOB75BT.js} +1 -1
- package/dist/{esm-DIYJ5HX6.js → esm-H73EL6IR.js} +1 -1
- package/dist/{esm-YKAO4ES6.js → esm-IBZKE3IU.js} +1 -1
- package/dist/esm-W4NAAZTQ.js +225 -0
- package/dist/{esm-RPR2GBJ2.js → esm-Y237QNPJ.js} +1 -1
- package/dist/getMachineId-bsd-A3UCSHLE.js +4 -0
- package/dist/getMachineId-bsd-E27XJQLX.js +0 -0
- package/dist/getMachineId-darwin-35UPAIXP.js +0 -0
- package/dist/getMachineId-darwin-MWJEU7OI.js +5 -0
- package/dist/getMachineId-linux-FNSLKUDN.js +4 -0
- package/dist/getMachineId-linux-MKXIYT6A.js +0 -0
- package/dist/getMachineId-unsupported-PKQWB2OJ.js +4 -0
- package/dist/getMachineId-unsupported-ZXVGGFX2.js +0 -0
- package/dist/getMachineId-win-3A667JT3.js +4 -0
- package/dist/getMachineId-win-RNVIYJG5.js +0 -0
- package/dist/lib/{anthropic-EQRUGP2C.js → anthropic-SQBOFRPQ.js} +4 -4
- package/dist/lib/{chunk-EGT7BJRD.js → chunk-AW2577J5.js} +2 -2
- package/dist/lib/{chunk-JYCSWXCR.js → chunk-GPJL4PLE.js} +2 -2
- package/dist/lib/{chunk-UBVKYJFI.js → chunk-IHVYAEY2.js} +1058 -522
- package/dist/lib/{chunk-CDMR25FD.js → chunk-U3OT4POQ.js} +3 -3
- package/dist/lib/{chunk-HUTUNNDX.js → chunk-WNGF7243.js} +0 -1
- package/dist/lib/{chunk-FUJDUZTH.js → chunk-WXR5HNB4.js} +1 -1
- package/dist/lib/{chunk-WWCSFKMR.js → chunk-XS3GONYN.js} +2 -11
- package/dist/lib/index.d.ts +98 -282
- package/dist/lib/index.js +1092 -2409
- package/dist/lib/{openai-B3I5WBFT.js → openai-UV4KFNQV.js} +3 -3
- package/dist/lib/{providers-EJ4VBHNP.js → providers-77VBEX3K.js} +2 -2
- package/dist/lib/{tool-filter-TURPCYFR.js → tool-filter-MLYQGWM5.js} +3 -3
- package/dist/{main-JEEKFCGX.js → main-653YZQHY.js} +228 -232
- package/dist/main.js +2 -2
- package/dist/node-634LOHDX.js +0 -0
- package/dist/{openai-7C6BVQ7M.js → openai-FKLMHNNC.js} +1 -1
- package/dist/providers-4IU7SUEQ.js +4 -0
- package/dist/seatbelt-UO7HGD4Z.js +0 -0
- package/dist/server-4NHV4RJL.js +4 -0
- package/dist/slim-Q56GHZZP.js +0 -0
- package/dist/{src-JBRNH4FA.js → src-DEVJGNXS.js} +1 -1
- package/dist/{src-X6JWWHHT.js → src-EMFESWQS.js} +1 -1
- package/dist/{src-R4BSSIJJ.js → src-GG4YROJH.js} +1 -1
- package/dist/{src-43CPCEK2.js → src-JFAO2DGP.js} +1 -1
- package/dist/tool-filter-LJTLMGFP.js +4 -0
- package/dist/turndown.es-NQ3KDXM7.js +0 -0
- package/package.json +22 -21
- package/dist/a2a-DKWMWGID.js +0 -14
- package/dist/acp-RL6DKS3R.js +0 -14
- package/dist/chunk-2LHY3FND.js +0 -67
- package/dist/chunk-3QL446GD.js +0 -4
- package/dist/chunk-6FSIG63T.js +0 -364
- package/dist/chunk-A5G5NTDB.js +0 -1015
- package/dist/chunk-A7CJPQC5.js +0 -5
- package/dist/chunk-AGSYLE4E.js +0 -16
- package/dist/chunk-CJSMVCUF.js +0 -6
- package/dist/chunk-CU3IISCC.js +0 -4
- package/dist/chunk-HMZQYFYG.js +0 -4
- package/dist/chunk-JFKC4VCA.js +0 -4
- package/dist/chunk-KCMBAHWU.js +0 -4
- package/dist/chunk-SCR7NDDL.js +0 -63
- package/dist/esm-57CJEGGK.js +0 -4
- package/dist/esm-YOQPBF42.js +0 -225
- package/dist/fe/dist/index.html +0 -21
- package/dist/fe/dist/static/index.css +0 -2
- package/dist/fe/dist/static/index.js +0 -203
- package/dist/providers-U23PWAHG.js +0 -4
- package/dist/server-EOSEQPNY.js +0 -4
- package/dist/tool-filter-UDSHRE5F.js +0 -4
package/dist/esm-YOQPBF42.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
-
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
-
import{b as S2}from"./chunk-WGFROGUC.js";import"./chunk-VU3JWAJR.js";import{a as Ar,c as $N}from"./chunk-JFKC4VCA.js";import{F as u_,G as QN,M as JN,a as Rs,b as Os,d as qN,r as Qp}from"./chunk-CU3IISCC.js";import{a as XN,c as xo,d as Kp,g as Ir,h as KN,k as p_,m as vt,n as Gn,o as pe,p as nn,q as qp,r as ci,s as he,u as at}from"./chunk-VCIRD267.js";import{a as En,c as Zp,d as ZN,e as Xp}from"./chunk-7MKA3SHV.js";var Vy=Zp((sTe,ik)=>{"use strict";var Wy=En("path").sep;ik.exports=function(e){var t=e.split(Wy),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",i=r?t[n+1]+"/"+t[n+2]:t[n+1],o=r?3:2,s="",c=n+o-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+Wy;for(var l="",p=t.length-1,u=n+o;u<=p;u++)u===p?l+=t[u]:l+=t[u]+Wy;return{name:i,basedir:s,path:l}}}});var Xy=Zp((aTe,Zy)=>{"use strict";var Da=En("path"),gr=En("module"),gt=S2()("require-in-the-middle"),Gj=Vy();Zy.exports=Fl;Zy.exports.Hook=Fl;var Yy,Qd;if(gr.isBuiltin)Qd=gr.isBuiltin;else if(gr.builtinModules)Qd=e=>e.startsWith("node:")?!0:(Yy===void 0&&(Yy=new Set(gr.builtinModules)),Yy.has(e));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var Uj=/([/\\]index)?(\.js)?$/,jy=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=En.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 i=En.cache[t];return i&&i[this._kRitmExports]}}set(t,n,r){r?this._localCache.set(t,n):t in En.cache?En.cache[t][this._kRitmExports]=n:(gt('non-core module is unexpectedly not in require.cache: "%s"',t),this._localCache.set(t,n))}};function Fl(e,t,n){if(!(this instanceof Fl))return new Fl(e,t,n);if(typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),typeof gr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof gr._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 jy,this._unhooked=!1,this._origRequire=gr.prototype.require;let r=this,i=new Set,o=t?t.internals===!0:!1,s=Array.isArray(e);gt("registering require hook"),this._require=gr.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=Qd(p),d;if(u){if(d=p,p.startsWith("node:")){let M=p.slice(5);Qd(M)&&(d=M)}}else{if(l)return gt("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,a);try{d=gr._resolveFilename(p,this)}catch(M){return gt('Module._resolveFilename("%s") threw %j, calling original Module.require',p,M.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=i.has(d);h===!1&&i.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(i.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 M=Da.parse(d);m=M.name,_=M.dir}else{let M=Gj(d);if(M===void 0)return gt("could not parse filename: %s",d),b;m=M.name,_=M.basedir;let R=Dj(M);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=En.resolve(m,{paths:[_]})}catch{return gt("could not resolve module: %s",m),r._cache.set(d,b,u),b}if(P!==d)if(o===!0)m=m+Da.sep+Da.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}}Fl.prototype.unhook=function(){this._unhooked=!0,this._require===gr.prototype.require?(gr.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 Dj(e){let t=Da.sep!=="/"?e.path.split(Da.sep).join("/"):e.path;return Da.posix.join(e.name,t).replace(Uj,"")}});var mk=Zp(Ba=>{"use strict";var $y=[],pk=new WeakMap,qy,Qy,ak,zy=new Map,eS=[];function ck(e,t){return t==="module.exports"&&!Object.hasOwn(e,t)?e.default:e[t]}function uk(e,t,n){return pk.get(e).write(t,n)}function Fj(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return uk(e,t,n.value)}var Wj={defineProperty:Fj,set:uk};function dk(e,t,n){let r=qy.get(e)?.[t];return typeof r=="function"?r(n):!0}function Vj(e,t){if(t===Symbol.toStringTag)return"Module";let n=Qy.get(e)[t];if(typeof n=="function")return n()}function Yj(e,t,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");return dk(e,t,n.value)}function jj(e,t,n,r,i){qy??=new WeakMap,Qy??=new WeakMap,ak??={defineProperty:Yj,get:Vj,set:dk},zy.set(e,i),qy.set(t,n),Qy.set(t,r);let o=new Proxy(t,ak);$y.forEach(s=>s(e,o,i)),eS.push([e,o,i])}function Zj(e,t,n,r,i){if(arguments.length===5){jj(e,t,n,r,i);return}let{namespace:o}=t;zy.set(e,n),pk.set(o,t);let s=new Proxy(o,Wj);$y.forEach(c=>c(e,s,n)),eS.push([e,s,n])}var lk=[0,10,50],Jy=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});#r=Object.create(null);#t;#n;#e;constructor(t,n,r,i){if(this.#t=r,n!==void 0)for(let o=0;o<n.length;o++)this.#s(n[o],o,i?.[o]??t)}#s(t,n,r){let i;try{i=ck(r,t),this.#t(n,i),this.namespace[t]=i}catch(o){if(!(o instanceof ReferenceError))throw o}i===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 i=ck(r,t);return i!==void 0?(this.#t(n,i),this.namespace[t]=i,!0):!1}catch(i){if(i instanceof ReferenceError)return!1;throw i}}}#i(){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.#i(),this.#o(0)})}#o(t){if(this.#e===void 0)return;if(t>=lk.length){this.#e=void 0;return}let n=setTimeout(()=>{this.#i(),this.#o(t+1)},lk[t]);n&&typeof n.unref=="function"&&n.unref()}};Ba.register=Zj;Ba.ModuleBinder=Jy;Ba.importHooks=$y;Ba.specifiers=zy;Ba.toHook=eS});var iS=Zp((mTe,Fa)=>{"use strict";var fk=En("path"),Xj=Vy(),{fileURLToPath:Kj}=En("url"),{MessageChannel:qj}=En("worker_threads"),{isBuiltin:tS}=En("module");tS||(tS=()=>!0);var{importHooks:nS,specifiers:gk,toHook:Qj}=mk();function Jj(e,t){if(!(process.env.TURBOPACK??process.argv.includes("--turbo")))return!1;let r=e.slice(0,e.lastIndexOf("-"));return t.endsWith(r)}function _k(e){nS.push(e),Qj.forEach(([t,n,r])=>e(t,n,r))}function hk(e){let t=nS.indexOf(e);t>-1&&nS.splice(t,1)}function Ha(e,t,n,r){let i=e(t,n,r);i&&i!==t&&"default"in t&&(t.default=i)}var rS;function $j(){let{port1:e,port2:t}=new qj,n=0,r;rS=c=>{n++,e.postMessage(c)},e.on("message",()=>{n--,r&&n<=0&&r()}).unref();function i(){let c=setInterval(()=>{},1e3),a=new Promise(l=>{r=l}).then(()=>{clearInterval(c)});return n===0&&r(),a}let o=t;return{registerOptions:{data:{addHookMessagePort:o,include:[]},transferList:[o]},addHookMessagePort:o,waitForAllMessagesAcknowledged:i}}function Wl(e,t,n){if(!(this instanceof Wl))return new Wl(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;rS&&Array.isArray(e)&&rS(e),this._iitmHook=(i,o,s)=>{let c=i,a=c.startsWith("node:"),l,p;if(a){let u=i.slice(5);tS(u)&&(i=u)}else if(c.startsWith("file://")){let u=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=Kj(i),i=l}catch{}if(Error.stackTraceLimit=u,l){let d=Xj(l);d&&(i=d.name,p=d.basedir)}}if(e)for(let u of e)if(l&&u===l)Ha(n,o,l,void 0);else if(u===i){if(!p)Ha(n,o,i,p);else if(p.endsWith(gk.get(c))||Jj(gk.get(c),p))Ha(n,o,i,p);else if(r){let d=i+fk.sep+fk.relative(p,l);Ha(n,o,d,p)}}else u===s&&Ha(n,o,s,p);else Ha(n,o,i,p)},_k(this._iitmHook)}Wl.prototype.unhook=function(){hk(this._iitmHook)};Fa.exports=Wl;Fa.exports.Hook=Wl;Fa.exports.addHook=_k;Fa.exports.removeHook=hk;Fa.exports.createAddHookMessageChannel=$j});var E=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var te=globalThis;var q="10.76.0";function Je(){return Jn(te),te}function Jn(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||q,t[q]=t[q]||{}}function Un(e,t,n=te){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[q]=r[q]||{};return i[e]||(i[e]=t())}var zn=["debug","info","warn","error","log","assert","trace"],E2="Sentry Logger ",$n={};function Me(e){if(!("console"in te))return e();let t=te.console,n={},r=Object.keys($n);r.forEach(i=>{let o=$n[i];n[i]=t[i],t[i]=o});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function T2(){m_().enabled=!0}function I2(){m_().enabled=!1}function zN(){return m_().enabled}function A2(...e){d_("log",...e)}function N2(...e){d_("warn",...e)}function v2(...e){d_("error",...e)}function d_(e,...t){E&&zN()&&Me(()=>{te.console[e](`${E2}[${e}]:`,...t)})}function m_(){return E?Un("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:T2,disable:I2,isEnabled:zN,log:A2,warn:N2,error:v2};var ev=/\(error: (.*)\)/,tv=/captureMessage|captureException/;function $p(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{let o=[],s=n.split(`
|
|
5
|
-
`);for(let c=r;c<s.length;c++){let a=s[c];a.length>1024&&(a=a.slice(0,1024));let l=ev.test(a)?a.replace(ev,"$1"):a;if(!l.includes("Error: ")){for(let p of t){let u=p(l);if(u){o.push(u);break}}if(o.length>=50+i)break}}return nv(o.slice(i))}}function g_(e){return Array.isArray(e)?$p(...e):e}function nv(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Jp(t).function||"")&&t.pop(),t.reverse(),tv.test(Jp(t).function||"")&&(t.pop(),tv.test(Jp(t).function||"")&&t.pop()),t.slice(0,50).map(n=>({...n,filename:n.filename||Jp(t).filename,function:n.function||"?"}))}function Jp(e){return e[e.length-1]||{}}var f_="<anonymous>";function Nc(e){try{return!e||typeof e!="function"?f_:e.name||f_}catch{return f_}}function zp(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 rv(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var vc={},iv={};function __(e,t){return vc[e]=vc[e]||[],vc[e].push(t),()=>{let n=vc[e];if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}function Rc(e,t){if(!iv[e]){iv[e]=!0;try{t()}catch(n){E&&g.error(`Error while instrumenting ${e}`,n)}}}function Cs(e,t){let n=e&&vc[e];if(n)for(let r of n)try{r(t)}catch(i){E&&g.error(`Error while triggering instrumentation handler.
|
|
6
|
-
Type: ${e}
|
|
7
|
-
Name: ${Nc(r)}
|
|
8
|
-
Error:`,i)}}var ov=Object.prototype.toString;function et(e){switch(ov.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return S_(e,Error)}}function eu(e,t){return ov.call(e)===`[object ${t}]`}function h_(e){return eu(e,"ErrorEvent")}function xs(e){return eu(e,"String")}function Ui(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function er(e){return e===null||Ui(e)||typeof e!="object"&&typeof e!="function"}function Yt(e){return eu(e,"Object")}function V(e){return typeof e=="object"&&e!==null}function b_(e){return typeof Event<"u"&&S_(e,Event)}function y_(e){return eu(e,"RegExp")}function bt(e){return!!(e?.then&&typeof e.then=="function")}function S_(e,t){try{return e instanceof t}catch{return!1}}function kt(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!="function")return;let i=n(r);typeof i=="function"&&Po(i,r);try{e[t]=i}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 Po(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,we(e,"__sentry_original__",t)}catch{}}function Ps(e,t,n,r=!0){let i=e[t];if(typeof i!="function")throw new Error(`Cannot wrap method: ${t} is not a function`);if(Nr(i))throw new Error(`Attempting to wrap method ${t} multiple times`);Po(n,i),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Nr(e){return e.__sentry_original__}function tu(e){if(et(e))return{message:e.message,name:e.name,stack:e.stack,...sv(e)};if(b_(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...sv(e)}}return e}function sv(e){return V(e)?Object.fromEntries(Object.entries(e)):{}}function E_(e){let t=Object.keys(tu(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var ks;function ko(e){if(ks!==void 0)return ks?ks(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=te;return t in n&&typeof n[t]=="function"?(ks=n[t],ks(e)):(ks=null,e())}function ct(){return ko(()=>Math.random())}function tt(){return ko(()=>Date.now())}var av=Symbol.for("sentry.skipNormalization"),cv=Symbol.for("sentry.overrideNormalizationDepth");function lv(e){we(e,av,!0)}function pv(e,t){we(e,cv,t)}function uv(e){return!!e[av]}function dv(e){let t=e[cv];return typeof t=="number"?t:void 0}var mv;function Ke(e,t=100,n=1/0){try{return T_("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function I_(e,t=3,n=100*1024){let r=Ke(e,t);return C2(r)>n?I_(e,t-1,n):r}function T_(e,t,n=1/0,r=1/0,i=x2()){let[o,s]=i;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let c=A_(e,t);if(!c.startsWith("[object "))return c;if(uv(t))return t;let a=dv(t),l=a!==void 0?a:n;if(l===0)return c.replace("object ","");if(o(t))return"[Circular ~]";let p=t;if(p&&typeof p.toJSON=="function")try{let _=p.toJSON();return T_("",_,l-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,m=tu(t);for(let _ in m){if(!Object.prototype.hasOwnProperty.call(m,_))continue;if(d>=r){u[_]="[MaxProperties ~]";break}let h=m[_];u[_]=T_(_,h,l-1,r,i),d++}return s(t),u}function A_(e,t){try{if(mv){let r=mv(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${Nc(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${R2(t)}]`}catch(n){return`**non-serializable** (${n})`}}function R2(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function O2(e){return~-encodeURI(e).split(/%..|./).length}function C2(e){return O2(JSON.stringify(e))}function x2(){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 mn(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function N_(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,r);return o>r-5&&(o=r),o===r&&(i=Math.max(o-140,0)),n=n.slice(i,o),i>0&&(n=`'{snip} ${n}`),o<r&&(n+=" {snip}"),n}function Ls(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let i=e[r];er(i)?n.push(String(i)):i instanceof Error?n.push(i.message?`${i.name}: ${i.message}`:i.name):n.push(A_(void 0,i))}return n.join(t)}function vr(e,t,n=!1){return xs(e)?y_(t)?t.test(e):xs(t)?n?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function fn(e,t=[],n=!1){for(let r of t)if(vr(e,r,n))return!0;return!1}function P2(){let e=te;return e.crypto||e.msCrypto}var v_;function k2(){return ct()*16}function dt(e=P2()){try{if(e?.randomUUID)return ko(()=>e.randomUUID()).replace(/-/g,"")}catch{}return v_||(v_="10000000100040008000"+1e11),v_.replace(/[018]/g,t=>(t^(k2()&15)>>t/4).toString(16))}function fv(e){return e.exception?.values?.[0]}function Di(e){let{message:t,event_id:n}=e;if(t)return t;let r=fv(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function O_(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type=n||"Error")}function Dn(e,t){let n=fv(e);if(!n)return;let r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&"data"in t){let o={...i?.data,...t.data};n.mechanism.data=o}}var L2=/^(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 R_(e){return parseInt(e||"",10)}function Ms(e){let t=e.match(L2)||[],n=R_(t[1]),r=R_(t[2]),i=R_(t[3]);return{buildmetadata:t[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(i)?void 0:i,prerelease:t[4]}}function nu(e){if(gv(e))return!0;try{we(e,"__sentry_captured__",!0)}catch{}return!1}function gv(e){try{return e.__sentry_captured__}catch{}}var hv=1e3;function Rr(){return tt()/hv}function M2(){let{performance:e}=te;if(!e?.now||!e.timeOrigin)return Rr;let t=e.timeOrigin;return()=>(t+ko(()=>e.now()))/hv}var _v;function lt(){return(_v??(_v=M2()))()}function bv(e){let t=lt(),n={sid:dt(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>w2(n)};return e&&li(n,e),n}function li(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 yv(e,t){let n={};t?n={status:t}:e.status==="ok"&&(n={status:"exited"}),li(e,n)}function w2(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 Bi(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 i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Bi(r[i],t[i],n-1));return r}function yt(){return dt()}function jt(){return dt().substring(16)}function Lo(e){try{let t=te.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function Mo(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var C_="_sentrySpan";function Bn(e,t){t?we(e,C_,Lo(t)):delete e[C_]}function tr(e){return Mo(e[C_])}var G2=100,Zt=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,Bn(t,tr(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&&li(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():Yt(n)?t:void 0,{tags:i,attributes:o,extra:s,user:c,contexts:a,level:l,fingerprint:p=[],propagationContext:u,conversationId:d}=r||{};return this._tags={...this._tags,...i},this._attributes={...this._attributes,...o},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,Bn(this,void 0),this._attachments=[],this.setPropagationContext({traceId:yt(),sampleRand:ct()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){let r=typeof n=="number"?n:G2;if(r<=0)return this;let i={timestamp:Rr(),...t,message:t.message?mn(t.message,2048):t.message};return this._breadcrumbs.push(i),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:tr(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Bi(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 i=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureMessage(t,n,r){let i=r?.event_id||dt();if(!this._client)return E&&g.warn("No client configured on scope - will not capture message!"),i;let o=r?.syntheticException??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:o,...r,event_id:i},this),i}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 ws(){return Un("defaultCurrentScope",()=>new Zt)}function Rt(){return Un("defaultIsolationScope",()=>new Zt)}var Sv=e=>e instanceof Promise&&!e[Ev],Ev=Symbol("chained PromiseLike"),ru=(e,t,n)=>{let r=e.then(i=>(t(i),i),i=>{throw n(i),i});return Sv(r)&&Sv(e)?r:U2(e,r)},U2=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i=="function"?Object.defineProperty(t,r,{value:(...o)=>i.apply(e,o),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[Ev]:!0}),t};var x_=class{constructor(t,n){let r;t?r=t:r=new Zt;let i;n?i=n:i=new Zt,this._stack=[{scope:r}],this._isolationScope=i}withScope(t){let n=this._pushScope(),r;try{r=t(n)}catch(i){throw this._popScope(),i}return bt(r)?ru(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 Gs(){let e=Je(),t=Jn(e);return t.stack=t.stack||new x_(ws(),Rt())}function D2(e){return Gs().withScope(e)}function B2(e,t){let n=Gs();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Tv(e){return Gs().withScope(()=>e(Gs().getIsolationScope()))}function Iv(){return{withIsolationScope:Tv,withScope:D2,withSetScope:B2,withSetIsolationScope:(e,t)=>Tv(t),getCurrentScope:()=>Gs().getScope(),getIsolationScope:()=>Gs().getIsolationScope()}}function P_(e){let t=Je(),n=Jn(t);n.acs=e}function St(e){let t=Jn(e);return t.acs?t.acs:Iv()}function H2(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function F2(e,t){let{value:n,unit:r}=H2(e)?e:{value:e,unit:void 0},i=W2(n),o=r&&typeof r=="string"?{unit:r}:{};if(i)return{...i,...o};if(!t||t==="skip-undefined"&&n===void 0)return;let s="";try{s=JSON.stringify(n)??""}catch{}return{value:s,type:"string",...o}}function pi(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let o=F2(i,t);o&&(n[r]=o)}return n}function k_(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 i=r.value;Array.isArray(i)?t+=Av(i[0])*i.length:er(i)?t+=Av(i):t+=100}return t}function Av(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function W2(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 Nv;function vv(){return Nv?.()}function L_(){return Nv!==void 0}function ne(){let e=Je();return St(e).getCurrentScope()}function J(){let e=Je();return St(e).getIsolationScope()}function wo(){return Un("globalScope",()=>new Zt)}function Be(...e){let t=Je(),n=St(t);if(e.length===2){let[r,i]=e;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(e[0])}function nr(...e){let t=Je(),n=St(t);if(e.length===2){let[r,i]=e;return r?n.withSetIsolationScope(r,i):n.withIsolationScope(i)}return n.withIsolationScope(e[0])}function C(){return ne().getClient()}function Go(e){let t=vv();if(t)return{trace_id:t.traceId,span_id:t.spanId};let n=e.getPropagationContext(),{traceId:r,parentSpanId:i,propagationSpanId:o}=n,s={trace_id:r,span_id:o||jt()};return i&&(s.parent_span_id=i),s}var ve="sentry.source",Hn="sentry.sample_rate",M_="sentry.previous_trace_sample_rate",B="sentry.op",S="sentry.origin",w_="sentry.status.message";var iu="sentry.measurement_unit",ou="sentry.measurement_value",G_="sentry.release",U_="sentry.environment";var D_="sentry.sdk.integrations",B_="user.id",H_="user.email",Oc="user.ip_address",F_="user.name",gn="sentry.custom_span_name",Us="sentry.profile_id",Ds="sentry.exclusive_time",W_="cache.hit",V_="cache.key",Y_="cache.item_size",j_="http.request.method";var Uo="gen_ai.conversation.id";function Xt(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 Bs(e,t){e.setAttribute("http.response.status_code",t);let n=Xt(t);n.message!=="unknown_error"&&e.setStatus(n)}var Rv="_sentryScope",Ov="_sentryIsolationScope",Cv=Symbol.for("sentry.otelSourceInference"),xv=Symbol.for("sentry.otelSourceExplicitlySet"),Pv=Symbol.for("sentry.tracerProviderSpan");function Or(e,t,n){e&&(we(e,Ov,Lo(n)),we(e,Rv,t))}function Kt(e){let t=e;return{scope:t[Rv],isolationScope:Mo(t[Ov])}}function Z_(e){we(e,Cv,!0)}function Hs(e){return e[Cv]===!0}function X_(e){we(e,xv,!0)}function K_(e){return e[xv]===!0}function q_(e){we(e,Pv,!0)}function su(e){return e[Pv]===!0}var ui="sentry-";var Lv=8192;function rr(e){let t=Fs(e);if(!t)return;let n=Object.entries(t).reduce((r,[i,o])=>{if(i.startsWith(ui)){let s=i.slice(ui.length);r[s]=o}return r},{});if(Object.keys(n).length>0)return n}function Hi(e){if(!e)return;let t=Object.entries(e).reduce((n,[r,i])=>(i&&(n[`${ui}${r}`]=i),n),{});return Q_(t)}function Fs(e){if(!(!e||!xs(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{let r=kv(n);return Object.entries(r).forEach(([i,o])=>{t[i]=o}),t},{}):kv(e)}function kv(e){return e.split(",").map(t=>{let n=t.indexOf("=");if(n===-1)return[];let r=t.slice(0,n),i=t.slice(n+1);return[r,i].map(o=>{try{return decodeURIComponent(o.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function Q_(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],i)=>{let o=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,s=i===0?o:`${t},${o}`;return s.length>Lv?(E&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):s},"")}function Ws(e,t){if(!e)return t;let n=Fs(e),r=Fs(t);if(!r)return e;let i={},o=!1,s={},c={};for(let[a,l]of Object.entries(r))a.startsWith(ui)?(s[a]=l,o=!0):c[a]=l;if(n)for(let[a,l]of Object.entries(n))(!o||!a.startsWith(ui))&&(i[a]=l);o&&Object.assign(i,s);for(let[a,l]of Object.entries(c))i[a]??(i[a]=l);return Q_(i)}var V2=/^o(\d+)\./,Y2=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function j2(e){return e==="http"||e==="https"}function rn(e,t=!1){let{host:n,path:r,pass:i,port:o,projectId:s,protocol:c,publicKey:a}=e;return`${c}://${a}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function Z2(e){let t=Y2.exec(e);if(!t){Me(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i="",o="",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 Mv({host:o,pass:i,path:a,projectId:l,port:s,protocol:n,publicKey:r})}function Mv(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function X2(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+$/)?j2(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 K2(e){return e.match(V2)?.[1]}function au(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=K2(n)),r}function wv(e){let t=typeof e=="string"?Z2(e):Mv(e);if(!(!t||!X2(t)))return t}function Tn(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 cu=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Gv(e){if(!e)return;let t=e.match(cu);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 Cc(e){return!!e.parentSpanId||!!e.dsc}function In(e,t){let n=Gv(e),r=rr(t);if(!n?.traceId)return{traceId:yt(),sampleRand:ct()};let i=q2(n,r);r&&(r.sample_rand=i.toString());let{traceId:o,parentSpanId:s,parentSampled:c}=n;return{traceId:o,parentSpanId:s,sampled:c,dsc:r||{},sampleRand:i}}function Fi(e=yt(),t=jt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function Wi(e=yt(),t=jt(),n){return`00-${e}-${t}-${n?"01":"00"}`}function q2(e,t){let n=Tn(t?.sample_rand);if(n!==void 0)return n;let r=Tn(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?ct()*r:r+ct()*(1-r):ct()}function xc(e,t){let n=au(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 pu=0,kc=1,Uv=!1;function Bv(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:o,status:s,origin:c,links:a}=oe(e);return{parent_span_id:o,span_id:t,trace_id:n,data:r,op:i,status:s,origin:c,links:a}}function xr(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:oe(e).parent_span_id,o=Kt(e).scope,s=r?o?.getPropagationContext().propagationSpanId||jt():t;return{parent_span_id:i,span_id:s,trace_id:n}}function Lc(e){let{traceId:t,spanId:n}=e.spanContext(),r=Qt(e);return Fi(t,n,r)}function Hv(e){let{traceId:t,spanId:n}=e.spanContext(),r=Qt(e);return Wi(t,n,r)}function Do(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...i},attributes:o})=>({span_id:t,trace_id:n,sampled:r===kc,attributes:o,...i}))}function $_(e){if(e?.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:i})=>({span_id:t,trace_id:n,sampled:r===kc,attributes:i}))}function qt(e){return typeof e=="number"?Dv(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Dv(e.getTime()):lt()}function Dv(e){return e>9999999999?e/1e3:e}function oe(e){if(Mc(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Wv(e)){let{attributes:r,startTime:i,name:o,endTime:s,status:c,links:a}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:Fv(e),start_timestamp:qt(i),timestamp:qt(s)||void 0,status:Bo(c),op:r[B],origin:r[S],links:Do(a)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function uu(e){if(Mc(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Wv(e)){let{attributes:r,startTime:i,name:o,endTime:s,status:c,links:a}=e;return{name:o,span_id:t,trace_id:n,parent_span_id:Fv(e),start_timestamp:qt(i),end_timestamp:qt(s),is_segment:e===Vs(e),status:mu(c),attributes:z_(r,c),links:$_(a)}}return{span_id:t,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===Vs(e)}}function Fv(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function du(e){return{...e,attributes:pi(e.attributes),links:e.links?.map(t=>({...t,attributes:pi(t.attributes)}))}}function Wv(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Mc(e){return typeof e.getSpanJSON=="function"}function Qt(e){let{traceFlags:t}=e.spanContext();return t===kc}function Bo(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function mu(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function z_(e,t){let n=mu(t)==="error"?t?.message:void 0;return{...n&&{[w_]:n},...e}}var Pc="_sentryChildSpans",J_="_sentryRootSpan";function di(e,t){let n=e[J_]||e;we(t,J_,n),Qt(e)&&(!e.isRecording()&&!n.isRecording()||(e[Pc]?e[Pc].add(t):we(e,Pc,new Set([t]))))}function wc(e){let t=new Set;function n(r){if(!t.has(r)&&Qt(r)){t.add(r);let i=r[Pc]?Array.from(r[Pc]):[];for(let o of i)n(o)}}return n(e),Array.from(t)}var Re=Vs;function Vs(e){return e[J_]||e}function Q(){let e=Je(),t=St(e);return t.getActiveSpan?t.getActiveSpan():tr(ne())}function Ho(){Uv||(Me(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Uv=!0)}function eh(e,t){e.updateName(t),e.setAttributes({[ve]:"custom",[gn]:t})}function Ue(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||C()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Vv(e){g.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ir(e,t){if(!t?.length)return!1;for(let n of t){if(J2(n)){if(e.description&&vr(e.description,n))return E&&Vv(e),!0;continue}let r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;let i=n.name?e.description&&vr(e.description,n.name):!0,o=n.op?e.op&&vr(e.op,n.op):!0,s=n.attributes?Object.entries(n.attributes).every(([c,a])=>Q2(e.attributes?.[c],a)):!0;if(i&&o&&s)return E&&Vv(e),!0}return!1}function Q2(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?vr(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function Yv(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let i of e)i.parent_span_id===r&&(i.parent_span_id=n)}function J2(e){return typeof e=="string"||e instanceof RegExp}var jv=Symbol.for("sentry.nonRecordingSpan"),Pr=class{constructor(t={}){this._traceId=t.traceId||yt(),this._spanId=t.spanId||jt(),this.dropReason=t.dropReason,we(this,jv,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:pu}}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 Vi(e){return!!e&&e[jv]===!0}var Yi="production";var Zv="_frozenDsc";function th(e,t){we(e,Zv,t)}function nh(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Yi,release:n.release,public_key:r,trace_id:e,org_id:au(t)};return t.emit("createDsc",i),i}function or(e,t){let n=t.getPropagationContext();return n.dsc||nh(n.traceId,e)}function nt(e){let t=C();if(!t)return{};let n=Re(e),r=oe(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[Hn]??i[M_];function c(b){return(typeof s=="number"||typeof s=="string")&&(b.sample_rate=`${s}`),b}let a=n[Zv];if(a)return c(a);let l=Vi(n),p=l&&n.dropReason==="ignored";if(l&&(!Ue(t.getOptions())||p)){let b=Kt(n).scope;if(b){let N={...or(t,b)};return p&&(N.sampled="false"),c(N)}}let u=o?.get("sentry.dsc"),d=u&&rr(u);if(d)return c(d);let m=nh(e.spanContext().traceId,t),_=i[ve]??i["sentry.segment.name.source"],h=r.description;return _!=="url"&&h&&(m.transaction=h),Ue()&&(m.sampled=String(Qt(n)),m.sample_rand=o?.get("sentry.sample_rand")??Kt(n).scope?.getPropagationContext().sampleRand.toString()),c(m),t.emit("createDsc",m,n),m}function rh(e){let t=nt(e);return Hi(t)}function ih(e){return we(e,"_streamed",!0),e}function mi(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function Lt(e,t=[]){return[e,t]}function fu(e,t){let[n,r]=e;return[n,[...r,t]]}function Gc(e,t){let n=e[1];for(let r of n){let i=r[0].type;if(t(r,i))return!0}return!1}function sh(e,t){return Gc(e,(n,r)=>t.includes(r))}function oh(e){let t=Jn(te);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Uc(e){let[t,n]=e,r=JSON.stringify(t);function i(o){typeof r=="string"?r=typeof o=="string"?r+o:[oh(r),o]:r.push(typeof o=="string"?oh(o):o)}for(let o of n){let[s,c]=o;if(i(`
|
|
9
|
-
${JSON.stringify(s)}
|
|
10
|
-
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let a;try{a=JSON.stringify(c)}catch{a=JSON.stringify(Ke(c))}i(a)}}return typeof r=="string"?r:$2(r)}function $2(e){let t=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(t),r=0;for(let i of e)n.set(i,r),r+=i.length;return n}function ah(e){return[{type:"span"},e]}function ch(e){let t=typeof e.data=="string"?oh(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var Xv={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 z2(e){return e in Xv}function gu(e){return z2(e)?Xv[e]:e}function Ys(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function lh(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(tt()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:rn(r)},...i&&{trace:i}}}function eW(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 Kv(e,t,n,r){let i=Ys(n),o={sent_at:new Date(tt()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:rn(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Lt(o,[s])}function qv(e,t,n,r){let i=Ys(n),o=e.type&&e.type!=="replay_event"?e.type:"event";eW(e,n?.sdk);let s=lh(e,i,r,t);return delete e.sdkProcessingMetadata,Lt(s,[[{type:o},e]])}function Qv(e,t){function n(m){return!!m.trace_id&&!!m.public_key}let r=nt(e[0]),i=t?.getDsn(),o=t?.getOptions().tunnel,s={sent_at:new Date(tt()).toISOString(),...n(r)&&{trace:r},...!!o&&i&&{dsn:rn(i)}},{beforeSendSpan:c,ignoreSpans:a}=t?.getOptions()||{},l=a?.length?e.filter(m=>{let _=oe(m);return!ir({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 _=oe(m),h=mi(c)?_:c(_);return h||(Ho(),_)}:oe,d=[];for(let m of l){let _=u(m);_&&d.push(ah(_))}return Lt(s,d)}function Dc(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=oe(e),{spanId:i}=e.spanContext(),o=Qt(e),s=Re(e),c=s===e,a=`[Tracing] Starting ${o?"sampled":"unsampled"} ${c?"root ":""}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(r&&l.push(`parent ID: ${r}`),!c){let{op:p,description:u}=oe(s);l.push(`root ID: ${s.spanContext().spanId}`),p&&l.push(`root op: ${p}`),u&&l.push(`root description: ${u}`)}g.log(`${a}
|
|
11
|
-
${l.join(`
|
|
12
|
-
`)}`)}function Bc(e){if(!E)return;let{description:t="< unknown name >",op:n="< unknown op >"}=oe(e),{spanId:r}=e.spanContext(),o=Re(e)===e,s=`[Tracing] Finishing "${n}" ${o?"root ":""}span "${t}" with ID ${r}`;g.log(s)}function ph(e,t,n,r=Q()){let i=r&&Re(r);i&&(E&&g.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[ou]:t,[iu]:n}))}function Fo(e){if(!e||e.length===0)return;let t={};return e.forEach(n=>{let r=n.attributes||{},i=r[iu],o=r[ou];typeof i=="string"&&typeof o=="number"&&(t[n.name]={value:o,unit:i})}),t}function Jv(e){Jn(Je()).segmentSpanCaptureStrategy=e}function Hc(){return Jn(Je()).segmentSpanCaptureStrategy}function rt(e){return e.getOptions().traceLifecycle==="stream"}var $v=1e3,js=class{constructor(t={}){this._traceId=t.traceId||yt(),this._spanId=t.spanId||jt(),this._startTime=t.startTimestamp||lt(),this._links=t.links,this._attributes={},this.setAttributes({[S]:"manual",[B]: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?kc:pu}}setAttribute(t,n){return this._frozen?this:(n===void 0?delete this._attributes[t]:this._attributes[t]=n,t===ve&&n!==void 0&&Hs(this)&&X_(this),this)}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._frozen||(this._startTime=qt(t))}setStatus(t){return this._frozen?this:(this._status=t,this)}updateName(t){return this._frozen?this:(this._name=t,Hs(this)||this.setAttribute(ve,"custom"),this)}end(t){if(this._endTime){this._frozen=su(this);return}this._endTime=qt(t),Bc(this),this._onSpanEnded(),this._frozen=su(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[B],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Bo(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[S],profile_id:this._attributes[Us],exclusive_time:this._attributes[Ds],measurements:Fo(this._events),is_segment:this._isStandaloneSpan&&Re(this)===this||void 0,segment_id:this._isStandaloneSpan?Re(this).spanContext().spanId:void 0,links:Do(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:mu(this._status),attributes:z_(this._attributes,this._status),links:$_(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 i=zv(n)?n:r||lt(),o=zv(n)?{}:n||{},s={name:t,time:qt(i),attributes:o};return this._events.push(s),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let t=C();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?nW(Qv([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=Hc();if(s){let c=Kt(this).scope||ne();s.onChildSpanEnded(this,n,a=>this._convertSpanToTransaction(a),c)}return}if(t&&rt(t)){t.emit("afterSegmentSpanEnd",this);return}let i=Kt(this).scope||ne(),o=Hc();if(o)o.onSegmentSpanEnded(s=>this._convertSpanToTransaction(s),i);else{let s=this._convertSpanToTransaction();s&&i.captureEvent(s)}}_convertSpanToTransaction(t={}){if(!eR(oe(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}=Kt(this),i=n?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;t.onSpanCaptured?.(this);let o=[];for(let u of wc(this)){if(u===this||tW(u)||t.isSpanAlreadyCaptured?.(u))continue;let d=oe(u);eR(d)&&(t.onSpanCaptured?.(u),o.push(d))}let s=this._attributes[ve];delete this._attributes[gn];let c=!1;o.forEach(u=>{delete u.data[gn],u.op?.startsWith("gen_ai.")&&(c=!0)});let a={contexts:{trace:Bv(this)},spans:o.length>$v?o.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,$v):o,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:n,capturedSpanIsolationScope:r,dynamicSamplingContext:nt(this),hasGenAiSpans:c},request:i,...s&&{transaction_info:{source:s}}},l=Fo(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 zv(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function eR(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function tW(e){return e instanceof js&&e.isStandaloneSpan()}function nW(e){let t=C();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function sr(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(o){throw t(o),n(),o}return rW(i,t,n,r)}function rW(e,t,n,r){return bt(e)?ru(e,i=>{n(),r(i)},i=>{t(i),n()}):(n(),r(e),e)}function Fc(e,t,n){if(!Ue(e))return[!1];let r,i;typeof e.tracesSampler=="function"?(i=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?i=t.parentSampled:typeof e.tracesSampleRate<"u"&&(i=e.tracesSampleRate,r=!0);let o=Tn(i);if(o===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(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!o)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,o,r];let s=n<o;return s||E&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[s,o,r]}var Zs="__SENTRY_SUPPRESS_TRACING__";function Se(e,t){let n=Wo();if(n.startSpan)return n.startSpan(e,t);let r=mh(e),{forceTransaction:i,parentSpan:o,scope:s}=e,c=s?.clone();return Be(c,()=>rR(o)(()=>{let l=ne(),p=fh(l,o),u=C(),m=e.onlyIfParent&&!p?uh(l,u):dh({parentSpan:p,spanArguments:r,forceTransaction:i,scope:l});return(!Lr(m)||!p)&&Bn(l,m),sr(()=>t(m),()=>{let{status:_}=oe(m);m.isRecording()&&(!_||_==="ok")&&m.setStatus({code:2,message:"internal_error"})},()=>{m.end()})}))}function ke(e,t){let n=Wo();if(n.startSpanManual)return n.startSpanManual(e,t);let r=mh(e),{forceTransaction:i,parentSpan:o,scope:s}=e,c=s?.clone();return Be(c,()=>rR(o)(()=>{let l=ne(),p=fh(l,o),d=e.onlyIfParent&&!p?uh(l,C()):dh({parentSpan:p,spanArguments:r,forceTransaction:i,scope:l});return(!Lr(d)||!p)&&Bn(l,d),sr(()=>t(d,()=>d.end()),()=>{let{status:m}=oe(d);d.isRecording()&&(!m||m==="ok")&&d.setStatus({code:2,message:"internal_error"})})}))}function k(e){let t=Wo();return t.startInactiveSpan?t.startInactiveSpan(e):nR(e)}function Xs(e){return nR(e)}function nR(e){let t=mh(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?o=>Be(e.scope,o):r!==void 0?o=>se(r,o):o=>o())(()=>{let o=ne(),s=fh(o,r),c=C();return e.onlyIfParent&&!s?uh(o,c):dh({parentSpan:s,spanArguments:t,forceTransaction:n,scope:o})})}var An=(e,t)=>{let n=Je(),r=St(n);if(r.continueTrace)return r.continueTrace(e,t);let{sentryTrace:i,baggage:o}=e,s=C(),c=rr(o);return s&&!xc(s,c?.org_id)?Nn(t):Be(a=>{let l=In(i,o);return a.setPropagationContext(l),Bn(a,void 0),t()})};function se(e,t){let n=Wo();return n.withActiveSpan?n.withActiveSpan(e,t):Be(r=>(Bn(r,e||void 0),t(r)))}function Fn(e){let t=Wo();return t.suppressTracing?t.suppressTracing(e):Be(n=>{n.setSDKProcessingMetadata({[Zs]:!0});let r=e();return n.setSDKProcessingMetadata({[Zs]:void 0}),r})}function kr(e=ne()){let t=Wo();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[Zs]===!0}function Nn(e){let t=Wo();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 uh(e,t){t?.recordDroppedEvent("no_parent_span","span");let n=new Pr({traceId:e.getPropagationContext().traceId});return Or(n,e,J()),n}function dh({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let i=J();if(!Ue()){let c=r.getPropagationContext(),a=e?e.spanContext().traceId:c.traceId,l=new Pr({traceId:a});return e&&!n&&di(e,l),Or(l,r,i),l}let o=C();if(oW(o,t)){kr(r)||o?.recordDroppedEvent("ignored","span");let c=new Pr({dropReason:"ignored",traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&di(e,c),Or(c,r,i),c}let s;if(e&&!n)s=iW(e,r,t,i),di(e,s);else if(e){let c=nt(e),{traceId:a,spanId:l}=e.spanContext(),p=Qt(e);s=tR({traceId:a,parentSpanId:l,...t},r,i,p),th(s,c)}else{let{traceId:c,dsc:a,parentSpanId:l,sampled:p}=r.getPropagationContext();s=tR({traceId:c,parentSpanId:l,...t},r,i,p),a&&th(s,a)}return Dc(s),s}function mh(e){let n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let r={...n};return r.startTimestamp=qt(e.startTime),delete r.startTime,r}return n}function Wo(){let e=Je();return St(e)}function tR(e,t,n,r){let i=C(),o=i?.getOptions()||{},{name:s=""}=e,c={spanAttributes:{...e.attributes},spanName:s,parentSampled:r};i?.emit("beforeSampling",c,{decision:!1});let a=c.parentSampled??r,l=c.spanAttributes,p=t.getPropagationContext(),u=kr(t),[d,m,_]=u?[!1]:Fc(o,{name:s,parentSampled:a,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:Tn(p.dsc?.sample_rate)},p.sampleRand),h=new js({...e,attributes:{[ve]:"custom",[Hn]:m!==void 0&&_?m:void 0,...l},sampled:d});return!d&&i&&!u&&(E&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),i.recordDroppedEvent("sample_rate",rt(i)?"span":"transaction")),Or(h,t,n),i&&i.emit("spanStart",h),h}function iW(e,t,n,r){let{spanId:i,traceId:o}=e.spanContext(),s=kr(t),c=s?!1:Qt(e),a=c?new js({...n,parentSpanId:i,traceId:o,sampled:c}):new Pr({traceId:o});di(e,a),Or(a,t,r);let l=C();return l&&(rt(l)&&Vi(a)&&(Vi(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 fh(e,t){if(t)return t;if(t===null)return;let n=tr(e);if(!n)return;let r=C();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Re(n):n}function rR(e){return e!==void 0?t=>se(e,t):t=>t()}function oW(e,t){let n=e?.getOptions().ignoreSpans;return!e||!rt(e)||!n?.length?!1:ir({description:t.name||"",op:t.attributes?.[B]||t.op,attributes:t.attributes},n)}function Lr(e){return Vi(e)&&e.dropReason==="ignored"}function Wc(e,t,n){let r,i,o,s=n?.maxWait?Math.max(n.maxWait,t):0,c=n?.setTimeoutImpl||setTimeout;function a(){return l(),r=e(),r}function l(){i!==void 0&&clearTimeout(i),o!==void 0&&clearTimeout(o),i=o=void 0}function p(){return i!==void 0||o!==void 0?a():r}function u(){return i&&clearTimeout(i),i=c(a,t),s&&o===void 0&&(o=c(a,s)),r}return u.cancel=l,u.flush=p,u}var _u=new WeakSet,iR=e=>_u.has(e),oR=e=>{_u.add(e)},hu=new WeakMap;function gh(e){if(Hc()||Jv(sW),hu.has(e))return;let t=new Set,n=Wc(()=>{let r=[...t];t.clear();for(let i of r)i()},1,{maxWait:100});e.on("flush",()=>{n.flush()}),hu.set(e,r=>{t.add(r),n()})}var sW={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&hu.get(n);if(!r){let i=e();i&&n?.captureEvent(i);return}r(()=>{let i=e({isSpanAlreadyCaptured:iR,onSpanCaptured:oR});i&&n.captureEvent(i)})},onChildSpanEnded(e,t,n,r){if(_u.has(e)||!_u.has(t))return;let i=r.getClient(),o=i&&hu.get(i),s=()=>{let c=n({isSpanAlreadyCaptured:iR,onSpanCaptured:oR});c?.contexts?.trace?.data&&(c.contexts.trace.data["sentry.parent_span_already_sent"]=!0),c&&i?.captureEvent(c)};o?o(s):s()}};var aW=["addListener","on","once","prependListener","prependOnceListener","addEventListener"],cW=["removeListener","off","removeEventListener"],sR=Symbol("SentryScopeBoundListeners"),Ks;function lW(e){return Ks!==void 0&&(e===Ks||e.listener===Ks)}function _n(e,t=ne()){let n=e;if(bu(n))return e;_h(n);for(let r of aW)typeof n[r]=="function"&&(n[r]=uW(n,n[r],t));for(let r of cW)typeof n[r]=="function"&&(n[r]=dW(n,n[r]));return typeof n.removeAllListeners=="function"&&(n.removeAllListeners=mW(n,n.removeAllListeners)),e}function pW(e,t){return function(...n){return Be(t,()=>e.apply(this,n))}}function aR(e){return typeof e=="function"}function uW(e,t,n){return function(...r){let i=r[0],o=r[1],s=r.slice(2);if(!aR(o)||lW(o))return t.apply(this,r);let c=bu(e)||_h(e),a=c.get(i);a||(a=new WeakMap,c.set(i,a));let l=a.get(o);l||(l=pW(o,n),a.set(o,l));let p=Ks;Ks=l;try{return t.call(this,i,l,...s)}finally{Ks=p}}}function dW(e,t){return function(...n){let r=n[0],i=n[1],o=n.slice(2),s=aR(i)?bu(e)?.get(r)?.get(i):void 0;return s?t.call(this,r,s,...o):t.apply(this,n)}}function mW(e,t){return function(...n){let r=bu(e);if(r)if(n.length===0)_h(e);else{let i=n[0];r.delete(i)}return t.apply(this,n)}}function _h(e){let t=new Map;return e[sR]=t,t}function bu(e){return e[sR]}function bh(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;fW(e,t),r&&hW(e,r),bW(e,n),gW(e,i),_W(e,o)}function hh(e,t){let{extra:n,tags:r,attributes:i,user:o,contexts:s,level:c,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:p,eventProcessors:u,attachments:d,propagationContext:m,transactionName:_,span:h}=t;Vc(e,"extra",n),Vc(e,"tags",r),Vc(e,"attributes",i),Vc(e,"user",o),Vc(e,"contexts",s),e.sdkProcessingMetadata=Bi(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 Vc(e,t,n){e[t]=Bi(e[t],n,1)}function vn(e,t){let n=wo().getScopeData();return e&&hh(n,e.getScopeData()),t&&hh(n,t.getScopeData()),n}function fW(e,t){let{extra:n,tags:r,user:i,contexts:o,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(i).length&&(e.user={...i,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),s&&(e.level=s),c&&e.type!=="transaction"&&(e.transaction=c)}function gW(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function _W(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function hW(e,t){e.contexts={trace:xr(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:nt(t),...e.sdkProcessingMetadata};let n=Re(t),r=oe(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function bW(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 cR(e){let t={},{response:n,profile:r,cloud_resource:i,culture:o,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)),i)for(let[l,p]of Object.entries(i))p!=null&&(t[l]=p);o&&(o.locale&&(t["culture.locale"]=o.locale),o.timezone&&(t["culture.timezone"]=o.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 lR="aws.dynamodb.attribute_definitions",pR="aws.dynamodb.consistent_read",uR="aws.dynamodb.consumed_capacity",dR="aws.dynamodb.count",mR="aws.dynamodb.exclusive_start_table",fR="aws.dynamodb.global_secondary_indexes",gR="aws.dynamodb.global_secondary_index_updates",yh="aws.dynamodb.index_name",_R="aws.dynamodb.item_collection_metrics",hR="aws.dynamodb.limit",bR="aws.dynamodb.local_secondary_indexes",yR="aws.dynamodb.projection",SR="aws.dynamodb.provisioned_read_capacity",ER="aws.dynamodb.provisioned_write_capacity",TR="aws.dynamodb.scanned_count",IR="aws.dynamodb.scan_forward",AR="aws.dynamodb.segment",Sh="aws.dynamodb.select",NR="aws.dynamodb.table_count",Eh="aws.dynamodb.table_names",vR="aws.dynamodb.total_segments";var RR="aws.kinesis.stream.name";var OR="aws.request.extended_id";var CR="aws.request.id",xR="aws.s3.bucket",Th="aws.secretsmanager.secret.arn",Ih="aws.sns.topic.arn",PR="aws.step_functions.activity.arn",kR="aws.step_functions.state_machine.arn";var qs="cache.key";var yu="cloud.region";var Su="code.function.name";var Qs="db.collection.name";var Et="db.name",fi="db.namespace",Js="db.operation",$s="db.operation.batch.size",ar="db.operation.name";var Mr="db.query.text";var Ve="db.statement";var Pe="db.system",mt="db.system.name",Mt="db.user";var wr="error.type";var LR="faas.execution";var MR="faas.invoked_name",wR="faas.invoked_provider",GR="faas.invoked_region",UR="faas.name";var Eu="faas.trigger";var DR="gen_ai.embeddings.input",BR="gen_ai.function_id",HR="gen_ai.input.messages",Tu="gen_ai.operation.name";var Ah="gen_ai.output.messages";var FR="gen_ai.request.available_tools";var gi="gen_ai.request.max_tokens";var Yc="gen_ai.request.model";var ji="gen_ai.request.stop_sequences",_i="gen_ai.request.temperature";var hi="gen_ai.request.top_p",Ot="gen_ai.response.finish_reasons",WR="gen_ai.response.id",VR="gen_ai.response.model",YR="gen_ai.response.streaming";var jc="gen_ai.system";var jR="gen_ai.tool.input";var ZR="gen_ai.tool.name",XR="gen_ai.tool.output",KR="gen_ai.tool.type";var Jt="gen_ai.usage.input_tokens";var Tt="gen_ai.usage.output_tokens";var Nh="gen_ai.usage.total_tokens",zs="graphql.document",Iu="graphql.operation.name",Au="graphql.operation.type";var qR="http.client_ip";var QR="http.flavor";var JR="http.host",Gr="http.method";var Ur="http.request.method";var hn="http.response.status_code";var He="http.route",$R="http.scheme";var bi="http.status_code",Nu="http.target",yi="http.url",zR="http.user_agent";var vu="koa.name",vh="koa.type";var ea="messaging.batch.message_count",e0="messaging.destination";var Rn="messaging.destination.name";var ta="messaging.message.id";var na="messaging.operation.name",cr="messaging.operation.type";var wt="messaging.system";var t0="network.peer.address",n0="network.peer.port",Rh="network.protocol.name",r0="network.protocol.version";var i0="net.host.ip",o0="net.host.name",s0="net.host.port",a0="net.peer.ip",Le="net.peer.name",xe="net.peer.port";var ra="net.transport";var c0="rpc.grpc.status_code",l0="rpc.method";var Ru="rpc.service",p0="rpc.system";var Oh="sentry.graphql.operation";var u0="sentry.http.prefetch";var d0="sentry.origin";var m0="sentry.sdk.name",f0="sentry.sdk.version",g0="sentry.segment.id";var _0="sentry.segment.name";var h0="sentry.trace_lifecycle";var _t="server.address";var ht="server.port",Ch="service.name",b0="service.version";var pt="url.full",Zi="url.path";var Ou="url.query";var y0="url.scheme";var S0="user_agent.original";function xh(e,t){let n=uu(e),r=Vs(e),i=uu(r),{isolationScope:o,scope:s}=Kt(e),c=vn(o,s);EW(n,i,t,c);let a=e.kind;t.emit("preprocessSpan",n,{spanKind:a}),n.is_segment&&(yW(n,c),SW(n,t),t.emit("processSegmentSpan",n)),t.emit("processSpan",n);let{beforeSendSpan:l}=t.getOptions(),p=l&&mi(l)?TW(n,l):n,u=p.attributes?.[ve];return n.is_segment&&u&&Gt(p,{"sentry.segment.name.source":u}),{...du(p),_segmentSpan:r}}function yW(e,t){let n=cR(t.contexts);Gt(e,n)}function Gt(e,t){let n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,i])=>{i!=null&&!(r in n)&&(n[r]=i)})}function SW(e,t){let n=t.getIntegrationNames();n.length&&Gt(e,{[D_]:n})}function EW(e,t,n,r){let i=n.getSdkMetadata(),{release:o,environment:s}=n.getOptions();Gt(e,{[h0]:"stream",[_0]:t.name,[g0]:t.span_id,[m0]:i?.sdk?.name,[f0]:i?.sdk?.version,[G_]:o,[U_]:s||Yi,[B_]:r.user?.id,[H_]:r.user?.email,[Oc]:r.user?.ip_address,[F_]:r.user?.username,...r.attributes})}function TW(e,t){let n=t(e);return n||(Ho(),e)}var Ph=0,E0=1,T0=2;function Si(e){return new Cu(t=>{t(e)})}function xu(e){return new Cu((t,n)=>{n(e)})}var Cu=class e{constructor(t){this._state=Ph,this._handlers=[],this._runExecutor(t)}then(t,n){return new e((r,i)=>{this._handlers.push([!1,o=>{if(!t)r(o);else try{r(t(o))}catch(s){i(s)}},o=>{if(!n)i(o);else try{r(n(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new e((n,r)=>{let i,o;return this.then(s=>{o=!1,i=s,t&&t()},s=>{o=!0,i=s,t&&t()}).then(()=>{if(o){r(i);return}n(i)})})}_executeHandlers(){if(this._state===Ph)return;let t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===E0&&n[1](this._value),this._state===T0&&n[2](this._value),n[0]=!0)})}_runExecutor(t){let n=(o,s)=>{if(this._state===Ph){if(bt(s)){s.then(r,i);return}this._state=o,this._value=s,this._executeHandlers()}},r=o=>{n(E0,o)},i=o=>{n(T0,o)};try{t(r,i)}catch(o){i(o)}}};function I0(e,t,n,r=0){try{let i=kh(t,n,e,r);return bt(i)?i:Si(i)}catch(i){return xu(i)}}function kh(e,t,n,r){let i=n[r];if(!e||!i)return e;let o=i({...e},t);return E&&o===null&&g.log(`Event processor "${i.id||"?"}" dropped event`),bt(o)?o.then(s=>kh(s,t,n,r+1)):kh(o,t,n,r+1)}var Vo,A0,N0,Xi;function Zc(e){let t=te._sentryDebugIds,n=te._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Xi&&r.length===A0&&i.length===N0)return Xi;A0=r.length,N0=i.length,Xi={},Vo||(Vo={});let o=(s,c)=>{for(let a of s){let l=c[a],p=Vo?.[a];if(p&&Xi&&l)Xi[p[0]]=l,Vo&&(Vo[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(_&&Xi&&Vo){Xi[_]=l,Vo[a]=[_,l];break}}}}};return t&&o(r,t),n&&o(i,n),Xi}function v0(e,t,n,r,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:c=1e3}=e,a={...t,event_id:t.event_id||n.event_id||dt(),timestamp:t.timestamp||Rr()},l=n.integrations||e.integrations.map(N=>N.name);IW(a,e),vW(a,l),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&AW(a,e.stackParser);let p=OW(r,n.captureContext);n.mechanism&&Dn(a,n.mechanism);let u=i?i.getEventProcessors():[],d=vn(o,p),m=[...n.attachments||[],...d.attachments];m.length&&(n.attachments=m),bh(a,d);let _=[...u,...d.eventProcessors];return(n.data&&n.data.__sentry__===!0?Si(a):I0(_,a,n)).then(N=>(N&&NW(N),typeof s=="number"&&s>0?RW(N,s,c):N))}function IW(e,t){let{environment:n,release:r,dist:i,maxValueLength:o}=t;e.environment=e.environment||n||Yi,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let s=e.request;s?.url&&o&&(s.url=mn(s.url,o)),o&&e.exception?.values?.forEach(c=>{c.value&&(c.value=mn(c.value,o))})}function AW(e,t){let n=Zc(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=n[i.filename])})})}function NW(e){let t={};if(e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.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,i])=>{n.push({type:"sourcemap",code_file:r,debug_id:i})})}function vW(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function RW(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:Ke(i.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(i=>({...i,...i.data&&{data:Ke(i.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Ke(e.contexts.flags,3,n)),r}function OW(e,t){if(!t)return e;let n=e?e.clone():new Zt;return n.update(t),n}function R0(e){if(e)return CW(e)?{captureContext:e}:PW(e)?{captureContext:e}:e}function CW(e){return e instanceof Zt||typeof e=="function"}var xW=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function PW(e){return Object.keys(e).some(t=>xW.includes(t))}function me(e,t){return ne().captureException(e,R0(t))}function Xc(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 Kc(e,t){return ne().captureEvent(e,t)}function Lh(e,t){J().setContext(e,t)}function Mh(e){J().setExtras(e)}function wh(e,t){J().setExtra(e,t)}function Gh(e){J().setTags(e)}function Uh(e,t){J().setTag(e,t)}function Dh(e){J().setAttributes(e)}function Bh(e,t){J().setAttribute(e,t)}function Hh(e){J().setUser(e)}function O0(e){J().setConversationId(e)}function Fh(){return J().lastEventId()}async function Yo(e){let t=C();return t?t.flush(e):(E&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function Wh(e){let t=C();return t?t.close(e):(E&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function Vh(){return!!C()}function jo(){let e=C();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Yh(e){J().addEventProcessor(e)}function qc(e){let t=J(),{user:n}=vn(t,ne()),{userAgent:r}=te.navigator||{},i=bv({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return o?.status==="ok"&&li(o,{status:"exited"}),Zo(),t.setSession(i),i}function Zo(){let e=J(),n=ne().getSession()||e.getSession();n&&yv(n),C0(),e.setSession()}function C0(){let e=J(),t=C(),n=e.getSession();n&&t&&t.captureSession(n)}function jh(e=!1){if(e){Zo();return}C0()}function Dr(e,t,n){function r(){let o=Qc({monitorSlug:e,status:"in_progress"},n),s=lt();function c(l){Qc({monitorSlug:e,status:l,checkInId:o,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 i={...ne().getPropagationContext()};return nr(()=>{if(n?.isolateTrace)return Nn(r);let o=ne();return Cc(o.getPropagationContext())||o.setPropagationContext(i),r()})}function Qc(e,t){let n=ne(),r=C();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 On(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}function ue(e,t=1){if(St(Je()).getTracingChannelBinding?.()){e();return}t&&On(setTimeout(()=>{ue(e,t-1)},1))}var kW="7";function LW(e){let t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function MW(e){return`${LW(e)}${e.projectId}/envelope/`}function wW(e,t){let n={sentry_version:kW};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function x0(e,t,n){return t||`${MW(e)}?${wW(e,n)}`}var Zh=[];function GW(e){let t={};return e.forEach(n=>{let{name:r}=n,i=t[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function Xh(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(i=>{i.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){let i=n(t);r=Array.isArray(i)?i:[i]}else r=t;return GW(r)}function P0(e,t){let n={};return t.forEach(r=>{r?.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&qh(e,r,n)}),n}function Kh(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function qh(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,!Zh.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),Zh.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",(i,o)=>r(i,o,e))}if(typeof t.processEvent=="function"){let r=t.processEvent.bind(t),i=Object.assign((o,s)=>r(o,s,e),{id:t.name});e.addEventProcessor(i)}["processSpan","processSegmentSpan"].forEach(r=>{let i=t[r];typeof i=="function"&&e.on(r,o=>i.call(t,o,e))}),E&&g.log(`Integration installed: ${t.name}`)}function Qh(e){let t=C();if(!t){E&&g.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function Ut(e,t){let n={...e,...t};for(let r in t){let i=e[r],o=t[r];if(typeof i=="function"&&typeof o=="function"){let s=new Proxy(i,{apply:(c,a,l)=>(Reflect.apply(c,a,l),Reflect.apply(o,a,l))});n[r]=s}}return n}var UW="sentry.timestamp.sequence",Jh=0,$h;function Pu(e){let t=Math.floor(e*1e3);$h!==void 0&&t!==$h&&(Jh=0);let n=Jh;return Jh++,$h=t,{key:UW,value:{value:n,type:"integer"}}}function ia(e,t){return t?Be(t,()=>{let n=Q(),r=n?xr(n):Go(t);return[n?nt(n):or(e,t),r]}):[void 0,void 0]}var k0={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function L0(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function M0(){return!L0()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function It(){return typeof window<"u"&&(!M0()||DW())}function DW(){return te.process?.type==="renderer"}function BW(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 w0(e,t,n,r,i){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=rn(r)),Lt(o,[BW(e,i)])}var HW=100;function Br(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function G0(e,t){let n=eb(),r=U0(e);r===void 0?n.set(e,[t]):r.length>=HW?(oa(e,r),n.set(e,[t])):n.set(e,[...r,t])}function lr(e,t=ne(),n=G0){let r=t?.getClient()??C();if(!r){E&&g.warn("No client available to capture log.");return}let{release:i,environment:o,enableLogs:s=!0,beforeSendLog:c}=r.getOptions();if(!s){E&&g.warn("logging option not enabled, log will not be captured.");return}let[,a]=ia(r,t),l={...e.attributes},{user:{id:p,email:u,username:d},attributes:m={}}=vn(J(),t);Br(l,"user.id",p,!1),Br(l,"user.email",u,!1),Br(l,"user.name",d,!1),Br(l,"sentry.release",i),Br(l,"sentry.environment",o);let{name:_,version:h}=r.getSdkMetadata()?.sdk??{};Br(l,"sentry.sdk.name",_),Br(l,"sentry.sdk.version",h);let b=r.getIntegrationByName("Replay"),N=b?.getReplayId(!0);Br(l,"sentry.replay_id",N),N&&b?.getRecordingMode()==="buffer"&&Br(l,"sentry._internal.replay_is_buffering",!0);let M=e.message;if(Ui(M)){let{__sentry_template_string__:Ne,__sentry_template_values__:Te=[]}=M;Te?.length&&(l["sentry.message.template"]=Ne),Te.forEach((Ce,qe)=>{l[`sentry.message.parameter.${qe}`]=Ce})}let R=tr(t);Br(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:D,message:I,attributes:H={},severityNumber:L}=P,G=lt(),ce=Pu(G),ge={timestamp:G,level:D,body:zh(String(I)),trace_id:a?.trace_id,severity_number:L??k0[D],attributes:FW({...pi(m),...pi(H,!0),[ce.key]:ce.value})};n(r,ge),r.emit("afterCaptureLog",P)}function oa(e,t){let n=t??U0(e)??[];if(n.length===0)return;let r=e.getOptions(),i=w0(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);eb().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function U0(e){return eb().get(e)}function eb(){return Un("clientToLogBufferMap",()=>new WeakMap)}function FW(e){let t={};for(let[n,r]of Object.entries(e)){let i=zh(n);r.type==="string"?t[i]={...r,value:zh(r.value)}:t[i]=r}return t}function zh(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 WW(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 D0(e,t,n,r,i){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=rn(r)),Lt(o,[WW(e,i)])}var VW=1e3;function Ei(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function B0(e,t){let n=nb(),r=H0(e);r===void 0?n.set(e,[t]):r.length>=VW?(sa(e,r),n.set(e,[t])):n.set(e,[...r,t])}function YW(e,t,n){let{release:r,environment:i}=t.getOptions(),o={...e.attributes};Ei(o,"user.id",n.id,!1),Ei(o,"user.email",n.email,!1),Ei(o,"user.name",n.username,!1),Ei(o,"sentry.release",r),Ei(o,"sentry.environment",i);let{name:s,version:c}=t.getSdkMetadata()?.sdk??{};Ei(o,"sentry.sdk.name",s),Ei(o,"sentry.sdk.version",c);let a=t.getIntegrationByName("Replay"),l=a?.getReplayId(!0);return Ei(o,"sentry.replay_id",l),l&&a?.getRecordingMode()==="buffer"&&Ei(o,"sentry._internal.replay_is_buffering",!0),{...e,attributes:o}}function jW(e,t,n,r){let[,i]=ia(t,n),o=tr(n),s=o?o.spanContext().traceId:i?.trace_id,c=o?o.spanContext().spanId:void 0,a=lt(),l=Pu(a);return{timestamp:a,trace_id:s??"",span_id:c,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...pi(r),...pi(e.attributes,"skip-undefined"),[l.key]:l.value}}}function tb(e,t){let n=t?.scope??ne(),r=t?.captureSerializedMetric??B0,i=n?.getClient()??C();if(!i){E&&g.warn("No client available to capture metric.");return}let{_experiments:o,enableMetrics:s,beforeSendMetric:c}=i.getOptions();if(!(s??o?.enableMetrics??!0)){E&&g.warn("metrics option not enabled, metric will not be captured.");return}let{user:l,attributes:p}=vn(J(),n),u=YW(e,i,l);i.emit("processMetric",u);let d=c||o?.beforeSendMetric,m=d?d(u):u;if(!m){E&&g.log("`beforeSendMetric` returned `null`, will not send metric.");return}let _=jW(m,i,n,p);E&&g.log("[Metric]",_),r(i,_),i.emit("afterCaptureMetric",m)}function sa(e,t){let n=t??H0(e)??[];if(n.length===0)return;let r=e.getOptions(),i=D0(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);nb().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function H0(e){return nb().get(e)}function nb(){return Un("clientToMetricBufferMap",()=>new WeakMap)}function F0(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 du(t)}function W0(e,t){if(e.type!=="transaction"||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||rt(t))return;let n=[],r=[];for(let o of e.spans)o.op?.startsWith("gen_ai.")?n.push(F0(o)):r.push(o);if(n.length===0)return;e.spans=r;let i=t.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...It()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var Jc=Symbol.for("SentryBufferFullError");function aa(e=100){let t=new Set;function n(){return t.size<e}function r(s){t.delete(s)}function i(s){if(!n())return xu(Jc);let c=s();return t.add(c),c.then(()=>r(c),()=>r(c)),c}function o(s){if(!t.size)return Si(!0);let c=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return c;let a=[c,new Promise(l=>On(setTimeout(()=>l(!1),s)))];return Promise.race(a)}return{get $(){return Array.from(t)},add:i,drain:o}}var ZW=60*1e3;function XW(e,t=tt()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?ZW:r-t}function KW(e,t){return e[t]||e.all||0}function V0(e,t,n=tt()){return KW(e,t)>n}function Y0(e,{statusCode:t,headers:n},r=tt()){let i={...e},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(let c of o.trim().split(",")){let[a,l,,,p]=c.split(":",5),u=parseInt(a,10),d=(isNaN(u)?60:u)*1e3;if(!l)i.all=r+d;else for(let m of l.split(";"))m==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(i[m]=r+d):i[m]=r+d}else s?i.all=r+XW(s,r):t===429&&(i.all=r+60*1e3);return i}var $c=64;function ca(e,t,n=aa(e.bufferSize||$c)){let r={},i=s=>n.drain(s);function o(s){let c=[];if(Gc(s,(u,d)=>{let m=gu(d);V0(r,m)?e.recordDroppedEvent("ratelimit_backoff",m):c.push(u)}),c.length===0)return Promise.resolve({});let a=Lt(s[0],c),l=u=>{if(sh(a,["client_report"])){E&&g.warn(`Dropping client report. Will not send outcomes (reason: ${u}).`);return}Gc(a,(d,m)=>{e.recordDroppedEvent(u,gu(m))})},p=()=>t({body:Uc(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=Y0(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===Jc)return E&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw u})}return{send:o,flush:i}}function j0(e,t,n){let r=[{type:"client_report"},{timestamp:n||Rr(),discarded_events:e}];return Lt(t?{dsn:t}:{},[r])}function ku(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 Z0(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:o,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:i,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:s?.[Us],exclusive_time:s?.[Ds],measurements:e.measurements,is_segment:!0}}function X0(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&&{[Us]:e.profile_id},...e.exclusive_time&&{[Ds]:e.exclusive_time}}}},measurements:e.measurements}}var la="[Filtered]",zc=["forwarded","-ip","remote-","via","-user"],rb=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","sid","identity","set-cookie","cookie"],K0=[".sid","sessid","remember","oidc","pkce","nonce","__secure-","__host-","awsalb","awselb","akamai","__stripe","cognito","firebase","supabase","sb-","mfa","2fa"];function Lu(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:zc},httpHeaders:{request:{deny:zc},response:{deny:zc}},httpBodies:[],urlQueryParams:{deny:zc},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var qW={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 QW(e){return typeof e=="boolean"||"allow"in e||"deny"in e}function JW(e,t){return e===void 0?{...t.httpHeaders}:QW(e)?{request:e,response:e}:{request:e.request??t.httpHeaders.request,response:e.response??t.httpHeaders.response}}function q0(e){let t=e.dataCollection!=null?qW:Lu(e.sendDefaultPii),n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:JW(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 Q0="Not capturing exception because it's already been captured.",J0="Discarded session because of missing or non-string release",rO=Symbol.for("SentryInternalError"),iO=Symbol.for("SentryDoNotSendEventError"),$W=5e3;function Mu(e){return{message:e,[rO]:!0}}function ib(e){return{message:e,[iO]:!0}}function $0(e){return V(e)&&rO in e}function z0(e){return V(e)&&iO in e}function eO(e,t,n,r,i){let o=0,s,c=!1;e.on(n,()=>{o=0,clearTimeout(s),c=!1}),e.on(t,a=>{if(o+=r(a),o>=8e5)i(e);else if(!c){let l=e.getOptions()._flushInterval??$W;l>0&&(c=!0,s=On(setTimeout(()=>{i(e)},l)))}}),e.on("flush",()=>{i(e)})}var wu=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=aa(t.transportOptions?.bufferSize??$c),this._dataCollection=q0(t),t.dsn?this._dsn=wv(t.dsn):E&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=x0(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&&eO(this,"afterCaptureLog","flushLogs",nV,oa),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&eO(this,"afterCaptureMetric","flushMetrics",tV,sa)}captureException(t,n,r){let i=dt();if(nu(t))return E&&g.log(Q0),i;let o={event_id:i,...n};return this._process(()=>this.eventFromException(t,o).then(s=>this._captureEvent(s,o,r)).then(s=>s),"error"),o.event_id}captureMessage(t,n,r,i){let o={event_id:dt(),...r},s=Ui(t)?t:String(t),c=er(t),a=c?this.eventFromMessage(s,n,o):this.eventFromException(t,o);return this._process(()=>a.then(l=>this._captureEvent(l,o,i)),c?"unknown":"error"),o.event_id}captureEvent(t,n,r){let i=dt();if(n?.originalException&&nu(n.originalException))return E&&g.log(Q0),i;let o={event_id:i,...n},s=t.sdkProcessingMetadata||{},c=s.capturedSpanScope,a=s.capturedSpanIsolationScope,l=tO(t.type);return this._process(()=>this._captureEvent(t,o,c||r,a),l),o.event_id}captureSession(t){this.sendSession(t),li(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),i=await n.flush(t);return r&&i}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),qh(this,t,this._integrations),n||Kh(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=W0(t,this),i=qv(t,this._dsn,this._options._metadata,this._options.tunnel);for(let o of n.attachments||[])i=fu(i,ch(o));r&&(i=fu(i,r)),this.sendEnvelope(i).then(o=>this.emit("afterSendEvent",t,o))}sendSession(t){let{release:n,environment:r=Yi}=this._options;if("aggregates"in t){let o=t.attrs||{};if(!o.release&&!n){E&&g.warn(J0);return}o.release=o.release||n,o.environment=o.environment||r,t.attrs=o}else{if(!t.release&&!n){E&&g.warn(J0);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);let i=Kv(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){let i=`${t}:${n}`;E&&g.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(t,n){let r=this._hooks[t]=this._hooks[t]||new Set,i=(...o)=>n(...o);return r.add(i),()=>{r.delete(i)}}emit(t,...n){let r=this._hooks[t];r&&r.forEach(i=>i(...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=P0(this,t),Kh(this,t)}_updateSessionFromEvent(t,n){let r=n.level==="fatal",i=!1,o=n.exception?.values;if(o){i=!0,r=!1;for(let a of o)if(a.mechanism?.handled===!1){r=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(li(t,{...r&&{status:"crashed"},errors:t.errors||Number(i||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,i){let o=this.getOptions(),s=this.getIntegrationNames();return!n.integrations&&s.length&&(n.integrations=s),this.emit("preprocessEvent",t,n),t.type||i.setLastEventId(t.event_id||n.event_id),v0(o,t,n,r,this,i).then(c=>{if(c===null)return c;this.emit("postprocessEvent",c,n),c.contexts={trace:{...c.contexts?.trace,...Go(r)},...c.contexts};let a=or(this,r);return c.sdkProcessingMetadata={dynamicSamplingContext:a,...c.sdkProcessingMetadata},c})}_captureEvent(t,n={},r=ne(),i=J()){return E&&ob(t)&&g.log(`Captured error event \`${ku(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,i).then(o=>o.event_id,o=>{E&&(z0(o)?g.log(o.message):$0(o)?g.warn(o.message):g.warn(o))})}_processEvent(t,n,r,i){let o=this.getOptions(),{sampleRate:s}=o,c=oO(t),a=ob(t),p=`before send for type \`${t.type||"error"}\``,u=typeof s>"u"?void 0:Tn(s),d=tO(t.type);return this._prepareEvent(t,n,r,i).then(m=>{if(m===null)throw this.recordDroppedEvent("event_processor",d),ib("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return m;let h=eV(this,o,m,n);return zW(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 ib(`${p} returned \`null\`, will not send event.`)}let _=r.getSession()||i.getSession();if(a&&_&&this._updateSessionFromEvent(_,m),a&&typeof u=="number"&&ct()>u)throw this.recordDroppedEvent("sample_rate","error"),ib(`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,M=b-N;M>0&&this.recordDroppedEvent("before_send","span",M)}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 z0(m)||$0(m)?m:(this.captureException(m,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:m}),Mu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
13
|
-
Reason: ${m}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===Jc&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{let[i,o]=n.split(":");return{reason:i,category:o,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=j0(t,this._options.tunnel&&rn(this._dsn));this.sendEnvelope(n)}};function tO(e){return e==="replay_event"?"replay":e||"error"}function zW(e,t){let n=`${t} must return \`null\` or a valid event.`;if(bt(e))return e.then(r=>{if(!Yt(r)&&r!==null)throw Mu(n);return r},r=>{throw Mu(`${t} rejected with ${r}`)});if(!Yt(e)&&e!==null)throw Mu(n);return e}function eV(e,t,n,r){let{beforeSend:i,beforeSendTransaction:o,ignoreSpans:s}=t,c=!mi(t.beforeSendSpan)&&t.beforeSendSpan,a=n;if(ob(a)&&i)return i(a,r);if(oO(a)){if(c||s){let l=Z0(a);if(s?.length&&ir({description:l.description,op:l.op,attributes:l.data},s))return null;if(c){let p=c(l);p?a=Bi(n,X0(p)):Ho()}if(a.spans){let p=[],u=a.spans;for(let m of u){if(s?.length&&ir({description:m.description,op:m.op,attributes:m.data},s)){Yv(u,m);continue}if(c){let _=c(m);_?p.push(_):(Ho(),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(o){if(a.spans){let l=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return o(a,r)}}return a}function ob(e){return e.type===void 0}function oO(e){return e.type==="transaction"}function tV(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+sO(e.attributes)}function nV(e){let t=0;return e.message&&(t+=e.message.length*2),t+sO(e.attributes)}function sO(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*nO(n[0]):er(n)?t+=nO(n):t+=100}),t}function nO(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function sb(e){ne().setClient(e)}var ab=new Set;function Ti(e){e.forEach(t=>{ab.add(t),E&&g.log(`AI provider "${t}" wrapping will be skipped`)})}function Cn(e){return ab.has(e)}function cb(){ab.clear(),E&&g.log("Cleared AI provider skip registrations")}function rV(e,t){return t.some(n=>e.includes(n))}function lb(e,t,n){if(t===!1)return!0;let r=e.toLowerCase(),i=n!=null?[...rb,...n]:rb;if(rV(r,i))return!0;if(t===!0)return!1;let s=("deny"in t?t.deny:t.allow).some(c=>r.includes(c.toLowerCase()));return"deny"in t?s:!s}function pa(e,t,n){if(t===!1)return{};let r={};for(let i of Object.keys(e))r[i]=lb(i,t,n)?la:e[i];return r}function aO(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf("=",n);if(r===-1)break;let i=e.indexOf(";",n);if(i===-1)i=e.length;else if(i<r){n=e.lastIndexOf(";",r-1)+1;continue}let o=e.slice(n,r).trim();if(t[o]===void 0){let s=e.slice(r+1,i).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));try{t[o]=s.indexOf("%")!==-1?decodeURIComponent(s):s}catch{t[o]=s}}n=i+1}return t}function ua(e,t){if(!(!e||t===!1))return e.split("&").map(n=>{let r=n.indexOf("="),i=r===-1?n:n.slice(0,r),o=new URLSearchParams(`${i}=`).keys().next().value;return o!==void 0&&lb(o,t)?`${i}=${la}`:n}).join("&")}function el(e,t){let n=e.indexOf("#"),r=n===-1?e.length:n,i=e.indexOf("?");if(i===-1||i>r)return e;let o=e.slice(0,i),s=e.slice(i+1,r),c=e.slice(r),a=ua(s,t);return a?`${o}?${a}${c}`:`${o}${c}`}function cO(e){return(e??C())?.getDataCollectionOptions().urlQueryParams??!0}function Ct(e,t){return e===void 0?void 0:el(e,cO(t))}function Wn(e,t){if(!e)return e;let n=e.startsWith("?"),r=ua(n?e.slice(1):e,cO(t));return r&&n?`?${r}`:r}var iV=new Set(["false","f","n","no","off","0"]),oV=new Set(["true","t","y","yes","on","1"]);function Xo(e,t){let n=String(e).toLowerCase();return iV.has(n)?!1:oV.has(n)?!0:t?.strict?null:!!e}function lO(e,t,n,r,i){let o={sent_at:new Date(tt()).toISOString()};n?.sdk&&(o.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(o.dsn=rn(i)),t&&(o.trace=t);let s=sV(e);return Lt(o,[s])}function sV(e){return[{type:"check_in"},e]}var aV="thismessage:/";function pr(e){return"isRelative"in e}function ur(e,t){let n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=t??(n?aV:void 0);try{if("canParse"in URL&&!URL.canParse(e,r))return;let i=new URL(e,r);return n?{isRelative:n,pathname:i.pathname,search:i.search,hash:i.hash}:i}catch{}}function pO(e){if(pr(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 cV(e,t,n,r){let i=n?.method?.toUpperCase()??"GET",o=r||(e?t==="client"?pO(e):e.pathname:"/");return`${i} ${o}`}function pb(e,t,n,r,i,o){let s={[S]:n,[ve]:"url"};return i&&(s[t==="server"?"http.route":"url.template"]=i,s[ve]="route"),r?.method&&(s[j_]=r.method.toUpperCase()),e&&(e.search&&(s["url.query"]=Wn(e.search,o)),e.hash&&(s["url.fragment"]=e.hash),e.pathname&&(s["url.path"]=e.pathname,e.pathname==="/"&&(s[ve]="route")),pr(e)||(s[pt]=Ct(e.href,o),e.port&&(s["url.port"]=e.port),e.protocol&&(s["url.scheme"]=e.protocol),e.hostname&&(s[t==="server"?"server.address":"url.domain"]=e.hostname))),[cV(e,t,r,i),s]}function Ki(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 dr(e){return e.split(/[?#]/,1)[0]}function qi(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${i}${r}`}function tl(e,t=!0){if(e.startsWith("data:")){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),o=e.indexOf(","),s="";if(t&&o!==-1){let c=e.slice(o+1);s=c.length>10?`${c.slice(0,10)}... [truncated]`:c}return`data:${r}${i?",base64":""}${s?`,${s}`:""}`}return e}function ub(e,t){let n=t?.getDsn(),r=t?.getOptions().tunnel;return pV(e,n)||lV(e,r)}function lV(e,t){return t?uO(e)===uO(t):!1}function pV(e,t){let n=ur(e);return!n||pr(n)||!t?!1:uV(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function uV(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function uO(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function Gu(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 db=Gu;function Ko(e,t,n=[t],r="npm"){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(o=>({name:`${r}:@sentry/${o}`,version:q})),i.version=q)}function $e(e={}){let t=e.client||C();if(!jo()||!t)return{};let n=Je(),r=St(n);if(r.getTraceData)return r.getTraceData(e);let i=e.scope||ne(),o=e.span||Q(),s=Vi(o)&&!Ue(t.getOptions());if(!o&&L_())return{};let c=o&&!s?Lc(o):dV(i),a=o?nt(o):or(t,i),l=Hi(a);if(!cu.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=o&&!s?Hv(o):mV(i)),u}function dV(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Fi(t,r,n)}function mV(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Wi(t,r,n)}var dO="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function qo(e,t,n){if(typeof e!="string"||!t)return!0;let r=n?.get(e);if(r!==void 0)return E&&!r&&g.log(dO,e),r;let i=fn(e,t);return n?.set(e,i),E&&!i&&g.log(dO,e),i}function mb(e){return Object.entries(e||$e()).map(([t,n])=>`<meta name="${t}" content="${n}"/>`).join("")}function nl(e){return Array.from(new Set(e))}var mO=1024*1024;function fb(e){return e==="small"?1e3:e==="medium"?1e4:mO}function fO(e){let t={};try{e.forEach((n,r)=>{typeof n=="string"&&(t[r]=n)})}catch{}return t}function Du(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 Qo(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),o=(typeof t["x-forwarded-proto"]=="string"?t["x-forwarded-proto"]:void 0)||e.protocol||(e.socket?.encrypted?"https":"http"),s=e.url||"",c=fV({url:s,host:r,protocol:o}),a=e.body||void 0,l=e.cookies;return{url:c,method:e.method,query_string:gO(s),headers:Du(t),cookies:l,data:a}}function fV({url:e,protocol:t,host:n}){if(e?.startsWith("http"))return e;if(e&&n)return`${t}://${n}${e}`}function Hr(e,t=!1,n="request"){let r=typeof t=="boolean"?Lu(t):t,i=n==="request"?r.httpHeaders.request:r.httpHeaders.response,o=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(o===!1)continue;if(typeof p=="string"&&p!==""){let m=gV(p,u==="set-cookie"),_=pa(m,o,K0);for(let[h,b]of Object.entries(_))c[`${s}${Uu(u)}.${Uu(h)}`]=b}else c[`${s}${Uu(u)}`]=la}else{if(i===!1)continue;Array.isArray(p)?a[u]=p.map(m=>m!=null?String(m):m).join(";"):typeof p=="string"&&(a[u]=p)}}if(i!==!1){let l=pa(a,i);for(let[p,u]of Object.entries(l))c[`${s}${Uu(p)}`]=u}}catch{}return c}function Uu(e){return e.replace(/-/g,"_")}function gV(e,t){let n=e.indexOf(";"),r=t&&n!==-1?e.substring(0,n):e,i=t?[r]:r.split("; "),o={};for(let s of i){let c=s.indexOf("="),a=(c!==-1?s.substring(0,c):s).toLowerCase(),l=c!==-1?s.substring(c+1):"";o[a]=l}return o}function gO(e){if(e)try{let t=new URL(e,"http://s.io").search.slice(1);return t.length?t:void 0}catch{return}}var U={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},_V={[U.INTERNAL]:"INTERNAL",[U.SERVER]:"SERVER",[U.CLIENT]:"CLIENT",[U.PRODUCER]:"PRODUCER",[U.CONSUMER]:"CONSUMER"};function gb(e){return _V[e]}var hV=100;function on(e,t){let n=C(),r=J();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=hV}=n.getOptions();if(o<=0)return;let c={timestamp:Rr(),...e},a=i?Me(()=>i(c,t)):c;a!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}var bV="FunctionToString",_O=new WeakMap,yV=(()=>({name:bV,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Nr(this),r;try{_O.has(C())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){_O.set(e,!0)}})),rl=yV;var SV=[/^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$/],EV="EventFilters",Hu=(e={})=>{let t;return{name:EV,setup(n){let r=n.getOptions();t=hO(e,r)},processEvent(n,r,i){if(!t){let o=i.getOptions();t=hO(e,o)}return TV(n,t)?null:n}}},il=((e={})=>({...Hu(e),name:"InboundFilters"}));function hO(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:SV],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function TV(e,t){if(e.type){if(e.type==="transaction"&&AV(e,t.ignoreTransactions))return E&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
14
|
-
Event: ${Di(e)}`),!0}else{if(IV(e,t.ignoreErrors))return E&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
15
|
-
Event: ${Di(e)}`),!0;if(OV(e))return E&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
16
|
-
Event: ${Di(e)}`),!0;if(NV(e,t.denyUrls))return E&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
17
|
-
Event: ${Di(e)}.
|
|
18
|
-
Url: ${Bu(e)}`),!0;if(!vV(e,t.allowUrls))return E&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
19
|
-
Event: ${Di(e)}.
|
|
20
|
-
Url: ${Bu(e)}`),!0}return!1}function IV(e,t){return t?.length?ku(e).some(n=>fn(n,t)):!1}function AV(e,t){if(!t?.length)return!1;let n=e.transaction;return n?fn(n,t):!1}function NV(e,t){if(!t?.length)return!1;let n=Bu(e);return n?fn(n,t):!1}function vV(e,t){if(!t?.length)return!0;let n=Bu(e);return n?fn(n,t):!0}function RV(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 Bu(e){try{let n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?RV(n):null}catch{return E&&g.error(`Cannot extract url for event ${Di(e)}`),null}}function OV(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function SO(e,t,n,r,i,o){if(!i.exception?.values||!o||!et(o.originalException))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=_b(e,t,r,o.originalException,n,i.exception.values,s,0))}function _b(e,t,n,r,i,o,s,c){if(o.length>=n+1)return o;let a=[...o];if(et(r[i])){bO(s,c,r);let l=e(t,r[i]),p=a.length;yO(l,i,p,c),a=_b(e,t,n,r[i],i,[l,...a],l,p)}return EO(r)&&r.errors.forEach((l,p)=>{if(et(l)){bO(s,c,r);let u=e(t,l),d=a.length;yO(u,`errors[${p}]`,d,c),a=_b(e,t,n,l,i,[u,...a],u,d)}}),a}function EO(e){return Array.isArray(e.errors)}function bO(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...EO(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function yO(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function TO(e,t){return e(t.stack||"",1)}function CV(e){return et(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function xV(e){return CV(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function hb(e,t){let n={type:t.name||t.constructor.name,value:xV(t)},r=TO(e,t);return r.length&&(n.stacktrace={frames:r}),n}function PV(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(et(n))return n}}function kV(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=E_(e);if(h_(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=LV(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${t}`}function LV(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function MV(e,t,n,r){if(et(n))return[n,void 0];if(t.synthetic=!0,Yt(n)){let o=e?.getOptions().normalizeDepth,s={__serialized__:I_(n,o)},c=PV(n);if(c)return[c,s];let a=kV(n),l=r?.syntheticException||new Error(a);return l.message=a,[l,s]}let i=r?.syntheticException||new Error(n);return i.message=`${n}`,[i,void 0]}function IO(e,t,n,r){let o=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[s,c]=MV(e,o,n,r),a={exception:{values:[hb(t,s)]}};return c&&(a.extra=c),O_(a,void 0,void 0),Dn(a,o),{...a,event_id:r?.event_id}}function AO(e,t,n="info",r,i){let o={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let s=TO(e,r.syntheticException);s.length&&(o.exception={values:[{value:t,stacktrace:{frames:s}}]},Dn(o,{synthetic:!0}))}if(Ui(t)){let{__sentry_template_string__:s,__sentry_template_values__:c}=t;return o.logentry={message:s,params:c},o}return o.message=t,o}var wV="cause",GV=5,UV="LinkedErrors",DV=((e={})=>{let t=e.limit||GV,n=e.key||wV;return{name:UV,preprocessEvent(r,i,o){let s=o.getOptions();SO(hb,s.stackParser,n,t,r,i)}}}),ol=DV;var bb=["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 yb(e){let t={};for(let o of Object.keys(e))t[o.toLowerCase()]=e[o];return bb.map(o=>{let s=t[o.toLowerCase()],c=Array.isArray(s)?s.join(";"):s;return o==="Forwarded"?BV(c):c?.split(",").map(a=>a.trim())}).reduce((o,s)=>s?o.concat(s):o,[]).find(o=>o!==null&&HV(o))||null}function BV(e){if(!e)return null;for(let t of e.split(";"))if(t.startsWith("for="))return t.slice(4);return null}function HV(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 FV="RequestData",WV=((e={})=>{function t(n){let r=n.getDataCollectionOptions(),i={...r,...e.include?.cookies===!0&&r.cookies===!1&&{cookies:!0},...e.include?.headers===!0&&r.httpHeaders.request===!1&&{httpHeaders:{...r.httpHeaders,request:!0}},...e.include?.query_string===!0&&r.urlQueryParams===!1&&{urlQueryParams:!0}};return{dataCollection:i,include:{cookies:i.cookies!==!1,data:!0,headers:i.httpHeaders.request!==!1,ip:i.userInfo,query_string:i.urlQueryParams!==!1,url:!0,...e.include}}}return{name:FV,processEvent(n,r,i){let{sdkProcessingMetadata:o={}}=n,{normalizedRequest:s,ipAddress:c}=o,{include:a,dataCollection:l}=t(i);return s&&VV(n,s,{ipAddress:c},a,l),n},processSegmentSpan(n,r){let{sdkProcessingMetadata:i={}}=J().getScopeData(),{normalizedRequest:o,ipAddress:s}=i;if(!o)return;let{include:c,dataCollection:a}=t(r);YV(n,o,s,c,a)}}}),sl=WV;function VV(e,t,n,r,i){let o=NO(t,r);if(o.query_string&&(o.query_string=vO(o.query_string,i.urlQueryParams)),o.url&&(o.url=el(o.url,i.urlQueryParams)),e.request={...e.request,...o},r.ip){let s=t.headers&&yb(t.headers)||n.ipAddress;s&&(e.user={...e.user,ip_address:s})}}function YV(e,t,n,r,i){let o=NO(t,r),s={};if(o.url&&(s[pt]=el(o.url,i.urlQueryParams)),o.method&&(s["http.request.method"]=o.method),o.query_string&&(s[Ou]=vO(o.query_string,i.urlQueryParams)),Gt(e,s),o.cookies&&Object.keys(o.cookies).length>0){let c=Object.entries(o.cookies).map(([l,p])=>`${l}=${p}`).join("; "),a=Hr({cookie:c},i,"request");Gt(e,a)}if(o.headers){let c=Hr(o.headers,i,"request");Gt(e,c)}if(o.data!=null){let c=typeof o.data=="string"?o.data:JSON.stringify(o.data);c&&Gt(e,{"http.request.body.data":c})}if(r.ip){let c=t.headers&&yb(t.headers)||n||void 0;c&&Gt(e,{[Oc]:c})}}function NO(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let i=new Set(bb.map(o=>o.toLowerCase()));for(let o of Object.keys(r))i.has(o.toLowerCase())&&delete r[o]}if(n.method=e.method,t.url&&(n.url=e.url),t.cookies){let i=e.cookies||(r?.cookie?aO(r.cookie):void 0);n.cookies=i||{}}return t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function vO(e,t){let n=jV(e);return n?ua(n,t):void 0}function jV(e){if(typeof e=="string")return e||void 0;let t=Array.isArray(e)?e:Object.entries(e);return new URLSearchParams(t).toString()||void 0}var Fu=new Set([]);function da(e){let t="console",n=__(t,e);return Rc(t,ZV),n}function OO(e){for(let t of e)Fu.add(t);return()=>{for(let t of e)Fu.delete(t)}}var RO=new Set;function ZV(){"console"in te&&zn.forEach(function(e){RO.has(e)||!(e in te.console)||(RO.add(e),kt(te.console,e,function(t){return $n[e]=t,function(...n){let r=n[0],i=$n[e],o=Fu.size&&typeof r=="string"&&fn(r,Fu);o||Cs("console",{args:n,level:e}),(!o||E&&g.isEnabled())&&i?.apply(te.console,n)}}))})}function Qi(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var XV="CaptureConsole",KV=((e={})=>{let t=e.levels||zn,n=e.handled??!0;return{name:XV,setup(r){"console"in te&&da(({args:i,level:o})=>{C()!==r||!t.includes(o)||qV(i,o,n)})}}}),Sb=KV;function qV(e,t,n){let r=Qi(t),i=new Error,o={level:Qi(t),extra:{arguments:e}};Be(s=>{if(s.addEventProcessor(l=>(l.logger="console",Dn(l,{handled:n,type:"auto.core.capture_console"}),l)),t==="assert"){if(!e[0]){let l=`Assertion failed: ${Ls(e.slice(1)," ")||"console.assert"}`;s.setExtra("arguments",e.slice(1)),s.captureMessage(l,r,{captureContext:o,syntheticException:i})}return}let c=e.find(l=>l instanceof Error);if(c){me(c,o);return}let a=Ls(e," ");s.captureMessage(a,r,{captureContext:o,syntheticException:i})})}var QV="Dedupe",JV=(()=>{let e;return{name:QV,processEvent(t){if(t.type)return t;try{if($V(t,e))return E&&g.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),Eb=JV;function $V(e,t){return t?!!(zV(e,t)||eY(e,t)):!1}function zV(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!PO(e,t)||!xO(e,t))}function eY(e,t){let n=CO(t),r=CO(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!PO(e,t)||!xO(e,t))}function xO(e,t){let n=zp(e),r=zp(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){let o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function PO(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 CO(e){return e.exception?.values?.[0]}var tY="ExtraErrorData",nY=((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:tY,processEvent(r,i,o){let{maxValueLength:s}=o.getOptions();return rY(r,i,t,n,s)}}}),Tb=nY;function rY(e,t={},n,r,i){if(!t.originalException||!et(t.originalException))return e;let o=t.originalException.name||t.originalException.constructor.name,s=kO(t.originalException,r,i);if(s){let c={...e.contexts},a=Ke(s,n);return Yt(a)&&(lv(a),c[o]=a),{...e,contexts:c}}return e}function kO(e,t,n){try{let r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],i={};for(let o of Object.keys(e)){if(r.indexOf(o)!==-1)continue;let s=e[o];i[o]=et(s)||typeof s=="string"?n?mn(`${s}`,n):`${s}`:s}if(t&&e.cause!==void 0)if(et(e.cause)){let o=e.cause.name||e.cause.constructor.name;i.cause={[o]:kO(e.cause,!1,n)}}else i.cause=e.cause;if(typeof e.toJSON=="function"){let o=e.toJSON();for(let s of Object.keys(o)){let c=o[s];i[s]=et(c)?c.toString():c}}return i}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 i=e[r];i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var oY=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function MO(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=oY.exec(t);return n?n.slice(1):[]}function Ib(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:"/";i&&(t=`${i}/${t}`,n=i.charAt(0)==="/")}return t=iY(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function LO(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 Ab(e,t){e=Ib(e).slice(1),t=Ib(t).slice(1);let n=LO(e.split("/")),r=LO(t.split("/")),i=Math.min(n.length,r.length),o=i;for(let c=0;c<i;c++)if(n[c]!==r[c]){o=c;break}let s=[];for(let c=o;c<n.length;c++)s.push("..");return s=s.concat(r.slice(o)),s.join("/")}function Nb(e){let t=MO(e),n=t[0]||"",r=t[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}function vb(e,t){let n=MO(e)[2]||"";return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var sY="RewriteFrames",Rb=(e={})=>{let t=e.root,n=e.prefix||"app:///",r="window"in te&&!!te.window,i=e.iteratee||aY({isBrowser:r,root:t,prefix:n});function o(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=>i(a))}}return{name:sY,processEvent(c){let a=c;return c.exception&&Array.isArray(c.exception.values)&&(a=o(a)),a}}};function aY({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),o=/^\//.test(r.filename);if(e){if(t){let s=r.filename;s.indexOf(t)===0&&(r.filename=s.replace(t,n))}}else if(i||o){let s=i?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,c=t?Ab(t,s):vb(s);r.filename=`${n}${c}`}return r}}var cY=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],lY=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],pY={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"},GO=["select","insert","upsert","update","delete"];function Wu(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Vu(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function UO(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function uY(e,t){return UO(e,t)!==void 0}function DO(e,t){if(!e)return;if(typeof e.get=="function")return e.get(t)??void 0;let n=e,r=t.toLowerCase(),i=Object.keys(n).find(o=>o.toLowerCase()===r);return i!==void 0?n[i]:void 0}function dY(e,t={}){switch(e){case"GET":return"select";case"POST":return DO(t,"Prefer")?.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return"<unknown-op>"}}function mY(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("."),i;return n?.startsWith("fts")?i="textSearch":n?.startsWith("plfts")?i="textSearch[plain]":n?.startsWith("phfts")?i="textSearch[phrase]":n?.startsWith("wfts")?i="textSearch[websearch]":i=n&&pY[n]||"filter",`${i}(${e}, ${r.join(".")})`}function wO(e,t=!1){return new Proxy(e,{apply(n,r,i){return Se({name:`auth ${t?"(admin) ":""}${e.name}`,attributes:{[S]:"auto.db.supabase",[B]:"db","db.system":"postgresql","db.operation":`auth.${t?"admin.":""}${e.name}`}},o=>Reflect.apply(n,r,i).then(s=>(V(s)&&"error"in s&&s.error?(o.setStatus({code:2}),me(s.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):o.setStatus({code:1}),o.end(),s)).catch(s=>{throw o.setStatus({code:2}),o.end(),me(s,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),s}).then(...i))}})}function fY(e){let t=e.auth;if(!(!t||Vu(e.auth))){for(let n of cY){let r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=wO(r))}for(let n of lY){let r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=wO(r,!0))}Wu(e.auth)}}function gY(e,t){Vu(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(n,r,i){let o=Reflect.apply(n,r,i),s=o.constructor;return hY(s,t),o}}),Wu(e.prototype.from))}function _Y(e,t){Vu(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(n,r,i){let o=GO,s=r,c=dY(s.method,s.headers);if(!o.includes(c)||!s?.url?.pathname||typeof s.url.pathname!="string")return Reflect.apply(n,r,i);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(mY(v,P));let u=Object.create(null);if(Yt(s.body))for(let[v,P]of Object.entries(s.body))u[v]=P;let d=C(),m=t.sendOperationData??d?.getDataCollectionOptions().databaseQueryData===!0,_=UO(s.body,u),h=c==="select"?"":`${c}${uY(s.body,u)?"(...) ":""}`,b=m?p.join(" "):p.length>0?"[redacted]":"",N=[h.trimEnd(),b].filter(Boolean).join(" "),M=N?`${N} from(${l})`:`from(${l})`,R={"db.table":l,"db.schema":s.schema,"db.url":s.url.origin,"db.sdk":DO(s.headers,"X-Client-Info"),"db.system":"postgresql","db.operation":c,[S]:"auto.db.supabase",[B]:"db"};return p.length&&m&&(R["db.query"]=p),_!==void 0&&m&&(R["db.body"]=_),Se({name:M,attributes:R},v=>Reflect.apply(n,r,[]).then(P=>{if(v&&(P&&typeof P=="object"&&"status"in P&&Bs(v,P.status||500),v.end()),P?.error){let H=new Error(P.error.message);P.error.code&&(H.code=P.error.code),P.error.details&&(H.details=P.error.details);let L={};p.length&&m&&(L.query=p),_!==void 0&&m&&(L.body=_),me(H,G=>(G.addEventProcessor(ce=>(Dn(ce,{handled:!1,type:"auto.db.supabase.postgres"}),ce)),G.setContext("supabase",L),G))}let D={type:"supabase",category:`db.${c}`,message:M},I={};return p.length&&m&&(I.query=p),_!==void 0&&m&&(I.body=_),Object.keys(I).length&&(D.data=I),on(D),P},P=>{throw v&&(Bs(v,500),v.end()),P}).then(...i))}}),Wu(e.prototype.then))}function hY(e,t){for(let n of GO)Vu(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(r,i,o){let s=Reflect.apply(r,i,o),c=s.constructor;return E&&g.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),_Y(c,t),s}}),Wu(e.prototype[n]))}var Yu=(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;gY(n,t),fY(e)},bY="Supabase",yY=((e,t)=>({setupOnce(){Yu(e,t)},name:bY})),Ob=e=>yY(e.supabaseClient,{sendOperationData:e.sendOperationData});var SY=10,EY="ZodErrors";function TY(e){return et(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function IY(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 AY(e){return e.map(t=>typeof t=="number"?"<array>":t).join(".")}function NY(e){let t=new Set;for(let r of e.issues){let i=AY(r.path);i.length>0&&t.add(i)}let n=Array.from(t);if(n.length===0){let r="variable";if(e.issues.length>0){let i=e.issues[0];i!==void 0&&"expected"in i&&typeof i.expected=="string"&&(r=i.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${mn(n.join(", "),100)}`}function vY(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!TY(r.originalException)||r.originalException.issues.length===0)return n;try{let o=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(IY);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:o})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:NY(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":o.slice(0,e)}}}catch(i){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:i instanceof Error?`${i.name}: ${i.message}
|
|
21
|
-
${i.stack}`:"unknown"}}}}}var RY=((e={})=>{let t=e.limit??SY;return{name:EY,processEvent(n,r){return vY(t,e.saveZodIssuesAsAttachment,n,r)}}}),Cb=RY;var OY="Console",xb=(e={})=>{let t=new Set(e.levels||zn);return{name:OY,setup(n){let r=da(({args:i,level:o})=>{C()!==n||!t.has(o)||CY(o,i)});if(n.registerCleanup(r),e.filter){let i=OO(e.filter);n.registerCleanup(i)}}}};function CY(e,t){let n={category:"console",data:{arguments:t,logger:"console"},level:Qi(e),message:BO(t)};if(e==="assert")if(t[0]===!1){let r=t.slice(1);n.message=r.length>0?`Assertion failed: ${BO(r)}`:"Assertion failed",n.data.arguments=r}else return;on(n,{input:t,level:e})}function BO(e){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):Ls(e," ")}var xY=100,PY=10,ju="flag.evaluation.";function Zu(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 Xu(e,t,n=xY){let r=ne().getScopeData().contexts;r.flags||(r.flags={values:[]});let i=r.flags.values;kY(i,e,t,n)}function kY(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 i=e.findIndex(o=>o.flag===t);i!==-1&&e.splice(i,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function Ku(e,t,n=PY){if(typeof t!="boolean")return;let r=Q();if(!r)return;let i=oe(r).data;if(`${ju}${e}`in i){r.setAttribute(`${ju}${e}`,t);return}Object.keys(i).filter(s=>s.startsWith(ju)).length<n&&r.setAttribute(`${ju}${e}`,t)}var Pb=()=>({name:"FeatureFlags",processEvent(e,t,n){return Zu(e)},addFeatureFlag(e,t){Xu(e,t),Ku(e,t)}});var kb=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){let t=e.prototype;typeof t.isOn=="function"&&kt(t,"isOn",HO),typeof t.getFeatureValue=="function"&&kt(t,"getFeatureValue",HO)},processEvent(t,n,r){return Zu(t)}});function HO(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&(Xu(n,r),Ku(n,r)),r}}var LY="ConversationId",MY=(()=>({name:LY,setup(e){e.on("spanStart",t=>{let n=ne().getScopeData(),r=J().getScopeData(),i=n.conversationId||r.conversationId;if(i){let{op:o,data:s,description:c}=oe(t);if(!o?.startsWith("gen_ai.")&&!s["ai.operationId"]&&!c?.startsWith("ai."))return;t.setAttribute(Uo,i)}})}})),Lb=MY;function FO(e){return!!e&&typeof e._profiler<"u"&&typeof e._profiler.start=="function"&&typeof e._profiler.stop=="function"}function wY(){let e=C();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(!FO(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.start()}function GY(){let e=C();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(!FO(t)){E&&g.warn("Profiler is not available on profiling integration.");return}t._profiler.stop()}var Mb={startProfiler:wY,stopProfiler:GY};function wb(e,t={},n=ne()){let{message:r,name:i,email:o,url:s,source:c,associatedEventId:a,tags:l}=e,p={contexts:{feedback:{contact_email:o,name:i,message:r,url:s,source:c,associated_event_id:a}},type:"feedback",level:"info",tags:l},u=n?.getClient()||C();return u&&u.emit("beforeSendFeedback",p,t),n.captureEvent(p,t)}function ma(e,t,n){return"util"in te&&typeof te.util.format=="function"?te.util.format(...e):UY(e,t,n)}function UY(e,t,n){return e.map(r=>er(r)?String(r):JSON.stringify(Ke(r,t,n))).join(" ")}function qu(e){return/%[sdifocO]/.test(e)}function Qu(e,t){let n={},r=new Array(t.length).fill("{}").join(" ");return n["sentry.message.template"]=`${e} ${r}`,t.forEach((i,o)=>{n[`sentry.message.parameter.${o}`]=i}),n}var DY="ConsoleLogs",WO={[S]:"auto.log.console"},BY=((e={})=>{let t=e.levels||zn;return{name:DY,setup(n){let{enableLogs:r,normalizeDepth:i=3,normalizeMaxBreadth:o=1e3}=n.getOptions();if(!r){E&&g.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let s=da(({args:c,level:a})=>{if(C()!==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: ${ma(p,i,o)}`:"Assertion failed";lr({level:"error",message:m,attributes:WO})}return}let u=a==="log",d={...WO};if(Yt(l)){Object.assign(d,Ke(l,i,o));let m=typeof c[1]=="string"?2:1;c.slice(m).forEach((h,b)=>{d[`sentry.message.parameter.${b}`]=Ke(h,i,o)})}else if(p.length>0&&typeof l=="string"&&!qu(l)){let _=Qu(l,p);for(let[h,b]of Object.entries(_))d[h]=h.startsWith("sentry.message.parameter.")?Ke(b,i,o):b}lr({level:u?"info":a,message:ma(c,i,o),severityNumber:u?10:void 0,attributes:d})});n.registerCleanup(s)}}}),Gb=BY;var ft={};ZN(ft,{count:()=>HY,distribution:()=>WY,gauge:()=>FY});function Ub(e,t,n,r){tb({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function HY(e,t=1,n){Ub("counter",e,t,n)}function FY(e,t,n){Ub("gauge",e,t,n)}function WY(e,t,n){Ub("distribution",e,t,n)}var VY=["trace","debug","info","warn","error","fatal"];function Db(e={}){let t=new Set(e.levels??VY),n=e.client;return{log(r){let{type:i,level:o,message:s,args:c,tag:a,date:l,...p}=r,u=n||C();if(!u)return;let d=ZY(i,o);if(!t.has(d))return;let{normalizeDepth:m=3,normalizeMaxBreadth:_=1e3}=u.getOptions(),h={};for(let[N,M]of Object.entries(p))h[N]=Ke(M,m,_);h["sentry.origin"]="auto.log.consola",a&&(h["consola.tag"]=a),i&&(h["consola.type"]=i),o!=null&&typeof o=="number"&&(h["consola.level"]=o);let b=KY(XY(c,m,_),m,_);b?.attributes&&Object.assign(h,b.attributes),lr({level:d,message:b?.message||s||c&&ma(c,m,_)||"",attributes:h})}}}var YY={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"},jY={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function ZY(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){let n=YY[e];if(n)return n}if(typeof t=="number"){let n=jY[t];if(n)return n}return"info"}function XY(e,t,n){if(!e?.length)return{message:""};let r=ma(e,t,n),i=e[0];if(Yt(i)){let o=typeof e[1]=="string"?2:1,s=e.slice(o);return{message:r,attributes:i,messageParameters:s}}else{let o=e.slice(1),s=o.length>0&&typeof i=="string"&&!qu(i);return{message:r,messageTemplate:s?i:void 0,messageParameters:s?o:void 0}}}function KY(e,t,n){let{message:r,attributes:i,messageTemplate:o,messageParameters:s}=e,c={};if(o&&s){let a=Qu(o,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(i,t,n),...c}}}var VO="gen_ai.prompt",Fr="gen_ai.system",De="gen_ai.request.model",fa="gen_ai.request.stream",Ji="gen_ai.request.temperature",ga="gen_ai.request.max_tokens",$i="gen_ai.request.frequency_penalty",_a="gen_ai.request.presence_penalty",zi="gen_ai.request.top_p",Ju="gen_ai.request.top_k",$u="gen_ai.request.encoding_format",zu="gen_ai.request.dimensions",Wr="gen_ai.response.finish_reasons",sn="gen_ai.response.model",eo="gen_ai.response.id",YO="gen_ai.response.stop_reason",it="gen_ai.usage.input_tokens",ut="gen_ai.usage.output_tokens",Dt="gen_ai.usage.total_tokens",ot="gen_ai.operation.name",xt="sentry.sdk_meta.gen_ai.input.messages.original_length",Bt="gen_ai.input.messages",jO="gen_ai.output.messages",$t="gen_ai.system_instructions",zt="gen_ai.response.text",Vn="gen_ai.request.available_tools",ZO="gen_ai.response.streaming",bn="gen_ai.response.tool_calls",to="gen_ai.agent.name",XO="gen_ai.pipeline.name",no="gen_ai.conversation.id",KO="gen_ai.usage.cache_creation_input_tokens",qO="gen_ai.usage.cache_read_input_tokens",Bb="gen_ai.usage.input_tokens.cache_write",ro="gen_ai.usage.input_tokens.cached",QO="gen_ai.invoke_agent",io="gen_ai.embeddings.input",Hb="gen_ai.embeddings",Fb="gen_ai.execute_tool",Vr="gen_ai.tool.name",al="gen_ai.tool.call.id",cl="gen_ai.tool.type",ha="gen_ai.tool.input",ba="gen_ai.tool.output",ya="gen_ai.tool.description";function oo(e){return!e||typeof e!="object"?!1:QY(e)||$O(e)||qY(e)||zO(e)||eC(e)||JY(e)||$Y(e)||zY(e)||e5(e)||t5(e)||n5(e)||r5(e)}function qY(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):JO(e):!1}function JO(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 QY(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&oo(e.source)}function $O(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function zO(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 eC(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 JY(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function $Y(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 zY(e){return"type"in e&&e.type==="image"&&"image"in e&&typeof e.image=="string"&&!e.image.startsWith("http://")&&!e.image.startsWith("https://")}function e5(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function t5(e){return"b64_json"in e}function n5(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function r5(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}var ll="[Blob substitute]",i5=["image_url","data","content","b64_json","result","uri","image"];function Jo(e){let t={...e};oo(t.source)&&(t.source=Jo(t.source)),$O(e)&&(t.inlineData={...e.inlineData,data:ll}),JO(e)&&(t.image_url={...e.image_url,url:ll}),zO(e)&&(t.input_audio={...e.input_audio,data:ll}),eC(e)&&(t.file={...e.file,file_data:ll});for(let n of i5)typeof t[n]=="string"&&(t[n]=ll);return t}var nC=2e4,ed=e=>new TextEncoder().encode(e).length,Vb=e=>ed(JSON.stringify(e));function td(e,t){if(ed(e)<=t)return e;let n=0,r=e.length,i="";for(;n<=r;){let o=Math.floor((n+r)/2),s=e.slice(0,o);ed(s)<=t?(i=s,n=o+1):r=o-1}return i}function o5(e){return typeof e=="string"?e:"text"in e&&typeof e.text=="string"?e.text:""}function tC(e,t){return typeof e=="string"?t:{...e,text:t}}function s5(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function rC(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function iC(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function a5(e,t){let n={...e,content:""},r=Vb(n),i=t-r;if(i<=0)return[];let o=td(e.content,i);return[{...e,content:o}]}function c5(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 l5(e,t){let{key:n,items:r}=c5(e);if(n===null||r.length===0)return[];let i=r.map(a=>tC(a,"")),o=Vb({...e,[n]:i}),s=t-o;if(s<=0)return[];let c=[];for(let a of r){let l=o5(a),p=ed(l);if(p<=s)c.push(a),s-=p;else if(c.length===0){let u=td(l,s);u&&c.push(tC(a,u));break}else break}return c.length<=0?[]:[{...e,[n]:c}]}function p5(e,t){if(!e)return[];if(typeof e=="string"){let n=td(e,t);return n?[n]:[]}return typeof e!="object"?[]:s5(e)?a5(e,t):rC(e)||iC(e)?l5(e,t):[]}function Wb(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(rC(n)?r={...n,content:Wb(n.content)}:"content"in n&&oo(n.content)&&(r={...n,content:Jo(n.content)}),iC(n)&&(r={...r??n,parts:Wb(n.parts)}),oo(r)?r=Jo(r):oo(n)&&(r=Jo(n))),r??n})}function u5(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=Wb([r]),o=i[0];return Vb(o)<=n?i:p5(o,n)}function oC(e){return u5(e,nC)}function sC(e){return td(e,nC)}function Ze(e){let t=C()?.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=C();return t?!rt(t)&&t.getOptions().streamGenAiSpans===!1:!0}function nd(e,t){return e?`${e}.${t}`:t}function aC(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[it]:t}),n!==void 0&&e.setAttributes({[ut]:n}),t!==void 0||n!==void 0||r!==void 0||i!==void 0){let o=(t??0)+(n??0)+(r??0)+(i??0);e.setAttributes({[Dt]:o})}}function $o(e,t,n){if(!e.isRecording())return;let r={[ZO]:!0};t.responseId&&(r[eo]=t.responseId),t.responseModel&&(r[sn]=t.responseModel),t.promptTokens!==void 0&&(r[it]=t.promptTokens),t.completionTokens!==void 0&&(r[ut]=t.completionTokens),t.totalTokens!==void 0?r[Dt]=t.totalTokens:(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Dt]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)),t.finishReasons.length&&(r[Wr]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[zt]=t.responseTexts.join("")),n&&t.toolCalls.length&&(r[bn]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Ht(e){if(typeof e=="string")return sC(e);try{return JSON.stringify(Array.isArray(e)?oC(e):e)}catch{return"[unserializable]"}}function xn(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 i=JSON.stringify([{type:"text",content:r}]),o=[...e.slice(0,t),...e.slice(t+1)];return{systemInstructions:i,filteredMessages:o}}async function d5(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r=="object"&&"data"in r?{...r,data:n}:n}function Sa(e,t){return bt(e)?new Proxy(e,{get(n,r){let o=r in Promise.prototype||r===Symbol.toStringTag?t:n,s=Reflect.get(o,r);return r==="withResponse"&&typeof s=="function"?function(){let a=s.call(n);return d5(a,t)}:typeof s=="function"?s.bind(o):s}}):t}var cC="WorkersAI";var pl=new Map,rd=new Map,id=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 od="operation.name",sd="ai.operationId",ad="ai.prompt",lC="ai.schema",pC="ai.response.object",Yb="ai.values",jb="ai.response.text",Zb="ai.response.toolCalls",uC="ai.response.finishReason",zo="ai.prompt.messages",Ii="ai.prompt.tools",ul="ai.model.id",dC="ai.response.providerMetadata",mC="ai.usage.cachedInputTokens",fC="ai.usage.inputTokenDetails.",gC="ai.telemetry.functionId",_C="ai.usage.completionTokens",hC="ai.usage.promptTokens",bC="ai.usage.tokens",Xb="ai.toolCall.name",Kb="ai.toolCall.id",yC="ai.toolCall.args",SC="ai.toolCall.result";function TC(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[it],i=e.data[ut];if(typeof r=="number"||typeof i=="number"){let o=t.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(o.inputTokens+=r),typeof i=="number"&&(o.outputTokens+=i),t.set(n,o)}}function qb(e,t){let n=t.get(e.span_id);!n||!e.data||(n.inputTokens>0&&(e.data[it]=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 m5(e){let t=new Map;for(let n of e){let r=n.data[Vn];if(typeof r=="string")try{let i=JSON.parse(r);for(let o of i)o.name&&o.description&&!t.has(o.name)&&t.set(o.name,o.description)}catch{}}return t}function IC(e,t){let n=m5(e);for(let r of e){if(r.op==="gen_ai.execute_tool"){let i=r.data[Vr];if(typeof i=="string"){let o=n.get(i);o&&(r.data[ya]=o)}}r.op==="gen_ai.invoke_agent"&&qb(r,t)}}function Qb(e){return pl.get(e)}function Jb(e){pl.delete(e)}function AC(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 EC(e){return e.filter(t=>!!t&&typeof t=="object"&&"role"in t&&"content"in t)}function f5(e){try{let t=JSON.parse(e);if(t&&typeof t=="object"){let{messages:n}=t,{prompt:r,system:i}=t,o=[];if(typeof i=="string"&&o.push({role:"system",content:i}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return o.push(...EC(n)),o;if(Array.isArray(r))return o.push(...EC(r)),o;if(typeof r=="string"&&o.push({role:"user",content:r}),o.length>0)return o}}catch{}return[]}function NC(e,t,n){if(typeof t[ad]=="string"&&!t[Bt]&&!t[zo]){let r=t[ad],i=f5(r);if(i.length){let{systemInstructions:o,filteredMessages:s}=xn(i);o&&e.setAttribute($t,o);let c=Array.isArray(s)?s.length:0,a=n?Ht(s):Ge(s);e.setAttributes({[ad]:a,[Bt]:a,[xt]:c})}}else if(typeof t[zo]=="string"){let r=t[zo];try{let i=JSON.parse(r);if(Array.isArray(i)){let{systemInstructions:o,filteredMessages:s}=xn(i);o&&e.setAttribute($t,o);let c=Array.isArray(s)?s.length:0,a=!n&&s===i?r:n?Ht(s):Ge(s);e.setAttributes({[zo]:a,[Bt]:a,[xt]:c})}}catch{}}}function g5(e){let{data:t,description:n}=oe(e);if(!n)return;if(t[Xb]&&t[Kb]&&n==="ai.toolCall"){E5(e,t);return}if(!t[sd]&&!n.startsWith("ai."))return;id.get(n)==="generate_content"&&Ti([cC]);let i=C()?.getIntegrationByName("VercelAI"),o=ze(i?.options?.enableTruncation);T5(e,n,t,o)}function _5(e){if(e.type==="transaction"&&e.spans){let t=new Map;for(let r of e.spans)y5(r),TC(r,t);IC(e.spans,t);let n=e.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&qb(n,t)}return e}function h5(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 b5(e){let t=e[jb],n=e[Zb],r=e[uC];if(t==null&&n==null)return;let i=[];if(typeof t=="string"&&t.length>0&&i.push({type:"text",content:t}),n!=null)try{let o=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(o)){for(let s of o){let c=s.input??s.args;i.push({type:"tool_call",id:s.toolCallId,name:s.toolName,arguments:typeof c=="string"?c:JSON.stringify(c??{})})}delete e[Zb]}}catch{}if(i.length>0){let o={role:"assistant",parts:i,finish_reason:h5(r)};e[jO]=JSON.stringify([o]),delete e[jb]}}function RC(e){if(Ft(e,_C,ut),Ft(e,hC,it),Ft(e,mC,ro),Ft(e,"ai.usage.inputTokens",it),Ft(e,"ai.usage.outputTokens",ut),Ft(e,bC,it),Ft(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),!Object.keys(e).some(n=>n.startsWith(fC))&&typeof e[it]=="number"&&typeof e[ro]=="number"&&(e[it]=e[it]+e[ro]),typeof e[it]=="number"){let n=typeof e[ut]=="number"?e[ut]:0;e[Dt]=n+e[it]}if(e[Ii]&&Array.isArray(e[Ii])&&(e[Ii]=AC(e[Ii])),e[od]){let n=e[sd]?e[sd]:e[od],r=id.get(n)??n;e[ot]=r,delete e[od]}if(Ft(e,zo,Bt),b5(e),Ft(e,pC,"gen_ai.response.object"),Ft(e,Ii,"gen_ai.request.available_tools"),Ft(e,yC,ha),Ft(e,SC,ba),Ft(e,lC,"gen_ai.request.schema"),Ft(e,ul,De),Array.isArray(e[Yb])){let n=e[Yb].map(r=>{try{return JSON.parse(r)}catch{return r}});e[io]=n.length===1?n[0]:JSON.stringify(n)}I5(e);for(let n of Object.keys(e))Array.isArray(e[n])&&(e[n]=JSON.stringify(e[n])),n.startsWith("ai.")&&Ft(e,n,`vercel.${n}`)}function y5(e){let{data:t,origin:n}=e;n==="auto.vercelai.otel"&&(e.status&&e.status!=="ok"&&(e.status="internal_error"),RC(t))}function S5(e){let t=e.attributes;if(t?.[S]==="auto.vercelai.otel"){if(RC(t),t[B]==="gen_ai.execute_tool"&&e.parent_span_id){let n=rd.get(e.parent_span_id);if(n){let r=t[Vr];if(typeof r=="string"){let i=n.get(r);i&&(t[ya]=i)}}}rd.delete(e.span_id)}}function Ft(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function E5(e,t){e.setAttribute(S,"auto.vercelai.otel"),e.setAttribute(B,"gen_ai.execute_tool"),e.setAttribute(ot,"execute_tool"),Ft(t,Xb,Vr),Ft(t,Kb,al);let n=t[al];typeof n=="string"&&pl.set(n,e.spanContext()),t[cl]||e.setAttribute(cl,"function");let r=t[Vr];r&&e.updateName(`execute_tool ${r}`)}function T5(e,t,n,r){e.setAttribute(S,"auto.vercelai.otel");let i=t.replace("ai.","");e.setAttribute("ai.pipeline.name",i),e.updateName(i);let o=n[gC];o&&typeof o=="string"&&e.setAttribute("gen_ai.function_id",o),NC(e,n,r),n[ul]&&!n[sn]&&e.setAttribute(sn,n[ul]),e.setAttribute("ai.streaming",t.includes("stream"));let s=id.get(t);if(s?e.setAttribute(B,`gen_ai.${s}`):t.startsWith("ai.stream")&&e.setAttribute(B,"ai.run"),s==="invoke_agent"){o&&typeof o=="string"?e.updateName(`invoke_agent ${o}`):e.updateName("invoke_agent");return}let c=n[ul];c&&s&&e.updateName(`${s} ${c}`);let a=C();if(a&&rt(a)&&n[Ii]&&Array.isArray(n[Ii])){let l=new Map;for(let p of n[Ii])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=oe(e).parent_span_id;p&&rd.set(p,l)}}}var vC=new WeakSet;function cd(e){vC.has(e)||(vC.add(e),e.on("spanStart",g5),e.addEventProcessor(Object.assign(_5,{id:"VercelAiEventProcessor"})),e.on("processSpan",t=>{S5(t)}))}function ld(e){let t={};if(!e||typeof e!="object")return t;let n=e,r=n.openai??n.azure;if(r&&(Pn(t,ro,r.cachedPromptTokens),Pn(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),Pn(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),Pn(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),Pn(t,no,r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;Pn(t,ro,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;Pn(t,Bb,s)}n.bedrock?.usage&&(Pn(t,ro,n.bedrock.usage.cacheReadInputTokens),Pn(t,Bb,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(Pn(t,ro,n.deepseek.promptCacheHitTokens),Pn(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens));let i=(n.google??n.vertex)?.usageMetadata;return i&&typeof i.thoughtsTokenCount=="number"&&i.thoughtsTokenCount>0&&(t[ut]=(i.candidatesTokenCount??0)+i.thoughtsTokenCount,Pn(t,Dt,i.totalTokenCount),Pn(t,"gen_ai.usage.reasoning.output_tokens",i.thoughtsTokenCount)),t}var pd=new Set([ut,Dt,"gen_ai.usage.reasoning.output_tokens"]);function I5(e){let t=e[dC];if(!t)return;let n=e[ot]==="invoke_agent";try{let r=ld(JSON.parse(t));for(let[i,o]of Object.entries(r))i===no&&e[i]||n&&pd.has(i)||(e[i]=o)}catch{}}function Pn(e,t,n){n!=null&&(e[t]=n)}var Yr="OpenAI",OC={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},A5=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],CC=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...A5];function xC(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function PC(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function dl(e,t,n){if(!t||typeof t!="object")return;let r=t,i={};if(typeof r.id=="string"&&(i[eo]=r.id),typeof r.model=="string"&&(i[sn]=r.model),r.object==="conversation"&&typeof r.id=="string"&&(i[no]=r.id),r.usage&&typeof r.usage=="object"){let o=r.usage,s=o.prompt_tokens??o.input_tokens;typeof s=="number"&&(i[it]=s);let c=o.completion_tokens??o.output_tokens;typeof c=="number"&&(i[ut]=c),typeof o.total_tokens=="number"&&(i[Dt]=o.total_tokens)}if(Array.isArray(r.choices)){let o=r.choices,s=o.map(c=>c.finish_reason).filter(c=>typeof c=="string");if(s.length>0&&(i[Wr]=JSON.stringify(s)),n){let c=o.map(l=>l.message?.content||"");i[zt]=JSON.stringify(c);let a=o.map(l=>l.message?.tool_calls).filter(l=>Array.isArray(l)&&l.length>0).flat();a.length>0&&(i[bn]=JSON.stringify(a))}}if(typeof r.status=="string"&&(i[Wr]||(i[Wr]=JSON.stringify([r.status]))),n&&(typeof r.output_text=="string"&&!i[zt]&&(i[zt]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!i[bn])){let o=r.output.filter(s=>s?.type==="function_call");o.length>0&&(i[bn]=JSON.stringify(o))}e.setAttributes(i)}function N5(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 $b(e){let t={[De]:e.model??"unknown"};"temperature"in e&&(t[Ji]=e.temperature),"top_p"in e&&(t[zi]=e.top_p),"frequency_penalty"in e&&(t[$i]=e.frequency_penalty),"presence_penalty"in e&&(t[_a]=e.presence_penalty),"stream"in e&&(t[fa]=e.stream),"encoding_format"in e&&(t[$u]=e.encoding_format),"dimensions"in e&&(t[zu]=e.dimensions);let n=N5(e);return n&&(t[no]=n),t}function v5(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 i=t.chatCompletionToolCalls[r];n.function.arguments&&i?.function&&(i.function.arguments+=n.function.arguments)}}}function R5(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&&v5(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function O5(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 i=e;if(!CC.includes(i.type)){t.eventTypes.push(i.type);return}if(n&&(i.type==="response.output_item.done"&&"item"in i&&t.responsesApiToolCalls.push(i.item),i.type==="response.output_text.delta"&&"delta"in i&&i.delta)){t.responseTexts.push(i.delta);return}if("response"in i){let{response:o}=i;t.responseId=o.id??t.responseId,t.responseModel=o.model??t.responseModel,o.usage&&(t.promptTokens=o.usage.input_tokens,t.completionTokens=o.usage.output_tokens,t.totalTokens=o.usage.total_tokens),o.status&&t.finishReasons.push(o.status),n&&o.output_text&&t.responseTexts.push(o.output_text)}}async function*ml(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 i of e)PC(i)?R5(i,r,n):xC(i)&&O5(i,r,n,t),yield i}finally{let i=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];$o(t,{...r,toolCalls:i},n)}}function C5(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}]:[],i=[...t,...r];if(i.length!==0)try{return JSON.stringify(i)}catch(o){E&&g.error("Failed to serialize OpenAI tools:",o);return}}function ud(e,t){let n={[Fr]:"openai",[ot]:t,[S]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let r=e[0],i=C5(r);i&&(n[Vn]=i),Object.assign(n,$b(r))}else n[De]="unknown";return n}function fl(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(io,typeof c=="string"?c:JSON.stringify(c));return}let i="input"in t?t.input:"messages"in t?t.messages:void 0;if(!i||Array.isArray(i)&&i.length===0)return;let{systemInstructions:o,filteredMessages:s}=xn(i);o&&e.setAttribute($t,o),e.setAttribute(Bt,r?Ht(s):Ge(s)),Array.isArray(s)?e.setAttribute(xt,s.length):e.setAttribute(xt,1)}function x5(e,t,n,r,i){return function(...s){let c=n.operation||"unknown",a=ud(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),i.recordInputs&&p&&fl(N,p,c,ze(i.enableTruncation)),(async()=>{try{let M=await h;return ml(M,N,i.recordOutputs??!1)}catch(M){throw N.setStatus({code:2,message:"internal_error"}),N.end(),M}})()));return Sa(h,b)}let m,_=Se(d,h=>(m=e.apply(r,s),i.recordInputs&&p&&fl(h,p,c,ze(i.enableTruncation)),m.then(b=>(dl(h,b,i.recordOutputs),b))));return Sa(m,_)}}function kC(e,t="",n){return new Proxy(e,{get(r,i){let o=r[i],s=nd(t,String(i)),c=OC[s];return typeof o=="function"&&c?x5(o,s,c,r,n):typeof o=="function"?o.bind(r):o&&typeof o=="object"?kC(o,s,n):o}})}function dd(e,t){return kC(e,"",Ze(t))}var jr="Anthropic_AI",zb={"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 LC(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=xn(t);r&&e.setAttributes({[$t]:r});let o=Array.isArray(i)?i.length:1;e.setAttributes({[Bt]:n?Ht(i):Ge(i),[xt]:o})}var P5={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 ey(e){return e&&P5[e]||"internal_error"}function MC(e,t){t.error&&(e.setStatus({code:2,message:ey(t.error.type)}),me(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function wC(e){let{system:t,messages:n,input:r}=e,i=typeof t=="string"?[{role:"system",content:e.system}]:[],o=Array.isArray(r)?r:r!=null?[r]:void 0,s=Array.isArray(n)?n:n!=null?[n]:[],c=o??s;return[...i,...c]}function k5(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:2,message:ey(e.error?.type)}),!0):!1}function L5(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 M5(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 w5(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 G5(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(""),i;try{i=r?JSON.parse(r):{}}catch{i={__unparsed:r}}t.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:i}),delete t.activeToolBlocks[e.index]}function GC(e,t,n,r){!(e&&typeof e=="object")||k5(e,r)||(L5(e,t),M5(e,t),w5(e,t,n),G5(e,t))}async function*gl(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 i of e)GC(i,r,n,t),yield i}finally{$o(t,r,n)}}function _l(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",i=>{GC(i,r,n,t)}),e.on("message",()=>{$o(t,r,n)}),e.on("error",i=>{me(i,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end())}),e}var md=!1,UC=new WeakSet;function fd(e,t,n){let r={[Fr]:"anthropic",[ot]:n,[S]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let i=e[0];i.tools&&Array.isArray(i.tools)&&(r[Vn]=JSON.stringify(i.tools)),r[De]=i.model??"unknown","temperature"in i&&(r[Ji]=i.temperature),"top_p"in i&&(r[zi]=i.top_p),"stream"in i&&(r[fa]=i.stream),"top_k"in i&&(r[Ju]=i.top_k),"frequency_penalty"in i&&(r[$i]=i.frequency_penalty),"max_tokens"in i&&(r[ga]=i.max_tokens)}else t==="models.retrieve"||t==="models.get"?r[De]=e[0]:r[De]="unknown";return r}function Ea(e,t,n){let r=wC(t);LC(e,r,n),"prompt"in t&&e.setAttributes({[VO]:JSON.stringify(t.prompt)})}function U5(e,t){if("content"in t&&Array.isArray(t.content)){e.setAttributes({[zt]: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({[bn]:JSON.stringify(n)})}"completion"in t&&e.setAttributes({[zt]:t.completion}),"input_tokens"in t&&e.setAttributes({[zt]:JSON.stringify(t.input_tokens)})}function D5(e,t){"id"in t&&"model"in t&&(e.setAttributes({[eo]:t.id,[sn]:t.model}),"usage"in t&&t.usage&&aC(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function gd(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){MC(e,t);return}n&&U5(e,t),D5(e,t)}}function DC(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end()),e}function B5(e,t,n,r,i,o,s,c,a,l){let p=r[De]??"unknown",u={name:`${i} ${p}`,op:`gen_ai.${i}`,attributes:r};if(a&&!l){let d,m=ke(u,_=>(d=e.apply(t,n),c.recordInputs&&s&&Ea(_,s,ze(c.enableTruncation)),(async()=>{try{let h=await d;return gl(h,_,c.recordOutputs??!1)}catch(h){return DC(h,_)}})()));return Sa(d,m)}else return ke(u,d=>{try{c.recordInputs&&s&&Ea(d,s,ze(c.enableTruncation)),md=!0;let m=e.apply(t,n);return md=!1,_l(m,d,c.recordOutputs??!1)}catch(m){return md=!1,DC(m,d)}})}function H5(e,t,n,r,i){return new Proxy(e,{apply(o,s,c){let a=s!==void 0?s:r,l=n.streaming===!0;if(!l&&md)return o.apply(a,c);let p=n.operation||"unknown",u=fd(c,t,p),d=u[De]??"unknown",m=typeof c[0]=="object"?c[0]:void 0,_=!!m?.stream;if(_||l)return B5(o,a,c,u,p,t,m,i,_,l);let h,b=Se({name:`${p} ${d}`,op:`gen_ai.${p}`,attributes:u},N=>(h=o.apply(a,c),i.recordInputs&&m&&Ea(N,m,ze(i.enableTruncation)),h.then(M=>(gd(N,M,i.recordOutputs),M))));return Sa(h,b)}})}function F5(e,t){for(let n of Object.keys(zb)){let r=n.split("."),i=r.pop(),o=e;for(let a of r)o=o?.[a];if(!o||typeof o[i]!="function")continue;let s=o[i];if(UC.has(s))continue;let c=H5(s,n,zb[n],o,t);UC.add(c),o[i]=c}return e}function _d(e,t){return F5(e,Ze(t))}var Zr="Google_GenAI",BC={"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}},HC="google_genai";function W5(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 V5(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 Y5(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 i of r?.content?.parts??[])n&&i.text&&t.responseTexts.push(i.text),i.functionCall&&t.toolCalls.push({type:"function",id:i.functionCall.id,name:i.functionCall.name,arguments:i.functionCall.args})}}function j5(e,t,n,r){!e||W5(e,r)||(V5(e,t),Y5(e,t,n))}async function*hl(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)j5(i,r,n,t),yield i}finally{$o(t,r,n)}}function Ta(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>Ta(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 FC(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 Z5(e){let t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[Ji]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[zi]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[Ju]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[ga]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[$i]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[_a]=e.presencePenalty),t}function hd(e,t,n){let r={[Fr]:HC,[ot]:e,[S]:"auto.ai.google_genai"};if(t){if(r[De]=FC(t,n),"config"in t&&typeof t.config=="object"&&t.config){let i=t.config;if(Object.assign(r,Z5(i)),"tools"in i&&Array.isArray(i.tools)){let o=i.tools.flatMap(s=>s.functionDeclarations);r[Vn]=JSON.stringify(o)}}}else r[De]=FC({},n);return r}function bl(e,t,n,r){if(n==="embeddings"){let o=t.contents;o!=null&&e.setAttribute(io,typeof o=="string"?o:JSON.stringify(o));return}let i=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&i.push(...Ta(t.config.systemInstruction,"system")),"history"in t&&i.push(...Ta(t.history,"user")),"contents"in t&&i.push(...Ta(t.contents,"user")),"message"in t&&i.push(...Ta(t.message,"user")),Array.isArray(i)&&i.length){let{systemInstructions:o,filteredMessages:s}=xn(i);o&&e.setAttribute($t,o);let c=Array.isArray(s)?s.length:0;e.setAttributes({[xt]:c,[Bt]:r?Ht(s):Ge(s)})}}function bd(e,t,n){if(!(!t||typeof t!="object")){if(t.modelVersion&&e.setAttribute(sn,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata=="object"){let r=t.usageMetadata;typeof r.promptTokenCount=="number"&&e.setAttributes({[it]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&e.setAttributes({[ut]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&e.setAttributes({[Dt]:r.totalTokenCount})}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let r=t.candidates.map(i=>i.content?.parts&&Array.isArray(i.content.parts)?i.content.parts.map(o=>typeof o.text=="string"?o.text:"").filter(o=>o.length>0).join(""):"").filter(i=>i.length>0);r.length>0&&e.setAttributes({[zt]:r.join("")})}if(n&&t.functionCalls){let r=t.functionCalls;Array.isArray(r)&&r.length>0&&e.setAttributes({[bn]:JSON.stringify(r)})}}}function X5(e,t,n,r,i){let o=n.operation==="embeddings";return new Proxy(e,{apply(s,c,a){let l=n.operation||"unknown",p=a[0],u=hd(l,p,r),d=u[De]??"unknown";return n.streaming?ke({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},async m=>{try{i.recordInputs&&p&&bl(m,p,l,ze(i.enableTruncation));let _=await s.apply(r,a);return hl(_,m,!!i.recordOutputs)}catch(_){throw m.setStatus({code:2,message:"internal_error"}),m.end(),_}}):Se({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},m=>(i.recordInputs&&p&&bl(m,p,l,ze(i.enableTruncation)),sr(()=>s.apply(r,a),()=>{},()=>{},_=>{o||bd(m,_,i.recordOutputs)})))}})}function ty(e,t="",n){return new Proxy(e,{get:(r,i,o)=>{let s=Reflect.get(r,i,o),c=nd(t,String(i)),a=BC[c];if(typeof s=="function"&&a){let l=a.operation?X5(s,c,a,r,n):s.bind(r);return a.proxyResultPath?function(...p){let u=l(...p);return u&&typeof u=="object"?ty(u,a.proxyResultPath,n):u}:l}return typeof s=="function"?s.bind(r):s&&typeof s=="object"?ty(s,c,n):s}})}function yd(e,t){return ty(e,"",Ze(t))}var Ia="LangChain",Aa="auto.ai.langchain",WC={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var Yn=(e,t,n)=>{n!=null&&(e[t]=n)},kn=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function Na(e){if(Array.isArray(e))try{let t=e.map(n=>n&&typeof n=="object"&&oo(n)?Jo(n):n);return JSON.stringify(t)}catch{return String(e)}return Ge(e,String)}function yl(e){let t=e.toLowerCase();return WC[t]??t}function VC(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 ny(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function Sl(e){return e.map(t=>{let n=t._getType;if(typeof n=="function"){let i=n.call(t);return{role:yl(i),content:Na(t.content)}}if(t.lc===1&&t.kwargs){let i=t.id,o=Array.isArray(i)&&i.length>0?i[i.length-1]:"",s=typeof o=="string"?VC(o):"user";return{role:yl(s),content:Na(t.kwargs?.content)}}if(t.type){let i=String(t.type).toLowerCase();return{role:yl(i),content:Na(t.content)}}if(t.role)return{role:yl(String(t.role)),content:Na(t.content)};let r=t.constructor?.name;return r&&r!=="Object"?{role:yl(VC(r)),content:Na(t.content)}:{role:"user",content:Na(t.content)}})}function K5(e,t,n){let r={},i="kwargs"in e?e.kwargs:void 0,o=t?.temperature??n?.ls_temperature??i?.temperature;kn(r,Ji,o);let s=t?.max_tokens??n?.ls_max_tokens??i?.max_tokens;kn(r,ga,s);let c=t?.top_p??i?.top_p;kn(r,zi,c);let a=t?.frequency_penalty;kn(r,$i,a);let l=t?.presence_penalty;return kn(r,_a,l),t&&"stream"in t&&Yn(r,fa,!!t.stream),r}function jC(e,t,n,r,i){return{[Fr]:Ge(e??"langchain",String),[ot]:"chat",[De]:Ge(t,String),[S]:Aa,...K5(n,r,i)}}function ZC(e,t,n,r,i,o){let s=o?.ls_provider,c=i?.model??o?.ls_model_name??"unknown",a=jC(s,c,e,i,o);if(n&&Array.isArray(t)&&t.length>0){Yn(a,xt,t.length);let l=t.map(p=>({role:"user",content:p}));Yn(a,Bt,r?Ht(l):Ge(l))}return a}function XC(e,t,n,r,i,o){let s=o?.ls_provider??e.id?.[2],c=i?.model??o?.ls_model_name??"unknown",a=jC(s,c,e,i,o);if(n&&Array.isArray(t)&&t.length>0){let l=Sl(t.flat()),{systemInstructions:p,filteredMessages:u}=xn(l);p&&Yn(a,$t,p);let d=Array.isArray(u)?u.length:0;Yn(a,xt,d),Yn(a,Bt,r?Ht(u):Ge(u))}return a}function q5(e,t){let n=[],r=e.flat();for(let i of r){let s=i.message?.tool_calls;if(Array.isArray(s)&&s.length>0)n.push(...s);else{let c=i.message?.content;if(Array.isArray(c))for(let a of c){let l=a;l.type==="tool_use"&&n.push(l)}}}n.length>0&&Yn(t,bn,Ge(n,String))}function Q5(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)kn(t,it,n.promptTokens),kn(t,ut,n.completionTokens),kn(t,Dt,n.totalTokens);else if(r){kn(t,it,r.input_tokens),kn(t,ut,r.output_tokens);let i=Number(r.input_tokens),o=Number(r.output_tokens),s=(Number.isNaN(i)?0:i)+(Number.isNaN(o)?0:o);s>0&&kn(t,Dt,s),r.cache_creation_input_tokens!==void 0&&kn(t,KO,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&kn(t,qO,r.cache_read_input_tokens)}}function KC(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&&Yn(n,Wr,Ge(l,String)),q5(e.generations,n),t){let p=e.generations.flat().map(u=>u.text??u.message?.content).filter(u=>typeof u=="string");p.length>0&&Yn(n,zt,Ge(p,String))}}Q5(e.llmOutput,n);let r=e.llmOutput,o=e.generations?.[0]?.[0]?.message,s=r?.model_name??r?.model??o?.response_metadata?.model_name;s&&Yn(n,sn,s);let c=r?.id??o?.id;c&&Yn(n,eo,c);let a=r?.stop_reason??o?.response_metadata?.finish_reason;return a&&Yn(n,YO,Ge(a,String)),n}function Sd(e){let t={},n=e?.lc_agent_name;return typeof n=="string"&&(t[to]=n),t}function qC(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(r=>{let i=r.function;return{type:"function",name:r.name??i?.name??"",description:r.description??i?.description}});return JSON.stringify(n)}function J5(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.addHandler=="function"&&typeof t.copy=="function"}function $5(e){return typeof e=="object"&&e?.name==="SentryCallbackHandler"}function YC(e){return e.some($5)}function es(e,t){if(!e)return[t];if(J5(e)){if(YC(e.handlers??[]))return e;let r=e.copy();return r.addHandler(t,!0),r}let n=Array.isArray(e)?e:[e];return YC(n)?e:[...n,t]}function mr(e={}){let{recordInputs:t,recordOutputs:n}=Ze(e),r=ze(e.enableTruncation),i=new Map,o=c=>{let a=i.get(c);a?.isRecording()&&(a.end(),i.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=ny(d),b=ZC(c,a,t,r,h,m),N=b[De],M=b[ot];ke({name:`${M} ${N}`,op:"gen_ai.chat",attributes:{...Sd(m),...b,[B]:"gen_ai.chat"}},R=>(i.set(l,R),R))},handleChatModelStart(c,a,l,p,u,d,m,_){let h=ny(d),b=XC(c,a,t,r,h,m),N=qC(u);N&&(b[Vn]=N);let M=b[De],R=b[ot];ke({name:`${R} ${M}`,op:"gen_ai.chat",attributes:{...Sd(m),...b,[B]:"gen_ai.chat"}},v=>(i.set(l,v),v))},handleLLMEnd(c,a,l,p,u){let d=i.get(a);if(d?.isRecording()){let m=KC(c,n);m&&d.setAttributes(m),o(a)}},handleLLMError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(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,[B]:"gen_ai.invoke_agent"}},N=>(i.set(l,N),N))},handleChainEnd(c,a){let l=i.get(a);l?.isRecording()&&(n&&l.setAttributes({"langchain.chain.outputs":JSON.stringify(c)}),o(a))},handleChainError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(a))},handleToolStart(c,a,l,p,u,d,m){if(d?.__sentry_langgraph__)return;let _=m||c.name||"unknown_tool",h={...Sd(d),[S]:Aa,[ot]:"execute_tool",[Vr]:_};t&&(h[ha]=a),ke({name:`execute_tool ${_}`,op:"gen_ai.execute_tool",attributes:{...h,[B]:"gen_ai.execute_tool"}},b=>(i.set(l,b),b))},handleToolEnd(c,a){let l=i.get(a);if(l?.isRecording()){if(n){let p=c,u=p&&typeof p=="object"&&"content"in p?p.content:c;l.setAttributes({[ba]:typeof u=="string"?u:JSON.stringify(u)})}o(a)}},handleToolError(c,a){let l=i.get(a);l?.isRecording()&&(l.setStatus({code:2,message:"internal_error"}),o(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 z5(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 e3(e){let t=e??{},n={[S]:Aa,[B]:Hb,[ot]:"embeddings",[De]:t.model??"unknown"};return n[Fr]=z5(t),"dimensions"in t&&(n[zu]=t.dimensions),"encodingFormat"in t&&(n[$u]=t.encodingFormat),n}function Ed(e,t,n={}){let{recordInputs:r}=Ze(n),i=e3(e),o=i[De]||"unknown";return r&&t!=null&&(i[io]=typeof t=="string"?t:JSON.stringify(t)),{name:`embeddings ${o}`,op:Hb,attributes:i}}function QC(e,t={}){return new Proxy(e,{apply(n,r,i){return Se(Ed(r,i[0],t),()=>Reflect.apply(n,r,i))}})}function Td(e,t){let n=e;return typeof n.embedQuery=="function"&&(n.embedQuery=QC(n.embedQuery,t)),typeof n.embedDocuments=="function"&&(n.embedDocuments=QC(n.embedDocuments,t)),e}var va="LangGraph",El="auto.ai.langgraph";function Tl(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 Ra(e){let t=e[0];return typeof t=="object"&&t&&"name"in t&&typeof t.name=="string"?t.name:null}function Il(e,t,n){let r="__sentry_tool_wrapped__";for(let i of e){if(!i||typeof i!="object")continue;let o=i,s=o.invoke;if(typeof s!="function"||Object.prototype.hasOwnProperty.call(o,r))continue;let c=typeof o.name=="string"?o.name:"unknown_tool",a=typeof o.description=="string"?o.description:void 0,l=new Proxy(s,{apply(p,u,d){let m={[S]:El,[B]:Fb,[ot]:"execute_tool",[Vr]:c,[cl]:"function"},h=d[1]?.metadata?.lc_agent_name??n;typeof h=="string"&&(m[to]=h),a&&(m[ya]=a);let b=d[0];if(typeof b=="object"&&b&&("id"in b&&typeof b.id=="string"&&(m[al]=b.id),t.recordInputs)){let N="args"in b&&typeof b.args=="object"?b.args:b;try{m[ha]=JSON.stringify(N)}catch{}}return Se({op:Fb,name:`execute_tool ${c}`,attributes:m},async N=>{try{let M=await Reflect.apply(p,u,d);if(t.recordOutputs)try{let R=M,v=R&&typeof R=="object"&&"content"in R?R.content:M;N.setAttribute(ba,typeof v=="string"?v:JSON.stringify(v))}catch{}return M}catch(M){throw N.setStatus({code:2,message:"internal_error"}),M}})}});o.invoke=l,Object.defineProperty(o,r,{value:!0,enumerable:!1})}return e}function t3(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 n3(e){let t=e,n=0,r=0,i=0;if(t.usage_metadata&&typeof t.usage_metadata=="object"){let o=t.usage_metadata;return typeof o.input_tokens=="number"&&(n=o.input_tokens),typeof o.output_tokens=="number"&&(r=o.output_tokens),typeof o.total_tokens=="number"&&(i=o.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:i}}if(t.response_metadata&&typeof t.response_metadata=="object"){let o=t.response_metadata;if(o.tokenUsage&&typeof o.tokenUsage=="object"){let s=o.tokenUsage;typeof s.promptTokens=="number"&&(n=s.promptTokens),typeof s.completionTokens=="number"&&(r=s.completionTokens),typeof s.totalTokens=="number"&&(i=s.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:i}}function r3(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(sn,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&e.setAttribute(Wr,[r.finish_reason])}}function JC(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 $C(e,t,n){let i=n?.messages;if(!i||!Array.isArray(i))return;let o=t?.length??0,s=i.length>o?i.slice(o):[];if(s.length===0)return;let c=t3(s);c&&e.setAttribute(bn,JSON.stringify(c));let a=Sl(s);e.setAttribute(zt,JSON.stringify(a));let l=0,p=0,u=0;for(let d of s){let m=n3(d);l+=m.inputTokens,p+=m.outputTokens,u+=m.totalTokens,r3(e,d)}l>0&&e.setAttribute(it,l),p>0&&e.setAttribute(ut,p),u>0&&e.setAttribute(Dt,u)}var ry=!1,Id="__sentry_patched__";function Ad(e){let t={[S]:El,[B]:"gen_ai.create_agent",[ot]:"create_agent"};return e&&(t[to]=e),{op:"gen_ai.create_agent",name:e?`create_agent ${e}`:"create_agent",attributes:t}}function iy(e,t){if(Object.prototype.hasOwnProperty.call(e,Id))return e;let n=mr(t),r=new Proxy(e,{apply(i,o,s){return ry?Reflect.apply(i,o,s):Se(Ad(),c=>{try{let a=Reflect.apply(i,o,s),l=s.length>0?s[0]:{};l?.name&&typeof l.name=="string"&&(c.setAttribute(to,l.name),c.updateName(`create_agent ${l.name}`));let p=a.invoke;return p&&typeof p=="function"&&(a.invoke=Al(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,Id,{value:!0,enumerable:!1}),r}function Al(e,t,n,r,i,o){return new Proxy(e,{apply(s,c,a){let l=i?.modelName??i?.model;return Se({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[S]:El,[B]:QO,[ot]:"invoke_agent"}},async p=>{try{let u=n?.name;u&&typeof u=="string"&&(p.setAttribute(XO,u),p.setAttribute(to,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(no,_),o){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=es(v.callbacks,o)}let h=JC(t);h&&p.setAttribute(Vn,JSON.stringify(h));let b=r.recordInputs,N=r.recordOutputs,M=a.length>0?a[0]?.messages??[]:[];if(M&&b){let v=Sl(M),{systemInstructions:P,filteredMessages:D}=xn(v);P&&p.setAttribute($t,P);let I=ze(r.enableTruncation),H=Array.isArray(D)?D.length:0;p.setAttributes({[Bt]:I?Ht(D):Ge(D),[xt]:H})}let R=await Reflect.apply(s,c,a);return N&&$C(p,M??null,R),R}catch(u){throw p.setStatus({code:2,message:"internal_error"}),u}})}})}function oy(e,t){if(Object.prototype.hasOwnProperty.call(e,Id))return e;let n=Ze(t),r=mr(n),i=new Proxy(e,{apply(o,s,c){let a=Tl(c),l=Ra(c),p=c[0];p&&Array.isArray(p.tools)&&p.tools.length>0&&Il(p.tools,n,l??void 0),ry=!0;let u;try{u=Reflect.apply(o,s,c)}finally{ry=!1}let d=u.invoke;if(d&&typeof d=="function"){let m={};l&&(m.name=l),u.invoke=Al(d.bind(u),u,m,n,a,r)}return u}});return Object.defineProperty(i,Id,{value:!0,enumerable:!1}),i}function Nl(e,t){return e.compile=iy(e.compile,Ze(t)),e}var zC=Nl;function ex(e,t,n){let r=n.getOptions(),i=n.getDsn(),o=r.tunnel,s=Ys(r._metadata),c={sent_at:new Date(tt()).toISOString(),...i3(t)&&{trace:t},...s&&{sdk:s},...!!o&&i&&{dsn:rn(i)}},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 Lt(c,[l])}function i3(e){return!!e.trace_id&&!!e.public_key}function tx(e){let t=156;if(t+=e.name.length*2,t+=k_(e.attributes),e.links&&e.links.length>0){let r=e.links[0]?.attributes,i=100+(r?k_(r):0);t+=i*e.links.length}return t}var nx=1e3,o3=5e6,Nd=class{constructor(t,n){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:r,flushInterval:i,maxTraceWeightInBytes:o}=n??{};this._maxSpanLimit=r&&r>0&&r<=nx?r:nx,this._flushInterval=i&&i>0?i:5e3,this._maxTraceWeight=o&&o>0?o:o3,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:On(setTimeout(()=>{this.flush(n)},this._flushInterval))},this._traceBuckets.set(n,r)),r.spans.add(t),r.size+=tx(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),i=r[0]?._segmentSpan;if(!i){E&&g.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let o=nt(i),s=r.map(a=>{let{_segmentSpan:l,...p}=a;return p}),c=ex(s,o,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 vl=()=>({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 i=r.beforeSendSpan;if(i&&!mi(i)){r.traceLifecycle="static",E&&g.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let o=new Nd(e);e.on("afterSpanEnd",s=>{Qt(s)&&o.add(xh(s,e))})}});function Rl(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}function Ol(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 Wt=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 rx(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 Cl=class extends wu{constructor(t){rx(t),t.traceLifecycle==="stream"&&!t.integrations.some(n=>n.name==="SpanStreaming")&&t.integrations.push(vl()),super(t),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(t,n){let r=IO(this,this._options.stackParser,t,n);return r.level="error",Si(r)}eventFromMessage(t,n="info",r){return Si(AO(this._options.stackParser,t,n,r,this._options.attachStacktrace))}captureException(t,n,r){return ix(n),super.captureException(t,n,r)}captureEvent(t,n,r){return!t.type&&t.exception?.values&&t.exception.values.length>0&&ix(n),super.captureEvent(t,n,r)}captureCheckIn(t,n,r){let i="checkInId"in t&&t.checkInId?t.checkInId:dt();if(!this._isEnabled())return E&&g.warn("SDK not enabled, will not capture check-in."),i;let o=this.getOptions(),{release:s,environment:c,tunnel:a}=o,l={check_in_id:i,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]=ia(this,r);u&&(l.contexts={trace:u});let d=lO(l,p,this.getSdkMetadata(),a,this.getDsn());return E&&g.log("Sending checkin:",t.monitorSlug,t.status),this.sendEnvelope(d),i}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=aa($c)}_prepareEvent(t,n,r,i){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,i)}_setUpMetricsProcessing(){this.on("processMetric",t=>{this._options.serverName&&(t.attributes={"server.address":this._options.serverName,...t.attributes})})}};function ix(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 ox={mechanism:{handled:!1,type:"auto.rpc.trpc.middleware"}};function s3(e){typeof e=="object"&&e!==null&&"ok"in e&&!e.ok&&"error"in e&&me(e.error,ox)}function sy(e={}){return async function(t){let{path:n,type:r,next:i,rawInput:o,getRawInput:s}=t,c=C(),a=c?.getOptions(),l=c?.getDataCollectionOptions(),p={procedure_path:n,procedure_type:r};if(pv(p,1+(a?.normalizeDepth??5)),(e.attachRpcInput!==void 0?e.attachRpcInput:l?.httpBodies.includes("incomingRequest"))&&(o!==void 0&&(p.input=Ke(o)),s!==void 0&&typeof s=="function"))try{let u=await s();p.input=Ke(u)}catch{}return nr(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 i();return s3(m),d.end(),m}catch(m){throw me(m,ox),d.end(),m}})))}}function Ai(e,t,n){try{if(!C())return;let i=Q();i?.isRecording()&&i.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 Oa(e,t){kt(e,t,n=>function(r,...i){let o=i[i.length-1];if(typeof o!="function")return n.call(this,r,...i);let s=xl(o,t,r);return n.call(this,r,...i.slice(0,-1),s)})}function xl(e,t,n){return function(...r){try{return a3.call(this,e,t,n,r)}catch(i){return E&&g.warn("MCP handler wrapping failed:",i),e.apply(this,r)}}}function a3(e,t,n,r){try{let i=e.apply(this,r);return V(i)&&typeof i.then=="function"?Promise.resolve(i).catch(o=>{throw sx(o,t,n),o}):i}catch(i){throw sx(i,t,n),i}}function sx(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")?Ai(e,"validation",r):e.name==="ServerTimeoutError"||e.message.includes("timed out")||e.message.includes("timeout")?Ai(e,"timeout",r):Ai(e,"tool_execution",r)):t==="resource"||t==="registerResource"?(r.resource_uri=n,Ai(e,"resource_execution",r)):(t==="prompt"||t==="registerPrompt")&&(r.prompt_name=n,Ai(e,"prompt_execution",r))}catch{}}function c3(e){typeof e.tool=="function"&&Oa(e,"tool"),typeof e.registerTool=="function"&&Oa(e,"registerTool")}function l3(e){typeof e.resource=="function"&&Oa(e,"resource"),typeof e.registerResource=="function"&&Oa(e,"registerResource")}function p3(e){typeof e.prompt=="function"&&Oa(e,"prompt"),typeof e.registerPrompt=="function"&&Oa(e,"registerPrompt")}function ax(e){c3(e),l3(e),p3(e)}function cx(e){let t=e,n=t._registeredTools;if(V(n))for(let[s,c]of Object.entries(n))typeof c.executor=="function"&&(c.executor=xl(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=xl(c.readCallback,"registerResource",s));let i=t._registeredResourceTemplates;if(V(i))for(let[s,c]of Object.entries(i))typeof c.readCallback=="function"&&(c.readCallback=xl(c.readCallback,"registerResource",s));let o=t._registeredPrompts;if(V(o))for(let[s,c]of Object.entries(o))typeof c.handler=="function"&&(c.handler=xl(c.handler,"registerPrompt",s))}var ay="mcp.method.name",lx="mcp.request.id",px="mcp.session.id",ux="mcp.transport",cy="mcp.server.name",ly="mcp.server.title",py="mcp.server.version",Ca="mcp.protocol.version",dx="mcp.tool.name",so="mcp.resource.uri",mx="mcp.prompt.name",fx="mcp.tool.result.is_error",gx="mcp.tool.result.content_count",_x="mcp.prompt.result.description",hx="mcp.prompt.result.message_count",vd="mcp.request.argument",bx="mcp.logging.level",yx="mcp.logging.logger",Sx="mcp.logging.data_type",Ex="mcp.logging.message",Tx="network.transport",Ix="network.protocol.version",Rd="client.address",Od="client.port",uy="mcp.server",Ax="mcp.notification.client_to_server",Nx="mcp.notification.server_to_client",vx="auto.function.mcp_server",dy="auto.mcp.notification",Rx="route";function Ox(e){return V(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&"id"in e}function my(e){return V(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&!("id"in e)}function Cx(e){return V(e)&&"jsonrpc"in e&&e.jsonrpc==="2.0"&&"id"in e&&("result"in e||"error"in e)}function xx(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 an(e){return V(e)}function u3(e,t){let n={[gx]:e.length};for(let[r,i]of e.entries()){if(!an(i))continue;let o=e.length===1?"mcp.tool.result":`mcp.tool.result.${r}`;if(typeof i.type=="string"&&(n[`${o}.content_type`]=i.type),t){let s=(a,l)=>{typeof l=="string"&&(n[`${o}.${a}`]=l)};s("mime_type",i.mimeType),s("uri",i.uri),s("name",i.name),typeof i.text=="string"&&(n[`${o}.content`]=i.text),typeof i.data=="string"&&(n[`${o}.data_size`]=i.data.length);let c=i.resource;an(c)&&(s("resource_uri",c.uri),s("resource_mime_type",c.mimeType))}}return n}function Px(e,t){if(!an(e))return{};let n=Array.isArray(e.content)?u3(e.content,t):{};return typeof e.isError=="boolean"&&(n[fx]=e.isError),n}function kx(e,t){let n={};if(!an(e))return n;if(t&&typeof e.description=="string"&&(n[_x]=e.description),Array.isArray(e.messages)&&(n[hx]=e.messages.length,t)){let r=e.messages;for(let[i,o]of r.entries()){if(!an(o))continue;let s=r.length===1?"mcp.prompt.result":`mcp.prompt.result.${i}`;if(((a,l)=>{if(typeof l=="string"){let p=r.length===1?`${s}.message_${a}`:`${s}.${a}`;n[p]=l}})("role",o.role),an(o.content)){let a=o.content;if(typeof a.text=="string"){let l=r.length===1?`${s}.message_content`:`${s}.content`;n[l]=a.text}}}}return n}var fy=new Map,Lx=new WeakMap;function Cd(e){let t=e.sessionId;return t?fy.get(t):Lx.get(e)}function d3(e,t){let n=e.sessionId;n?fy.set(n,t):Lx.set(e,t)}function xd(e,t){let n=Cd(e)||{};d3(e,{...n,...t})}function Mx(e){return Cd(e)?.clientInfo}function wx(e){return Cd(e)?.protocolVersion}function Gx(e){return Cd(e)}function Ux(e){let t=e.sessionId;t&&fy.delete(t)}var Dx="io.modelcontextprotocol/protocolVersion",Bx="io.modelcontextprotocol/clientInfo",Hx="io.modelcontextprotocol/serverInfo";function Pd(e){let t={};return an(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 Fx(e){let t={};return an(e.params)&&(typeof e.params.protocolVersion=="string"&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=Pd(e.params.clientInfo))),t}function Wx(e){let t={};if(an(e.params)&&an(e.params._meta)){let n=e.params._meta;typeof n[Dx]=="string"&&(t.protocolVersion=n[Dx]),n[Bx]&&(t.clientInfo=Pd(n[Bx]))}return t}function Vx(e){let t={};return an(e)&&(typeof e.protocolVersion=="string"&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=Pd(e.serverInfo))),t}function Yx(e){let t={};return an(e)&&an(e._meta)&&e._meta[Hx]&&(t.serverInfo=Pd(e._meta[Hx])),t}function m3(e){let t=Mx(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 jx(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 f3(e){let t=Gx(e)?.serverInfo,n={};return t?.name&&(n[cy]=t.name),t?.title&&(n[ly]=t.title),t?.version&&(n[py]=t.version),n}function Zx(e){let t={};return e?.name&&(t[cy]=e.name),e?.title&&(t[ly]=e.title),e?.version&&(t[py]=e.version),t}function g3(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 _3(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 gy(e,t){let n=e&&"sessionId"in e?e.sessionId:void 0,r=t?g3(t):{},{mcpTransport:i,networkTransport:o}=_3(e),s=m3(e),c=f3(e),a=wx(e);return{...n&&{[px]:n},...r.address&&{[Rd]:r.address},...r.port&&{[Od]:r.port},[ux]:i,[Tx]:o,[Ix]:"2.0",...a&&{[Ca]:a},...s,...c}}var kd=new Map,_y=new WeakMap;function Xx(e){let t=e.sessionId;if(t){let r=kd.get(t);return r||(r=new Map,kd.set(t,r)),r}let n=_y.get(e);return n||(n=new Map,_y.set(e,n)),n}function Kx(e,t,n,r,i){Xx(e).set(t,{span:n,method:r,capturePolicy:i,startTime:Date.now()})}function qx(e,t,n,r=!1){let i=Xx(e),o=i.get(t);if(o){let{span:s,method:c}=o,a=c==="initialize"?Vx(n):Yx(n);(a.protocolVersion||a.serverInfo)&&xd(e,a);let l={...Zx(a.serverInfo)};if(a.protocolVersion&&(l[Ca]=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=Px(n,o.capturePolicy.recordOutputs);s.setAttributes(p)}else if(c==="prompts/get"){let p=kx(n,o.capturePolicy.recordOutputs);s.setAttributes(p)}s.end(),i.delete(t)}}function Qx(e){let t=e.sessionId;if(t){let r=kd.get(t);if(r){for(let[,i]of r)i.span.setStatus({code:2,message:"cancelled"}),i.span.end();kd.delete(t)}return}let n=_y.get(e);if(n){for(let[,r]of n)r.span.setStatus({code:2,message:"cancelled"}),r.span.end();n.clear()}}var Jx={"tools/call":{targetField:"name",targetAttribute:dx,captureArguments:!0,argumentsField:"arguments"},"resources/read":{targetField:"uri",targetAttribute:so,captureUri:!0},"resources/subscribe":{targetField:"uri",targetAttribute:so},"resources/unsubscribe":{targetField:"uri",targetAttribute:so},"prompts/get":{targetField:"name",targetAttribute:mx,captureName:!0,captureArguments:!0,argumentsField:"arguments"}};function Pl(e,t){let n=Jx[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 $x(e,t){let n={},r=Jx[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let i=t[r.argumentsField];if(V(i))for(let[o,s]of Object.entries(i))n[`${vd}.${o.toLowerCase()}`]=JSON.stringify(s)}return r.captureUri&&t?.uri&&(n[`${vd}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${vd}.name`]=JSON.stringify(t.name)),n}function h3(e){return typeof e=="string"?e:JSON.stringify(e)}function b3(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[bx]=String(t.level)),t?.logger&&(r[yx]=String(t.logger)),t?.data!==void 0&&(r[Sx]=typeof t.data,n&&(r[Ex]=h3(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[so]=String(t.uri);let i=ur(String(t.uri));i&&!pr(i)&&(r["mcp.resource.protocol"]=i.protocol.replace(":",""))}break;case"notifications/initialized":r["mcp.lifecycle.phase"]="initialization_complete",r["mcp.protocol.ready"]=1;break}return r}function hy(e,t,n,r){if(e==="request"){let i=t,o=Pl(i.method,n||{});return{...i.id!==void 0&&{[lx]:String(i.id)},...o.attributes,...r?$x(i.method,n||{}):{}}}return b3(t.method,n||{},r)}var y3=new Set([Rd,Od,so]);function S3(e){return y3.has(e)}function by(e,t){return t?e:Object.entries(e).reduce((n,[r,i])=>(S3(r)||(n[r]=i),n),{})}function zx(e,t){return t?`${e} ${t}`:e}function eP(e){let t,n;switch(e){case"request":t=uy,n=vx;break;case"notification-incoming":t=Ax,n=dy;break;case"notification-outgoing":t=Nx,n=dy;break}return{[B]:t,[S]:n,[ve]:Rx}}function tP(e){let{type:t,message:n,transport:r,extra:i,callback:o,options:s}=e,{method:c}=n,a=n.params,l;if(t==="request"){let _=Pl(c,a||{});l=zx(c,_.target)}else l=c;let p={...gy(r,i),[ay]:c,...hy(t,n,a,s?.recordInputs),...eP(t)},d=!!C()?.getDataCollectionOptions().userInfo,m=by(p,d);return Se({name:l,forceTransaction:!0,attributes:m},o)}function nP(e,t,n,r,i){return tP({type:"notification-incoming",message:e,transport:t,extra:n,callback:i,options:r})}function rP(e,t,n,r){return tP({type:"notification-outgoing",message:e,transport:t,options:n,callback:r})}function iP(e,t,n,r){let{method:i}=e,o=e.params,s=Pl(i,o||{}),c=zx(i,s.target),a={...gy(t,n),[ay]:i,...hy("request",e,o,r?.recordInputs),...eP("request")},p=!!C()?.getDataCollectionOptions().userInfo,u=by(a,p);return{name:c,op:uy,forceTransaction:!0,attributes:u}}function yy(e){if(e.recordInputs!==void 0&&e.recordOutputs!==void 0)return{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs};let t=C()?.getDataCollectionOptions().genAI;return{recordInputs:e.recordInputs??t?.inputs??!1,recordOutputs:e.recordOutputs??t?.outputs??!1}}function oP(e,t){e.onmessage&&kt(e,"onmessage",n=>function(r,i){let o=Ox(r)?r:void 0,s=my(r)?r:void 0,c=o||s,a;if(c)try{a=o?.method==="initialize"?Fx(o):Wx(c),(a.protocolVersion||a.clientInfo)&&xd(e,a)}catch{}if(o){let l=yy(t),p=J().clone();return nr(p,()=>{let u=iP(o,e,i,l),d=k(u);return o.method==="initialize"&&a&&d.setAttributes({...jx(a.clientInfo),...a.protocolVersion&&{[Ca]:a.protocolVersion}}),Kx(e,o.id,d,o.method,l),se(d,()=>n.call(this,o,i))})}if(s){let l=yy(t);return nP(s,e,i,l,()=>n.call(this,s,i))}return n.call(this,r,i)})}function sP(e,t){e.send&&kt(e,"send",n=>async function(...r){let[i]=r;if(my(i)){let o=yy(t);return rP(i,e,o,()=>n.call(this,...r))}return Cx(i)&&i.id!==null&&i.id!==void 0&&(i.error&&E3(i.error),qx(e,i.id,i.result,!!i.error)),n.call(this,...r)})}function aP(e){e.onclose&&kt(e,"onclose",t=>function(...n){return Qx(e),Ux(e),t.call(this,...n)})}function cP(e){e.onerror&&kt(e,"onerror",t=>function(n){return T3(n),t.call(this,n)})}function E3(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}`,Ai(r,"protocol")}}}catch{}}function T3(e){try{Ai(e,"transport")}catch{}}var lP=new WeakSet;function Sy(e,t){if(lP.has(e)||!xx(e))return e;let n=e,r={...t};return kt(n,"connect",i=>async function(o,...s){let c=await i.call(this,o,...s);return oP(o,r),sP(o,r),aP(o),cP(o),c}),ax(n),cx(n),lP.add(e),e}function dP(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 mP(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let o=i.match(r);if(o)return{filename:`<data:${o[2]}>`,function:o[1]};let s=i.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=rv(s[2]),m=s[5]==="native";!d&&s[5]&&!m&&(d=s[5]);let _=d?I3(d):void 0;return{filename:_??d,module:_&&e?.(_),function:l,lineno:pP(s[3]),colno:pP(s[4]),in_app:dP(d||"",m)}}if(i.match(t))return{filename:i}}}function Ey(e){return[90,mP(e)]}function pP(e){return parseInt(e||"",10)||void 0}function I3(e){try{return decodeURI(e)}catch{return}}var Ld=new WeakMap,fP=(e,t)=>{let n=Ld.get(e);n?n.push(t):Ld.set(e,[t])},kl=e=>{let t=Ld.get(e);return t||(t=[],Ld.set(e,t)),t};var ts="express.name",gP="http.route",ns="express.type",Md="router",_P="middleware",hP="request_handler";var Ty=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function A3(e){return e.includes(":")||e.includes("*")}var yP=(e,t,n)=>{if(t.name==="router"){let r=SP("",t),i=r||n||e||"/";return{attributes:{[ts]:i,[ns]:Md},name:`router - ${i}`}}else return t.name==="bound dispatch"||t.name==="handle"?{attributes:{[ts]:(e||n)??"request handler",[ns]:hP},name:`request handler${t.path?` - ${e||n}`:""}`}:{attributes:{[ts]:t.name,[ns]:_P},name:`middleware - ${t.name}`}},SP=(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)?SP(e,n):e},EP=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return fn(e,n.ignoreLayers,!0)}catch{}return!1};function TP(e,t){let n=kl(e);if(n.length===0)return;if(n.every(o=>o==="/"))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)||A3(r))?r:void 0}function IP(e){let t=kl(e),n="";for(let r of t)r==="/"||r==="/*"||(n+=!n||n.endsWith("/")?r:`/${r}`);return n.replace(/\/{2,}/g,"/")}var wd=e=>{let t=e[0];return Array.isArray(t)?t.map(n=>bP(n)||"").join(","):bP(t)},bP=e=>typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0,Gd=e=>AP(e?.Router?.prototype),AP=e=>(typeof e=="object"||typeof e=="function")&&!!e&&"route"in e&&typeof e.route=="function",NP=e=>AP(e.Router)&&!Gd(e);function N3(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function vP(e){return N3(e)>=500}function Ll(e){if(!J()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let n=Qo(e);J().setSDKProcessingMetadata({normalizedRequest:n})}}function Ud(e,t,n){if(!t?.handle)return;let r=t,i=r.handle;if(Nr(i)||i.length===4)return;function o(s,c,...a){let l=e();Ll(s);let p=Q();if(!p)return i.apply(this,[s,c,...a]);n&&fP(s,n);let u=kl(s),d=!!n,m=IP(s),_=TP(s,m);l.onRouteResolved?.(_);let h=yP(m,r,n),b=h.attributes[ts],N=h.attributes[ns],M=Object.assign(h.attributes,{[S]:"auto.http.express",[B]:`${N}.express`});if(_&&(M[gP]=_),EP(h.attributes[ts],N,l))return d&&u.pop(),i.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:M},v=>{let P=!1;h.attributes[ns]===Md&&(v.end(),P=!0);let D=()=>{P||(P=!0,v.end())};for(let I=0;I<a.length;I++){let H=a[I];if(typeof H=="function"){a[I]=function(...L){let G=L[0],ce=!!G&&G!=="route"&&G!=="router";if(!P&&ce){let[ge,Ne]=Ty(G);v.setStatus({code:2,message:Ne})}return P||(P=!0,c.removeListener("finish",D),v.end()),!(s.route&&ce)&&d&&u.pop(),se(p,()=>H.apply(this,L))};break}}try{return i.apply(this,[s,c,...a])}catch(I){let[H,L]=Ty(I);throw v.setStatus({code:2,message:L}),I}finally{P||c.once("finish",D)}})}for(let s in i)s in o||Object.defineProperty(o,s,{get(){return i[s]},set(c){i[s]=c}});Po(o,i),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:o})}function Dd(e){return!!e&&typeof e=="object"&&"default"in e&&e.default||e}function v3(e){return!!e.express}var RP=!1;function R3(){RP||(RP=!0,E&&g.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function Iy(e,t){let n,r;if(!t&&v3(e)){let{express:p,...u}=e;r=p,n=()=>u,R3()}else{if(typeof t!="function")throw new TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");n=t,r=e}let i=Dd(r),o=Gd(i)?i.Router.prototype:NP(i)?i.Router:void 0;if(!o)throw new TypeError("no valid Express route function to instrument");let s=o.route;try{Ps(o,"route",function(...u){let d=s.apply(this,u),m=this.stack[this.stack.length-1];return Ud(n,m,wd(u)),d})}catch(p){E&&g.error("Failed to patch express route method:",p)}let c=o.use;try{Ps(o,"use",function(...u){let d=c.apply(this,u),m=this.stack[this.stack.length-1];return m&&Ud(n,m,wd(u)),d})}catch(p){E&&g.error("Failed to patch express use method:",p)}let{application:a}=i,l=a.use;try{Ps(a,"use",function(...u){let d=l.apply(this,u),m=Gd(i)?this.router:this._router;if(m){let _=m.stack[m.stack.length-1];_&&Ud(n,_,wd(u))}return d})}catch(p){E&&g.error("Failed to patch express application.use method:",p)}return i}function O3(){return C()?.getIntegrationByName("Express")?.getShouldHandleError?.()}function Ay(e){return function(n,r,i,o){Ll(r);let s=e?.shouldHandleError??O3()??vP;if(s===!1){o(n);return}if(s(n)){let c=me(n,{mechanism:{type:"auto.middleware.express",handled:!1}});i.sentry=c}o(n)}}function Ny(e,t){e.use(C3()),e.use(Ay(t))}function C3(){return function(t,n,r){Ll(t),r()}}var x3=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,Bd=Symbol("sentryPostgresConnectionContext"),vy=Symbol.for("sentry.instrumented.postgresjs"),P3=Symbol.for("sentry.query.from.instrumented.sql");function Cy(e,t){return!e||typeof e!="function"?(E&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),e):Oy(e,{requireParentSpan:!0,...t})}function Oy(e,t,n){if(e[vy])return e;let r=new Proxy(e,{apply(i,o,s){let c=Reflect.apply(i,o,s);return V(c)&&"handle"in c&&OP(c,r,t),c},get(i,o){let s=i[o];return typeof o!="string"||typeof s!="function"?s:o==="unsafe"||o==="file"?k3(s,i,r,t):o==="begin"||o==="reserve"?L3(s,i,r,t):s}});return n?r[Bd]=n:w3(e,r),e[vy]=!0,r[vy]=!0,r}function k3(e,t,n,r){return function(...i){let o=Reflect.apply(e,t,i);return V(o)&&"handle"in o&&OP(o,n,r),o}}function L3(e,t,n,r){return function(...i){let o=n[Bd];if(!(typeof i[i.length-1]=="function")){let p=Reflect.apply(e,t,i);return p&&typeof p.then=="function"?p.then(u=>Oy(u,r,o)):p}let c=i.length===1?i[0]:i[1],a=function(p){let u=Oy(p,r,o);return c(u)},l=i.length===1?[a]:[i[0],a];return Reflect.apply(e,t,l)}}function OP(e,t,n){if(e.handle?.__sentryWrapped)return;e[P3]=!0;let r=e.handle,i=async function(...o){if(this.executed||!M3(n))return r.apply(this,o);let s=Hd(e.strings),c=Pa(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[Bd]:void 0;if(Fd(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{xa(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"),xa(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,o)}catch(u){throw a.setStatus({code:2,message:u instanceof Error?u.message:"unknown_error"}),a.end(),u}})};i.__sentryWrapped=!0,e.handle=i}function M3(e){return Q()!==void 0||!e.requireParentSpan}function Hd(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((t,n,r)=>r===0?n:`${t}$${r}${n}`,"")}var Ry;function Pa(e){return e?(Ry||(Ry=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(Ry,"?").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 Fd(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 xa(e,t,n){if(n){e.setAttribute("db.operation.name",n);return}let r=t?.match(x3);r?.[1]&&e.setAttribute("db.operation.name",r[1].toUpperCase())}function Wd(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 w3(e,t){let n=e;!n.options||typeof n.options!="object"||(t[Bd]=Wd(n.options))}var Xr="@sentry/instrumentation-http",Kr="http.client.request.created",ka="http.server.request.start";function Vd(e){let t=e.host||"",n=/^(.*):(\d+)$/.exec(t),r=n?n[1]:t,i=e.port??(n?Number(n[2]):void 0);return{method:e.method,port:i,protocol:e.protocol,host:e.host,hostname:r,path:e.path,headers:e.getHeaders()}}function xy(e){try{return String(CP(e))}catch{return""}}function CP(e){let t=e.protocol||"http:",r=e.headers?.host&&String(e.headers?.host)||e.hostname||e.host||"",i=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(r)?"":`:${e.port}`,o=e.path?e.path:"/",s=`${t}//${r}${i}`;return new URL(o.startsWith("//")?`${s}${o}`:o,s)}function fr(e){return String(xy(Vd(e)))}function xP(e,t){let n=fr(e),r=Ki(n),i=t?.statusCode,o=Rl(i);on({category:"http",data:{status_code:i,url:qi(r),"http.method":e.method||"GET",...r.search?{"http.query":Wn(r.search)}:{},...r.hash?{"http.fragment":r.hash}:{}},type:"http",level:o},{event:"response",request:e,response:t})}function PP(e){let t=fr(e),[n,r]=pb(ur(t),"client","auto.http.client",e),i=e.getHeader("user-agent");return{name:n,attributes:{[B]:"http.client","otel.kind":"CLIENT","http.url":Ct(t),"http.method":e.method,"http.target":Ct(e.path||"/"),"net.peer.name":e.host,"http.host":e.getHeader("host"),...i?{"user_agent.original":i}:{},...r},onlyIfParent:!0}}function kP(e,t){let{statusCode:n,statusMessage:r,httpVersion:i,socket:o}=e,s=i?.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp";t.setAttributes({"http.response.status_code":n,"network.protocol.version":i,"http.flavor":i,"network.transport":s,"net.transport":s,"http.status_text":r?.toUpperCase(),"http.status_code":n,...U3(e),...G3(o)})}function G3(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 U3(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,i=t["content-encoding"];return r>=0?i&&i!=="identity"?{"http.response_content_length":r}:{"http.response_content_length_uncompressed":r}:{}}function Yd(e,t){let n=fr(e),r=C()?.getOptions(),{tracePropagationTargets:i,propagateTraceparent:o}=r??{};if(!qo(n,i,t)||!!e.getHeader("sentry-trace"))return;let c=$e({propagateTraceparent:o});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c;if(a)try{e.setHeader("sentry-trace",a),E&&g.log(Xr,"Added sentry-trace header")}catch(u){E&&g.error(Xr,"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(Xr,"Added traceparent header")}catch(u){E&&g.error(Xr,"Failed to set traceparent header:",et(u)?u.message:"Unknown error")}if(l){let u=Ws(e.getHeader("baggage"),l);if(u)try{e.setHeader("baggage",u),E&&g.log(Xr,"Added baggage header")}catch(d){E&&g.error(Xr,"Failed to set baggage header:",et(d)?d.message:"Unknown error")}}}var LP=e=>typeof e.__unwrap=="function",D3="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",MP=!1,Py=E?e=>{MP||(LP(e.request)||LP(e.get))&&(MP=!0,g.warn(D3))}:()=>{};function Ml(e){let t=new Wt(100),n=()=>C()?.getOptions(),r=i=>{if(ne().getScopeData().sdkProcessingMetadata[Zs]===!0)return;let o=n(),{errorMonitor:s="error",spans:c=o?Ue(o):!0,propagateTrace:a=!1,breadcrumbs:l=!0,http:p,https:u,suppressOtelWarning:d=!1}=e,{request:m}=i,_=fr(m);if(ub(_,C())||e.ignoreOutgoingRequests?.(_,m))return;let h=!1;function b(D,I){h||(h=!0,xP(D,I))}function N(D){D.on(s,()=>b(D,void 0)),D.prependListener("response",I=>{D.listenerCount("response")<=1&&I.resume(),I.on("end",()=>b(D,I)),I.on(s,()=>b(D,I))})}if(!c){l&&N(m),a&&Yd(m,t);return}d||(p&&Py(p),u&&Py(u));let M=k(PP(m));e.outgoingRequestHook?.(M,m),a&&(M.isRecording()?se(M,()=>{Yd(m,t)}):Yd(m,t));let R=!1;function v(D){R||(R=!0,M.setStatus(D),M.end())}let P=()=>v({code:0});m.on("close",P),m.on(s,D=>{E&&g.log(Xr,"outgoingRequest on request error()",D),l&&b(m,void 0),v({code:2})}),m.prependListener("response",D=>{m.removeListener("close",P),m.listenerCount("response")<=1&&D.resume(),kP(D,M),_n(D),e.outgoingResponseHook?.(M,D);let I=!1;function H(L){if(!I){I=!0,L&&E&&g.log(Xr,"outgoingRequest on response error()",L),l&&b(m,D);let G=D.aborted&&!D.complete,ce=L||typeof D.statusCode!="number"||G?{code:2}:Xt(D.statusCode);e.applyCustomAttributesOnSpan?.(M,m,D),v(ce)}}D.on("end",()=>H()),D.on(s,H)})};return{[Kr]:r}}var wP;function B3(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!="function"||(wP=Ml({...t,http:e})[Kr],Nr(n._storeHeader)))return;let i=n._storeHeader;Ps(n,"_storeHeader",function(...s){try{wP({request:this},Kr)}catch{}return i.apply(this,s)})}function H3(e,t={}){let n=Dd(e);return B3(n,t),e}var ky=(e,t={})=>H3(e,t);function GP(e,t,n,r){let i=0,o=[];E&&g.log(r,"Patching request.on");let s=new WeakMap,c=fb(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 M=N[0],R=Buffer.from(M);i<c?(o.push(R),i+=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(o).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 Ly=new WeakMap;function UP(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let i=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&i){E&&g.log(`Recorded request session with status: ${i.status}`);let o=new Date(tt());o.setSeconds(0,0);let s=o.toISOString(),c=Ly.get(e),a=c?.[s]||{exited:0,crashed:0,errored:0};if(a[{ok:"exited",crashed:"crashed",errored:"errored"}[i.status]]++,c)c[s]=a;else{E&&g.log("Opened new request session aggregate.");let l={[s]:a};Ly.set(e,l);let p=()=>{clearTimeout(d),u(),Ly.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);On(d)}}})}var DP="Http.Server",F3="Http.SentryServerSpans",BP=new WeakMap,HP=Symbol.for("sentry_http_server_instrumented");function W3(e){return!e[HP]&&(e[HP]=!0)}function V3(e,t){let n=t.emit,r=BP.get(t);if(n===r)return;let i=new Proxy(n,{apply(o,s,c){let[a,...l]=c;if(a!=="request")return o.apply(s,c);let p=C(),[u,d]=l;if(!p||!W3(u))return o.apply(s,c);E&&g.log(DP,"Handling incoming request");let m=J().clone();m.setClient(p);let _=u.socket?.remoteAddress,h=u.url||"/",b=Qo(u),{maxRequestBodySize:N="medium",ignoreRequestBody:M,sessions:R=!0,sessionFlushingDelayMS:v=6e4}=e;N!=="none"&&!M?.(h,u)&&GP(u,m,N,DP),m.setSDKProcessingMetadata({normalizedRequest:b,ipAddress:_});let P=(u.method||"GET").toUpperCase(),D=dr(h),I=`${P} ${D}`;return m.setTransactionName(I),R&&UP(p,{requestIsolationScope:m,response:d,sessionFlushingDelayMS:v??6e4}),nr(m,()=>{let H=b.headers?.["sentry-trace"],L=b.headers?.baggage,G=Array.isArray(H)?H[0]:H;return An({sentryTrace:G,baggage:Array.isArray(L)?L[0]:L},()=>{let ce=ne().getPropagationContext();ce.propagationSpanId=jt(),G||(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=o.apply(s,c)}):Ne=o.apply(s,c),Ne})})}});BP.set(t,i),t.emit=i}function My(e){let t=e.wrapServerEmitRequest,n=Y3(e),r={...e,wrapServerEmitRequest(o,s,c,a){let l=C()?.getOptions();e.spans??(l?Ue(l):!1)?n(o,s,c,a):t?t(o,s,c,a):a()}},i=o=>{let{server:s}=o;V3(r,s)};return{[ka]:i}}function Y3(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:i,errorMonitor:o="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(j3(c,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return E&&g.log(F3,"Skipping span creation for incoming request",c.url),p();let _=l.url||c.url||"/",h=ur(_),b=h?h.pathname:dr(_),N=(c.method||"GET").toUpperCase(),M=`${N} ${b}`,R=c.headers,v=R["user-agent"],P=R["x-forwarded-for"],D=c.httpVersion,I=R.host,H=I?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",L=_.startsWith("https")?"https":"http",{socket:G}=c,{localAddress:ce,localPort:ge,remoteAddress:Ne,remotePort:Te}=G??{};return ke({name:M,kind:U.SERVER,attributes:{[B]:"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":Z3(c)||void 0,[pt]:h&&!pr(h)?Ct(h.href,m):void 0,[Zi]:h?.pathname??b,[yi]:Ct(_,m),"http.method":N,"http.target":Ct(h?`${h.pathname}${h.search}`:b,m),"http.host":I,"net.host.name":H,"http.client_ip":typeof P=="string"?P.split(",")[0]:void 0,"http.user_agent":v,"http.scheme":L,"http.flavor":D,"net.transport":D?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...X3(c),...Hr(l.headers||{},m.getDataCollectionOptions())}},Ce=>{i?.(Ce,c,a);let qe=!1;function Nt(Sn){qe||(qe=!0,Ce.setAttributes({"http.status_text":a.statusMessage?.toUpperCase(),"http.response.status_code":a.statusCode,"http.status_code":a.statusCode,...Hr(Du(a.headers),m?.getDataCollectionOptions()??!1,"response")}),Ce.setStatus(Sn),s?.(Ce,c,a),Ce.end())}a.once("close",()=>{Nt(Xt(a.statusCode))}),a.once(o,()=>{let Sn=Xt(a.statusCode);Nt(Sn.code===2?Sn:{code:2})}),p()})}}}function j3(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,i=e.method?.toUpperCase();return!!(i==="OPTIONS"||i==="HEAD"||!r||t&&i==="GET"&&FP(r)||n?.(r,e))}function FP(e){let t=dr(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 Z3(e){return e.headers["next-router-prefetch"]==="1"}function X3(e){let{headers:t}=e,n=t["content-length"],r=n?parseInt(String(n),10):-1,i=t["content-encoding"];return r>=0?i&&i!=="identity"?{"http.request_content_length":r}:{"http.request_content_length_uncompressed":r}:{}}at();import{subscribe as K3}from"diagnostics_channel";var We=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var WP=xo("sentry_http_server_instrumented"),q3="Http.Server";function VP(e,t){we(e,"_startSpanCallback",new WeakRef(t))}var Q3=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??"medium",spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(n,r,i,o){let s=C();if(!s||pe.active().getValue(WP))return o();let c=ci.extract(pe.active(),i.headers).setValue(WP,!0);pe.with(c,()=>{s.emit("httpServerRequest",n,r,i);let a=n._startSpanCallback?.deref();a?a(()=>(o(),!0)):o()})}};return{name:q3,setupOnce(){let{[ka]:n}=My(t);K3(ka,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`.")}}}),La=Q3;at();JN();import{errorMonitor as J3}from"events";var YP="Http.ServerSpans",$3=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,r=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:i}=e,{requestHook:o,responseHook:s,applyCustomAttributesOnSpan:c}=e.instrumentation??{};return{name:YP,setup(a){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||a.on("httpServerRequest",(l,p,u)=>{let d=l,m=p;VP(d,h=>{if(tj(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return We&&g.log(YP,"Skipping span creation for incoming request",d.url),h();let b=u.url||d.url||"/",N=ur(b),M=d.headers,R=M["user-agent"],v=M["x-forwarded-for"],P=d.httpVersion,D=M.host,I=D?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",H=b.startsWith("https")?"https":"http",L=u.method||d.method?.toUpperCase()||"GET",G=N?N.pathname:dr(b),ce=`${L} ${G}`,ge=k({name:ce,kind:U.SERVER,attributes:{[B]:"http.server",[S]:"auto.http.otel.http",[u0]:z3(d)||void 0,[pt]:N&&!pr(N)?Ct(N.href,a):void 0,[Zi]:N?.pathname??G,[yi]:Ct(b,a),[Gr]:u.method,[Nu]:Ct(N?`${N.pathname}${N.search}`:G,a),[JR]:D,[o0]:I,[qR]:typeof v=="string"?v.split(",")[0]:void 0,[zR]:R,[$R]:H,[QR]:P,[ra]:P?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...nj(d),...Hr(u.headers||{},a.getDataCollectionOptions())}});o?.(ge,d),s?.(ge,m),c?.(ge,d,m),i?.(ge,d,m);let Ne={type:u_.HTTP,span:ge};return se(ge,()=>pe.with(QN(pe.active(),Ne),()=>{_n(d),_n(m);let Te=!1;function Ce(qe){if(Te)return;Te=!0;let Nt=oj(d,m,Ne);ge.setAttributes(Nt),ge.setStatus(qe),ge.end();let Sn=Nt["http.route"];Sn&&J().setTransactionName(`${d.method?.toUpperCase()||"GET"} ${Sn}`)}return m.on("close",()=>{Ce(Xt(m.statusCode))}),m.on(J3,()=>{let qe=Xt(m.statusCode);Ce(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(sj(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."))}}}),Ma=$3;function z3(e){return e.headers["next-router-prefetch"]==="1"}function ej(e){let t=dr(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 tj(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(kr())return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i==="OPTIONS"||i==="HEAD"||!r||t&&i==="GET"&&ej(r)||n?.(r,e))}function nj(e){let t=rj(e.headers);return t==null?{}:ij(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function rj(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 oj(e,t,n){let{socket:r}=e,{statusCode:i,statusMessage:o}=t,s={[hn]:i,[bi]:i,"http.status_text":o?.toUpperCase()};if(r){let{localAddress:c,localPort:a,remoteAddress:l,remotePort:p}=r;s[i0]=c,s[s0]=a,s[a0]=l,s[xe]=p}if(s[bi]=i,s["http.status_text"]=(o||"").toUpperCase(),n?.type===u_.HTTP&&n.route!==void 0){let c=n.route;s[He]=c}return s}function sj(e,t){return t.some(n=>{if(typeof n=="number")return n===e;let[r,i]=n;return e>=r&&e<=i})}at();import{subscribe as eZ,unsubscribe as tZ}from"diagnostics_channel";at();var wl=class{emit(t){}enabled(){return!1}},jP=new wl;var Gl=Symbol.for("io.opentelemetry.js.api.logs"),wa=globalThis;function ZP(e,t,n){return r=>r===e?t:n}var wy=1;var Gy=class{getLogger(t,n,r){return new wl}},jd=new Gy;var Zd=class{constructor(t,n,r,i){this._provider=t,this.name=n,this.version=r,this.options=i}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):jP}};var Ul=class{getLogger(t,n,r){var i;return(i=this._getDelegateLogger(t,n,r))!==null&&i!==void 0?i:new Zd(this,t,n,r)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:jd}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,n,r){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,n,r)}};var Xd=class e{constructor(){this._proxyLoggerProvider=new Ul}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return wa[Gl]?this.getLoggerProvider():(wa[Gl]=ZP(wy,t,jd),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,n;return(n=(t=wa[Gl])===null||t===void 0?void 0:t.call(wa,wy))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(t,n,r){return this.getLoggerProvider().getLogger(t,n,r)}disable(){delete wa[Gl],this._proxyLoggerProvider=new Ul}};var Kd=Xd.getInstance();function XP(e,t,n,r){for(let i=0,o=e.length;i<o;i++){let s=e[i];t&&s.setTracerProvider(t),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}}function KP(e){e.forEach(t=>t.disable())}function Ga(e){let t=e.tracerProvider||he.getTracerProvider(),n=e.meterProvider||qp.getMeterProvider(),r=e.loggerProvider||Kd.getLoggerProvider(),i=e.instrumentations?.flat()??[];return XP(i,t,n,r),()=>{KP(i)}}import*as Ni from"path";import{types as bk}from"util";at();var zP=/^(?: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-]+)*))?$/,aj=/^(?<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-]+)*))?$/,cj={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function ek(e,t,n){if(!lj(e))return nn.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,"$1");let r=mj(e);if(!r)return!1;let i=[],o=tk(r,t,i,n);return o&&!n?.includePrerelease?uj(r,i):o}function lj(e){return typeof e=="string"&&zP.test(e)}function tk(e,t,n,r){if(t.includes("||")){let i=t.trim().split("||");for(let o of i)if(Uy(e,o,n,r))return!0;return!1}else if(t.includes(" - "))t=Mj(t,r);else if(t.includes(" ")){let i=t.trim().replace(/\s{2,}/g," ").split(" ");for(let o of i)if(!Uy(e,o,n,r))return!1;return!0}return Uy(e,t,n,r)}function Uy(e,t,n,r){if(t=dj(t,r),t.includes(" "))return tk(e,t,n,r);{let i=fj(t);return n.push(i),pj(e,i)}}function pj(e,t){if(t.invalid)return!1;if(!t.version||By(t.version))return!0;let n=QP(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];!r.length&&!i.length?n=0:!r.length&&i.length?n=1:r.length&&!i.length?n=-1:n=QP(r,i)}return cj[t.op]?.includes(n)}function uj(e,t){return e.prerelease?t.some(n=>n.prerelease&&n.version===e.version):!0}function dj(e,t){return e=e.trim(),e=kj(e,t),e=Pj(e),e=Lj(e,t),e=e.trim(),e}function cn(e){return!e||e.toLowerCase()==="x"||e==="*"}function mj(e){let t=e.match(zP);if(!t){nn.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,o=n.split("."),s=r?.split(".");return{op:void 0,version:n,versionSegments:o,versionSegmentCount:o.length,prerelease:r,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:i}}function fj(e){if(!e)return{};let t=e.match(aj);if(!t)return nn.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,o=t.groups.build,s=r.split("."),c=i?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:s,versionSegmentCount:s.length,prerelease:i,prereleaseSegments:c,prereleaseSegmentCount:c?c.length:0,build:o}}function By(e){return e==="*"||e==="x"||e==="X"}function qP(e){let t=parseInt(e,10);return isNaN(t)?e:t}function gj(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 _j(e,t){if(By(e)||By(t))return 0;let[n,r]=gj(qP(e),qP(t));return n>r?1:n<r?-1:0}function QP(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=_j(e[n]||"0",t[n]||"0");if(r!==0)return r}return 0}var nk="[a-zA-Z0-9-]",rk="0|[1-9]\\d*",hj=`\\d*[a-zA-Z-]${nk}*`,bj="((?:<|>)?=?)",JP=`(?:${rk}|${hj})`,yj=`(?:-(${JP}(?:\\.${JP})*))`,$P=`${nk}+`,Sj=`(?:\\+(${$P}(?:\\.${$P})*))`,Dy=`${rk}|x|X|\\*`,Dl=`[v=\\s]*(${Dy})(?:\\.(${Dy})(?:\\.(${Dy})(?:${yj})?${Sj}?)?)?`,Ej=`^${bj}\\s*${Dl}$`,Tj=new RegExp(Ej),Ij=`^\\s*(${Dl})\\s+-\\s+(${Dl})\\s*$`,Aj=new RegExp(Ij),Nj="(?:~>?)",vj=`^${Nj}${Dl}$`,Rj=new RegExp(vj),Oj="(?:\\^)",Cj=`^${Oj}${Dl}$`,xj=new RegExp(Cj);function Pj(e){let t=Rj;return e.replace(t,(n,r,i,o,s)=>{let c;return cn(r)?c="":cn(i)?c=`>=${r}.0.0 <${+r+1}.0.0-0`:cn(o)?c=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:s?c=`>=${r}.${i}.${o}-${s} <${r}.${+i+1}.0-0`:c=`>=${r}.${i}.${o} <${r}.${+i+1}.0-0`,c})}function kj(e,t){let n=xj,r=t?.includePrerelease?"-0":"";return e.replace(n,(i,o,s,c,a)=>{let l;return cn(o)?l="":cn(s)?l=`>=${o}.0.0${r} <${+o+1}.0.0-0`:cn(c)?o==="0"?l=`>=${o}.${s}.0${r} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.0${r} <${+o+1}.0.0-0`:a?o==="0"?s==="0"?l=`>=${o}.${s}.${c}-${a} <${o}.${s}.${+c+1}-0`:l=`>=${o}.${s}.${c}-${a} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.${c}-${a} <${+o+1}.0.0-0`:o==="0"?s==="0"?l=`>=${o}.${s}.${c}${r} <${o}.${s}.${+c+1}-0`:l=`>=${o}.${s}.${c}${r} <${o}.${+s+1}.0-0`:l=`>=${o}.${s}.${c} <${+o+1}.0.0-0`,l})}function Lj(e,t){let n=Tj;return e.replace(n,(r,i,o,s,c,a)=>{let l=cn(o),p=l||cn(s),u=p||cn(c),d=u;return i==="="&&d&&(i=""),a=t?.includePrerelease?"-0":"",l?i===">"||i==="<"?r="<0.0.0-0":r="*":i&&d?(p&&(s=0),c=0,i===">"?(i=">=",p?(o=+o+1,s=0,c=0):(s=+s+1,c=0)):i==="<="&&(i="<",p?o=+o+1:s=+s+1),i==="<"&&(a="-0"),r=`${i+o}.${s}.${c}${a}`):p?r=`>=${o}.0.0${a} <${+o+1}.0.0-0`:u&&(r=`>=${o}.${s}.0${a} <${o}.${+s+1}.0-0`),r})}function Mj(e,t){let n=Aj;return e.replace(n,(r,i,o,s,c,a,l,p,u,d,m,_)=>(cn(o)?i="":cn(s)?i=`>=${o}.0.0${t?.includePrerelease?"-0":""}`:cn(c)?i=`>=${o}.${s}.0${t?.includePrerelease?"-0":""}`:a?i=`>=${i}`:i=`>=${i}${t?.includePrerelease?"-0":""}`,cn(u)?p="":cn(d)?p=`<${+u+1}.0.0-0`:cn(m)?p=`<${u}.${+d+1}.0-0`:_?p=`<=${u}.${d}.${m}-${_}`:t?.includePrerelease?p=`<${u}.${d}.${+m+1}-0`:p=`<=${p}`,`${i} ${p}`.trim()))}var ln=console.error.bind(console);function Bl(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 rs=(e,t,n)=>{if(!e||!e[t]){ln("no original function "+String(t)+" to wrap");return}if(!n){ln("no wrapper function"),ln(new Error().stack);return}let r=e[t];if(typeof r!="function"||typeof n!="function"){ln("original object and wrapper must be functions");return}let i=n(r,t);return Bl(i,"__original",r),Bl(i,"__unwrap",()=>{e[t]===i&&Bl(e,t,r)}),Bl(i,"__wrapped",!0),Bl(e,t,i),i},Hy=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{ln("must provide one or more modules to patch"),ln(new Error().stack);return}if(!(t&&Array.isArray(t))){ln("must provide one or more functions to wrap on modules");return}e.forEach(r=>{t.forEach(i=>{rs(r,i,n)})})},Ua=(e,t)=>{if(!e||!e[t]){ln("no function to unwrap."),ln(new Error().stack);return}let n=e[t];if(!n.__unwrap)ln("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{n.__unwrap();return}},Fy=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{ln("must provide one or more modules to patch"),ln(new Error().stack);return}if(!(t&&Array.isArray(t))){ln("must provide one or more functions to unwrap on modules");return}e.forEach(n=>{t.forEach(r=>{Ua(n,r)})})};function Hl(e){e&&e.logger&&(typeof e.logger!="function"?ln("new logger isn't a function, not replacing"):ln=e.logger)}Hl.wrap=rs;Hl.massWrap=Hy;Hl.unwrap=Ua;Hl.massUnwrap=Fy;at();var qd=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,n,r){this.instrumentationName=t,this.instrumentationVersion=n,this.setConfig(r),this._diag=nn.createComponentLogger({namespace:t}),this._tracer=he.getTracer(t,n),this._meter=qp.getMeter(t,n),this._logger=Kd.getLogger(t,n),this._updateMetricInstruments()}_wrap=rs;_unwrap=Ua;_massWrap=Hy;_massUnwrap=Fy;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,i){if(t)try{t(r,i)}catch(o){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},o)}}};var sk=Xp(Xy());import*as Ky from"path";var Jd=class{hooks=[];children=new Map},$d=class{_trie=new Jd;_counter=0;insert(t){let n=this._trie;for(let r of t.moduleName.split("/")){let i=n.children.get(r);i||(i=new Jd,n.children.set(r,i)),n=i}n.hooks.push({hook:t,insertedId:this._counter++})}search(t,{maintainInsertionOrder:n,fullOnly:r}={}){let i=this._trie,o=[],s=!0;for(let c of t.split("/")){let a=i.children.get(c);if(!a){s=!1;break}r||o.push(...a.hooks),i=a}return r&&s&&o.push(...i.hooks),o.length===0?[]:o.length===1?[o[0].hook]:(n&&o.sort((c,a)=>c.insertedId-a.insertedId),o.map(({hook:c})=>c))}};var Bj=["afterEach","after","beforeEach","before","describe","it"].every(e=>typeof global[e]=="function"),zd=class e{_moduleNameTrie=new $d;static _instance;constructor(){this._initialize()}_initialize(){new sk.Hook(null,{internals:!0},(t,n,r)=>{let i=Hj(n),o=this._moduleNameTrie.search(i,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:s}of o)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 Bj?new e:this._instance=this._instance??new e}};function Hj(e){return Ky.sep!=="/"?e.split(Ky.sep).join("/"):e}var Sk=Xp(iS());at();var Ek=Xp(Xy());import{readFileSync as zj}from"fs";function qr(e,t,n){let r,i;try{i=e()}catch(o){r=o}finally{if(t(r,i),r&&!n)throw r;return i}}function w(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var ae=class extends qd{_modules;_hooks=[];_requireInTheMiddleSingleton=zd.getInstance();_enabled=!1;constructor(t,n,r){super(t,n,r);let i=this.init();i&&!Array.isArray(i)&&(i=[i]),this._modules=i||[],this._config.enabled&&this.enable()}_wrap=(t,n,r)=>{if(w(t[n])&&this._unwrap(t,n),bk.isProxy(t)){let i=rs(Object.assign({},t),n,r);return Object.defineProperty(t,n,{value:i}),i}else return rs(t,n,r)};_unwrap=(t,n)=>bk.isProxy(t)?Object.defineProperty(t,n,{value:t[n]}):Ua(t,n);_massWrap=(t,n,r)=>{if(t)Array.isArray(t)||(t=[t]);else{nn.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nn.error("must provide one or more functions to wrap on modules");return}t.forEach(i=>{n.forEach(o=>{this._wrap(i,o,r)})})};_massUnwrap=(t,n)=>{if(t)Array.isArray(t)||(t=[t]);else{nn.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){nn.error("must provide one or more functions to wrap on modules");return}t.forEach(r=>{n.forEach(i=>{this._unwrap(r,i)})})};_warnOnPreloadedModules(){let t=globalThis.require;!t?.resolve||!t?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let i=t.resolve(r);t.cache[i]?.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=zj(Ni.join(t,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{nn.warn("Failed extracting version",t)}}_onRequire(t,n,r,i){if(!i)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 o=this._extractPackageVersion(i);if(t.moduleVersion=o,t.name===r)return yk(t.supportedVersions,o,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:i}),t.patch(n,t.moduleVersion)):n;let s=t.files??[],c=Ni.normalize(r);return s.filter(l=>l.name===c&&yk(l.supportedVersions,o,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:i}),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&&Ni.isAbsolute(c)){let l=Ni.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),i=Ni.isAbsolute(t.name)?new Ek.Hook([t.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(t.name,r);this._hooks.push(i);let o=new Sk.Hook([t.name],{internals:!0},n);this._hooks.push(o)}}}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 yk(e,t,n){return typeof t>"u"?e.includes("*"):e.some(r=>ek(t,r,{includePrerelease:n}))}var re=class{files;name;supportedVersions;patch;unpatch;constructor(t,n,r,i,o){this.files=o||[],this.name=t,this.supportedVersions=n,this.patch=r,this.unpatch=i}};var en=Ms(process.versions.node),Wa=en.major,oS=en.minor;import{errorMonitor as nZ}from"events";import*as Tk from"http";var rZ=en.major===22&&en.minor>=12||en.major===23&&en.minor>=2||en.major>=24;function is(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,r={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(i,o){return kr()||!!n.ignoreOutgoingRequests?.(i,Vd(o))},outgoingRequestHook(i,o){n.outgoingRequestHook?.(i,o);let s=o.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,i);return pe.with(m,()=>a.apply(l,p))}});o.once=c},outgoingResponseHook(i,o){n.outgoingResponseHook?.(i,o)},errorMonitor:nZ,http:Tk};rZ?iZ(r):oZ(r)}var sS;function iZ(e){let{[Kr]:t}=Ml(e);sS&&tZ(Kr,sS),eZ(Kr,t),sS=t}function oZ(e){ky(Tk,e)}var Ik="Http";Object.assign(is,{id:`${Ik}.sentry`});var Ak=(e={})=>{let t=e.spans??!1,n=e.disableIncomingRequestSpans??!1,r=t&&!n,i={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},o={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},s={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests,spans:t},c=La(i),a=Ma(o);return{name:Ik,setup(l){r&&a.setup(l)},setupOnce(){c.setupOnce(),is(s)},processEvent(l){return a.processEvent(l)}}};import*as tm from"diagnostics_channel";import{URL as uZ}from"url";var aS="sentry-trace",em="baggage",sZ="traceparent";function pS(e,t,n){let r=vk(e.origin,e.path),{tracePropagationTargets:i,propagateTraceparent:o}=C()?.getOptions()||{};if(!qo(r,i,t))return;let s=n&&Lr(n)&&Q()?void 0:n,c=s?se(s,()=>$e({propagateTraceparent:o})):$e({propagateTraceparent:o});if(!c)return;let{"sentry-trace":a,baggage:l,traceparent:p}=c,u=Array.isArray(e.headers)?aZ(e.headers):cZ(e.headers);if(cS(u,aS),cS(u,em),o&&cS(u,sZ),!(lS(u,aS)!==-1)){a&&u.push(aS,a),p&&lS(u,"traceparent")===-1&&u.push("traceparent",p);let m=lS(u,em);if(l&&m===-1)u.push(em,l);else if(l){let _=u[m+1],h=Ws(_,l);h&&(u[m+1]=h)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...u):e.headers=lZ(u)}function aZ(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 cZ(e){let t=e.split(`\r
|
|
22
|
-
`),n=[];for(let r of t)try{let i=r.indexOf(":");if(i===-1)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&n.push(o,s)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function lZ(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];!r||i==null||t.push(`${r}: ${i}`)}return t.length?t.join(`\r
|
|
23
|
-
`).concat(`\r
|
|
24
|
-
`):""}function cS(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 i=e[n+1];if(t===em&&i){let o=Ws(e[r+1],i);o&&(e[n+1]=o)}e.splice(r,2),r-=2}}function lS(e,t){return e.findIndex((n,r)=>r%2===0&&n===t)}function Nk(e,t){let n=pZ(e),r=t.statusCode,i=Rl(r);on({category:"http",data:{status_code:r,...n},type:"http",level:i},{event:"response",request:e,response:t})}function pZ(e){try{let t=vk(e.origin,e.path),n=Ki(t),r={url:qi(n),"http.method":e.method||"GET"};return n.search&&(r["http.query"]=Wn(n.search)),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function vk(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 dZ="http.request.method_original",uS=[],os=new WeakMap,Ok=new WeakMap,Rk=new Wt(100);function Yl(e={}){uS.length||(Vl("undici:request:create",t=>mZ(e,t)),Vl("undici:client:sendHeaders",t=>fZ(e,t)),Vl("undici:request:headers",t=>gZ(e,t)),Vl("undici:request:trailers",t=>_Z(t)),Vl("undici:request:error",t=>hZ(t)))}function dS(e,t){try{return e()}catch(n){t(n);return}}function Vl(e,t){let[n=0,r=0]=process.version.replace("v","").split(".").map(o=>Number(o));n>18||n===18&&r>=19?uS.push(tm.subscribe?.(e,t)):uS.push(tm.channel(e).subscribe(t))}function Ck(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],i=e.headers[n+1];typeof r=="string"&&i!==void 0&&t.set(r.toLowerCase(),i)}else if(typeof e.headers=="string"){let n=e.headers.split(`\r
|
|
25
|
-
`);for(let r of n){if(!r)continue;let i=r.indexOf(":");if(i===-1)continue;let o=r.substring(0,i).toLowerCase(),s=r.substring(i+1).trim(),c=t.get(o);c&&Array.isArray(c)?c.push(s):c?t.set(o,[c,s]):t.set(o,s)}}return t}function mZ(e,{request:t}){let n=yZ(t.origin,t.path),r=dS(()=>!!e.ignoreOutgoingRequests?.(n),b=>b&&We&&g.error("caught ignoreOutgoingRequests error: ",b)),i=kr()||!!r;if(Ok.set(t,i),!e.spans){e.tracePropagation!==!1&&!i&&pS(t,Rk);return}if(t.method==="CONNECT"||r)return;let o;try{o=new uZ(t.path,t.origin)}catch(b){We&&g.warn("could not determine url.full:",b);return}let s=o.protocol.replace(":",""),c=bZ(t.method),a={[Ur]:c,[dZ]:t.method,[pt]:Ct(o.toString()),[Zi]:o.pathname,[Ou]:Wn(o.search),[y0]:s,[S]:"auto.http.otel.node_fetch"};if(n.startsWith("data:")){let b=tl(n);a["http.url"]=b,a[pt]=b,a[gn]=`${t.method||"GET"} ${b}`}let l={https:"443",http:"80"},p=o.hostname,u=o.port||l[s];a[_t]=p,u&&!isNaN(Number(u))&&(a[ht]=Number(u));let m=Ck(t).get("user-agent");if(m){let b=Array.isArray(m)?m[m.length-1]:m;a[S0]=b}let _=C(),h=k({name:c==="_OTHER"?"HTTP":c,kind:U.CLIENT,attributes:a,onlyIfParent:!_||!rt(_)});dS(()=>e.requestHook?.(h,t),b=>b&&We&&g.error("caught requestHook error: ",b)),pS(t,Rk,h),os.set(t,h)}function fZ(e,{request:t,socket:n}){let r=os.get(t);if(!r)return;let{remoteAddress:i,remotePort:o}=n,s={[t0]:i,[n0]:o};if(e.headersToSpanAttributes?.requestHeaders){let c=new Set(e.headersToSpanAttributes.requestHeaders.map(l=>l.toLowerCase())),a=Ck(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 gZ(e,{request:t,response:n}){e.breadcrumbs!==!1&&!Ok.get(t)&&Nk(t,n);let i=os.get(t);if(!i)return;let o={[hn]:n.statusCode};if(dS(()=>e.responseHook?.(i,{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(o,d)?o[d].push(u.toString()):o[d]=[u.toString()]}}}i.setAttributes(o),n.statusCode>=400&&i.setStatus(Xt(n.statusCode))}function _Z({request:e}){let t=os.get(e);t&&(t.end(),os.delete(e))}function hZ({request:e,error:t}){let n=os.get(e);n&&(n.setStatus({code:2,message:t.message}),n.end(),os.delete(e))}function bZ(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 yZ(e,t="/"){let n=`${e}`;return n.endsWith("/")&&t.startsWith("/")?`${n}${t.slice(1)}`:!n.endsWith("/")&&!t.startsWith("/")?`${n}/${t}`:`${n}${t}`}var SZ=((e={})=>({name:"NodeFetch",setupOnce(){Yl(e)}})),xk=SZ;at();at();JN();var NS="sentry.parentIsRemote",ss="sentry.graphql.operation";function vS(e){if("parentSpanId"in e)return e.parentSpanId;if("parentSpanContext"in e)return e.parentSpanContext?.spanId}function om(e){return V(e.attributes)}function wk(e){return typeof e.kind=="number"}function Gk(e){return!!e.status}function mS(e){return!!e.name}function Uk(e){if(!om(e))return{};let t=e.attributes[pt]||e.attributes[yi],n={url:t,"http.method":e.attributes[Ur]||e.attributes[Gr]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof t=="string"){let r=Ki(t);n.url=qi(r);let i=Wn(r.search);i&&(n["http.query"]=i),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function Dk(e){return wk(e)?e.kind:vt.INTERNAL}var nm="sentry-trace",fS="baggage",sm="sentry.dsc",RS="sentry.sampled_not_recording",Bk="sentry.url",EZ="sentry.sample_rand",TZ="sentry.sample_rate",am="sentry.ignored",Hk="sentry.segment_ignored",cm=xo("sentry_scopes"),gS=xo("sentry_fork_isolation_scope"),_S=xo("sentry_fork_set_scope"),rm=xo("sentry_fork_set_isolation_scope"),Fk="_scopeContext";function as(e){return e.getValue(cm)}function Wk(e,t){return e.setValue(cm,t)}function IZ(e,t){we(e,Fk,Lo(t))}function Va(e){return Mo(e[Fk])}function Ya(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(RS)==="1":!1;if(t===Ir.SAMPLED)return!0;if(r)return!1;let i=n?n.get(sm):void 0,o=i?rr(i):void 0;if(o?.sampled==="true")return!0;if(o?.sampled==="false")return!1}function Vk(e,t){let n=e.spanContext(),r=Re(e),i=Ya(n);if(i!==void 0)return i;if(Lr(r))return!1;if(!(!Ue(t?.getOptions())||n.isRemote||!Mc(r)))return Qt(e)}function Zl(e,t,n){let r=t[Ur]||t[Gr];if(r)return NZ({attributes:t,name:e,kind:n},r);let i=t[mt]||t[Pe],o=typeof t[B]=="string"&&t[B].startsWith("cache.");if(i&&!o)return AZ({attributes:t,name:e});let s=t[ve]==="custom"?"custom":"route";if(t[Ru])return{...jl(e,t,"route"),op:"rpc"};if(t[wt])return{...jl(e,t,s),op:"message"};let l=t[Eu];return l?{...jl(e,t,s),op:l.toString()}:{op:void 0,description:e,source:"custom"}}function Yk(e){let t,n;if(om(e))t=e.attributes,n=mS(e)?e.name:"<unknown>";else{let i=typeof e.spanContext=="function"?oe(e):void 0;t=i?.data||{},n=mS(e)?e.name:i?.description||"<unknown>"}let r=Dk(e);return Zl(n,t,r)}function AZ({attributes:e,name:t}){let n=e[gn];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 NZ({name:e,kind:t,attributes:n},r){let i=["http"];switch(t){case vt.CLIENT:i.push("client");break;case vt.SERVER:i.push("server");break}n["sentry.http.prefetch"]&&i.push("prefetch");let{urlPath:o,url:s,query:c,fragment:a,hasRoute:l}=RZ(n,t);if(!o)return{...jl(e,n),op:i.join(".")};let p=n[ss],u=`${r} ${o}`,d=p?`${u} (${vZ(p)})`:u,m=l||o==="/"?"route":"url",_={};s&&(_.url=Ct(s));let h=Wn(c);h&&(_["http.query"]=h.slice(1)),a&&(_["http.fragment"]=a.slice(1));let b=t===vt.CLIENT||t===vt.SERVER,M=!`${n[S]||"manual"}`.startsWith("auto"),R=n[ve]==="custom",v=n[gn],P=!R&&v==null&&(b||!M),{description:D,source:I}=P?{description:d,source:m}:jl(e,n);return{op:i.join("."),description:D,source:I,data:_}}function vZ(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 RZ(e,t){let n=e[Nu],r=e[yi]||e[pt],i=e[He],o=typeof r=="string"?Ki(r):void 0,s=o?qi(o):void 0,c=o?.search||void 0,a=o?.hash||void 0;return typeof i=="string"?{urlPath:i,url:s,query:c,fragment:a,hasRoute:!0}:t===vt.SERVER&&typeof n=="string"?{urlPath:dr(n),url:s,query:c,fragment:a,hasRoute:!1}:o?{urlPath:s,url:s,query:c,fragment:a,hasRoute:!1}:typeof n=="string"?{urlPath:dr(n),url:s,query:c,fragment:a,hasRoute:!1}:{urlPath:void 0,url:s,query:c,fragment:a,hasRoute:!1}}function jl(e,t,n="custom"){let r=t[ve]||n,i=t[gn];return i&&typeof i=="string"?{description:i,source:r}:{description:e,source:r}}function OS(e){e.on("createDsc",(t,n)=>{if(!n)return;let r=oe(n),o=r.data[ve],s=Vk(n,e);if(s===!1)delete t.transaction;else if(r.description){let{description:c}=Yk(n);o!=="url"&&c&&(t.transaction=c)}Ue()&&(t.sampled=s==null?void 0:String(s))})}function CS(){return he.getActiveSpan()}var ao=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,im=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 jk({dsc:e,sampled:t}){let n=e?Hi(e):void 0,r=new im,i=n?r.set(sm,n):r;return t===!1?i.set(RS,"1"):i}var Zk=new Set;function xS(){return Array.from(Zk)}function cs(e){Zk.add(e)}var ja=class extends qN{constructor(){super(),cs("SentryPropagator"),this._urlMatchesTargetsMap=new Wt(100)}inject(t,n,r){if(Os(t)){ao&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let i=he.getSpan(t),o=i&&PZ(i),{tracePropagationTargets:s,propagateTraceparent:c}=C()?.getOptions()||{};if(!qo(o,s,this._urlMatchesTargetsMap)){ao&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",o);return}let a=CZ(n),l=xZ(n),p=ci.getBaggage(t)||ci.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:m,sampled:_}=Xk(t);if(a){let h=Fs(a);h&&Object.entries(h).forEach(([b,N])=>{!l&&b.startsWith(ui)||(p=p.setEntry(b,{value:N}))})}!l&&u&&(p=Object.entries(u).reduce((h,[b,N])=>N?h.setEntry(`${ui}${b}`,{value:N}):h,p)),!l&&d&&d!==KN&&(r.set(n,nm,Fi(d,m,_)),c&&r.set(n,"traceparent",Wi(d,m,_))),super.inject(ci.setBaggage(t,p),n,r)}extract(t,n,r){let i=r.get(n,nm),o=r.get(n,fS),s=i?Array.isArray(i)?i[0]:i:void 0;return qk(Kk(t,{sentryTrace:s,baggage:o}))}fields(){return[nm,fS,"traceparent"]}};function Xk(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:Ya(c)}}if(n){let c=n.spanContext();return{dynamicSamplingContext:nt(n),traceId:c.traceId,spanId:c.spanId,sampled:Vk(n,t.client)}}let r=t.scope||as(e)?.scope||ne(),i=t.client||C(),o=r.getPropagationContext();return{dynamicSamplingContext:i?or(i,r):void 0,traceId:o.traceId,spanId:o.propagationSpanId,sampled:o.sampled}}function Kk(e,{sentryTrace:t,baggage:n}){let r=In(t,n),{traceId:i,parentSpanId:o,sampled:s,dsc:c}=r,a=C(),l=rr(n);if(!o||a&&!xc(a,l?.org_id))return e;let p=kZ({traceId:i,spanId:o,sampled:s,dsc:c});return he.setSpanContext(e,p)}function OZ(e,t,n){let r=qk(Kk(e,t));return pe.with(r,n)}function qk(e){let t=as(e),n={scope:t?t.scope:ne().clone(),isolationScope:t?t.isolationScope:J()};return Wk(e,n)}function CZ(e){try{let t=e[fS];return Array.isArray(t)?t.join(","):t}catch{return}}function xZ(e){try{return e[nm]}catch{return}}function PZ(e){let t=oe(e).data,n=t[yi]||t[pt];if(typeof n=="string")return n;let r=e.spanContext().traceState?.get(Bk);if(r)return r}function kZ({spanId:e,traceId:t,sampled:n,dsc:r}){let i=jk({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?Ir.SAMPLED:Ir.NONE,traceState:i}}function Qk(e,t,n){let r=eL(),{name:i,parentSpan:o}=e;return oL(o)(()=>{let c=rL(e.scope,e.forceTransaction),a=e.onlyIfParent&&!he.getSpan(c),l=a?Rs(c):c;a&&C()?.recordDroppedEvent("no_parent_span","span");let p=tL(e);if(!Ue()){let u=Os(l)?l:Rs(l);return pe.with(u,()=>r.startActiveSpan(i,p,u,d=>(hS(d),pe.with(c,()=>sr(()=>t(d),()=>{oe(d).status===void 0&&d.setStatus({code:Gn.ERROR})},n?()=>d.end():void 0)))))}return r.startActiveSpan(i,p,l,u=>(hS(u),sr(()=>t(u),()=>{oe(u).status===void 0&&u.setStatus({code:Gn.ERROR})},n?()=>u.end():void 0)))})}function Jk(e,t){return Qk(e,t,!0)}function $k(e,t){return Qk(e,n=>t(n,()=>n.end()),!1)}function zk(e){let t=eL(),{name:n,parentSpan:r}=e;return oL(r)(()=>{let o=rL(e.scope,e.forceTransaction),s=e.onlyIfParent&&!he.getSpan(o),c=s?Rs(o):o;s&&C()?.recordDroppedEvent("no_parent_span","span");let a=tL(e);Ue()||(c=Os(c)?c:Rs(c));let l=t.startSpan(n,a,c);return hS(l),l})}function PS(e,t){let n=e?he.setSpan(pe.active(),e):he.deleteSpan(pe.active());return pe.with(n,()=>t(ne()))}function eL(){return C()?.tracer||he.getTracer("@sentry/opentelemetry",q)}function tL(e){let{startTime:t,attributes:n,kind:r,op:i,links:o}=e,s=typeof t=="number"?nL(t):t;return{attributes:i?{[B]:i,...n}:n,kind:r,links:o,startTime:s}}function nL(e){return e<9999999999?e*1e3:e}function hS(e){let t=e.end.bind(e);e.end=n=>t(typeof n=="number"?nL(n):n)}function rL(e,t){let n=LZ(e),r=he.getSpan(n);if(!r||!t)return n;let i=he.deleteSpan(n),{spanId:o,traceId:s}=r.spanContext(),c=Ya(r.spanContext()),a=Re(r),l=nt(a),p=jk({dsc:l,sampled:c}),u={traceId:s,spanId:o,isRemote:!0,traceFlags:c?Ir.SAMPLED:Ir.NONE,traceState:p};return he.setSpanContext(i,u)}function LZ(e){if(e){let t=Va(e);if(t)return t}return pe.active()}function iL(e,t){return OZ(pe.active(),e,t)}function MZ(e){let t=yt(),n=jt(),r={traceId:t,spanId:n,isRemote:!0,traceFlags:Ir.NONE},i=he.setSpanContext(pe.active(),r);return pe.with(i,()=>(ne().setPropagationContext({traceId:t,sampleRand:ct()}),e()))}function kS(e,t){let n=Va(t),r=n&&he.getSpan(n),i=r?xr(r):Go(t);return[r?nt(r):or(e,t),i]}function oL(e){return e!==void 0?t=>PS(e,t):t=>t()}function sL(e){let t=Rs(pe.active());return pe.with(t,e)}function wZ(e){let t=e?Va(e):pe.active();return t?Os(t):!1}function LS(e){e.on("preprocessEvent",t=>{let n=CS();if(!n||t.type==="transaction")return;t.contexts={trace:xr(n),...t.contexts};let r=Re(n);return t.sdkProcessingMetadata={dynamicSamplingContext:nt(r),...t.sdkProcessingMetadata},t})}function aL(e,t){let n=he.getSpan(e),r;if(n?.spanContext().traceState?.get(am)==="1"){let h=he.deleteSpan(e),b=he.getSpan(t);r=b?he.setSpan(h,b):h}else r=e;let i=as(r),o=i?.scope||ne(),s=i?.isolationScope||J(),c=r.getValue(gS)===!0,a=r.getValue(_S),l=r.getValue(rm),p=a||o.clone(),u=l||(c?s.clone():s),_=Wk(r,{scope:p,isolationScope:u}).deleteValue(gS).deleteValue(_S).deleteValue(rm);return IZ(p,_),_}function GZ(e){let t=new Map;for(let n of e)UZ(t,n);return Array.from(t,function([n,r]){return r})}function cL(e){return e.attributes[NS]===!0?void 0:vS(e)}function UZ(e,t){let n=t.spanContext().spanId,r=cL(t);if(!r){bS(e,{id:n,span:t,children:[]});return}let i=DZ(e,r),o=bS(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(o)}function DZ(e,t){let n=e.get(t);return n||bS(e,{id:t,children:[]})}function bS(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 lL={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"},pL=e=>Object.values(lL).includes(e);function uL(e){let t=om(e)?e.attributes:{},n=Gk(e)?e.status:void 0;if(n){if(n.code===Gn.OK)return{code:1};if(n.code===Gn.ERROR){if(typeof n.message>"u"){let i=yS(t);if(i)return i}return n.message&&pL(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=yS(t);return r||(n?.code===Gn.UNSET?{code:1}:{code:2,message:"unknown_error"})}function yS(e){let t=e[hn]||e[bi],n=e[c0],r=typeof t=="number"?t:typeof t=="string"?parseInt(t):void 0;if(typeof r=="number")return Xt(r);if(typeof n=="string")return{code:2,message:lL[n]||"unknown_error"}}var Pk=1e3,BZ=300,HZ=1e4,SS=class{constructor(t){this._finishedSpanBucketSize=t?.timeout||BZ,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(tt()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Wt(HZ),this._debouncedFlush=Wc(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&&ao&&g.log(`SpanExporter dropped ${s} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,i=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=i,i.spans.add(t),this._spansToBucketEntry.set(t,i);let o=cL(t);(!o||this._sentSpans.get(o))&&this._debouncedFlush()}flush(){let t=this._finishedSpanBuckets.flatMap(o=>o?Array.from(o.spans):[]),n=this._maybeSend(t),r=n.size,i=t.length-r;ao&&g.log(`SpanExporter exported ${r} spans, ${i} spans are waiting for their parent spans to finish`);for(let o of n){this._sentSpans.set(o.spanContext().spanId,1);let s=this._spansToBucketEntry.get(o);s&&s.spans.delete(o)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(t){let n=GZ(t),r=new Set,i=this._getCompletedRootNodes(n);for(let o of i){let s=o.span;r.add(s);let c=WZ(s);if(o.parentNode&&this._sentSpans.get(o.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 o.children)ES(u,a,r)&&(l=!0);c.spans=a.length>Pk?a.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,Pk):a,l&&(c.sdkProcessingMetadata={...c.sdkProcessingMetadata,hasGenAiSpans:!0});let p=Fo(s.events);p&&(c.measurements=p),Kc(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 FZ(e){let t=e.attributes,n=t[S],r=t[B],i=t[ve];return{origin:n,op:r,source:i}}function WZ(e){let{op:t,description:n,data:r,origin:i="manual",source:o}=dL(e),s=Kt(e),c=e.attributes[Hn],a={[ve]:o,[Hn]:c,[B]:t,[S]:i,...r,...mL(e.attributes)},{links:l}=e,{traceId:p,spanId:u}=e.spanContext(),d=vS(e),m=uL(e),_={parent_span_id:d,span_id:u,trace_id:p,data:a,origin:i,op:t,status:Bo(m),links:Do(l)},h=a[hn],b=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:_,otel:{resource:e.resource.attributes},...b},spans:[],start_timestamp:qt(e.startTime),timestamp:qt(e.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:s.scope,capturedSpanIsolationScope:s.isolationScope,sampleRate:c,dynamicSamplingContext:nt(e)},...o&&{transaction_info:{source:o}}}}function ES(e,t,n){let r=e.span;if(r&&n.add(r),!r){let v=!1;return e.children.forEach(P=>{ES(P,t,n)&&(v=!0)}),v}let o=r.spanContext().spanId,s=r.spanContext().traceId,c=vS(r),{attributes:a,startTime:l,endTime:p,links:u}=r,{op:d,description:m,data:_,origin:h="manual"}=dL(r),b={[S]:h,[B]:d,...mL(a),..._},N=uL(r),M={span_id:o,trace_id:s,data:b,description:m,parent_span_id:c,start_timestamp:qt(l),timestamp:qt(p)||void 0,status:Bo(N),op:d,origin:h,measurements:Fo(r.events),links:Do(u)};t.push(M);let R=!!d?.startsWith("gen_ai.");return e.children.forEach(v=>{ES(v,t,n)&&(R=!0)}),R}function dL(e){let{op:t,source:n,origin:r}=FZ(e),{op:i,description:o,source:s,data:c}=Yk(e),a=t||i,l=n||s,p={...c,...VZ(e)};return{op:a,description:o,source:l,origin:r,data:p}}function mL(e){let t={...e};return delete t[Hn],delete t[NS],delete t[gn],t}function VZ(e){let t=e.attributes,n={};e.kind!==vt.INTERNAL&&(n["otel.kind"]=vt[e.kind]);let r=t[bi];r&&(n[hn]=r);let i=Uk(e);return i.url&&(n.url=i.url),i["http.query"]&&(n["http.query"]=i["http.query"].slice(1)),i["http.fragment"]&&(n["http.fragment"]=i["http.fragment"].slice(1)),n}function lm(e,t){let n=e.attributes??{},r=t?.spanKind??U.INTERNAL,{op:i,description:o,source:s,data:c}=Zl(e.name,n,r);e.name=o,Gt(e,{[B]:i,[ve]:s,[d0]:"manual",...c}),r!==U.INTERNAL&&Gt(e,{"otel.kind":gb(r)})}var Xl=class{constructor(t){this._unsubscribePreprocessSpan=void 0,cs("SentrySpanProcessor"),this._exporter=new SS(t),this._client=t?.client??C(),this._client&&rt(this._client)&&(this._unsubscribePreprocessSpan=this._client.on("preprocessSpan",lm))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(t,n){let r=he.getSpan(n),i=as(n);r&&!r.spanContext().isRemote&&di(r,t),r?.spanContext().isRemote&&t.setAttribute(NS,!0),n===Kp&&(i={scope:ws(),isolationScope:Rt()}),i&&Or(t,i.scope,i.isolationScope),Dc(t),this._client?.emit("spanStart",t)}onEnd(t){Bc(t),this._client?.emit("spanEnd",t),this._client&&rt(this._client)?this._client.emit("afterSpanEnd",t):this._exporter.export(t)}},Kl=class{constructor(t){this._client=t,this._isSpanStreaming=rt(t),cs("SentrySampler")}shouldSample(t,n,r,i,o,s){let c=this._client.getOptions(),{ignoreSpans:a}=c,l=ZZ(t),p=l?.spanContext();if(!Ue(c))return vi({decision:void 0,context:t,spanAttributes:o});let u=o[Gr]||o[Ur];if(i===vt.CLIENT&&u&&(!l||p?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent("no_parent_span","span"),vi({decision:void 0,context:t,spanAttributes:o});let d=l?YZ(l,n,r):void 0;if(!(!l||p?.isRemote)){if(this._isSpanStreaming){if(d&&a?.length){let{description:ce,op:ge}=Zl(r,o,i);if(ir({description:ce,op:o[B]??ge,attributes:o},a))return this._client.recordDroppedEvent("ignored","span"),vi({decision:Ar.NOT_RECORD,context:t,spanAttributes:o,ignoredChildSpan:!0})}if(!d){let ce=p?.traceState?.get(Hk)==="1";this._client.recordDroppedEvent(ce?"ignored":"sample_rate","span")}}return vi({decision:d?Ar.RECORD_AND_SAMPLED:Ar.NOT_RECORD,context:t,spanAttributes:o})}let{description:_,data:h,op:b}=Zl(r,o,i),N={...h,...o};if(b&&(N[B]=b),this._isSpanStreaming&&a?.length&&ir({description:_,op:N[B]??b,attributes:N},a))return this._client.recordDroppedEvent("ignored","span"),vi({decision:Ar.NOT_RECORD,context:t,spanAttributes:o,ignoredSegmentSpan:!0});let M={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:N,spanName:_,parentSampled:d,parentContext:p},M),!M.decision)return vi({decision:void 0,context:t,spanAttributes:o});let{isolationScope:R}=as(t)??{},v=p?.traceState?p.traceState.get(sm):void 0,P=v?rr(v):void 0,D=Tn(P?.sample_rand)??ct(),[I,H,L]=Fc(c,{name:_,attributes:N,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:Tn(P?.sample_rate)},D),G=`${u}`.toUpperCase();return G==="OPTIONS"||G==="HEAD"?(ao&&g.log(`[Tracing] Not sampling span because HTTP method is '${G}' for ${r}`),vi({decision:Ar.NOT_RECORD,context:t,spanAttributes:o,sampleRand:D,downstreamTraceSampleRate:0})):(!I&&d===void 0&&(ao&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate",this._isSpanStreaming?"span":"transaction")),{...vi({decision:I?Ar.RECORD_AND_SAMPLED:Ar.NOT_RECORD,context:t,spanAttributes:o,sampleRand:D,downstreamTraceSampleRate:L?H:void 0}),attributes:{[Hn]:L?H:void 0}})}toString(){return"SentrySampler"}};function YZ(e,t,n){let r=e.spanContext();if(p_(r)&&r.traceId===t){if(r.isRemote){let o=Ya(e.spanContext());return ao&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${o}`),o}let i=Ya(r);return ao&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${i}`),i}}function vi({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:o,ignoredSegmentSpan:s}){let c=jZ(t,n);return i!==void 0&&(c=c.set(TZ,`${i}`)),r!==void 0&&(c=c.set(EZ,`${r}`)),o&&(c=c.set(am,"1")),s&&(c=c.set(Hk,"1")),e==null?{decision:Ar.NOT_RECORD,traceState:c}:e===Ar.NOT_RECORD?{decision:e,traceState:c.set(RS,"1")}:{decision:e,traceState:c}}function jZ(e,t){let i=he.getSpan(e)?.spanContext()?.traceState||new im,o=t[yi]||t[pt];return o&&typeof o=="string"&&(i=i.set(Bk,o)),i}function ZZ(e){let t=he.getSpan(e);return t&&p_(t.spanContext())?t:void 0}function pm(e,t={}){let n=oe(e),r=n.data,i=e.kind??vt.INTERNAL,o=Hs(e),s=r[gn]!==void 0,c=o&&!s&&!K_(e),a=c&&r[ve]==="custom"?{...r,[ve]:void 0}:r,l=Zl(n.description||"<unknown>",a,i);if(i!==vt.INTERNAL&&r["otel.kind"]===void 0&&e.setAttribute("otel.kind",vt[i]),l.op&&r[B]===void 0&&e.setAttribute(B,l.op),l.source!==void 0&&l.source!=="custom"&&(t.finalizeStatus||l.source!=="url")&&(n.parent_span_id===void 0||i===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){qZ(e,r);let u=C();KZ(e,r,n.status,!!u&&rt(u))}o&&l.description!==n.description&&(r[ve]!=="custom"||c)&&e.updateName(l.description)}function XZ(e,t){we(e,"kind",t??vt.INTERNAL)}function KZ(e,t,n,r){if(n===void 0){e.setStatus(yS(t)||{code:1});return}!r&&n!=="ok"&&!pL(n)&&e.setStatus({code:2,message:"internal_error"})}function qZ(e,t){let n=t[bi];t[hn]===void 0&&n!==void 0&&(e.setAttribute(hn,n),t[hn]=n)}var TS=class{startSpan(t,n={},r){let i=r||pe.active(),o=n.root?void 0:he.getSpan(i);if(Os(i))return this._createNonRecordingSpan(o);let s=this._startSentrySpan(t,n,o,r!==void 0);return q_(s),XZ(s,n.kind),n.attributes?.[ve]===void 0&&Z_(s),pm(s),s}startActiveSpan(t,n,r,i){let o=typeof n=="function"?{}:n,s=typeof r=="function"||r===void 0?pe.active():r,c=typeof n=="function"?n:typeof r=="function"?r:i,a=this.startSpan(t,o,s),l=Kt(a).isolationScope,p=u=>l?u.setValue(rm,l):u;return Lr(a)&&he.getSpan(s)?pe.with(p(s),()=>c(a)):pe.with(p(he.setSpan(s,a)),()=>(Bn(ne(),a),c(a)))}_startSentrySpan(t,n,r,i){let o={name:t,attributes:n.attributes,links:n.links,startTime:n.startTime};return n.root?Nn(()=>Xs({...o,parentSpan:null})):r?.spanContext().isRemote?this._startRootSpanWithRemoteParent(o,r):r?Xs({...o,parentSpan:r}):Nn(()=>Xs({...o,parentSpan:i?null:void 0}))}_startRootSpanWithRemoteParent(t,n){let{spanId:r,traceId:i,traceState:o}=n.spanContext(),s=nt(n),c=typeof s.sample_rand=="string"?Number(s.sample_rand):void 0,a=!!o?.get(sm);return Be(l=>(l.setPropagationContext({traceId:i,parentSpanId:r,sampled:Ya(n.spanContext()),dsc:a?s:void 0,sampleRand:typeof c=="number"&&!Number.isNaN(c)?c:ct()}),Bn(l,void 0),Xs({...t,parentSpan:null})))}_createNonRecordingSpan(t){let n=new Pr({traceId:t?.spanContext().traceId});return t&&di(t,n),Or(n,ne(),J()),n}},ql=class{constructor(t={}){this._tracers=new Map,this.resource=t.resource}getTracer(t,n,r){let i=JSON.stringify([t,n,r]),o=this._tracers.get(i);if(o)return o;let s=new TS;return this._tracers.set(i,s),s}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},kk="telemetry.sdk.language",Lk="telemetry.sdk.name",Mk="telemetry.sdk.version",QZ="service.namespace",IS=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 JZ(e){if(!e)return{};let t={};for(let n of e.split(",")){let r=n.indexOf("=");if(r===-1)continue;let i=n.substring(0,r).trim(),o=n.substring(r+1).trim();if(i)try{t[i]=decodeURIComponent(o)}catch{t[i]=o}}return t}function um(e){let t=typeof process<"u"?process.env:{},n=t.OTEL_SERVICE_NAME,r=JZ(t.OTEL_RESOURCE_ATTRIBUTES);return new IS({[QZ]:"sentry",[Ch]:e,...r,...n?{[Ch]:n}:{},[b0]:q,[kk]:Qp[kk],[Lk]:Qp[Lk],[Mk]:Qp[Mk]})}function $Z({span:e,scope:t,client:n,propagateTraceparent:r}={}){let i=(t&&Va(t))??pe.active();if(e){let{scope:p}=Kt(e);i=p&&Va(p)||he.setSpan(pe.active(),e)}let{traceId:o,spanId:s,sampled:c,dynamicSamplingContext:a}=Xk(i,{scope:t,client:n}),l={"sentry-trace":Fi(o,s,c),baggage:Hi(a)};return r&&(l.traceparent=Wi(o,s,c)),l}function fL(e){function t(){let a=pe.active(),l=as(a);return l||{scope:ws(),isolationScope:Rt()}}function n(a){let l=pe.active();return pe.with(l,()=>a(s()))}function r(a,l){let p=Va(a)||pe.active();return pe.with(p.setValue(_S,a),()=>l(a))}function i(a){let l=pe.active();return pe.with(l.setValue(gS,!0),()=>{let p=s();return Cc(p.getPropagationContext())||p.setPropagationContext({traceId:yt(),sampleRand:ct()}),a(c())})}function o(a,l){let p=pe.active();return pe.with(p.setValue(rm,a),()=>l(c()))}function s(){return t().scope}function c(){return t().isolationScope}P_({withScope:n,withSetScope:r,withSetIsolationScope:o,withIsolationScope:i,getCurrentScope:s,getIsolationScope:c,startSpan:Jk,startSpanManual:$k,startInactiveSpan:zk,getActiveSpan:CS,suppressTracing:sL,isTracingSuppressed:wZ,getTraceData:$Z,continueTrace:iL,startNewTrace:MZ,withActiveSpan:PS,getTracingChannelBinding:e?.getTracingChannelBinding})}at();at();import{AsyncLocalStorage as gL}from"async_hooks";import{EventEmitter as zZ}from"events";var eX=["addListener","on","once","prependListener","prependOnceListener"],dm=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1,cs("SentryContextManager"),this._asyncLocalStorage=St(Je()).getTracingChannelBinding?.()?.asyncLocalStorage??new gL}active(){return this._asyncLocalStorage.getStore()??Kp}with(t,n,r,...i){let o=aL(t,this.active()),s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(o,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(t,n){return n instanceof zZ?this._bindEventEmitter(t,n):typeof n=="function"?this._bindFunction(t,n):n}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:cm}}_bindFunction(t,n){let r=this.with.bind(this),i=function(...o){return r(t,()=>n.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),i}_bindEventEmitter(t,n){if(this._getPatchMap(n)!==void 0)return n;this._createPatchMap(n);for(let r of eX)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(i,o){let s=r._getPatchMap(t)?.[i];if(s===void 0)return n.call(this,i,o);let c=s.get(o);return n.call(this,i,c||o)}}_patchRemoveAllListeners(t,n){let r=this;return function(i){let o=r._getPatchMap(t);return o!==void 0&&(arguments.length===0?r._createPatchMap(t):i!==void 0&&o[i]!==void 0&&delete o[i]),n.apply(this,arguments)}}_patchAddListener(t,n,r){let i=this;return function(o,s){if(i._wrapped)return n.call(this,o,s);let c=i._getPatchMap(t);c===void 0&&(c=i._createPatchMap(t));let a=c[o];a===void 0&&(a=new WeakMap,c[o]=a);let l=i.bind(r,s);a.set(s,l),i._wrapped=!0;try{return n.call(this,o,l)}finally{i._wrapped=!1}}}_createPatchMap(t){let n=Object.create(null);return t[this._kOtListeners]=n,n}_getPatchMap(t){return t[this._kOtListeners]}};function MS(e){fL({getTracingChannelBinding:e?.skipOpenTelemetrySetup?nX():tX()})}function tX(){let e=new gL;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:_L})}function nX(){return()=>{try{let t=pe._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return t?{asyncLocalStorage:t,getStoreWithActiveSpan:_L}:void 0}catch{return}}}function _L(e){let t=pe.active();return Lr(e)&&Re(e)!==e||e.spanContext().traceState?.get(am)==="1"?t:he.setSpan(t,e)}var Ql=dm;at();function wS(){nn.disable(),nn.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},XN.DEBUG)}var Jl={};function de(e,t,n){return n?iX(e,t,n):rX(e,t)}function rX(e,t){return Object.assign(n=>{let r=Jl[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return Jl[e]=i,Ga({instrumentations:[i]}),i},{id:e})}function iX(e,t,n){return Object.assign(r=>{let i=n(r),o=Jl[e];if(o)return o.setConfig(i),o;let s=new t(i);return Jl[e]=s,Ga({instrumentations:[s]}),s},{id:e})}import*as GS from"diagnostics_channel";var oX="ChildProcess",mm=(e={})=>({name:oX,setup(){GS.channel("child_process").subscribe(t=>{V(t)&&"process"in t&&sX(t.process,e)}),GS.channel("worker_threads").subscribe(t=>{V(t)&&"worker"in t&&aX(t.worker,e)})}});function sX(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",i=>{n||(n=!0,i!==null&&i!==0&&on({category:"child_process",message:`Child process exited with code '${i}'`,level:i===0?"info":"warning",data:r}))}).on("error",i=>{n||(n=!0,on({category:"child_process",message:`Child process errored with '${i.message}'`,level:"error",data:r}))})}function aX(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)}}}):on({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as cX}from"child_process";import{readFile as lX,readdir as pX}from"fs";import*as At from"os";import{join as uX}from"path";import{promisify as yL}from"util";var dX=yL(lX),mX=yL(pX),fX="Context",gX=((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?SX():void 0,r=t.device?EX(t.device):void 0,i=t.culture?yX():void 0,o=t.cloudResource?RX():void 0,s=t.os?bX():void 0,c={"process.runtime.engine.name":"v8","process.runtime.engine.version":process.versions.v8,...hL({app:n,device:r,culture:i,cloud_resource:o})};s&&s.then(p=>Object.assign(c,hL({os:p}))).catch(()=>{});let a=(async()=>{let p={};return s&&(p.os=await s),n&&(p.app=n),r&&(p.device=r),i&&(p.culture=i),o&&(p.cloud_resource=o),p})();async function l(p){let u=_X(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:fX,processEvent(p){return l(p)},processSegmentSpan(p){Gt(p,c),Gt(p,hX(n,r))}}}),fm=gX;function _X(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 hL(e){let t={},{app:n,device:r,os:i,culture:o,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)),i&&(i.name&&(t["os.name"]=i.name),i.version&&(t["os.version"]=i.version),i.kernel_version&&(t["os.kernel_version"]=i.kernel_version),i.build&&(t["os.build"]=i.build)),o&&(o.locale&&(t["culture.locale"]=o.locale),o.timezone&&(t["culture.timezone"]=o.timezone)),s)for(let[c,a]of Object.entries(s))a!=null&&(t[c]=a);return t}function hX(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 bX(){let e=At.platform();switch(e){case"darwin":return NX();case"linux":return vX();default:return{name:TX[e]||e,version:At.release()}}}function yX(){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 SX(){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 EX(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(),i=r?.[0];i&&(t.processor_count=r.length,t.cpu_description=i.model,t.processor_frequency=i.speed)}return t}var TX={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},IX=[{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"]}],AX={alpine:e=>e,arch:e=>Qr(/distrib_release=(.*)/,e),centos:e=>Qr(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>Qr(/release (..)/,e),mint:e=>Qr(/distrib_release=(.*)/,e),red:e=>Qr(/release ([^ ]+)/,e),suse:e=>Qr(/VERSION = (.*)\n/,e),ubuntu:e=>Qr(/distrib_release=(.*)/,e)};function Qr(e,t){let n=e.exec(t);return n?n[1]:void 0}async function NX(){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)=>{cX("/usr/bin/sw_vers",(i,o)=>{if(i){r(i);return}n(o)})});e.name=Qr(/^ProductName:\s+(.*)$/m,t),e.version=Qr(/^ProductVersion:\s+(.*)$/m,t),e.build=Qr(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function bL(e){return e.split(" ")[0].toLowerCase()}async function vX(){let e={kernel_version:At.release(),name:"Linux"};try{let t=await mX("/etc"),n=IX.find(c=>t.includes(c.name));if(!n)return e;let r=uX("/etc",n.name),i=(await dX(r,{encoding:"utf-8"})).toLowerCase(),{distros:o}=n;e.name=o.find(c=>i.indexOf(bL(c))>=0)||o[0];let s=bL(e.name);e.version=AX[s]?.(i)}catch{}return e}function RX(){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 OX}from"fs";import{createInterface as CX}from"readline";var US=new Wt(10),TL=new Wt(20),xX=7,PX="ContextLines",kX=1e3,LX=1e4;function MX(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function wX(e){return!!(e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:"))}function GX(e){return e.lineno!==void 0&&e.lineno>LX||e.colno!==void 0&&e.colno>kX}function UX(e,t){let n=US.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 DX(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!="number")return[];let i=EL(r,t),o=[];for(;;){if(n===e.length-1){o.push(i);break}let s=e[n+1];if(typeof s!="number")break;s<=i[1]?i[1]=s+t:(o.push(i),i=EL(s,t)),n++}return o}function BX(e,t,n){return new Promise((r,i)=>{let o=OX(e),s=CX({input:o});function c(){o.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(_){TL.set(e,1),We&&g.error(`Failed to read file: ${e}. Error: ${_}`),s.close(),s.removeAllListeners(),c()}o.on("error",m),s.on("error",m),s.on("close",c),s.on("line",_=>{if(a++,!(a<u)&&(n[a]=N_(_,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 HX(e,t){let n={};if(t>0&&e.exception?.values){for(let o of e.exception.values)if(o.stacktrace?.frames?.length)for(let s=o.stacktrace.frames.length-1;s>=0;s--){let c=o.stacktrace.frames[s],a=c?.filename;if(!c||typeof a!="string"||typeof c.lineno!="number"||wX(a)||GX(c))continue;n[a]||(n[a]=[]),n[a].push(c.lineno)}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let o of r){if(TL.get(o))continue;let s=n[o];if(!s)continue;s.sort((l,p)=>l-p);let c=DX(s,t);if(c.every(l=>UX(o,l)))continue;let a=MX(US,o,{});i.push(BX(o,c,a))}if(await Promise.all(i).catch(()=>{We&&g.log("Failed to read one or more source files and resolve context lines")}),t>0&&e.exception?.values)for(let o of e.exception.values)o.stacktrace?.frames&&o.stacktrace.frames.length>0&&FX(o.stacktrace.frames,t,US);return e}function FX(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=n.get(r.filename);if(i===void 0)continue;WX(r.lineno,r,t,i)}}function SL(e){delete e.pre_context,delete e.context_line,delete e.post_context}function WX(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 o=IL(e,n);o<e;o++){let s=r[o];if(s===void 0){SL(t),We&&g.error(`Could not find line ${o} in file ${t.filename}`);return}t.pre_context.push(s)}if(r[e]===void 0){SL(t),We&&g.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=AL(e,n);t.post_context=[];for(let o=e+1;o<=i;o++){let s=r[o];if(s===void 0)break;t.post_context.push(s)}}function IL(e,t){return Math.max(1,e-t)}function AL(e,t){return e+t}function EL(e,t){return[IL(e,t),AL(e,t)]}var VX=((e={})=>({name:PX,processEvent(t,n,r){let i=e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??xX;return HX(t,i)}})),gm=VX;import{Worker as YX}from"worker_threads";var _m;async function Za(){if(_m===void 0)try{_m=!!(await import("inspector")).url()}catch{_m=!1}return _m}function hm(e,t){return pa(e,t)}var $l="__SENTRY_ERROR_LOCAL_VARIABLES__";function vL(e,t,n){let r=0,i=5,o=0;return setInterval(()=>{o===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),o=i):(o-=1,o===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function NL(e){return e!==void 0&&(e.length===0||e==="?"||e==="<anonymous>")}function bm(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||NL(e)&&NL(t)}var jX="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc2LjAgKDBlMGI1Y2EpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2R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lYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function RL(...e){g.log("[LocalVariables]",...e)}var OL=((e={})=>{function t(o,s,c){if(c===!1)return;let a=(o.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||!bm(d.function,u.function)||(d.vars=hm(u.vars,c))}}function n(o,s){if(s.originalException&&typeof s.originalException=="object"&&$l in s.originalException&&Array.isArray(s.originalException[$l])){let c=C()?.getDataCollectionOptions().stackFrameVariables??!0;for(let a of o.exception?.values||[])t(a,s.originalException[$l],c);s.originalException[$l]=void 0}return o}async function r(){let o=await import("inspector");o.url()||o.open(0)}function i(o){let s=new YX(new URL(`data:application/javascript;base64,${jX}`),{workerData:o,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{s.terminate()}),s.once("error",c=>{RL("Worker error",c)}),s.once("exit",c=>{RL("Worker exit",c)}),s.unref()}return{name:"LocalVariablesAsync",async setup(o){if(!o.getOptions().includeLocalVariables)return;if(await Za()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let c={...e,debug:g.isEnabled()};r().then(()=>{try{i(c)}catch(a){g.error("Failed to start worker",a)}},a=>{g.error("Failed to start inspector",a)})},processEvent(o,s){return n(o,s)}}});function CL(e){if(e!==void 0)return e.slice(-10).reduce((t,n)=>`${t},${n.function},${n.lineno},${n.colno}`,"")}function ZX(e,t){if(t!==void 0)return CL(e(t,1))}function xL(e){let t=[],n=!1;function r(s){t=[],!n&&(n=!0,e(s))}t.push(r);function i(s){t.push(s)}function o(s){let c=t.pop()||r;try{c(s)}catch{r(s)}}return{add:i,next:o}}var DS=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:i,next:o}=xL(n);for(let s of r)if(s.value?.objectId&&s.value.className==="Array"){let c=s.value.objectId;i(a=>this._unrollArray(c,s.name,a,o))}else if(s.value?.objectId&&s.value.className==="Object"){let c=s.value.objectId;i(a=>this._unrollObject(c,s.name,a,o))}else s.value&&i(c=>this._unrollOther(s,c,o));o({})})}_getProperties(t,n){this._session.post("Runtime.getProperties",{objectId:t,ownProperties:!0},(r,i)=>{n(r?[]:i.result)})}_unrollArray(t,n,r,i){this._getProperties(t,o=>{r[n]=o.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),i(r)})}_unrollObject(t,n,r,i){this._getProperties(t,o=>{r[n]=o.map(s=>[s.name,s.value?.value]).reduce((s,[c,a])=>(s[c]=a,s),{}),i(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)}},XX="LocalVariables",KX=((e={},t)=>{let n=new Wt(20),r,i=!1;function o(l,p){let u=CL(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||!bm(N.function,b.function)||(N.vars=hm(b.vars,p))}}function s(l){for(let p of l.exception?.values||[])o(p,C()?.getDataCollectionOptions().stackFrameVariables??!0);return l}let c;async function a(){let p=C()?.getOptions();if(!p?.includeLocalVariables)return;if(Wa<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Za()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let d=await DS.create(t),m=(h,{params:{reason:b,data:N,callFrames:M}},R)=>{if(b!=="exception"&&b!=="promiseRejection"){R();return}r?.();let v=ZX(h,N.description);if(v==null){R();return}let{add:P,next:D}=xL(I=>{n.set(v,I),R()});for(let I=0;I<Math.min(M.length,5);I++){let{scopeChain:H,functionName:L,this:G}=M[I],ce=H.find(Ne=>Ne.type==="local"),ge=G.className==="global"||!G.className?L:`${G.className}.${L}`;if(ce?.object.objectId===void 0)P(Ne=>{Ne[I]={function:ge},D(Ne)});else{let Ne=ce.object.objectId;P(Te=>d.getLocalVariables(Ne,Ce=>{Te[I]={function:ge,vars:Ce},D(Te)}))}}D([])},_=e.captureAllExceptions!==!1;if(d.configureAndConnect((h,b)=>m(p.stackParser,h,b),_),_){let h=e.maxExceptionsPerSecond||50;r=vL(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)})}i=!0}catch(d){g.log("The `LocalVariables` integration failed to start.",d)}}return{name:XX,setupOnce(){c=a()},async processEvent(l){return await c,i?s(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}}),PL=KX;var ym=(e={})=>en.major<19?PL(e):OL(e);import{readFileSync as qX}from"fs";import{join as QX}from"path";var BS,JX="Modules";function $X(){return typeof __SENTRY_SERVER_MODULES__<"u"?__SENTRY_SERVER_MODULES__:te.__SENTRY_SERVER_MODULES__??{}}var zX=(()=>({name:JX,processEvent(e){return e.modules={...e.modules,...kL()},e},getModules:kL})),Sm=zX;function eK(){return{...$X(),...nK()}}function kL(){return BS||(BS=eK()),BS}function tK(){try{let e=QX(process.cwd(),"package.json");return JSON.parse(qX(e,"utf8"))}catch{return{}}}function nK(){let e=tK();return{...e.dependencies,...e.devDependencies}}import{isMainThread as iK}from"worker_threads";var rK=2e3,LL=!1;function zl(e){if(LL)return;LL=!0,Me(()=>{console.error(e)});let t=C();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:rK;t.close(r).then(i=>{i||We&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},i=>{We&&g.error(i),global.process.exit(1)})}var oK="OnUncaughtException",Em=(e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:oK,setup(n){iK&&global.process.on("uncaughtException",sK(n,t))}}};function sK(e,t){let r=!1,i=!1,o=!1,s,c=e.getOptions();return Object.assign(a=>{let l=zl;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&&(o?(We&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),zl(a)):i||(i=!0,setTimeout(()=>{o||(o=!0,l(s,a))},2e3))):(s=a,r=!0,C()===e&&me(a,{originalException:a,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!o&&d&&(o=!0,l(a)))},{_errorHandler:!0})}var aK="OnUnhandledRejection",cK=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],lK=((e={})=>{let t={mode:e.mode??"warn",ignore:[...cK,...e.ignore??[]]};return{name:aK,setup(n){global.process.on("unhandledRejection",mK(n,t))}}}),Tm=lK;function pK(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 uK(e,t){let n=e.name===void 0||vr(t.name,e.name,!0),r=e.message===void 0||vr(t.message,e.message);return n&&r}function dK(e,t){let n=pK(t);return e.some(r=>uK(r,n))}function mK(e,t){return function(r,i){if(C()!==e||dK(t.ignore??[],r))return;let o=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:o},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),fK(r,t.mode)}}function fK(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)}),zl(e))}var gK="ProcessSession",Im=()=>({name:gK,setupOnce(){qc(),process.on("beforeExit",()=>{J().getSession()?.status==="ok"&&Zo()})}});import*as ML from"http";var HS="Spotlight",_K=((e={})=>{let t={sidecarUrl:e.sidecarUrl||"http://localhost:8969/stream"};return{name:HS,setup(n){try{g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}hK(n,t)}}}),Am=_K;function hK(e,t){let n=bK(t.sidecarUrl);if(!n)return;let r=0;e.on("beforeEnvelope",i=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let o=Uc(i);Fn(()=>{let s=ML.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(o),s.end()})})}function bK(e){try{return new URL(`${e}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var Nm=(e={})=>({name:"Console",setup(t){process.env.LAMBDA_TASK_ROOT&&Rc("console",yK),xb({...e,filter:[...e.filter||[],"[DEP0205] DeprecationWarning"]}).setup?.(t)}});function yK(){let e=te?.console;e&&zn.forEach(t=>{t in e&&SK(e,t)})}function SK(e,t){let n=e[t];$n[t]=n;let r=n,i,o=!1,s=function(...a){if(o){n.apply(e,a);return}o=!0;try{Cs("console",{args:a,level:t}),r.apply(e,a)}finally{o=!1}};Po(s,n);let c=n.bind(e);$n[t]=c;try{let a=s;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return a},set(l){l===s?(i!==void 0&&(r=i,i=void 0),a=s):l===c?(i=r,a=c):typeof l=="function"&&!l.__sentry_original__?(r=l,a=s):a=l}})}catch{kt(e,t,function(a){return $n[t]=a,function(...l){Cs("console",{args:l,level:t}),$n[t]?.apply(this,l)}})}}import*as FS from"util";var EK="NodeSystemError";function TK(e){return!(e instanceof Error)||!("errno"in e)||typeof e.errno!="number"||typeof FS.getSystemErrorMap!="function"?!1:FS.getSystemErrorMap().has(e.errno)}var vm=(e={})=>({name:EK,processEvent:(t,n,r)=>{if(!TK(n.originalException))return t;let i=n.originalException,o={...i};!r.getDataCollectionOptions().userInfo&&e.includePaths!==!0&&(delete o.path,delete o.dest),t.contexts={...t.contexts,node_system_error:o};for(let s of t.exception?.values||[])s.value&&(i.path&&s.value.includes(i.path)&&(s.value=s.value.replace(`'${i.path}'`,"").trim()),i.dest&&s.value.includes(i.dest)&&(s.value=s.value.replace(`'${i.dest}'`,"").trim()));return t}});import*as AK from"http";import*as NK from"https";import{Readable as vK}from"stream";import{createGzip as RK}from"zlib";import*as Ri from"net";import*as VS from"tls";import*as WS from"http";import"https";var wL,Jr=Symbol("AgentBaseInternalState"),Rm=class extends(wL=WS.Agent,wL){constructor(t){super(t),this[Jr]={}}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(`
|
|
26
|
-
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(t,n,r){let i={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(t,i)).then(o=>{if(o instanceof WS.Agent)return o.addRequest(t,i);this[Jr].currentSocket=o,super.createSocket(t,n,r)},r)}createConnection(){let t=this[Jr].currentSocket;if(this[Jr].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[Jr].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[Jr]&&(this[Jr].defaultPort=t)}get protocol(){return this[Jr].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[Jr]&&(this[Jr].protocol=t)}};function Om(...e){g.log("[https-proxy-agent:parse-proxy-response]",...e)}function GL(e){return new Promise((t,n)=>{let r=0,i=[];function o(){let p=e.read();p?l(p):e.once("readable",o)}function s(){e.removeListener("end",c),e.removeListener("error",a),e.removeListener("readable",o)}function c(){s(),Om("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function a(p){s(),Om("onerror %o",p),n(p)}function l(p){i.push(p),r+=p.length;let u=Buffer.concat(i,r),d=u.indexOf(`\r
|
|
27
|
-
\r
|
|
28
|
-
`);if(d===-1){Om("have not received end of HTTP headers yet..."),o();return}let m=u.subarray(0,d).toString("ascii").split(`\r
|
|
29
|
-
`),_=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(" "),M={};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(),D=R.slice(v+1).trimStart(),I=M[P];typeof I=="string"?M[P]=[I,D]:Array.isArray(I)?I.push(D):M[P]=D}Om("got proxy server response: %o %o",_,M),s(),t({connect:{statusCode:b,statusText:N,headers:M},buffered:u})}e.on("error",a),e.on("end",c),o()})}function ep(...e){g.log("[https-proxy-agent]",...e)}var tp=class extends Rm{constructor(t,n){super(n),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=n?.headers??{},ep("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),i=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?UL(n,"headers"):null,host:r,port:i}}async connect(t,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let i;if(r.protocol==="https:"){ep("Creating `tls.Socket`: %o",this.connectOpts);let d=this.connectOpts.servername||this.connectOpts.host;i=VS.connect({...this.connectOpts,servername:d&&Ri.isIP(d)?void 0:d})}else ep("Creating `net.Socket`: %o",this.connectOpts),i=Ri.connect(this.connectOpts);let o=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=Ri.isIPv6(n.host)?`[${n.host}]`:n.host,c=`CONNECT ${s}:${n.port} HTTP/1.1\r
|
|
30
|
-
`;if(r.username||r.password){let d=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}o.Host=`${s}:${n.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(o))c+=`${d}: ${o[d]}\r
|
|
31
|
-
`;let a=GL(i);i.write(`${c}\r
|
|
32
|
-
`);let{connect:l,buffered:p}=await a;if(t.emit("proxyConnect",l),this.emit("proxyConnect",l,t),l.statusCode===200){if(t.once("socket",IK),n.secureEndpoint){ep("Upgrading socket connection to TLS");let d=n.servername||n.host;return VS.connect({...UL(n,"host","path","port"),socket:i,servername:Ri.isIP(d)?void 0:d})}return i}i.destroy();let u=new Ri.Socket({writable:!1});return u.readable=!0,t.once("socket",d=>{ep("Replaying proxy buffer for failed request"),d.push(p),d.push(null)}),u}};tp.protocols=["http","https"];function IK(e){e.resume()}function UL(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var OK=1024*32;function CK(e){return new vK({read(){this.push(e),this.push(null)}})}function Cm(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.")}),ca(e,()=>Promise.resolve({}))}let n=t.protocol==="https:",r=xK(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?NK:AK,o=e.keepAlive===void 0?!1:e.keepAlive,s=r?new tp(r):new i.Agent({keepAlive:o,maxSockets:30,timeout:2e3}),c=PK(e,e.httpModule??i,s);return ca(e,c)}function xK(e,t){let{no_proxy:n}=process.env;if(!n?.split(",").some(i=>e.host.endsWith(i)||e.hostname.endsWith(i)))return t}function PK(e,t,n){let{hostname:r,pathname:i,port:o,protocol:s,search:c}=new URL(e.url);return function(l){return new Promise((p,u)=>{Fn(()=>{let d=CK(l.body),m={...e.headers};l.body.length>OK&&(m["content-encoding"]="gzip",d=d.pipe(RK()));let _=r.startsWith("["),h=t.request({method:"POST",agent:n,headers:m,hostname:_?r.slice(1,-1):r,path:`${i}${c}`,port:o,protocol:s,ca:e.caCerts},b=>{b.on("data",()=>{}),b.on("end",()=>{}),b.setEncoding("utf8");let N=b.headers["retry-after"]??null,M=b.headers["x-sentry-rate-limits"]??null;p({statusCode:b.statusCode,headers:{"retry-after":N,"x-sentry-rate-limits":Array.isArray(M)?M[0]||null:M}})});h.on("error",u),d.pipe(h)})})}}function DL(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=Xo(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 kK,sep as LK}from"path";function BL(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function xm(e=process.argv[1]?Nb(process.argv[1]):process.cwd(),t=LK==="\\"){let n=t?BL(e):e;return r=>{if(!r)return;let i=t?BL(r):r,{dir:o,base:s,ext:c}=kK.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(s=s.slice(0,c.length*-1));let a=decodeURIComponent(s);o||(o=".");let l=o.lastIndexOf("/node_modules");if(l>-1)return`${o.slice(l+14).replace(/\//g,".")}:${a}`;if(o.startsWith(n)){let p=o.slice(n.length+1).replace(/\//g,".");return p?`${p}:${a}`:a}return a}}function Pm(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 km=$p(Ey(xm()));at();import*as HL from"os";import{threadId as MK,isMainThread as wK}from"worker_threads";var GK=6e4,Xa=class extends Cl{constructor(t){let n=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||HL.hostname(),r={...t,platform:"node",runtime:t.runtime||{name:"node",version:global.process.version},serverName:n};t.openTelemetryInstrumentations&&Ga({instrumentations:t.openTelemetryInstrumentations}),Ko(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${wK?"main":`worker-${MK}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{oa(this)},n&&this.on("beforeCaptureLog",i=>{i.attributes={...i.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener)),this._metricsOnExitFlushListener=()=>{sa(this)},process.on("beforeExit",this._metricsOnExitFlushListener),gh(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),this._metricsOnExitFlushListener&&process.off("beforeExit",this._metricsOnExitFlushListener);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??GK).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){cb(),super._setupIntegrations()}_getTraceInfoFromScope(t){return t?kS(this,t):[void 0,void 0]}};var VL=Xp(iS(),1);import*as YL from"module";var FL;function WL(){return Wa>=21||Wa===20&&oS>=6||Wa===18&&oS>=19?!0:(FL||(FL=!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 np(){if(WL()&&!te._sentryEsmLoaderHookRegistered){te._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,VL.createAddHookMessageChannel)();YL.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 Lm(){return[il(),rl(),ol(),sl(),vm(),Lb(),Nm(),Ak(),xk(),Em(),Tm(),gm(),ym(),fm(),mm(),Im(),Sm()]}function YS(e={}){return UK(e,Lm)}function UK(e={},t){let n=DK(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&&np(),MS(n),ne().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:o})=>o===HS)&&n.integrations.push(Am({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Ko(n,"node-core");let i=new Xa(n);return ne().setClient(i),i.init(),g.log("SDK initialized from ESM"),i.startClientReportTracking(),FK(),OS(i),LS(i),process.env.VERCEL&&process.on("SIGTERM",async()=>{await i.flush(200)}),i}function Mm(){if(!We)return;let e=xS(),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 DK(e,t){let n=BK(e.release),r=DL(e.spotlight),i=HK(e.tracesSampleRate),o={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??Cm,stackParser:g_(e.stackParser||km),release:n,tracesSampleRate:i,spotlight:r,debug:Xo(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,c=e.defaultIntegrations??t(o),a=Xh({defaultIntegrations:c,integrations:s});return{...o,integrations:a}}function BK(e){if(e!==void 0)return e;let t=Pm();if(t!==void 0)return t}function HK(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 FK(){if(Xo(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=In(e,t);ne().setPropagationContext(n)}}var jL=e=>{let t;return t=!1,{package:e,"javascript.is_cjs":t}};function _r(e,t){let n=C()?.getOptions();!n?.disableInstrumentationWarnings&&!(w(e)||typeof Nr(e)=="function")&&jo()&&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/.`)}),wo().setContext("missing_instrumentation",jL(t)))}import{types as WK}from"util";import{Worker as VK}from"worker_threads";var{isPromise:YK}=WK,jK="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc2LjAgKDBlMGI1Y2EpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIG4scGFyZW50UG9ydCBhcyBlfWZyb20ibm9kZTp3b3JrZXJfdGhyZWFkcyI7aW1wb3J0e3Bvc2l4IGFzIHIsc2VwIGFzIG99ZnJvbSJub2RlOnBhdGgiO2ltcG9ydCphcyBpIGZyb20ibm9kZTpodHRwIjtpbXBvcnQqYXMgcyBmcm9tIm5vZGU6aHR0cHMiO2ltcG9ydHtSZWFkYWJsZSBhcyBjfWZyb20ibm9kZTpzdHJlYW0iO2ltcG9ydHtjcmVhd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sbCwoKT0+e2RuKCJTZW5kaW5nIEFOUiBldmVudCBmYWlsZWQgb24gd2F0Y2hkb2cgdGltZW91dC4iKX0pKX0pO2U/Lm9uKCJtZXNzYWdlIix0PT57dC5zZXNzaW9uJiYoZm49SCh0LnNlc3Npb24pKSx0LmRlYnVnSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==",ZK=50,XK=5e3;function jS(e,...t){g.log(`[ANR] ${e}`,...t)}function KK(){return te}function qK(){let e=vn(J(),ne());return e.attachments=[],e.eventProcessors=[],e}async function QK(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 ZL="Anr",JK=((e={})=>{if(en.major<16||en.major===16&&en.minor<17)throw new Error("ANR detection requires Node 16.17.0 or later");let t,n,r=KK();return r.__SENTRY_GET_SCOPES__=qK,{name:ZL,startWorker:()=>{t||n&&(t=$K(n,e))},stopWorker:()=>{t&&t.then(i=>{i(),t=void 0})},async setup(i){n=i,e.captureStackTrace&&await Za()&&(g.warn("ANR captureStackTrace has been disabled because the debugger was already enabled"),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}),XL=JK;async function $K(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await QK(e);delete r.app?.app_memory,delete r.device?.free_memory;let i=e.getOptions(),o=e.getSdkMetadata()||{};o.sdk&&(o.sdk.integrations=i.integrations.map(l=>l.name));let s={debug:g.isEnabled(),dsn:n,tunnel:i.tunnel,environment:i.environment||"production",release:i.release,dist:i.dist,sdkMetadata:o,appRootPath:t.appRootPath,pollInterval:t.pollInterval||ZK,anrThreshold:t.anrThreshold||XK,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 VK(new URL(`data:application/javascript;base64,${jK}`),{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:Zc(i.stackParser)})}catch{}},s.pollInterval);return a.unref(),c.on("message",l=>{l==="session-ended"&&(jS("ANR event sent from ANR worker. Clearing session in this thread."),J().setSession(void 0))}),c.once("error",l=>{clearInterval(a),jS("ANR worker error",l)}),c.once("exit",l=>{clearInterval(a),jS("ANR worker exit",l)}),c.unref(),()=>{c.terminate(),clearInterval(a)}}function KL(e){let t=C()?.getIntegrationByName(ZL);if(!t)return e();t.stopWorker();let n=e();return YK(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}var ZS={};ZN(ZS,{debug:()=>t9,error:()=>i9,fatal:()=>o9,fmt:()=>db,info:()=>n9,trace:()=>e9,warn:()=>r9});import{format as zK}from"util";function Oi(e,...t){let[n,r,i,o]=t;if(Array.isArray(r)){let s={...i};s["sentry.message.template"]=n,r.forEach((a,l)=>{s[`sentry.message.parameter.${l}`]=a});let c=zK(n,...r);lr({level:e,message:c,attributes:s},o?.scope)}else lr({level:e,message:n,attributes:r},i?.scope??o?.scope)}function e9(...e){Oi("trace",...e)}function t9(...e){Oi("debug",...e)}function n9(...e){Oi("info",...e)}function r9(...e){Oi("warn",...e)}function i9(...e){Oi("error",...e)}function o9(...e){Oi("fatal",...e)}import{monitorEventLoopDelay as s9,performance as XS}from"perf_hooks";var qL="NodeRuntimeMetrics",QL=3e4,wm=1e3,JL=10;function KS(e,t,n){return Number.isFinite(e)?e<wm?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${wm}ms. Using minimum of ${wm}ms.`),wm):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var $L=(e={})=>{let t=KS(e.collectionIntervalMs??QL,qL,QL),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,i=n.cpuUtilization||n.cpuTime,o,s,c,a=0,l,p=JL*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(i&&s!==void 0){let M=process.cpuUsage(s);n.cpuTime&&(ft.gauge("node.runtime.cpu.user",M.user/1e6,_),ft.gauge("node.runtime.cpu.system",M.system/1e6,_)),n.cpuUtilization&&N>0&&ft.gauge("node.runtime.cpu.utilization",(M.user+M.system)/(N*1e3),d),s=process.cpuUsage()}if(n.memRss||n.memHeapUsed||n.memHeapTotal||n.memExternal){let M=process.memoryUsage();n.memRss&&ft.gauge("node.runtime.mem.rss",M.rss,m),n.memHeapUsed&&ft.gauge("node.runtime.mem.heap_used",M.heapUsed,m),n.memHeapTotal&&ft.gauge("node.runtime.mem.heap_total",M.heapTotal,m),n.memExternal&&(ft.gauge("node.runtime.mem.external",M.external,m),ft.gauge("node.runtime.mem.array_buffers",M.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 M=XS.eventLoopUtilization(),R=XS.eventLoopUtilization(M,c);ft.gauge("node.runtime.event_loop.utilization",R.utilization,d),c=M}n.uptime&&N>0&&ft.count("node.runtime.process.uptime",N/1e3,_),a=b}return{name:qL,setup(){if(r){l?.disable();try{l=s9({resolution:JL}),l.enable()}catch{l=void 0}}i&&(s=process.cpuUsage()),n.eventLoopUtilization&&(c=XS.eventLoopUtilization()),a=tt(),o&&clearInterval(o),o=On(setInterval(h,t))}}};var a9=["trace","debug","info","warn","error","fatal"],zL=Symbol.for("level"),c9=Symbol.for("message"),l9=Symbol.for("splat");function eM(e,t){class n extends e{constructor(i){super(i),this._levels=new Set(t?.levels??a9)}log(i,o){try{if(setImmediate(()=>{this.emit("logged",i)}),!V(i))return;let s=i[zL],{level:c,message:a,timestamp:l,...p}=i;p[zL]=void 0,p[c9]=void 0,p[l9]=void 0;let u=t?.customLevelMap?.[s],d=p9[s],m=u??d??"info";this._levels.has(m)?Oi(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{}o&&o()}}return n}var p9={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 rM from"diagnostics_channel";var qS=Symbol("sentry-track-pino-logger");function tM(e,t,n){let r=Object.getOwnPropertySymbols(e),i=`Symbol(${t})`;for(let o of r)if(o.toString()===i){let s=e[o];return typeof s=="string"?s:n}return n}var nM={error:{levels:[],handled:!0},log:{levels:["trace","debug","info","warn","error","fatal"]}};function u9(e){let{level:t,time:n,pid:r,hostname:i,...o}=e;return o}var d9=(e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...nM.error,...e.error},log:{...nM.log,...e.log}};function n(r){let i=r[qS];return i==="track"||i!=="ignore"&&t.autoInstrument}return{name:"Pino",setup:r=>{let i=!!r.getOptions().enableLogs,o=rM.tracingChannel("pino_asJson");function s(c,a,l){if(!n(c))return;let p=u9(l),[u,d,m]=a,_=c?.levels?.labels?.[m]||"info",h=tM(c,"pino.messageKey","msg"),b=d||p?.[h]||"";if(i&&t.log.levels.includes(_)){let N={...p,"sentry.origin":"auto.log.pino","pino.logger.level":m};lr({level:_,message:b,attributes:N})}if(t.error.levels.includes(_)){let N=tM(c,"pino.errorKey","err"),M={};for(let[v,P]of Object.entries(p))v!==N&&v!==h&&(M[v]=P);b&&(M[h]=b);let R={level:Qi(_),contexts:{pino:M}};Be(v=>{v.addEventProcessor(D=>(D.logger="pino",Dn(D,{handled:t.error.handled,type:"auto.log.pino"}),D));let P=u[N];if(P){me(P,R);return}Xc(b,R)})}}o.end.subscribe(c=>{let{instance:a,arguments:l,result:p}=c;s(a,l,JSON.parse(p))})}}},iM=Object.assign(d9,{trackLogger(e){V(e)&&"levels"in e&&(e[qS]="track")},untrackLogger(e){V(e)&&"levels"in e&&(e[qS]="ignore")}});function QS(e,t){e.setAttribute(S,t)}var m9=[["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 ls(e){return m9.reduce((t,[n,r])=>t.replace(new RegExp(n,"gi"),r),e)}var oM="Automatic instrumentation of CronJob only supports crontab string";function sM(e,t){let n=!1;return new Proxy(e,{construct(r,i){let[o,s,c,a,l,...p]=i;if(typeof o!="string")throw new Error(oM);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let u=ls(o);async function d(m,_){return Dr(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(o,d,c,a,l,...p)},get(r,i){return i==="from"?o=>{let{cronTime:s,onTick:c,timeZone:a}=o;if(typeof s!="string")throw new Error(oM);if(n)throw new Error(`A job named '${t}' has already been scheduled`);n=!0;let l=ls(s);return o.onTick=async(p,u)=>Dr(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(o)}:r[i]}})}function aM(e,t={}){return new Proxy(e,{get(n,r){return r==="schedule"&&n.schedule?new Proxy(n.schedule,{apply(i,o,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)=>Dr(p,async()=>{try{return await a(...m)}catch(_){throw me(_,{mechanism:{handled:!1,type:"auto.function.node-cron.instrumentNodeCron"}}),_}},{schedule:{type:"crontab",value:ls(c)},timezone:u,...t});return i.apply(o,[c,d,l])}}):n[r]}})}function cM(e){return new Proxy(e,{get(t,n){return n==="scheduleJob"?new Proxy(t.scheduleJob,{apply(r,i,o){let[s,c,a]=o;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 Dr(l,async()=>{await a?.()},{schedule:{type:"crontab",value:ls(p)}})}return r.apply(i,[l,p,u])}}):t[n]}})}var lM={instrumentCron:sM,instrumentNodeCron:aM,instrumentNodeSchedule:cM};var pM="Http",uM=Object.assign(is,{id:`${pM}.sentry`}),JS=(e={})=>{let t=e.spans??!0,n=e.disableIncomingRequestSpans,r=t&&!n,i={sessions:e.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:e.sessionFlushingDelayMS,ignoreRequestBody:e.ignoreIncomingRequestBody,maxRequestBodySize:e.maxIncomingRequestBodySize},o={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},s=La(i),c=Ma(o);return{name:pM,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=fr(p);if(u.startsWith("data:")){let d=tl(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};is(a)},processEvent(a){return c.processEvent(a)}}};var f9=((e={})=>({name:"NodeFetch",setupOnce(){let t=C()?.getOptions();Yl({...e,spans:g9(e,t)})}})),$S=f9;function g9(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&Ue(t))}import*as Um from"fs";import{promisify as h9}from"util";var dM=["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"],mM=["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"],fM=["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 _9(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 zS(e,t){if(!t)throw new Error(JSON.stringify({member:t}));let n=_9(t),[r,i]=n;return i?{objectToPatch:e[r],functionNameToPatch:i}:{objectToPatch:e,functionNameToPatch:r}}var b9="auto.file.fs",y9="file",S9=["rename","renameSync"],E9=["copyFile","cp","copyFileSync","cpSync"],T9=["link","linkSync"],I9=["mkdtemp","mkdtempSync"],A9=["symlink","symlinkSync"],N9=["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 Dm(e,t,n){let r={[B]:y9,[S]:b9};return n.recordFilePaths&&(typeof t[0]=="string"&&N9.includes(e)?r.path_argument=t[0]:typeof t[0]=="string"&&typeof t[1]=="string"?A9.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):T9.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):E9.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):S9.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]=="string"&&I9.includes(e)&&(r.prefix_argument=t[0])),r}function Bm(e,t){return Object.assign(e,t)}var gM=new WeakMap;function Gm(e,t,n){let r=e[t];if(typeof r!="function")return;let i=gM.get(e);i||(i=new Set,gM.set(e,i)),!i.has(t)&&(i.add(t),e[t]=n(r))}function v9(e,t,n){return Bm(function(...i){let o=Dm(e,i,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:o},s=>{try{return Fn(()=>t.apply(this,i))}catch(c){throw rp(s,c,n),c}})},t)}function R9(e,t,n){return Bm(function(...i){let o=i.length-1,s=i[o];if(typeof s!="function")return t.apply(this,i);let c=Dm(e,i,n),a=k({name:`fs.${e}`,onlyIfParent:!0,attributes:c}),l=Q();i[o]=function(...p){let u=p[0];return u&&rp(a,u,n),a.end(),l?se(l,()=>s.apply(this,p)):s.apply(this,p)};try{return Fn(()=>t.apply(this,i))}catch(p){throw rp(a,p,n),a.end(),p}},t)}function O9(e,t){let n="exists",i=Bm(function(...s){let c=s.length-1,a=s[c];if(typeof a!="function")return e.apply(this,s);let l=Dm(n,s,t),p=k({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 Fn(()=>e.apply(this,s))}catch(d){throw rp(p,d,t),p.end(),d}},e),o=function(s){return new Promise(c=>i(s,c))};return Object.defineProperty(o,"name",{value:n}),Object.defineProperty(i,h9.custom,{value:o}),i}function C9(e,t,n){return Bm(async function(...i){let o=Dm(e,i,n);return Se({name:`fs.${e}`,onlyIfParent:!0,attributes:o},async s=>{try{return await Fn(()=>t.apply(this,i))}catch(c){throw rp(s,c,n),c}})},t)}function _M(e={}){for(let n of fM){let{objectToPatch:r,functionNameToPatch:i}=zS(Um,n);Gm(r,i,o=>v9(n,o,e))}for(let n of mM){let{objectToPatch:r,functionNameToPatch:i}=zS(Um,n);n==="exists"?Gm(r,i,o=>O9(o,e)):Gm(r,i,o=>R9(n,o,e))}let t=Um.promises;for(let n of dM)Gm(t,n,r=>C9(n,r,e))}function rp(e,t,n){e.setStatus({code:2,message:"internal_error"}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute("fs_error",t.message)}var x9="FileSystem",P9=(e={})=>({name:x9,setupOnce(){_M(e)}});var Ye=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function $r(e){let t=Q();if(!t)return;let n=Re(t);n&&oe(n).data[B]==="http.server"&&n.setAttribute("http.route",e)}var hM="Express",k9=[">=4.0.0 <6"];function L9(e,t){Ny(e,t),_r(e.use,"express")}var tE=de(hM,e=>new eE(e)),eE=class extends ae{constructor(t={}){super("sentry-express",q,t)}init(){return new re("express",k9,n=>{try{Iy(n,()=>({...this.getConfig(),onRouteResolved(r){r&&$r(r)}}))}catch(r){Ye&&g.error("Failed to patch express module:",r)}return n},n=>n)}},M9=(e=>({name:hM,setupOnce(){tE(e)},getShouldHandleError(){return e?.shouldHandleError}})),nE=M9;at();var co=(e=>(e.FASTIFY_NAME="fastify.name",e.FASTIFY_TYPE="fastify.type",e.HOOK_NAME="hook.name",e.PLUGIN_NAME="plugin.name",e))(co||{}),Hm=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(Hm||{}),Fm=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request handler",e))(Fm||{});at();var ip=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function rE(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),o=e[ip]||[];return o.push(i),Object.defineProperty(e,ip,{enumerable:!1,configurable:!0,value:o}),i}function Wm(e,t){let n=e[ip]||[];n.length&&(n.forEach(r=>{t&&(r.setStatus({code:Gn.ERROR,message:t.message}),r.recordException(t)),r.end()}),delete e[ip])}function yM(e,t,n){let r,i;try{i=e(),bM(i)&&i.then(o=>t(void 0,o),o=>t(o))}catch(o){r=o}finally{if(!bM(i)&&(t(r,i),r))throw r;return i}}function bM(e){return typeof e=="object"&&e&&typeof Object.getOwnPropertyDescriptor(e,"then")?.value=="function"||!1}var w9="@sentry/instrumentation-fastify-v3",SM="anonymous",G9=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),Vm=class extends ae{constructor(t={}){super(w9,q,t)}init(){return[new re("fastify",[">=3.0.0 <3.21.0"],t=>this._patchConstructor(t))]}_hookOnRequest(){let t=this;return function(r,i,o){if(!t.isEnabled())return o();t._wrap(i,"send",t._patchSend());let s=r,c=s.routeOptions?s.routeOptions.url:r.routerPath;c&&$r(c);let a=r.method||"GET";J().setTransactionName(`${a} ${c}`),o()}}_wrapHandler(t,n,r,i){let o=this;return this._diag.debug("Patching fastify route.handler function"),function(...s){if(!o.isEnabled())return r.apply(this,s);let c=r.name||t||SM,a=`${Fm.MIDDLEWARE} - ${c}`,l=s[1],p=rE(l,o.tracer,a,{[co.FASTIFY_TYPE]:Hm.MIDDLEWARE,[co.PLUGIN_NAME]:t,[co.HOOK_NAME]:n}),u=i&&s[s.length-1];return u&&(s[s.length-1]=function(...d){Wm(l),u.apply(this,d)}),pe.with(he.setSpan(pe.active(),p),()=>yM(()=>r.apply(this,s),d=>{d instanceof Error&&(p.setStatus({code:Gn.ERROR,message:d.message}),p.recordException(d)),i||Wm(l)}))}}_wrapAddHook(){let t=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...i){let o=i[0],s=i[1],c=this.pluginName;if(!G9.has(o))return n.apply(this,i);let a=typeof i[i.length-1]=="function"&&s.constructor.name!=="AsyncFunction";return n.apply(this,[o,t._wrapHandler(c,o,s,a)])}}}_patchConstructor(t){let n=this;function r(...i){let o=t.fastify.apply(this,i);return o.addHook("onRequest",n._hookOnRequest()),o.addHook("preHandler",n._hookPreHandler()),U9(),n._wrap(o,"addHook",n._wrapAddHook()),o}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(...o){let s=o[0];return t.isEnabled()?qr(()=>r.apply(this,o),c=>{!c&&s instanceof Error&&(c=s),Wm(this,c)}):r.apply(this,o)}}}_hookPreHandler(){let t=this;return this._diag.debug("Patching fastify preHandler function"),function(r,i,o){if(!t.isEnabled())return o();let s=r,c=s.routeOptions?.handler||s.context?.handler,a=c?.name.startsWith("bound ")?c.name.substring(6):c?.name,l=`${Fm.REQUEST_HANDLER} - ${a||this.pluginName||SM}`,p={[co.PLUGIN_NAME]:this.pluginName,[co.FASTIFY_TYPE]:Hm.REQUEST_HANDLER,[He]:s.routeOptions?s.routeOptions.url:r.routerPath};a&&(p[co.FASTIFY_NAME]=a);let u=rE(i,t.tracer,l,p);EM(u);let{requestHook:d}=t.getConfig();return d&&qr(()=>d(u,{request:r}),m=>{m&&t._diag.error("request hook failed",m)},!0),pe.with(he.setSpan(pe.active(),u),()=>{o()})}}};function U9(){let e=C();e&&e.on("spanStart",t=>{EM(t)})}function EM(e){let t=oe(e).data,n=t["fastify.type"];if(t[B]||!n)return;e.setAttributes({[S]:"auto.http.otel.fastify",[B]:`${n}.fastify`});let r=t["fastify.name"]||t["plugin.name"]||t["hook.name"];if(typeof r=="string"){let i=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");e.updateName(i)}}import*as aE from"diagnostics_channel";var TM="execute_tool";var IM="invoke_agent";var Ci="graphql";var $=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var oE=()=>{};function ee(e,t,n){let r=D9(e,t,n),i=n?.beforeSpanEnd,o=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}=B9(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),u.error=m),iE(u,i))}},l={start:oE,asyncStart:oE,end(p){if("error"in p||"result"in p){let u=p._sentrySpan;if(u&&o?.({span:u,data:p,end:a(u,p)}))return;iE(p,i)}},error(p){let u=p._sentrySpan;u&&c(u,p.error)},asyncEnd(p){let u=p._sentrySpan;u&&o?.({span:u,data:p,end:a(u,p)})||iE(p,i)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function D9(e,t,n){let r=St(Je()).getTracingChannelBinding?.();if(!r)return $&&g.log("[TracingChannel] Could not access async context binding."),{channel:e,unbind:oE};let i=r.asyncLocalStorage;return e.start.bindStore(i,o=>{o._sentryCallerStore=i.getStore();let c=!n?.requiresParentSpan||Q()?t(o):void 0;return c?(o._sentrySpan=c,r.getStoreWithActiveSpan(c)):o._sentryCallerStore}),e.asyncStart.bindStore(i,o=>o._sentryCallerStore),{channel:e,unbind:()=>{e.start.unbindStore(i),e.asyncStart.unbindStore(i)}}}function iE(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function B9(e){let t=V(e),n=t?"message"in e?e.message:void 0:e,r=n?String(n):void 0,i=t&&"name"in e?String(e.name):"unknown";return{message:r,attributes:{[wr]:i}}}var sE="original-description",H9=new Set(["Int","Float","String","BlockString"]);function Ym(e,t,n){let r=Re(e);if(r===e)return;let i=oe(r),o=n?`${t} ${n}`:t,s=i.data[Oh],c;Array.isArray(s)?c=[...s,o]:typeof s=="string"?c=[s,o]:c=o,r.setAttribute(Oh,c);let a=i.data[sE]??i.description;i.data[sE]||r.setAttribute(sE,a),r.updateName(`${a} (${F9(c)})`)}function F9(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 jm(e,t,n){return e&&t?`${e} ${t}`:e||n}function Zm(e){if(V(e)&&"errors"in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function W9(e){let t=e?.loc,n=t?.source?.body;if(!(typeof n!="string"||!t?.startToken))try{let r=[];for(let o=t.startToken;o;o=o.next)H9.has(o.kind)&&r.push({start:o.start,end:o.end,kind:o.kind});let i=n;for(let o=r.length-1;o>=0;o--){let{start:s,end:c,kind:a}=r[o],l=a==="String"||a==="BlockString"?'"*"':"*";i=i.slice(0,s)+l+i.slice(c)}return i}catch{return}}function Ka(e){if(C()?.getDataCollectionOptions().graphQL.document===!0)return W9(e)}var V9="graphql:parse",Y9="graphql:validate",j9="graphql:execute",Z9="graphql:subscribe",X9="graphql:resolve",Xm="auto.graphql.diagnostic_channel",K9="graphql.parse",q9="graphql.validate",Q9="graphql.execute",J9="graphql.subscribe",$9="graphql.resolve",z9="graphql.field.name",eq="graphql.field.path",tq="graphql.field.type",nq="graphql.parent.name";function NM(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,i=t.useOperationNameForRootSpan!==!1;rq(e),iq(e),AM(e,j9,Q9,i),AM(e,Z9,J9,i),n||oq(e,r)}function rq(e){ee(e(V9),()=>k({name:K9,attributes:{[S]:Xm,[B]:Ci}}))}function iq(e){ee(e(Y9),t=>k({name:q9,attributes:{[S]:Xm,[B]:Ci,[zs]:Ka(t.document)}}),{beforeSpanEnd:(t,n)=>{Array.isArray(n.result)&&n.result.length>0&&t.setStatus({code:2,message:"invalid_argument"})}})}function AM(e,t,n,r){ee(e(t),i=>{let o=k({name:jm(i.operationType,i.operationName,n),attributes:{[S]:Xm,[B]:Ci,[Au]:i.operationType,[Iu]:i.operationName||void 0,[zs]:Ka(i.document)}});return r&&i.operationType&&Ym(o,i.operationType,i.operationName),o},{beforeSpanEnd:(i,o)=>{Zm(o.result)&&i.setStatus({code:2,message:"internal_error"})}})}function oq(e,t){ee(e(X9),n=>{if(!(t&&n.isDefaultResolver))return k({name:`${$9} ${n.fieldPath}`,attributes:{[S]:Xm,[B]:Ci,[z9]:n.fieldName,[eq]:n.fieldPath,[tq]:n.fieldType,[nq]:n.parentType}})})}var sq=((e={})=>({name:"Graphql",setupOnce(){aE.tracingChannel&&ue(()=>{NM(aE.tracingChannel,e)})}})),op=sq;import*as lE from"diagnostics_channel";var aq="mongoose:query",cq="mongoose:aggregate",lq="mongoose:model:save",pq="mongoose:model:insertMany",uq="mongoose:model:bulkWrite",dq="mongoose:cursor:next",mq="auto.db.mongoose.diagnostic_channel",fq="mongodb",gq=10,vM=!1;function Km(e){if(!vM){vM=!0;try{qa(e,aq),qa(e,cq),qa(e,lq),qa(e,pq),qa(e,uq),qa(e,dq)}catch{$&&g.log("Mongoose node:diagnostics_channel subscription failed.")}}}function qa(e,t){ee(e(t),n=>{let r=n.collection,i=hq(n.args?.pipeline??n.args?.filter),o=_q(n);return k({name:r?`mongoose.${r}.${n.operation}`:`mongoose.${n.operation}`,attributes:{[S]:mq,[B]:"db",[mt]:fq,[ar]:n.operation,[Qs]:r??void 0,[fi]:n.database??void 0,[Mr]:i??void 0,[$s]:o??void 0,[_t]:n.serverAddress??void 0,[ht]:n.serverPort??void 0}})})}function _q(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 hq(e){if(e!=null)try{let t=cE(e,0),n=JSON.stringify(t);return n==null||n==="{}"||n==="[]"?void 0:n}catch{return}}function cE(e,t){if(t>gq)return"?";if(Array.isArray(e))return e.map(n=>cE(n,t+1));if(V(e)){let n={};for(let r of Object.keys(e))n[r]=cE(e[r],t+1);return n}return"?"}var bq=(()=>({name:"Mongoose",setupOnce(){lE.tracingChannel&&ue(()=>{Km(lE.tracingChannel)})}})),pE=bq;var yq="db.system",Sq="db.name",RM="db.operation",Eq="db.statement",Tq="db.mongodb.collection",Iq="db.connection_string",Aq="net.peer.name",Nq="net.peer.port",vq="mongodb";function Rq(e){return JSON.stringify(uE(e))}function uE(e){if(Array.isArray(e))return e.map(t=>uE(t));if(Oq(e)){let t={};return Object.entries(e).map(([n,r])=>[n,uE(r)]).reduce((n,r)=>(xq(r)&&(n[r[0]]=r[1]),n),t)}return"?"}function Oq(e){return V(e)&&!Cq(e)}function Cq(e){return typeof Buffer<"u"&&Buffer.isBuffer(e)}function xq(e){return Array.isArray(e)}function sp(e,t,n,r,i){let o,s;if(e){let a=typeof e.address=="string"?e.address.split(":"):"";a.length===2&&(o=a[0],s=a[1])}let c;return n?.documents?.[0]?c=n.documents[0]:n?.cursors?c=n.cursors:c=n,OM(t.db,t.collection,o,s,c,r,i)}function OM(e,t,n,r,i,o,s){let c={[S]:s,[yq]:vq,[Sq]:e,[Tq]:t,[RM]:o,[Iq]:`mongodb://${n}:${r}/${e}`};if(n&&r){c[Aq]=n;let a=parseInt(r,10);isNaN(a)||(c[Nq]=a)}if(i)try{c[Eq]=Rq(i)}catch{}return c}function ap(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 cp(e,t,n,r,i){let o,s;if(t?.s&&(o=t.s.options?.host??t.s.host,s=(t.s.options?.port??t.s.port)?.toString(),o==null||s==null)){let p=t.description?.address;if(p){let u=p.split(":");o=u[0],s=u[1]}}let[c,a]=e.toString().split("."),l=n?.query??n?.q??n;return OM(c,a,o,s,l,r,i)}function hr(e){return k({name:`mongodb.${e[RM]||"command"}`,op:"db",kind:U.CLIENT,attributes:e})}import*as dE from"diagnostics_channel";var Pq="mysql2:query",kq="mysql2:execute",Lq="mysql2:connect",Mq="mysql2:pool:connect",PM="auto.db.mysql2.diagnostic_channel",kM="mysql",wq=/^\s*(\w+)/;function qm(e){CM(e,Pq),CM(e,kq),xM(e,Lq,"mysql2.connect"),xM(e,Mq,"mysql2.pool.connect")}function CM(e,t){ee(e(t),n=>{let r=n.query?Pa(n.query):void 0,i=r?.match(wq)?.[1]?.toUpperCase();return k({name:r||"mysql2.query",attributes:{[S]:PM,[B]:"db",[mt]:kM,[Mr]:r,[ar]:i,[fi]:n.database||void 0,[_t]:n.serverAddress,[ht]:n.serverPort}})},{requiresParentSpan:!0})}function xM(e,t,n){ee(e(t),r=>k({name:n,attributes:{[S]:PM,[B]:"db",[mt]:kM,[fi]:r.database||void 0,[_t]:r.serverAddress,[ht]:r.serverPort}}),{requiresParentSpan:!0})}var Gq=(()=>({name:"Mysql2",setupOnce(){dE.tracingChannel&&ue(()=>{qm(dE.tracingChannel)})}})),mE=Gq;var Uq="PRISMA_INSTRUMENTATION",Dq="V7_PRISMA_INSTRUMENTATION",LM=globalThis;function MM(e){let t={helper:e};LM[Dq]=t,LM[Uq]=t}var Bq=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES==="true"}catch{return!1}})(),Hq="00-10-10-00",Fq="auto.db.otel.prisma",GM=1e3,fE=new Wt(GM),Qa=[];function gE(e,t){fE.set(e,t)}function _E(e,t){let n={...t,[S]:Fq};return e==="prisma:engine:db_query"&&n[Pe]==null&&(n[Pe]="prisma"),n}function hE(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 Wq(){let e=!0;for(;e;){e=!1;for(let t=Qa.length-1;t>=0;t--){let n=Qa[t],r=fE.get(n.parent_span_id);if(!r)continue;let i=_E(n.name,n.attributes),o=k({name:hE(n.name,i),attributes:i,kind:n.kind==="client"?U.CLIENT:U.INTERNAL,startTime:n.start_time,parentSpan:r});gE(n.span_id,o),n.links&&o.addLinks(n.links.flatMap(s=>{let c=fE.get(s.span_id);return c?[{context:c.spanContext()}]:[]})),o.end(n.end_time),Qa.splice(t,1),e=!0}}}var Qm=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}`:Hq}dispatchEngineSpans(t){let n=new Map,r=t.filter(i=>i.parentId===null);for(let i of r)UM(i,t,n,this.ignoreSpanTypes)}createEngineSpan(t){Qa.push(...t.spans),Wq();let n=Qa.length-GM;n>0&&($&&g.log(`[Prisma] Dropping ${n} unresolved v5 engine span(s) whose parent was never registered.`),Qa.splice(0,n))}getActiveContext(){return Q()}runInChildSpan(t,n){let r=typeof t=="string"?{name:t}:t;if(r.internal&&!Bq)return n();let i=`prisma:client:${r.name}`;if(DM(i,this.ignoreSpanTypes))return n();let o=Q(),s=_E(i,r.attributes),c={name:hE(i,s),attributes:s,kind:r.kind,links:r.links,startTime:r.startTime,parentSpan:o};if(r.active===!1){let a=k(c);return gE(a.spanContext().spanId,a),wM(a,()=>n(a,o))}return ke(c,a=>(gE(a.spanContext().spanId,a),wM(a,()=>n(a,o))))}};function UM(e,t,n,r){if(DM(e.name,r))return;let i=_E(e.name,e.attributes);ke({name:hE(e.name,i),attributes:i,kind:e.kind==="client"?U.CLIENT:U.INTERNAL,startTime:e.startTime},o=>{n.set(e.id,o.spanContext().spanId),e.links&&o.addLinks(e.links.flatMap(c=>{let a=n.get(c);return a?{context:{spanId:a,traceId:o.spanContext().traceId,traceFlags:o.spanContext().traceFlags}}:[]}));let s=t.filter(c=>c.parentId===e.id);for(let c of s)UM(c,t,n,r);o.end(e.endTime)})}function wM(e,t){let n;try{n=t()}catch(r){throw e.end(),r}return Vq(n)?n.then(r=>(e.end(),r),r=>{throw e.end(),r}):(e.end(),n)}function Vq(e){return e!=null&&typeof e.then=="function"}function DM(e,t){return t.some(n=>typeof n=="string"?n===e:n.test(e))}var Yq="Prisma";function BM(e){MM(new Qm({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var jq=(e=>({name:Yq,setupOnce(){BM(e)}})),Jm=jq;import*as SE from"diagnostics_channel";var Zq="node-redis:command",Xq="node-redis:batch",Kq="node-redis:connect",qq="ioredis:command",Qq="ioredis:connect",bE="auto.db.redis.diagnostic_channel",yE="redis";function WM(e,t){HM(e,Zq,n=>n.args.slice(1),t),Jq(e,Xq,n=>n.batchMode==="PIPELINE"?"PIPELINE":"MULTI"),FM(e,Kq),HM(e,qq,n=>n.args,t),FM(e,Qq)}function HM(e,t,n,r){ee(e(t),i=>{let o=n(i),s=o.length?`${i.command} ${o.join(" ")}`:i.command;return k({name:`redis-${i.command}`,attributes:{[S]:bE,[B]:"db.redis",[mt]:yE,[Mr]:s,...i.serverAddress!=null?{[_t]:i.serverAddress}:{},...i.serverPort!=null?{[ht]:i.serverPort}:{}}})},{beforeSpanEnd(i,o){"error"in o||$q(r,i,o.command,n(o),o.result)}})}function Jq(e,t,n){ee(e(t),r=>k({name:n(r),attributes:{[S]:bE,[B]:"db.redis",[mt]:yE,...Number(r.batchSize)>1?{[$s]:r.batchSize}:{},...r.serverAddress!=null?{[_t]:r.serverAddress}:{},...r.serverPort!=null?{[ht]:r.serverPort}:{}}}))}function FM(e,t){ee(e(t),n=>k({name:"redis-connect",attributes:{[S]:bE,[B]:"db.redis.connect",[mt]:yE,...n.serverAddress!=null?{[_t]:n.serverAddress}:{},...n.serverPort!=null?{[ht]:n.serverPort}:{}}}))}function $q(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}var zq=((e={})=>({name:"Redis",setupOnce(){SE.tracingChannel&&ue(()=>{WM(SE.tracingChannel,e.responseHook)})}})),EE=zq;var e4=[{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}],zr=(e,t)=>{if(Array.isArray(t)&&t.length){let n=e4.find(({regex:i})=>i.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 $m(e){return typeof e=="number"&&!isNaN(e)?e:void 0}function TE(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function zm(e){return V(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"}function ef(e,t,n){let r=e.getReader(),i={toolCalls:[]},o="",s=!1,c=()=>{s||(s=!0,o&&(i.text=o),t(i))},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}o+=t4(i,u)??"",l.enqueue(u)}catch(p){a(p),l.error(p)}},cancel(l){return c(),r.cancel(l)}})}function t4(e,t){if(!V(t))return;let{type:n,delta:r,textDelta:i,id:o,modelId:s,toolCallId:c,toolName:a,input:l,args:p,finishReason:u,usage:d,providerMetadata:m}=t;switch(n){case"text-delta":{let _=r??i;return typeof _=="string"?_:void 0}case"tool-call":e.toolCalls.push({toolCallId:c,toolName:a,input:l??p});return;case"response-metadata":typeof o=="string"&&(e.responseId=o),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 n4="ai:telemetry",YM="auto.vercelai.channel",r4="gen_ai.tool.call.id",i4="gen_ai.tool.description",o4="embeddings",s4="rerank",a4="generate_content",c4="WorkersAI",jM="vercel.ai.operationId",l4="vercel.ai.model.provider",p4="vercel.ai.settings.maxRetries",AE=new Map,tf=new Map,NE=new Map,ZM=new Set(["generateText","streamText","generateObject","embed","embedMany","rerank"]);function vE(e){if(!ZM.has(e.type))return;let t=Fe(e.event.callId);t&&RE(t)}function RE(e){AE.delete(e),tf.delete(e),NE.delete(e)}function u4(e,t){if(ZM.has(t))for(let n of pd)delete e[n]}function d4(e,t){if(!e||!Array.isArray(t))return;let n=tf.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&&tf.set(e,n)}function m4(e,t,n){let r=e?tf.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let i=n.find(o=>V(o)&&o.name===t);return V(i)?Fe(i.description):void 0}if(V(n)){let i=n[t];return V(i)?Fe(i.description):void 0}}function XM(e,t={}){ee(e(n4),n=>pp(n,t),{beforeSpanEnd:(n,r)=>{Ja(n,r,t),vE(r)},deferSpanEnd:({data:n,end:r})=>f4(n,t,r)})}function f4(e,t,n){if(e.type!=="languageModelCall"||!V(e.result))return!1;let r=e.result,i=r.stream;if(!zm(i))return!1;let o=Fe(e.event.callId),{recordOutputs:s}=xE(e.event,t);return r.stream=ef(i,c=>{e.result={...r,...OE(c)},n(),g4(o,c,s)},c=>n(c)),!0}function OE(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 g4(e,t,n){let r=e?NE.get(e):void 0;if(!r)return;let i=V(t.usage)?t.usage:void 0;if(i){let o=jn(i.inputTokens)??jn(i.promptTokens)??jn(i.tokens),s=jn(i.outputTokens)??jn(i.completionTokens);IE(r,Jt,o),IE(r,Tt,s),IE(r,Nh,jn(i.totalTokens)??TE(o,s))}if(n){let o=JM(t.text,t.toolCalls),s=qM(o,KM({finishReason:t.finishReason}));s&&r.setAttribute(Ah,s)}}function IE(e,t,n){if(n===void 0)return;let r=oe(e).data[t];e.setAttribute(t,(typeof r=="number"?r:0)+n)}function pp(e,t){let{type:n,event:r}=e;if(n==="step"||!r||typeof r!="object")return;let{recordInputs:i,enableTruncation:o}=xE(r,t),s=Fe(r.provider),c=Fe(r.modelId),a=Fe(r.callId),l=$m(r.maxRetries);i&&d4(a,r.tools);let p={[S]:YM,...s?{[jc]:s,[l4]:s}:{},...c?{[Yc]:c}:{},...l!==void 0?{[p4]:l}:{}};switch(n){case"generateText":case"streamText":case"generateObject":return _4(r,p,i,o,a,n==="streamText");case"languageModelCall":return Ti([c4]),h4(r,p,i,o,a,c);case"executeTool":return b4(r,i);case"embed":case"embedMany":{let u=n==="embedMany"?r.values:r.value;return lp(o4,c,{...p,...i&&u!==void 0?{[DR]:Ge(u)}:{}})}case"rerank":return lp(s4,c,p);default:return}}function lp(e,t,n){return k({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[Tu]:e,...n}})}function _4(e,t,n,r,i,o){let s=Fe(e.functionId),c=Fe(e.operationId)??(o?"ai.streamText":"ai.generateText");i&&AE.set(i,{operationId:c,isStream:o});let a=lp(IM,s,{...t,[jM]:c,[YR]:o,...s?{[BR]:s}:{},...n?$M(e,r):{}});return o&&i&&NE.set(i,a),a}function h4(e,t,n,r,i,o){let s=i?AE.get(i):void 0,c=s?`${s.operationId}.${s.isStream?"doStream":"doGenerate"}`:"ai.generateText.doGenerate";return lp(a4,o,{...t,[jM]:c,...n?$M(e,r):{},...n&&Array.isArray(e.tools)?{[FR]:Ge(e.tools)}:{}})}function b4(e,t){let n=V(e.toolCall)?e.toolCall:{},r=Fe(n.toolName),i=Fe(e.toolCallId)??Fe(n.toolCallId),o=n.input??n.args,s=t&&r?m4(Fe(e.callId),r,e.tools):void 0;return lp(TM,r,{[S]:YM,[KR]:"function",...r?{[ZR]:r}:{},...i?{[r4]:i}:{},...s?{[i4]:s}:{},...t&&o!==void 0?{[jR]:Ge(o)}:{}})}function Ja(e,t,n){let{type:r,result:i}=t;if(!V(i))return;let{recordOutputs:o}=xE(t.event,n);if(r==="executeTool"){o&&e.setAttribute(XR,Ge(i.output??i));let m=V(i.output)?i.output:void 0;m?.type==="tool-error"&&CE(e,t,m.error);return}let s=V(i.usage)?i.usage:void 0;if(s){let m=jn(s.inputTokens)??jn(s.promptTokens)??jn(s.tokens),_=jn(s.outputTokens)??jn(s.completionTokens),h=jn(s.totalTokens)??TE(m,_);m!==void 0&&e.setAttribute(Jt,m),_!==void 0&&e.setAttribute(Tt,_),h!==void 0&&e.setAttribute(Nh,h)}let c=KM(i);c&&r==="languageModelCall"&&e.setAttribute(Ot,Ge([c]));let a=V(i.response)?i.response:void 0,l=Fe(a?.id)??Fe(i.responseId);l&&e.setAttribute(WR,l);let p=Fe(a?.modelId)??Fe(t.event.modelId);p&&e.setAttribute(VR,p);let u=i.providerMetadata,d=ld(u);if(Uo in d&&oe(e).data[Uo]&&delete d[Uo],u4(d,r),e.setAttributes(d),o){let m=r==="languageModelCall"&&Array.isArray(i.content)?S4(i.content):JM(i.text,i.toolCalls),_=qM(m,c);_&&e.setAttribute(Ah,_)}}function y4(e){return e==="tool-calls"?"tool_call":e??"stop"}function KM(e){let t=e.finishReason;return typeof t=="string"?t:V(t)?Fe(t.unified):void 0}function jn(e){return $m(e)??(V(e)?$m(e.total):void 0)}function qM(e,t){if(e.length)return Ge([{role:"assistant",parts:e,finish_reason:y4(t)}])}function QM(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 S4(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(QM(n)));return t}function JM(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(QM(r));return n}function CE(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:"tool_error"});let r=V(t.event.toolCall)?t.event.toolCall:{},i=Fe(r.toolName),o=Fe(t.event.toolCallId)??Fe(r.toolCallId);Be(s=>{s.setContext("trace",xr(e)),i&&s.setTag("vercel.ai.tool.name",i),o&&s.setTag("vercel.ai.tool.callId",o),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 xE(e,t){let n=C()?.getDataCollectionOptions().genAI;return{recordInputs:VM(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:VM(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:ze(t.enableTruncation)}}function VM(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n===!0}function $M(e,t){let n={},r=Fe(e.instructions);r&&(n[$t]=Ge([{type:"text",content:r}]));let i=e.messages??e.prompt;return i!==void 0&&(n[HR]=t?Ht(i):Ge(i),n[xt]=Array.isArray(i)?i.length:1),n}import*as PE from"diagnostics_channel";var E4=((e={})=>({name:"VercelAI",setupOnce(){PE.tracingChannel&&ue(()=>{XM(PE.tracingChannel,e)})}})),up=E4;import*as n1 from"diagnostics_channel";var kE="@sentry/instrumentation-fastify",T4=">=3.21.0 <6",r1="auto.http.otel.fastify",I4="hook.fastify",i1="request_handler.fastify",o1=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],lo="hook.name",po="fastify.type",ps="hook.callback.name",A4="fastify.root",N4="route-hook",$a="hook",s1="request-handler",uo="anonymous",xi=Symbol("sentry fastify request span"),a1=Symbol("sentry fastify addHook original"),c1=Symbol("sentry fastify setNotFoundHandler original");function l1(e){return e.routeOptions?.url??e.routerPath}function p1(e){return e.routeOptions?.config??e.routeConfig}function v4(e){return V(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||"routerPath"in e)}function u1(e,t,n){e.decorate(a1,e.addHook),e.decorate(c1,e.setNotFoundHandler),e.decorateRequest("opentelemetry",function(){return{span:this[xi]}}),e.decorateRequest(xi,null),e.addHook("onRoute",R4),e.addHook("onRequest",O4),e.addHook("onResponse",C4),e.addHook=k4,e.setNotFoundHandler=L4,n()}var LE=u1;LE[Symbol.for("skip-override")]=!0;LE[Symbol.for("fastify.display-name")]=kE;LE[Symbol.for("plugin-meta")]={fastify:T4,name:kE};function R4(e){if(e.config?.otel!==!1){for(let t of o1){let n=e[t];typeof n=="function"?e[t]=mo(n,t,zM(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(r=>mo(r,t,zM(this.pluginName,t,r,e.url))))}e.onSend=e1(e.onSend,x4),e.onError=e1(e.onError,P4),e.handler=mo(e.handler,"handler",{[lo]:`${this.pluginName} - route-handler`,[po]:s1,[He]:e.url,[ps]:e.handler.name.length>0?e.handler.name:uo})}}function zM(e,t,n,r){return{[lo]:`${e} - route -> ${t}`,[po]:N4,[He]:r,[ps]:n.name?.length>0?n.name:uo}}function e1(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function O4(e,t,n){if(p1(e)?.otel===!1)return n();let r={[S]:r1,[A4]:kE,[Ur]:e.method,[Zi]:e.url},i=l1(e);if(i!=null){r[He]=i;let s=Q(),c=s&&Re(s);c&&oe(c).data[B]==="http.server"&&c.setAttribute(He,i)}let o=k({name:"request",op:i1,attributes:r});e[xi]=o,se(o,()=>{n()})}function C4(e,t,n){let r=e[xi];r!=null&&(r.setAttributes({[hn]:t.statusCode}),r.end()),e[xi]=null,n()}function x4(e,t,n,r){let i=e[xi];i!=null&&(t.statusCode>=500&&i.setStatus({code:2}),i.setAttributes({[hn]:t.statusCode}),i.end()),e[xi]=null,r(null,n)}function P4(e,t,n,r){let i=e[xi];i?.setStatus({code:2,message:n.message}),r()}function k4(e,t){let n=this[a1];return o1.includes(e)?n.call(this,e,mo(t,e,{[lo]:`${this.pluginName} - ${e}`,[po]:$a,[ps]:t.name?.length>0?t.name:uo})):n.call(this,e,t)}function L4(e,t){let n=this[c1];if(typeof e=="function"){n.call(this,mo(e,"notFoundHandler",{[lo]:`${this.pluginName} - not-found-handler`,[po]:$a,[ps]:e.name?.length>0?e.name:uo}));return}if(e.preValidation!=null&&(e.preValidation=mo(e.preValidation,"notFoundHandler - preValidation",{[lo]:`${this.pluginName} - not-found-handler - preValidation`,[po]:$a,[ps]:e.preValidation.name?.length>0?e.preValidation.name:uo})),e.preHandler!=null&&(e.preHandler=mo(e.preHandler,"notFoundHandler - preHandler",{[lo]:`${this.pluginName} - not-found-handler - preHandler`,[po]:$a,[ps]:e.preHandler.name?.length>0?e.preHandler.name:uo})),t==null){n.call(this,e);return}n.call(this,e,mo(t,"notFoundHandler",{[lo]:`${this.pluginName} - not-found-handler`,[po]:$a,[ps]:t.name?.length>0?t.name:uo}))}function M4(e){for(let t of e)if(v4(t))return t;return null}function mo(e,t,n={}){return function(...i){let o=M4(i);if(o===null||p1(o)?.otel===!1)return e.call(this,...i);let s=o[xi]??void 0,c=e.name?.length>0?e.name:this.pluginName??uo,a=n[po],l=a===$a?I4:a===s1?i1:void 0,p=l?w4(n[lo]):`${t} - ${c}`;return Se({name:p,op:l,attributes:{...n,[S]:r1},parentSpan:s},()=>e.call(this,...i))}}function w4(e=""){return e.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"").replace(/^@sentry\/instrumentation-fastify -> /,"")}function G4(e){e.addHook("onRequest",async(t,n)=>{let r=l1(t),i=t.method||"GET";J().setTransactionName(`${i} ${r}`)})}var t1=!1,d1=Object.assign(function(){t1||(t1=!0,n1.subscribe("fastify.initialization",t=>{let n=t.fastify;n?.register(u1).after(r=>{r?$&&g.error("Failed to setup Fastify instrumentation",r):n&&G4(n)})}))},{id:"Fastify.v5"});var nf="Fastify";function rf(e,t,n){let r=n.statusCode;return r>=500||r<=299}import*as m1 from"diagnostics_channel";function U4(){return C()?.getIntegrationByName(nf)}function f1(){m1.subscribe("tracing:fastify.request.handler:error",e=>{let{error:t,request:n,reply:r}=e;of.call(of,t,n,r,"diagnostics-channel")})}function of(e,t,n,r){let i=U4()?.getShouldHandleError()||rf;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}i(e,t,n)&&me(e,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var D4=(({shouldHandleError:e}={})=>{let t;return{name:nf,setupOnce(){t=e||rf,f1(),d1()},getShouldHandleError(){return t},setShouldHandleError(n){t=n}}}),ME=D4;var sf=of;var B4="db.mongodb.collection",H4="db.name",F4="db.user",W4="net.peer.name",V4="net.peer.port",Y4="db.operation",j4="db.system";function Pi({collection:e,modelName:t,operation:n,origin:r,parentSpan:i}){let o={[B4]:e?.name,[H4]:e?.conn?.name,[F4]:e?.conn?.user,[W4]:e?.conn?.host,[V4]:e?.conn?.port,[Y4]:n,[j4]:"mongoose",[S]:r};return k({name:`mongoose.${t}.${n}`,op:"db",kind:U.CLIENT,attributes:o,parentSpan:i})}var g1="Fastify",wE=de(`${g1}.v3`,()=>new Vm);function Z4(){let e=C();if(e)return e.getIntegrationByName(g1)}var X4=(e=>{let t=ME(e);return Ut(t,{setupOnce(){wE()}})}),GE=(e={})=>X4(e);function K4(e,t){t?.shouldHandleError&&Z4()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(r,i,o){r.addHook("onError",async(s,c,a)=>{sf.call(sf,a,s,c,"onError-hook")}),o()},{[Symbol.for("skip-override")]:!0,[Symbol.for("fastify.display-name")]:"sentry-fastify-error-handler"});e.register(n)}import{normalize as q4}from"path";var Ae=class{constructor(t,n,r,i){this.name=q4(t),this.supportedVersions=n,this.patch=r,this.unpatch=i}};var UE=(e=>(e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription",e))(UE||{}),fo=(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))(fo||{}),ki=(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))(ki||{});var yn=(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))(yn||{});var dp=Symbol.for("opentelemetry.patched"),ei=Symbol.for("opentelemetry.graphql_data");var _1="Operation$operationName$not supported";var h1=Object.values(UE),DE=e=>typeof e?.then=="function";function af(e,t,n,r){if(C()?.getDataCollectionOptions().graphQL.document===!0){let i=iQ(t,n,r);e.setAttribute(yn.SOURCE,i)}}function Q4(e,t,n){let r=E1(e,n);if(r)return{field:r,spanAdded:!1};let i=z4(e,n);return r={span:J4(e,t,n,i)},$4(e,n,r),{field:r,spanAdded:!0}}function J4(e,t,n,r){let i={[yn.FIELD_NAME]:t.fieldName,[yn.FIELD_PATH]:n.join("."),[yn.FIELD_TYPE]:t.returnType.toString(),[yn.PARENT_NAME]:t.parentType.name},o=k({name:`${ki.RESOLVE} ${i[yn.FIELD_PATH]}`,attributes:i,parentSpan:r}),s=e[ei].source,c=t.fieldNodes.find(a=>a.kind==="Field");return c&&af(o,s.loc,c.loc?.start,c.loc?.end),o}function us(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function BE(e,t){if(!(!e||!Array.isArray(e.definitions)))return t?e.definitions.filter(n=>h1.indexOf(n?.operation)!==-1).find(n=>t===n?.name?.value):e.definitions.find(n=>h1.indexOf(n?.operation)!==-1)}function $4(e,t,n){return e[ei].fields[t.join(".")]=n}function E1(e,t){return e[ei].fields[t.join(".")]}function z4(e,t){for(let n=t.length-1;n>0;n--){let r=E1(e,t.slice(0,n));if(r)return r.span}return eQ(e)}function eQ(e){return e[ei].span}function tQ(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function nQ(e){return T1(`
|
|
33
|
-
`,e)}function b1(e){return T1(" ",e)}function T1(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}var rQ=[fo.FLOAT,fo.STRING,fo.INT,fo.BLOCK_STRING];function iQ(e,t,n){let r="";if(e?.startToken){let i=typeof t=="number"?t:e.start,o=typeof n=="number"?n:e.end,s=e.startToken.next,c=1;for(;s;){if(s.start<i){s=s.next,c=s?.line;continue}if(s.end>o){s=s.next,c=s?.line;continue}let a=s.value||s.kind,l="";rQ.indexOf(s.kind)>=0&&(a="*"),s.kind===fo.STRING&&(a=`"${a}"`),s.kind===fo.EOF&&(a=""),s.line>c?(r+=nQ(s.line-c),c=s.line,l=b1(s.column-1)):s.line===s.prev?.line&&(l=b1(s.start-(s.prev?.end||0))),r+=l+a,s&&(s=s.next)}}return r}function cf(e,t){if(!e||e[dp])return;let n=e.getFields();e[dp]=!0,Object.keys(n).forEach(r=>{let i=n[r];if(i&&(i.resolve&&(i.resolve=HE(t,i.resolve)),i.type)){let o=I1(i.type);for(let s of o)cf(s,t)}})}function I1(e){return"ofType"in e?I1(e.ofType):oQ(e)?e.getTypes():sQ(e)?[e]:[]}function oQ(e){return"getTypes"in e&&typeof e.getTypes=="function"}function sQ(e){return"getFields"in e&&typeof e.getFields=="function"}var y1=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},S1=(e,t)=>{t&&e.end()};function HE(e,t,n=!1){if(r[dp]||typeof t!="function")return t;function r(i,o,s,c){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(V(i)||typeof i=="function")&&typeof i[c.fieldName]!="function")return t.call(this,i,o,s,c);if(!s[ei])return t.call(this,i,o,s,c);let l=tQ(c?.path),{field:p,spanAdded:u}=Q4(s,c,l),d=p.span,m=u;return se(d,()=>{try{let _=t.call(this,i,o,s,c);return DE(_)?_.then(h=>(S1(d,m),h),h=>{throw y1(d,h,m),h}):(S1(d,m),_)}catch(_){throw y1(d,_,m),_}})}return r[dp]=!0,r}var aQ="@sentry/instrumentation-graphql",cQ="auto.graphql.otel.graphql",A1={ignoreResolveSpans:!1},lf=[">=14.0.0 <17"],pf=class extends ae{constructor(t={}){super(aQ,q,{...A1,...t})}setConfig(t={}){super.setConfig({...A1,...t})}init(){let t=new re("graphql",lf);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",lf,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",lf,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",lf,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(i){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=BE(s.document,s.operationName),a=n._createExecuteSpan(c,s);return s.contextValue[ei]={source:s.document?s.document||s.document[ei]:void 0,span:a,fields:{}},se(a,()=>qr(()=>i.apply(this,[s]),(l,p)=>{n._handleExecutionResult(a,l,p)}))}}}_handleExecutionResult(t,n,r){if(r===void 0||n){us(t,n);return}DE(r)?r.then(i=>{this._updateSpanFromResult(t,i),us(t)},i=>{us(t,i)}):(this._updateSpanFromResult(t,r),us(t))}_updateSpanFromResult(t,n){if(n.errors?.length&&!oe(t).status&&t.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let r=oe(t).data,i=r[yn.OPERATION_TYPE],o=r[yn.OPERATION_NAME];if(!i)return;let s=Re(t),a=oe(s).data[ss]||[],l=o?`${i} ${o}`:`${i}`;Array.isArray(a)?(a.push(l),s.setAttribute(ss,a)):typeof a=="string"?s.setAttribute(ss,[a,l]):s.setAttribute(ss,l),oe(s).data["original-description"]||s.setAttribute("original-description",oe(s).description),s.updateName(`${oe(s).data["original-description"]} (${lQ(a)})`)}_patchParse(){let t=this;return function(r){return function(o,s){return t._parse(this,r,o,s)}}}_patchValidate(){let t=this;return function(r){return function(o,s,c,a,l){return t._validate(this,r,o,s,c,l,a)}}}_parse(t,n,r,i){let o=k({name:ki.PARSE});return se(o,()=>qr(()=>n.call(t,r,i),(s,c)=>{c&&(BE(c)?c.loc&&af(o,c.loc):o.updateName(ki.SCHEMA_PARSE)),us(o,s)}))}_validate(t,n,r,i,o,s,c){let a=k({name:ki.VALIDATE});return se(a,()=>qr(()=>n.call(t,r,i,o,c,s),(l,p)=>{i.loc||a.updateName(ki.SCHEMA_VALIDATE),us(a,l)}))}_createExecuteSpan(t,n){let r=k({name:ki.EXECUTE,attributes:{[S]:cQ}});if(t){let{operation:i,name:o}=t;r.setAttribute(yn.OPERATION_TYPE,i);let s=o?.value;s?(r.setAttribute(yn.OPERATION_NAME,s),r.updateName(`${i} ${s}`)):r.updateName(i)}else{let i=" ";n.operationName&&(i=` "${n.operationName}" `),i=_1.replace("$operationName$",i),r.setAttribute(yn.OPERATION_NAME,i)}return n.document?.loc&&af(r,n.document.loc),r}_wrapExecuteArgs(t,n,r,i,o,s,c,a,l){if(i||(i={}),i[ei]||this.getConfig().ignoreResolveSpans)return{schema:t,document:n,rootValue:r,contextValue:i,variableValues:o,operationName:s,fieldResolver:c,typeResolver:a};let p=c==null;return c=HE(()=>this.getConfig(),c??l,p),t&&(cf(t.getQueryType(),()=>this.getConfig()),cf(t.getMutationType(),()=>this.getConfig())),{schema:t,document:n,rootValue:r,contextValue:i,variableValues:o,operationName:s,fieldResolver:c,typeResolver:a}}};function lQ(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 N1="Graphql",WE=de(N1,pf,e=>FE(e)),pQ=((e={})=>Ut(op(FE(e)),{name:N1,setupOnce(){WE(FE(e))}})),VE=pQ;function FE(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var za="messaging.destination.partition.id",YE="messaging.kafka.message.key",jE="messaging.kafka.message.tombstone",v1="messaging.kafka.offset",ZE="process",mp="receive",R1="send",XE="kafka",O1="_OTHER";at();var uQ="auto.kafkajs.otel.producer",dQ="auto.kafkajs.otel.consumer";function fp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function C1(e){let t=fp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=In(t,fp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?Ir.SAMPLED:Ir.NONE}}]}function uf({topic:e,message:t,operationType:n,links:r,attributes:i}){let o=n===mp?"poll":n;return k({name:`${o} ${e}`,kind:n===mp?U.CLIENT:U.CONSUMER,links:r,attributes:{...i,[wt]:XE,[Rn]:e,[cr]:n,[na]:o,[YE]:t?.key?String(t.key):void 0,[jE]:t?.key&&t.value===null?!0:void 0,[v1]:t?.offset,...t?{[S]:dQ}:{}}})}function KE(e,t){let n=k({name:`send ${e}`,kind:U.PRODUCER,attributes:{[wt]:XE,[Rn]:e,[YE]:t.key?String(t.key):void 0,[jE]:t.key&&t.value===null?!0:void 0,[za]:t.partition!==void 0?String(t.partition):void 0,[na]:"send",[cr]:R1,[S]:uQ}});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 ds(e,t){return Promise.resolve(t).catch(n=>{let r,i=O1;throw typeof n=="string"||n===void 0?r=n:typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"message")&&(r=n.message,i=n.constructor.name),e.forEach(o=>{o.setAttribute(wr,i),o.setStatus({code:2,message:r})}),n}).finally(()=>{e.forEach(n=>n.end())})}var mQ="@sentry/instrumentation-kafkajs",df=class extends ae{constructor(t={}){super(mQ,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(...i){let o=n.apply(this,i);return w(o.run)&&t._unwrap(o,"run"),t._wrap(o,"run",t._getConsumerRunPatch()),o}}_getProducerPatch(){let t=this;return n=>function(...i){let o=n.apply(this,i);return w(o.sendBatch)&&t._unwrap(o,"sendBatch"),t._wrap(o,"sendBatch",t._getSendBatchPatch()),w(o.send)&&t._unwrap(o,"send"),t._wrap(o,"send",t._getSendPatch()),w(o.transaction)&&t._unwrap(o,"transaction"),t._wrap(o,"transaction",t._getProducerTransactionPatch()),o}}_getConsumerRunPatch(){let t=this;return n=>function(...i){let o=i[0];return o?.eachMessage&&(w(o.eachMessage)&&t._unwrap(o,"eachMessage"),t._wrap(o,"eachMessage",t._getConsumerEachMessagePatch())),o?.eachBatch&&(w(o.eachBatch)&&t._unwrap(o,"eachBatch"),t._wrap(o,"eachBatch",t._getConsumerEachBatchPatch())),n.call(this,o)}}_getConsumerEachMessagePatch(){return t=>function(...r){let i=r[0],o=fp(i.message.headers,"sentry-trace"),s=fp(i.message.headers,"baggage");return An({sentryTrace:o,baggage:s},()=>{let c=uf({topic:i.topic,message:i.message,operationType:ZE,attributes:{[za]:String(i.partition)}}),a=se(c,()=>t.apply(this,r));return ds([c],a)})}}_getConsumerEachBatchPatch(){return t=>function(...r){let i=r[0],o=Nn(()=>uf({topic:i.batch.topic,message:void 0,operationType:mp,attributes:{[ea]:i.batch.messages.length,[za]:String(i.batch.partition)}}));return se(o,()=>{let s=[o];i.batch.messages.forEach(a=>{s.push(uf({topic:i.batch.topic,message:a,operationType:ZE,links:C1(a.headers),attributes:{[za]:String(i.batch.partition)}}))});let c=t.apply(this,r);return ds(s,c)})}}_getProducerTransactionPatch(){let t=this;return n=>function(...i){let o=k({name:"transaction"}),s=n.apply(this,i);return s.then(c=>{let a=c.send;c.send=function(...m){return se(o,()=>t._getSendPatch()(a).apply(this,m).catch(h=>{throw o.setStatus({code:2,message:h?.message}),h}))};let l=c.sendBatch;c.sendBatch=function(...m){return se(o,()=>t._getSendBatchPatch()(l).apply(this,m).catch(h=>{throw o.setStatus({code:2,message:h?.message}),h}))};let p=c.commit;c.commit=function(...m){let _=p.apply(this,m).then(()=>{o.setStatus({code:1})});return ds([o],_)};let u=c.abort;c.abort=function(...m){let _=u.apply(this,m);return ds([o],_)}}).catch(c=>{o.setStatus({code:2,message:c?.message}),o.end()}),s}}_getSendBatchPatch(){return t=>function(...r){let o=r[0].topicMessages||[],s=[];o.forEach(a=>{a.messages.forEach(l=>{s.push(KE(a.topic,l))})});let c=t.apply(this,r);return ds(s,c)}}_getSendPatch(){return t=>function(...r){let i=r[0],o=i.messages.map(c=>KE(i.topic,c)),s=t.apply(this,r);return ds(o,s)}}};var x1="Kafka",qE=de(x1,()=>new df),fQ=(()=>({name:x1,setupOnce(){qE()}})),QE=fQ;var gQ="@sentry/instrumentation-lru-memoizer",mf=class extends ae{constructor(){super(gQ,q,{})}init(){return[new re("lru-memoizer",[">=1.3 <4"],t=>Object.assign(function(...r){let i=t.apply(this,r);return function(...o){let s=o.pop(),c=ne(),a=typeof s=="function"?function(...l){return Be(c,()=>s.apply(this,l))}:s;return i.apply(this,[...o,a])}},{sync:t.sync}),void 0)]}};var P1="LruMemoizer",JE=de(P1,()=>new mf),_Q=(()=>({name:P1,setupOnce(){JE()}})),$E=_Q;var k1="auto.db.otel.mongo";function zE(e,t,n,r){return sp(e,t,n,r,k1)}function gp(e,t,n,r){return cp(e,t,n,r,k1)}function ms(e,t){let n=Q(),r=!1;return function(...o){if(!r){r=!0;let s=o[0];e&&(s instanceof Error&&e.setStatus({code:2,message:s.message}),e.end())}return se(n??null,()=>t.apply(this,o))}}function fs(){return!Q()}function ff(e){return t=>function(r,i,o,s,c){let a=typeof s=="function"?s:c;if(fs()||typeof a!="function"||typeof o!="object")return typeof s=="function"?t.call(this,r,i,o,s):t.call(this,r,i,o,s,c);let l=hr(gp(i,r,o[0],e)),p=ms(l,a);return typeof s=="function"?t.call(this,r,i,o,p):t.call(this,r,i,o,s,p)}}function L1(){return e=>function(n,r,i,o,s){let c=typeof o=="function"?o:s;if(fs()||typeof c!="function"||typeof i!="object")return typeof o=="function"?e.call(this,n,r,i,o):e.call(this,n,r,i,o,s);let a=ap(i),l=hr(gp(r,n,i,a)),p=ms(l,c);return typeof o=="function"?e.call(this,n,r,i,p):e.call(this,n,r,i,o,p)}}function M1(){return e=>function(n,r,i,o){let s=o,c=Object.keys(r)[0];if(typeof r!="object"||r.ismaster||r.hello)return e.call(this,n,r,i,o);let a;fs()||(a=hr(zE(this,n,r,c)));let l=ms(a,s);return e.call(this,n,r,i,l)}}function w1(){return e=>function(...n){let[r,i]=n,o=Object.keys(i)[0],s=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return e.apply(this,n);let c;fs()||(c=hr(zE(this,r,i,o)));let a=ms(c,s),l=e.apply(this,n);return l.then(p=>a(null,p),p=>a(p)),l}}function G1(){return e=>function(n,r,i,o,s,c){let a=typeof s=="function"?s:c;if(fs()||typeof a!="function"||typeof i!="object")return typeof s=="function"?e.call(this,n,r,i,o,s):e.call(this,n,r,i,o,s,c);let l=hr(gp(r,n,i,"find")),p=ms(l,a);return typeof s=="function"?e.call(this,n,r,i,o,p):e.call(this,n,r,i,o,s,p)}}function U1(){return e=>function(n,r,i,o,s,c){let a=typeof s=="function"?s:c;if(fs()||typeof a!="function")return typeof s=="function"?e.call(this,n,r,i,o,s):e.call(this,n,r,i,o,s,c);let l=hr(gp(r,n,i.cmd,"getMore")),p=ms(l,a);return typeof s=="function"?e.call(this,n,r,i,o,p):e.call(this,n,r,i,o,s,p)}}function D1(){return e=>function(n){let r=Q();return e.call(this,function(...i){return se(r??null,()=>n.apply(this,i))})}}var hQ="@sentry/instrumentation-mongodb",gf=class extends ae{constructor(t={}){super(hQ,q,t)}init(){let{v3PatchConnection:t,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnectionCallback:r,v4PatchConnectionPromise:i,v4UnpatchConnection:o}=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,o),new Ae("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,o),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",ff("insert")),w(t.remove)&&this._unwrap(t,"remove"),this._wrap(t,"remove",ff("remove")),w(t.update)&&this._unwrap(t,"update"),this._wrap(t,"update",ff("update")),w(t.command)&&this._unwrap(t,"command"),this._wrap(t,"command",L1()),w(t.query)&&this._unwrap(t,"query"),this._wrap(t,"query",G1()),w(t.getMore)&&this._unwrap(t,"getMore"),this._wrap(t,"getMore",U1()),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",D1()),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",M1()),t),v4PatchConnectionPromise:t=>(w(t.Connection.prototype.command)&&this._unwrap(t.Connection.prototype,"command"),this._wrap(t.Connection.prototype,"command",w1()),t),v4UnpatchConnection:t=>{t!==void 0&&this._unwrap(t.Connection.prototype,"command")}}}};var B1="Mongo",eT=de(B1,()=>new gf),bQ=(()=>({name:B1,setupOnce(){eT()}})),tT=bQ;function H1(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
|
|
34
|
-
Mongoose Error Code: ${t.code}`:""}`})}function F1(e,t){return e instanceof Promise?e.catch(n=>{throw H1(t,n),n}).finally(()=>t.end()):(t.end(),e)}function W1(e,t,n,r,i){let o=0;return i.length===2?o=1:i.length===3&&(o=2),i[o]=(s,c)=>(s&&H1(r,s),r.end(),e(s,c)),t.apply(n,i)}var yQ="@sentry/instrumentation-mongoose",_p="auto.db.otel.mongoose",bf=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],SQ=["remove","count","findOneAndRemove",...bf],EQ=["count","findOneAndRemove",...bf],TQ=[...bf];function V1(e){return e?e.startsWith("6.")||e.startsWith("5.")?SQ:e.startsWith("7.")?EQ:TQ:bf}function Y1(e){return e&&(e.startsWith("5.")||e.startsWith("6."))||!1}function j1(e){return!e||!e.startsWith("8.")?!1:parseInt(e.split(".")[1],10)>=21}var _f=Symbol("stored-parent-span"),Z1=Symbol("already-instrumented"),hf=class extends ae{constructor(t={}){super(yQ,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,Y1(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove")),j1(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()),V1(n).forEach(o=>{this._wrap(r.Query.prototype,o,this.patchAndCaptureSpanContext(o))}),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,i=V1(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,Y1(n)&&this._unwrap(r.Model.prototype,"remove"),j1(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"),i.forEach(o=>{this._unwrap(r.Query.prototype,o)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(){let t=this;return n=>function(i){let o=this[_f],s=Pi({collection:this._model.collection,modelName:this._model?.modelName,operation:"aggregate",origin:_p,parentSpan:o});return t._handleResponse(s,n,this,arguments,i)}}patchQueryExec(){let t=this;return n=>function(i){if(this[Z1])return n.apply(this,arguments);let o=this[_f],s=Pi({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:_p,parentSpan:o});return t._handleResponse(s,n,this,arguments,i)}}patchOnModelMethods(t){let n=this;return r=>function(o,s){let c=Pi({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:_p});return o instanceof Function&&(s=o),n._handleResponse(c,r,this,arguments,s)}}_patchDocumentUpdateMethods(t){let n=this;return r=>function(o,s,c){let a=c;typeof o=="function"?a=o:typeof s=="function"&&(a=s);let l=Pi({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:t,origin:_p}),p=n._handleResponse(l,r,this,arguments,a);return p&&typeof p=="object"&&(p[Z1]=!0),p}}patchModelStatic(t){let n=this;return r=>function(o,s,c){typeof s=="function"&&(c=s);let a=Pi({collection:this.collection,modelName:this.modelName,operation:t,origin:_p});return n._handleResponse(a,r,this,arguments,c)}}patchModelAggregate(){return t=>function(){let r=Q(),i=t.apply(this,arguments);return i&&(i[_f]=r),i}}patchAndCaptureSpanContext(t){return n=>function(){return this[_f]=Q(),n.apply(this,arguments)}}_handleResponse(t,n,r,i,o){return se(t,()=>{if(o instanceof Function)return W1(o,n,r,t,i);{let s=n.apply(r,i);return F1(s,t)}})}};var X1="Mongoose",nT=de(X1,()=>new hf),IQ=(()=>Ut(pE(),{name:X1,setupOnce(){nT()}})),rT=IQ;var K1="db.connection_string",q1="mysql";function Q1(e){let t=e?.connectionConfig||e||{},{host:n,port:r,database:i,user:o}=t;return{host:n,port:r,database:i,user:o}}function J1(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),typeof n=="string"&&(r+=`/${n}`),r}function $1(e){return typeof e=="string"?e:e.sql}function z1(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var AQ="@sentry/instrumentation-mysql",NQ="auto.db.otel.mysql",yf=class extends ae{constructor(t={}){super(AQ,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(i){let o=t(...arguments);return n._wrap(o,"query",n._patchQuery(o)),o}}}_patchCreatePool(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"query",n._patchQuery(o)),n._wrap(o,"getConnection",n._patchGetConnection(o)),o}}}_patchCreatePoolCluster(){return t=>{let n=this;return function(i){let o=t(...arguments);return n._wrap(o,"getConnection",n._patchGetConnection(o)),o}}}_patchGetConnection(t){return n=>{let r=this;return function(o,s,c){if(!r._enabled)return r._unwrap(t,"getConnection"),n.apply(t,arguments);if(arguments.length===1&&typeof o=="function"){let a=r._getConnectionCallbackPatchFn(o);return n.call(t,a)}if(arguments.length===2&&typeof s=="function"){let a=r._getConnectionCallbackPatchFn(s);return n.call(t,o,a)}if(arguments.length===3&&typeof c=="function"){let a=r._getConnectionCallbackPatchFn(c);return n.call(t,o,s,a)}return n.apply(t,arguments)}}}_getConnectionCallbackPatchFn(t){let n=this,r=ne();return function(i,o){o&&(w(o.query)||n._wrap(o,"query",n._patchQuery(o))),typeof t=="function"&&Be(r,()=>t.call(this,i,o))}}_patchQuery(t){return n=>{let r=this;return function(i,o,s){if(!r._enabled)return r._unwrap(t,"query"),n.apply(t,arguments);let{host:c,port:a,database:l,user:p}=Q1(t.config),u=parseInt(String(a),10),d={[S]:NQ,[Pe]:q1,[K1]:J1(c,a,l),[Et]:l,[Mt]:p,[Ve]:$1(i),[Le]:c};isNaN(u)||(d[xe]=u);let m=k({name:z1(i),kind:U.CLIENT,attributes:d}),_=Array.from(arguments).findIndex(b=>typeof b=="function"),h=ne();if(_===-1){let b=se(m,()=>n.apply(t,arguments));return _n(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(i,o,s){return i&&t.setStatus({code:2,message:i.message}),t.end(),Be(n,()=>r(...arguments))}}};var ew="Mysql",iT=de(ew,()=>new yf({})),vQ=(()=>({name:ew,setupOnce(){iT()}})),oT=vQ;var tw="db.connection_string",nw="mysql";function rw(e){let{host:t,port:n,database:r,user:i}=RQ(e),o={[tw]:OQ(t,n,r),[Et]:r,[Mt]:i,[Le]:t},s=parseInt(n,10);return isNaN(s)||(o[xe]=s),o}function RQ(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function OQ(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,i]=typeof e=="string"?[e,n]:[e.sql,CQ(e)?n||e.values:n];try{return t&&i?t(r,i):r}catch{return"Could not determine the query due to an error in formatting"}}function CQ(e){return"values"in e}function ow(e){let t=typeof e=="object"?e.sql:e,n=t?.indexOf(" ");return typeof n=="number"&&n!==-1?t?.substring(0,n):t}var sw=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function sT(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:t}var xQ="@sentry/instrumentation-mysql2",PQ="auto.db.otel.mysql2",aT=[">=1.4.2 <3.20.0"],Sf=class extends ae{constructor(t={}){super(xQ,q,t)}init(){let t;function n(o){!t&&o.format&&(t=o.format)}let r=o=>{w(o.query)&&this._unwrap(o,"query"),this._wrap(o,"query",this._patchQuery(t)),w(o.execute)&&this._unwrap(o,"execute"),this._wrap(o,"execute",this._patchQuery(t))},i=o=>{this._unwrap(o,"query"),this._unwrap(o,"execute")};return[new re("mysql2",aT,o=>(n(o),o),()=>{},[new Ae("mysql2/promise.js",aT,o=>(n(o),o),()=>{}),new Ae("mysql2/lib/connection.js",aT,o=>{let s=sT(o);return r(s),o},o=>{if(o===void 0)return;let s=sT(o);i(s)})])]}_patchQuery(t){let n=this;return r=>function(i,o,s){let c;Array.isArray(o)?c=o:arguments[2]&&(c=[o]);let a={...rw(this.config),[Pe]:nw,[Ve]:iw(i,t,c),[S]:PQ},l=k({name:ow(i),kind:U.CLIENT,attributes:a}),p=sw(u=>{u&&l.setStatus({code:2,message:u.message}),l.end()});if(arguments.length===1){typeof i.onResult=="function"&&n._wrap(i,"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 aw="Mysql2",cT=de(aw,()=>new Sf),kQ=(()=>Ut(mE(),{name:aw,setupOnce(){cT()}})),lT=kQ;import*as Iw from"diagnostics_channel";var Ef,cw;function lw(e){Ef=e}function ec(){return!!Ef}function pT(){if(Ef)return cw??(cw=Ef())}var LQ=["get","set","setex"],uT=["get","mget"],MQ=["set","setex"],dT=["del","unlink"];function gs(e,t){return e.includes(t.toLowerCase())}function mT(e){return gs(uT,e)?"cache.get":gs(MQ,e)?"cache.put":gs(dT,e)?"cache.remove":void 0}function wQ(e,t){return t.some(n=>e.startsWith(n))}function uw(e,t){try{if(t.length===0)return;let n=i=>typeof i=="string"||typeof i=="number"||Buffer.isBuffer(i)?[i.toString()]:Array.isArray(i)?pw(i.map(o=>n(o))):["<unknown>"],r=t[0];return gs(LQ,e)&&r!=null?n(r):pw(t.map(i=>n(i)))}catch{return}}function dw(e,t,n){if(!mT(e))return!1;for(let r of t)if(wQ(r,n))return!0;return!1}function mw(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 i=t(r);return typeof i=="number"?n!==void 0?n+i:i:n},0):t(e)}function pw(e){let t=[],n=r=>{r.forEach(i=>{Array.isArray(i)?n(i):t.push(i)})};return n(e),t}var hp={};function fw(e){hp=e}var _s=(e,t,n,r)=>{let i=uw(t,n),o=mT(t);if(!i||!o||!hp.cachePrefixes||!dw(t,i,hp.cachePrefixes))return;let s=oe(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=gs(dT,t)?void 0:mw(r);l&&e.setAttribute(Y_,l),gs(uT,t)&&l!==void 0&&e.setAttribute(W_,l>0),e.setAttributes({[B]:o,[V_]:i});let p=i.join(", ");e.updateName(hp.maxCacheKeyLength?mn(p,hp.maxCacheKeyLength):p)};var tc="db.connection_string",nc="redis";var GQ="@sentry/instrumentation-ioredis",gw="auto.db.otel.redis",UQ=[">=2.0.0 <5.11.0"];function hs(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var Tf=class extends ae{constructor(t={}){super(GQ,q,t)}init(){return[new re("ioredis",UQ,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 i=r[0];if(r.length<1||typeof i!="object"||!Q())return n.apply(this,r);let{host:o,port:s}=this.options,c={[Pe]:nc,[Ve]:zr(i.name,i.args),[tc]:`redis://${o}:${s}`,[Le]:o,[xe]:s,[S]:gw},a=k({name:i.name,kind:U.CLIENT,attributes:c});try{let l=n.apply(this,r),p=i.resolve;i.resolve=function(d){t._callResponseHook(a,i,d),hs(a,null),p(d)};let u=i.reject;return i.reject=function(d){hs(a,d),u(d)},l}catch(l){throw hs(a,l),l}}}_patchConnection(){return t=>function(...n){if(!Q())return t.apply(this,n);let{host:r,port:i}=this.options,o={[Pe]:nc,[Ve]:"connect",[tc]:`redis://${r}:${i}`,[Le]:r,[xe]:i,[S]:gw},s=k({name:"connect",kind:U.CLIENT,attributes:o});try{let c=t.apply(this,n);return c instanceof Promise?c.then(a=>(hs(s,null),a),a=>(hs(s,a),Promise.reject(a))):(hs(s,null),c)}catch(c){throw hs(s,c),c}}}_callResponseHook(t,n,r){let{responseHook:i}=this.getConfig();if(i)try{i(t,n.name,n.args,r)}catch{}}};var gT="@sentry/instrumentation-redis",bw="auto.db.otel.redis",bp=Symbol("opentelemetry.instrumentation.redis.open_spans"),_w=Symbol("opentelemetry.instrumentation.redis.multi_command_options");function If(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function yw(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function DQ(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 hw(e){return{[Pe]:nc,[Le]:e?.socket?.host,[xe]:e?.socket?.port,[tc]:DQ(e?.url),[S]:bw}}var Sw=class Ew extends ae{constructor(t={}){super(gT,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(o){if(arguments.length!==1||typeof o!="object")return r.apply(this,arguments);let s={[Pe]:nc,[Ve]:zr(o.command,o.args),[S]:bw};this.connection_options&&(s[Le]=this.connection_options.host,s[xe]=this.connection_options.port),this.address&&(s[tc]=`redis://${this.address}`);let c=k({name:`${Ew.COMPONENT}-${o.command}`,kind:U.CLIENT,attributes:s}),a=arguments[0].callback;if(a){let l=Q();arguments[0].callback=function(u,d){return yw(t.getConfig().responseHook,c,o.command,o.args,d),If(c,u),se(l??null,()=>a.apply(this,arguments))}}try{return r.apply(this,arguments)}catch(l){throw If(c,l),l}}}}};Sw.COMPONENT="redis";var BQ=Sw,Tw=class fT extends ae{constructor(t={}){super(gT,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"],(o,s)=>{let c=o.transformCommandArguments;if(!c)return Ye&&g.error("internal instrumentation error, missing transformCommandArguments function"),o;let a=s?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return w(o?.[a])&&this._unwrap(o,a),this._wrap(o,a,this._getPatchExtendWithCommands(c)),o},o=>{w(o?.extendWithCommands)&&this._unwrap(o,"extendWithCommands"),w(o?.attachCommands)&&this._unwrap(o,"attachCommands")}),r=new Ae(`${t}/dist/lib/client/multi-command.js`,["^1.0.0",">=5.0.0 <5.12.0"],o=>{let s=o?.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()),o},o=>{let s=o?.default?.prototype;w(s?.exec)&&this._unwrap(s,"exec"),w(s?.execAsPipeline)&&this._unwrap(s,"execAsPipeline"),w(s?.addCommand)&&this._unwrap(s,"addCommand")}),i=new Ae(`${t}/dist/lib/client/index.js`,["^1.0.0",">=5.0.0 <5.12.0"],o=>{let s=o?.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()),o},o=>{let s=o?.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"],o=>o,()=>{},[n,r,i])}_getPatchExtendWithCommands(t){let n=this;return function(i){return function(s){if(s?.BaseClass?.name!=="RedisClient")return i.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)},i.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let t=this;return function(r){return function(){let o=r.apply(this,arguments);return typeof o?.then!="function"?(Ye&&g.error("non-promise result when patching exec/execAsPipeline"),o):o.then(s=>{let c=this[bp];return t._endSpansWithRedisReplies(c,s),s}).catch(s=>{let c=this[bp];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(o){return t._traceClientCommand(r,this,arguments,o)}}}_getPatchRedisClientMulti(){return function(n){return function(){let i=n.apply(this,arguments);return i[_w]=this.options,i}}}_getPatchRedisClientSendCommand(){let t=this;return function(r){return function(o){return t._traceClientCommand(r,this,arguments,o)}}}_getPatchedClientConnect(){return function(n){return function(){let i=hw(this.options),o=k({name:`${fT.COMPONENT}-connect`,kind:U.CLIENT,attributes:i});return se(o,()=>n.apply(this)).then(c=>(o.end(),c),c=>(If(o,c),Promise.reject(c)))}}}_traceClientCommand(t,n,r,i){let o=n.options||n[_w],s=i[0],c=i.slice(1),a=hw(o),l=zr(s,c);l!=null&&(a[Ve]=l);let p=k({name:`${fT.COMPONENT}-${s}`,kind:U.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[bp]=d[bp]||[],d[bp].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:i,commandName:o,commandArgs:s}=t[r],c=n[r],[a,l]=c instanceof Error?[null,c]:[c,void 0];this._endSpanWithResponse(i,o,s,a,l)}}_endSpanWithResponse(t,n,r,i,o){o||yw(this.getConfig().responseHook,t,n,r,i),If(t,o)}};Tw.COMPONENT="redis";var HQ=Tw,Af=class extends ae{constructor(t={}){super(gT,q,t),this.initialized=!1,this.instrumentationV2_V3=new BQ(this.getConfig()),this.instrumentationV4_V5=new HQ(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 Nf="Redis",FQ=de(`${Nf}.IORedis`,()=>new Tf({responseHook:_s})),WQ=de(`${Nf}.Redis`,()=>new Af({responseHook:_s})),_T=Object.assign(()=>{(!ec()||!Iw.tracingChannel)&&(FQ(),WQ())},{id:Nf}),VQ=((e={})=>Ut(EE({responseHook:_s}),{name:Nf,setupOnce(){fw(e),_T()}})),hT=VQ;var bs=(e=>(e.QUERY_PREFIX="pg.query",e.CONNECT="pg.connect",e.POOL_CONNECT="pg-pool.connect",e))(bs||{});var yp=(e=>(e.PG_PLAN="db.postgresql.plan",e.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",e.MAX_CLIENT="db.postgresql.max.client",e))(yp||{});var bT="db.connection_string",yT="postgresql";var YQ="auto.db.otel.postgres";function jQ(e,t){if(!t)return bs.QUERY_PREFIX;let n=typeof t.name=="string"&&t.name?t.name:ZQ(t.text);return`${bs.QUERY_PREFIX}:${n}${e?` ${e}`:""}`}function ZQ(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 XQ(e){try{let t=new URL(e);return t.username="",t.password="",t.toString()}catch{return"postgresql://localhost:5432/"}}function Aw(e){if("connectionString"in e&&e.connectionString)return XQ(e.connectionString);let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}function Nw(e){if(Number.isInteger(e))return e}function ST(e){return{[Pe]:yT,[Et]:e.database,[bT]:Aw(e),[Mt]:e.user,[Le]:e.host,[xe]:Nw(e.port)}}function vw(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[yp.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[yp.MAX_CLIENT]:e.maxClient,[Pe]:yT,[Et]:t?.pathname.slice(1)??e.database,[bT]:Aw(e),[Le]:t?.hostname??e.host,[xe]:Number(t?.port)||Nw(e.port),[Mt]:t?.username??e.user}}function vf(){return Q()===void 0}function Rw(e){let{connectionParameters:t}=this,n=t.database,r=jQ(n,e),i=k({name:r,kind:U.CLIENT,attributes:{...ST(t),[S]:YQ}});return e&&(e.text&&i.setAttribute(Ve,e.text),typeof e.name=="string"&&i.setAttribute(yp.PG_PLAN,e.name)),i}function ET(e,t){return function(r,i){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,i)}}function Ow(e,t){return function(r,i,o){r&&e.setStatus({code:2,message:r.message}),e.end(),t.call(this,r,i,o)}}function Cw(e,t){return function(...r){let i=r[0];i instanceof Error&&e.setStatus({code:2,message:i.message}),e.end(),t.apply(this,r)}}function Rf(e){return typeof e=="object"&&e!==null&&"message"in e?String(e.message):void 0}function xw(e){return typeof e=="object"&&typeof e?.text=="string"}var KQ="@sentry/instrumentation-pg";function rc(e){return e[Symbol.toStringTag]==="Module"?e.default:e}function Of(e,t){return function(...n){return se(e,()=>t.apply(this,n))}}var Cf=class extends ae{constructor(t={}){super(KQ,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)),i=new Ae("pg/lib/client.js",t,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new re("pg",t,c=>{let a=rc(c);return this._patchPgClient(a.Client),c},c=>{let a=rc(c);return this._unpatchPgClient(a.Client),c},[i,r]),s=new re("pg-pool",n,c=>{let a=rc(c);return w(a.prototype.connect)&&this._unwrap(a.prototype,"connect"),this._wrap(a.prototype,"connect",this._getPoolConnectPatch()),a},c=>{let a=rc(c);w(a.prototype.connect)&&this._unwrap(a.prototype,"connect")});return[o,s]}_patchPgClient(t){if(!t)return;let n=rc(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=rc(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(i){if(vf()||t.getConfig().ignoreConnectSpans)return n.call(this,i);let o=k({name:bs.CONNECT,kind:U.CLIENT,attributes:ST(this)}),s=i;if(s){let a=Q();s=Cw(o,s),a&&(s=Of(a,s))}let c=se(o,()=>n.call(this,s));return Pw(o,c)}}_getClientQueryPatch(){return t=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...r){if(vf())return t.apply(this,r);let i=r[0],o=typeof i=="string",s=xw(i),c=o?{text:i,values:Array.isArray(r[1])?r[1]:void 0}:s?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(r[1])?r[1]:void 0)}:void 0,a=Rw.call(this,c);if(r.length>0){let p=Q();if(typeof r[r.length-1]=="function")r[r.length-1]=ET(a,r[r.length-1]),p&&(r[r.length-1]=Of(p,r[r.length-1]));else if(typeof c?.callback=="function"){let u=ET(a,c.callback);p&&(u=Of(p,u)),r[0].callback=u}}let l;try{l=t.apply(this,r)}catch(p){throw a.setStatus({code:2,message:Rf(p)}),a.end(),p}return l instanceof Promise?l.then(p=>(a.end(),p)).catch(p=>(a.setStatus({code:2,message:Rf(p)}),a.end(),Promise.reject(p))):l})}_getPoolConnectPatch(){let t=this;return n=>function(i){if(vf()||t.getConfig().ignoreConnectSpans)return n.call(this,i);let o=k({name:bs.POOL_CONNECT,kind:U.CLIENT,attributes:vw(this.options)}),s=i;if(s){let a=Q();s=Ow(o,s),a&&(s=Of(a,s))}let c=se(o,()=>n.call(this,s));return Pw(o,c)}}};function Pw(e,t){return t instanceof Promise?t.then(r=>(e.end(),r)).catch(r=>(e.setStatus({code:2,message:Rf(r)}),e.end(),Promise.reject(r))):t}var kw="Postgres",TT=de(kw,Cf,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),qQ=(e=>({name:kw,setupOnce(){TT(e)}})),IT=qQ;at();var NT="PostgresJs",Lw=[">=3.0.0 <4"],QQ="db.response.status_code",JQ=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,$Q=Symbol.for("sentry.query.from.instrumented.sql"),vT=de(NT,e=>new AT({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),AT=class extends ae{constructor(t){super("sentry-postgres-js",q,t)}init(){let t=new re("postgres",Lw,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`,Lw,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 i=this,o=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=i.getConfig();return Cy(c,{requireParentSpan:a.requireParentSpan,requestHook:a.requestHook})};Object.setPrototypeOf(o,r),Object.setPrototypeOf(o.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(o,s,c)}return n?o:(Ol(t,"default",o),t)}_shouldCreateSpans(){let t=this.getConfig();return he.getSpan(pe.active())!==void 0||!t.requireParentSpan}_setOperationName(t,n,r){if(r){t.setAttribute(ar,r);return}let i=n?.match(JQ);i?.[1]&&t.setAttribute(ar,i[1].toUpperCase())}_reconstructQuery(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((n,r,i)=>i===0?r:`${n}$${i}${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(...i){if(this.executed||this[$Q])return r.apply(this,i);if(!n._shouldCreateSpans())return r.apply(this,i);let o=n._reconstructQuery(this.strings),s=n._sanitizeSqlQuery(o);return ke({name:s||"postgresjs.query",op:"db"},c=>{QS(c,"auto.db.postgresjs"),c.setAttributes({[mt]:"postgres",[Mr]:s});let a=n.getConfig(),{requestHook:l}=a;l&&qr(()=>l(c,s,void 0),d=>{d&&(c.setAttribute("sentry.hook.error","requestHook failed"),Ye&&g.error(`Error in requestHook for ${NT} 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(QQ,_?.[0]?.code||"unknown"),c.setAttribute(wr,_?.[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,i)}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}},zQ=(e=>({name:NT,setupOnce(){vT(e)}})),RT=zQ;at();var Ln=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(Ln||{});var Mw="@hapi/hapi",Sp=Symbol("hapi-handler-patched"),Ep={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},ww=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"]);function Gw(e){return e.name?e.name:e.pkg.name}var xf=e=>typeof e=="string"&&ww.has(e),Uw=e=>{let t=e?.type;return t!==void 0&&xf(t)},Dw=e=>Array.isArray(e)&&e.length<=3&&xf(e[0])&&typeof e[1]=="function",Bw=e=>!Array.isArray(e),Hw=(e,t)=>{let n={[He]:e.path,[Gr]:e.method},r;return t?(n[Ln.HAPI_TYPE]=Ep.PLUGIN,n[Ln.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[Ln.HAPI_TYPE]=Ep.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},Fw=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[Ln.EXT_TYPE]:e,[Ln.HAPI_TYPE]:Ep.EXT,[Ln.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[Ln.EXT_TYPE]:e,[Ln.HAPI_TYPE]:Ep.EXT},name:r}},OT=e=>"plugin"in e?"plugin"in e.plugin?e.plugin.plugin:e.plugin:e;var eJ="@sentry/instrumentation-hapi",Pf=class extends ae{constructor(t={}){super(eJ,q,t)}init(){return new re(Mw,[">=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(o){let s=t.apply(this,[o]);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(i,o){if(Array.isArray(i))for(let s of i){let c=OT(s);n._wrapRegisterHandler(c)}else{let s=OT(i);n._wrapRegisterHandler(s)}return t.apply(this,[i,o])}}_getServerExtPatch(t,n){let r=this;return function(...o){if(Array.isArray(o[0])){let s=o[0];for(let c=0;c<s.length;c++){let a=s[c];if(xf(a.type)){let l=a,p=r._wrapExtMethods(l.method,a.type,n);l.method=p,s[c]=l}}return t.apply(this,o)}else if(Dw(o)){let s=o,c=s[1],a=r._wrapExtMethods(c,s[0],n);return t.apply(this,[s[0],a,s[2]])}else if(Uw(o[0])){let s=o[0],c=r._wrapExtMethods(s.method,s.type,n);return s.method=c,t.call(this,s)}return t.apply(this,o)}}_getServerRoutePatch(t,n){let r=this;return function(i){if(Array.isArray(i))for(let o=0;o<i.length;o++){let s=r._wrapRouteHandler.call(r,i[o],n);i[o]=s}else i=r._wrapRouteHandler.call(r,i,n);return t.apply(this,[i])}}_wrapRegisterHandler(t){let n=this,r=Gw(t),i=t.register,o=this,s=function(c,a){return o._wrap(c,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),o._wrap(c,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),i.call(this,c,a)};t.register=s}_wrapExtMethods(t,n,r){let i=this;if(t instanceof Array){for(let o=0;o<t.length;o++)t[o]=i._wrapExtMethods(t[o],n);return t}else if(Bw(t))return t[Sp]===!0?t:(t[Sp]=!0,function(...s){if(he.getSpan(pe.active())===void 0)return t.apply(this,s);let c=Fw(n,r,t.name);return Se({name:c.name,op:`${c.attributes[Ln.HAPI_TYPE]}.hapi`,attributes:{...c.attributes,[S]:"auto.http.otel.hapi"}},()=>t.apply(void 0,s))});return t}_wrapRouteHandler(t,n){if(t[Sp]===!0)return t;t[Sp]=!0;let r=i=>function(...o){if(he.getSpan(pe.active())===void 0)return i.call(this,...o);$r(t.path);let s=Hw(t,n);return Se({name:s.name,op:`${s.attributes[Ln.HAPI_TYPE]}.hapi`,attributes:{...s.attributes,[S]:"auto.http.otel.hapi"}},()=>i.call(this,...o))};if(typeof t.handler=="function")t.handler=r(t.handler);else if(typeof t.options=="function"){let i=t.options;t.options=function(o){let s=i(o);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 Ww="Hapi",kf=de(Ww,()=>new Pf),tJ=(()=>({name:Ww,setupOnce(){kf()}})),CT=tJ;function nJ(e){return!!(e&&typeof e=="object"&&"error"in e&&e.error)}function rJ(e){me(e,{mechanism:{type:"auto.function.hapi",handled:!1}})}var iJ={name:"SentryHapiErrorPlugin",version:q,register:async function(e){e.events.on({name:"request",channels:["error"]},(n,r)=>{if(J()!==Rt()){let i=n.route;i.path&&J().setTransactionName(`${i.method.toUpperCase()} ${i.path}`)}else Ye&&g.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");nJ(r)&&rJ(r.error)})}};async function oJ(e){await e.register(iJ),_r(e.register,"hapi")}var go={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Tp={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};at();var sJ="@sentry/instrumentation-hono",aJ="0.0.1",Lf=class extends ae{constructor(t={}){super(sJ,aJ,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(...o){super(...o),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(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return n.apply(this,[o]);let s=i.slice(1);return n.apply(this,[o,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,i.map(o=>t._wrapHandler(o)))}}}_patchOnHandler(){let t=this;return function(n){return function(...i){let o=i.slice(2);return n.apply(this,[...i.slice(0,2),...o.map(s=>t._wrapHandler(s))])}}}_patchMiddlewareHandler(){let t=this;return function(n){return function(...i){if(typeof i[0]=="string"){let o=i[0];if(i.length===1)return n.apply(this,[o]);let s=i.slice(1);return n.apply(this,[o,...s.map(c=>t._wrapHandler(c))])}return n.apply(this,i.map(o=>t._wrapHandler(o)))}}}_wrapHandler(t){let n=this;return function(r,i){if(!n.isEnabled())return t.apply(this,[r,i]);let o=r.req.path,s=n.tracer.startSpan(o);return pe.with(he.setSpan(pe.active(),s),()=>n._safeExecute(()=>{let c=t.apply(this,[r,i]);if(bt(c))return c.then(a=>{let l=n._determineHandlerType(a);return s.setAttributes({[go.HONO_TYPE]:l,[go.HONO_NAME]:l===Tp.REQUEST_HANDLER?o:t.name||"anonymous"}),n.getConfig().responseHook?.(s),a});{let a=n._determineHandlerType(c);return s.setAttributes({[go.HONO_TYPE]:a,[go.HONO_NAME]:a===Tp.REQUEST_HANDLER?o:t.name||"anonymous"}),n.getConfig().responseHook?.(s),c}},()=>s.end(),c=>{n._handleError(s,c),s.end()}))}}_safeExecute(t,n,r){try{let i=t();return bt(i)?i.then(()=>n(),o=>r(o)):n(),i}catch(i){throw r(i),i}}_determineHandlerType(t){return t===void 0?Tp.MIDDLEWARE:Tp.REQUEST_HANDLER}_handleError(t,n){n instanceof Error&&(t.setStatus({code:Gn.ERROR,message:n.message}),t.recordException(n))}};var Vw="Hono";function cJ(e){let t=oe(e).data,n=t[go.HONO_TYPE];if(t[B]||!n)return;e.setAttributes({[S]:"auto.http.otel.hono",[B]:`${n}.hono`});let r=t[go.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 i=t[He],o=t[Ur];typeof i=="string"&&typeof o=="string"&&J().setTransactionName(`${o} ${i}`)}var xT=de(Vw,()=>new Lf({responseHook:e=>{cJ(e)}})),lJ=(()=>({name:Vw,setupOnce(){xT()}})),PT=lJ;function pJ(){return async function(t,n){let r=Qo(t.req);J().setSDKProcessingMetadata({normalizedRequest:r}),await n()}}function uJ(e){return e.res.status>=500}function dJ(e){return async function(n,r){await r(),(e?.shouldHandleError||uJ)(n)&&(n.res.sentry=me(n.error,{mechanism:{type:"auto.middleware.hono",handled:!1}}))}}function mJ(e,t){e.use(pJ()),e.use(dJ(t)),_r(e.use,"hono")}at();var ys=(e=>(e.ROUTER="router",e.MIDDLEWARE="middleware",e))(ys||{});var _o=(e=>(e.KOA_TYPE="koa.type",e.KOA_NAME="koa.name",e))(_o||{});var Yw=(e,t,n,r)=>n?{attributes:{[_o.KOA_NAME]:r?.toString(),[_o.KOA_TYPE]:ys.ROUTER,[He]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[_o.KOA_NAME]:t.name??"middleware",[_o.KOA_TYPE]:ys.MIDDLEWARE,[Su]:t.name??"middleware"},name:`middleware - ${t.name}`},jw=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e));var kT=Symbol("koa-layer-patched");var fJ="@sentry/instrumentation-koa",Mf=class extends ae{constructor(t={}){super(fJ,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(o){let s=o.router?n(o):r(o,!1);return t.apply(this,[s])}}_patchRouterDispatch(t){let r=t.router?.stack??[];for(let i of r){let o=i.path,s=i.stack;for(let c=0;c<s.length;c++){let a=s[c];s[c]=this._patchLayer(a,!0,o)}}return t}_patchLayer(t,n,r){let i=n?ys.ROUTER:ys.MIDDLEWARE;return t[kT]===!0||jw(i,this.getConfig())||t.constructor.name==="GeneratorFunction"||t.constructor.name==="AsyncGeneratorFunction"?t:(t[kT]=!0,(o,s)=>{if(he.getSpan(pe.active())===void 0)return t(o,s);let a=Yw(o,t,n,r);o._matchedRoute&&$r(o._matchedRoute.toString());let l=a.attributes[_o.KOA_NAME],p=typeof l=="string"?l||"< unknown >":a.name;return Se({name:p,op:`${i}.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=o.request?.method?.toUpperCase()||"GET";J().setTransactionName(`${d} ${u}`)}return t(o,s)})})}};var Zw="Koa",LT=de(Zw,Mf,(e={})=>({ignoreLayersType:e.ignoreLayersType})),gJ=((e={})=>({name:Zw,setupOnce(){LT(e)}})),MT=gJ,_J=e=>{e.use(async(t,n)=>{try{await n()}catch(r){throw me(r,{mechanism:{handled:!1,type:"auto.middleware.koa"}}),r}}),_r(e.use,"koa")};var wf=(e=>(e.CONNECT_TYPE="connect.type",e.CONNECT_NAME="connect.name",e))(wf||{}),Gf=(e=>(e.MIDDLEWARE="middleware",e.REQUEST_HANDLER="request_handler",e))(Gf||{});var Li=Symbol("opentelemetry.instrumentation-connect.request-route-stack");var Xw=e=>{Array.isArray(e[Li])===!1&&Object.defineProperty(e,Li,{enumerable:!1,value:[]}),e[Li].push("/");let t=e[Li].length;return()=>{t===e[Li].length?e[Li].pop():Ye&&g.warn("Connect: Trying to pop the stack multiple time")}},Kw=(e,t)=>{t&&e[Li].splice(-1,1,t)},qw=e=>e[Li].reduce((t,n)=>t.replace(/\/+$/,"")+n);var hJ="@sentry/instrumentation-connect",bJ="anonymous",Uf=class extends ae{constructor(t={}){super(hJ,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 i=Reflect.apply(t,this,r);return n(i),i}}_patchNext(t,n,r){return function(o){et(o)&&n.setStatus({code:2,message:"internal_error"});let s=t.apply(this,[o]);return r(),s}}_startSpan(t,n){let r=t?Gf.REQUEST_HANDLER:Gf.MIDDLEWARE,i=t||n.name||bJ;return k({name:i,op:`${r}.connect`,attributes:{[S]:"auto.http.otel.connect",[He]:t.length>0?t:"/",[wf.CONNECT_TYPE]:r,[wf.CONNECT_NAME]:i}})}_patchMiddleware(t,n){let r=this.isEnabled.bind(this),i=this._startSpan.bind(this),o=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];Kw(u,t),t&&$r(qw(u));let _=i(t,n),h=!1;function b(){h||(h=!0,_.end()),d.removeListener("close",b)}d.addListener("close",b),arguments[p]=o(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 i=r[r.length-1],o=r[r.length-2]||"";return r[r.length-1]=n(o,i),t.apply(this,r)}}_patchHandle(t){let n=this._patchOut.bind(this);return function(){let[r,i]=[0,2],o=arguments[r],s=arguments[i],c=Xw(o);return typeof s=="function"&&(arguments[i]=n(s,c)),Reflect.apply(t,this,arguments)}}_patchOut(t,n){return function(...i){return n(),Reflect.apply(t,this,i)}}};var Qw="Connect",wT=de(Qw,()=>new Uf),yJ=(()=>({name:Qw,setupOnce(){wT()}})),GT=yJ;function SJ(e,t,n,r){me(e,{mechanism:{handled:!1,type:"auto.middleware.connect"}}),r(e)}var EJ=e=>{e.use(SJ),_r(e.use,"connect")};var Jw="db.sql.table",$w="sqlite",zw="postgresql";var eG=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>"},TJ=new Map([["sqlite3",$w],["pg",zw]]),tG=e=>TJ.get(e)||e,nG=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,rG=(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}},oG=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},sG=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},UT=e=>{let t=e?._single?.table;return typeof t=="object"?UT(t):t};var IJ="@sentry/instrumentation-knex",AJ="auto.db.otel.knex",NJ="knex",DT=[">=0.22.0 <4",">=0.10.0 <0.18.0",">=0.19.0 <0.22.0",">=0.18.0 <0.19.0"],vJ=1022,aG=Symbol("sentry.instrumentation-knex.parent-span"),Df=class extends ae{constructor(t={}){super(IJ,q,t)}init(){let t=new re(NJ,DT);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`,DT,(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`,DT,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(o){let s=this.client.config,c=UT(this.builder),a=o?.method,l=s?.connection?.connectionString,p=s?.connection?.filename||s?.connection?.database||iG(l),u={[S]:AJ,"knex.version":t,[Pe]:tG(this.client.driverName),[Jw]:c,[Js]:a,[Mt]:s?.connection?.user,[Et]:p,[Le]:s?.connection?.host??oG(l),[xe]:s?.connection?.port??sG(l),[ra]:s?.connection?.filename===":memory:"?"inproc":void 0,[Ve]:rG(o?.sql,vJ)},d=this.builder[aG]||Q(),m=arguments;return Se({name:nG(p,a,c),kind:U.CLIENT,attributes:u,parentSpan:d,onlyIfParent:!0},_=>r.apply(this,m).catch(h=>{let N=eG(this)(o.sql,o.bindings||[]),M=h.message.replace(`${N} - `,"");throw _.setStatus({code:2,message:M}),h}))}}}_storeContext(t){return function(){let r=t.apply(this,arguments);return Object.defineProperty(r,aG,{value:Q()}),r}}_ensureWrapped(t,n,r){w(t[n])&&this._unwrap(t,n),this._wrap(t,n,r)}};import*as Zn from"diagnostics_channel";var RJ="sentrySubscribeOrchestrionChannel";function fe(e){let t=new Set,n=[];for(let{module:r}of e){let i=`${r.name}\0${r.versionRange}\0${String(r.filePath)}`;t.has(i)||(t.add(i),n.push({channelName:r.name,module:r,astQuery:"Program",transform:RJ}))}return n}var ti={name:"amqplib",versionRange:">=0.5.5 <2"},BT=[{channelName:"publish",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"publish",kind:"Sync"}},{channelName:"confirmPublish",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"ConfirmChannel",methodName:"publish",kind:"Callback"}},{channelName:"consume",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"consume",kind:"Async"}},{channelName:"dispatch",module:{...ti,filePath:"lib/channel.js"},functionQuery:{className:"BaseChannel",methodName:"dispatchMessage",kind:"Sync"}},{channelName:"ack",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ack",kind:"Sync"}},{channelName:"nack",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nack",kind:"Sync"}},{channelName:"reject",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"reject",kind:"Sync"}},{channelName:"ackAll",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"ackAll",kind:"Sync"}},{channelName:"nackAll",module:{...ti,filePath:"lib/channel_model.js"},functionQuery:{className:"Channel",methodName:"nackAll",kind:"Sync"}},{channelName:"connect",module:{...ti,filePath:"lib/connect.js"},functionQuery:{functionName:"connect",kind:"Callback"}}],cG={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"},lG=fe(BT);var HT=[...["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"}}))],pG={ANTHROPIC_CHAT:"orchestrion:@anthropic-ai/sdk:chat",ANTHROPIC_MODELS:"orchestrion:@anthropic-ai/sdk:models",ANTHROPIC_MESSAGES_STREAM:"orchestrion:@anthropic-ai/sdk:messages-stream"},uG=fe(HT);var FT=[{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"}}],dG={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"},mG=fe(FT);var ic={name:"dataloader",versionRange:">=2.0.0 <3",filePath:"index.js"},WT=[{channelName:"construct",module:ic,functionQuery:{functionName:"DataLoader",kind:"Sync"}},{channelName:"load",module:ic,functionQuery:{expressionName:"load",kind:"Async"}},{channelName:"loadMany",module:ic,functionQuery:{expressionName:"loadMany",kind:"Async"}},{channelName:"prime",module:ic,functionQuery:{expressionName:"prime",kind:"Sync"}},{channelName:"clear",module:ic,functionQuery:{expressionName:"clear",kind:"Sync"}},{channelName:"clearAll",module:ic,functionQuery:{expressionName:"clearAll",kind:"Sync"}}],fG={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"},gG=fe(WT);var VT=[{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"}}],_G={EXPRESS_HANDLE:"orchestrion:express:handle",ROUTER_HANDLE:"orchestrion:router:handle",EXPRESS_REGISTER:"orchestrion:express:register",ROUTER_REGISTER:"orchestrion:router:register"},hG=fe(VT);var OJ=">=3.0.0 <5",CJ=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,xJ=[{functionName:"addDoc",channelName:"add-doc"},{functionName:"getDocs",channelName:"get-docs"},{functionName:"setDoc",channelName:"set-doc"},{functionName:"deleteDoc",channelName:"delete-doc"}],PJ=">=6.0.0 <7",kJ=[{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"}],YT=[...xJ.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:"@firebase/firestore",versionRange:OJ,filePath:CJ},functionQuery:{functionName:e,kind:"Auto"}})),...kJ.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:"firebase-functions",versionRange:PJ,filePath:e},functionQuery:{functionName:t,kind:"Sync"}}))],bG={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"},yG=fe(YT);var jT=[{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"}}],SG={GENERIC_POOL_ACQUIRE:"orchestrion:generic-pool:acquire"},EG=fe(jT);var ZT=["dist/node/index.js","dist/node/index.mjs","dist/node/index.cjs"],XT=[...ZT.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"}}))),...ZT.map(e=>({channelName:"embed-content",module:{name:"@google/genai",versionRange:">=0.10.0 <2",filePath:e},functionQuery:{className:"Models",methodName:"embedContent",kind:"Auto"}})),...ZT.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"}})))],TG={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"},IG=fe(XT);var KT=[{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"}}],AG={GRAPHQL_PARSE:"orchestrion:graphql:parse",GRAPHQL_VALIDATE:"orchestrion:graphql:validate",GRAPHQL_EXECUTE:"orchestrion:graphql:execute"},NG=fe(KT);var qT=[{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"}}],vG={HAPI_ROUTE:"orchestrion:@hapi/hapi:route",HAPI_EXT:"orchestrion:@hapi/hapi:ext"},RG=fe(qT);var QT=[...["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"}}],OG={IOREDIS_COMMAND:"orchestrion:ioredis:command",IOREDIS_CONNECT:"orchestrion:ioredis:connect"},CG=fe(QT);var JT=[{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"}}],xG={KAFKAJS_SEND_BATCH:"orchestrion:kafkajs:send_batch",KAFKAJS_CONSUMER_RUN:"orchestrion:kafkajs:consumer_run"},PG=fe(JT);var kG="knex",LJ=[{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"}],MJ=[{filePath:"lib/client.js",versionRange:">=0.10.0 <4"},{filePath:"src/client.js",versionRange:">=0.18.0 <0.19.0"}],wJ=["queryBuilder","schemaBuilder","raw"];function GJ(e,t){return{channelName:"query",module:{name:kG,versionRange:t,filePath:e},functionQuery:{className:"Runner",methodName:"query",kind:"Async"}}}function UJ(e,t,n){return{channelName:e,module:{name:kG,versionRange:n,filePath:t},functionQuery:{className:"Client",methodName:e,kind:"Sync"}}}var $T=[...LJ.map(({filePath:e,versionRange:t})=>GJ(e,t)),...MJ.flatMap(({filePath:e,versionRange:t})=>wJ.map(n=>UJ(n,e,t)))],LG={KNEX_QUERY:"orchestrion:knex:query",KNEX_QUERY_BUILDER:"orchestrion:knex:queryBuilder",KNEX_SCHEMA_BUILDER:"orchestrion:knex:schemaBuilder",KNEX_RAW:"orchestrion:knex:raw"},MG=fe($T);var zT=[{channelName:"use",module:{name:"koa",versionRange:">=2.0.0 <4",filePath:"lib/application.js"},functionQuery:{className:"Application",methodName:"use",kind:"Sync"}}],wG={KOA_USE:"orchestrion:koa:use"},GG=fe(zT);var DJ=["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"}}]}),eI="embedQuery",Bf="embedDocuments",UG=[{name:"@langchain/openai",versionRange:">=0.1.0 <2.0.0",methods:[eI,Bf]},{name:"@langchain/google-genai",versionRange:">=0.1.0 <3.0.0",methods:[eI,Bf]},{name:"@langchain/mistralai",versionRange:">=0.1.0 <2.0.0",methods:[eI,Bf]},{name:"@langchain/google-common",versionRange:">=0.1.0 <3.0.0",methods:[Bf]}],BJ=UG.flatMap(({name:e,versionRange:t,methods:n})=>["dist/embeddings.cjs","dist/embeddings.js"].flatMap(r=>n.map(i=>({channelName:i,module:{name:e,versionRange:t,filePath:r},functionQuery:{methodName:i,kind:"Async"}})))),tI=[...DJ,...BJ],DG=UG.flatMap(({name:e,methods:t})=>t.map(n=>`orchestrion:${e}:${n}`)),BG={LANGCHAIN_CHAT_MODEL_INVOKE:"orchestrion:@langchain/core:chatModelInvoke",LANGCHAIN_CHAT_MODEL_STREAM:"orchestrion:@langchain/core:chatModelStream"},HG=fe(tI);var FG=e=>({name:"@langchain/langgraph",versionRange:">=0.0.0 <2.0.0",filePath:e}),HJ=["dist/graph/state.cjs","dist/graph/state.js"].map(e=>({channelName:"stateGraphCompile",module:FG(e),functionQuery:{className:"StateGraph",methodName:"compile",kind:"Sync"}})),FJ=["dist/prebuilt/react_agent_executor.cjs","dist/prebuilt/react_agent_executor.js"].map(e=>({channelName:"createReactAgent",module:FG(e),functionQuery:{functionName:"createReactAgent",kind:"Sync"}})),nI=[...HJ,...FJ],WG={LANGGRAPH_STATE_GRAPH_COMPILE:"orchestrion:@langchain/langgraph:stateGraphCompile",LANGGRAPH_CREATE_REACT_AGENT:"orchestrion:@langchain/langgraph:createReactAgent"},VG=fe(nI);var rI=[{channelName:"load",module:{name:"lru-memoizer",versionRange:">=2.1.0 <4",filePath:"lib/async.js"},functionQuery:{functionName:"memoizedFunction",kind:"Callback"}}],YG={LRU_MEMOIZER_LOAD:"orchestrion:lru-memoizer:load"},jG=fe(rI);var Ss={name:"mongodb"},iI=[{channelName:"command",module:{...Ss,versionRange:">=6.4.0 <8",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Async"}},{channelName:"command",module:{...Ss,versionRange:">=4.0.0 <6.4",filePath:"lib/cmap/connection.js"},functionQuery:{methodName:"command",kind:"Callback"}},{channelName:"checkout",module:{...Ss,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:{...Ss,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/index.js"},functionQuery:{expressionName:e,kind:"Callback"}})),{channelName:"v3_command",module:{...Ss,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/command.js"},functionQuery:{functionName:"command",kind:"Callback"}},{channelName:"v3_query",module:{...Ss,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/query.js"},functionQuery:{functionName:"query",kind:"Callback"}},{channelName:"v3_get_more",module:{...Ss,versionRange:">=3.3.0 <4",filePath:"lib/core/wireprotocol/get_more.js"},functionQuery:{functionName:"getMore",kind:"Callback"}}],ZG={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"},XG=fe(iI);var ho={name:"mongoose",versionRange:">=5.9.7 <9.7.0"},KG=["find","findOne","deleteOne","deleteMany","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace","remove","count","findOneAndRemove"],oI=[{channelName:"query_exec",module:{...ho,filePath:"lib/query.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"aggregate_exec",module:{...ho,filePath:"lib/aggregate.js"},functionQuery:{expressionName:"exec",kind:"Auto"}},{channelName:"model_save",module:{...ho,filePath:"lib/model.js"},functionQuery:{expressionName:"save",kind:"Auto"}},{channelName:"model_insert_many",module:{...ho,filePath:"lib/model.js"},functionQuery:{expressionName:"insertMany",kind:"Auto"}},{channelName:"model_bulk_write",module:{...ho,filePath:"lib/model.js"},functionQuery:{expressionName:"bulkWrite",kind:"Auto"}},{channelName:"model_remove",module:{...ho,filePath:"lib/model.js"},functionQuery:{expressionName:"remove",kind:"Auto"}},{channelName:"model_aggregate",module:{...ho,filePath:"lib/model.js"},functionQuery:{expressionName:"aggregate",kind:"Sync"}},...KG.map(e=>({channelName:`ctx_${e}`,module:{...ho,filePath:"lib/query.js"},functionQuery:{expressionName:e,kind:"Sync"}}))],qG={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"},QG=KG.map(e=>`orchestrion:mongoose:ctx_${e}`),JG=fe(oI);var sI=[{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"}}],$G={MYSQL2_QUERY:"orchestrion:mysql2:query",MYSQL2_EXECUTE:"orchestrion:mysql2:execute"},zG=fe(sI);var aI=[{channelName:"query",module:{name:"mysql",versionRange:">=2.0.0 <3",filePath:"lib/Connection.js"},functionQuery:{expressionName:"query",kind:"Auto"}}],eU={MYSQL_QUERY:"orchestrion:mysql:query"},tU=fe(aI);var cI=[{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"}}],nU={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"},rU=fe(cI);var lI=[...["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"},oU=fe(lI);var pI=[{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"}}],sU={PG_QUERY:"orchestrion:pg:query",PG_CONNECT:"orchestrion:pg:connect",PGPOOL_CONNECT:"orchestrion:pg-pool:connect"},aU=fe(pI);var WJ=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"}}],uI=["src","cjs/src"].flatMap(WJ),cU={POSTGRESJS_HANDLE:"orchestrion:postgres:handle",POSTGRESJS_CONNECTION:"orchestrion:postgres:connection",POSTGRESJS_EXECUTE:"orchestrion:postgres:execute",POSTGRESJS_CONNECT:"orchestrion:postgres:connect"},lU=fe(uI);var dI=[{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"}}],pU={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"},uU=fe(dI);var VJ=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"}}],mI=["dist","dist/esm"].flatMap(VJ),dU={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"},mU=fe(mI);var YJ="tedious",jJ="lib/connection.js",ZJ=">=1.11.0 <20",XJ=["connect","execSql","execSqlBatch","callProcedure","execBulkLoad","prepare","execute"],fI=XJ.map(e=>({channelName:e,module:{name:YJ,versionRange:ZJ,filePath:jJ},functionQuery:{className:"Connection",methodName:e,kind:"Sync"}})),fU={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"},gU=fe(fI);var gI=[...Es(">=4.0.0 <7.0.0","generateText","generateText","Async"),...Es(">=4.0.0 <7.0.0","streamText","streamText","Sync"),...Es(">=4.0.0 <7.0.0","generateObject","generateObject","Async"),...Es(">=4.0.0 <7.0.0","embed","embed","Async"),...Es(">=4.0.0 <7.0.0","embedMany","embedMany","Async"),...Es(">=5.0.0 <7.0.0","resolveLanguageModel","resolveLanguageModel","Sync"),...Es(">=6.0.0 <7.0.0","executeToolCall","executeToolCall","Async")],_U={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 Es(e,t,n,r){return["dist/index.js","dist/index.mjs"].map(i=>({channelName:t,module:{name:"ai",versionRange:e,filePath:i},functionQuery:{functionName:n,kind:r}}))}var hU=fe(gI);var A={...cG,...pG,...dG,...fG,..._G,...bG,...SG,...TG,...AG,...vG,...OG,...xG,...LG,...wG,...BG,...WG,...YG,...ZG,...qG,...$G,...eU,...nU,...iU,...sU,...cU,...pU,...dU,...fU,..._U};var KJ="Amqplib",qJ="auto.amqplib.orchestrion.publisher",QJ="auto.amqplib.orchestrion.consumer",JJ="messaging.operation",vU="messaging.destination",RU="messaging.destination_kind",OU="messaging.rabbitmq.routing_key",bU="messaging.protocol",$J="messaging.protocol_version",zJ="messaging.url",CU="messaging.message_id",xU="messaging.conversation_id",PU="messaging.rabbitmq.destination.routing_key",kU="messaging.message.conversation_id",LU="topic",yU="process",e$="send",MU=1e3*60,Xn={Ack:"ack",AckAll:"ackAll",Reject:"reject",Nack:"nack",NackAll:"nackAll",ChannelClosed:"channel closed",ChannelError:"channel error",InstrumentationTimeout:"instrumentation timeout"},hI=Symbol("sentry.amqplib.message.stored-span"),Ts=Symbol("sentry.amqplib.channel.spans-not-ended"),bI=Symbol("sentry.amqplib.channel.consume-timeout-timer"),SI=Symbol("sentry.amqplib.channel.consumer-info"),yI=Symbol("sentry.amqplib.channel.is-confirm-publishing"),wU=Symbol("sentry.amqplib.connection.attributes"),GU=()=>{},SU=!1,t$=(()=>({name:KJ,setupOnce(){!Zn.tracingChannel||SU||(SU=!0,$&&g.log("[orchestrion:amqplib] subscribing to amqplib tracing channels"),ue(()=>{a$(),n$(),r$(),i$(),o$(),s$()}))}}));function n$(){ee(Zn.tracingChannel(A.AMQPLIB_PUBLISH),e=>{if(!e.self?.[yI])return DU(e)})}function r$(){let e=Zn.tracingChannel(A.AMQPLIB_CONFIRM_PUBLISH);ee(e,t=>(t.self&&(t.self[yI]=!0),DU(t))),e.end.subscribe(t=>{let n=t.self;n&&(n[yI]=!1)})}function i$(){let e=Zn.tracingChannel(A.AMQPLIB_CONSUME);e.start.subscribe(GU),e.asyncEnd.subscribe(t=>{let n=t,r=n.self,o=n.result?.consumerTag;if(!r||!o)return;UU(r);let s=n.arguments[0],c=typeof s=="string"?s:"<unknown>",a=n.arguments[2];r[SI]?.set(o,{noAck:!!a?.noAck,queue:c})})}function o$(){ee(Zn.tracingChannel(A.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;UU(t);let i=n?.consumerTag?t[SI]?.get(n.consumerTag):void 0,o=i?.queue??r.fields?.routingKey??"<unknown>",s=i?.noAck??!1,c=r.properties?.headers,a=NU(c,"sentry-trace"),l=NU(c,"baggage"),p=An({sentryTrace:a,baggage:l},()=>l$(o,r,t));return s||(t[Ts]?.push({msg:r,timeOfConsume:lt()}),r[hI]=p),e._sentryNoAck=s,p},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function s$(){Zn.tracingChannel(A.AMQPLIB_ACK).start.subscribe(e=>_I(e,!1,Xn.Ack)),Zn.tracingChannel(A.AMQPLIB_NACK).start.subscribe(e=>_I(e,!0,Xn.Nack)),Zn.tracingChannel(A.AMQPLIB_REJECT).start.subscribe(e=>_I(e,!0,Xn.Reject)),Zn.tracingChannel(A.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&Hf(t.self,!1,Xn.AckAll,void 0)}),Zn.tracingChannel(A.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&Hf(t.self,!0,Xn.NackAll,t.arguments[0])})}function a$(){let e=Zn.tracingChannel(A.AMQPLIB_CONNECT);e.start.subscribe(GU),e.asyncEnd.subscribe(t=>{let n=t,r=n.result;!r||typeof r!="object"||(r[wU]={...u$(n.arguments?.[0]),...p$(r)})})}function _I(e,t,n){let r=e.self;if(!r)return;let i=e.arguments[0];if(!i)return;let o=e.arguments[1],s=e.arguments[2],c=n===Xn.Reject?o:s,a=r[Ts]??[],l=a.findIndex(p=>p.msg===i);if(l<0)Ip(i,t,n,c);else if(n!==Xn.Reject&&o){for(let p=0;p<=l;p++)Ip(a[p].msg,t,n,c);a.splice(0,l+1)}else Ip(i,t,n,c),a.splice(l,1)}function UU(e){if(Object.prototype.hasOwnProperty.call(e,Ts))return;e[Ts]=[],e[SI]=new Map;let t=setInterval(()=>c$(e),MU);t.unref?.(),e[bI]=t,typeof e.on=="function"&&(e.on("close",()=>{Hf(e,!0,Xn.ChannelClosed,void 0),EU(e)}),e.on("error",()=>{Hf(e,!0,Xn.ChannelError,void 0),EU(e)}))}function EU(e){let t=e[bI];t&&(clearInterval(t),e[bI]=void 0)}function c$(e){let t=lt(),n=e[Ts]??[],r;for(r=0;r<n.length;r++){let i=n[r];if((t-i.timeOfConsume)*1e3<MU)break;Ip(i.msg,null,Xn.InstrumentationTimeout,!0)}n.splice(0,r)}function Hf(e,t,n,r){(e[Ts]??[]).forEach(o=>{Ip(o.msg,t,n,r)}),e[Ts]=[]}function Ip(e,t,n,r){let i=e[hI];i&&(t!==!1&&i.setStatus({code:2,message:n!==Xn.ChannelClosed&&n!==Xn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),i.end(),e[hI]=void 0)}function DU(e){let t=e.arguments[0],n=e.arguments[1],r=typeof t=="string"?t:"",i=typeof n=="string"?n:"",o=e.arguments[3],s=k({name:`publish ${d$(r)}`,op:"message",kind:U.PRODUCER,attributes:{...BU(e.self),[vU]:r,[Rn]:r,[RU]:LU,[OU]:i,[PU]:i,[cr]:e$,[CU]:o?.messageId,[ta]:o?.messageId,[xU]:o?.correlationId,[kU]:o?.correlationId,[S]:qJ}});(!o||typeof o!="object")&&(o={},e.arguments[3]=o);let c=o.headers&&typeof o.headers=="object"?o.headers:o.headers={},a=$e({span:s});return a["sentry-trace"]&&(c["sentry-trace"]=a["sentry-trace"]),a.baggage&&(c.baggage=a.baggage),s}function l$(e,t,n){return k({name:`${e} process`,op:"message",kind:U.CONSUMER,attributes:{...BU(n),[vU]:t.fields?.exchange,[Rn]:t.fields?.exchange,[RU]:LU,[OU]:t.fields?.routingKey,[PU]:t.fields?.routingKey,[JJ]:yU,[cr]:yU,[CU]:t.properties?.messageId,[ta]:t.properties?.messageId,[xU]:t.properties?.correlationId,[kU]:t.properties?.correlationId,[S]:QJ}})}function BU(e){let t=e?.connection,n=t?.[wU];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r=="string"&&r?{[wt]:r.toLowerCase()}:{}}function p$(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t=="string"&&t?{[wt]:t.toLowerCase()}:{}}function u$(e){let t={[$J]:"0.9.1",[r0]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,i=IU(r.protocol),o=AU(r.hostname),s=TU(r.port,i);t[bU]=i,t[Rh]=i,t[_t]=o,t[ht]=s,t[Le]=o,t[xe]=s}else if(typeof n=="string"){let r=m$(n);t[zJ]=r,t[pt]=r;try{let i=new URL(r),o=IU(i.protocol),s=AU(i.hostname),c=TU(i.port?parseInt(i.port,10):void 0,o);t[bU]=o,t[Rh]=o,t[_t]=s,t[ht]=c,t[Le]=s,t[xe]=c}catch{}}return t}function d$(e){return e!==""?e:"<default>"}function m$(e){return e.replace(/:[^:@/]*@/,":***@")}function TU(e,t){return e||(t==="AMQP"?5672:5671)}function IU(e){let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()}function AU(e){return e||"localhost"}function NU(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}var HU=t$;import*as EI from"diagnostics_channel";var WU="Anthropic_AI",f$="auto.ai.orchestrion.anthropic",g$=[{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"}],FU=!1,_$=((e={})=>({name:WU,setupOnce(){!EI.tracingChannel||FU||(FU=!0,ue(()=>{for(let{channel:t,operation:n,methodPath:r,stream:i}of g$)$&&g.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),ee(EI.tracingChannel(t),o=>h$(o,n,r,e),{beforeSpanEnd:(o,s)=>{gd(o,s.result,Ze(e).recordOutputs)},deferSpanEnd:({span:o,data:s})=>S$(o,s,i,e)})}))}}));function h$(e,t,n,r){let i=e.arguments??[];if(Cn(WU)||i[1]?.headers?.["X-Stainless-Helper-Method"]==="stream")return;let s=typeof i[0]=="object"&&i[0]!==null?i[0]:void 0,{recordInputs:c}=Ze(r),a=ze(r.enableTruncation),l=fd(i,n,t),p=l[De]||"unknown";l[S]=f$;let u=k({name:`${t} ${p}`,op:`gen_ai.${t}`,attributes:l});return c&&s&&Ea(u,s,a),u}function b$(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function y$(e){return!!e&&typeof e.on=="function"}function S$(e,t,n,r){let{recordOutputs:i}=Ze(r),o=t.result;if(n==="async-iterable"&&b$(o)){let s=o[Symbol.asyncIterator].bind(o),c=gl({[Symbol.asyncIterator]:s},e,i);return o[Symbol.asyncIterator]=()=>c,!0}return n==="message-stream"&&y$(o)?(_l(o,e,i),!0):!1}var VU=_$;import*as OI from"diagnostics_channel";var YU="auto.aws.orchestrion.aws_sdk",jU="dynamodb",ZU="messaging.destination_kind",XU="topic",TI="chat",II="aws.bedrock";var E$=new TextDecoder,Ff=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=TI,i={[jc]:II,[Tu]:TI},o=t.commandInput.modelId;o&&(i[Yc]=o,r&&(r+=` ${o}`));let s=t.commandInput.inferenceConfig;if(s){let{maxTokens:c,temperature:a,topP:l,stopSequences:p}=s;c!==void 0&&(i[gi]=c),a!==void 0&&(i[_i]=a),l!==void 0&&(i[hi]=l),p!==void 0&&(i[ji]=p)}return{spanName:r,isStream:n,spanAttributes:i}}_requestPreSpanHookInvokeModel(t,n){let r={[jc]:II},i=t.commandInput?.modelId;if(i&&(r[Yc]=i),t.commandInput?.body){let o=JSON.parse(t.commandInput.body);i.includes("amazon.titan")?(o.textGenerationConfig?.temperature!==void 0&&(r[_i]=o.textGenerationConfig.temperature),o.textGenerationConfig?.topP!==void 0&&(r[hi]=o.textGenerationConfig.topP),o.textGenerationConfig?.maxTokenCount!==void 0&&(r[gi]=o.textGenerationConfig.maxTokenCount),o.textGenerationConfig?.stopSequences!==void 0&&(r[ji]=o.textGenerationConfig.stopSequences)):i.includes("amazon.nova")?(o.inferenceConfig?.temperature!==void 0&&(r[_i]=o.inferenceConfig.temperature),o.inferenceConfig?.top_p!==void 0&&(r[hi]=o.inferenceConfig.top_p),o.inferenceConfig?.max_new_tokens!==void 0&&(r[gi]=o.inferenceConfig.max_new_tokens),o.inferenceConfig?.stopSequences!==void 0&&(r[ji]=o.inferenceConfig.stopSequences)):i.includes("anthropic.claude")?(o.max_tokens!==void 0&&(r[gi]=o.max_tokens),o.temperature!==void 0&&(r[_i]=o.temperature),o.top_p!==void 0&&(r[hi]=o.top_p),o.stop_sequences!==void 0&&(r[ji]=o.stop_sequences)):i.includes("meta.llama")?(o.max_gen_len!==void 0&&(r[gi]=o.max_gen_len),o.temperature!==void 0&&(r[_i]=o.temperature),o.top_p!==void 0&&(r[hi]=o.top_p)):i.includes("cohere.command-r")?(o.max_tokens!==void 0&&(r[gi]=o.max_tokens),o.temperature!==void 0&&(r[_i]=o.temperature),o.p!==void 0&&(r[hi]=o.p),o.message!==void 0&&(r[Jt]=Math.ceil(o.message.length/6)),o.stop_sequences!==void 0&&(r[ji]=o.stop_sequences)):i.includes("cohere.command")?(o.max_tokens!==void 0&&(r[gi]=o.max_tokens),o.temperature!==void 0&&(r[_i]=o.temperature),o.p!==void 0&&(r[hi]=o.p),o.prompt!==void 0&&(r[Jt]=Math.ceil(o.prompt.length/6)),o.stop_sequences!==void 0&&(r[ji]=o.stop_sequences)):i.includes("mistral")&&(o.prompt!==void 0&&(r[Jt]=Math.ceil(o.prompt.length/6)),o.max_tokens!==void 0&&(r[gi]=o.max_tokens),o.temperature!==void 0&&(r[_i]=o.temperature),o.top_p!==void 0&&(r[hi]=o.top_p),o.stop!==void 0&&(r[ji]=o.stop))}return{isStream:n,spanAttributes:r}}_responseHookConverse(t,n){let{stopReason:r,usage:i}=t.data;KU(n,r),qU(n,i)}_responseHookConverseStream(t,n){t.data.stream=I$(t.data.stream,n)}_responseHookInvokeModel(t,n){let r=t.request.commandInput?.modelId;if(t.data?.body){let i=E$.decode(t.data.body),o=JSON.parse(i);r.includes("amazon.titan")?(o.inputTextTokenCount!==void 0&&n.setAttribute(Jt,o.inputTextTokenCount),o.results?.[0]?.tokenCount!==void 0&&n.setAttribute(Tt,o.results[0].tokenCount),o.results?.[0]?.completionReason!==void 0&&n.setAttribute(Ot,[o.results[0].completionReason])):r.includes("amazon.nova")?(o.usage!==void 0&&(o.usage.inputTokens!==void 0&&n.setAttribute(Jt,o.usage.inputTokens),o.usage.outputTokens!==void 0&&n.setAttribute(Tt,o.usage.outputTokens)),o.stopReason!==void 0&&n.setAttribute(Ot,[o.stopReason])):r.includes("anthropic.claude")?(o.usage?.input_tokens!==void 0&&n.setAttribute(Jt,o.usage.input_tokens),o.usage?.output_tokens!==void 0&&n.setAttribute(Tt,o.usage.output_tokens),o.stop_reason!==void 0&&n.setAttribute(Ot,[o.stop_reason])):r.includes("meta.llama")?(o.prompt_token_count!==void 0&&n.setAttribute(Jt,o.prompt_token_count),o.generation_token_count!==void 0&&n.setAttribute(Tt,o.generation_token_count),o.stop_reason!==void 0&&n.setAttribute(Ot,[o.stop_reason])):r.includes("cohere.command-r")?(o.text!==void 0&&n.setAttribute(Tt,Math.ceil(o.text.length/6)),o.finish_reason!==void 0&&n.setAttribute(Ot,[o.finish_reason])):r.includes("cohere.command")?(o.generations?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(o.generations[0].text.length/6)),o.generations?.[0]?.finish_reason!==void 0&&n.setAttribute(Ot,[o.generations[0].finish_reason])):r.includes("mistral")&&(o.outputs?.[0]?.text!==void 0&&n.setAttribute(Tt,Math.ceil(o.outputs[0].text.length/6)),o.outputs?.[0]?.stop_reason!==void 0&&n.setAttribute(Ot,[o.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(t,n){let r=t.data?.body,i=t.request.commandInput?.modelId;if(!r||!i)return;let o=T$(i);t.data.body=(async function*(){try{for await(let s of r){if(o){let c=A$(s?.chunk?.bytes);c&&o(c,n)}yield s}}finally{n.end()}})()}};function T$(e){if(e.includes("amazon.titan"))return R$;if(e.includes("anthropic.claude"))return v$;if(e.includes("amazon.nova"))return N$;if(e.includes("meta.llama"))return O$;if(e.includes("cohere.command-r"))return P$;if(e.includes("cohere.command"))return x$;if(e.includes("mistral"))return C$}async function*I$(e,t){try{let n;for await(let r of e)KU(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;qU(t,n)}finally{t.end()}}function KU(e,t){t!==void 0&&e.setAttribute(Ot,[t])}function qU(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(Jt,n),r!==void 0&&e.setAttribute(Tt,r)}}function A$(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 N$(e,t){e.metadata?.usage!==void 0&&(e.metadata?.usage.inputTokens!==void 0&&t.setAttribute(Jt,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(Tt,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(Ot,[e.messageStop.stopReason])}function v$(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(Jt,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(Ot,[e.delta.stop_reason])}function R$(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(Jt,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(Tt,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(Ot,[e.completionReason])}function O$(e,t){e.prompt_token_count!==void 0&&t.setAttribute(Jt,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(Tt,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(Ot,[e.stop_reason])}function C$(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(Ot,[e.outputs[0].stop_reason])}function x$(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(Ot,[e.generations[0].finish_reason])}function P$(e,t){e.text!==void 0&&t.setAttribute(Tt,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(Ot,[e.finish_reason])}function oc(e){return Array.isArray(e)?e:[e]}var Wf=class{requestPreSpanHook(t){let n=t.commandName,r=t.commandInput?.TableName,i={};return i[Pe]=jU,i[Et]=r,i[Js]=n,t.commandInput?.TableName?i[Eh]=[t.commandInput.TableName]:t.commandInput?.RequestItems&&(i[Eh]=Object.keys(t.commandInput.RequestItems)),(n==="CreateTable"||n==="UpdateTable")&&t.commandInput?.ProvisionedThroughput&&(i[SR]=t.commandInput.ProvisionedThroughput.ReadCapacityUnits,i[ER]=t.commandInput.ProvisionedThroughput.WriteCapacityUnits),(n==="GetItem"||n==="Scan"||n==="Query")&&t.commandInput?.ConsistentRead&&(i[pR]=t.commandInput.ConsistentRead),(n==="Query"||n==="Scan")&&t.commandInput?.ProjectionExpression&&(i[yR]=t.commandInput.ProjectionExpression),n==="CreateTable"&&(t.commandInput?.GlobalSecondaryIndexes&&(i[fR]=oc(t.commandInput.GlobalSecondaryIndexes).map(o=>JSON.stringify(o))),t.commandInput?.LocalSecondaryIndexes&&(i[bR]=oc(t.commandInput.LocalSecondaryIndexes).map(o=>JSON.stringify(o)))),(n==="ListTables"||n==="Query"||n==="Scan")&&t.commandInput?.Limit&&(i[hR]=t.commandInput.Limit),n==="ListTables"&&t.commandInput?.ExclusiveStartTableName&&(i[mR]=t.commandInput.ExclusiveStartTableName),n==="Query"&&(t.commandInput?.ScanIndexForward&&(i[IR]=t.commandInput.ScanIndexForward),t.commandInput?.IndexName&&(i[yh]=t.commandInput.IndexName),t.commandInput?.Select&&(i[Sh]=t.commandInput.Select)),n==="Scan"&&(t.commandInput?.Segment&&(i[AR]=t.commandInput?.Segment),t.commandInput?.TotalSegments&&(i[vR]=t.commandInput?.TotalSegments),t.commandInput?.IndexName&&(i[yh]=t.commandInput.IndexName),t.commandInput?.Select&&(i[Sh]=t.commandInput.Select)),n==="UpdateTable"&&(t.commandInput?.AttributeDefinitions&&(i[lR]=oc(t.commandInput.AttributeDefinitions).map(o=>JSON.stringify(o))),t.commandInput?.GlobalSecondaryIndexUpdates&&(i[gR]=oc(t.commandInput.GlobalSecondaryIndexUpdates).map(o=>JSON.stringify(o)))),{spanAttributes:i,spanKind:U.CLIENT,spanOp:"db"}}responseHook(t,n){t.data?.ConsumedCapacity&&n.setAttribute(uR,oc(t.data.ConsumedCapacity).map(r=>JSON.stringify(r))),t.data?.ItemCollectionMetrics&&n.setAttribute(_R,oc(t.data.ItemCollectionMetrics).map(r=>JSON.stringify(r))),t.data?.TableNames&&n.setAttribute(NR,t.data?.TableNames.length),t.data?.Count&&n.setAttribute(dR,t.data?.Count),t.data?.ScannedCount&&n.setAttribute(TR,t.data?.ScannedCount)}};var Vf=class{requestPreSpanHook(t){let n=t.commandInput?.StreamName,r={};return n&&(r[RR]=n),{spanAttributes:r,spanKind:U.CLIENT}}};var Yf="Invoke",jf=class{requestPreSpanHook(t){let n=t.commandInput?.FunctionName,r={},i;return t.commandName===Yf&&(r[MR]=n,r[wR]="aws",i=`${n} ${Yf}`),{spanAttributes:r,spanKind:U.CLIENT,spanName:i}}requestPostSpanHook(t,n){t.commandName===Yf&&t.commandInput&&(t.commandInput.ClientContext=k$(t.commandInput.ClientContext,n))}responseHook(t,n){t.request.commandName===Yf&&(n.setAttribute(LR,t.requestId),t.request.region&&n.setAttribute(GR,t.request.region))}};function k$(e,t){try{let n=$e({span:t}),r=e?JSON.parse(Buffer.from(e,"base64").toString("utf8")):{},i={...r,custom:{...r.custom,...n}},o=Buffer.from(JSON.stringify(i)).toString("base64");return o.length>3583?($&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations."),e):o}catch(n){return $&&g.log("[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext",n),e}}var Zf=class{requestPreSpanHook(t){let n=t.commandInput?.Bucket,r={};return n&&(r[xR]=n),{spanAttributes:r,spanKind:U.CLIENT}}};var Xf=class{requestPreSpanHook(t){let n=t.commandInput?.SecretId,r={};return typeof n=="string"&&n.startsWith("arn:aws:secretsmanager:")&&(r[Th]=n),{spanAttributes:r,spanKind:U.CLIENT}}responseHook(t,n){let r=t.data?.ARN;r&&n.setAttribute(Th,r)}};var L$=10,AI="sentry-trace",NI="baggage",M$=[AI,NI];function Ap(e,t){let n=e??{},r=Object.keys(t);if(Object.keys(n).length+r.length<=L$)for(let i of r){let o=t[i];o&&(n[i]={DataType:"String",StringValue:o})}else $&&g.warn("[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes");return n}function QU(e){let t=e.MessageAttributes??{},n=t[AI]?.StringValue??t[AI]?.Value;if(n)return{sentryTrace:n,baggage:t[NI]?.StringValue??t[NI]?.Value}}function JU(e=[]){return nl([...e,...M$])}var Kf=class{requestPreSpanHook(t){let n=U.CLIENT,r=`SNS ${t.commandName}`,i={[wt]:"aws.sns"};if(t.commandName==="Publish"){n=U.PRODUCER,i[ZU]=XU;let{TopicArn:s,TargetArn:c,PhoneNumber:a}=t.commandInput,l=w$(s,c,a);i[e0]=l,i[Rn]=s||c||a||"unknown",r=`${a?"phone_number":l} send`}let o=t.commandInput?.TopicArn;return o&&(i[Ih]=o),{spanAttributes:i,spanKind:n,spanName:r}}requestPostSpanHook(t,n){if(t.commandName==="Publish"){let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=Ap(r,$e({span:n}))}}responseHook(t,n){let r=t.data?.TopicArn;r&&n.setAttribute(Ih,r)}};function w$(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 qf=class{requestPreSpanHook(t){let n=U$(t.commandInput),r=D$(n),i=U.CLIENT,o,s={[wt]:"aws_sqs",[Rn]:r,[pt]:n};switch(t.commandName){case"ReceiveMessage":i=U.CONSUMER,o=`${r} receive`,s[cr]="receive",t.commandInput.MessageAttributeNames=JU(t.commandInput.MessageAttributeNames);break;case"SendMessage":case"SendMessageBatch":i=U.PRODUCER,o=`${r} send`;break}return{spanAttributes:s,spanKind:i,spanName:o}}requestPostSpanHook(t,n){switch(t.commandName){case"SendMessage":{let r=t.commandInput.MessageAttributes??{};t.commandInput.MessageAttributes=Ap(r,$e({span:n}))}break;case"SendMessageBatch":{let r=t.commandInput?.Entries;if(Array.isArray(r)){let i=$e({span:n});r.forEach(o=>{o.MessageAttributes=Ap(o.MessageAttributes??{},i)})}}break}}responseHook(t,n){switch(t.request.commandName){case"SendMessage":n.setAttribute(ta,t?.data?.MessageId);break;case"SendMessageBatch":break;case"ReceiveMessage":{let r=t?.data?.Messages||[];n.setAttribute(ea,r.length);for(let i of r)G$(n,i);break}}}};function G$(e,t){let n=QU(t);if(!n)return;let{parentSpanId:r,traceId:i,sampled:o}=In(n.sentryTrace,n.baggage);i&&r&&e.addLink({context:{traceId:i,spanId:r,traceFlags:o?1:0},attributes:{[ta]:t.MessageId}})}function U$(e){return e?.QueueUrl}function D$(e){if(!e)return;let t=e.split("/");if(t.length!==0)return t[t.length-1]}var Qf=class{requestPreSpanHook(t){let n=t.commandInput?.stateMachineArn,r=t.commandInput?.activityArn,i={};return n&&(i[kR]=n),r&&(i[PR]=r),{spanAttributes:i,spanKind:U.CLIENT}}};var Jf=class{constructor(){this._services=new Map([["SecretsManager",new Xf],["SFN",new Qf],["SQS",new qf],["SNS",new Kf],["DynamoDB",new Wf],["Lambda",new jf],["S3",new Zf],["Kinesis",new Vf],["BedrockRuntime",new Ff]])}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 vI(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function $U(e,t,n,r){return{serviceName:e?.replace(/\s+/g,""),commandName:vI(t,"Command"),commandInput:n,region:r}}function zU(e){return{[p0]:"aws-api",[l0]:e.commandName,[Ru]:e.serviceName,[yu]:e.region}}var B$="Aws";function RI(e){try{return e()}catch(t){$&&g.warn("[orchestrion:aws-sdk] error building span",t);return}}function eD(e,t){t&&(t.requestId&&e.setAttribute(CR,t.requestId),t.httpStatusCode&&e.setAttribute(bi,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(OR,t.extendedRequestId))}var H$=(()=>{let e=new Jf;return{name:B$,setupOnce(){if(!OI.tracingChannel)return;let t=i=>RI(()=>{let o=i.arguments[0],s=o?.constructor?.name;if(!o||!s)return;let c=i.self?.config,a=c?.serviceId??vI(i.self?.constructor?.name||"AWS","Client");o.input||(o.input={});let l=$U(a,s,o.input,void 0),p=e.requestPreSpanHook(l),u=k({name:p.spanName??`${l.serviceName}.${l.commandName}`,kind:p.spanKind??U.CLIENT,op:p.spanOp||"rpc",attributes:{[S]:YU,...zU(l),...p.spanAttributes}});i._sentryNormalizedRequest=l,i._sentryRequestMetadata=p;let d;try{d=c?.region?.()}catch{}let m={settled:!1,promise:Promise.resolve(d).then(_=>{_&&(l.region=_,u.setAttribute(yu,_))}).catch(()=>{}).finally(()=>{m.settled=!0})};return i._sentryRegion=m,RI(()=>e.requestPostSpanHook(l,u)),u}),n={deferSpanEnd({span:i,data:o,end:s}){let c=o._sentryNormalizedRequest,a=o._sentryRequestMetadata;if(!c)return!1;let l="error"in o;if(RI(()=>{if(l){let m=o.error,_=m?.$metadata;eD(i,{requestId:m?.RequestId??_?.requestId,httpStatusCode:_?.httpStatusCode,extendedRequestId:m?.extendedRequestId??_?.extendedRequestId});return}let u=o.result;eD(i,u?.$metadata);let d={data:u,request:c,requestId:u?.$metadata?.requestId};e.responseHook(d,i)}),a?.isStream&&!l)return!0;let p=o._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 i of r)ee(OI.tracingChannel(i),t,n)})}}}),tD=H$;import*as Np from"diagnostics_channel";var F$="Dataloader",nD="dataloader",W$="auto.db.orchestrion.dataloader",V$="cache.get",rD=Symbol("sentry.dataloader.wrapped");function Y$(e,t){let n=e?.name;return n?`${nD}.${t} ${n}`:`${nD}.${t}`}function j$(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:Y$(e,t),kind:t==="batch"?void 0:U.CLIENT,op:r?V$:void 0,onlyIfParent:!0,attributes:{[S]:W$,[qs]:r?j$(n):void 0}}}var Z$=(()=>({name:F$,setupOnce(){Np.tracingChannel&&($&&g.log("[orchestrion:dataloader] subscribing to dataloader tracing channels"),ue(()=>{X$(),K$(),$f(A.DATALOADER_LOAD_MANY,"loadMany"),$f(A.DATALOADER_PRIME,"prime"),$f(A.DATALOADER_CLEAR,"clear"),$f(A.DATALOADER_CLEAR_ALL,"clearAll")}))}}));function X$(){Np.tracingChannel(A.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!="function"||n[rD])return;let r=n,i=function(...o){return Se({...iD(this,"batch",o[0]),links:this._batch?.spanLinks},()=>r.apply(this,o))};i[rD]=!0,t.arguments[0]=i})}function K$(){let e=Np.tracingChannel(A.DATALOADER_LOAD);ee(e,t=>oD(t.self,"load",t.arguments[0]),{requiresParentSpan:!0}),e.end.subscribe(t=>{let n=t,r=n._sentrySpan,i=n.self?._batch;r&&i&&r.isRecording()&&(i.spanLinks??(i.spanLinks=[])).push({context:r.spanContext()})})}function $f(e,t){ee(Np.tracingChannel(e),n=>oD(n.self,t,n.arguments[0]),{requiresParentSpan:!0})}function oD(e,t,n){return k(iD(e,t,n))}var CI=Z$;import*as xI from"diagnostics_channel";var q$="GenericPool",Q$=(()=>({name:q$,setupOnce(){xI.tracingChannel&&ue(()=>J$())}})),sD=Q$;function J$(){ee(xI.tracingChannel(A.GENERIC_POOL_ACQUIRE),()=>k({name:"generic-pool.acquire",attributes:{[S]:"auto.db.orchestrion.generic_pool"}}))}import*as PI from"diagnostics_channel";var lD="Google_GenAI",aD="auto.ai.orchestrion.google_genai",$$=[{channel:A.GOOGLE_GENAI_GENERATE_CONTENT,operation:"generate_content"},{channel:A.GOOGLE_GENAI_EMBED_CONTENT,operation:"embeddings"},{channel:A.GOOGLE_GENAI_CHAT,operation:"chat"}],cD=!1,z$=((e={})=>({name:lD,setupOnce(){!PI.tracingChannel||cD||(cD=!0,ue(()=>{for(let{channel:t,operation:n}of $$)$&&g.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),ee(PI.tracingChannel(t),r=>ez(r,n,e),{beforeSpanEnd:(r,i)=>{n!=="embeddings"&&bd(r,i.result,Ze(e).recordOutputs)},deferSpanEnd:({span:r,data:i})=>nz(r,i,e)})}))}}));function ez(e,t,n){if(Cn(lD))return;if(t!=="chat"){let p=Q();if(p){let{op:u,origin:d}=oe(p);if(d===aD&&u==="gen_ai.chat")return}}let i=(e.arguments??[])[0],{recordInputs:o}=Ze(n),s=ze(n.enableTruncation),c=hd(t,i,e.self),a=c[De]||"unknown";c[S]=aD;let l=k({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return o&&i&&bl(l,i,t,s),l}function tz(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function nz(e,t,n){let r=t.result;if(!tz(r))return!1;let{recordOutputs:i}=Ze(n),o=r[Symbol.asyncIterator].bind(r),s=hl({[Symbol.asyncIterator]:o},e,i??!1);return r[Symbol.asyncIterator]=()=>s,!0}var pD=z$;import*as Op from"diagnostics_channel";var zf="auto.graphql.diagnostic_channel",uD="graphql.parse",dD="graphql.validate",mD="graphql.execute",fD="graphql.resolve",gD="graphql.field.name",_D="graphql.field.path",hD="graphql.field.type",bD="graphql.parent.name",bo=Symbol.for("opentelemetry.graphql_data"),vp=Symbol.for("opentelemetry.patched");function rz(e){return typeof e?.then=="function"}function tg(e,t){if(!e||e[vp])return;e[vp]=!0;let n=e.getFields();Object.keys(n).forEach(r=>{let i=n[r];if(i&&(i.resolve&&(i.resolve=kI(t,i.resolve)),i.type))for(let o of SD(i.type))tg(o,t)})}function kI(e,t,n=!1){if(typeof t!="function"||t[vp])return t;function r(i,o,s,c){if(!t)return;let a=s??{};if(e().ignoreTrivialResolveSpans&&n&&(V(i)||typeof i=="function")&&typeof i[c.fieldName]!="function")return t.call(this,i,o,a,c);if(!a[bo])return t.call(this,i,o,a,c);let p=cz(c.path),{field:u,spanAdded:d}=iz(a,c,p),m=u.span;return se(m,()=>{try{let _=t.call(this,i,o,a,c);return rz(_)?_.then(h=>(eg(m,d),h),h=>{throw eg(m,d,h),h}):(eg(m,d),_)}catch(_){throw eg(m,d,_),_}})}return r[vp]=!0,r}function eg(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function iz(e,t,n){let r=yD(e,n);if(r)return{field:r,spanAdded:!1};let i={span:oz(t,n,az(e,n))};return sz(e,n,i),{field:i,spanAdded:!0}}function oz(e,t,n){let r={[S]:zf,[B]:Ci,[gD]:e.fieldName,[_D]:t.join("."),[hD]:e.returnType.toString(),[bD]:e.parentType.name};return k({name:`${fD} ${t.join(".")}`,attributes:r,parentSpan:n})}function sz(e,t,n){let r=e[bo];r&&(r.fields[t.join(".")]=n)}function yD(e,t){return e[bo]?.fields[t.join(".")]}function az(e,t){for(let n=t.length-1;n>0;n--){let r=yD(e,t.slice(0,n));if(r)return r.span}return e[bo]?.span}function cz(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function SD(e){return"ofType"in e&&e.ofType?SD(e.ofType):lz(e)?e.getTypes():pz(e)?[e]:[]}function lz(e){return"getTypes"in e&&typeof e.getTypes=="function"}function pz(e){return"getFields"in e&&typeof e.getFields=="function"}function ED(e,t){let n=e?.definitions;if(!n||!Array.isArray(n))return;let r=i=>!!i?.operation&&["query","mutation","subscription"].indexOf(i.operation)!==-1;return t?n.filter(r).find(i=>t===i?.name?.value):n.find(r)}var LI={[S]:zf,[B]:Ci};function TD(){return k({name:uD,attributes:{...LI}})}function ID(e){return k({name:dD,attributes:{...LI,[zs]:Ka(e)}})}function AD(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:"invalid_argument"})}function uz(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 ND(e,t,n,r){let i=uz(e),{schema:o,document:s}=i,{contextValue:c,fieldResolver:a}=i,l=!!c[bo];if(!n.ignoreResolveSpans&&!l){let _=a==null,h=t?.defaultFieldResolver,b=a??h;b&&(a=kI(r,b,_)),o&&(tg(o.getQueryType(),r),tg(o.getMutationType(),r))}let p=ED(s,i.operationName),u=p?.operation,d=p?.name?.value??i.operationName??void 0,m=k({name:jm(u,d||void 0,mD),attributes:{...LI,[Au]:u,[Iu]:d||void 0,[zs]:Ka(s)}});return n.useOperationNameForRootSpan&&u&&Ym(m,u,d||void 0),c[bo]={source:s,span:m,fields:{}},i.writeBack(c,a),m}function vD(e,t){Zm(t)&&e.setStatus({code:2,message:"internal_error"})}var RD="Graphql";function dz(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function Rp(e){try{return e()}catch(t){$&&g.warn("[orchestrion:graphql] error building span",t);return}}var mz=((e={})=>{let t=dz(e),n=()=>t;return{name:RD,setupOnce(){Op.tracingChannel&&ue(()=>{ee(Op.tracingChannel(A.GRAPHQL_PARSE),()=>Rp(()=>TD())),ee(Op.tracingChannel(A.GRAPHQL_VALIDATE),r=>Rp(()=>ID(r.arguments[1])),{beforeSpanEnd:(r,i)=>{Rp(()=>AD(r,i.result))}}),ee(Op.tracingChannel(A.GRAPHQL_EXECUTE),r=>Rp(()=>ND(r.arguments,r.self,t,n)),{beforeSpanEnd:(r,i)=>{Rp(()=>vD(r,i.result))}})})}}}),fz=mz,OD=e=>{let t=fz(e);return Ut(op(e),{name:RD,setupOnce:()=>t.setupOnce?.()})};import*as rg from"diagnostics_channel";var gz=["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"],sc=Symbol("hapi-handler-patched"),Cp={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"},CD=new Set(gz),br=(e=>(e.HAPI_TYPE="hapi.type",e.PLUGIN_NAME="hapi.plugin.name",e.EXT_TYPE="server.ext.type",e))(br||{});function _z(e){let t=Q();if(!t)return;let n=Re(t);n&&oe(n).data[B]==="http.server"&&n.setAttribute(He,e)}var MI=e=>typeof e=="string"&&CD.has(e),hz=e=>{let t=e?.type;return t!==void 0&&MI(t)},bz=e=>Array.isArray(e)&&e.length<=3&&MI(e[0])&&typeof e[1]=="function",yz=e=>!Array.isArray(e),Sz=(e,t)=>{let n={[He]:e.path,[Gr]:e.method},r;return t?(n[br.HAPI_TYPE]=Cp.PLUGIN,n[br.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[br.HAPI_TYPE]=Cp.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},Ez=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!=="method"&&(r=`ext - ${e} - ${n}`),t?{attributes:{[br.EXT_TYPE]:e,[br.HAPI_TYPE]:Cp.EXT,[br.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[br.EXT_TYPE]:e,[br.HAPI_TYPE]:Cp.EXT},name:r}};function PD(e,t){return Se({name:e.name,op:`${e.attributes[br.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[S]:"auto.http.orchestrion.hapi"}},t)}function xD(e,t){if(e[sc]===!0)return e;e[sc]=!0;let n=r=>function(...i){if(!Q())return r.call(this,...i);_z(e.path);let o=Sz(e,t);return PD(o,()=>r.call(this,...i))};if(typeof e.handler=="function")e.handler=n(e.handler);else if(typeof e.options=="function"){let r=e.options;e.options=function(i){let o=r(i);return typeof o.handler=="function"&&(o.handler=n(o.handler)),o}}else typeof e.options?.handler=="function"&&(e.options.handler=n(e.options.handler));return e}function ng(e,t,n){if(Array.isArray(e)){for(let r=0;r<e.length;r++)e[r]=ng(e[r],t);return e}else if(yz(e)){if(e[sc]===!0)return e;e[sc]=!0;let r=function(...i){if(!Q())return e.apply(this,i);let o=Ez(t,n,e.name);return PD(o,()=>e.apply(void 0,i))};return r[sc]=!0,r}return e}function kD(e,t){let n=e[0];if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=xD(n[r],t);else e[0]=xD(n,t)}function LD(e,t){if(Array.isArray(e[0])){let n=e[0];for(let r=0;r<n.length;r++){let i=n[r];if(MI(i.type)){let o=i,s=ng(o.method,i.type,t);o.method=s,n[r]=o}}return}else if(bz(e)){let n=e,r=n[1],i=ng(r,n[0],t);e[1]=i;return}else if(hz(e[0])){let n=e[0],r=ng(n.method,n.type,t);n.method=r}}var Tz="Hapi",Iz=(()=>({name:Tz,setupOnce(){rg.tracingChannel&&($&&g.log(`[orchestrion:hapi] subscribing to channels "${A.HAPI_ROUTE}" / "${A.HAPI_EXT}"`),rg.tracingChannel(A.HAPI_ROUTE).subscribe({start(e){let t=e;kD(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),rg.tracingChannel(A.HAPI_EXT).subscribe({start(e){let t=e;LD(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}})),MD=Iz;import*as wI from"diagnostics_channel";var Az="Koa",Nz="auto.http.orchestrion.koa",ig={ROUTER:"router",MIDDLEWARE:"middleware"},wD=Symbol("sentry.koa.layer-patched"),GD=!1,vz=((e={})=>{let t=e.ignoreLayersType??[];return{name:Az,setupOnce(){!wI.tracingChannel||GD||(GD=!0,$&&g.log(`[orchestrion:koa] subscribing to channel "${A.KOA_USE}"`),wI.tracingChannel(A.KOA_USE).subscribe({start(n){Rz(n,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function Rz(e,t){let n=e.arguments[0];typeof n=="function"&&(e.arguments[0]=Oz(n,t))}function Oz(e,t){return e.router?Cz(e,t):UD(e,!1,t)}function Cz(e,t){let r=e.router?.stack??[];for(let i of r){let o=i.path,s=i.stack;s.forEach((c,a)=>{s[a]=UD(c,!0,t,o)})}return e}function UD(e,t,n,r){let i=t?ig.ROUTER:ig.MIDDLEWARE;return e[wD]===!0||n.includes(i)||e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?e:(e[wD]=!0,(o,s)=>{if(!Q())return e(o,s);let c=xz(o,e,t,r);o._matchedRoute&&Pz(o._matchedRoute.toString());let a=c.attributes[vu],l=typeof a=="string"?a||"< unknown >":c.name;return Se({name:l,op:`${i}.koa`,attributes:{...c.attributes,[S]:Nz}},()=>{let p=c.attributes[He];if(J()===Rt())$&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");else if(p){let u=o.request?.method?.toUpperCase()||"GET";J().setTransactionName(`${u} ${p}`)}return e(o,s)})})}function xz(e,t,n,r){return n?{attributes:{[vu]:r?.toString(),[vh]:ig.ROUTER,[He]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[vu]:t.name||"middleware",[vh]:ig.MIDDLEWARE,[Su]:t.name||"middleware"},name:`middleware - ${t.name}`}}function Pz(e){let t=Q();if(!t)return;let n=Re(t);n&&oe(n).data[B]==="http.server"&&n.setAttribute(He,e)}var DD=vz;import*as og from"diagnostics_channel";var kz="IORedis",Lz="auto.db.orchestrion.redis",Mz="db.connection_string";function HD(e){return{host:e?.options?.host,port:e?.options?.port}}function FD(e,t){return{[Pe]:"redis",[Mz]:`redis://${e}:${t}`,[Le]:e,[xe]:t,[S]:Lz}}var BD=new WeakSet;function wz(e){let t=e.arguments?.[0];if(!t||typeof t!="object"||BD.has(t))return;BD.add(t);let{host:n,port:r}=HD(e.self),i=zr(t.name,t.args??[]);return k({name:i,op:"db",attributes:{...FD(n,r),[Ve]:i}})}var Gz=((e={})=>{let t=e.responseHook;return{name:kz,setupOnce(){if(!og.tracingChannel)return;$&&g.log(`[orchestrion:ioredis] subscribing to "${A.IOREDIS_COMMAND}"/"${A.IOREDIS_CONNECT}"`);let n=og.tracingChannel(A.IOREDIS_COMMAND),r=og.tracingChannel(A.IOREDIS_CONNECT);ue(()=>{ee(n,wz,{requiresParentSpan:!0,beforeSpanEnd(i,o){if("error"in o||!t)return;let s=o.arguments?.[0];s&&Uz(t,i,s,o.result)}}),ee(r,i=>{let{host:o,port:s}=HD(i.self);return k({name:"connect",op:"db",attributes:{...FD(o,s),[Ve]:"connect"}})},{requiresParentSpan:!0})})}}});function Uz(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var GI=Gz;import*as ag from"diagnostics_channel";var ac="messaging.destination.partition.id",UI="messaging.kafka.message.key",DI="messaging.kafka.message.tombstone",WD="messaging.kafka.offset",BI="process",xp="receive",VD="send",HI="kafka",YD="_OTHER";var Dz="auto.kafkajs.orchestrion.producer",Bz="auto.kafkajs.orchestrion.consumer",Hz=1,Fz=0;function Pp(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function jD(e){let t=Pp(e,"sentry-trace");if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=In(t,Pp(e,"baggage"));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?Hz:Fz}}]}function sg({topic:e,message:t,operationType:n,links:r,attributes:i}){let o=n===xp?"poll":n;return k({name:`${o} ${e}`,op:"message",kind:n===xp?U.CLIENT:U.CONSUMER,links:r,attributes:{...i,[wt]:HI,[Rn]:e,[cr]:n,[na]:o,[UI]:t?.key?String(t.key):void 0,[DI]:t?.key&&t.value===null?!0:void 0,[WD]:t?.offset,...t?{[S]:Bz}:{}}})}function ZD(e,t){let n=k({name:`send ${e}`,op:"message",kind:U.PRODUCER,attributes:{[wt]:HI,[Rn]:e,[UI]:t.key?String(t.key):void 0,[DI]:t.key&&t.value===null?!0:void 0,[ac]:t.partition!==void 0?String(t.partition):void 0,[na]:"send",[cr]:VD,[S]:Dz}});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 FI(e,t){let n,r=YD;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(i=>{i.setAttribute(wr,r),i.setStatus({code:2,message:n})})}function WI(e,t){return Promise.resolve(t).catch(n=>{throw FI(e,n),n}).finally(()=>{e.forEach(n=>n.end())})}var VI=Symbol("sentry-kafkajs-consumer-callback-wrapped");function YI(e){return typeof e=="function"&&e[VI]===!0}function XD(e){let t=function(r){let i=Pp(r.message.headers,"sentry-trace"),o=Pp(r.message.headers,"baggage");return An({sentryTrace:i,baggage:o},()=>{let s=sg({topic:r.topic,message:r.message,operationType:BI,attributes:{[ac]:String(r.partition)}}),c=se(s,()=>e.call(this,r));return WI([s],c)})};return t[VI]=!0,t}function KD(e){let t=function(r){let i=Nn(()=>sg({topic:r.batch.topic,message:void 0,operationType:xp,attributes:{[ea]:r.batch.messages.length,[ac]:String(r.batch.partition)}}));return se(i,()=>{let o=[i];r.batch.messages.forEach(c=>{o.push(sg({topic:r.batch.topic,message:c,operationType:BI,links:jD(c.headers),attributes:{[ac]:String(r.batch.partition)}}))});let s=e.call(this,r);return WI(o,s)})};return t[VI]=!0,t}var Wz="Kafka";function Vz(){let e=ag.tracingChannel(A.KAFKAJS_SEND_BATCH),t={start(n){let r=[];(n.arguments[0]?.topicMessages??[]).forEach(i=>{i.messages.forEach(o=>{r.push(ZD(i.topic,o))})}),n._sentrySpans=r},error(n){n._sentrySpans&&FI(n._sentrySpans,n.error)},asyncEnd(n){n._sentrySpans?.forEach(r=>r.end())}};e.subscribe(t)}function Yz(){let e=ag.tracingChannel(A.KAFKAJS_CONSUMER_RUN),t={start(n){let r=n.arguments[0];!r||typeof r!="object"||(typeof r.eachMessage=="function"&&!YI(r.eachMessage)&&(r.eachMessage=XD(r.eachMessage)),typeof r.eachBatch=="function"&&!YI(r.eachBatch)&&(r.eachBatch=KD(r.eachBatch)))}};e.subscribe(t)}var jz=(()=>({name:Wz,setupOnce(){ag.tracingChannel&&($&&g.log(`[orchestrion:kafkajs] subscribing to channels "${A.KAFKAJS_SEND_BATCH}", "${A.KAFKAJS_CONSUMER_RUN}"`),Vz(),Yz())}})),qD=jz;import*as cg from"diagnostics_channel";var Zz="Knex",Xz="auto.db.orchestrion.knex",Kz=1021,qz="db.sql.table",Qz="sqlite",Jz="postgresql",ZI=Symbol("sentry.orchestrion.knex.parent-span"),$z=(()=>({name:Zz,setupOnce(){cg.tracingChannel&&($&&g.log(`[orchestrion:knex] subscribing to channel "${A.KNEX_QUERY}"`),ue(()=>{jI(A.KNEX_QUERY_BUILDER),jI(A.KNEX_SCHEMA_BUILDER),jI(A.KNEX_RAW),zz()}))}}));function jI(e){cg.tracingChannel(e).end.subscribe(t=>{let n=t.result;if(!n||typeof n!="object"||ZI in n)return;let r=Q();r&&Object.defineProperty(n,ZI,{value:r})})}function zz(){ee(cg.tracingChannel(A.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[ZI]??Q();if(!r)return;let i=e.arguments[0],o=t?.client,s=o?.config?.connection,c=s?.connectionString,a=QD(n),l=i?.method,p=s?.filename||s?.database||i7(c),u={[S]:Xz,"knex.version":e.moduleVersion,[Pe]:n7(o?.driverName),[qz]:a,[Js]:l,[Mt]:s?.user,[Et]:p,[Le]:s?.host??o7(c),[xe]:s?.port??s7(c),[ra]:s?.filename===":memory:"?"inproc":void 0,[Ve]:i?.sql!=null?mn(i.sql,Kz):void 0};return k({name:r7(p,l,a)??"knex.query",kind:U.CLIENT,op:"db",parentSpan:r,attributes:u})},{beforeSpanEnd(e,t){if("error"in t){let n=e7(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function e7(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 o=t7(e.self)(r.sql,r.bindings||[]);return n.replace(`${o} - `,"")}catch{return n}}function t7(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 n7(e){return e==="sqlite3"?Qz:e==="pg"?Jz:e}function r7(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function QD(e){let t=e?._single?.table;return t&&typeof t=="object"?QD(t):typeof t=="string"?t:void 0}function i7(e){if(e)try{return new URL(e).pathname?.replace(/^\//,"")||void 0}catch{return}}function o7(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function s7(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var XI=$z;import*as lg from"diagnostics_channel";var a7=Ia,c7=[Yr,jr,Zr],JD=!1;function $D(){Ti(c7)}var l7=((e={})=>({name:a7,setupOnce(){if(!lg.tracingChannel||JD)return;JD=!0;let t=mr(e),n=r=>{$D();let i=r.arguments;if(!Array.isArray(i))return;let o=i[1];(!o||typeof o!="object"||Array.isArray(o))&&(o={},i[1]=o),o.callbacks=es(o.callbacks,t)};for(let r of[A.LANGCHAIN_CHAT_MODEL_INVOKE,A.LANGCHAIN_CHAT_MODEL_STREAM])$&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),lg.tracingChannel(r).start.subscribe(n);ue(()=>{for(let r of DG)$&&g.log(`[orchestrion:langchain] subscribing to channel "${r}"`),ee(lg.tracingChannel(r),i=>p7(i,e))})}}));function p7(e,t){$D();let n=(e.arguments??[])[0];return k(Ed(e.self,n,t))}var zD=l7;import*as ug from"diagnostics_channel";var u7=va,eB=!1,pg=!1,d7=((e={})=>({name:u7,setupOnce(){if(!ug.tracingChannel||eB)return;eB=!0;let t=Ze(e),n=mr(t);ue(()=>{$&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_STATE_GRAPH_COMPILE}"`),ee(ug.tracingChannel(A.LANGGRAPH_STATE_GRAPH_COMPILE),i=>{if(pg)return;let o=KI(i.arguments),s=typeof o?.name=="string"?o.name:void 0;return k(Ad(s))},{beforeSpanEnd:(i,o)=>{tB(o.result,KI(o.arguments)??{},t,null,n)}}),$&&g.log(`[orchestrion:langgraph] subscribing to channel "${A.LANGGRAPH_CREATE_REACT_AGENT}"`);let r=ug.tracingChannel(A.LANGGRAPH_CREATE_REACT_AGENT);r.start.subscribe(i=>{pg=!0;try{let{arguments:o}=i,s=KI(o);s&&Array.isArray(s.tools)&&s.tools.length>0&&Il(s.tools,t,Ra(o)??void 0)}catch(o){$&&g.error("[orchestrion:langgraph] failed to wrap createReactAgent tools",o)}}),r.end.subscribe(i=>{pg=!1;let{arguments:o,result:s}=i,c=Ra(o)??void 0;tB(s,c?{name:c}:{},t,Tl(o),n)}),r.error.subscribe(()=>{pg=!1})})}}));function KI(e){let t=(e??[])[0];return typeof t=="object"&&t!==null?t:void 0}function tB(e,t,n,r,i){if(!e||typeof e!="object")return;let o=e,s=o.invoke;typeof s=="function"&&(o.invoke=Al(s.bind(o),o,t,n,r,i))}var nB=d7;import*as qI from"diagnostics_channel";var m7="LruMemoizer",f7=(()=>({name:m7,setupOnce(){qI.tracingChannel&&($&&g.log(`[orchestrion:lru-memoizer] subscribing to channel "${A.LRU_MEMOIZER_LOAD}"`),ue(()=>{ee(qI.tracingChannel(A.LRU_MEMOIZER_LOAD),()=>{})}))}})),rB=f7;import*as kp from"diagnostics_channel";var g7="Mongo",iB="auto.db.orchestrion.mongo",_7=new Set(["insert","update","delete","find","getMore","killCursors"]),h7=(()=>({name:g7,setupOnce(){kp.tracingChannel&&ue(()=>{b7(),y7(),S7()})}}));function b7(){ee(kp.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 i=Object.keys(r)[0];return hr(sp(e.self,n,r,i,iB))},{requiresParentSpan:!0})}function y7(){ee(kp.tracingChannel(A.MONGODB_CHECKOUT),()=>{})}function S7(){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;dg(t,n=>({topology:n[0],ns:n[1],command:n[2]?.[0],operation:e}))}dg(A.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&_7.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?ap(t):void 0}}),dg(A.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:"find"})),dg(A.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:"getMore"}))}function dg(e,t){ee(kp.tracingChannel(e),n=>{let r=n.arguments;if(!r)return;let i=t(r);if(!(!i||typeof i.ns!="string"))return hr(cp(i.ns,i.topology,i.command,i.operation,iB))},{requiresParentSpan:!0})}var oB=h7;import*as Lp from"diagnostics_channel";var E7="Mongoose",T7="auto.db.orchestrion.mongoose",QI=new WeakMap,sB=!1,I7=(()=>({name:E7,setupOnce(){Lp.tracingChannel&&ue(()=>{Km(Lp.tracingChannel),A7()})}}));function A7(){if(!sB){sB=!0,$&&g.log("[orchestrion:mongoose] subscribing to injected channels");for(let e of QG)aB(e).subscribe({start(t){cB(t.self)}});aB(A.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t=="object"&&cB(t)}}),lc(A.MONGOOSE_QUERY_EXEC,e=>{let t=e;return cc(t.mongooseCollection,t.model?.modelName,t.op??"exec",QI.get(e))}),lc(A.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return cc(t?.collection,t?.modelName,"aggregate",QI.get(e))}),lc(A.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return cc(t.collection,t.modelName,"save")}),lc(A.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return cc(t.collection,t.modelName,"remove")}),lc(A.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return cc(t.collection,t.modelName,"insertMany")}),lc(A.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return cc(t.collection,t.modelName,"bulkWrite")})}}function cc(e,t,n,r){return Pi({collection:e,modelName:t,operation:n,origin:T7,parentSpan:r})}function aB(e){return Lp.tracingChannel(e)}function lc(e,t){ee(Lp.tracingChannel(e),n=>{let r=n.self;if(r)return t(r)})}function cB(e){let t=Q();e&&t&&QI.set(e,t)}var lB=I7;import*as JI from"diagnostics_channel";var N7="Mysql",v7="db.system",R7="db.connection_string",O7="db.name",C7="db.user",x7="db.statement",P7="net.peer.name",k7="net.peer.port",L7=(()=>({name:N7,setupOnce(){JI.tracingChannel&&($&&g.log(`[orchestrion:mysql] subscribing to channel "${A.MYSQL_QUERY}"`),ue(()=>{ee(JI.tracingChannel(A.MYSQL_QUERY),e=>{let t=w7(e.arguments[0]),{host:n,port:r,database:i,user:o}=G7(e.self),s=typeof r=="string"?parseInt(r,10):r,c=typeof s=="number"&&!isNaN(s);return e._sentryCallerScope=ne(),k({name:t??"mysql.query",kind:U.CLIENT,op:"db",attributes:{[v7]:"mysql",[S]:"auto.db.orchestrion.mysql",[R7]:U7(n,c?s:void 0,i),...i?{[O7]:i}:{},...o?{[C7]:o}:{},...t?{[x7]:t}:{},...n?{[P7]:n}:{},...c?{[k7]:s}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!="object"||!M7(n))return!1;let r=e._sentryCallerScope;return r&&_n(n,r),n.on("error",i=>t(i)),n.on("end",()=>t()),!0}})}))}}));function M7(e){return"on"in e&&typeof e.on=="function"}function w7(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 G7(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function U7(e,t,n){let r=`jdbc:mysql://${e||"localhost"}`;return typeof t=="number"&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var pB=L7;import*as mg from"diagnostics_channel";var D7="Mysql2",B7="auto.db.orchestrion.mysql2",H7="mysql";function F7(){qm(mg.tracingChannel),uB(A.MYSQL2_QUERY),uB(A.MYSQL2_EXECUTE)}function uB(e){ee(mg.tracingChannel(e),t=>{let n=W7(t.arguments);return k({name:n??"mysql2.query",kind:U.CLIENT,attributes:{[S]:B7,[B]:"db",[Pe]:H7,...Y7(t.self?.config),[Ve]:n||void 0}})},{requiresParentSpan:!0})}function W7(e){return V7(e[0])}function V7(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 Y7(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig??e??{},o=typeof n=="string"?parseInt(n,10):n,s=typeof o=="number"&&!isNaN(o);return{[Et]:r||void 0,[Mt]:i||void 0,[Le]:t||void 0,[xe]:s?o:void 0}}var j7=(()=>({name:D7,setupOnce(){mg.tracingChannel&&ue(()=>{F7()})}})),dB=j7;import*as $I from"diagnostics_channel";var fB="OpenAI",Z7="auto.ai.orchestrion.openai",X7=[{channel:A.OPENAI_CHAT,operation:"chat"},{channel:A.OPENAI_EMBEDDINGS,operation:"embeddings"}],mB=!1,K7=((e={})=>({name:fB,setupOnce(){!$I.tracingChannel||mB||(mB=!0,ue(()=>{for(let{channel:t,operation:n}of X7)$&&g.log(`[orchestrion:openai] subscribing to channel "${t}"`),ee($I.tracingChannel(t),r=>q7(r,n,e),{beforeSpanEnd:(r,i)=>{dl(r,i.result,Ze(e).recordOutputs)},deferSpanEnd:({span:r,data:i})=>J7(r,i,e)})}))}}));function q7(e,t,n){if(Cn(fB))return;let r=e.arguments??[],i=r[0],{recordInputs:o}=Ze(n),s=ze(n.enableTruncation),c=ud(r,t);c[S]=Z7;let a=i?.model||"unknown",l=k({name:`${t} ${a}`,op:`gen_ai.${t}`,attributes:c});return o&&i&&fl(l,i,t,s),l}function Q7(e){return!!e&&typeof e[Symbol.asyncIterator]=="function"}function J7(e,t,n){let r=t.result;if(!Q7(r))return!1;let{recordOutputs:i}=Ze(n),o=r[Symbol.asyncIterator].bind(r),s=ml({[Symbol.asyncIterator]:o},e,i??!1);return r[Symbol.asyncIterator]=()=>s,!0}var gB=K7;import*as eA from"diagnostics_channel";var $7="Postgres",z7="auto.db.orchestrion.postgres",_B="db.system",hB="db.name",bB="db.connection_string",yB="db.user",e6="db.statement",SB="net.peer.name",EB="net.peer.port",t6="db.postgresql.plan",n6="db.postgresql.idle.timeout.millis",r6="db.postgresql.max.client",TB="postgresql",i6="pg.query",o6="pg.connect",s6="pg-pool.connect",a6=((e={})=>({name:$7,setupOnce(){eA.tracingChannel&&ue(()=>{zI(A.PG_QUERY,c6,{deferStreamedResult:!0}),e.ignoreConnectSpans||(zI(A.PG_CONNECT,l6),zI(A.PGPOOL_CONNECT,p6))})}}));function zI(e,t,{deferStreamedResult:n=!1}={}){$&&g.log(`[orchestrion:pg] subscribing to channel "${e}"`),ee(eA.tracingChannel(e),r=>(r._sentryCallerScope=ne(),k({...t(r),kind:U.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:r,end:i}){let o=r.result;if(!o||typeof o!="object"||!u6(o))return!1;let s=r._sentryCallerScope;return s&&_n(o,s),o.on("error",c=>i(c)),o.on("end",()=>i()),!0}}:{requiresParentSpan:!0})}function c6(e){let t=e.self?.connectionParameters??{},n=d6(e.arguments);return{name:n?.text??i6,op:"db",attributes:{...IB(t),[S]:z7,[e6]:n?.text||void 0,[t6]:typeof n?.name=="string"?n.name:void 0}}}function l6(e){let t=e.self?.connectionParameters??{};return{name:o6,op:"db",attributes:IB(t)}}function p6(e){let t=e.self?.options??{};return{name:s6,op:"db",attributes:m6(t)}}function u6(e){return"on"in e&&typeof e.on=="function"}function d6(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 IB(e){return{[_B]:TB,[bB]:AB(e),[hB]:e.database,[yB]:e.user,[SB]:e.host,[EB]:Number.isInteger(e.port)?e.port:void 0}}function m6(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,i=Number(t?.port)||(Number.isInteger(e.port)?e.port:void 0),o=t?.username||e.user;return{[_B]:TB,[bB]:AB(e),[n6]:e.idleTimeoutMillis,[r6]:e.max,[hB]:n,[EB]:i,[SB]:r||void 0,[yB]:o||void 0}}function AB(e){if(e.connectionString)try{let i=new URL(e.connectionString);return i.username="",i.password="",i.toString()}catch{return"postgresql://localhost:5432/"}let t=e.host||"localhost",n=e.port||5432,r=e.database||"";return`postgresql://${t}:${n}/${r}`}var NB=a6;import*as pc from"diagnostics_channel";var f6="PostgresJs",g6="auto.db.orchestrion.postgresjs",_6="db.response.status_code",Kn=()=>{},h6=Symbol.for("sentry.query.from.instrumented.sql"),OB=Symbol("sentryPostgresJsSpan"),vB=Symbol("sentryPostgresJsConnectionAttrsSet"),CB=Symbol("sentryPostgresJsSpanEnded"),xB=new WeakMap,fg=[];function b6(e){fg.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)||fg.push(e)}function y6(){return fg.length===1?fg[0]:void 0}function S6(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!="object"||!n)return;let r=Wd(n);xB.set(t,r),b6(r)}function PB(e,t,n){let r=t;r[vB]||(r[vB]=!0,Fd(e,n))}function RB(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[OB],i=xB.get(t);r&&i&&PB(r,n,i)}function E6(e,t,n){let r=e.self;if(!r)return;let i=()=>{e[CB]=!0},o=r.resolve;typeof o=="function"&&(r.resolve=function(...c){i();try{let a=c[0]?.command;xa(t,n,a),t.end()}catch(a){$&&g.error("[orchestrion:postgresjs] error ending span in resolve:",a)}return o.apply(this,c)});let s=r.reject;typeof s=="function"&&(r.reject=function(...c){i();try{let a=c[0];t.setStatus({code:2,message:a?.message||"unknown_error"}),t.setAttribute(_6,a?.code||"unknown"),t.setAttribute(wr,a?.name||"unknown"),xa(t,n),t.end()}catch(a){$&&g.error("[orchestrion:postgresjs] error ending span in reject:",a)}return s.apply(this,c)})}var T6=((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:f6,setupOnce(){pc.tracingChannel&&($&&g.log(`[orchestrion:postgresjs] subscribing to "${A.POSTGRESJS_HANDLE}"`),pc.tracingChannel(A.POSTGRESJS_CONNECTION).subscribe({start:Kn,asyncStart:Kn,asyncEnd:Kn,error:Kn,end:S6}),pc.tracingChannel(A.POSTGRESJS_EXECUTE).subscribe({end:Kn,asyncStart:Kn,asyncEnd:Kn,error:Kn,start:RB}),pc.tracingChannel(A.POSTGRESJS_CONNECT).subscribe({end:Kn,asyncStart:Kn,asyncEnd:Kn,error:Kn,start:RB}),ue(()=>{ee(pc.tracingChannel(A.POSTGRESJS_HANDLE),r=>{let i=r.self;if(!i||i.executed===!0||i[h6])return;let o=Hd(i.strings),s=Pa(o),c=k({name:s||"postgresjs.query",op:"db",kind:U.CLIENT,attributes:{[S]:g6,[mt]:"postgres",[Mr]:s}});i[OB]=c;let a=y6();if(a&&PB(c,i,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 E6(r,c,s),c},{requiresParentSpan:t!==!1,deferSpanEnd({data:r}){return r[CB]?!0:!("error"in r)}})}))}}}),kB=T6;import{EventEmitter as I6}from"events";import*as _g from"diagnostics_channel";var A6="Tedious",N6="auto.db.orchestrion.tedious",v6="mssql",R6="db.sql.table",MB=Symbol("sentry.orchestrion.tedious.current-database");function gg(e){Object.defineProperty(this,MB,{value:e,writable:!0,configurable:!0})}function LB(){this.removeListener("databaseChange",gg)}function O6(){_g.tracingChannel(A.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(gg.call(t,t.config?.options?.database),t.removeListener("databaseChange",gg),t.on("databaseChange",gg),t.removeListener("end",LB),t.once("end",LB))})}function uc(e,t){_g.tracingChannel(e).start.subscribe(n=>{let r=n,i=r.self,o=r.arguments[0];if(!i||!(o instanceof I6))return;let s=0,c=0,a=()=>{c++},l=()=>{s++},p=i[MB],u=C6(o),d={[S]:N6,[Pe]:v6,[Et]:p,[Mt]:i.config?.userName??i.config?.authentication?.options?.userName,[Ve]:u,[R6]:o.table,[Le]:i.config?.server,[xe]:i.config?.options?.port},m=k({name:x6(t,p,u,o.table),kind:U.CLIENT,op:"db",attributes:d}),_=P6(h=>{o.removeListener("done",a),o.removeListener("doneInProc",a),o.removeListener("doneProc",l),o.removeListener("error",_),i.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(o.on("done",a),o.on("doneInProc",a),o.on("doneProc",l),o.once("error",_),i.on("end",_),typeof o.callback=="function"){let h=o.callback;o.callback=function(...b){return _(b[0]),h.apply(this,b)}}})}function C6(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 x6(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 P6(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var k6=(()=>({name:A6,setupOnce(){_g.tracingChannel&&($&&g.log(`[orchestrion:tedious] subscribing to channel "${A.TEDIOUS_EXEC_SQL}"`),ue(()=>{O6(),uc(A.TEDIOUS_EXEC_SQL,"execSql"),uc(A.TEDIOUS_EXEC_SQL_BATCH,"execSqlBatch"),uc(A.TEDIOUS_CALL_PROCEDURE,"callProcedure"),uc(A.TEDIOUS_EXEC_BULK_LOAD,"execBulkLoad"),uc(A.TEDIOUS_PREPARE,"prepare"),uc(A.TEDIOUS_EXECUTE,"execute")}))}})),wB=k6;import*as sA from"diagnostics_channel";var GB=Symbol("SentryVercelAiModelPatched"),UB=Symbol("SentryVercelAiToolPatched"),L6=0;function hg(){return`v6-${++L6}`}var bg=new WeakMap,WB=new WeakSet,VB=new WeakSet,iA=new WeakMap,oA=new WeakMap,nA=new WeakMap,YB=new WeakSet,DB=!1;function jB(e,t={}){if(!DB){DB=!0;try{dc(e,A.VERCEL_AI_GENERATE_TEXT,tA("generateText"),t),dc(e,A.VERCEL_AI_STREAM_TEXT,tA("streamText"),t),dc(e,A.VERCEL_AI_GENERATE_OBJECT,tA("generateObject"),t),dc(e,A.VERCEL_AI_EMBED,(n,r)=>({type:"embed",event:{callId:hg(),...rA(n.model),maxRetries:n.maxRetries,value:n.value,...Mp(r)}}),t),dc(e,A.VERCEL_AI_EMBED_MANY,(n,r)=>({type:"embedMany",event:{callId:hg(),...rA(n.model),maxRetries:n.maxRetries,values:n.values,...Mp(r)}}),t),dc(e,A.VERCEL_AI_EXECUTE_TOOL_CALL,(n,r)=>({type:"executeTool",event:{callId:hg(),toolCall:n.toolCall,tools:n.tools,...Mp(r)}}),t),U6(e,A.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{$&&g.log("Vercel AI orchestrion channel subscription failed.")}}}function dc(e,t,n,r){let i=e(t),o=s=>{let c=V(s.arguments[0])?s.arguments[0]:{},a=V(c.experimental_telemetry)?c.experimental_telemetry:{};if(a.isEnabled===!1&&!YB.has(a))return;let l=n(c,a);G6(c,a);let p=Q(),u=pp(l,r);if(u){bg.set(s,l),WB.add(u);let d=V(c.model)&&c.model.specificationVersion==="v1";nA.set(u,{callSiteSpan:p,toolErrorsBubbleToCaller:d}),l.type==="executeTool"&&VB.add(u);let m=Fe(l.event.callId);m&&iA.set(u,m),oA.set(u,Mp(a)),V(c.tools)&&D6(c.tools,r),d&&XB(c.model,r)}return u};ee(i,s=>o(s),{beforeSpanEnd:(s,c)=>{let a=bg.get(c);if(a){if("error"in c){let l=nA.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,Ja(s,a,r);a.type!=="streamText"&&vE(a),bg.delete(c)}},deferSpanEnd:({data:s,end:c})=>M6(s,c)})}function M6(e,t){if(bg.get(e)?.type!=="streamText"||"error"in e||!w6(e.result))return!1;let n=e.result;return(async()=>{try{let[r,i,o,s,c]=await Promise.all([n.totalUsage??n.usage,n.text,n.toolCalls,n.finishReason,n.response]);e.result={usage:r,text:i,toolCalls:o,finishReason:s,response:c},t()}catch(r){t(r)}})(),!0}function w6(e){return V(e)&&(BB(e.totalUsage)||BB(e.usage))}function BB(e){return V(e)&&typeof e.then=="function"}function G6(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};YB.add(n),e.experimental_telemetry=n}function U6(e,t,n){e(t).subscribe({end(r){let i=r;V(i.result)&&XB(i.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function ZB(){let e=Q();return e&&WB.has(e)?e:void 0}function XB(e,t){e[GB]||(e[GB]=!0,HB(e,"doGenerate",t),HB(e,"doStream",t))}function HB(e,t,n){let r=e[t];typeof r=="function"&&(e[t]=function(...i){let o=ZB();if(!o)return Promise.resolve(r.apply(this,i));let s=V(i[0])?i[0]:{},c=iA.get(o),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,...oA.get(o)}},l=se(o,()=>pp(a,n));if(!l)return Promise.resolve(r.apply(this,i));let p=()=>{t==="doStream"&&c&&RE(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,i)).then(m=>t==="doStream"&&V(m)&&zm(m.stream)?(m.stream=ef(m.stream,_=>{a.result={...m,...OE(_)},Ja(l,a,n),l.end(),p()},_=>{l.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),l.end(),p()}),m):(a.result=m,Ja(l,a,n),l.end(),p(),m),u)}catch(d){return u(d)}})}function D6(e,t){try{for(let[n,r]of Object.entries(e))V(r)&&B6(n,r,e,t)}catch{$&&g.log("Vercel AI orchestrion tool patching failed.")}}function B6(e,t,n,r){let i=t.execute;typeof i!="function"||t[UB]||(t[UB]=!0,t.execute=function(o,...s){let c=ZB();if(!c||VB.has(c))return i.apply(this,[o,...s]);let a=V(s[0])?s[0]:{},l={type:"executeTool",event:{callId:iA.get(c),toolCall:{toolName:e,toolCallId:Fe(a.toolCallId),input:o},tools:n,...oA.get(c)}},p=se(c,()=>pp(l,r));if(!p)return i.apply(this,[o,...s]);let u=d=>{throw nA.get(c)?.toolErrorsBubbleToCaller?p.setStatus({code:2,message:d instanceof Error?d.message:"tool_error"}):CE(p,l,d),p.end(),d};try{return Promise.resolve(i.apply(this,[o,...s])).then(m=>(l.result={output:m},Ja(p,l,r),p.end(),m),u)}catch(d){return u(d)}})}function tA(e){return(t,n)=>({type:e,event:{callId:hg(),operationId:`ai.${e}`,functionId:Fe(n.functionId),...rA(t.model),maxRetries:t.maxRetries,instructions:Fe(t.system),messages:H6(t),...Mp(n)}})}function H6(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt=="string"?[{role:"user",content:e.prompt}]:e.messages??e.prompt}function Mp(e){let t=e.isEnabled===!0?!0:void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function rA(e){return{provider:FB(e,"provider"),modelId:FB(e,"modelId")}}function FB(e,t){return V(e)?Fe(e[t]):void 0}var F6=((e={})=>{let t=up(e);return Ut(t,{options:e,setupOnce(){sA.tracingChannel&&ue(()=>{jB(sA.tracingChannel,e)})}})}),KB=F6;import*as aA from"diagnostics_channel";var JB=new WeakMap;function $B(e,t){JB.set(e,t)}function zB(e){return JB.get(e)}var qB=new WeakMap;function yg(e){let t=qB.get(e);return t||(t=[],qB.set(e,t)),t}function eH(e,t){yg(e).push(t)}function tH(e){yg(e).pop()}function nH(e){let t=e[0];return Array.isArray(t)?t.map(n=>QB(n)??"").join(","):QB(t)}function QB(e){return typeof e=="string"?e:e instanceof RegExp||typeof e=="number"?String(e):void 0}function rH(e){let t=yg(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=yg(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 i=t.startsWith("/")?t:`/${t}`;return i.length>0&&(r===i||r.startsWith(i)||W6(i))?i:void 0}function W6(e){return e.includes(":")||e.includes("*")}var V6="auto.http.express",Y6="express.name",j6="express.type",yo=()=>{},oH=!1;function sH(e,t){if(!oH){oH=!0;for(let n of[A.EXPRESS_REGISTER,A.ROUTER_REGISTER])t(n).subscribe({start:yo,asyncStart:yo,asyncEnd:yo,error:yo,end:Z6});for(let n of[A.EXPRESS_HANDLE,A.ROUTER_HANDLE]){$&&g.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);ee(r,i=>K6(i,e),{beforeSpanEnd(i,o){o._sentryCleanup?.()}}),r.subscribe({start:yo,asyncEnd:yo,end:yo,error:yo,asyncStart:X6})}}}function Z6(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&$B(n,nH(e.arguments??[]))}function X6(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&tH(t)}function K6(e,t){let n=e.self,r=e.arguments;if(!n||!Array.isArray(r)||n.handle?.length===4||n.method&&!n.route)return;let i=r[0],o=r[1];if(!i||!Q())return;let s=q6(n),c=zB(n);c!=null&&(eH(i,c),e._sentryStoredLayer=!0);let a=s==="request_handler"?rH(i):void 0,l=s==="request_handler"&&a!=null?iH(i,a):void 0,p=s==="request_handler"?a||"request handler":s==="router"?n.path??"/":n.name??"<anonymous>";if(l&&Q6(l),s==="request_handler"&&a){let d=J();if(d!==Rt()){let m=typeof i.method=="string"?i.method.toUpperCase():"GET";d.setTransactionName(`${m} ${a}`)}else $&&g.warn("[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name")}if(J6(p,s,t))return;let u=k({name:p,attributes:{[S]:V6,[B]:`${s}.express`,[Y6]:p,[j6]:s,...l?{[He]:l}:{}}});if(o&&typeof o.once=="function"){let d=()=>{u.end()};o.once("finish",d),e._sentryCleanup=()=>o.removeListener("finish",d)}return u}function q6(e){return e.name==="router"?"router":e.name==="bound dispatch"||e.name==="handle"?"request_handler":"middleware"}function Q6(e){let t=Q(),n=t&&Re(t);n&&oe(n).data[B]==="http.server"&&n.setAttribute(He,e)}function J6(e,t,n){let{ignoreLayers:r,ignoreLayersType:i}=n;if(Array.isArray(i)&&i.includes(t))return!0;if(!Array.isArray(r))return!1;try{return fn(e,r,!0)}catch{return!1}}var $6="Express",z6=((e={})=>({name:$6,setupOnce(){aA.tracingChannel&&ue(()=>{sH(e,aA.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})),aH=z6;import*as gH from"diagnostics_channel";import*as cA from"diagnostics_channel";import*as cH from"net";function lH(e,t){return k({name:`${e} ${t.path}`,op:"db.query",kind:U.CLIENT,attributes:{[S]:"auto.firebase.orchestrion.firestore",[ar]:e,...t8(t)}})}function e8(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(cH.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 t8(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},i={[Qs]:e.path,[fi]: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:o,port:s}=e8(r);return o&&(i[_t]=o),s&&(i[ht]=s),i}var pH="auto.firebase.orchestrion.functions",uH="__sentryFirebaseWrapped";function dH(e,t){let n=e.arguments;if(!Array.isArray(n)||n.length===0)return;let r=typeof n[0]=="function"?0:1,i=n[r];typeof i!="function"||i[uH]||(n[r]=n8(i,t))}function n8(e,t){let n=async function(...r){let i=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",o={[S]:pH,[UR]:i,[Eu]:t,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(o["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(o["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),ke({name:`firebase.function.${t}`,op:"function.firebase",kind:U.SERVER,attributes:o},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:pH,handled:!1}}),s.end(),await Yo(2e3),c}})};return n[uH]=!0,n}var r8=[{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}],i8=[{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"}],Sg=()=>{};function mH(e){try{return e()}catch(t){$&&g.warn("[orchestrion:firebase] error handling channel event",t);return}}function fH(){for(let{channel:e,spanName:t,useParent:n}of r8)ee(cA.tracingChannel(e),r=>mH(()=>{let i=r.arguments[0];if(!i)return;let o=n&&i.parent||i;return lH(t,o)}));for(let{channel:e,triggerType:t}of i8)cA.tracingChannel(e).subscribe({start:n=>{mH(()=>dH(n,t))},end:Sg,asyncStart:Sg,asyncEnd:Sg,error:Sg})}var o8="Firebase",s8=(()=>({name:o8,setupOnce(){gH.tracingChannel&&ue(()=>{fH()})}})),_H=s8;function wp(){return!!te.__SENTRY_ORCHESTRION__}function lA(){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 mc from"diagnostics_channel";var a8="RedisChannel",uA="auto.db.orchestrion.redis",yH="db.connection_string",dA="redis";function hH(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function SH(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function c8(e){let t=e[0];return V(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function l8(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 EH(e){return{[Pe]:dA,[Le]:e?.socket?.host,[xe]:e?.socket?.port,[yH]:l8(e?.url),[S]:uA}}function TH(e,t,n){return k({name:`redis-${e}`,kind:U.CLIENT,attributes:{...n,[B]:"db",[Ve]:zr(e,t)}})}function p8(e){let t=mc.tracingChannel(A.REDIS_COMMAND),n=()=>{};t.subscribe({end:n,asyncStart:n,asyncEnd:n,start(r){let i=r.arguments?.[0];if(!i||typeof i!="object")return;let o=i.callback;if(typeof o!="function")return;let s=r.self,c={[Pe]:dA,[S]:uA};c[Le]=s?.connection_options?.host,c[xe]=s?.connection_options?.port,s?.address&&(c[yH]=`redis://${s.address}`);let a=TH(i.command,i.args??[],c);r._sentrySpan=a;let l=Q();i.callback=function(p,u){p||SH(e,a,i.command,i.args??[],u),hH(a,p);let d=arguments;return se(l??null,()=>o.apply(this,d))}},error(r){let i=r._sentrySpan;i&&hH(i,r.error)}})}function bH(e,t,n){let r=mc.tracingChannel(e);ee(r,i=>{let o=t(i);if(!o?.length)return;let s=String(o[0]),c=i.self?.options;return TH(s,o.slice(1),EH(c))},{beforeSpanEnd(i,o){if("error"in o||!n)return;let s=t(o);s?.length&&SH(n,i,String(s[0]),s.slice(1),o.result)}})}function u8(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function d8(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(!(typeof t?.transformArguments!="function"||!Array.isArray(n)))try{return t.transformArguments(...c8(n))}catch{return}}function m8(){let e=mc.tracingChannel(A.NODE_REDIS_CONNECT);ee(e,t=>{let n=t.self?.options;return k({name:"redis-connect",kind:U.CLIENT,attributes:{...EH(n),[B]:"db"}})})}function pA(e,t){let n=mc.tracingChannel(e);ee(n,r=>{let i=r.arguments?.[0],o=Array.isArray(i)?i.length:void 0,s=r.self?.options?.socket;return k({name:t(r),kind:U.CLIENT,attributes:{[S]:uA,[B]:"db.redis",[mt]:dA,...o&&o>1?{[$s]:o}:{},...s?.host!=null?{[_t]:s.host}:{},...s?.port!=null?{[ht]:s.port}:{}}})})}var f8=((e={})=>{let t=e.responseHook;return{name:a8,setupOnce(){mc.tracingChannel&&($&&g.log(`[orchestrion:redis] subscribing to "${A.REDIS_COMMAND}" and node-redis channels`),p8(t),ue(()=>{bH(A.NODE_REDIS_COMMAND,u8,t),bH(A.NODE_REDIS_EXECUTOR,d8,t),m8(),pA(A.NODE_REDIS_MULTI,()=>"MULTI"),pA(A.NODE_REDIS_PIPELINE,()=>"PIPELINE"),pA(A.NODE_REDIS_BATCH,n=>n.arguments?.[2]!==void 0?"MULTI":"PIPELINE")}))}}}),mA=f8;var fA={postgresIntegration:NB,postgresJsIntegration:kB,mongoIntegration:oB,mysqlIntegration:pB,mysql2Integration:dB,genericPoolIntegration:sD,mongooseIntegration:lB,lruMemoizerIntegration:rB,openaiIntegration:gB,anthropicIntegration:VU,googleGenAIIntegration:pD,langChainIntegration:zD,langGraphIntegration:nB,vercelAiIntegration:KB,amqplibIntegration:HU,hapiIntegration:MD,koaIntegration:DD,expressIntegration:aH,graphqlIntegration:OD,kafkajsIntegration:qD,tediousIntegration:wB,awsIntegration:tD,firebaseIntegration:_H};var IH="Knex",g8=de(IH,()=>new Df),_8=(()=>({name:IH,setupOnce(){wp()?XI().setupOnce?.():g8()}})),h8=_8;import{EventEmitter as b8}from"events";var AH="db.sql.table",NH="mssql";function vH(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 RH=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};var y8="@sentry/instrumentation-tedious",CH=Symbol("opentelemetry.instrumentation-tedious.current-database"),OH=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function Eg(e){Object.defineProperty(this,CH,{value:e,writable:!0})}var xH=class PH extends ae{constructor(t={}){super(y8,q,t)}init(){return[new re(PH.COMPONENT,[">=1.11.0 <20"],t=>{let n=t.Connection.prototype;for(let r of OH)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 OH)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(t){return function(){return Eg.call(this,this.config?.options?.database),this.removeListener("databaseChange",Eg),this.on("databaseChange",Eg),this.once("end",()=>{this.removeListener("databaseChange",Eg)}),t.apply(this,arguments)}}_patchQuery(t){return n=>{let r=this;function i(o){if(!(o instanceof b8))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[CH],u=(h=>h.sqlTextOrProcedure==="sp_prepare"&&h.parametersByName?.stmt?.value?h.parametersByName.stmt.value:h.sqlTextOrProcedure)(o),d={[S]:"auto.db.otel.tedious",[Pe]:NH,[Et]:p,[Mt]:this.config?.userName??this.config?.authentication?.options?.userName,[Ve]:u,[AH]:o.table,[Le]:this.config?.server,[xe]:this.config?.options?.port},m=k({name:vH(t,p,u,o.table),kind:U.CLIENT,attributes:d}),_=RH(h=>{o.removeListener("done",a),o.removeListener("doneInProc",a),o.removeListener("doneProc",l),o.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 o.on("done",a),o.on("doneInProc",a),o.on("doneProc",l),o.once("error",_),this.on("end",_),typeof o.callback=="function"?r._wrap(o,"callback",r._patchCallbackQuery(_)):r._diag.error("Expected request.callback to be a function"),se(m,()=>n.apply(this,arguments))}return Object.defineProperty(i,"length",{value:n.length,writable:!1}),i}}_patchCallbackQuery(t){return n=>function(r,i,o){return t(r),n.apply(this,arguments)}}};xH.COMPONENT="tedious";var kH=xH;var LH="Tedious",gA=de(LH,()=>new kH({})),S8=(()=>({name:LH,setupOnce(){gA()}})),_A=S8;var hA="generic-pool",E8="@sentry/instrumentation-generic-pool",Tg=class extends ae{constructor(t={}){super(E8,q,t),this._isDisabled=!1}init(){return[new re(hA,[">=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(hA,[">=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(hA,[">=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(...o){let s=t.apply(this,o);return n(s,"acquire",r),s}}_acquireWithCallbacksPatcher(t){let n=()=>this._isDisabled;return function(i,o){return n()?t.call(this,i,o):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(),i&&i(c,a)},o)})}}};var MH="GenericPool",bA=de(MH,()=>new Tg({})),T8=(()=>({name:MH,setupOnce(){bA()}})),yA=T8;var EA="dataloader",I8="@sentry/instrumentation-dataloader",fc="auto.db.otel.dataloader";function A8(e){return e[Symbol.toStringTag]==="Module"}function wH(e){return A8(e)?e.default:e}function gc(e,t){let n=e.name;return n?`${EA}.${t} ${n}`:`${EA}.${t}`}function _c(e){if(e==="load"||e==="loadMany"||e==="batch")return"cache.get"}function SA(e){return Array.isArray(e)?e.map(t=>String(t)):e==null?void 0:[String(e)]}var Ig=class extends ae{constructor(t={}){super(I8,q,t)}init(){return[new re(EA,[">=2.0.0 <3"],t=>{let n=wH(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=wH(t);["load","loadMany","prime","clear","clearAll"].forEach(r=>{w(n.prototype[r])&&this._unwrap(n.prototype,r)})})]}_wrapBatchLoadFn(t){let n=this;return function(...i){return n.isEnabled()?Se({name:gc(this,"batch"),links:this._batch?.spanLinks,attributes:{[S]:fc,[B]:_c("batch"),[qs]:SA(i[0])},onlyIfParent:!0},()=>t.apply(this,i)):t.call(this,...i)}}_getPatchedConstructor(t){let n=this,r=t.prototype;if(!n.isEnabled())return t;function i(...o){return typeof o[0]=="function"&&(w(o[0])&&n._unwrap(o,0),o[0]=n._wrapBatchLoadFn(o[0])),t.apply(this,o)}return i.prototype=r,i}_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:gc(this,"load"),kind:U.CLIENT,attributes:{[S]:fc,[B]:_c("load"),[qs]:SA(r[0])},onlyIfParent:!0},i=>{let o=t.call(this,...r);return this._batch&&i.isRecording()&&(this._batch.spanLinks||(this._batch.spanLinks=[]),this._batch.spanLinks.push({context:i.spanContext()})),o})}}_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:gc(this,"loadMany"),kind:U.CLIENT,attributes:{[S]:fc,[B]:_c("loadMany"),[qs]:SA(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:gc(this,"prime"),kind:U.CLIENT,attributes:{[S]:fc,[B]:_c("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:gc(this,"clear"),kind:U.CLIENT,attributes:{[S]:fc,[B]:_c("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:gc(this,"clearAll"),kind:U.CLIENT,attributes:{[S]:fc,[B]:_c("clearAll")},onlyIfParent:!0},()=>t.call(this,...r))}}};var GH="Dataloader",N8=de(GH,()=>new Ig),v8=(()=>({name:GH,setupOnce(){wp()?CI().setupOnce?.():N8()}})),R8=v8;var pn=(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))(pn||{});at();var UH="messaging.operation",TA="messaging.destination",IA="messaging.destination_kind",AA="messaging.rabbitmq.routing_key",NA="messaging.protocol",DH="messaging.protocol_version",BH="messaging.url",vA="messaging.message_id",RA="messaging.conversation_id",OA="topic",HH="process";var O8="auto.amqplib.otel.publisher",C8="auto.amqplib.otel.consumer",Ag=Symbol("opentelemetry.amqplib.message.stored-span"),So=Symbol("opentelemetry.amqplib.channel.spans-not-ended"),Ng=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer"),vg=Symbol("opentelemetry.amqplib.connection.attributes"),Rg=Symbol("sentry.amqplib.channel.is-confirm-publishing"),x8=e=>e!==""?e:"<default>",P8=e=>e.replace(/:[^:@/]*@/,":***@"),FH=(e,t)=>e||(t==="AMQP"?5672:5671),WH=e=>{let t=e||"amqp";return(t.endsWith(":")?t.substring(0,t.length-1):t).toUpperCase()},VH=e=>e||"localhost",YH=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[wt]:t}:{}},jH=e=>{let t={[DH]:"0.9.1"},n=e||"amqp://localhost";if(typeof n=="object"){let r=n,i=WH(r?.protocol);t[NA]=i,t[Le]=VH(r?.hostname),t[xe]=FH(r.port,i)}else{let r=P8(n);t[BH]=r;try{let i=new URL(r),o=WH(i.protocol);t[NA]=o,t[Le]=VH(i.hostname),t[xe]=FH(i.port?parseInt(i.port):void 0,o)}catch{}}return t};function CA(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?String(n[0]):String(n)}function xA(e,t,n,r){let i=x8(e),o=k({name:`publish ${i}`,kind:vt.PRODUCER,attributes:{...n.connection[vg],[TA]:e,[IA]:OA,[AA]:t,[vA]:r?.messageId,[RA]:r?.correlationId,[S]:O8}}),s=r??{};s.headers=s.headers??{};let c=$e({span:o});return c["sentry-trace"]&&(s.headers["sentry-trace"]=c["sentry-trace"]),c.baggage&&(s.headers.baggage=c.baggage),{span:o,modifiedOptions:s}}function ZH(e,t,n){return k({name:`${e} process`,kind:vt.CONSUMER,attributes:{...n?.connection?.[vg],[TA]:t.fields?.exchange,[IA]:OA,[AA]:t.fields?.routingKey,[UH]:HH,[vA]:t?.properties.messageId,[RA]:t?.properties.correlationId,[S]:C8}})}var XH=1e3*60;function Gp(e,t,n,r){let i=e[Ag];i&&(t!==!1&&i.setStatus({code:2,message:n!==pn.ChannelClosed&&n!==pn.ChannelError?`${n} called on message${r===!0?" with requeue":r===!1?" without requeue":""}`:n}),i.end(),e[Ag]=void 0)}function PA(e,t,n,r){(e[So]??[]).forEach(o=>{Gp(o.msg,t,n,r)}),e[So]=[]}function k8(e){let t=lt(),n=e[So]??[],r;for(r=0;r<n.length;r++){let i=n[r];if((t-i.timeOfConsume)*1e3<XH)break;Gp(i.msg,null,pn.InstrumentationTimeout,!0)}n.splice(0,r)}function KH(e){return function(n,r,i){return e.call(this,n,r,function(o,s){if(o==null){let c=jH(n),a=YH(s);s[vg]={...c,...a}}i.apply(this,arguments)})}}function qH(e){return function(n){if(n==="close"){PA(this,!0,pn.ChannelClosed,void 0);let r=this[Ng];r&&clearInterval(r),this[Ng]=void 0}else n==="error"&&PA(this,!0,pn.ChannelError,void 0);return e.apply(this,arguments)}}function kA(e,t){return n=>function(i){return PA(this,e,t,i),n.apply(this,arguments)}}function Og(e,t){return n=>function(i,o,s){let c=this,a=t===pn.Reject?o:s,l=c[So]??[],p=l.findIndex(u=>u.msg===i);if(p<0)Gp(i,e,t,a);else if(t!==pn.Reject&&o){for(let u=0;u<=p;u++)Gp(l[u].msg,e,t,a);l.splice(0,p+1)}else Gp(i,e,t,a),l.splice(p,1);return n.apply(this,arguments)}}function QH(e){return function(n,r,i){let o=this;if(!Object.prototype.hasOwnProperty.call(o,So)){let a=setInterval(()=>{k8(o)},XH);a.unref(),o[Ng]=a,o[So]=[]}let s=function(a){if(!a)return r.call(this,a);let l=a.properties.headers??{},p=CA(l,"sentry-trace"),u=CA(l,"baggage");An({sentryTrace:p,baggage:u},()=>{let d=ZH(n,a,o);i?.noAck||(o[So].push({msg:a,timeOfConsume:lt()}),a[Ag]=d),se(d,()=>{r.call(this,a)}),i?.noAck&&d.end()})},c=Array.prototype.slice.call(arguments);return c[1]=s,e.apply(this,c)}}function JH(e){return function(n,r,i,o,s){let c=this,{span:a,modifiedOptions:l}=xA(n,r,c,o),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[Rg]=!0;try{return e.apply(this,u)}finally{c[Rg]=!1}}}function $H(e){return function(n,r,i,o){if(this[Rg])return e.apply(this,arguments);let s=this,{span:c,modifiedOptions:a}=xA(n,r,s,o),l=[...arguments];l[3]=a;let p=e.apply(this,l);return c.end(),p}}var L8="@sentry/instrumentation-amqplib",Cg=[">=0.5.5 <2"],xg=class extends ae{constructor(t={}){super(L8,q,t)}init(){let t=new Ae("amqplib/lib/channel_model.js",Cg,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ae("amqplib/lib/callback_model.js",Cg,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ae("amqplib/lib/connect.js",Cg,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new re("amqplib",Cg,void 0,void 0,[t,r,n])}patchConnect(t){let n=this.unpatchConnect(t);return w(n.connect)||this._wrap(n,"connect",KH),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",$H),w(t.Channel.prototype.consume)||this._wrap(t.Channel.prototype,"consume",QH),w(t.Channel.prototype.ack)||this._wrap(t.Channel.prototype,"ack",Og(!1,pn.Ack)),w(t.Channel.prototype.nack)||this._wrap(t.Channel.prototype,"nack",Og(!0,pn.Nack)),w(t.Channel.prototype.reject)||this._wrap(t.Channel.prototype,"reject",Og(!0,pn.Reject)),w(t.Channel.prototype.ackAll)||this._wrap(t.Channel.prototype,"ackAll",kA(!1,pn.AckAll)),w(t.Channel.prototype.nackAll)||this._wrap(t.Channel.prototype,"nackAll",kA(!0,pn.NackAll)),w(t.Channel.prototype.emit)||this._wrap(t.Channel.prototype,"emit",qH),w(t.ConfirmChannel.prototype.publish)||this._wrap(t.ConfirmChannel.prototype,"publish",JH),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 zH="Amqplib",LA=de(zH,()=>new xg),M8=(()=>({name:zH,setupOnce(){LA()}})),MA=M8;var Pg="VercelAI";var w8=[">=3.0.0 <7"],eF=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function G8(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 U8(e){if(typeof e!="object"||e===null||!("content"in e)||typeof e.consumeStream=="function")return;let t=e;Array.isArray(t.content)&&(D8(t.content),B8(t.content))}function D8(e){for(let t of e){if(!G8(t))continue;let n=Qb(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 B8(e){for(let t of e)typeof t=="object"&&t!==null&&"toolCallId"in t&&typeof t.toolCallId=="string"&&Jb(t.toolCallId)}function H8(e,t,n,r,i){let o=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:i;return{recordInputs:o,recordOutputs:s}}var kg=class extends ae{constructor(t={}){super("@sentry/instrumentation-vercel-ai",q,t),this._isPatched=!1,this._callbacks=[]}init(){return new re("ai",w8,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:(i,o,s)=>{let c=s[0].experimental_telemetry||{},a=c.isEnabled,l=C(),p=l?.getIntegrationByName(Pg),u=p?.options,d=p?l?.getDataCollectionOptions().genAI:void 0,{recordInputs:m,recordOutputs:_}=H8(u,c,a,!!d?.inputs,!!d?.outputs);return s[0].experimental_telemetry={...c,isEnabled:a!==void 0?a:!0,recordInputs:m,recordOutputs:_},sr(()=>Reflect.apply(i,o,s),h=>{h&&typeof h=="object"&&we(h,"_sentry_active_span",Q())},()=>{},h=>{U8(h)})}});if(Object.prototype.toString.call(t)==="[object Module]"){for(let r of eF)t[r]!=null&&(t[r]=n(t[r]));return t}else{let r=eF.reduce((i,o)=>(t[o]!=null&&(i[o]=n(t[o])),i),{});return{...t,...r}}}};var wA=de(Pg,()=>new kg({}));function F8(e){return!!e.getIntegrationByName("Modules")?.getModules?.()?.ai}var W8=((e={})=>{let t,n=up(e);return Ut(n,{options:e,setupOnce(){t=wA()},afterAllSetup(r){e.force??F8(r)?cd(r):t?.callWhenPatched(()=>cd(r))}})}),GA=W8;var V8=[">=4.0.0 <8"],Lg=class extends ae{constructor(t={}){super("@sentry/instrumentation-openai",q,t)}init(){return new re("openai",V8,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 i=this.getConfig(),o=function(...s){if(Cn(Yr))return Reflect.construct(r,s);let c=Reflect.construct(r,s);return dd(c,i)};Object.setPrototypeOf(o,r),Object.setPrototypeOf(o.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(o,s,c)}try{t[n]=o}catch{Object.defineProperty(t,n,{value:o,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=o}catch{Object.defineProperty(t,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return t}};var UA=de(Yr,e=>new Lg(e)),Y8=((e={})=>({name:Yr,setupOnce(){UA(e)}})),DA=Y8;var j8=[">=0.19.2 <1.0.0"],Mg=class extends ae{constructor(t={}){super("@sentry/instrumentation-anthropic-ai",q,t)}init(){return new re("@anthropic-ai/sdk",j8,this._patch.bind(this))}_patch(t){let n=t.Anthropic,r=this.getConfig(),i=function(...o){if(Cn(jr))return Reflect.construct(n,o);let s=Reflect.construct(n,o);return _d(s,r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let o of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(i,o,s)}try{t.Anthropic=i}catch{Object.defineProperty(t,"Anthropic",{value:i,writable:!0,configurable:!0,enumerable:!0})}if(t.default===n)try{t.default=i}catch{Object.defineProperty(t,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return t}};var BA=de(jr,e=>new Mg(e)),Z8=((e={})=>({name:jr,options:e,setupOnce(){BA(e)}})),HA=Z8;var tF=[">=0.10.0 <2"],wg=class extends ae{constructor(t={}){super("@sentry/instrumentation-google-genai",q,t)}init(){return new re("@google/genai",tF,n=>this._patch(n),n=>n,[new Ae("@google/genai/dist/node/index.cjs",tF,n=>this._patch(n),n=>n)])}_patch(t){let n=t.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return t;let i=function(...o){if(Cn(Zr))return Reflect.construct(n,o);let s=Reflect.construct(n,o);return yd(s,r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let o of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(o)){let s=Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(i,o,s)}return Ol(t,"GoogleGenAI",i),t}};var FA=de(Zr,e=>new wg(e)),X8=((e={})=>({name:Zr,setupOnce(){FA(e)}})),WA=X8;var Gg=[">=0.1.0 <2.0.0"];function K8(e,t,n){return new Proxy(e,{apply(r,i,o){let c=o[1];return(!c||typeof c!="object"||Array.isArray(c))&&(c={},o[1]=c),c.callbacks=es(c.callbacks,t),Reflect.apply(r,i,o)}})}var Ug=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,Gg,this._patch.bind(this),i=>i,[new Ae(`${r}/dist/index.cjs`,Gg,this._patch.bind(this),i=>i)]));return t.push(new re("langchain",Gg,this._patch.bind(this),r=>r,[new Ae("langchain/dist/chat_models/universal.cjs",Gg,this._patch.bind(this),r=>r)])),t}_patch(t){Ti([Yr,jr,Zr]);let n=this.getConfig(),r=mr(n);return this._patchRunnableMethods(t,r),this._patchEmbeddingsMethods(t,n),t}_patchRunnableMethods(t,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],i=t.universal_exports??t,o=Object.values(i).find(a=>typeof a=="function"&&r.includes(a.name));if(!o)return;let s=o.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]=K8(l,n))}}_patchEmbeddingsMethods(t,n){let r=t.universal_exports??t;for(let i of Object.values(r)){if(typeof i!="function"||!i.prototype)continue;let o=i.prototype;typeof o.embedQuery!="function"||typeof o.embedDocuments!="function"||o.__sentry_patched__||(o.__sentry_patched__=!0,Td(o,n))}}};var VA=de(Ia,e=>new Ug(e)),q8=((e={})=>({name:Ia,setupOnce(){VA(e)}})),YA=q8;var Up=[">=0.0.0 <2.0.0"],Dg=class extends ae{constructor(t={}){super("@sentry/instrumentation-langgraph",q,t)}init(){return[new re("@langchain/langgraph",Up,this._patch.bind(this),t=>t,[new Ae("@langchain/langgraph/dist/index.cjs",Up,this._patch.bind(this),t=>t),new Ae("@langchain/langgraph/dist/prebuilt/index.cjs",Up,this._patch.bind(this),t=>t)]),new re("@langchain/langgraph/prebuilt",Up,this._patch.bind(this),t=>t,[new Ae("@langchain/langgraph/dist/prebuilt/index.cjs",Up,this._patch.bind(this),t=>t)])]}_patch(t){let r=C()?.getDataCollectionOptions().genAI,i={...this.getConfig(),recordInputs:this.getConfig().recordInputs??r?.inputs??!1,recordOutputs:this.getConfig().recordOutputs??r?.outputs??!1};if(t.StateGraph&&typeof t.StateGraph=="function"&&Nl(t.StateGraph.prototype,i),t.createReactAgent&&typeof t.createReactAgent=="function"){let o=t.createReactAgent;Object.defineProperty(t,"createReactAgent",{value:oy(o,i),writable:!0,enumerable:!0,configurable:!0})}return t}};var jA=de(va,e=>new Dg(e)),Q8=((e={})=>({name:va,setupOnce(){jA(e)}})),ZA=Q8;var J8=e=>(It()||Me(()=>{console.warn("The launchDarklyIntegration() can only be used in the browser.")}),{name:"LaunchDarkly"});function $8(){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 z8=e=>(It()||Me(()=>{console.warn("The openFeatureIntegration() can only be used in the browser.")}),{name:"OpenFeature"}),XA=class{constructor(){It()||Me(()=>{console.warn("The OpenFeatureIntegrationHook can only be used in the browser.")})}after(){}error(){}};var eee=e=>(It()||Me(()=>{console.warn("The statsigIntegration() can only be used in the browser.")}),{name:"Statsig"});var tee=e=>(It()||Me(()=>{console.warn("The unleashIntegration() can only be used in the browser.")}),{name:"Unleash"});var nee=kb;import*as rF from"net";function iF(e,t,n){let r=new re("@firebase/firestore",e,o=>nF(o,t,n)),i=["@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 o of i)r.files.push(new Ae(o,e,s=>nF(s,t,n),s=>oF(s,n)));return r}function nF(e,t,n){return oF(e,n),t(e,"addDoc",ree()),t(e,"getDocs",oee()),t(e,"setDoc",see()),t(e,"deleteDoc",iee()),e}function oF(e,t){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])w(e[n])&&t(e,n);return e}function ree(){return function(t){return function(n,r){return Bg("addDoc",n,()=>t(n,r))}}}function iee(){return function(t){return function(n){return Bg("deleteDoc",n.parent||n,()=>t(n))}}}function oee(){return function(t){return function(n){return Bg("getDocs",n,()=>t(n))}}}function see(){return function(t){return function(n,r,i){return Bg("setDoc",n.parent||n,()=>typeof i<"u"?t(n,r,i):t(n,r))}}}function Bg(e,t,n){return Se({name:`${e} ${t.path}`,op:"db.query",kind:U.CLIENT,attributes:{[S]:"auto.firebase.otel.firestore",[ar]:e,...cee(t)}},n)}function aee(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(rF.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 cee(e){let t=e.firestore.app,n=t.options,i=(e.firestore.toJSON()||{}).settings||{},o={[Qs]:e.path,[fi]: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}=aee(i);return s&&(o[_t]=s),c&&(o[ht]=c),o}function sF(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:o,triggerType:s})=>{r.files.push(new Ae(o,e,c=>lee(c,t,n,s),c=>aF(c,n)))}),r}function un(e){return function(n){return function(...r){let i=typeof r[0]=="function"?r[0]:r[1],o=typeof r[0]=="function"?void 0:r[0];if(!i)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:U.SERVER,attributes:l},async p=>{try{let u=await i.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 Yo(2e3),u}})};return o?n.call(this,o,s):n.call(this,s)}}}function lee(e,t,n,r){switch(aF(e,n),r){case"function":t(e,"onRequest",un("http.request")),t(e,"onCall",un("http.call"));break;case"firestore":t(e,"onDocumentCreated",un("firestore.document.created")),t(e,"onDocumentUpdated",un("firestore.document.updated")),t(e,"onDocumentDeleted",un("firestore.document.deleted")),t(e,"onDocumentWritten",un("firestore.document.written")),t(e,"onDocumentCreatedWithAuthContext",un("firestore.document.created")),t(e,"onDocumentUpdatedWithAuthContext",un("firestore.document.updated")),t(e,"onDocumentDeletedWithAuthContext",un("firestore.document.deleted")),t(e,"onDocumentWrittenWithAuthContext",un("firestore.document.written"));break;case"scheduler":t(e,"onSchedule",un("scheduler.scheduled"));break;case"storage":t(e,"onObjectFinalized",un("storage.object.finalized")),t(e,"onObjectArchived",un("storage.object.archived")),t(e,"onObjectDeleted",un("storage.object.deleted")),t(e,"onObjectMetadataUpdated",un("storage.object.metadataUpdated"));break}return e}function aF(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 pee=[">=3.0.0 <5"],uee=[">=6.0.0 <7"],Hg=class extends ae{constructor(t={}){super("@sentry/instrumentation-firebase",q,t)}init(){let t=[];return t.push(iF(pee,this._wrap,this._unwrap)),t.push(sF(uee,this._wrap,this._unwrap)),t}};var cF="Firebase",KA=de(cF,()=>new Hg),dee=(()=>({name:cF,setupOnce(){KA()}})),qA=dee;function QA(){return[nE(),GE(),VE(),PT(),tT(),rT(),oT(),lT(),hT(),IT(),Jm(),CT(),MT(),GT(),_A(),yA(),QE(),MA(),$E(),YA(),ZA(),GA(),DA(),HA(),WA(),RT(),qA()]}function lF(){return[uM,tE,wT,wE,kf,xT,qE,LT,JE,eT,nT,iT,cT,TT,kf,WE,_T,gA,bA,LA,VA,wA,UA,vT,KA,BA,FA,jA]}at();var JA=1e6,Fg=Symbol.for("opentelemetry.js.api.1");function pF(e){if(he.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[Fg];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[Fg]=void 0,!he.setGlobalTracerProvider(e))return!1;let r=t[Fg];if(r){let{propagation:i,context:o,...s}=n;t[Fg]={...s,...r}}return!0}return!1}function $A(e,t={}){e.getOptions().debug&&wS();let[n,r]=gee(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function mee(e={}){let{debug:t}=e;t&&g.enable(),np(),fee(e.integrations).forEach(n=>{n(),t&&g.log(`[Sentry] Preloaded ${n.id} instrumentation`)})}function fee(e){let t=lF();return e?t.filter(n=>{let r=n.id;return e.some(i=>r===i||r.startsWith(`${i}.`))}):t}function gee(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||!!t.spanProcessors?.length))return _ee(e);let r=new $N({sampler:new Kl(e),resource:um("node"),forceFlushTimeoutMillis:500,spanProcessors:[new Xl({timeout:hee(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});pF(r),ci.setGlobalPropagator(new ja);let i=new Ql;return pe.setGlobalContextManager(i),[r,i.getAsyncLocalStorageLookup()]}function _ee(e){let t=new ql({resource:um("node")});if(!pF(t))return Ye&&g.warn("Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered."),[void 0,void 0];cs("SentryTracerProvider"),ci.setGlobalPropagator(new ja);let n=new Ql;return pe.setGlobalContextManager(n),e.on("spanEnd",r=>{pm(r,{finalizeStatus:!0})}),rt(e)&&e.on("preprocessSpan",lm),e.on("preprocessEvent",r=>{r.type==="transaction"&&(r.contexts={...r.contexts,otel:{resource:t.resource?.attributes,...r.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function hee(e){if(e!=null){if(e>JA)return Ye&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${JA}`),JA;if(e<=0||Number.isNaN(e)){Ye&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function uF(){return Lm().filter(t=>t.name!=="Http"&&t.name!=="NodeFetch").concat(JS(),$S())}function dF(e){return[...uF(),...Ue(e)?QA():[]]}function bee(e,t){if(ec()&&Ue(t)){let n=pT();if(n){let r=new Set(n.replacedOtelIntegrationNames);return[...e.filter(i=>!r.has(i.name)),...n.integrations]}}return e}function yee(e={}){return mF(e,dF)}function mF(e={},t){Ko(e,"node");let n=ec()&&Ue(e)?pT():void 0;n&&n.register();let r=e.defaultIntegrations??t(e);if(n&&Array.isArray(r)&&r.length>0){let o=new Set(n.replacedOtelIntegrationNames);r=[...r.filter(s=>!o.has(s.name)),...n.integrations]}let i=YS({...e,defaultIntegrations:r});return i&&!e.skipOpenTelemetrySetup&&($A(i,{spanProcessors:e.openTelemetrySpanProcessors}),Mm()),n&&n.detect(),i}function See(e={}){return mF(e,()=>[])}import*as vte from"module";import"url";import{isMainThread as Rte,parentPort as Ote}from"worker_threads";var Dp=[...BT,...HT,...FT,...WT,...VT,...YT,...jT,...XT,...KT,...qT,...QT,...JT,...$T,...zT,...tI,...nI,...rI,...iI,...oI,...sI,...aI,...cI,...lI,...pI,...uI,...dI,...mI,...fI,...gI],T2e=[...lG,...uG,...mG,...gG,...hG,...yG,...EG,...IG,...NG,...RG,...CG,...PG,...MG,...GG,...HG,...VG,...jG,...XG,...JG,...zG,...tU,...rU,...oU,...aU,...lU,...uU,...mU,...gU,...hU];function Eee(e=[]){return[...nl([...Dp,...e].map(t=>t.module.name)),"@remix-run/node"]}var I2e=Eee();function Eo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gF=Tee;function Tee(e,t){let[n]=_F(e,"");for(let r of Aee(t))if(Iee(r,n))return!0;return!1}function Iee(e,t){for(let[n,r]of e)if(!Ree(t,r,n))return!1;return!0}function fF(e){return e==="latest"&&(e=">=0"),e.match(/^([^\d+]*)(\d.*)$/)||[null,"","*.*.*"]}function Aee(e){let t=[],n=[],r=e.trim().split(/\s+/);for(let i=0;i<r.length;i++){let o=r[i];if(o==="-")continue;if(o==="||"){t.push(n),n=[];continue}if(/^[<>=~v^]+$/.test(o)&&i+1<r.length){r[i+1]=o+r[i+1];continue}let s=fF(o),c=s[1]||"=";c.endsWith("v")&&(c=c.slice(0,-1));let[a,l]=_F(s[2],c);if(i+2<r.length&&r[i+1]==="-"){let p=fF(r[i+2]);r[i+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?hc(a,0):hc(a,1)])}else if(l[0]==="^"){let p=a[0]!==0?0:a[1]!==0?1:2;n.push([">=",a]),n.push(["<",p===0?hc(a,0):p===1?hc(a,1):hc(a,2)])}else n.push([l.replace("~","").replace("^",""),a])}return n.length&&t.push(n),t}function hc(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 Nee(e){return e==="x"||e==="X"||e==="*"||e==="latest"?-1:Number(e)}function vee(e){return/^\d+$/.test(e)?Number(e):e}function To(e,t,n){return n===-1?e!=="<":e==="="?t===n:e===">"?t>n:e===">="?t>=n:e==="<"?t<n:e==="<="?t<=n:!1}function _F(e,t){e=e.split("+")[0];let[n,r]=e.split("-"),i=n.split(".").map(Nee).slice(0,3),o=Math.max(i.length-1,0);return t===">"?(t=">=",i.push(0,0,0),i[o]++):t===""?i.push(0,0,0):i.push(-1,-1,-1),r?[i.slice(0,3).concat(r.split(".").map(vee)),t]:[i.slice(0,3),t]}function Ree(e,t,n){if(!To("=",e[0],t[0]))return To(n,e[0],t[0]);if(!To("=",e[1],t[1]))return To(n,e[1],t[1]);if(!To("=",e[2],t[2])||e.length===3&&t.length===3)return To(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(To(n,e[r]||"",t[r]||""))return!0;return!1}function eN(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 nN(e,t){return(function(n){if(Array.isArray(n))return n})(e)||(function(n,r){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var o,s,c,a,l=[],p=!0,u=!1;try{if(c=(i=i.call(n)).next,r!==0)for(;!(p=(o=c.call(i)).done)&&(l.push(o.value),l.length!==r);p=!0);}catch(d){u=!0,s=d}finally{try{if(!p&&i.return!=null&&(a=i.return(),Object(a)!==a))return}finally{if(u)throw s}}return l}})(e,t)||EF(e,t)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
35
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Oee(e){return(function(t){if(Array.isArray(t))return eN(t)})(e)||(function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)})(e)||EF(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
36
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Bp(e){return(Bp=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 EF(e,t){if(e){if(typeof e=="string")return eN(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)?eN(e,t):void 0}}function TF(e,t){return e(t={exports:{}},t.exports),t.exports}var Wg=TF((function(e,t){(function n(r){var i,o,s,c,a,l;function p(R){var v,P,D={};for(v in R)R.hasOwnProperty(v)&&(P=R[v],D[v]=typeof P=="object"&&P!==null?p(P):P);return D}function u(R,v){this.parent=R,this.key=v}function d(R,v,P,D){this.node=R,this.path=v,this.wrap=P,this.ref=D}function m(){}function _(R){return R!=null&&typeof R=="object"&&typeof R.type=="string"}function h(R,v){return(R===i.ObjectExpression||R===i.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 M(R,v){var P;return P=(function(D,I){var H,L,G,ce;for(L=D.length,G=0;L;)I(D[ce=G+(H=L>>>1)])?L=H:(G=ce+1,L-=H+1);return G})(v,(function(D){return D.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 i={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"]},o={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,D,I;function H(L,G){if(Array.isArray(G))for(P=0,D=G.length;P<D;++P)L.push(G[P]);else L.push(G)}if(!this.__current.path)return null;for(I=[],R=2,v=this.__leavelist.length;R<v;++R)H(I,this.__leavelist[R].path);return H(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,D;return D=void 0,P=this.__current,this.__current=v,this.__state=null,R&&(D=R.call(this,v.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=P,D},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,D,I,H,L,G,ce,ge,Ne,Te,Ce,qe;for(this.__initialize(R,v),qe={},P=this.__worklist,D=this.__leavelist,P.push(new d(R,null,null,null)),D.push(new d(null,null,null,null));P.length;)if((I=P.pop())!==qe){if(I.node){if(G=this.__execute(v.enter,I),this.__state===c||G===c)return;if(P.push(qe),D.push(I),this.__state===a||G===a)continue;if(L=(H=I.node).type||I.wrap,!(Te=this.__keys[L])){if(!this.__fallback)throw new Error("Unknown node type "+L+".");Te=this.__fallback(H)}for(ge=Te.length;(ge-=1)>=0;)if(Ce=H[ce=Te[ge]]){if(Array.isArray(Ce)){for(Ne=Ce.length;(Ne-=1)>=0;)if(Ce[Ne]&&!b(D,Ce[Ne])){if(h(L,Te[ge]))I=new d(Ce[Ne],[ce,Ne],"Property",null);else{if(!_(Ce[Ne]))continue;I=new d(Ce[Ne],[ce,Ne],null,null)}P.push(I)}}else if(_(Ce)){if(b(D,Ce))continue;P.push(new d(Ce,ce,null,null))}}}}else if(I=D.pop(),G=this.__execute(v.leave,I),this.__state===c||G===c)return},m.prototype.replace=function(R,v){var P,D,I,H,L,G,ce,ge,Ne,Te,Ce,qe,Nt;function Sn(ii){var oi,vo,Ro,Ac;if(ii.ref.remove()){for(vo=ii.ref.key,Ac=ii.ref.parent,oi=P.length;oi--;)if((Ro=P[oi]).ref&&Ro.ref.parent===Ac){if(Ro.ref.key<vo)break;--Ro.ref.key}}}for(this.__initialize(R,v),Ce={},P=this.__worklist,D=this.__leavelist,G=new d(R,null,null,new u(qe={root:R},"root")),P.push(G),D.push(G);P.length;)if((G=P.pop())!==Ce){if((L=this.__execute(v.enter,G))!==void 0&&L!==c&&L!==a&&L!==l&&(G.ref.replace(L),G.node=L),this.__state!==l&&L!==l||(Sn(G),G.node=null),this.__state===c||L===c)return qe.root;if((I=G.node)&&(P.push(Ce),D.push(G),this.__state!==a&&L!==a)){if(H=I.type||G.wrap,!(Ne=this.__keys[H])){if(!this.__fallback)throw new Error("Unknown node type "+H+".");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(H,Ne[ce]))G=new d(Te[ge],[Nt,ge],"Property",new u(Te,ge));else{if(!_(Te[ge]))continue;G=new d(Te[ge],[Nt,ge],null,new u(Te,ge))}P.push(G)}}else _(Te)&&P.push(new d(Te,Nt,null,new u(I,Nt)))}}else if(G=D.pop(),(L=this.__execute(v.leave,G))!==void 0&&L!==c&&L!==a&&L!==l&&G.ref.replace(L),this.__state!==l&&L!==l||Sn(G),this.__state===c||L===c)return qe.root;return qe.root},r.Syntax=i,r.traverse=N,r.replace=function(R,v){return new m().replace(R,v)},r.attachComments=function(R,v,P){var D,I,H,L,G=[];if(!R.range)throw new Error("attachComments needs range information");if(!P.length){if(v.length){for(H=0,I=v.length;H<I;H+=1)(D=p(v[H])).extendedRange=[0,R.range[0]],G.push(D);R.leadingComments=G}return R}for(H=0,I=v.length;H<I;H+=1)G.push(M(p(v[H]),P));return L=0,N(R,{enter:function(ce){for(var ge;L<G.length&&!((ge=G[L]).extendedRange[1]>ce.range[0]);)ge.extendedRange[1]===ce.range[0]?(ce.leadingComments||(ce.leadingComments=[]),ce.leadingComments.push(ge),G.splice(L,1)):L+=1;return L===G.length?o.Break:G[L].extendedRange[0]>ce.range[1]?o.Skip:void 0}}),L=0,N(R,{leave:function(ce){for(var ge;L<G.length&&(ge=G[L],!(ce.range[1]<ge.extendedRange[0]));)ce.range[1]===ge.extendedRange[0]?(ce.trailingComments||(ce.trailingComments=[]),ce.trailingComments.push(ge),G.splice(L,1)):L+=1;return L===G.length?o.Break:G[L].extendedRange[0]>ce.range[1]?o.Skip:void 0}}),R},r.VisitorKeys=s,r.VisitorOption=o,r.Controller=m,r.cloneEnvironment=function(){return n({})},r})(t)})),Cee=TF((function(e){e.exports&&(e.exports=(function(){function t(n,r,i,o){this.message=n,this.expected=r,this.found=i,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)}return(function(n,r){function i(){this.constructor=n}i.prototype=r.prototype,n.prototype=new i})(t,Error),t.buildMessage=function(n,r){var i={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 o(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"+o(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+o(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"+o(l)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(l){return"\\x"+o(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],i[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 i,o,s,c,a={},l={start:BN},p=BN,u=Xe(" ",!1),d=/^[^ [\],():#!=><~+.]/,m=Er([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),_=Xe(">",!1),h=Xe("~",!1),b=Xe("+",!1),N=Xe(",",!1),M=function(T,F){return[T].concat(F.map((function(Y){return Y[3]})))},R=Xe("!",!1),v=Xe("*",!1),P=Xe("#",!1),D=Xe("[",!1),I=Xe("]",!1),H=/^[><!]/,L=Er([">","<","!"],!1,!1),G=Xe("=",!1),ce=function(T){return(T||"")+"="},ge=/^[><]/,Ne=Er([">","<"],!1,!1),Te=Xe(".",!1),Ce=function(T,F,Y){return{type:"attribute",name:T,operator:F,value:Y}},qe=Xe('"',!1),Nt=/^[^\\"]/,Sn=Er(["\\",'"'],!0,!1),ii=Xe("\\",!1),oi={type:"any"},vo=function(T,F){return T+F},Ro=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`
|
|
37
|
-
`;case"r":return"\r";case"t":return" ";case"v":return"\v";default:return y}})))};var F},Ac=Xe("'",!1),NN=/^[^\\']/,vN=Er(["\\","'"],!0,!1),wi=/^[0-9]/,Gi=Er([["0","9"]],!1,!1),p2=Xe("type(",!1),RN=/^[^ )]/,ON=Er([" ",")"],!0,!1),Oo=Xe(")",!1),CN=/^[imsu]/,xN=Er(["i","m","s","u"],!1,!1),PN=Xe("/",!1),kN=/^[^\]\\]/,LN=Er(["]","\\"],!0,!1),MN=/^[^\/\\[]/,wN=Er(["/","\\","["],!0,!1),u2=Xe(":not(",!1),d2=Xe(":matches(",!1),GN=function(T){return{type:"matches",selectors:T}},m2=Xe(":is(",!1),f2=Xe(":has(",!1),g2=Xe(":first-child",!1),_2=Xe(":last-child",!1),h2=Xe(":nth-child(",!1),b2=Xe(":nth-last-child(",!1),y2=Xe(":",!1),f=0,Wp=[{line:1,column:1}],Sr=0,i_=[],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 Er(T,F,Y){return{type:"class",parts:T,inverted:F,ignoreCase:Y}}function UN(T){var F,Y=Wp[T];if(Y)return Y;for(F=T-1;!Wp[F];)F--;for(Y={line:(Y=Wp[F]).line,column:Y.column};F<T;)n.charCodeAt(F)===10?(Y.line++,Y.column=1):Y.column++,F++;return Wp[T]=Y,Y}function DN(T,F){var Y=UN(T),y=UN(F);return{start:{offset:T,line:Y.line,column:Y.column},end:{offset:F,line:y.line,column:y.column}}}function j(T){f<Sr||(f>Sr&&(Sr=f,i_=[]),i_.push(T))}function BN(){var T,F,Y,y,O=36*f+0,K=z[O];return K?(f=K.nextPos,K.result):(T=f,(F=Oe())!==a&&(Y=Vp())!==a&&Oe()!==a?T=F=(y=Y).length===1?y[0]:{type:"matches",selectors:y}:(f=T,T=a),T===a&&(T=f,(F=Oe())!==a&&(F=void 0),T=F),z[O]={nextPos:f,result:T},T)}function Oe(){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 si(){var T,F,Y,y=36*f+2,O=z[y];if(O)return f=O.nextPos,O.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 o_(){var T,F,Y,y=36*f+3,O=z[y];return O?(f=O.nextPos,O.result):(T=f,(F=Oe())!==a?(n.charCodeAt(f)===62?(Y=">",f++):(Y=a,j(_)),Y!==a&&Oe()!==a?T=F="child":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,(F=Oe())!==a?(n.charCodeAt(f)===126?(Y="~",f++):(Y=a,j(h)),Y!==a&&Oe()!==a?T=F="sibling":(f=T,T=a)):(f=T,T=a),T===a&&(T=f,(F=Oe())!==a?(n.charCodeAt(f)===43?(Y="+",f++):(Y=a,j(b)),Y!==a&&Oe()!==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=Oe())!==a?T=F="descendant":(f=T,T=a)))),z[y]={nextPos:f,result:T},T)}function Vp(){var T,F,Y,y,O,K,X,_e,be=36*f+5,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(T=f,(F=Yp())!==a){for(Y=[],y=f,(O=Oe())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(N)),K!==a&&(X=Oe())!==a&&(_e=Yp())!==a?y=O=[O,K,X,_e]:(f=y,y=a)):(f=y,y=a);y!==a;)Y.push(y),y=f,(O=Oe())!==a?(n.charCodeAt(f)===44?(K=",",f++):(K=a,j(N)),K!==a&&(X=Oe())!==a&&(_e=Yp())!==a?y=O=[O,K,X,_e]:(f=y,y=a)):(f=y,y=a);Y!==a?T=F=M(F,Y):(f=T,T=a)}else f=T,T=a;return z[be]={nextPos:f,result:T},T}function s_(){var T,F,Y,y,O,K=36*f+6,X=z[K];return X?(f=X.nextPos,X.result):(T=f,(F=o_())===a&&(F=null),F!==a&&(Y=Yp())!==a?(O=Y,T=F=(y=F)?{type:y,left:{type:"exactNode"},right:O}:O):(f=T,T=a),z[K]={nextPos:f,result:T},T)}function Yp(){var T,F,Y,y,O,K,X,_e=36*f+7,be=z[_e];if(be)return f=be.nextPos,be.result;if(T=f,(F=a_())!==a){for(Y=[],y=f,(O=o_())!==a&&(K=a_())!==a?y=O=[O,K]:(f=y,y=a);y!==a;)Y.push(y),y=f,(O=o_())!==a&&(K=a_())!==a?y=O=[O,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 a_(){var T,F,Y,y,O,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=HN())!==a)for(;y!==a;)Y.push(y),y=HN();else Y=a;Y!==a?(O=F,X=(K=Y).length===1?K[0]:{type:"compound",selectors:K},O&&(X.subject=!0),T=F=X):(f=T,T=a)}else f=T,T=a;return z[_e]={nextPos:f,result:T},T}function HN(){var T,F=36*f+9,Y=z[F];return Y?(f=Y.nextPos,Y.result):((T=(function(){var y,O,K=36*f+10,X=z[K];return X?(f=X.nextPos,X.result):(n.charCodeAt(f)===42?(O="*",f++):(O=a,j(v)),O!==a&&(O={type:"wildcard",value:O}),y=O,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X=36*f+11,_e=z[X];return _e?(f=_e.nextPos,_e.result):(y=f,n.charCodeAt(f)===35?(O="#",f++):(O=a,j(P)),O===a&&(O=null),O!==a&&(K=si())!==a?y=O={type:"identifier",value:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+12,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.charCodeAt(f)===91?(O="[",f++):(O=a,j(D)),O!==a&&Oe()!==a&&(K=(function(){var ye,st,Mn,je,Qn=36*f+16,tn=z[Qn];return tn?(f=tn.nextPos,tn.result):(ye=f,(st=c_())!==a&&Oe()!==a&&(Mn=(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(G)),Ee!==a?(le=ce(le),Z=le):(f=Z,Z=a)):(f=Z,Z=a),z[W]={nextPos:f,result:Z},Z)})())!==a&&Oe()!==a?((je=(function(){var Z,le,Ee,W,Ie,Qe=36*f+20,wn=z[Qe];if(wn)return f=wn.nextPos,wn.result;if(Z=f,n.substr(f,5)==="type("?(le="type(",f+=5):(le=a,j(p2)),le!==a)if(Oe()!==a){if(Ee=[],RN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(ON)),W!==a)for(;W!==a;)Ee.push(W),RN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(ON));else Ee=a;Ee!==a&&(W=Oe())!==a?(n.charCodeAt(f)===41?(Ie=")",f++):(Ie=a,j(Oo)),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,wn=36*f+22,Tr=z[wn];if(Tr)return f=Tr.nextPos,Tr.result;if(Z=f,n.charCodeAt(f)===47?(le="/",f++):(le=a,j(PN)),le!==a){if(Ee=[],(W=FN())===a&&(W=jp())===a&&(W=WN()),W!==a)for(;W!==a;)Ee.push(W),(W=FN())===a&&(W=jp())===a&&(W=WN());else Ee=a;Ee!==a?(n.charCodeAt(f)===47?(W="/",f++):(W=a,j(PN)),W!==a?((Ie=(function(){var ai,Co,jN=36*f+21,l_=z[jN];if(l_)return f=l_.nextPos,l_.result;if(ai=[],CN.test(n.charAt(f))?(Co=n.charAt(f),f++):(Co=a,j(xN)),Co!==a)for(;Co!==a;)ai.push(Co),CN.test(n.charAt(f))?(Co=n.charAt(f),f++):(Co=a,j(xN));else ai=a;return z[jN]={nextPos:f,result:ai},ai})())===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[wn]={nextPos:f,result:Z},Z})()),je!==a?(st=Ce(st,Mn,je),ye=st):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(st=c_())!==a&&Oe()!==a&&(Mn=(function(){var Z,le,Ee,W=36*f+13,Ie=z[W];return Ie?(f=Ie.nextPos,Ie.result):(Z=f,H.test(n.charAt(f))?(le=n.charAt(f),f++):(le=a,j(L)),le===a&&(le=null),le!==a?(n.charCodeAt(f)===61?(Ee="=",f++):(Ee=a,j(G)),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&&Oe()!==a?((je=(function(){var Z,le,Ee,W,Ie,Qe,wn=36*f+17,Tr=z[wn];if(Tr)return f=Tr.nextPos,Tr.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(Sn)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ii)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(oi)),Qe!==a?(Ie=vo(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(Sn)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ii)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(oi)),Qe!==a?(Ie=vo(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=Ro(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(Ac)),le!==a){for(Ee=[],NN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(vN)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ii)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(oi)),Qe!==a?(Ie=vo(Ie,Qe),W=Ie):(f=W,W=a)):(f=W,W=a));W!==a;)Ee.push(W),NN.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(vN)),W===a&&(W=f,n.charCodeAt(f)===92?(Ie="\\",f++):(Ie=a,j(ii)),Ie!==a?(n.length>f?(Qe=n.charAt(f),f++):(Qe=a,j(oi)),Qe!==a?(Ie=vo(Ie,Qe),W=Ie):(f=W,W=a)):(f=W,W=a));Ee!==a?(n.charCodeAt(f)===39?(W="'",f++):(W=a,j(Ac)),W!==a?(le=Ro(Ee),Z=le):(f=Z,Z=a)):(f=Z,Z=a)}else f=Z,Z=a;return z[wn]={nextPos:f,result:Z},Z})())===a&&(je=(function(){var Z,le,Ee,W,Ie,Qe,wn,Tr=36*f+18,ai=z[Tr];if(ai)return f=ai.nextPos,ai.result;for(Z=f,le=f,Ee=[],wi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Gi));W!==a;)Ee.push(W),wi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Gi));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=[],wi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Gi)),W!==a)for(;W!==a;)Ee.push(W),wi.test(n.charAt(f))?(W=n.charAt(f),f++):(W=a,j(Gi));else Ee=a;Ee!==a?(Qe=Ee,wn=(Ie=le)?[].concat.apply([],Ie).join(""):"",le={type:"literal",value:parseFloat(wn+Qe.join(""))},Z=le):(f=Z,Z=a)}else f=Z,Z=a;return z[Tr]={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=si())!==a&&(le={type:"literal",value:le}),Z=le,z[Ee]={nextPos:f,result:Z},Z)})()),je!==a?(st=Ce(st,Mn,je),ye=st):(f=ye,ye=a)):(f=ye,ye=a),ye===a&&(ye=f,(st=c_())!==a&&(st={type:"attribute",name:st}),ye=st)),z[Qn]={nextPos:f,result:ye},ye)})())!==a&&Oe()!==a?(n.charCodeAt(f)===93?(X="]",f++):(X=a,j(I)),X!==a?y=O=K:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e,be,ye,st,Mn=36*f+26,je=z[Mn];if(je)return f=je.nextPos,je.result;if(y=f,n.charCodeAt(f)===46?(O=".",f++):(O=a,j(Te)),O!==a)if((K=si())!==a){for(X=[],_e=f,n.charCodeAt(f)===46?(be=".",f++):(be=a,j(Te)),be!==a&&(ye=si())!==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=si())!==a?_e=be=[be,ye]:(f=_e,_e=a);X!==a?(st=K,O={type:"field",name:X.reduce((function(Qn,tn){return Qn+tn[0]+tn[1]}),st)},y=O):(f=y,y=a)}else f=y,y=a;else f=y,y=a;return z[Mn]={nextPos:f,result:y},y})())===a&&(T=(function(){var y,O,K,X,_e=36*f+27,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":not("?(O=":not(",f+=5):(O=a,j(u2)),O!==a&&Oe()!==a&&(K=Vp())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Oo)),X!==a?y=O={type:"not",selectors:K}:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+28,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,9)===":matches("?(O=":matches(",f+=9):(O=a,j(d2)),O!==a&&Oe()!==a&&(K=Vp())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Oo)),X!==a?(O=GN(K),y=O):(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+29,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,4)===":is("?(O=":is(",f+=4):(O=a,j(m2)),O!==a&&Oe()!==a&&(K=Vp())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Oo)),X!==a?(O=GN(K),y=O):(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K,X,_e=36*f+30,be=z[_e];return be?(f=be.nextPos,be.result):(y=f,n.substr(f,5)===":has("?(O=":has(",f+=5):(O=a,j(f2)),O!==a&&Oe()!==a&&(K=(function(){var ye,st,Mn,je,Qn,tn,Z,le,Ee=36*f+4,W=z[Ee];if(W)return f=W.nextPos,W.result;if(ye=f,(st=s_())!==a){for(Mn=[],je=f,(Qn=Oe())!==a?(n.charCodeAt(f)===44?(tn=",",f++):(tn=a,j(N)),tn!==a&&(Z=Oe())!==a&&(le=s_())!==a?je=Qn=[Qn,tn,Z,le]:(f=je,je=a)):(f=je,je=a);je!==a;)Mn.push(je),je=f,(Qn=Oe())!==a?(n.charCodeAt(f)===44?(tn=",",f++):(tn=a,j(N)),tn!==a&&(Z=Oe())!==a&&(le=s_())!==a?je=Qn=[Qn,tn,Z,le]:(f=je,je=a)):(f=je,je=a);Mn!==a?ye=st=M(st,Mn):(f=ye,ye=a)}else f=ye,ye=a;return z[Ee]={nextPos:f,result:ye},ye})())!==a&&Oe()!==a?(n.charCodeAt(f)===41?(X=")",f++):(X=a,j(Oo)),X!==a?y=O={type:"has",selectors:K}:(f=y,y=a)):(f=y,y=a),z[_e]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K=36*f+31,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,12)===":first-child"?(O=":first-child",f+=12):(O=a,j(g2)),O!==a&&(O=VN(1)),y=O,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,K=36*f+32,X=z[K];return X?(f=X.nextPos,X.result):(n.substr(f,11)===":last-child"?(O=":last-child",f+=11):(O=a,j(_2)),O!==a&&(O=YN(1)),y=O,z[K]={nextPos:f,result:y},y)})())===a&&(T=(function(){var y,O,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("?(O=":nth-child(",f+=11):(O=a,j(h2)),O!==a)if(Oe()!==a){if(K=[],wi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Gi)),X!==a)for(;X!==a;)K.push(X),wi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Gi));else K=a;K!==a&&(X=Oe())!==a?(n.charCodeAt(f)===41?(_e=")",f++):(_e=a,j(Oo)),_e!==a?(O=VN(parseInt(K.join(""),10)),y=O):(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,O,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("?(O=":nth-last-child(",f+=16):(O=a,j(b2)),O!==a)if(Oe()!==a){if(K=[],wi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Gi)),X!==a)for(;X!==a;)K.push(X),wi.test(n.charAt(f))?(X=n.charAt(f),f++):(X=a,j(Gi));else K=a;K!==a&&(X=Oe())!==a?(n.charCodeAt(f)===41?(_e=")",f++):(_e=a,j(Oo)),_e!==a?(O=YN(parseInt(K.join(""),10)),y=O):(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,O,K,X=36*f+35,_e=z[X];return _e?(f=_e.nextPos,_e.result):(y=f,n.charCodeAt(f)===58?(O=":",f++):(O=a,j(y2)),O!==a&&(K=si())!==a?y=O={type:"class",name:K}:(f=y,y=a),z[X]={nextPos:f,result:y},y)})()),z[F]={nextPos:f,result:T},T)}function c_(){var T,F,Y,y,O,K,X,_e,be=36*f+15,ye=z[be];if(ye)return f=ye.nextPos,ye.result;if(T=f,(F=si())!==a){for(Y=[],y=f,n.charCodeAt(f)===46?(O=".",f++):(O=a,j(Te)),O!==a&&(K=si())!==a?y=O=[O,K]:(f=y,y=a);y!==a;)Y.push(y),y=f,n.charCodeAt(f)===46?(O=".",f++):(O=a,j(Te)),O!==a&&(K=si())!==a?y=O=[O,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 FN(){var T,F,Y,y,O=36*f+23,K=z[O];if(K)return f=K.nextPos,K.result;if(T=f,n.charCodeAt(f)===91?(F="[",f++):(F=a,j(D)),F!==a){if(Y=[],kN.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(LN)),y===a&&(y=jp()),y!==a)for(;y!==a;)Y.push(y),kN.test(n.charAt(f))?(y=n.charAt(f),f++):(y=a,j(LN)),y===a&&(y=jp());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[O]={nextPos:f,result:T},T}function jp(){var T,F,Y,y=36*f+24,O=z[y];return O?(f=O.nextPos,O.result):(T=f,n.charCodeAt(f)===92?(F="\\",f++):(F=a,j(ii)),F!==a?(n.length>f?(Y=n.charAt(f),f++):(Y=a,j(oi)),Y!==a?T=F="\\"+Y:(f=T,T=a)):(f=T,T=a),z[y]={nextPos:f,result:T},T)}function WN(){var T,F,Y,y=36*f+25,O=z[y];if(O)return f=O.nextPos,O.result;if(F=[],MN.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(wN)),Y!==a)for(;Y!==a;)F.push(Y),MN.test(n.charAt(f))?(Y=n.charAt(f),f++):(Y=a,j(wN));else F=a;return F!==a&&(F=F.join("")),T=F,z[y]={nextPos:f,result:T},T}function VN(T){return{type:"nth-child",index:{type:"literal",value:T}}}function YN(T){return{type:"nth-last-child",index:{type:"literal",value:T}}}if((i=p())!==a&&f===n.length)return i;throw i!==a&&f<n.length&&j({type:"end"}),o=i_,s=Sr<n.length?n.charAt(Sr):null,c=Sr<n.length?DN(Sr,Sr+1):DN(Sr,Sr),new t(t.buildMessage(o,s),o,s,c)}}})())}));function yr(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var zA=typeof WeakMap=="function"?new WeakMap:null;function Vt(e){if(e==null)return function(){return!0};if(zA!=null){var t=zA.get(e);return t!=null||(t=hF(e),zA.set(e,t)),t}return hF(e)}function hF(e){switch(e.type){case"wildcard":return function(){return!0};case"identifier":var t=e.value.toLowerCase();return function(I,H,L){var G=L&&L.nodeTypeKey||"type";return t===I[G].toLowerCase()};case"exactNode":return function(I,H){return H.length===0};case"field":var n=e.name.split(".");return function(I,H){return(function L(G,ce,ge,Ne){for(var Te=ce,Ce=Ne;Ce<ge.length;++Ce){if(Te==null)return!1;var qe=Te[ge[Ce]];if(Array.isArray(qe)){for(var Nt=0;Nt<qe.length;++Nt)if(L(G,qe[Nt],ge,Ce+1))return!0;return!1}Te=qe}return G===Te})(I,H[n.length-1],n,0)};case"matches":var r=e.selectors.map(Vt);return function(I,H,L){for(var G=0;G<r.length;++G)if(r[G](I,H,L))return!0;return!1};case"compound":var i=e.selectors.map(Vt);return function(I,H,L){for(var G=0;G<i.length;++G)if(!i[G](I,H,L))return!1;return!0};case"not":var o=e.selectors.map(Vt);return function(I,H,L){for(var G=0;G<o.length;++G)if(o[G](I,H,L))return!1;return!0};case"has":var s=e.selectors.map(Vt);return function(I,H,L){var G=!1,ce=[];return Wg.traverse(I,{enter:function(ge,Ne){Ne!=null&&ce.unshift(Ne);for(var Te=0;Te<s.length;++Te)if(s[Te](ge,ce,L))return G=!0,void this.break()},leave:function(){ce.shift()},keys:L&&L.visitorKeys,fallback:L&&L.fallback||"iteration"}),G};case"child":var c=Vt(e.left),a=Vt(e.right);return function(I,H,L){return!!(H.length>0&&a(I,H,L))&&c(H[0],H.slice(1),L)};case"descendant":var l=Vt(e.left),p=Vt(e.right);return function(I,H,L){if(p(I,H,L)){for(var G=0,ce=H.length;G<ce;++G)if(l(H[G],H.slice(G+1),L))return!0}return!1};case"attribute":var u=e.name.split(".");switch(e.operator){case void 0:return function(I){return yr(I,u)!=null};case"=":switch(e.value.type){case"regexp":return function(I){var H=yr(I,u);return typeof H=="string"&&e.value.value.test(H)};case"literal":var d="".concat(e.value.value);return function(I){return d==="".concat(yr(I,u))};case"type":return function(I){return e.value.value===Bp(yr(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(yr(I,u))};case"literal":var m="".concat(e.value.value);return function(I){return m!=="".concat(yr(I,u))};case"type":return function(I){return e.value.value!==Bp(yr(I,u))}}throw new Error("Unknown selector value type: ".concat(e.value.type));case"<=":return function(I){return yr(I,u)<=e.value.value};case"<":return function(I){return yr(I,u)<e.value.value};case">":return function(I){return yr(I,u)>e.value.value};case">=":return function(I){return yr(I,u)>=e.value.value}}throw new Error("Unknown operator: ".concat(e.operator));case"sibling":var _=Vt(e.left),h=Vt(e.right);return function(I,H,L){return h(I,H,L)&&bF(I,_,H,"LEFT_SIDE",L)||e.left.subject&&_(I,H,L)&&bF(I,h,H,"RIGHT_SIDE",L)};case"adjacent":var b=Vt(e.left),N=Vt(e.right);return function(I,H,L){return N(I,H,L)&&yF(I,b,H,"LEFT_SIDE",L)||e.right.subject&&b(I,H,L)&&yF(I,N,H,"RIGHT_SIDE",L)};case"nth-child":var M=e.index.value,R=Vt(e.right);return function(I,H,L){return R(I,H,L)&&SF(I,H,M,L)};case"nth-last-child":var v=-e.index.value,P=Vt(e.right);return function(I,H,L){return P(I,H,L)&&SF(I,H,v,L)};case"class":var D=e.name.toLowerCase();return function(I,H,L){if(L&&L.matchClass)return L.matchClass(e.name,I,H);if(L&&L.nodeTypeKey)return!1;switch(D){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"&&(H.length===0||H[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 rN(e,t){var n=t&&t.nodeTypeKey||"type",r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:Wg.VisitorKeys[r]?Wg.VisitorKeys[r]:t&&typeof t.fallback=="function"?t.fallback(e):Object.keys(e).filter((function(i){return i!==n}))}function tN(e,t){var n=t&&t.nodeTypeKey||"type";return e!==null&&Bp(e)==="object"&&typeof e[n]=="string"}function bF(e,t,n,r,i){var o=nN(n,1)[0];if(!o)return!1;for(var s=rN(o,i),c=0;c<s.length;++c){var a=o[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(tN(a[d],i)&&t(a[d],n,i))return!0}}return!1}function yF(e,t,n,r,i){var o=nN(n,1)[0];if(!o)return!1;for(var s=rN(o,i),c=0;c<s.length;++c){var a=o[s[c]];if(Array.isArray(a)){var l=a.indexOf(e);if(l<0)continue;if(r==="LEFT_SIDE"&&l>0&&tN(a[l-1],i)&&t(a[l-1],n,i)||r==="RIGHT_SIDE"&&l<a.length-1&&tN(a[l+1],i)&&t(a[l+1],n,i))return!0}}return!1}function SF(e,t,n,r){if(n===0)return!1;var i=nN(t,1)[0];if(!i)return!1;for(var o=rN(i,r),s=0;s<o.length;++s){var c=i[o[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 IF(e,t,n,r){if(t){var i=[],o=Vt(t),s=(function c(a,l){if(a==null||Bp(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,Oee(c(_,m==="left"?_:l)))}return p})(t).map(Vt);Wg.traverse(e,{enter:function(c,a){if(a!=null&&i.unshift(a),o(c,i,r))if(s.length)for(var l=0,p=s.length;l<p;++l){s[l](c,i,r)&&n(c,a,i);for(var u=0,d=i.length;u<d;++u){var m=i.slice(u+1);s[l](i[u],m,r)&&n(i[u],a,m)}}else n(c,a,i)},leave:function(){i.shift()},keys:r&&r.visitorKeys,fallback:r&&r.fallback||"iteration"})}}function AF(e,t,n){var r=[];return IF(e,t,(function(i){r.push(i)}),n),r}function NF(e){return Cee.parse(e)}function ni(e,t,n){return AF(e,NF(t),n)}ni.parse=NF,ni.match=AF,ni.traverse=IF,ni.matches=function(e,t,n,r){return!t||!!e&&(n||(n=[]),Vt(t)(e,n,r))},ni.query=ni;var Vg={};var vF={};var iN={exports:{}};var oN=ni,{parse:dn}=Vg,RF=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name==="tr_ch_apm_tracingChannel",xee=/[^\w]/g,Is=e=>`tr_ch_apm$${e.replace(xee,"_")}`,sN=iN.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(RF))return;let r={module:t==="esm"},i=n.body.findIndex(a=>a.directive==="use strict"),o=t==="esm"?`import tr_ch_apm_dc from "${e}"`:`const tr_ch_apm_dc = require("${e}")`;n.body.splice(i+1,0,dn(o,r).body[0],dn("const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc",r).body[0],dn(`const tr_ch_apm_hasSubscribers = ch => ch.start.hasSubscribers
|
|
38
|
-
|| ch.end.hasSubscribers
|
|
39
|
-
|| ch.asyncStart.hasSubscribers
|
|
40
|
-
|| ch.asyncEnd.hasSubscribers
|
|
41
|
-
|| ch.error.hasSubscribers`,r).body[0])},tracingChannelDeclaration(e,t){let{channelName:n,module:{name:r}}=e,i=Is(n);if(t.body.some(c=>c.declarations?.[0]?.id?.name===i))return;sN.tracingChannelImport(e,t);let o=t.body.findIndex(RF),s=`
|
|
42
|
-
const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
|
|
43
|
-
`;t.body.splice(o+1,0,dn(s).body[0])},traceCallback:Yg,tracePromise:Yg,traceSync:Yg,traceAuto:Yg};function Pee(e){return[...(e||[]).filter(r=>r.type!=="RestElement"&&r.type!=="AssignmentPattern").map((r,i)=>({type:"Identifier",name:`__apm$arg${i}`})),{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}]}function Yg(e,t,n,r){let i=r[r.length-1];t.type==="ClassDeclaration"||t.type==="ClassExpression"?Lee(e,t,i):kee(e,t,i)}function kee(e,t,n){sN.tracingChannelDeclaration(e,n);let{functionQuery:{methodName:r,privateMethodName:i,functionName:o,expressionName:s,propertyName:c}}=e,l=r==="constructor"||!r&&!i&&!o&&!s&&!c?"ArrowFunctionExpression":t.type,p=t.params;t.body=OF(e,{type:l,params:p,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=Pee(p),t.generator=!1,t.async=!1,CF(e,t)}function Lee(e,t,n){let{functionQuery:r,operator:i}=e,{methodName:o}=r;if(!o)return;let s=t.body;if(s.body.some(({key:p})=>p.name===o))return;let c=s.body.find(({kind:p})=>p==="constructor");sN.tracingChannelDeclaration(e,n),c||(c=dn(t.superClass?"class A extends Object { constructor (...args) { super(...args) } }":"class A { constructor () {} }").body[0].body.body[0],s.body.unshift(c));let a=dn(`
|
|
44
|
-
const __apm$${o} = this["${o}"]
|
|
45
|
-
this["${o}"] = function () {}
|
|
46
|
-
if (typeof __apm$${o} === 'function') {
|
|
47
|
-
Object.defineProperty(this["${o}"], 'length', {
|
|
48
|
-
value: __apm$${o}.length,
|
|
49
|
-
configurable: true
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
`).body,l=a[1].expression.right;l.params=[{type:"RestElement",argument:{type:"Identifier",name:"__apm$args"}}],l.async=i==="tracePromise",l.body=OF(e,{type:"Identifier",name:`__apm$${o}`},n),CF(e,l),c.value.body.body.push(...a)}function OF(e,t,n){let{operator:r,moduleVersion:i}=e,{returnKind:o}=e.functionQuery,s=o?Uee(e,o,n):"",c;r==="traceCallback"&&(c=xF(e,t,s)),r==="tracePromise"&&(c=PF(e,t,s)),r==="traceSync"&&(c=wee(e,t,s)),r==="traceAuto"&&(c=Mee(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=dn(t.type==="ArrowFunctionExpression"?`
|
|
53
|
-
const __apm$arguments = [${a}];
|
|
54
|
-
const __apm$ctx = {
|
|
55
|
-
arguments: __apm$arguments,
|
|
56
|
-
moduleVersion: ${JSON.stringify(i)}
|
|
57
|
-
};
|
|
58
|
-
const __apm$traced = () => {
|
|
59
|
-
const __apm$wrapped = () => {};
|
|
60
|
-
return __apm$wrapped(...__apm$arguments);
|
|
61
|
-
};
|
|
62
|
-
`:`
|
|
63
|
-
const __apm$arguments = [${a}].slice(0, arguments.length);
|
|
64
|
-
const __apm$ctx = {
|
|
65
|
-
arguments: __apm$arguments,
|
|
66
|
-
self: this,
|
|
67
|
-
moduleVersion: ${JSON.stringify(i)}
|
|
68
|
-
};
|
|
69
|
-
const __apm$traced = () => {
|
|
70
|
-
const __apm$wrapped = () => {};
|
|
71
|
-
return __apm$wrapped.apply(this, __apm$arguments);
|
|
72
|
-
};
|
|
73
|
-
`).body;return l.body.unshift(...p),oN.query(l,"[id.name=__apm$wrapped]")[0].init=t,l}function CF(e,t){let n=new Set;oN.traverse(t.body,oN.parse("[object.type=Super]"),(r,i)=>{let{name:o}=r.property,s;if(i.callee){let{expression:c}=dn(`__apm$super['${o}'].call(this)`).body[0];i.callee=s=c.callee,i.arguments.unshift(...c.arguments)}else i.expression=s=dn(`__apm$super['${o}']`).body[0];s.computed=i.callee.computed,s.optional=i.callee.optional,n.add(o)});for(let r of n){let i=dn(`
|
|
74
|
-
class Wrapper {
|
|
75
|
-
wrapper () {
|
|
76
|
-
__apm$super['${r}'] = super['${r}']
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`).body[0].body.body[0].value.body.body[0];t.body.body.unshift(i)}n.size>0&&t.body.body.unshift(dn("const __apm$super = {}").body[0])}function Mee(e,t,n=""){let r=xF(e,t,n),i=PF(e,t,n),[o,s,c,a,l,p]=r.body[0].body.body,u={type:"IfStatement",test:a.test,consequent:{type:"BlockStatement",body:i.body[0].body.body},alternate:null};return r.body[0].body.body=[o,u,s,c,l,p],r}function xF(e,t,n=""){let{channelName:r,functionQuery:{callbackIndex:i=-1}}=e,o=Is(r);return dn(`
|
|
80
|
-
function wrapper () {
|
|
81
|
-
const __apm$cb = Array.prototype.at.call(__apm$arguments, ${i});
|
|
82
|
-
|
|
83
|
-
if (!${o}.start.hasSubscribers) return __apm$traced();
|
|
84
|
-
|
|
85
|
-
function __apm$wrappedCb(err, res) {
|
|
86
|
-
if (err) {
|
|
87
|
-
__apm$ctx.error = err;
|
|
88
|
-
${o}.error.publish(__apm$ctx);
|
|
89
|
-
} else {
|
|
90
|
-
__apm$ctx.result = res;
|
|
91
|
-
${n}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
${o}.asyncStart.runStores(__apm$ctx, () => {
|
|
95
|
-
try {
|
|
96
|
-
if (__apm$cb) {
|
|
97
|
-
return __apm$cb.apply(this, arguments);
|
|
98
|
-
}
|
|
99
|
-
} finally {
|
|
100
|
-
${o}.asyncEnd.publish(__apm$ctx);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (typeof __apm$cb !== 'function') {
|
|
106
|
-
return __apm$traced();
|
|
107
|
-
}
|
|
108
|
-
Array.prototype.splice.call(__apm$arguments, ${i}, 1, __apm$wrappedCb);
|
|
109
|
-
|
|
110
|
-
return ${o}.start.runStores(__apm$ctx, () => {
|
|
111
|
-
try {
|
|
112
|
-
return __apm$traced();
|
|
113
|
-
} catch (err) {
|
|
114
|
-
__apm$ctx.error = err;
|
|
115
|
-
${o}.error.publish(__apm$ctx);
|
|
116
|
-
throw err;
|
|
117
|
-
} finally {
|
|
118
|
-
__apm$ctx.self ??= this;
|
|
119
|
-
${o}.end.publish(__apm$ctx);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
`)}function PF(e,t,n=""){let{channelName:r}=e,i=Is(r);return dn(`
|
|
124
|
-
function wrapper () {
|
|
125
|
-
if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
|
|
126
|
-
|
|
127
|
-
return ${i}.start.runStores(__apm$ctx, () => {
|
|
128
|
-
try {
|
|
129
|
-
let promise = __apm$traced();
|
|
130
|
-
if (typeof promise?.then !== 'function') {
|
|
131
|
-
__apm$ctx.result = promise;
|
|
132
|
-
${n}
|
|
133
|
-
return __apm$ctx.result;
|
|
134
|
-
}
|
|
135
|
-
// Mirror Node.js core diagnostics_channel behaviour: for native Promise
|
|
136
|
-
// instances, chain normally (safe since there is no subclass API to
|
|
137
|
-
// preserve). For Promise subclasses and other thenables, side-chain the
|
|
138
|
-
// callbacks for event publishing and return the original so that any
|
|
139
|
-
// subclass-specific methods (e.g. APIPromise.withResponse()) remain
|
|
140
|
-
// accessible to the caller.
|
|
141
|
-
if (promise instanceof Promise && promise.constructor === Promise) {
|
|
142
|
-
return promise.then(
|
|
143
|
-
result => {
|
|
144
|
-
__apm$ctx.result = result;
|
|
145
|
-
${n}
|
|
146
|
-
${i}.asyncStart.publish(__apm$ctx);
|
|
147
|
-
${i}.asyncEnd.publish(__apm$ctx);
|
|
148
|
-
return __apm$ctx.result;
|
|
149
|
-
},
|
|
150
|
-
err => {
|
|
151
|
-
__apm$ctx.error = err;
|
|
152
|
-
${i}.error.publish(__apm$ctx);
|
|
153
|
-
${i}.asyncStart.publish(__apm$ctx);
|
|
154
|
-
${i}.asyncEnd.publish(__apm$ctx);
|
|
155
|
-
throw err;
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
promise.then(
|
|
160
|
-
result => {
|
|
161
|
-
__apm$ctx.result = result;
|
|
162
|
-
${n}
|
|
163
|
-
${i}.asyncStart.publish(__apm$ctx);
|
|
164
|
-
${i}.asyncEnd.publish(__apm$ctx);
|
|
165
|
-
},
|
|
166
|
-
err => {
|
|
167
|
-
__apm$ctx.error = err;
|
|
168
|
-
${i}.error.publish(__apm$ctx);
|
|
169
|
-
${i}.asyncStart.publish(__apm$ctx);
|
|
170
|
-
${i}.asyncEnd.publish(__apm$ctx);
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
return promise;
|
|
174
|
-
} catch (err) {
|
|
175
|
-
__apm$ctx.error = err;
|
|
176
|
-
${i}.error.publish(__apm$ctx);
|
|
177
|
-
throw err;
|
|
178
|
-
} finally {
|
|
179
|
-
__apm$ctx.self ??= this;
|
|
180
|
-
${i}.end.publish(__apm$ctx);
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
`)}function wee(e,t,n=""){let{channelName:r}=e,i=Is(r);return dn(`
|
|
185
|
-
function wrapper () {
|
|
186
|
-
if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
|
|
187
|
-
|
|
188
|
-
return ${i}.start.runStores(__apm$ctx, () => {
|
|
189
|
-
try {
|
|
190
|
-
__apm$ctx.result = __apm$traced();
|
|
191
|
-
${n}
|
|
192
|
-
} catch (err) {
|
|
193
|
-
__apm$ctx.error = err;
|
|
194
|
-
${i}.error.publish(__apm$ctx);
|
|
195
|
-
throw err;
|
|
196
|
-
} finally {
|
|
197
|
-
__apm$ctx.self ??= this;
|
|
198
|
-
${i}.end.publish(__apm$ctx);
|
|
199
|
-
}
|
|
200
|
-
return __apm$ctx.result;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
`)}function Gee(e,t){let{channelName:n,module:{name:r}}=e,i=Is(n+":next");if(t.body.some(a=>a.declarations?.[0]?.id?.name===i))return;let o=Is(n),s=t.body.findIndex(a=>a.declarations?.[0]?.id?.name===o),c=`const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}:next")`;t.body.splice(s+1,0,dn(c).body[0])}function Uee(e,t,n){let{channelName:r}=e,i=t==="Iterator"?"traceSync":"tracePromise",o=Is(r+":next");return Gee(e,n),`
|
|
204
|
-
const __apm$iter = __apm$ctx.result;
|
|
205
|
-
if (__apm$iter != null && typeof __apm$iter.next === 'function') {
|
|
206
|
-
const __apm$patchIter = function (method) {
|
|
207
|
-
const __apm$orig = __apm$iter[method];
|
|
208
|
-
if (typeof __apm$orig !== 'function') return;
|
|
209
|
-
__apm$iter[method] = function () {
|
|
210
|
-
const __apm$iterArgs = Array.prototype.slice.call(arguments);
|
|
211
|
-
if (!tr_ch_apm_hasSubscribers(${o})) return __apm$orig.apply(this, __apm$iterArgs);
|
|
212
|
-
__apm$ctx.method = method;
|
|
213
|
-
__apm$ctx.arguments = __apm$iterArgs;
|
|
214
|
-
return ${o}.${i}(__apm$orig, __apm$ctx, this, ...__apm$iterArgs);
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
__apm$patchIter('next');
|
|
218
|
-
__apm$patchIter('throw');
|
|
219
|
-
__apm$patchIter('return');
|
|
220
|
-
}
|
|
221
|
-
`}var kF=iN.exports;var aN={};var wF=e=>{throw TypeError(e)},uN=(e,t,n)=>t.has(e)||wF("Cannot "+n),ri=(e,t,n)=>(uN(e,t,"read from private field"),n?n.call(e):t.get(e)),As=(e,t,n)=>t.has(e)?wF("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),bc=(e,t,n,r)=>(uN(e,t,"write to private field"),t.set(e,n),n),yc=(e,t,n)=>(uN(e,t,"access private method"),n),Hp,Zg,Fp,Sc,Xg,Kg,Io,GF,UF,DF,lN,BF,LF=ni,{parse:MF}=Vg,{generate:Dee}=vF,Bee=kF,cN,jg,pN=class{constructor(t,n,r,i,o,s={}){As(this,Io),As(this,Hp,null),As(this,Zg,null),As(this,Fp,null),As(this,Sc,[]),As(this,Xg,null),As(this,Kg,{}),bc(this,Hp,t),bc(this,Zg,n),bc(this,Fp,r),bc(this,Sc,i),bc(this,Xg,o),bc(this,Kg,s)}free(){}get moduleName(){return ri(this,Hp)}get filePath(){return ri(this,Fp)}transform(t,n,r){if(Buffer.isBuffer(t)&&(t=t.toString()),!t)return{code:t};let i,o={},s=0;for(let c of ri(this,Sc)){let{astQuery:a,functionQuery:l={}}=c;if(!i){let m={loc:!0,ranges:!0,raw:!0,module:n==="esm"};try{i=MF(t,m)}catch{i=MF(t,{...m,module:!m.module})}n==="esm"&&(o=yc(this,Io,DF).call(this,i))}let p=yc(this,Io,lN).call(this,l,o),u=a||yc(this,Io,BF).call(this,p),d={...c,dcModule:ri(this,Xg),moduleType:n,moduleVersion:ri(this,Zg),functionQuery:p};d.operator=yc(this,Io,UF).call(this,d),LF.traverse(i,LF.parse(u),(...m)=>{s++,yc(this,Io,GF).call(this,d,...m)})}if(s===0&&ri(this,Sc).length>0){let c=ri(this,Sc).map(({astQuery:a,functionQuery:l={}})=>{if(a)return a;let p=yc(this,Io,lN).call(this,l,o),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(i){cN??(cN=aN.SourceMapConsumer),jg??(jg=aN.SourceMapGenerator);let c=`${ri(this,Hp)}/${ri(this,Fp)}`,a;if(r){let u=new cN(r);u.file=c,a=jg.fromSourceMap(u)}else a=new jg({file:c});let l=Dee(i,{sourceMap:a}),p=a.toString();return{code:l,map:p}}return{code:t}}};Hp=new WeakMap;Zg=new WeakMap;Fp=new WeakMap;Sc=new WeakMap;Xg=new WeakMap;Kg=new WeakMap;Io=new WeakSet;GF=function(e,...t){let n=ri(this,Kg)[e.operator]??Bee[e.operator],{index:r=0}=e.functionQuery,[i]=t,o=i.init?.type||i.type;o!=="ClassDeclaration"&&o!=="ClassExpression"&&(i.type==="VariableDeclarator"||(e.functionIndex=++e.functionIndex||0,r!==null&&r!==e.functionIndex))||n(e,...t)};UF=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"}};DF=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 i=r.exported.name??r.exported.value,o=r.local.name??r.local.value;i&&o&&(t[i]=o)}}return t};lN=function(e,t){if(!e.isExportAlias)return e;let{functionName:n,expressionName:r,className:i}=e;return n&&t[n]?{...e,functionName:t[n]}:r&&t[r]?{...e,expressionName:t[r]}:i&&t[i]?{...e,className:t[i]}:e};BF=function(e){let{functionName:t,expressionName:n,className:r,objectName:i,propertyName:o}=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]`),i||o){if(!i||!o)throw new Error(`functionQuery: 'objectName' and 'propertyName' must be used together (got objectName=${i}, propertyName=${o})`);let l=i==="this"?"left.object.type=ThisExpression":`left.object.name="${i}"`;c.push(`AssignmentExpression[${l}][left.property.name="${o}"] > [async]`)}return c.join(", ")};var HF={Transformer:pN};var FF=e=>{throw TypeError(e)},WF=(e,t,n)=>t.has(e)||FF("Cannot "+n),Ao=(e,t,n)=>(WF(e,t,"read from private field"),n?n.call(e):t.get(e)),qg=(e,t,n)=>t.has(e)?FF("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dN=(e,t,n,r)=>(WF(e,t,"write to private field"),t.set(e,n),n),Qg,Jg,Ns,$g,Hee=gF,{Transformer:Fee}=HF,mN=class{constructor(t,n){qg(this,Qg,[]),qg(this,Jg,null),qg(this,Ns,{}),qg(this,$g,{}),dN(this,Qg,t),dN(this,Jg,n||"diagnostics_channel")}free(){dN(this,Ns,{})}addTransform(t,n){Ao(this,$g)[t]=n}getTransformer(t,n,r){r=r.replace(/\\/g,"/");let i=`${t}/${r}@${n}`;if(Ao(this,Ns)[i])return Ao(this,Ns)[i];let o=Ao(this,Qg).filter(({module:s})=>s.name===t&&(typeof s.filePath=="string"?s.filePath===r:s.filePath.test(r))&&Hee(n,s.versionRange));if(o.length!==0)return Ao(this,Ns)[i]=new Fee(t,n,r,o,Ao(this,Jg),Ao(this,$g)),Ao(this,Ns)[i]}};Qg=new WeakMap;Jg=new WeakMap;Ns=new WeakMap;$g=new WeakMap;var VF={InstrumentationMatcher:mN};var{InstrumentationMatcher:Wee}=VF;function Vee(e,t){return new Wee(e,t)}var YF={create:Vee};var zg=YF;import pte from"module";import Yee from"path";var fN=Yee.sep,gN=function(e){var t=e.split(fN),n=t.lastIndexOf("node_modules");if(n!==-1&&t[n+1]){for(var r=t[n+1][0]==="@",i=r?t[n+1]+"/"+t[n+2]:t[n+1],o=r?3:2,s="",c=n+o-1,a=0;a<=c;a++)a===c?s+=t[a]:s+=t[a]+fN;for(var l="",p=t.length-1,u=n+o;u<=p;u++)u===p?l+=t[u]:l+=t[u]+fN;return{name:i,basedir:s,path:l}}},jF=Eo(gN);import ute from"url";import jee from"fs";import Zee from"path";var{readFileSync:Xee}=jee,{join:Kee}=Zee,_N=new Map;function qee(e){if(_N.has(e))return _N.get(e);try{let t=Kee(e,"package.json"),n=Xee(t),{version:r}=JSON.parse(n);return _N.set(e,r),r}catch{return process.version.slice(1)}}var hN=qee,ZF=Eo(hN);var bN;function Qee(e){bN=e}function Jee(e){bN&&bN(e)}var Mi={setDiagnosticsHook:Qee,emitDiagnostics:Jee};var e_={exports:{}};import cte from"tty";import lte from"util";import $ee from"os";import zee from"tty";var XF=(e,t=process.argv)=>{let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),i=t.indexOf("--");return r!==-1&&(i===-1||r<i)};var ete=$ee,KF=zee,qn=XF,{env:Pt}=process,No;qn("no-color")||qn("no-colors")||qn("color=false")||qn("color=never")?No=0:(qn("color")||qn("colors")||qn("color=true")||qn("color=always"))&&(No=1);"FORCE_COLOR"in Pt&&(Pt.FORCE_COLOR==="true"?No=1:Pt.FORCE_COLOR==="false"?No=0:No=Pt.FORCE_COLOR.length===0?1:Math.min(parseInt(Pt.FORCE_COLOR,10),3));function yN(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function SN(e,t){if(No===0)return 0;if(qn("color=16m")||qn("color=full")||qn("color=truecolor"))return 3;if(qn("color=256"))return 2;if(e&&!t&&No===void 0)return 0;let n=No||0;if(Pt.TERM==="dumb")return n;if(process.platform==="win32"){let r=ete.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Pt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in Pt)||Pt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in Pt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Pt.TEAMCITY_VERSION)?1:0;if(Pt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Pt){let r=parseInt((Pt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Pt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Pt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Pt.TERM)||"COLORTERM"in Pt?1:n}function tte(e){let t=SN(e,e&&e.isTTY);return yN(t)}var qF={supportsColor:tte,stdout:yN(SN(!0,KF.isatty(1))),stderr:yN(SN(!0,KF.isatty(2)))};var Ec=1e3,Tc=Ec*60,Ic=Tc*60,vs=Ic*24,nte=vs*7,rte=vs*365.25,QF=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return ite(e);if(n==="number"&&isFinite(e))return t.long?ste(e):ote(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ite(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*rte;case"weeks":case"week":case"w":return n*nte;case"days":case"day":case"d":return n*vs;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Ic;case"minutes":case"minute":case"mins":case"min":case"m":return n*Tc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ec;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function ote(e){var t=Math.abs(e);return t>=vs?Math.round(e/vs)+"d":t>=Ic?Math.round(e/Ic)+"h":t>=Tc?Math.round(e/Tc)+"m":t>=Ec?Math.round(e/Ec)+"s":e+"ms"}function ste(e){var t=Math.abs(e);return t>=vs?t_(e,t,vs,"day"):t>=Ic?t_(e,t,Ic,"hour"):t>=Tc?t_(e,t,Tc,"minute"):t>=Ec?t_(e,t,Ec,"second"):e+" ms"}function t_(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+" "+r+(i?"s":"")}function ate(e){n.debug=n,n.default=n,n.coerce=a,n.disable=s,n.enable=i,n.enabled=c,n.humanize=QF,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,M=Number(new Date),R=M-(u||M);N.diff=R,N.prev=u,N.curr=M,u=M,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,(D,I)=>{if(D==="%%")return"%";v++;let H=n.formatters[I];if(typeof H=="function"){let L=b[v];D=H.call(N,L),b.splice(v,1),v--}return D}),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 i(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 o(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(o(p,u))return!1;for(let u of n.names)if(o(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 JF=ate;(function(e,t){let n=cte,r=lte;t.init=p,t.log=c,t.formatArgs=o,t.save=a,t.load=l,t.useColors=i,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=qF;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 i(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function o(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(`
|
|
222
|
-
`).join(`
|
|
223
|
-
`+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)+`
|
|
224
|
-
`)}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=JF(t);let{formatters:u}=e.exports;u.o=function(d){return this.inspectOpts.colors=this.useColors,r.inspect(d,this.inspectOpts).split(`
|
|
225
|
-
`).map(m=>m.trim()).join(" ")},u.O=function(d){return this.inspectOpts.colors=this.useColors,r.inspect(d,this.inspectOpts)}})(e_,e_.exports);var EN=e_.exports,$F=Eo(EN);import dte from"os";import mte from"path";import fte from"fs";var{create:gte}=zg,TN=pte,_te=gN,{pathToFileURL:zF}=ute,hte=hN,{emitDiagnostics:e2}=Mi,n_=EN("@apm-js-collab/tracing-hooks:module-patch"),IN=class{constructor({instrumentations:t=[]}={}){this.packages=new Set(t.map(n=>n.module.name)),this.instrumentator=gte(t),this.compile=TN.prototype._compile}patch(){let t=this;TN.prototype._compile=function(...r){let[i,o]=r,s=_te(o);if(s&&t.packages.has(s.name)){n_("found resolved module, checking if there is a transformer %s",o);let c=hte(s.basedir,s.name),a=t.instrumentator.getTransformer(s.name,c,s.path);if(a){n_("transforming file %s",o);try{let l=a.transform(i,"cjs");r[0]=l?.code,e2({url:zF(o).href,moduleName:a.moduleName}),process.env.TRACING_DUMP&&bte(r[0],o)}catch(l){n_("Error transforming module %s: %o",o,l),e2({url:zF(o).href,moduleName:a.moduleName,error:l})}finally{a.free()}}}return t.compile.apply(this,r)}}unpatch(){TN.prototype._compile=this.compile}};function bte(e,t){let n=dte,r=mte,i=fte,o=process.env.TRACING_DUMP_DIR??n.tmpdir(),s=r.dirname(t),c=r.basename(t),a=r.join(o,s),l=r.join(a,c);n_("Dumping patched code to: %s",l),i.mkdirSync(a,{recursive:!0}),i.writeFileSync(l,e)}var yte=IN,t2=Eo(yte);import{fileURLToPath as Ste}from"url";import{MessageChannel as Ete}from"worker_threads";import{readFileSync as Tte}from"fs";var n2=$F("@apm-js-collab/tracing-hooks:esm-hook"),r_=null,r2=null,i2=null,AN=Mi.emitDiagnostics;function o2(){let{port1:e,port2:t}=new Ete;return e.on("message",Mi.emitDiagnostics),e.unref(),t}function s2(e={}){let t=e?.instrumentations||[];i2=zg.create(t),r2=new Set(t.map(n=>n.module.name)),r_=new Map,AN=e?.diagnosticsPort?Ite(e.diagnosticsPort):Mi.emitDiagnostics}function Ite(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){n2("failed to post diagnostics for %s: %o",t.url,n)}}}function Ate(e){let t=jF(e.url);if(t&&r2.has(t.name)){let n=Ste(t.basedir),r=ZF(n),i=i2.getTransformer(t.name,r,t.path);i&&r_.set(e.url,i)}return e}function a2(e,t,n){return Ate(n(e,t))}function c2(e,t,n){let r=n(e,t);if(r_.has(e)===!1)return r;if(r.format==="commonjs"){let i=new URL(r.responseURL??e);r.source??=Tte(i)}return Nte(e,r)}function Nte(e,t){let n=t.source;if(n){let r=r_.get(e);try{let i=t.format==="module"?"esm":t.format==="commonjs"?"cjs":"unknown",o=typeof n=="string"?n:Buffer.from(n).toString("utf8"),s=r.transform(o,i);t.source=s?.code,t.shortCircuit=!0,AN({url:e,moduleName:r.moduleName})}catch(i){n2("Error transforming module %s: %o",e,i),AN({url:e,moduleName:r.moduleName,error:i})}finally{r.free()}}return t}var BWe=Mi.setDiagnosticsHook;function Cte(e){if(e){let{major:r=0,minor:i=0}=Ms(e);return r>2||r===2&&i>=8}let{major:t=0,minor:n=0}=Ms(process.versions.node??"0.0.0");return t>25||t===25&&n>=1||t===24&&n>=13}function l2(e){if(!Rte&&!Ote||te?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=Cte(t.Deno?.version?.deno),r=vte;Mi.setDiagnosticsHook(({moduleName:i,error:o})=>{o?g.warn(`[orchestrion] failed to inject diagnostics-channel into ${i}:`,o):(te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[],te.__SENTRY_ORCHESTRION__.runtime.push(i))});try{if(typeof r.registerHooks=="function"&&n)s2({instrumentations:Dp}),r.registerHooks({resolve:a2,load:c2}),g.log("Registered diagnostics-channel injection via Module.registerHooks()");else if(typeof r.register=="function"&&!t.Bun&&!t.Deno){let i=o2(),o;o=import.meta.url,r.register("@sentry/server-utils/orchestrion/hook",{parentURL:o,data:{instrumentations:Dp,diagnosticsPort:i},transferList:[i]}),new t2({instrumentations:Dp}).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(i){g.warn("Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.",i);return}te.__SENTRY_ORCHESTRION__=te.__SENTRY_ORCHESTRION__||{},te.__SENTRY_ORCHESTRION__.runtime=te.__SENTRY_ORCHESTRION__.runtime||[]}function xte(){return fA}function Pte(e){lw(()=>{let t=Object.values(fA).map(r=>r()),n=t.map(r=>r.name);return{integrations:[...t,GI({responseHook:_s}),mA({responseHook:_s})],replacedOtelIntegrationNames:n,register:()=>l2(),detect:lA}})}export{en as NODE_VERSION,Xa as NodeClient,XA as OpenFeatureIntegrationHook,q as SDK_VERSION,B as SEMANTIC_ATTRIBUTE_SENTRY_OP,S as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Hn as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,ve as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,Zt as Scope,Ql as SentryContextManager,KS as _INTERNAL_normalizeCollectionInterval,on as addBreadcrumb,Yh as addEventProcessor,Qh as addIntegration,MA as amqplibIntegration,XL as anrIntegration,HA as anthropicAIIntegration,bee as applyDiagnosticsChannelInjectionIntegrations,_n as bindScopeToEmitter,$8 as buildLaunchDarklyFlagUsedHandler,Qc as captureCheckIn,Sb as captureConsoleIntegration,Kc as captureEvent,me as captureException,wb as captureFeedback,Xc as captureMessage,jh as captureSession,mm as childProcessIntegration,Wh as close,GT as connectIntegration,Nm as consoleIntegration,Gb as consoleLoggingIntegration,gm as contextLinesIntegration,An as continueTrace,Db as createConsolaReporter,xm as createGetModuleFromFilename,mr as createLangChainCallbackHandler,eM as createSentryWinstonTransport,ca as createTransport,lM as cron,R8 as dataloaderIntegration,Eb as dedupeIntegration,km as defaultStackParser,xte as diagnosticsChannelInjectionIntegrations,KL as disableAnrDetectionForCallback,Zo as endSession,Hu as eventFiltersIntegration,Pte as experimentalUseDiagnosticsChannelInjection,Ay as expressErrorHandler,nE as expressIntegration,Tb as extraErrorDataIntegration,GE as fastifyIntegration,Pb as featureFlagsIntegration,qA as firebaseIntegration,Yo as flush,P9 as fsIntegration,rl as functionToStringIntegration,de as generateInstrumentOnce,yA as genericPoolIntegration,Q as getActiveSpan,QA as getAutoPerformanceIntegrations,C as getClient,ne as getCurrentScope,dF as getDefaultIntegrations,uF as getDefaultIntegrationsWithoutPerformance,wo as getGlobalScope,J as getIsolationScope,Re as getRootSpan,Pm as getSentryRelease,wc as getSpanDescendants,Xt as getSpanStatusFromHttpCode,$e as getTraceData,mb as getTraceMetaTags,WA as googleGenAIIntegration,VE as graphqlIntegration,nee as growthbookIntegration,CT as hapiIntegration,PT as honoIntegration,Hr as httpHeadersToSpanAttributes,JS as httpIntegration,La as httpServerIntegration,Ma as httpServerSpansIntegration,il as inboundFiltersIntegration,yee as init,$A as initOpenTelemetry,See as initWithoutDefaultIntegrations,_d as instrumentAnthropicAiClient,yd as instrumentGoogleGenAIClient,Td as instrumentLangChainEmbeddings,zC as instrumentLangGraph,dd as instrumentOpenAiClient,Nl as instrumentStateGraph,iy as instrumentStateGraphCompile,Yu as instrumentSupabaseClient,ec as isDiagnosticsChannelInjectionEnabled,jo as isEnabled,Vh as isInitialized,QE as kafkaIntegration,h8 as knexIntegration,MT as koaIntegration,YA as langChainIntegration,ZA as langGraphIntegration,Fh as lastEventId,J8 as launchDarklyIntegration,ol as linkedErrorsIntegration,ym as localVariablesIntegration,ZS as logger,$E as lruMemoizerIntegration,Cm as makeNodeTransport,ft as metrics,Sm as modulesIntegration,tT as mongoIntegration,rT as mongooseIntegration,lT as mysql2Integration,oT as mysqlIntegration,$S as nativeNodeFetchIntegration,fm as nodeContextIntegration,$L as nodeRuntimeMetricsIntegration,Em as onUncaughtExceptionIntegration,Tm as onUnhandledRejectionIntegration,DA as openAIIntegration,z8 as openFeatureIntegration,Gu as parameterize,iM as pinoIntegration,IT as postgresIntegration,RT as postgresJsIntegration,mee as preloadOpenTelemetry,Jm as prismaIntegration,Im as processSessionIntegration,Mb as profiler,hT as redisIntegration,sl as requestDataIntegration,Rb as rewriteFramesIntegration,Bh as setAttribute,Dh as setAttributes,Lh as setContext,O0 as setConversationId,sb as setCurrentClient,wh as setExtra,Mh as setExtras,Bs as setHttpStatus,ph as setMeasurement,MS as setNodeAsyncContextStrategy,Uh as setTag,Gh as setTags,Hh as setUser,EJ as setupConnectErrorHandler,L9 as setupExpressErrorHandler,K4 as setupFastifyErrorHandler,oJ as setupHapiErrorHandler,mJ as setupHonoErrorHandler,_J as setupKoaErrorHandler,vl as spanStreamingIntegration,rh as spanToBaggageHeader,oe as spanToJSON,Lc as spanToTraceHeader,Am as spotlightIntegration,k as startInactiveSpan,Nn as startNewTrace,qc as startSession,Se as startSpan,ke as startSpanManual,eee as statsigIntegration,Ob as supabaseIntegration,Fn as suppressTracing,vm as systemErrorIntegration,_A as tediousIntegration,sy as trpcMiddleware,tee as unleashIntegration,eh as updateSpanName,Mm as validateOpenTelemetrySetup,GA as vercelAIIntegration,fO as winterCGHeadersToDict,se as withActiveSpan,nr as withIsolationScope,Dr as withMonitor,Be as withScope,ih as withStreamedSpan,Sy as wrapMcpServerWithSentry,Cb as zodErrorsIntegration};
|