@aventurevc/mcp-server 0.8.28 → 0.8.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,222 +0,0 @@
1
- import{i as e,r as t,t as n}from"./rolldown-runtime-tZXQYakl.js";import{D as r,G as i,I as a,J as o,L as s,N as c,Q as l,R as u,S as d,T as f,V as p,X as m,a as h,b as g,c as _,i as v,j as y,k as b,l as ee,q as te,r as ne,s as re,t as ie,u as ae,v as x,w as oe}from"./ResourceImpl-Dm7ANMDE.js";import{a as se,c as ce,d as le,f as ue,i as de,l as fe,m as pe,p as me,r as he,t as ge,u as _e}from"./src-BqpNQELF.js";import*as ve from"node:module";import ye from"node:module";import{EventEmitter as be,errorMonitor as xe}from"node:events";import{execFile as Se}from"node:child_process";import Ce,{join as we,posix as Te,sep as Ee}from"node:path";import De,{createReadStream as Oe,readFile as ke,readFileSync as Ae,readdir as je}from"node:fs";import*as Me from"node:util";import Ne,{format as Pe,promisify as Fe,types as Ie}from"node:util";import{promisify as Le,types as Re}from"util";import*as ze from"fs";import{readFileSync as Be}from"fs";import*as Ve from"path";import{normalize as S}from"path";import He,{fileURLToPath as Ue}from"node:url";import{AsyncLocalStorage as We}from"node:async_hooks";import*as C from"node:net";import*as w from"node:http";import{Readable as Ge}from"node:stream";import*as T from"node:diagnostics_channel";import{subscribe as Ke,unsubscribe as E}from"node:diagnostics_channel";import*as qe from"node:tls";import{createGzip as D}from"node:zlib";import{MessageChannel as Je,Worker as Ye,isMainThread as Xe,parentPort as Ze}from"node:worker_threads";import*as Qe from"node:os";import $e from"node:os";import{URL as et}from"url";import tt from"node:tty";import*as nt from"module";import{isMainThread as rt,threadId as it}from"worker_threads";import*as at from"diagnostics_channel";import{createInterface as ot}from"node:readline";import*as st from"node:https";import{monitorEventLoopDelay as ct,performance as lt}from"perf_hooks";import{EventEmitter as ut}from"events";var dt=`baggage`,ft=4096;x();function pt(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function mt(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function ht(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;if(t!==-1&&t<e.length-1){let n=e.substring(t+1);c=m(n)}return{key:o,value:s,metadata:c}}function gt(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=ht(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}x();var _t=class{inject(e,t,n){let r=d.getBaggage(e);if(!r||me(e))return;let i=pt(mt(r).filter(e=>e.length<=ft).slice(0,180));i.length>0&&n.set(t,dt,i)}extract(e,t,n){let r=n.get(t,dt);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=gt(r[e],i,a,o);else[a]=gt(r,i,a,o);return a===0?e:d.setBaggage(e,d.createBaggage(i))}fields(){return[dt]}};x();function vt(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!yt(n)){f.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!bt(r)){f.warn(`Invalid attribute value set for key: ${n}`);continue}t[n]=Array.isArray(r)?r.slice():r}return t}function yt(e){return typeof e==`string`&&e!==``}function bt(e){return e==null?!0:Array.isArray(e)?xt(e):St(typeof e)}function xt(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(St(e)){t=e;continue}return!1}return!1}}return!0}function St(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}x();var Ct=o(`OpenTelemetry SDK Context Key RPC_METADATA`),wt;(function(e){e.HTTP=`http`})(wt||={});function Tt(e,t){return e.setValue(Ct,t)}var Et=`[object Object]`,Dt=`[object Null]`,Ot=`[object Undefined]`,kt=Function.prototype.toString,At=kt.call(Object),jt=Object.getPrototypeOf,Mt=Object.prototype,Nt=Mt.hasOwnProperty,Pt=Symbol?Symbol.toStringTag:void 0,Ft=Mt.toString;function It(e){if(!Lt(e)||Rt(e)!==Et)return!1;let t=jt(e);if(t===null)return!0;let n=Nt.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&kt.call(n)===At}function Lt(e){return typeof e==`object`&&!!e}function Rt(e){return e==null?e===void 0?Ot:Dt:Pt&&Pt in Object(e)?zt(e):Bt(e)}function zt(e){let t=Nt.call(e,Pt),n=e[Pt],r=!1;try{e[Pt]=void 0,r=!0}catch{}let i=Ft.call(e);return r&&(t?e[Pt]=n:delete e[Pt]),i}function Bt(e){return Ft.call(e)}var Vt=20;function Ht(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Wt(t,e.shift(),0,n);return t}function Ut(e){return Kt(e)?e.slice():e}function Wt(e,t,n=0,r){let i;if(!(n>Vt)){if(n++,Yt(e)||Yt(t)||qt(t))i=Ut(t);else if(Kt(e)){if(i=e.slice(),Kt(t))for(let e=0,n=t.length;e<n;e++)i.push(Ut(t[e]));else if(Jt(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r!==`__proto__`&&r!==`constructor`&&r!==`prototype`&&(i[r]=Ut(t[r]))}}}else if(Jt(e)){if(Jt(t)){if(!Xt(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Yt(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Gt(e,s,r)||Gt(t,s,r))delete i[s];else{if(Jt(a)&&Jt(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Wt(i[s],c,n,r)}}}}else i=t}return i}}function Gt(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Kt(e){return Array.isArray(e)}function qt(e){return typeof e==`function`}function Jt(e){return!Yt(e)&&!Kt(e)&&!qt(e)&&typeof e==`object`}function Yt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Xt(e,t){return!(!It(e)||!It(t))}var O=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,k=globalThis,A=`10.75.3`;function Zt(){return Qt(k),k}function Qt(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.75.3`,t[A]=t[`10.75.3`]||{}}function $t(e,t,n=k){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[A]=r[`10.75.3`]||{};return i[e]||(i[e]=t())}var en=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],tn=`Sentry Logger `,nn={};function rn(e){if(!(`console`in k))return e();let t=k.console,n={},r=Object.keys(nn);r.forEach(e=>{let r=nn[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function an(){fn().enabled=!0}function on(){fn().enabled=!1}function sn(){return fn().enabled}function cn(...e){dn(`log`,...e)}function ln(...e){dn(`warn`,...e)}function un(...e){dn(`error`,...e)}function dn(e,...t){O&&sn()&&rn(()=>{k.console[e](`${tn}[${e}]:`,...t)})}function fn(){return O?$t(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var j={enable:an,disable:on,isEnabled:sn,log:cn,warn:ln,error:un},pn=50,mn=/\(error: (.*)\)/,hn=/captureMessage|captureException/;function gn(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
2
- `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=mn.test(n)?n.replace(mn,`$1`):n;if(!o.includes(`Error: `)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=pn+r)break}}return vn(i.slice(r))}}function _n(e){return Array.isArray(e)?gn(...e):e}function vn(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(yn(t).function||``)&&t.pop(),t.reverse(),hn.test(yn(t).function||``)&&(t.pop(),hn.test(yn(t).function||``)&&t.pop()),t.slice(0,pn).map(e=>({...e,filename:e.filename||yn(t).filename,function:e.function||`?`}))}function yn(e){return e[e.length-1]||{}}var bn=`<anonymous>`;function xn(e){try{return!e||typeof e!=`function`?bn:e.name||bn}catch{return bn}}function Sn(e){let t=e.exception;if(t){let e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function Cn(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var wn={},Tn={};function En(e,t){return wn[e]=wn[e]||[],wn[e].push(t),()=>{let n=wn[e];if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}function Dn(e,t){if(!Tn[e]){Tn[e]=!0;try{t()}catch(t){O&&j.error(`Error while instrumenting ${e}`,t)}}}function On(e,t){let n=e&&wn[e];if(n)for(let r of n)try{r(t)}catch(t){O&&j.error(`Error while triggering instrumentation handler.
3
- Type: ${e}
4
- Name: ${xn(r)}
5
- Error:`,t)}}var kn=Object.prototype.toString;function An(e){switch(kn.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Bn(e,Error)}}function jn(e,t){return kn.call(e)===`[object ${t}]`}function Mn(e){return jn(e,`ErrorEvent`)}function Nn(e){return jn(e,`String`)}function Pn(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function Fn(e){return e===null||Pn(e)||typeof e!=`object`&&typeof e!=`function`}function In(e){return jn(e,`Object`)}function M(e){return typeof e==`object`&&!!e}function Ln(e){return typeof Event<`u`&&Bn(e,Event)}function Rn(e){return jn(e,`RegExp`)}function zn(e){return!!(e?.then&&typeof e.then==`function`)}function Bn(e,t){try{return e instanceof t}catch{return!1}}function Vn(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Un(i,r);try{e[t]=i}catch{O&&j.log(`Failed to replace method "${t}" in object`,e)}}function Hn(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{O&&j.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Un(e,t){try{e.prototype=t.prototype=t.prototype||{},Hn(e,`__sentry_original__`,t)}catch{}}function Wn(e,t,n,r=!0){let i=e[t];if(typeof i!=`function`)throw Error(`Cannot wrap method: ${t} is not a function`);if(Gn(i))throw Error(`Attempting to wrap method ${t} multiple times`);Un(n,i),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Gn(e){return e.__sentry_original__}function Kn(e){if(An(e))return{message:e.message,name:e.name,stack:e.stack,...qn(e)};if(Ln(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...qn(e)}}return e}function qn(e){return M(e)?Object.fromEntries(Object.entries(e)):{}}function Jn(e){let t=Object.keys(Kn(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}var Yn;function Xn(e){if(Yn!==void 0)return Yn?Yn(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=k;return t in n&&typeof n[t]==`function`?(Yn=n[t],Yn(e)):(Yn=null,e())}function Zn(){return Xn(()=>Math.random())}function Qn(){return Xn(()=>Date.now())}var $n=Symbol.for(`sentry.skipNormalization`),er=Symbol.for(`sentry.overrideNormalizationDepth`);function tr(e){Hn(e,$n,!0)}function nr(e,t){Hn(e,er,t)}function rr(e){return!!e[$n]}function ir(e){let t=e[er];return typeof t==`number`?t:void 0}function ar(e,t=100,n=1/0){try{return sr(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function or(e,t=3,n=102400){let r=ar(e,t);return dr(r)>n?or(e,t-1,n):r}function sr(e,t,n=1/0,r=1/0,i=fr()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=cr(e,t);if(!s.startsWith(`[object `))return s;if(rr(t))return t;let c=ir(t),l=c===void 0?n:c;if(l===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let u=t;if(u&&typeof u.toJSON==`function`)try{return sr(``,u.toJSON(),l-1,r,i)}catch{}let d=Array.isArray(t)?[]:{},f=0,p=Kn(t);for(let e in p){if(!Object.prototype.hasOwnProperty.call(p,e))continue;if(f>=r){d[e]=`[MaxProperties ~]`;break}let t=p[e];d[e]=sr(e,t,l-1,r,i),f++}return o(t),d}function cr(e,t){try{return typeof global<`u`&&t===global?`[Global]`:typeof t==`number`&&!Number.isFinite(t)?`[${t}]`:typeof t==`function`?`[Function: ${xn(t)}]`:typeof t==`symbol`?`[${String(t)}]`:typeof t==`bigint`?`[BigInt: ${String(t)}]`:`[object ${lr(t)}]`}catch(e){return`**non-serializable** (${e})`}}function lr(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function ur(e){return~-encodeURI(e).split(/%..|./).length}function dr(e){return ur(JSON.stringify(e))}function fr(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function pr(e,t=`[unserializable]`){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return typeof t==`function`?t(e):t}}function mr(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function hr(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 a=Math.min(i+140,r);return a>r-5&&(a=r),a===r&&(i=Math.max(a-140,0)),n=n.slice(i,a),i>0&&(n=`'{snip} ${n}`),a<r&&(n+=` {snip}`),n}function gr(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];Fn(r)?n.push(String(r)):r instanceof Error?n.push(r.message?`${r.name}: ${r.message}`:r.name):n.push(cr(void 0,r))}return n.join(t)}function _r(e,t,n=!1){return Nn(e)?Rn(t)?t.test(e):Nn(t)?n?e===t:e.includes(t):typeof t==`function`&&t(e):!1}function vr(e,t=[],n=!1){for(let r of t)if(_r(e,r,n))return!0;return!1}function yr(){let e=k;return e.crypto||e.msCrypto}var br;function xr(){return Zn()*16}function Sr(e=yr()){try{if(e?.randomUUID)return Xn(()=>e.randomUUID()).replace(/-/g,``)}catch{}return br||=`10000000100040008000100000000000`,br.replace(/[018]/g,e=>(e^(xr()&15)>>e/4).toString(16))}function Cr(e){return e.exception?.values?.[0]}function wr(e){let{message:t,event_id:n}=e;if(t)return t;let r=Cr(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Tr(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function Er(e,t){let n=Cr(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}var Dr=/^(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 Or(e){return parseInt(e||``,10)}function kr(e){let t=e.match(Dr)||[],n=Or(t[1]),r=Or(t[2]),i=Or(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 Ar(e){if(jr(e))return!0;try{Hn(e,`__sentry_captured__`,!0)}catch{}return!1}function jr(e){try{return e.__sentry_captured__}catch{}}var Mr=1e3;function Nr(){return Qn()/Mr}function Pr(){let{performance:e}=k;if(!e?.now||!e.timeOrigin)return Nr;let t=e.timeOrigin;return()=>(t+Xn(()=>e.now()))/Mr}var Fr;function Ir(){return(Fr??=Pr())()}function Lr(e){let t=Ir(),n={sid:Sr(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>Br(n)};return e&&Rr(n,e),n}function Rr(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||Ir(),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:Sr()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function zr(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Rr(e,n)}function Br(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 Vr(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=Vr(r[e],t[e],n-1));return r}function Hr(){return Sr()}function Ur(){return Sr().substring(16)}function Wr(e){try{let t=k.WeakRef;if(typeof t==`function`)return new t(e)}catch{}return e}function Gr(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}var Kr=`_sentrySpan`;function qr(e,t){t?Hn(e,Kr,Wr(t)):delete e[Kr]}function Jr(e){return Gr(e[Kr])}var Yr=100,Xr=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:Hr(),sampleRand:Zn()}}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,qr(t,Jr(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Rr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():In(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,qr(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Hr(),sampleRand:Zn()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:Yr;if(n<=0)return this;let r={timestamp:Nr(),...e,message:e.message?mr(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Jr(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Vr(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||Sr();if(!this._client)return O&&j.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||Sr();if(!this._client)return O&&j.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||Sr();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(O&&j.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function Zr(){return $t(`defaultCurrentScope`,()=>new Xr)}function Qr(){return $t(`defaultIsolationScope`,()=>new Xr)}var $r=e=>e instanceof Promise&&!e[ei],ei=Symbol(`chained PromiseLike`),ti=(e,t,n)=>{let r=e.then(e=>(t(e),e),e=>{throw n(e),e});return $r(r)&&$r(e)?r:ni(e,r)},ni=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i==`function`?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[ei]:!0}),t},ri=class{constructor(e,t){let n;n=e||new Xr;let r;r=t||new Xr,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return zn(n)?ti(n,()=>this._popScope(),()=>this._popScope()):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function ii(){let e=Qt(Zt());return e.stack=e.stack||new ri(Zr(),Qr())}function ai(e){return ii().withScope(e)}function oi(e,t){let n=ii();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function si(e){return ii().withScope(()=>e(ii().getIsolationScope()))}function ci(){return{withIsolationScope:si,withScope:ai,withSetScope:oi,withSetIsolationScope:(e,t)=>si(t),getCurrentScope:()=>ii().getScope(),getIsolationScope:()=>ii().getIsolationScope()}}function li(e){let t=Qt(Zt());t.acs=e}function ui(e){let t=Qt(e);return t.acs?t.acs:ci()}function di(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).includes(`value`)}function fi(e,t){let{value:n,unit:r}=di(e)?e:{value:e,unit:void 0},i=gi(n),a=r&&typeof r==`string`?{unit:r}:{};if(i)return{...i,...a};if(!t||t===`skip-undefined`&&n===void 0)return;let o=``;try{o=JSON.stringify(n)??``}catch{}return{value:o,type:`string`,...a}}function pi(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let e=fi(i,t);e&&(n[r]=e)}return n}function mi(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 e=r.value;Array.isArray(e)?t+=hi(e[0])*e.length:Fn(e)?t+=hi(e):t+=100}return t}function hi(e){return typeof e==`string`?e.length*2:typeof e==`boolean`?4:typeof e==`number`?8:0}function gi(e){if(Array.isArray(e))return{value:e,type:`array`};let t=typeof e==`string`?`string`:typeof e==`boolean`?`boolean`:typeof e==`number`&&!Number.isNaN(e)?Number.isInteger(e)?`integer`:`double`:null;if(t)return{value:e,type:t}}function _i(){return!1}function N(){return ui(Zt()).getCurrentScope()}function P(){return ui(Zt()).getIsolationScope()}function vi(){return $t(`globalScope`,()=>new Xr)}function yi(...e){let t=ui(Zt());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function bi(...e){let t=ui(Zt());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function F(){return N().getClient()}function xi(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Ur()};return n&&(i.parent_span_id=n),i}var Si=`sentry.source`,Ci=`sentry.sample_rate`,I=`sentry.op`,L=`sentry.origin`,wi=`sentry.measurement_unit`,Ti=`sentry.measurement_value`,Ei=`sentry.release`,Di=`sentry.environment`,Oi=`sentry.sdk.integrations`,ki=`user.id`,Ai=`user.email`,ji=`user.ip_address`,Mi=`user.name`,Ni=`sentry.custom_span_name`,Pi=`sentry.profile_id`,Fi=`sentry.exclusive_time`,Ii=`cache.hit`,Li=`cache.key`,Ri=`cache.item_size`,zi=`http.request.method`,Bi=`gen_ai.conversation.id`;function Vi(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 Hi(e,t){e.setAttribute(`http.response.status_code`,t);let n=Vi(t);n.message!==`unknown_error`&&e.setStatus(n)}var Ui=`_sentryScope`,Wi=`_sentryIsolationScope`,Gi=Symbol.for(`sentry.otelSourceInference`),Ki=Symbol.for(`sentry.otelSourceExplicitlySet`),qi=Symbol.for(`sentry.tracerProviderSpan`);function Ji(e,t,n){e&&(Hn(e,Wi,Wr(n)),Hn(e,Ui,t))}function Yi(e){let t=e;return{scope:t[Ui],isolationScope:Gr(t[Wi])}}function Xi(e){Hn(e,Gi,!0)}function Zi(e){return e[Gi]===!0}function Qi(e){Hn(e,Ki,!0)}function $i(e){return e[Ki]===!0}function ea(e){Hn(e,qi,!0)}function ta(e){return e[qi]===!0}var na=`sentry-`;function ra(e){let t=aa(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.startsWith(`sentry-`)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function ia(e){if(e)return sa(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`${na}${t}`]=n),e),{}))}function aa(e){if(e&&(Nn(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=oa(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):oa(e)}function oa(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}function sa(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((e,[t,n],r)=>{let i=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,a=r===0?i:`${e},${i}`;return a.length>8192?(O&&j.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}function ca(e,t){if(!e)return t;let n=aa(e),r=aa(t);if(!r)return e;let i={},a=!1,o={},s={};for(let[e,t]of Object.entries(r))e.startsWith(`sentry-`)?(o[e]=t,a=!0):s[e]=t;if(n)for(let[e,t]of Object.entries(n))(!a||!e.startsWith(`sentry-`))&&(i[e]=t);a&&Object.assign(i,o);for(let[e,t]of Object.entries(s))i[e]??(i[e]=t);return sa(i)}var la=/^o(\d+)\./,ua=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function da(e){return e===`http`||e===`https`}function fa(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function pa(e){let t=ua.exec(e);if(!t){rn(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return ma({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function ma(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function ha(e){if(!O)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>!e[t]&&(j.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?da(r)?t&&isNaN(parseInt(t,10))?(j.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(j.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(j.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function ga(e){return e.match(la)?.[1]}function _a(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=ga(n)),r}function va(e){let t=typeof e==`string`?pa(e):ma(e);if(t&&ha(t))return t}function ya(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 ba=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function xa(e){if(!e)return;let t=e.match(ba);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 Sa(e){return!!e.parentSpanId||!!e.dsc}function Ca(e,t){let n=xa(e),r=ra(t);if(!n?.traceId)return{traceId:Hr(),sampleRand:Zn()};let i=Ea(n,r);r&&(r.sample_rand=i.toString());let{traceId:a,parentSpanId:o,parentSampled:s}=n;return{traceId:a,parentSpanId:o,sampled:s,dsc:r||{},sampleRand:i}}function wa(e=Hr(),t=Ur(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Ta(e=Hr(),t=Ur(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Ea(e,t){let n=ya(t?.sample_rand);if(n!==void 0)return n;let r=ya(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?Zn()*r:r+Zn()*(1-r):Zn()}function Da(e,t){let n=_a(e);return t&&n&&t!==n?(j.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):e.getOptions().strictTraceContinuation&&(t&&!n||!t&&n)?(j.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 Oa=!1;function ka(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:a,status:o,origin:s,links:c}=R(e);return{parent_span_id:a,span_id:t,trace_id:n,data:r,op:i,status:o,origin:s,links:c}}function Aa(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:R(e).parent_span_id,a=Yi(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Ur():t,trace_id:n}}function ja(e){let{traceId:t,spanId:n}=e.spanContext();return wa(t,n,Ha(e))}function Ma(e){let{traceId:t,spanId:n}=e.spanContext();return Ta(t,n,Ha(e))}function Na(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function Pa(e){if(e?.length)return e.map(({context:{spanId:e,traceId:t,traceFlags:n},attributes:r})=>({span_id:e,trace_id:t,sampled:n===1,attributes:r}))}function Fa(e){return typeof e==`number`?Ia(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Ia(e.getTime()):Ir()}function Ia(e){return e>9999999999?e/1e3:e}function R(e){if(Va(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Ba(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:Ra(e),start_timestamp:Fa(i),timestamp:Fa(o)||void 0,status:Ua(s),op:r[I],origin:r[L],links:Na(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function La(e){if(Va(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Ba(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{name:a,span_id:t,trace_id:n,parent_span_id:Ra(e),start_timestamp:Fa(i),end_timestamp:Fa(o),is_segment:e===Za(e),status:Wa(s),attributes:Ga(r,s),links:Pa(c)}}return{span_id:t,trace_id:n,start_timestamp:0,name:``,end_timestamp:0,status:`ok`,is_segment:e===Za(e)}}function Ra(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function za(e){return{...e,attributes:pi(e.attributes),links:e.links?.map(e=>({...e,attributes:pi(e.attributes)}))}}function Ba(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Va(e){return typeof e.getSpanJSON==`function`}function Ha(e){let{traceFlags:t}=e.spanContext();return t===1}function Ua(e){if(e&&e.code!==0)return e.code===1?`ok`:e.message||`internal_error`}function Wa(e){return!e||e.code===1||e.code===0||e.message===`cancelled`?`ok`:`error`}function Ga(e,t){let n=Wa(t)===`error`?t?.message:void 0;return{...n&&{"sentry.status.message":n},...e}}var Ka=`_sentryChildSpans`,qa=`_sentryRootSpan`;function Ja(e,t){let n=e[qa]||e;Hn(t,qa,n),Ha(e)&&(e.isRecording()||n.isRecording())&&(e[Ka]?e[Ka].add(t):Hn(e,Ka,new Set([t])))}function Ya(e){let t=new Set;function n(e){if(!t.has(e)&&Ha(e)){t.add(e);let r=e[Ka]?Array.from(e[Ka]):[];for(let e of r)n(e)}}return n(e),Array.from(t)}var Xa=Za;function Za(e){return e[qa]||e}function z(){let e=ui(Zt());return e.getActiveSpan?e.getActiveSpan():Jr(N())}function Qa(){Oa||=(rn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}function $a(e,t){e.updateName(t),e.setAttributes({[Si]:`custom`,[Ni]:t})}function eo(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||F()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function to(e){j.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function no(e,t){if(!t?.length)return!1;for(let n of t){if(ao(n)){if(e.description&&_r(e.description,n))return O&&to(e),!0;continue}let t=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!t)continue;let r=!n.name||e.description&&_r(e.description,n.name),i=!n.op||e.op&&_r(e.op,n.op),a=!n.attributes||Object.entries(n.attributes).every(([t,n])=>ro(e.attributes?.[t],n));if(r&&i&&a)return O&&to(e),!0}return!1}function ro(e,t){return typeof e==`string`&&(typeof t==`string`||t instanceof RegExp)?_r(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function io(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function ao(e){return typeof e==`string`||e instanceof RegExp}var oo=Symbol.for(`sentry.nonRecordingSpan`),so=class{constructor(e={}){this._traceId=e.traceId||Hr(),this._spanId=e.spanId||Ur(),this.dropReason=e.dropReason,Hn(this,oo,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:0}}end(e){}setAttribute(e,t){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}recordException(e,t){}};function co(e){return!!e&&e[oo]===!0}var lo=`production`,uo=`_frozenDsc`;function fo(e,t){Hn(e,uo,t)}function po(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e,org_id:_a(t)};return t.emit(`createDsc`,i),i}function mo(e,t){let n=t.getPropagationContext();return n.dsc||po(n.traceId,e)}function ho(e){let t=F();if(!t)return{};let n=Xa(e),r=R(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n[uo];if(c)return s(c);let l=co(n),u=l&&n.dropReason===`ignored`;if(l&&(!eo(t.getOptions())||u)){let e=Yi(n).scope;if(e){let n={...mo(t,e)};return u&&(n.sampled=`false`),s(n)}}let d=a?.get(`sentry.dsc`),f=d&&ra(d);if(f)return s(f);let p=po(e.spanContext().traceId,t),m=i[`sentry.source`]??i[`sentry.segment.name.source`],h=r.description;return m!==`url`&&h&&(p.transaction=h),eo()&&(p.sampled=String(Ha(n)),p.sample_rand=a?.get(`sentry.sample_rand`)??Yi(n).scope?.getPropagationContext().sampleRand.toString()),s(p),t.emit(`createDsc`,p,n),p}function go(e){return ia(ho(e))}function _o(e){return Hn(e,`_streamed`,!0),e}function vo(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}function yo(e,t=[]){return[e,t]}function bo(e,t){let[n,r]=e;return[n,[...r,t]]}function xo(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function So(e,t){return xo(e,(e,n)=>t.includes(n))}function Co(e){let t=Qt(k);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function wo(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Co(r),e]:r.push(typeof e==`string`?Co(e):e)}for(let e of n){let[t,n]=e;if(i(`
6
- ${JSON.stringify(t)}
7
- `),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(ar(n))}i(e)}}return typeof r==`string`?r:To(r)}function To(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Eo(e){return[{type:`span`},e]}function Do(e){let t=typeof e.data==`string`?Co(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var Oo={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 ko(e){return e in Oo}function Ao(e){return ko(e)?Oo[e]:e}function jo(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Mo(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(Qn()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:fa(r)},...i&&{trace:i}}}function No(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 Po(e,t,n,r){let i=jo(n);return yo({sent_at:new Date(Qn()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:fa(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Fo(e,t,n,r){let i=jo(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;No(e,n?.sdk);let o=Mo(e,i,r,t);return delete e.sdkProcessingMetadata,yo(o,[[{type:a},e]])}function Io(e,t){function n(e){return!!e.trace_id&&!!e.public_key}let r=ho(e[0]),i=t?.getDsn(),a=t?.getOptions().tunnel,o={sent_at:new Date(Qn()).toISOString(),...n(r)&&{trace:r},...!!a&&i&&{dsn:fa(i)}},{beforeSendSpan:s,ignoreSpans:c}=t?.getOptions()||{},l=c?.length?e.filter(e=>{let t=R(e);return!no({description:t.description,op:t.op,attributes:t.data},c)}):e,u=e.length-l.length;u&&t?.recordDroppedEvent(`before_send`,`span`,u);let d=s?e=>{let t=R(e);return(vo(s)?t:s(t))||(Qa(),t)}:R,f=[];for(let e of l){let t=d(e);t&&f.push(Eo(t))}return yo(o,f)}function Lo(e){if(!O)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`,parent_span_id:r}=R(e),{spanId:i}=e.spanContext(),a=Ha(e),o=Xa(e),s=o===e,c=`[Tracing] Starting ${a?`sampled`:`unsampled`} ${s?`root `:``}span`,l=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(r&&l.push(`parent ID: ${r}`),!s){let{op:e,description:t}=R(o);l.push(`root ID: ${o.spanContext().spanId}`),e&&l.push(`root op: ${e}`),t&&l.push(`root description: ${t}`)}j.log(`${c}
8
- ${l.join(`
9
- `)}`)}function Ro(e){if(!O)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`}=R(e),{spanId:r}=e.spanContext(),i=`[Tracing] Finishing "${n}" ${Xa(e)===e?`root `:``}span "${t}" with ID ${r}`;j.log(i)}function zo(e,t,n,r=z()){let i=r&&Xa(r);i&&(O&&j.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Ti]:t,[wi]:n}))}function Bo(e){if(!e||e.length===0)return;let t={};return e.forEach(e=>{let n=e.attributes||{},r=n[wi],i=n[Ti];typeof r==`string`&&typeof i==`number`&&(t[e.name]={value:i,unit:r})}),t}function Vo(e){Qt(Zt()).segmentSpanCaptureStrategy=e}function Ho(){return Qt(Zt()).segmentSpanCaptureStrategy}function Uo(e){return e.getOptions().traceLifecycle===`stream`}var Wo=1e3,Go=class{constructor(e={}){this._traceId=e.traceId||Hr(),this._spanId=e.spanId||Ur(),this._startTime=e.startTimestamp||Ir(),this._links=e.links,this._attributes={},this.setAttributes({[L]:`manual`,[I]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),`sampled`in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._frozen||(this._links?this._links.push(e):this._links=[e]),this}addLinks(e){return this._frozen||(this._links?this._links.push(...e):this._links=e),this}recordException(e,t){}spanContext(){let{_spanId:e,_traceId:t,_sampled:n}=this;return{spanId:e,traceId:t,traceFlags:+!!n}}setAttribute(e,t){return this._frozen?this:(t===void 0?delete this._attributes[e]:this._attributes[e]=t,e===`sentry.source`&&t!==void 0&&Zi(this)&&Qi(this),this)}setAttributes(e){return Object.keys(e).forEach(t=>this.setAttribute(t,e[t])),this}updateStartTime(e){this._frozen||(this._startTime=Fa(e))}setStatus(e){return this._frozen||(this._status=e),this}updateName(e){return this._frozen?this:(this._name=e,Zi(this)||this.setAttribute(Si,`custom`),this)}end(e){if(this._endTime){this._frozen=ta(this);return}this._endTime=Fa(e),Ro(this),this._onSpanEnded(),this._frozen=ta(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[I],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Ua(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[L],profile_id:this._attributes[Pi],exclusive_time:this._attributes[Fi],measurements:Bo(this._events),is_segment:this._isStandaloneSpan&&Xa(this)===this||void 0,segment_id:this._isStandaloneSpan?Xa(this).spanContext().spanId:void 0,links:Na(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===Xa(this),status:Wa(this._status),attributes:Ga(this._attributes,this._status),links:Pa(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,t,n){if(this._frozen)return this;O&&j.log(`[Tracing] Adding an event to span:`,e);let r=Ko(t)?t:n||Ir(),i=Ko(t)?{}:t||{},a={name:e,time:Fa(r),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=F();e&&(e.emit(`spanEnd`,this),this._isStandaloneSpan||e.emit(`afterSpanEnd`,this));let t=Xa(this),n=this._isStandaloneSpan||this===t;if(this._isStandaloneSpan){this._sampled?Yo(Io([this],e)):(O&&j.log(`[Tracing] Discarding standalone span because its trace was not chosen to be sampled.`),e&&e.recordDroppedEvent(`sample_rate`,`span`));return}if(!n){let e=Ho();if(e){let n=Yi(this).scope||N();e.onChildSpanEnded(this,t,e=>this._convertSpanToTransaction(e),n)}return}if(e&&Uo(e)){e.emit(`afterSegmentSpanEnd`,this);return}let r=Yi(this).scope||N(),i=Ho();if(i)i.onSegmentSpanEnded(e=>this._convertSpanToTransaction(e),r);else{let e=this._convertSpanToTransaction();e&&r.captureEvent(e)}}_convertSpanToTransaction(e={}){if(!qo(R(this)))return;this._name||=(O&&j.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),`<unlabeled transaction>`);let{scope:t,isolationScope:n}=Yi(this),r=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;e.onSpanCaptured?.(this);let i=[];for(let t of Ya(this)){if(t===this||Jo(t)||e.isSpanAlreadyCaptured?.(t))continue;let n=R(t);qo(n)&&(e.onSpanCaptured?.(t),i.push(n))}let a=this._attributes[Si];delete this._attributes[Ni];let o=!1;i.forEach(e=>{delete e.data[Ni],e.op?.startsWith(`gen_ai.`)&&(o=!0)});let s={contexts:{trace:ka(this)},spans:i.length>Wo?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,Wo):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:ho(this),hasGenAiSpans:o},request:r,...a&&{transaction_info:{source:a}}},c=Bo(this._events);return c&&Object.keys(c).length&&(O&&j.log(`[Measurements] Adding measurements to transaction event`,JSON.stringify(c,void 0,2)),s.measurements=c),s}};function Ko(e){return e&&typeof e==`number`||e instanceof Date||Array.isArray(e)}function qo(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function Jo(e){return e instanceof Go&&e.isStandaloneSpan()}function Yo(e){let t=F();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent(`before_send`,`span`);return}t.sendEnvelope(e)}function Xo(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(e){throw t(e),n(),e}return Zo(i,t,n,r)}function Zo(e,t,n,r){return zn(e)?ti(e,e=>{n(),r(e)},e=>{t(e),n()}):(n(),r(e),e)}function Qo(e,t,n){if(!eo(e))return[!1];let r,i;typeof e.tracesSampler==`function`?(i=e.tracesSampler({...t,inheritOrSampleWith:e=>typeof t.parentSampleRate==`number`?t.parentSampleRate:typeof t.parentSampled==`boolean`?Number(t.parentSampled):e}),r=!0):t.parentSampled===void 0?e.tracesSampleRate!==void 0&&(i=e.tracesSampleRate,r=!0):i=t.parentSampled;let a=ya(i);if(a===void 0)return O&&j.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(!a)return O&&j.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,a,r];let o=n<a;return o||O&&j.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[o,a,r]}var $o=`__SENTRY_SUPPRESS_TRACING__`;function B(e,t){let n=us();if(n.startSpan)return n.startSpan(e,t);let r=ls(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return yi(s,()=>ms(a)(()=>{let n=N(),o=ps(n,a),s=F(),c=e.onlyIfParent&&!o?ss(n,s):cs({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!gs(c)||!o)&&qr(n,c),Xo(()=>t(c),()=>{let{status:e}=R(c);c.isRecording()&&(!e||e===`ok`)&&c.setStatus({code:2,message:`internal_error`})},()=>{c.end()})}))}function es(e,t){let n=us();if(n.startSpanManual)return n.startSpanManual(e,t);let r=ls(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return yi(s,()=>ms(a)(()=>{let n=N(),o=ps(n,a),s=e.onlyIfParent&&!o?ss(n,F()):cs({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!gs(s)||!o)&&qr(n,s),Xo(()=>t(s,()=>s.end()),()=>{let{status:e}=R(s);s.isRecording()&&(!e||e===`ok`)&&s.setStatus({code:2,message:`internal_error`})})}))}function V(e){let t=us();return t.startInactiveSpan?t.startInactiveSpan(e):ns(e)}function ts(e){return ns(e)}function ns(e){let t=ls(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?t=>yi(e.scope,t):r===void 0?e=>e():e=>H(r,e))(()=>{let i=N(),a=ps(i,r),o=F();return e.onlyIfParent&&!a?ss(i,o):cs({parentSpan:a,spanArguments:t,forceTransaction:n,scope:i})})}var rs=(e,t)=>{let n=ui(Zt());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=F(),o=ra(i);return a&&!Da(a,o?.org_id)?os(t):yi(e=>{let n=Ca(r,i);return e.setPropagationContext(n),qr(e,void 0),t()})};function H(e,t){let n=us();return n.withActiveSpan?n.withActiveSpan(e,t):yi(n=>(qr(n,e||void 0),t(n)))}function is(e){let t=us();return t.suppressTracing?t.suppressTracing(e):yi(t=>{t.setSDKProcessingMetadata({[$o]:!0});let n=e();return t.setSDKProcessingMetadata({[$o]:void 0}),n})}function as(e=N()){let t=us();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[$o]===!0}function os(e){let t=us();return t.startNewTrace?t.startNewTrace(e):yi(t=>(t.setPropagationContext({traceId:Hr(),sampleRand:Zn()}),O&&j.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),H(null,e)))}function ss(e,t){t?.recordDroppedEvent(`no_parent_span`,`span`);let n=new so({traceId:e.getPropagationContext().traceId});return Ji(n,e,P()),n}function cs({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let i=P();if(!eo()){let t=r.getPropagationContext(),a=new so({traceId:e?e.spanContext().traceId:t.traceId});return e&&!n&&Ja(e,a),Ji(a,r,i),a}let a=F();if(hs(a,t)){as(r)||a?.recordDroppedEvent(`ignored`,`span`);let t=new so({dropReason:`ignored`,traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&Ja(e,t),Ji(t,r,i),t}let o;if(e&&!n)o=fs(e,r,t,i),Ja(e,o);else if(e){let n=ho(e),{traceId:a,spanId:s}=e.spanContext(),c=Ha(e);o=ds({traceId:a,parentSpanId:s,...t},r,i,c),fo(o,n)}else{let{traceId:e,dsc:n,parentSpanId:a,sampled:s}=r.getPropagationContext();o=ds({traceId:e,parentSpanId:a,...t},r,i,s),n&&fo(o,n)}return Lo(o),o}function ls(e){let t={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let n={...t};return n.startTimestamp=Fa(e.startTime),delete n.startTime,n}return t}function us(){return ui(Zt())}function ds(e,t,n,r){let i=F(),a=i?.getOptions()||{},{name:o=``}=e,s={spanAttributes:{...e.attributes},spanName:o,parentSampled:r};i?.emit(`beforeSampling`,s,{decision:!1});let c=s.parentSampled??r,l=s.spanAttributes,u=t.getPropagationContext(),d=as(t),[f,p,m]=d?[!1]:Qo(a,{name:o,parentSampled:c,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:ya(u.dsc?.sample_rate)},u.sampleRand),h=new Go({...e,attributes:{[Si]:`custom`,[Ci]:p!==void 0&&m?p:void 0,...l},sampled:f});return!f&&i&&!d&&(O&&j.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),i.recordDroppedEvent(`sample_rate`,Uo(i)?`span`:`transaction`)),Ji(h,t,n),i&&i.emit(`spanStart`,h),h}function fs(e,t,n,r){let{spanId:i,traceId:a}=e.spanContext(),o=as(t),s=!o&&Ha(e),c=s?new Go({...n,parentSpanId:i,traceId:a,sampled:s}):new so({traceId:a});Ja(e,c),Ji(c,t,r);let l=F();return l?(Uo(l)&&co(c)&&(co(e)&&e.dropReason?(c.dropReason=e.dropReason,l.recordDroppedEvent(e.dropReason,`span`)):o||(c.dropReason=`sample_rate`,l.recordDroppedEvent(`sample_rate`,`span`))),l.emit(`spanStart`,c),n.endTimestamp&&(l.emit(`spanEnd`,c),l.emit(`afterSpanEnd`,c)),c):c}function ps(e,t){if(t)return t;if(t===null)return;let n=Jr(e);if(!n)return;let r=F();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Xa(n):n}function ms(e){return e===void 0?e=>e():t=>H(e,t)}function hs(e,t){let n=e?.getOptions().ignoreSpans;return!e||!Uo(e)||!n?.length?!1:no({description:t.name||``,op:t.attributes?.[`sentry.op`]||t.op,attributes:t.attributes},n)}function gs(e){return co(e)&&e.dropReason===`ignored`}function _s(e,t,n){let r,i,a,o=n?.maxWait?Math.max(n.maxWait,t):0,s=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=e(),r}function l(){i!==void 0&&clearTimeout(i),a!==void 0&&clearTimeout(a),i=a=void 0}function u(){return i!==void 0||a!==void 0?c():r}function d(){return i&&clearTimeout(i),i=s(c,t),o&&a===void 0&&(a=s(c,o)),r}return d.cancel=l,d.flush=u,d}var vs=new WeakSet,ys=e=>vs.has(e),bs=e=>{vs.add(e)},xs=new WeakMap;function Ss(e){if(Ho()||Vo(Cs),xs.has(e))return;let t=new Set,n=_s(()=>{let e=[...t];t.clear();for(let t of e)t()},1,{maxWait:100});e.on(`flush`,()=>{n.flush()}),xs.set(e,e=>{t.add(e),n()})}var Cs={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&xs.get(n);if(!r){let t=e();t&&n?.captureEvent(t);return}r(()=>{let t=e({isSpanAlreadyCaptured:ys,onSpanCaptured:bs});t&&n.captureEvent(t)})},onChildSpanEnded(e,t,n,r){if(vs.has(e)||!vs.has(t))return;let i=r.getClient(),a=i&&xs.get(i),o=()=>{let e=n({isSpanAlreadyCaptured:ys,onSpanCaptured:bs});e?.contexts?.trace?.data&&(e.contexts.trace.data[`sentry.parent_span_already_sent`]=!0),e&&i?.captureEvent(e)};a?a(o):o()}},ws=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`,`addEventListener`],Ts=[`removeListener`,`off`,`removeEventListener`],Es=Symbol(`SentryScopeBoundListeners`),Ds;function Os(e){return Ds!==void 0&&(e===Ds||e.listener===Ds)}function ks(e,t=N()){let n=e;if(Is(n))return e;Fs(n);for(let e of ws)typeof n[e]==`function`&&(n[e]=Ms(n,n[e],t));for(let e of Ts)typeof n[e]==`function`&&(n[e]=Ns(n,n[e]));return typeof n.removeAllListeners==`function`&&(n.removeAllListeners=Ps(n,n.removeAllListeners)),e}function As(e,t){return function(...n){return yi(t,()=>e.apply(this,n))}}function js(e){return typeof e==`function`}function Ms(e,t,n){return function(...r){let i=r[0],a=r[1],o=r.slice(2);if(!js(a)||Os(a))return t.apply(this,r);let s=Is(e)||Fs(e),c=s.get(i);c||(c=new WeakMap,s.set(i,c));let l=c.get(a);l||(l=As(a,n),c.set(a,l));let u=Ds;Ds=l;try{return t.call(this,i,l,...o)}finally{Ds=u}}}function Ns(e,t){return function(...n){let r=n[0],i=n[1],a=n.slice(2),o=js(i)?Is(e)?.get(r)?.get(i):void 0;return o?t.call(this,r,o,...a):t.apply(this,n)}}function Ps(e,t){return function(...n){let r=Is(e);if(r){if(n.length===0)Fs(e);else{let e=n[0];r.delete(e)}}return t.apply(this,n)}}function Fs(e){let t=new Map;return e[Es]=t,t}function Is(e){return e[Es]}function Ls(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Vs(e,t),r&&Ws(e,r),Gs(e,n),Hs(e,i),Us(e,a)}function Rs(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;zs(e,`extra`,n),zs(e,`tags`,r),zs(e,`attributes`,i),zs(e,`user`,a),zs(e,`contexts`,o),e.sdkProcessingMetadata=Vr(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function zs(e,t,n){e[t]=Vr(e[t],n,1)}function Bs(e,t){let n=vi().getScopeData();return e&&Rs(n,e.getScopeData()),t&&Rs(n,t.getScopeData()),n}function Vs(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function Hs(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Us(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Ws(e,t){e.contexts={trace:Aa(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ho(t),...e.sdkProcessingMetadata};let n=R(Xa(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Gs(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 Ks(e){let t={},{response:n,profile:r,cloud_resource:i,culture:a,state:o}=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[e,n]of Object.entries(i))n!=null&&(t[e]=n);a&&(a.locale&&(t[`culture.locale`]=a.locale),a.timezone&&(t[`culture.timezone`]=a.timezone)),o?.state&&typeof o.state.type==`string`&&(t[`state.type`]=o.state.type);let s=e.angular;if(s){let e=s.version;(typeof e==`string`||typeof e==`number`)&&(t[`angular.version`]=e)}let c=e.react;if(c){let e=c.version;(typeof e==`string`||typeof e==`number`)&&(t[`react.version`]=e)}return t}var qs=`aws.dynamodb.attribute_definitions`,Js=`aws.dynamodb.consistent_read`,Ys=`aws.dynamodb.consumed_capacity`,Xs=`aws.dynamodb.count`,Zs=`aws.dynamodb.exclusive_start_table`,Qs=`aws.dynamodb.global_secondary_indexes`,$s=`aws.dynamodb.global_secondary_index_updates`,ec=`aws.dynamodb.index_name`,tc=`aws.dynamodb.item_collection_metrics`,nc=`aws.dynamodb.limit`,rc=`aws.dynamodb.local_secondary_indexes`,ic=`aws.dynamodb.projection`,ac=`aws.dynamodb.provisioned_read_capacity`,oc=`aws.dynamodb.provisioned_write_capacity`,sc=`aws.dynamodb.scanned_count`,cc=`aws.dynamodb.scan_forward`,lc=`aws.dynamodb.segment`,uc=`aws.dynamodb.select`,dc=`aws.dynamodb.table_count`,fc=`aws.dynamodb.table_names`,pc=`aws.dynamodb.total_segments`,mc=`aws.kinesis.stream.name`,hc=`aws.request.extended_id`,gc=`aws.request.id`,_c=`aws.s3.bucket`,vc=`aws.secretsmanager.secret.arn`,yc=`aws.sns.topic.arn`,bc=`aws.step_functions.activity.arn`,xc=`aws.step_functions.state_machine.arn`,Sc=`cache.key`,Cc=`cloud.region`,wc=`code.function.name`,Tc=`db.collection.name`,Ec=`db.name`,Dc=`db.namespace`,Oc=`db.operation`,kc=`db.operation.batch.size`,Ac=`db.operation.name`,jc=`db.query.text`,Mc=`db.statement`,Nc=`db.system`,Pc=`db.system.name`,Fc=`db.user`,Ic=`error.type`,Lc=`faas.execution`,Rc=`faas.invoked_name`,zc=`faas.invoked_provider`,Bc=`faas.invoked_region`,Vc=`faas.name`,Hc=`faas.trigger`,Uc=`gen_ai.embeddings.input`,Wc=`gen_ai.function_id`,Gc=`gen_ai.input.messages`,Kc=`gen_ai.operation.name`,qc=`gen_ai.output.messages`,Jc=`gen_ai.request.available_tools`,Yc=`gen_ai.request.max_tokens`,Xc=`gen_ai.request.model`,Zc=`gen_ai.request.stop_sequences`,Qc=`gen_ai.request.temperature`,$c=`gen_ai.request.top_p`,el=`gen_ai.response.finish_reasons`,tl=`gen_ai.response.id`,nl=`gen_ai.response.model`,rl=`gen_ai.response.streaming`,il=`gen_ai.system`,al=`gen_ai.tool.input`,ol=`gen_ai.tool.name`,sl=`gen_ai.tool.output`,cl=`gen_ai.tool.type`,ll=`gen_ai.usage.input_tokens`,ul=`gen_ai.usage.output_tokens`,dl=`gen_ai.usage.total_tokens`,fl=`graphql.document`,pl=`graphql.operation.name`,ml=`graphql.operation.type`,hl=`http.client_ip`,gl=`http.flavor`,_l=`http.host`,vl=`http.method`,yl=`http.request.method`,bl=`http.response.status_code`,xl=`http.route`,Sl=`http.scheme`,Cl=`http.status_code`,wl=`http.target`,Tl=`http.url`,El=`http.user_agent`,Dl=`koa.name`,Ol=`koa.type`,kl=`messaging.batch.message_count`,Al=`messaging.destination`,jl=`messaging.destination.name`,Ml=`messaging.message.id`,Nl=`messaging.operation.name`,Pl=`messaging.operation.type`,Fl=`messaging.system`,Il=`network.peer.address`,Ll=`network.peer.port`,Rl=`network.protocol.name`,zl=`network.protocol.version`,Bl=`net.host.ip`,Vl=`net.host.name`,Hl=`net.host.port`,Ul=`net.peer.ip`,Wl=`net.peer.name`,Gl=`net.peer.port`,Kl=`net.transport`,ql=`rpc.grpc.status_code`,Jl=`rpc.method`,Yl=`rpc.service`,Xl=`rpc.system`,Zl=`sentry.graphql.operation`,Ql=`sentry.http.prefetch`,$l=`sentry.origin`,eu=`sentry.sdk.name`,tu=`sentry.sdk.version`,nu=`sentry.segment.id`,ru=`sentry.segment.name`,iu=`sentry.trace_lifecycle`,au=`server.address`,ou=`server.port`,su=`service.name`,cu=`service.version`,lu=`url.full`,uu=`url.path`,du=`url.query`,fu=`url.scheme`,pu=`user_agent.original`;function mu(e,t){let n=La(e),r=Za(e),i=La(r),{isolationScope:a,scope:o}=Yi(e),s=Bs(a,o);vu(n,i,t,s);let c=e.kind;t.emit(`preprocessSpan`,n,{spanKind:c}),n.is_segment&&(hu(n,s),_u(n,t),t.emit(`processSegmentSpan`,n)),t.emit(`processSpan`,n);let{beforeSendSpan:l}=t.getOptions(),u=l&&vo(l)?yu(n,l):n,d=u.attributes?.[Si];return n.is_segment&&d&&gu(u,{"sentry.segment.name.source":d}),{...za(u),_segmentSpan:r}}function hu(e,t){gu(e,Ks(t.contexts))}function gu(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}function _u(e,t){let n=t.getIntegrationNames();n.length&&gu(e,{[Oi]:n})}function vu(e,t,n,r){let i=n.getSdkMetadata(),{release:a,environment:o}=n.getOptions();gu(e,{[iu]:`stream`,[ru]:t.name,[nu]:t.span_id,[eu]:i?.sdk?.name,[tu]:i?.sdk?.version,[Ei]:a,[Di]:o||`production`,[ki]:r.user?.id,[Ai]:r.user?.email,[ji]:r.user?.ip_address,[Mi]:r.user?.username,...r.attributes})}function yu(e,t){return t(e)||(Qa(),e)}var bu=0,xu=1,Su=2;function Cu(e){return new Tu(t=>{t(e)})}function wu(e){return new Tu((t,n)=>{n(e)})}var Tu=class e{constructor(e){this._state=bu,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===bu)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===xu&&e[1](this._value),this._state===Su&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===bu){if(zn(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(xu,e)},r=e=>{t(Su,e)};try{e(n,r)}catch(e){r(e)}}};function Eu(e,t,n,r=0){try{let i=Du(t,n,e,r);return zn(i)?i:Cu(i)}catch(e){return wu(e)}}function Du(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return O&&a===null&&j.log(`Event processor "${i.id||`?`}" dropped event`),zn(a)?a.then(e=>Du(e,t,n,r+1)):Du(a,t,n,r+1)}var Ou,ku,Au,ju;function Mu(e){let t=k._sentryDebugIds,n=k._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(ju&&r.length===ku&&i.length===Au)return ju;ku=r.length,Au=i.length,ju={},Ou||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Ou?.[r];if(i&&ju&&t)ju[i[0]]=t,Ou&&(Ou[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&ju&&Ou){ju[i]=t,Ou[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),ju}function Nu(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Sr(),timestamp:t.timestamp||Nr()},l=n.integrations||e.integrations.map(e=>e.name);Pu(c,e),Lu(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Fu(c,e.stackParser);let u=zu(r,n.captureContext);n.mechanism&&Er(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Bs(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Ls(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Cu(c):Eu(m,c,n)).then(e=>(e&&Iu(e),typeof o==`number`&&o>0?Ru(e,o,s):e))}function Pu(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=mr(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=mr(e.value,a)})}function Fu(e,t){let n=Mu(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Iu(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function Lu(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Ru(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:ar(e.data,t,n)}}))},...e.user&&{user:ar(e.user,t,n)},...e.contexts&&{contexts:ar(e.contexts,t,n)},...e.extra&&{extra:ar(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=ar(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:ar(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=ar(e.contexts.flags,3,n)),r}function zu(e,t){if(!t)return e;let n=e?e.clone():new Xr;return n.update(t),n}function Bu(e){if(e)return Vu(e)||Uu(e)?{captureContext:e}:e}function Vu(e){return e instanceof Xr||typeof e==`function`}var Hu=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Uu(e){return Object.keys(e).some(e=>Hu.includes(e))}function U(e,t){return N().captureException(e,Bu(t))}function Wu(e,t){let n=typeof t==`string`?t:void 0,r=typeof t==`string`?void 0:{captureContext:t};return N().captureMessage(e,n,r)}function Gu(e,t){return N().captureEvent(e,t)}function Ku(e,t){P().setContext(e,t)}function qu(e){P().setExtras(e)}function Ju(e,t){P().setExtra(e,t)}function Yu(e){P().setTags(e)}function Xu(e,t){P().setTag(e,t)}function Zu(e){P().setAttributes(e)}function Qu(e,t){P().setAttribute(e,t)}function $u(e){P().setUser(e)}function ed(e){P().setConversationId(e)}function td(){return P().lastEventId()}async function nd(e){let t=F();return t?t.flush(e):(O&&j.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}async function rd(e){let t=F();return t?t.close(e):(O&&j.warn(`Cannot flush events and disable SDK. No client defined.`),Promise.resolve(!1))}function id(){return!!F()}function ad(){let e=F();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function od(e){P().addEventProcessor(e)}function sd(e){let t=P(),{user:n}=Bs(t,N()),{userAgent:r}=k.navigator||{},i=Lr({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&Rr(a,{status:`exited`}),cd(),t.setSession(i),i}function cd(){let e=P(),t=N().getSession()||e.getSession();t&&zr(t),ld(),e.setSession()}function ld(){let e=P(),t=F(),n=e.getSession();n&&t&&t.captureSession(n)}function ud(e=!1){if(e){cd();return}ld()}function dd(e,t,n){function r(){let r=fd({monitorSlug:e,status:`in_progress`},n),i=Ir();function a(t){fd({monitorSlug:e,status:t,checkInId:r,duration:Ir()-i})}let o;try{o=t()}catch(e){throw a(`error`),e}return zn(o)?o.then(e=>(a(`ok`),e),e=>{throw a(`error`),e}):(a(`ok`),o)}let i={...N().getPropagationContext()};return bi(()=>{if(n?.isolateTrace)return os(r);let e=N();return Sa(e.getPropagationContext())||e.setPropagationContext(i),r()})}function fd(e,t){let n=N(),r=F();if(!r)O&&j.warn(`Cannot capture check-in. No client defined.`);else if(!r.captureCheckIn)O&&j.warn(`Cannot capture check-in. Client does not support sending check-ins.`);else return r.captureCheckIn(e,t,n);return Sr()}function pd(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}function W(e,t=1){if(ui(Zt()).getTracingChannelBinding?.()){e();return}t&&pd(setTimeout(()=>{W(e,t-1)},1))}function md(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function hd(e){return`${md(e)}${e.projectId}/envelope/`}function gd(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function _d(e,t,n){return t||`${hd(e)}?${gd(e,n)}`}var vd=[];function yd(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function bd(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return yd(r)}function xd(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&Cd(e,t,n)}),n}function Sd(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Cd(e,t,n){if(n[t.name]){O&&j.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!vd.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),vd.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}[`processSpan`,`processSegmentSpan`].forEach(n=>{let r=t[n];typeof r==`function`&&e.on(n,n=>r.call(t,n,e))}),O&&j.log(`Integration installed: ${t.name}`)}function wd(e){let t=F();if(!t){O&&j.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function G(e){return e}function Td(e,t){let n={...e,...t};for(let r in t){let i=e[r],a=t[r];typeof i==`function`&&typeof a==`function`&&(n[r]=new Proxy(i,{apply:(e,t,n)=>(Reflect.apply(e,t,n),Reflect.apply(a,t,n))}))}return n}var Ed=`sentry.timestamp.sequence`,Dd=0,Od;function kd(e){let t=Math.floor(e*1e3);Od!==void 0&&t!==Od&&(Dd=0);let n=Dd;return Dd++,Od=t,{key:Ed,value:{value:n,type:`integer`}}}function Ad(e,t){return t?yi(t,()=>{let n=z(),r=n?Aa(n):xi(t);return[n?ho(n):mo(e,t),r]}):[void 0,void 0]}var jd={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function Md(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function Nd(){return!Md()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function Pd(){return typeof window<`u`&&(!Nd()||Fd())}function Fd(){return k.process?.type===`renderer`}function Id(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...Pd()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Ld(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=fa(r)),yo(a,[Id(e,i)])}var Rd=100;function zd(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function Bd(e,t){let n=Wd(),r=Ud(e);r===void 0?n.set(e,[t]):r.length>=Rd?(Hd(e,r),n.set(e,[t])):n.set(e,[...r,t])}function Vd(e,t=N(),n=Bd){let r=t?.getClient()??F();if(!r){O&&j.warn(`No client available to capture log.`);return}let{release:i,environment:a,enableLogs:o=!0,beforeSendLog:s}=r.getOptions();if(!o){O&&j.warn(`logging option not enabled, log will not be captured.`);return}let[,c]=Ad(r,t),l={...e.attributes},{user:{id:u,email:d,username:f},attributes:p={}}=Bs(P(),t);zd(l,`user.id`,u,!1),zd(l,`user.email`,d,!1),zd(l,`user.name`,f,!1),zd(l,`sentry.release`,i),zd(l,`sentry.environment`,a);let{name:m,version:h}=r.getSdkMetadata()?.sdk??{};zd(l,`sentry.sdk.name`,m),zd(l,`sentry.sdk.version`,h);let g=r.getIntegrationByName(`Replay`),_=g?.getReplayId(!0);zd(l,`sentry.replay_id`,_),_&&g?.getRecordingMode()===`buffer`&&zd(l,`sentry._internal.replay_is_buffering`,!0);let v=e.message;if(Pn(v)){let{__sentry_template_string__:e,__sentry_template_values__:t=[]}=v;t?.length&&(l[`sentry.message.template`]=e),t.forEach((e,t)=>{l[`sentry.message.parameter.${t}`]=e})}zd(l,`sentry.trace.parent_span_id`,Jr(t)?.spanContext().spanId);let y={...e,attributes:l};r.emit(`beforeCaptureLog`,y);let b=s?rn(()=>s(y)):y;if(!b){r.recordDroppedEvent(`before_send`,`log_item`,1),O&&j.warn(`beforeSendLog returned null, log will not be captured.`);return}let{level:ee,message:te,attributes:ne={},severityNumber:re}=b,ie=Ir(),ae=kd(ie);n(r,{timestamp:ie,level:ee,body:Kd(String(te)),trace_id:c?.trace_id,severity_number:re??jd[ee],attributes:Gd({...pi(p),...pi(ne,!0),[ae.key]:ae.value})}),r.emit(`afterCaptureLog`,b)}function Hd(e,t){let n=t??Ud(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Ld(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Wd().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Ud(e){return Wd().get(e)}function Wd(){return $t(`clientToLogBufferMap`,()=>new WeakMap)}function Gd(e){let t={};for(let[n,r]of Object.entries(e)){let e=Kd(n);t[e]=r.type===`string`?{...r,value:Kd(r.value)}:r}return t}function Kd(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 qd(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,...Pd()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Jd(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=fa(r)),yo(a,[qd(e,i)])}var Yd=1e3;function Xd(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function Zd(e,t){let n=rf(),r=nf(e);r===void 0?n.set(e,[t]):r.length>=Yd?(tf(e,r),n.set(e,[t])):n.set(e,[...r,t])}function Qd(e,t,n){let{release:r,environment:i}=t.getOptions(),a={...e.attributes};Xd(a,`user.id`,n.id,!1),Xd(a,`user.email`,n.email,!1),Xd(a,`user.name`,n.username,!1),Xd(a,`sentry.release`,r),Xd(a,`sentry.environment`,i);let{name:o,version:s}=t.getSdkMetadata()?.sdk??{};Xd(a,`sentry.sdk.name`,o),Xd(a,`sentry.sdk.version`,s);let c=t.getIntegrationByName(`Replay`),l=c?.getReplayId(!0);return Xd(a,`sentry.replay_id`,l),l&&c?.getRecordingMode()===`buffer`&&Xd(a,`sentry._internal.replay_is_buffering`,!0),{...e,attributes:a}}function $d(e,t,n,r){let[,i]=Ad(t,n),a=Jr(n),o=a?a.spanContext().traceId:i?.trace_id,s=a?a.spanContext().spanId:void 0,c=Ir(),l=kd(c);return{timestamp:c,trace_id:o??``,span_id:s,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 ef(e,t){let n=t?.scope??N(),r=t?.captureSerializedMetric??Zd,i=n?.getClient()??F();if(!i){O&&j.warn(`No client available to capture metric.`);return}let{_experiments:a,enableMetrics:o,beforeSendMetric:s}=i.getOptions();if(!(o??a?.enableMetrics??!0)){O&&j.warn(`metrics option not enabled, metric will not be captured.`);return}let{user:c,attributes:l}=Bs(P(),n),u=Qd(e,i,c);i.emit(`processMetric`,u);let d=s||a?.beforeSendMetric,f=d?d(u):u;if(!f){O&&j.log("`beforeSendMetric` returned `null`, will not send metric.");return}let p=$d(f,i,n,l);O&&j.log(`[Metric]`,p),r(i,p),i.emit(`afterCaptureMetric`,f)}function tf(e,t){let n=t??nf(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Jd(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);rf().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function nf(e){return rf().get(e)}function rf(){return $t(`clientToMetricBufferMap`,()=>new WeakMap)}function af(e){return za({trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||``,start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status===`ok`||e.status===`cancelled`?`ok`:`error`,is_segment:!1,attributes:{...e.data},links:e.links})}function of(e,t){if(e.type!==`transaction`||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||Uo(t))return;let n=[],r=[];for(let t of e.spans)t.op?.startsWith(`gen_ai.`)?n.push(af(t)):r.push(t);if(n.length===0)return;e.spans=r;let i=t.getDataCollectionOptions().userInfo?`auto`:`never`;return[{type:`span`,item_count:n.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...Pd()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var sf=Symbol.for(`SentryBufferFullError`);function cf(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return wu(sf);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Cu(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>pd(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var lf=6e4;function uf(e,t=Qn()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?lf:r-t}function df(e,t){return e[t]||e.all||0}function ff(e,t,n=Qn()){return df(e,t)>n}function pf(e,{statusCode:t,headers:n},r=Qn()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+uf(o,r):t===429&&(i.all=r+6e4);return i}function mf(e,t,n=cf(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(xo(i,(t,n)=>{let i=Ao(n);ff(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=yo(i[0],a),s=t=>{if(So(o,[`client_report`])){O&&j.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}xo(o,(n,r)=>{e.recordDroppedEvent(t,Ao(r))})};return n.add(()=>t({body:wo(o)}).then(e=>e.statusCode===413?(O&&j.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(O&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&j.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=pf(r,e),e),e=>{throw s(`network_error`),O&&j.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===sf)return O&&j.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function hf(e,t,n){let r=[{type:`client_report`},{timestamp:n||Nr(),discarded_events:e}];return yo(t?{dsn:t}:{},[r])}function gf(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 _f(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[Pi],exclusive_time:o?.[Fi],measurements:e.measurements,is_segment:!0}}function vf(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}var yf=`[Filtered]`,bf=[`forwarded`,`-ip`,`remote-`,`via`,`-user`],xf=[`auth`,`token`,`secret`,`session`,`password`,`passwd`,`pwd`,`key`,`jwt`,`bearer`,`sso`,`saml`,`csrf`,`xsrf`,`credentials`,`sid`,`identity`,`set-cookie`,`cookie`],Sf=[`.sid`,`sessid`,`remember`,`oidc`,`pkce`,`nonce`,`__secure-`,`__host-`,`awsalb`,`awselb`,`akamai`,`__stripe`,`cognito`,`firebase`,`supabase`,`sb-`,`mfa`,`2fa`];function Cf(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:bf},httpHeaders:{request:{deny:bf},response:{deny:bf}},httpBodies:[],urlQueryParams:{deny:bf},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var wf={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 Tf(e){return typeof e==`boolean`||`allow`in e||`deny`in e}function Ef(e,t){return e===void 0?{...t.httpHeaders}:Tf(e)?{request:e,response:e}:{request:e.request??t.httpHeaders.request,response:e.response??t.httpHeaders.response}}function Df(e){let t=e.dataCollection==null?Cf(e.sendDefaultPii):wf,n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:Ef(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 Of=`Not capturing exception because it's already been captured.`,kf=`Discarded session because of missing or non-string release`,Af=Symbol.for(`SentryInternalError`),jf=Symbol.for(`SentryDoNotSendEventError`),Mf=5e3;function Nf(e){return{message:e,[Af]:!0}}function Pf(e){return{message:e,[jf]:!0}}function Ff(e){return M(e)&&Af in e}function If(e){return M(e)&&jf in e}function Lf(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{if(a+=r(t),a>=8e5)i(e);else if(!s){let t=e.getOptions()._flushInterval??Mf;t>0&&(s=!0,o=pd(setTimeout(()=>{i(e)},t)))}}),e.on(`flush`,()=>{i(e)})}var Rf=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=cf(e.transportOptions?.bufferSize??64),this._dataCollection=Df(e),e.dsn?this._dsn=va(e.dsn):O&&j.warn(`No DSN provided, client will not send events.`),this._dsn){let t=_d(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs??!0,this._options.enableLogs&&Lf(this,`afterCaptureLog`,`flushLogs`,Gf,Hd),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Lf(this,`afterCaptureMetric`,`flushMetrics`,Wf,tf)}captureException(e,t,n){let r=Sr();if(Ar(e))return O&&j.log(Of),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:Sr(),...n},a=Pn(e)?e:String(e),o=Fn(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=Sr();if(t?.originalException&&Ar(t.originalException))return O&&j.log(Of),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=zf(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),Rr(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(this.emit(`flush`),!t)return!0;let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),Cd(this,e,this._integrations),t||Sd(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=of(e,this),r=Fo(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])r=bo(r,Do(e));n&&(r=bo(r,n)),this.sendEnvelope(r).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=lo}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){O&&j.warn(kf);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){O&&j.warn(kf);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Po(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;O&&j.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return O&&j.error(`Error while sending envelope:`,e),{}}return O&&j.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=xd(this,e),Sd(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(Rr(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=this.getIntegrationNames();return!t.integrations&&a.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Nu(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...xi(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:mo(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=N(),r=P()){return O&&Hf(e)&&j.log(`Captured error event \`${gf(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{O&&(If(e)?j.log(e.message):Ff(e)?j.warn(e.message):j.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Uf(e),s=Hf(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:ya(a),u=zf(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Pf("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:Bf(Vf(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Pf(`${c} returned \`null\`, will not send event.`)}let d=n.getSession()||r.getSession();if(s&&d&&this._updateSessionFromEvent(d,i),s&&typeof l==`number`&&Zn()>l)throw this.recordDroppedEvent(`sample_rate`,`error`),Pf(`Discarding event because it's not included in the random sample (sampling rate = ${a})`);if(o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let f=i.transaction_info;return o&&f&&i.transaction!==e.transaction&&(i.transaction_info={...f,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw If(e)||Ff(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Nf(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
10
- Reason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===sf&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){O&&j.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){O&&j.log(`No outcomes to send`);return}if(!this._dsn){O&&j.log(`No dsn provided, will not send outcomes`);return}O&&j.log(`Sending outcomes:`,e);let t=hf(e,this._options.tunnel&&fa(this._dsn));this.sendEnvelope(t)}};function zf(e){return e===`replay_event`?`replay`:e||`error`}function Bf(e,t){let n=`${t} must return \`null\` or a valid event.`;if(zn(e))return e.then(e=>{if(!In(e)&&e!==null)throw Nf(n);return e},e=>{throw Nf(`${t} rejected with ${e}`)});if(!In(e)&&e!==null)throw Nf(n);return e}function Vf(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!vo(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(Hf(c)&&i)return i(c,r);if(Uf(c)){if(s||o){let t=_f(c);if(o?.length&&no({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){let e=s(t);e?c=Vr(n,vf(e)):Qa()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&no({description:e.description,op:e.op,attributes:e.data},o)){io(n,e);continue}if(s){let n=s(e);n?t.push(n):(Qa(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function Hf(e){return e.type===void 0}function Uf(e){return e.type===`transaction`}function Wf(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Kf(e.attributes)}function Gf(e){let t=0;return e.message&&(t+=e.message.length*2),t+Kf(e.attributes)}function Kf(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*qf(e[0]):Fn(e)?t+=qf(e):t+=100}),t}function qf(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Jf(e){N().setClient(e)}var Yf=new Set;function Xf(e){e.forEach(e=>{Yf.add(e),O&&j.log(`AI provider "${e}" wrapping will be skipped`)})}function Zf(e){return Yf.has(e)}function Qf(){Yf.clear(),O&&j.log(`Cleared AI provider skip registrations`)}function $f(e,t){return t.some(t=>e.includes(t))}function ep(e,t,n){if(t===!1)return!0;let r=e.toLowerCase();if($f(r,n==null?xf:[...xf,...n]))return!0;if(t===!0)return!1;let i=(`deny`in t?t.deny:t.allow).some(e=>r.includes(e.toLowerCase()));return`deny`in t?i:!i}function tp(e,t,n){if(t===!1)return{};let r={};for(let i of Object.keys(e))r[i]=ep(i,t,n)?yf:e[i];return r}function np(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 a=e.slice(n,r).trim();if(t[a]===void 0){let n=e.slice(r+1,i).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));try{t[a]=n.indexOf(`%`)===-1?n:decodeURIComponent(n)}catch{t[a]=n}}n=i+1}return t}function rp(e,t){if(e&&t!==!1)return e.split(`&`).map(e=>{let n=e.indexOf(`=`),r=n===-1?e:e.slice(0,n),i=new URLSearchParams(`${r}=`).keys().next().value;return i!==void 0&&ep(i,t)?`${r}=${yf}`:e}).join(`&`)}function ip(e,t){let n=e.indexOf(`#`),r=n===-1?e.length:n,i=e.indexOf(`?`);if(i===-1||i>r)return e;let a=e.slice(0,i),o=e.slice(i+1,r),s=e.slice(r),c=rp(o,t);return c?`${a}?${c}${s}`:`${a}${s}`}function ap(e){return(e??F())?.getDataCollectionOptions().urlQueryParams??!0}function op(e,t){return e===void 0?void 0:ip(e,ap(t))}function sp(e,t){if(!e)return e;let n=e.startsWith(`?`),r=rp(n?e.slice(1):e,ap(t));return r&&n?`?${r}`:r}var cp=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),lp=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function up(e,t){let n=String(e).toLowerCase();return cp.has(n)?!1:lp.has(n)?!0:t?.strict?null:!!e}function dp(e,t,n,r,i){let a={sent_at:new Date(Qn()).toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=fa(i)),t&&(a.trace=t),yo(a,[fp(e)])}function fp(e){return[{type:`check_in`},e]}var pp=`thismessage:/`;function mp(e){return`isRelative`in e}function hp(e,t){let n=e.indexOf(`://`)<=0&&e.indexOf(`//`)!==0,r=t??(n?pp:void 0);try{if(`canParse`in URL&&!URL.canParse(e,r))return;let t=new URL(e,r);return n?{isRelative:n,pathname:t.pathname,search:t.search,hash:t.hash}:t}catch{}}function gp(e){if(mp(e))return e.pathname;let t=new URL(e);return t.search=``,t.hash=``,[`80`,`443`].includes(t.port)&&(t.port=``),t.password&&=`%filtered%`,t.username&&=`%filtered%`,t.toString()}function _p(e,t,n,r){return`${n?.method?.toUpperCase()??`GET`} ${r||(e?t===`client`?gp(e):e.pathname:`/`)}`}function vp(e,t,n,r,i,a){let o={[L]:n,[Si]:`url`};return i&&(o[t===`server`?`http.route`:`url.template`]=i,o[Si]=`route`),r?.method&&(o[zi]=r.method.toUpperCase()),e&&(e.search&&(o[`url.query`]=sp(e.search,a)),e.hash&&(o[`url.fragment`]=e.hash),e.pathname&&(o[`url.path`]=e.pathname,e.pathname===`/`&&(o[Si]=`route`)),mp(e)||(o[lu]=op(e.href,a),e.port&&(o[`url.port`]=e.port),e.protocol&&(o[`url.scheme`]=e.protocol),e.hostname&&(o[t===`server`?`server.address`:`url.domain`]=e.hostname))),[_p(e,t,r,i),o]}function yp(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 bp(e){return e.split(/[?#]/,1)[0]}function xp(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Sp(e,t=!0){if(e.startsWith(`data:`)){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:`text/plain`,i=e.includes(`;base64,`),a=e.indexOf(`,`),o=``;if(t&&a!==-1){let t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?`,base64`:``}${o?`,${o}`:``}`}return e}function Cp(e,t){let n=t?.getDsn(),r=t?.getOptions().tunnel;return Tp(e,n)||wp(e,r)}function wp(e,t){return t?Dp(e)===Dp(t):!1}function Tp(e,t){let n=hp(e);return!n||mp(n)||!t?!1:Ep(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function Ep(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function Dp(e){return e[e.length-1]===`/`?e.slice(0,-1):e}function Op(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 kp=Op;function Ap(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(e=>({name:`${r}:@sentry/${e}`,version:A})),i.version=A)}function jp(e={}){let t=e.client||F();if(!ad()||!t)return{};let n=ui(Zt());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||N(),i=e.span||z(),a=co(i)&&!eo(t.getOptions());if(!i&&_i())return{};let o=i&&!a?ja(i):Mp(r),s=ia(i?ho(i):mo(t,r));if(!ba.test(o))return j.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let c={"sentry-trace":o,baggage:s};return e.propagateTraceparent&&(c.traceparent=i&&!a?Ma(i):Np(r)),c}function Mp(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return wa(t,r,n)}function Np(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ta(t,r,n)}var Pp=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Fp(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return O&&!r&&j.log(Pp,e),r;let i=vr(e,t);return n?.set(e,i),O&&!i&&j.log(Pp,e),i}function Ip(e){return Object.entries(e||jp()).map(([e,t])=>`<meta name="${e}" content="${t}"/>`).join(``)}function Lp(e){return Array.from(new Set(e))}var Rp=1048576;function zp(e){return e===`small`?1e3:e===`medium`?1e4:Rp}function Bp(e){let t={};try{e.forEach((e,n)=>{typeof e==`string`&&(t[n]=e)})}catch{}return t}function Vp(e){let t=Object.create(null);try{Object.entries(e).forEach(([e,n])=>{typeof n==`string`?t[e]=n:typeof n==`number`&&(t[e]=String(n))})}catch{}return t}function Hp(e){let t=e.headers||{},n=(typeof t[`x-forwarded-host`]==`string`?t[`x-forwarded-host`]:void 0)||(typeof t.host==`string`?t.host:void 0),r=(typeof t[`x-forwarded-proto`]==`string`?t[`x-forwarded-proto`]:void 0)||e.protocol||(e.socket?.encrypted?`https`:`http`),i=e.url||``,a=Up({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:qp(i),headers:Vp(t),cookies:s,data:o}}function Up({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Wp(e,t=!1,n=`request`){let r=typeof t==`boolean`?Cf(t):t,i=n===`request`?r.httpHeaders.request:r.httpHeaders.response,a=r.cookies,o=`http.${n}.header.`,s={};try{let t={};for(let[n,r]of Object.entries(e)){if(r==null)continue;let e=n.toLowerCase();if(e===`cookie`||e===`set-cookie`){if(a===!1)continue;if(typeof r==`string`&&r!==``){let t=tp(Kp(r,e===`set-cookie`),a,Sf);for(let[n,r]of Object.entries(t))s[`${o}${Gp(e)}.${Gp(n)}`]=r}else s[`${o}${Gp(e)}`]=yf}else{if(i===!1)continue;Array.isArray(r)?t[e]=r.map(e=>e==null?e:String(e)).join(`;`):typeof r==`string`&&(t[e]=r)}}if(i!==!1){let e=tp(t,i);for(let[t,n]of Object.entries(e))s[`${o}${Gp(t)}`]=n}}catch{}return s}function Gp(e){return e.replace(/-/g,`_`)}function Kp(e,t){let n=e.indexOf(`;`),r=t&&n!==-1?e.substring(0,n):e,i=t?[r]:r.split(`; `),a={};for(let e of i){let t=e.indexOf(`=`),n=(t===-1?e:e.substring(0,t)).toLowerCase();a[n]=t===-1?``:e.substring(t+1)}return a}function qp(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}var K={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},Jp={[K.INTERNAL]:`INTERNAL`,[K.SERVER]:`SERVER`,[K.CLIENT]:`CLIENT`,[K.PRODUCER]:`PRODUCER`,[K.CONSUMER]:`CONSUMER`};function Yp(e){return Jp[e]}var Xp=100;function Zp(e,t){let n=F(),r=P();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=Xp}=n.getOptions();if(a<=0)return;let o={timestamp:Nr(),...e},s=i?rn(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}var Qp=`FunctionToString`,$p=new WeakMap,em=G((()=>({name:Qp,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Gn(this),r;try{$p.has(F())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){$p.set(e,!0)}}))),tm=[/^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$/],nm=`EventFilters`,rm=G((e={})=>{let t;return{name:nm,setup(n){t=am(e,n.getOptions())},processEvent(n,r,i){return t||=am(e,i.getOptions()),om(n,t)?null:n}}}),im=G(((e={})=>({...rm(e),name:`InboundFilters`})));function am(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:tm],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function om(e,t){if(!e.type){if(sm(e,t.ignoreErrors))return O&&j.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
11
- Event: ${wr(e)}`),!0;if(pm(e))return O&&j.warn(`Event dropped due to not having an error message, error type or stacktrace.
12
- Event: ${wr(e)}`),!0;if(lm(e,t.denyUrls))return O&&j.warn(`Event dropped due to being matched by \`denyUrls\` option.
13
- Event: ${wr(e)}.
14
- Url: ${fm(e)}`),!0;if(!um(e,t.allowUrls))return O&&j.warn(`Event dropped due to not being matched by \`allowUrls\` option.
15
- Event: ${wr(e)}.
16
- Url: ${fm(e)}`),!0}else if(e.type===`transaction`&&cm(e,t.ignoreTransactions))return O&&j.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
17
- Event: ${wr(e)}`),!0;return!1}function sm(e,t){return t?.length?gf(e).some(e=>vr(e,t)):!1}function cm(e,t){if(!t?.length)return!1;let n=e.transaction;return n?vr(n,t):!1}function lm(e,t){if(!t?.length)return!1;let n=fm(e);return n?vr(n,t):!1}function um(e,t){if(!t?.length)return!0;let n=fm(e);return!n||vr(n,t)}function dm(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 fm(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?dm(t):null}catch{return O&&j.error(`Cannot extract url for event ${wr(e)}`),null}}function pm(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function mm(e,t,n,r,i,a){if(!i.exception?.values||!a||!An(a.originalException))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=hm(e,t,r,a.originalException,n,i.exception.values,o,0))}function hm(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(An(r[i])){_m(o,s,r);let a=e(t,r[i]),l=c.length;vm(a,i,l,s),c=hm(e,t,n,r[i],i,[a,...c],a,l)}return gm(r)&&r.errors.forEach((a,l)=>{if(An(a)){_m(o,s,r);let u=e(t,a),d=c.length;vm(u,`errors[${l}]`,d,s),c=hm(e,t,n,a,i,[u,...c],u,d)}}),c}function gm(e){return Array.isArray(e.errors)}function _m(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...gm(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function vm(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}function ym(e,t){return e(t.stack||``,1)}function bm(e){return An(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function xm(e){return bm(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Sm(e,t){let n={type:t.name||t.constructor.name,value:xm(t)},r=ym(e,t);return r.length&&(n.stacktrace={frames:r}),n}function Cm(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(An(n))return n}}function wm(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message '${e.message}'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;let t=Jn(e);if(Mn(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=Tm(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function Tm(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Em(e,t,n,r){if(An(n))return[n,void 0];if(t.synthetic=!0,In(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:or(n,t)},a=Cm(n);if(a)return[a,i];let o=wm(n),s=r?.syntheticException||Error(o);return s.message=o,[s,i]}let i=r?.syntheticException||Error(n);return i.message=`${n}`,[i,void 0]}function Dm(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=Em(e,i,n,r),s={exception:{values:[Sm(t,a)]}};return o&&(s.extra=o),Tr(s,void 0,void 0),Er(s,i),{...s,event_id:r?.event_id}}function Om(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=ym(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Er(a,{synthetic:!0}))}if(Pn(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return a.logentry={message:e,params:n},a}return a.message=t,a}var km=`cause`,Am=5,jm=`LinkedErrors`,Mm=G(((e={})=>{let t=e.limit||Am,n=e.key||km;return{name:jm,preprocessEvent(e,r,i){mm(Sm,i.getOptions().stackParser,n,t,e,r)}}})),Nm=[`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 Pm(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Nm.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Fm(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&Im(e))||null}function Fm(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function Im(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 Lm=`RequestData`,Rm=G(((e={})=>{function t(t){let n=t.getDataCollectionOptions(),r={...n,...e.include?.cookies===!0&&n.cookies===!1&&{cookies:!0},...e.include?.headers===!0&&n.httpHeaders.request===!1&&{httpHeaders:{...n.httpHeaders,request:!0}},...e.include?.query_string===!0&&n.urlQueryParams===!1&&{urlQueryParams:!0}};return{dataCollection:r,include:{cookies:r.cookies!==!1,data:!0,headers:r.httpHeaders.request!==!1,ip:r.userInfo,query_string:r.urlQueryParams!==!1,url:!0,...e.include}}}return{name:Lm,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,{include:s,dataCollection:c}=t(r);return a&&zm(e,a,{ipAddress:o},s,c),e},processSegmentSpan(e,n){let{sdkProcessingMetadata:r={}}=P().getScopeData(),{normalizedRequest:i,ipAddress:a}=r;if(!i)return;let{include:o,dataCollection:s}=t(n);Bm(e,i,a,o,s)}}}));function zm(e,t,n,r,i){let a=Vm(t,r);if(a.query_string&&=Hm(a.query_string,i.urlQueryParams),a.url&&=ip(a.url,i.urlQueryParams),e.request={...e.request,...a},r.ip){let r=t.headers&&Pm(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Bm(e,t,n,r,i){let a=Vm(t,r),o={};if(a.url&&(o[lu]=ip(a.url,i.urlQueryParams)),a.method&&(o[`http.request.method`]=a.method),a.query_string&&(o[du]=Hm(a.query_string,i.urlQueryParams)),gu(e,o),a.cookies&&Object.keys(a.cookies).length>0&&gu(e,Wp({cookie:Object.entries(a.cookies).map(([e,t])=>`${e}=${t}`).join(`; `)},i,`request`)),a.headers&&gu(e,Wp(a.headers,i,`request`)),a.data!=null){let t=typeof a.data==`string`?a.data:JSON.stringify(a.data);t&&gu(e,{"http.request.body.data":t})}if(r.ip){let r=t.headers&&Pm(t.headers)||n||void 0;r&&gu(e,{[ji]:r})}}function Vm(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let e=new Set(Nm.map(e=>e.toLowerCase()));for(let t of Object.keys(r))e.has(t.toLowerCase())&&delete r[t]}return n.method=e.method,t.url&&(n.url=e.url),t.cookies&&(n.cookies=e.cookies||(r?.cookie?np(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Hm(e,t){let n=Um(e);return n?rp(n,t):void 0}function Um(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 Wm=new Set([]);function Gm(e){let t=`console`,n=En(t,e);return Dn(t,Jm),n}function Km(e){for(let t of e)Wm.add(t);return()=>{for(let t of e)Wm.delete(t)}}var qm=new Set;function Jm(){`console`in k&&en.forEach(function(e){!qm.has(e)&&e in k.console&&(qm.add(e),Vn(k.console,e,function(t){return nn[e]=t,function(...t){let n=t[0],r=nn[e],i=Wm.size&&typeof n==`string`&&vr(n,Wm);i||On(`console`,{args:t,level:e}),(!i||O&&j.isEnabled())&&r?.apply(k.console,t)}}))})}function Ym(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var Xm=`CaptureConsole`,Zm=G(((e={})=>{let t=e.levels||en,n=e.handled??!0;return{name:Xm,setup(e){`console`in k&&Gm(({args:r,level:i})=>{F()===e&&t.includes(i)&&Qm(r,i,n)})}}}));function Qm(e,t,n){let r=Ym(t),i=Error(),a={level:Ym(t),extra:{arguments:e}};yi(o=>{if(o.addEventProcessor(e=>(e.logger=`console`,Er(e,{handled:n,type:`auto.core.capture_console`}),e)),t===`assert`){if(!e[0]){let t=`Assertion failed: ${gr(e.slice(1),` `)||`console.assert`}`;o.setExtra(`arguments`,e.slice(1)),o.captureMessage(t,r,{captureContext:a,syntheticException:i})}return}let s=e.find(e=>e instanceof Error);if(s){U(s,a);return}let c=gr(e,` `);o.captureMessage(c,r,{captureContext:a,syntheticException:i})})}var $m=`Dedupe`,eh=G((()=>{let e;return{name:$m,processEvent(t){if(t.type)return t;try{if(th(t,e))return O&&j.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function th(e,t){return t?!!(nh(e,t)||rh(e,t)):!1}function nh(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!ah(e,t)||!ih(e,t))}function rh(e,t){let n=oh(t),r=oh(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!ah(e,t)||!ih(e,t))}function ih(e,t){let n=Sn(e),r=Sn(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function ah(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 oh(e){return e.exception?.values?.[0]}var sh=`ExtraErrorData`,ch=G(((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:sh,processEvent(e,r,i){let{maxValueLength:a}=i.getOptions();return lh(e,r,t,n,a)}}}));function lh(e,t={},n,r,i){if(!t.originalException||!An(t.originalException))return e;let a=t.originalException.name||t.originalException.constructor.name,o=uh(t.originalException,r,i);if(o){let t={...e.contexts},r=ar(o,n);return In(r)&&(tr(r),t[a]=r),{...e,contexts:t}}return e}function uh(e,t,n){try{let r=[`name`,`message`,`stack`,`line`,`column`,`fileName`,`lineNumber`,`columnNumber`,`toJSON`],i={};for(let t of Object.keys(e)){if(r.indexOf(t)!==-1)continue;let a=e[t];i[t]=An(a)||typeof a==`string`?n?mr(`${a}`,n):`${a}`:a}if(t&&e.cause!==void 0&&(i.cause=An(e.cause)?{[e.cause.name||e.cause.constructor.name]:uh(e.cause,!1,n)}:e.cause),typeof e.toJSON==`function`){let t=e.toJSON();for(let e of Object.keys(t)){let n=t[e];i[e]=An(n)?n.toString():n}}return i}catch(e){O&&j.error(`Unable to extract extra data from the Error object:`,e)}return null}function dh(e,t){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r===`.`?e.splice(t,1):r===`..`?(e.splice(t,1),n++):n&&(e.splice(t,1),n--)}if(t)for(;n--;)e.unshift(`..`);return e}var fh=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function ph(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=fh.exec(t);return n?n.slice(1):[]}function mh(...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=dh(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`}function hh(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 gh(e,t){e=mh(e).slice(1),t=mh(t).slice(1);let n=hh(e.split(`/`)),r=hh(t.split(`/`)),i=Math.min(n.length,r.length),a=i;for(let e=0;e<i;e++)if(n[e]!==r[e]){a=e;break}let o=[];for(let e=a;e<n.length;e++)o.push(`..`);return o=o.concat(r.slice(a)),o.join(`/`)}function _h(e){let t=ph(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}function vh(e,t){let n=ph(e)[2]||``;return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var yh=`RewriteFrames`,bh=G((e={})=>{let t=e.root,n=e.prefix||`app:///`,r=`window`in k&&!!k.window,i=e.iteratee||xh({isBrowser:r,root:t,prefix:n});function a(e){try{return{...e,exception:{...e.exception,values:e.exception.values.map(e=>({...e,...e.stacktrace&&{stacktrace:o(e.stacktrace)}}))}}}catch{return e}}function o(e){return{...e,frames:e?.frames?.map(e=>i(e))}}return{name:yh,processEvent(e){let t=e;return e.exception&&Array.isArray(e.exception.values)&&(t=a(t)),t}}});function xh({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(`/`),a=/^\//.test(r.filename);if(e){if(t){let e=r.filename;e.indexOf(t)===0&&(r.filename=e.replace(t,n))}}else if(i||a){let e=i?r.filename.replace(/^[a-zA-Z]:/,``).replace(/\\/g,`/`):r.filename;r.filename=`${n}${t?gh(t,e):vh(e)}`}return r}}var Sh=[`reauthenticate`,`signInAnonymously`,`signInWithOAuth`,`signInWithIdToken`,`signInWithOtp`,`signInWithPassword`,`signInWithSSO`,`signOut`,`signUp`,`verifyOtp`],Ch=[`createUser`,`deleteUser`,`listUsers`,`getUserById`,`updateUserById`,`inviteUserByEmail`],wh={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`},Th=[`select`,`insert`,`upsert`,`update`,`delete`];function Eh(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Dh(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function Oh(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function kh(e,t){return Oh(e,t)!==void 0}function Ah(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(e=>e.toLowerCase()===r);return i===void 0?void 0:n[i]}function jh(e,t={}){switch(e){case`GET`:return`select`;case`POST`:return Ah(t,`Prefer`)?.includes(`resolution=`)?`upsert`:`insert`;case`PATCH`:return`update`;case`DELETE`:return`delete`;default:return`<unknown-op>`}}function Mh(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 i=n?.startsWith(`fts`)?`textSearch`:n?.startsWith(`plfts`)?`textSearch[plain]`:n?.startsWith(`phfts`)?`textSearch[phrase]`:n?.startsWith(`wfts`)?`textSearch[websearch]`:n&&wh[n]||`filter`,`${i}(${e}, ${r.join(`.`)})`}function Nh(e,t=!1){return new Proxy(e,{apply(n,r,i){return B({name:`auth ${t?`(admin) `:``}${e.name}`,attributes:{[L]:`auto.db.supabase`,[I]:`db`,"db.system":`postgresql`,"db.operation":`auth.${t?`admin.`:``}${e.name}`}},e=>Reflect.apply(n,r,i).then(t=>(M(t)&&`error`in t&&t.error?(e.setStatus({code:2}),U(t.error,{mechanism:{handled:!1,type:`auto.db.supabase.auth`}})):e.setStatus({code:1}),e.end(),t)).catch(t=>{throw e.setStatus({code:2}),e.end(),U(t,{mechanism:{handled:!1,type:`auto.db.supabase.auth`}}),t}).then(...i))}})}function Ph(e){let t=e.auth;if(t&&!Dh(e.auth)){for(let n of Sh){let r=t[n];r&&typeof e.auth[n]==`function`&&(e.auth[n]=Nh(r))}for(let n of Ch){let r=t.admin[n];r&&typeof e.auth.admin[n]==`function`&&(e.auth.admin[n]=Nh(r,!0))}Eh(e.auth)}}function Fh(e,t){Dh(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(e,n,r){let i=Reflect.apply(e,n,r),a=i.constructor;return Lh(a,t),i}}),Eh(e.prototype.from))}function Ih(e,t){Dh(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(e,n,r){let i=Th,a=n,o=jh(a.method,a.headers);if(!i.includes(o)||!a?.url?.pathname||typeof a.url.pathname!=`string`)return Reflect.apply(e,n,r);let s=a.url.pathname.split(`/`),c=s.length>0?s[s.length-1]:``,l=[];for(let[e,t]of a.url.searchParams.entries())l.push(Mh(e,t));let u=Object.create(null);if(In(a.body))for(let[e,t]of Object.entries(a.body))u[e]=t;let d=F(),f=t.sendOperationData??d?.getDataCollectionOptions().databaseQueryData===!0,p=Oh(a.body,u),m=o===`select`?``:`${o}${kh(a.body,u)?`(...) `:``}`,h=f?l.join(` `):l.length>0?`[redacted]`:``,g=[m.trimEnd(),h].filter(Boolean).join(` `),_=g?`${g} from(${c})`:`from(${c})`,v={"db.table":c,"db.schema":a.schema,"db.url":a.url.origin,"db.sdk":Ah(a.headers,`X-Client-Info`),"db.system":`postgresql`,"db.operation":o,[L]:`auto.db.supabase`,[I]:`db`};return l.length&&f&&(v[`db.query`]=l),p!==void 0&&f&&(v[`db.body`]=p),B({name:_,attributes:v},t=>Reflect.apply(e,n,[]).then(e=>{if(t&&(e&&typeof e==`object`&&`status`in e&&Hi(t,e.status||500),t.end()),e?.error){let t=Error(e.error.message);e.error.code&&(t.code=e.error.code),e.error.details&&(t.details=e.error.details);let n={};l.length&&f&&(n.query=l),p!==void 0&&f&&(n.body=p),U(t,e=>(e.addEventProcessor(e=>(Er(e,{handled:!1,type:`auto.db.supabase.postgres`}),e)),e.setContext(`supabase`,n),e))}let n={type:`supabase`,category:`db.${o}`,message:_},r={};return l.length&&f&&(r.query=l),p!==void 0&&f&&(r.body=p),Object.keys(r).length&&(n.data=r),Zp(n),e},e=>{throw t&&(Hi(t,500),t.end()),e}).then(...r))}}),Eh(e.prototype.then))}function Lh(e,t){for(let n of Th)Dh(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(e,r,i){let a=Reflect.apply(e,r,i),o=a.constructor;return O&&j.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),Ih(o,t),a}}),Eh(e.prototype[n]))}var Rh=(e,t={})=>{if(!e){O&&j.warn(`Supabase integration was not installed because no Supabase client was provided.`);return}Fh(e.constructor===Function?e:e.constructor,t),Ph(e)},zh=`Supabase`,Bh=((e,t)=>({setupOnce(){Rh(e,t)},name:zh})),Vh=G(e=>Bh(e.supabaseClient,{sendOperationData:e.sendOperationData})),Hh=10,Uh=`ZodErrors`;function Wh(e){return An(e)&&e.name===`ZodError`&&Array.isArray(e.issues)}function Gh(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 Kh(e){return e.map(e=>typeof e==`number`?`<array>`:e).join(`.`)}function qh(e){let t=new Set;for(let n of e.issues){let e=Kh(n.path);e.length>0&&t.add(e)}let n=Array.from(t);if(n.length===0){let t=`variable`;if(e.issues.length>0){let n=e.issues[0];n!==void 0&&`expected`in n&&typeof n.expected==`string`&&(t=n.expected)}return`Failed to validate ${t}`}return`Failed to validate keys: ${mr(n.join(`, `),100)}`}function Jh(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!Wh(r.originalException)||r.originalException.issues.length===0)return n;try{let i=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(Gh);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:`zod_issues.json`,data:JSON.stringify({issues:i})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:qh(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":i.slice(0,e)}}}catch(e){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:`an exception was thrown while processing ZodError within applyZodErrorsToEvent()`,error:e instanceof Error?`${e.name}: ${e.message}
18
- ${e.stack}`:`unknown`}}}}}var Yh=G(((e={})=>{let t=e.limit??Hh;return{name:Uh,processEvent(n,r){return Jh(t,e.saveZodIssuesAsAttachment,n,r)}}})),Xh=`Console`,Zh=G((e={})=>{let t=new Set(e.levels||en);return{name:Xh,setup(n){let r=Gm(({args:e,level:r})=>{F()===n&&t.has(r)&&Qh(r,e)});if(n.registerCleanup(r),e.filter){let t=Km(e.filter);n.registerCleanup(t)}}}});function Qh(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Ym(e),message:$h(t)};if(e===`assert`){if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${$h(e)}`:`Assertion failed`,n.data.arguments=e}else return}Zp(n,{input:t,level:e})}function $h(e){return`util`in k&&typeof k.util.format==`function`?k.util.format(...e):gr(e,` `)}var eg=`flag.evaluation.`;function tg(e){if(e.type)return e;let t=N().getScopeData().contexts.flags,n=t?t.values:[];return n.length?(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...n]},e):e}function ng(e,t,n=100){let r=N().getScopeData().contexts;r.flags||={values:[]};let i=r.flags.values;rg(i,e,t,n)}function rg(e,t,n,r){if(typeof n!=`boolean`)return;if(e.length>r){O&&j.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}let i=e.findIndex(e=>e.flag===t);i!==-1&&e.splice(i,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function ig(e,t,n=10){if(typeof t!=`boolean`)return;let r=z();if(!r)return;let i=R(r).data;if(`${eg}${e}`in i){r.setAttribute(`${eg}${e}`,t);return}Object.keys(i).filter(e=>e.startsWith(eg)).length<n&&r.setAttribute(`${eg}${e}`,t)}var ag=G(()=>({name:`FeatureFlags`,processEvent(e,t,n){return tg(e)},addFeatureFlag(e,t){ng(e,t),ig(e,t)}})),og=G(({growthbookClass:e})=>({name:`GrowthBook`,setupOnce(){let t=e.prototype;typeof t.isOn==`function`&&Vn(t,`isOn`,sg),typeof t.getFeatureValue==`function`&&Vn(t,`getFeatureValue`,sg)},processEvent(e,t,n){return tg(e)}}));function sg(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n==`string`&&typeof r==`boolean`&&(ng(n,r),ig(n,r)),r}}var cg=`ConversationId`,lg=G((()=>({name:cg,setup(e){e.on(`spanStart`,e=>{let t=N().getScopeData(),n=P().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=R(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(Bi,r)}})}})));function ug(e){return!!e&&e._profiler!==void 0&&typeof e._profiler.start==`function`&&typeof e._profiler.stop==`function`}function dg(){let e=F();if(!e){O&&j.warn(`No Sentry client available, profiling is not started`);return}let t=e.getIntegrationByName(`ProfilingIntegration`);if(!t){O&&j.warn(`ProfilingIntegration is not available`);return}if(!ug(t)){O&&j.warn(`Profiler is not available on profiling integration.`);return}t._profiler.start()}function fg(){let e=F();if(!e){O&&j.warn(`No Sentry client available, profiling is not started`);return}let t=e.getIntegrationByName(`ProfilingIntegration`);if(!t){O&&j.warn(`ProfilingIntegration is not available`);return}if(!ug(t)){O&&j.warn(`Profiler is not available on profiling integration.`);return}t._profiler.stop()}var pg={startProfiler:dg,stopProfiler:fg};function mg(e,t={},n=N()){let{message:r,name:i,email:a,url:o,source:s,associatedEventId:c,tags:l}=e,u={contexts:{feedback:{contact_email:a,name:i,message:r,url:o,source:s,associated_event_id:c}},type:`feedback`,level:`info`,tags:l},d=n?.getClient()||F();return d&&d.emit(`beforeSendFeedback`,u,t),n.captureEvent(u,t)}function hg(e,t,n){return`util`in k&&typeof k.util.format==`function`?k.util.format(...e):gg(e,t,n)}function gg(e,t,n){return e.map(e=>Fn(e)?String(e):JSON.stringify(ar(e,t,n))).join(` `)}function _g(e){return/%[sdifocO]/.test(e)}function vg(e,t){let n={};return n[`sentry.message.template`]=`${e} ${Array(t.length).fill(`{}`).join(` `)}`,t.forEach((e,t)=>{n[`sentry.message.parameter.${t}`]=e}),n}var yg=`ConsoleLogs`,bg={[L]:`auto.log.console`},xg=G(((e={})=>{let t=e.levels||en;return{name:yg,setup(e){let{enableLogs:n,normalizeDepth:r=3,normalizeMaxBreadth:i=1e3}=e.getOptions();if(!n){O&&j.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let a=Gm(({args:n,level:a})=>{if(F()!==e||!t.includes(a))return;let o=n[0],s=n.slice(1);if(a===`assert`){o||Vd({level:`error`,message:s.length>0?`Assertion failed: ${hg(s,r,i)}`:`Assertion failed`,attributes:bg});return}let c=a===`log`,l={...bg};if(In(o)){Object.assign(l,ar(o,r,i));let e=typeof n[1]==`string`?2:1;n.slice(e).forEach((e,t)=>{l[`sentry.message.parameter.${t}`]=ar(e,r,i)})}else if(s.length>0&&typeof o==`string`&&!_g(o)){let e=vg(o,s);for(let[t,n]of Object.entries(e))l[t]=t.startsWith(`sentry.message.parameter.`)?ar(n,r,i):n}Vd({level:c?`info`:a,message:hg(n,r,i),severityNumber:c?10:void 0,attributes:l})});e.registerCleanup(a)}}})),Sg=t({count:()=>wg,distribution:()=>Eg,gauge:()=>Tg});function Cg(e,t,n,r){ef({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function wg(e,t=1,n){Cg(`counter`,e,t,n)}function Tg(e,t,n){Cg(`gauge`,e,t,n)}function Eg(e,t,n){Cg(`distribution`,e,t,n)}var Dg=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function Og(e={}){let t=new Set(e.levels??Dg),n=e.client;return{log(e){let{type:r,level:i,message:a,args:o,tag:s,date:c,...l}=e,u=n||F();if(!u)return;let d=jg(r,i);if(!t.has(d))return;let{normalizeDepth:f=3,normalizeMaxBreadth:p=1e3}=u.getOptions(),m={};for(let[e,t]of Object.entries(l))m[e]=ar(t,f,p);m[`sentry.origin`]=`auto.log.consola`,s&&(m[`consola.tag`]=s),r&&(m[`consola.type`]=r),i!=null&&typeof i==`number`&&(m[`consola.level`]=i);let h=Ng(Mg(o,f,p),f,p);h?.attributes&&Object.assign(m,h.attributes),Vd({level:d,message:h?.message||a||o&&hg(o,f,p)||``,attributes:m})}}}var kg={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`},Ag={0:`fatal`,1:`warn`,2:`info`,3:`info`,4:`debug`,5:`trace`};function jg(e,t){if(e===`verbose`)return`debug`;if(e===`silent`)return`trace`;if(e){let t=kg[e];if(t)return t}if(typeof t==`number`){let e=Ag[t];if(e)return e}return`info`}function Mg(e,t,n){if(!e?.length)return{message:``};let r=hg(e,t,n),i=e[0];if(In(i)){let t=typeof e[1]==`string`?2:1;return{message:r,attributes:i,messageParameters:e.slice(t)}}{let t=e.slice(1),n=t.length>0&&typeof i==`string`&&!_g(i);return{message:r,messageTemplate:n?i:void 0,messageParameters:n?t:void 0}}}function Ng(e,t,n){let{message:r,attributes:i,messageTemplate:a,messageParameters:o}=e,s={};if(a&&o){let e=vg(a,o);for(let[r,i]of Object.entries(e))s[r]=r.startsWith(`sentry.message.parameter.`)?ar(i,t,n):i}else o&&o.length>0&&o.forEach((e,r)=>{s[`sentry.message.parameter.${r}`]=ar(e,t,n)});return{message:r,attributes:{...ar(i,t,n),...s}}}var Pg=`gen_ai.prompt`,Fg=`gen_ai.system`,Ig=`gen_ai.request.model`,Lg=`gen_ai.request.stream`,Rg=`gen_ai.request.temperature`,zg=`gen_ai.request.max_tokens`,Bg=`gen_ai.request.frequency_penalty`,Vg=`gen_ai.request.presence_penalty`,Hg=`gen_ai.request.top_p`,Ug=`gen_ai.request.top_k`,Wg=`gen_ai.request.encoding_format`,Gg=`gen_ai.request.dimensions`,Kg=`gen_ai.response.finish_reasons`,qg=`gen_ai.response.model`,Jg=`gen_ai.response.id`,Yg=`gen_ai.response.stop_reason`,Xg=`gen_ai.usage.input_tokens`,Zg=`gen_ai.usage.output_tokens`,Qg=`gen_ai.usage.total_tokens`,$g=`gen_ai.operation.name`,e_=`sentry.sdk_meta.gen_ai.input.messages.original_length`,t_=`gen_ai.input.messages`,n_=`gen_ai.output.messages`,r_=`gen_ai.system_instructions`,i_=`gen_ai.response.text`,a_=`gen_ai.request.available_tools`,o_=`gen_ai.response.streaming`,s_=`gen_ai.response.tool_calls`,c_=`gen_ai.agent.name`,l_=`gen_ai.pipeline.name`,u_=`gen_ai.conversation.id`,d_=`gen_ai.usage.cache_creation_input_tokens`,f_=`gen_ai.usage.cache_read_input_tokens`,p_=`gen_ai.usage.input_tokens.cache_write`,m_=`gen_ai.usage.input_tokens.cached`,h_=`gen_ai.invoke_agent`,g_=`gen_ai.embeddings.input`,__=`gen_ai.embeddings`,v_=`gen_ai.execute_tool`,y_=`gen_ai.tool.name`,b_=`gen_ai.tool.call.id`,x_=`gen_ai.tool.type`,S_=`gen_ai.tool.input`,C_=`gen_ai.tool.output`,w_=`gen_ai.tool.description`;function T_(e){return!e||typeof e!=`object`?!1:O_(e)||k_(e)||E_(e)||A_(e)||j_(e)||M_(e)||N_(e)||P_(e)||F_(e)||I_(e)||L_(e)||R_(e)}function E_(e){return`image_url`in e?typeof e.image_url==`string`?e.image_url.startsWith(`data:`):D_(e):!1}function D_(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 O_(e){return`type`in e&&typeof e.type==`string`&&`source`in e&&T_(e.source)}function k_(e){return`inlineData`in e&&!!e.inlineData&&typeof e.inlineData==`object`&&`data`in e.inlineData&&typeof e.inlineData.data==`string`}function A_(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 j_(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 M_(e){return`media_type`in e&&typeof e.media_type==`string`&&`data`in e}function N_(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 P_(e){return`type`in e&&e.type===`image`&&`image`in e&&typeof e.image==`string`&&!e.image.startsWith(`http://`)&&!e.image.startsWith(`https://`)}function F_(e){return`type`in e&&(e.type===`blob`||e.type===`base64`)}function I_(e){return`b64_json`in e}function L_(e){return`type`in e&&`result`in e&&e.type===`image_generation`}function R_(e){return`uri`in e&&typeof e.uri==`string`&&e.uri.startsWith(`data:`)}var z_=`[Blob substitute]`,B_=[`image_url`,`data`,`content`,`b64_json`,`result`,`uri`,`image`];function V_(e){let t={...e};T_(t.source)&&(t.source=V_(t.source)),k_(e)&&(t.inlineData={...e.inlineData,data:z_}),D_(e)&&(t.image_url={...e.image_url,url:z_}),A_(e)&&(t.input_audio={...e.input_audio,data:z_}),j_(e)&&(t.file={...e.file,file_data:z_});for(let e of B_)typeof t[e]==`string`&&(t[e]=z_);return t}var H_=2e4,U_=e=>new TextEncoder().encode(e).length,W_=e=>U_(JSON.stringify(e));function G_(e,t){if(U_(e)<=t)return e;let n=0,r=e.length,i=``;for(;n<=r;){let a=Math.floor((n+r)/2),o=e.slice(0,a);U_(o)<=t?(i=o,n=a+1):r=a-1}return i}function K_(e){return typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``}function q_(e,t){return typeof e==`string`?t:{...e,text:t}}function J_(e){return typeof e==`object`&&!!e&&`content`in e&&typeof e.content==`string`}function Y_(e){return typeof e==`object`&&!!e&&`content`in e&&Array.isArray(e.content)}function X_(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)&&e.parts.length>0}function Z_(e,t){let n=t-W_({...e,content:``});if(n<=0)return[];let r=G_(e.content,n);return[{...e,content:r}]}function Q_(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 $_(e,t){let{key:n,items:r}=Q_(e);if(n===null||r.length===0)return[];let i=r.map(e=>q_(e,``)),a=t-W_({...e,[n]:i});if(a<=0)return[];let o=[];for(let e of r){let t=K_(e),n=U_(t);if(n<=a)o.push(e),a-=n;else if(o.length===0){let n=G_(t,a);n&&o.push(q_(e,n));break}else break}return o.length<=0?[]:[{...e,[n]:o}]}function ev(e,t){if(!e)return[];if(typeof e==`string`){let n=G_(e,t);return n?[n]:[]}return typeof e==`object`?J_(e)?Z_(e,t):Y_(e)||X_(e)?$_(e,t):[]:[]}function tv(e){return e.map(e=>{let t;return e&&typeof e==`object`&&(Y_(e)?t={...e,content:tv(e.content)}:`content`in e&&T_(e.content)&&(t={...e,content:V_(e.content)}),X_(e)&&(t={...t??e,parts:tv(e.parts)}),T_(t)?t=V_(t):T_(e)&&(t=V_(e))),t??e})}function nv(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=tv([r]),a=i[0];return W_(a)<=n?i:ev(a,n)}function rv(e){return nv(e,H_)}function iv(e){return G_(e,H_)}function av(e){let t=F()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function ov(e){if(e!==void 0)return e;let t=F();return!t||!Uo(t)&&t.getOptions().streamGenAiSpans===!1}function sv(e,t){return e?`${e}.${t}`:t}function cv(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[Xg]:t}),n!==void 0&&e.setAttributes({[Zg]:n}),t!==void 0||n!==void 0||r!==void 0||i!==void 0){let a=(t??0)+(n??0)+(r??0)+(i??0);e.setAttributes({[Qg]:a})}}function lv(e,t,n){if(!e.isRecording())return;let r={[o_]:!0};t.responseId&&(r[Jg]=t.responseId),t.responseModel&&(r[qg]=t.responseModel),t.promptTokens!==void 0&&(r[Xg]=t.promptTokens),t.completionTokens!==void 0&&(r[Zg]=t.completionTokens),t.totalTokens===void 0?(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Qg]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)):r[Qg]=t.totalTokens,t.finishReasons.length&&(r[Kg]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[i_]=t.responseTexts.join(``)),n&&t.toolCalls.length&&(r[s_]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function uv(e){if(typeof e==`string`)return iv(e);try{return JSON.stringify(Array.isArray(e)?rv(e):e)}catch{return`[unserializable]`}}function dv(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};let t=e.findIndex(e=>e&&typeof e==`object`&&`role`in e&&e.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?void 0:JSON.stringify(n.content);return r?{systemInstructions:JSON.stringify([{type:`text`,content:r}]),filteredMessages:[...e.slice(0,t),...e.slice(t+1)]}:{systemInstructions:void 0,filteredMessages:e}}async function fv(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r==`object`&&`data`in r?{...r,data:n}:n}function pv(e,t){return zn(e)?new Proxy(e,{get(e,n){let r=n in Promise.prototype||n===Symbol.toStringTag?t:e,i=Reflect.get(r,n);return n===`withResponse`&&typeof i==`function`?function(){return fv(i.call(e),t)}:typeof i==`function`?i.bind(r):i}}):t}var mv=`WorkersAI`,hv=new Map,gv=new Map,_v=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`]]),vv=`operation.name`,yv=`ai.operationId`,bv=`ai.prompt`,xv=`ai.schema`,Sv=`ai.response.object`,Cv=`ai.values`,wv=`ai.response.text`,Tv=`ai.response.toolCalls`,Ev=`ai.response.finishReason`,Dv=`ai.prompt.messages`,Ov=`ai.prompt.tools`,kv=`ai.model.id`,Av=`ai.response.providerMetadata`,jv=`ai.usage.cachedInputTokens`,Mv=`ai.telemetry.functionId`,Nv=`ai.usage.completionTokens`,Pv=`ai.usage.promptTokens`,Fv=`ai.usage.tokens`,Iv=`ai.toolCall.name`,Lv=`ai.toolCall.id`,Rv=`ai.toolCall.args`,zv=`ai.toolCall.result`;function Bv(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[Xg],i=e.data[Zg];if(typeof r==`number`||typeof i==`number`){let e=t.get(n)||{inputTokens:0,outputTokens:0};typeof r==`number`&&(e.inputTokens+=r),typeof i==`number`&&(e.outputTokens+=i),t.set(n,e)}}function Vv(e,t){let n=t.get(e.span_id);n&&e.data&&(n.inputTokens>0&&(e.data[Xg]=n.inputTokens),n.outputTokens>0&&(e.data[Zg]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data[`gen_ai.usage.total_tokens`]=n.inputTokens+n.outputTokens))}function Hv(e){let t=new Map;for(let n of e){let e=n.data[a_];if(typeof e==`string`)try{let n=JSON.parse(e);for(let e of n)e.name&&e.description&&!t.has(e.name)&&t.set(e.name,e.description)}catch{}}return t}function Uv(e,t){let n=Hv(e);for(let r of e){if(r.op===`gen_ai.execute_tool`){let e=r.data[y_];if(typeof e==`string`){let t=n.get(e);t&&(r.data[w_]=t)}}r.op===`gen_ai.invoke_agent`&&Vv(r,t)}}function Wv(e){return hv.get(e)}function Gv(e){hv.delete(e)}function Kv(e){let t=e.map(e=>{if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e});return JSON.stringify(t)}function qv(e){return e.filter(e=>!!e&&typeof e==`object`&&`role`in e&&`content`in e)}function Jv(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`){let{messages:e}=t,{prompt:n,system:r}=t,i=[];if(typeof r==`string`&&i.push({role:`system`,content:r}),typeof e==`string`)try{e=JSON.parse(e)}catch{}if(Array.isArray(e))return i.push(...qv(e)),i;if(Array.isArray(n))return i.push(...qv(n)),i;if(typeof n==`string`&&i.push({role:`user`,content:n}),i.length>0)return i}}catch{}return[]}function Yv(e,t,n){if(typeof t[`ai.prompt`]==`string`&&!t[`gen_ai.input.messages`]&&!t[`ai.prompt.messages`]){let r=t[bv],i=Jv(r);if(i.length){let{systemInstructions:t,filteredMessages:r}=dv(i);t&&e.setAttribute(r_,t);let a=Array.isArray(r)?r.length:0,o=n?uv(r):pr(r);e.setAttributes({[bv]:o,[t_]:o,[e_]:a})}}else if(typeof t[`ai.prompt.messages`]==`string`){let r=t[Dv];try{let t=JSON.parse(r);if(Array.isArray(t)){let{systemInstructions:i,filteredMessages:a}=dv(t);i&&e.setAttribute(r_,i);let o=Array.isArray(a)?a.length:0,s=!n&&a===t?r:n?uv(a):pr(a);e.setAttributes({[Dv]:s,[t_]:s,[e_]:o})}}catch{}}}function Xv(e){let{data:t,description:n}=R(e);if(!n)return;if(t[`ai.toolCall.name`]&&t[`ai.toolCall.id`]&&n===`ai.toolCall`){iy(e,t);return}if(!t[`ai.operationId`]&&!n.startsWith(`ai.`))return;_v.get(n)===`generate_content`&&Xf([mv]);let r=F()?.getIntegrationByName(`VercelAI`);ay(e,n,t,ov(r?.options?.enableTruncation))}function Zv(e){if(e.type===`transaction`&&e.spans){let t=new Map;for(let n of e.spans)ty(n),Bv(n,t);Uv(e.spans,t);let n=e.contexts?.trace;n?.op===`gen_ai.invoke_agent`&&Vv(n,t)}return e}function Qv(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 $v(e){let t=e[wv],n=e[Tv],r=e[Ev];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 t=typeof n==`string`?JSON.parse(n):n;if(Array.isArray(t)){for(let e of t){let t=e.input??e.args;i.push({type:`tool_call`,id:e.toolCallId,name:e.toolName,arguments:typeof t==`string`?t:JSON.stringify(t??{})})}delete e[Tv]}}catch{}if(i.length>0){let t={role:`assistant`,parts:i,finish_reason:Qv(r)};e[n_]=JSON.stringify([t]),delete e[wv]}}function ey(e){if(ry(e,Nv,Zg),ry(e,Pv,Xg),ry(e,jv,m_),ry(e,`ai.usage.inputTokens`,Xg),ry(e,`ai.usage.outputTokens`,Zg),ry(e,Fv,Xg),ry(e,`ai.response.avgOutputTokensPerSecond`,`ai.response.avgCompletionTokensPerSecond`),!Object.keys(e).some(e=>e.startsWith(`ai.usage.inputTokenDetails.`))&&typeof e[`gen_ai.usage.input_tokens`]==`number`&&typeof e[`gen_ai.usage.input_tokens.cached`]==`number`&&(e[Xg]=e[Xg]+e[m_]),typeof e[`gen_ai.usage.input_tokens`]==`number`&&(e[Qg]=(typeof e[`gen_ai.usage.output_tokens`]==`number`?e[Zg]:0)+e[Xg]),e[`ai.prompt.tools`]&&Array.isArray(e[`ai.prompt.tools`])&&(e[Ov]=Kv(e[Ov])),e[`operation.name`]){let t=e[`ai.operationId`]?e[yv]:e[vv];e[$g]=_v.get(t)??t,delete e[vv]}if(ry(e,Dv,t_),$v(e),ry(e,Sv,`gen_ai.response.object`),ry(e,Ov,`gen_ai.request.available_tools`),ry(e,Rv,S_),ry(e,zv,C_),ry(e,xv,`gen_ai.request.schema`),ry(e,kv,Ig),Array.isArray(e[`ai.values`])){let t=e[Cv].map(e=>{try{return JSON.parse(e)}catch{return e}});e[g_]=t.length===1?t[0]:JSON.stringify(t)}uy(e);for(let t of Object.keys(e))Array.isArray(e[t])&&(e[t]=JSON.stringify(e[t])),t.startsWith(`ai.`)&&ry(e,t,`vercel.${t}`)}function ty(e){let{data:t,origin:n}=e;n===`auto.vercelai.otel`&&(e.status&&e.status!==`ok`&&(e.status=`internal_error`),ey(t))}function ny(e){let t=e.attributes;if(t?.[`sentry.origin`]===`auto.vercelai.otel`){if(ey(t),t[`sentry.op`]===`gen_ai.execute_tool`&&e.parent_span_id){let n=gv.get(e.parent_span_id);if(n){let e=t[y_];if(typeof e==`string`){let r=n.get(e);r&&(t[w_]=r)}}}gv.delete(e.span_id)}}function ry(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function iy(e,t){e.setAttribute(L,`auto.vercelai.otel`),e.setAttribute(I,`gen_ai.execute_tool`),e.setAttribute($g,`execute_tool`),ry(t,Iv,y_),ry(t,Lv,b_);let n=t[b_];typeof n==`string`&&hv.set(n,e.spanContext()),t[`gen_ai.tool.type`]||e.setAttribute(x_,`function`);let r=t[y_];r&&e.updateName(`execute_tool ${r}`)}function ay(e,t,n,r){e.setAttribute(L,`auto.vercelai.otel`);let i=t.replace(`ai.`,``);e.setAttribute(`ai.pipeline.name`,i),e.updateName(i);let a=n[Mv];a&&typeof a==`string`&&e.setAttribute(`gen_ai.function_id`,a),Yv(e,n,r),n[`ai.model.id`]&&!n[`gen_ai.response.model`]&&e.setAttribute(qg,n[kv]),e.setAttribute(`ai.streaming`,t.includes(`stream`));let o=_v.get(t);if(o?e.setAttribute(I,`gen_ai.${o}`):t.startsWith(`ai.stream`)&&e.setAttribute(I,`ai.run`),o===`invoke_agent`){a&&typeof a==`string`?e.updateName(`invoke_agent ${a}`):e.updateName(`invoke_agent`);return}let s=n[kv];s&&o&&e.updateName(`${o} ${s}`);let c=F();if(c&&Uo(c)&&n[`ai.prompt.tools`]&&Array.isArray(n[`ai.prompt.tools`])){let t=new Map;for(let e of n[Ov])try{let n=typeof e==`string`?JSON.parse(e):e;n?.name&&n?.description&&t.set(n.name,n.description)}catch{}if(t.size>0){let n=R(e).parent_span_id;n&&gv.set(n,t)}}}var oy=new WeakSet;function sy(e){oy.has(e)||(oy.add(e),e.on(`spanStart`,Xv),e.addEventProcessor(Object.assign(Zv,{id:`VercelAiEventProcessor`})),e.on(`processSpan`,e=>{ny(e)}))}function cy(e){let t={};if(!e||typeof e!=`object`)return t;let n=e,r=n.openai??n.azure;r&&(dy(t,m_,r.cachedPromptTokens),dy(t,`gen_ai.usage.output_tokens.reasoning`,r.reasoningTokens),dy(t,`gen_ai.usage.output_tokens.prediction_accepted`,r.acceptedPredictionTokens),dy(t,`gen_ai.usage.output_tokens.prediction_rejected`,r.rejectedPredictionTokens),dy(t,u_,r.responseId)),n.anthropic&&(dy(t,m_,n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens),dy(t,p_,n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens)),n.bedrock?.usage&&(dy(t,m_,n.bedrock.usage.cacheReadInputTokens),dy(t,p_,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(dy(t,m_,n.deepseek.promptCacheHitTokens),dy(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[Zg]=(i.candidatesTokenCount??0)+i.thoughtsTokenCount,dy(t,Qg,i.totalTokenCount),dy(t,`gen_ai.usage.reasoning.output_tokens`,i.thoughtsTokenCount)),t}var ly=new Set([Zg,Qg,`gen_ai.usage.reasoning.output_tokens`]);function uy(e){let t=e[Av];if(!t)return;let n=e[$g]===`invoke_agent`;try{let r=cy(JSON.parse(t));for(let[t,i]of Object.entries(r))t===`gen_ai.conversation.id`&&e[t]||n&&ly.has(t)||(e[t]=i)}catch{}}function dy(e,t,n){n!=null&&(e[t]=n)}var fy=`OpenAI`,py={"responses.create":{operation:`chat`},"chat.completions.create":{operation:`chat`},"embeddings.create":{operation:`embeddings`},"conversations.create":{operation:`chat`}},my=[`response.created`,`response.in_progress`,`response.failed`,`response.completed`,`response.incomplete`,`response.queued`,`response.output_text.delta`,`response.output_item.added`,`response.function_call_arguments.delta`,`response.function_call_arguments.done`,`response.output_item.done`];function hy(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&e.type.startsWith(`response.`)}function gy(e){return typeof e==`object`&&!!e&&`object`in e&&e.object===`chat.completion.chunk`}function _y(e,t,n){if(!t||typeof t!=`object`)return;let r=t,i={};if(typeof r.id==`string`&&(i[Jg]=r.id),typeof r.model==`string`&&(i[qg]=r.model),r.object===`conversation`&&typeof r.id==`string`&&(i[u_]=r.id),r.usage&&typeof r.usage==`object`){let e=r.usage,t=e.prompt_tokens??e.input_tokens;typeof t==`number`&&(i[Xg]=t);let n=e.completion_tokens??e.output_tokens;typeof n==`number`&&(i[Zg]=n),typeof e.total_tokens==`number`&&(i[Qg]=e.total_tokens)}if(Array.isArray(r.choices)){let e=r.choices,t=e.map(e=>e.finish_reason).filter(e=>typeof e==`string`);if(t.length>0&&(i[Kg]=JSON.stringify(t)),n){let t=e.map(e=>e.message?.content||``);i[i_]=JSON.stringify(t);let n=e.map(e=>e.message?.tool_calls).filter(e=>Array.isArray(e)&&e.length>0).flat();n.length>0&&(i[s_]=JSON.stringify(n))}}if(typeof r.status==`string`&&(i[`gen_ai.response.finish_reasons`]||(i[Kg]=JSON.stringify([r.status]))),n&&(typeof r.output_text==`string`&&!i[`gen_ai.response.text`]&&(i[i_]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!i[`gen_ai.response.tool_calls`])){let e=r.output.filter(e=>e?.type===`function_call`);e.length>0&&(i[s_]=JSON.stringify(e))}e.setAttributes(i)}function vy(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 yy(e){let t={[Ig]:e.model??`unknown`};`temperature`in e&&(t[Rg]=e.temperature),`top_p`in e&&(t[Hg]=e.top_p),`frequency_penalty`in e&&(t[Bg]=e.frequency_penalty),`presence_penalty`in e&&(t[Vg]=e.presence_penalty),`stream`in e&&(t[Lg]=e.stream),`encoding_format`in e&&(t[Wg]=e.encoding_format),`dimensions`in e&&(t[Gg]=e.dimensions);let n=vy(e);return n&&(t[u_]=n),t}function by(e,t){for(let n of e){let e=n.index;if(e!==void 0&&n.function){if(!(e in t.chatCompletionToolCalls))t.chatCompletionToolCalls[e]={...n,function:{name:n.function.name,arguments:n.function.arguments||``}};else{let r=t.chatCompletionToolCalls[e];n.function.arguments&&r?.function&&(r.function.arguments+=n.function.arguments)}}}}function xy(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&&by(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function Sy(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`}),U(e,{mechanism:{handled:!1,type:`auto.ai.openai.stream-response`}});return}if(!(`type`in e))return;let i=e;if(!my.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:e}=i;t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.input_tokens,t.completionTokens=e.usage.output_tokens,t.totalTokens=e.usage.total_tokens),e.status&&t.finishReasons.push(e.status),n&&e.output_text&&t.responseTexts.push(e.output_text)}}async function*Cy(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)gy(i)?xy(i,r,n):hy(i)&&Sy(i,r,n,t),yield i}finally{let e=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];lv(t,{...r,toolCalls:e},n)}}function wy(e){let t=Array.isArray(e.tools)?e.tools:[],n=e.web_search_options&&typeof e.web_search_options==`object`?[{type:`web_search_options`,...e.web_search_options}]:[],r=[...t,...n];if(r.length!==0)try{return JSON.stringify(r)}catch(e){O&&j.error(`Failed to serialize OpenAI tools:`,e);return}}function Ty(e,t){let n={[Fg]:`openai`,[$g]:t,[L]:`auto.ai.openai`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0],r=wy(t);r&&(n[a_]=r),Object.assign(n,yy(t))}else n[Ig]=`unknown`;return n}function Ey(e,t,n,r){if(n===`embeddings`&&`input`in t){let n=t.input;if(n==null||typeof n==`string`&&n.length===0||Array.isArray(n)&&n.length===0)return;e.setAttribute(g_,typeof n==`string`?n:JSON.stringify(n));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:a,filteredMessages:o}=dv(i);a&&e.setAttribute(r_,a),e.setAttribute(t_,r?uv(o):pr(o)),Array.isArray(o)?e.setAttribute(e_,o.length):e.setAttribute(e_,1)}function Dy(e,t,n,r,i){return function(...t){let a=n.operation||`unknown`,o=Ty(t,a),s=o[`gen_ai.request.model`]||`unknown`,c=t[0],l=c&&typeof c==`object`&&c.stream===!0,u={name:`${a} ${s}`,op:`gen_ai.${a}`,attributes:o};if(l){let n,o=es(u,o=>(n=e.apply(r,t),i.recordInputs&&c&&Ey(o,c,a,ov(i.enableTruncation)),(async()=>{try{return Cy(await n,o,i.recordOutputs??!1)}catch(e){throw o.setStatus({code:2,message:`internal_error`}),o.end(),e}})()));return pv(n,o)}let d,f=B(u,n=>(d=e.apply(r,t),i.recordInputs&&c&&Ey(n,c,a,ov(i.enableTruncation)),d.then(e=>(_y(n,e,i.recordOutputs),e))));return pv(d,f)}}function Oy(e,t=``,n){return new Proxy(e,{get(e,r){let i=e[r],a=sv(t,String(r)),o=py[a];return typeof i==`function`&&o?Dy(i,a,o,e,n):typeof i==`function`?i.bind(e):i&&typeof i==`object`?Oy(i,a,n):i}})}function ky(e,t){return Oy(e,``,av(t))}var Ay=`Anthropic_AI`,jy={"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 My(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=dv(t);r&&e.setAttributes({[r_]:r});let a=Array.isArray(i)?i.length:1;e.setAttributes({[t_]:n?uv(i):pr(i),[e_]:a})}var Ny={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 Py(e){return e&&Ny[e]||`internal_error`}function Fy(e,t){t.error&&(e.setStatus({code:2,message:Py(t.error.type)}),U(t.error,{mechanism:{handled:!1,type:`auto.ai.anthropic.anthropic_error`}}))}function Iy(e){let{system:t,messages:n,input:r}=e,i=typeof t==`string`?[{role:`system`,content:e.system}]:[],a=(Array.isArray(r)?r:r==null?void 0:[r])??(Array.isArray(n)?n:n==null?[]:[n]);return[...i,...a]}function Ly(e,t){return`type`in e&&typeof e.type==`string`&&e.type===`error`&&(t.setStatus({code:2,message:Py(e.error?.type)}),!0)}function Ry(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 zy(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 By(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 n=t.activeToolBlocks[e.index];n&&n.inputJsonParts.push(e.delta.partial_json)}n&&typeof e.delta.text==`string`&&t.responseTexts.push(e.delta.text)}}function Vy(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 Hy(e,t,n,r){e&&typeof e==`object`&&(Ly(e,r)||(Ry(e,t),zy(e,t),By(e,t,n),Vy(e,t)))}async function*Uy(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)Hy(i,r,n,t),yield i}finally{lv(t,r,n)}}function Wy(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`,e=>{Hy(e,r,n,t)}),e.on(`message`,()=>{lv(t,r,n)}),e.on(`error`,e=>{U(e,{mechanism:{handled:!1,type:`auto.ai.anthropic.stream_error`}}),t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end())}),e}var Gy=!1,Ky=new WeakSet;function qy(e,t,n){let r={[Fg]:`anthropic`,[$g]:n,[L]:`auto.ai.anthropic`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0];t.tools&&Array.isArray(t.tools)&&(r[a_]=JSON.stringify(t.tools)),r[Ig]=t.model??`unknown`,`temperature`in t&&(r[Rg]=t.temperature),`top_p`in t&&(r[Hg]=t.top_p),`stream`in t&&(r[Lg]=t.stream),`top_k`in t&&(r[Ug]=t.top_k),`frequency_penalty`in t&&(r[Bg]=t.frequency_penalty),`max_tokens`in t&&(r[zg]=t.max_tokens)}else r[Ig]=t===`models.retrieve`||t===`models.get`?e[0]:`unknown`;return r}function Jy(e,t,n){My(e,Iy(t),n),`prompt`in t&&e.setAttributes({[Pg]:JSON.stringify(t.prompt)})}function Yy(e,t){if(`content`in t&&Array.isArray(t.content)){e.setAttributes({[i_]:t.content.map(e=>e.text).filter(e=>!!e).join(``)});let n=[];for(let e of t.content)(e.type===`tool_use`||e.type===`server_tool_use`)&&n.push(e);n.length>0&&e.setAttributes({[s_]:JSON.stringify(n)})}`completion`in t&&e.setAttributes({[i_]:t.completion}),`input_tokens`in t&&e.setAttributes({[i_]:JSON.stringify(t.input_tokens)})}function Xy(e,t){`id`in t&&`model`in t&&(e.setAttributes({[Jg]:t.id,[qg]:t.model}),`usage`in t&&t.usage&&cv(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function Zy(e,t,n){if(t&&typeof t==`object`){if(`type`in t&&t.type===`error`){Fy(e,t);return}n&&Yy(e,t),Xy(e,t)}}function Qy(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end()),e}function $y(e,t,n,r,i,a,o,s,c,l){let u={name:`${i} ${r[`gen_ai.request.model`]??`unknown`}`,op:`gen_ai.${i}`,attributes:r};if(c&&!l){let r,i=es(u,i=>(r=e.apply(t,n),s.recordInputs&&o&&Jy(i,o,ov(s.enableTruncation)),(async()=>{try{return Uy(await r,i,s.recordOutputs??!1)}catch(e){return Qy(e,i)}})()));return pv(r,i)}return es(u,r=>{try{s.recordInputs&&o&&Jy(r,o,ov(s.enableTruncation)),Gy=!0;let i=e.apply(t,n);return Gy=!1,Wy(i,r,s.recordOutputs??!1)}catch(e){return Gy=!1,Qy(e,r)}})}function eb(e,t,n,r,i){return new Proxy(e,{apply(e,a,o){let s=a===void 0?r:a,c=n.streaming===!0;if(!c&&Gy)return e.apply(s,o);let l=n.operation||`unknown`,u=qy(o,t,l),d=u[`gen_ai.request.model`]??`unknown`,f=typeof o[0]==`object`?o[0]:void 0,p=!!f?.stream;if(p||c)return $y(e,s,o,u,l,t,f,i,p,c);let m,h=B({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},t=>(m=e.apply(s,o),i.recordInputs&&f&&Jy(t,f,ov(i.enableTruncation)),m.then(e=>(Zy(t,e,i.recordOutputs),e))));return pv(m,h)}})}function tb(e,t){for(let n of Object.keys(jy)){let r=n.split(`.`),i=r.pop(),a=e;for(let e of r)a=a?.[e];if(!a||typeof a[i]!=`function`)continue;let o=a[i];if(Ky.has(o))continue;let s=eb(o,n,jy[n],a,t);Ky.add(s),a[i]=s}return e}function nb(e,t){return tb(e,av(t))}var rb=`Google_GenAI`,ib={"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}},ab=`google_genai`;function ob(e,t){let n=e?.promptFeedback;if(n?.blockReason){let e=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:`internal_error`}),U(`Content blocked: ${e}`,{mechanism:{handled:!1,type:`auto.ai.google_genai`}}),!0}return!1}function sb(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 cb(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 e of r?.content?.parts??[])n&&e.text&&t.responseTexts.push(e.text),e.functionCall&&t.toolCalls.push({type:`function`,id:e.functionCall.id,name:e.functionCall.name,arguments:e.functionCall.args})}}function lb(e,t,n,r){e&&!ob(e,r)&&(sb(e,t),cb(e,t,n))}async function*ub(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)lb(i,r,n,t),yield i}finally{lv(t,r,n)}}function db(e,t=`user`){return typeof e==`string`?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(e=>db(e,t)):typeof e!=`object`||!e?[]:`role`in e&&typeof e.role==`string`?[e]:`parts`in e?[{...e,role:t}]:[{role:t,content:e}]}function fb(e,t){if(`model`in e&&typeof e.model==`string`)return e.model;if(t&&typeof t==`object`){let e=t;if(`model`in e&&typeof e.model==`string`)return e.model;if(`modelVersion`in e&&typeof e.modelVersion==`string`)return e.modelVersion}return`unknown`}function pb(e){let t={};return`temperature`in e&&typeof e.temperature==`number`&&(t[Rg]=e.temperature),`topP`in e&&typeof e.topP==`number`&&(t[Hg]=e.topP),`topK`in e&&typeof e.topK==`number`&&(t[Ug]=e.topK),`maxOutputTokens`in e&&typeof e.maxOutputTokens==`number`&&(t[zg]=e.maxOutputTokens),`frequencyPenalty`in e&&typeof e.frequencyPenalty==`number`&&(t[Bg]=e.frequencyPenalty),`presencePenalty`in e&&typeof e.presencePenalty==`number`&&(t[Vg]=e.presencePenalty),t}function mb(e,t,n){let r={[Fg]:ab,[$g]:e,[L]:`auto.ai.google_genai`};if(t){if(r[Ig]=fb(t,n),`config`in t&&typeof t.config==`object`&&t.config){let e=t.config;if(Object.assign(r,pb(e)),`tools`in e&&Array.isArray(e.tools)){let t=e.tools.flatMap(e=>e.functionDeclarations);r[a_]=JSON.stringify(t)}}}else r[Ig]=fb({},n);return r}function hb(e,t,n,r){if(n===`embeddings`){let n=t.contents;n!=null&&e.setAttribute(g_,typeof n==`string`?n:JSON.stringify(n));return}let i=[];if(`config`in t&&t.config&&typeof t.config==`object`&&`systemInstruction`in t.config&&t.config.systemInstruction&&i.push(...db(t.config.systemInstruction,`system`)),`history`in t&&i.push(...db(t.history,`user`)),`contents`in t&&i.push(...db(t.contents,`user`)),`message`in t&&i.push(...db(t.message,`user`)),Array.isArray(i)&&i.length){let{systemInstructions:t,filteredMessages:n}=dv(i);t&&e.setAttribute(r_,t);let a=Array.isArray(n)?n.length:0;e.setAttributes({[e_]:a,[t_]:r?uv(n):pr(n)})}}function gb(e,t,n){if(t&&typeof t==`object`){if(t.modelVersion&&e.setAttribute(qg,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata==`object`){let n=t.usageMetadata;typeof n.promptTokenCount==`number`&&e.setAttributes({[Xg]:n.promptTokenCount}),typeof n.candidatesTokenCount==`number`&&e.setAttributes({[Zg]:n.candidatesTokenCount}),typeof n.totalTokenCount==`number`&&e.setAttributes({[Qg]:n.totalTokenCount})}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let n=t.candidates.map(e=>e.content?.parts&&Array.isArray(e.content.parts)?e.content.parts.map(e=>typeof e.text==`string`?e.text:``).filter(e=>e.length>0).join(``):``).filter(e=>e.length>0);n.length>0&&e.setAttributes({[i_]:n.join(``)})}if(n&&t.functionCalls){let n=t.functionCalls;Array.isArray(n)&&n.length>0&&e.setAttributes({[s_]:JSON.stringify(n)})}}}function _b(e,t,n,r,i){let a=n.operation===`embeddings`;return new Proxy(e,{apply(e,t,o){let s=n.operation||`unknown`,c=o[0],l=mb(s,c,r),u=l[`gen_ai.request.model`]??`unknown`;return n.streaming?es({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},async t=>{try{return i.recordInputs&&c&&hb(t,c,s,ov(i.enableTruncation)),ub(await e.apply(r,o),t,!!i.recordOutputs)}catch(e){throw t.setStatus({code:2,message:`internal_error`}),t.end(),e}}):B({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},t=>(i.recordInputs&&c&&hb(t,c,s,ov(i.enableTruncation)),Xo(()=>e.apply(r,o),()=>{},()=>{},e=>{a||gb(t,e,i.recordOutputs)})))}})}function vb(e,t=``,n){return new Proxy(e,{get:(e,r,i)=>{let a=Reflect.get(e,r,i),o=sv(t,String(r)),s=ib[o];if(typeof a==`function`&&s){let t=s.operation?_b(a,o,s,e,n):a.bind(e);return s.proxyResultPath?function(...e){let r=t(...e);return r&&typeof r==`object`?vb(r,s.proxyResultPath,n):r}:t}return typeof a==`function`?a.bind(e):a&&typeof a==`object`?vb(a,o,n):a}})}function yb(e,t){return vb(e,``,av(t))}var bb=`LangChain`,xb=`auto.ai.langchain`,Sb={human:`user`,ai:`assistant`,assistant:`assistant`,system:`system`,function:`function`,tool:`tool`},Cb=(e,t,n)=>{n!=null&&(e[t]=n)},wb=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function Tb(e){if(Array.isArray(e))try{let t=e.map(e=>e&&typeof e==`object`&&T_(e)?V_(e):e);return JSON.stringify(t)}catch{return String(e)}return pr(e,String)}function Eb(e){let t=e.toLowerCase();return Sb[t]??t}function Db(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 Ob(e){if(e&&!Array.isArray(e))return e.invocation_params}function kb(e){return e.map(e=>{let t=e._getType;if(typeof t==`function`)return{role:Eb(t.call(e)),content:Tb(e.content)};if(e.lc===1&&e.kwargs){let t=e.id,n=Array.isArray(t)&&t.length>0?t[t.length-1]:``;return{role:Eb(typeof n==`string`?Db(n):`user`),content:Tb(e.kwargs?.content)}}if(e.type)return{role:Eb(String(e.type).toLowerCase()),content:Tb(e.content)};if(e.role)return{role:Eb(String(e.role)),content:Tb(e.content)};let n=e.constructor?.name;return n&&n!==`Object`?{role:Eb(Db(n)),content:Tb(e.content)}:{role:`user`,content:Tb(e.content)}})}function Ab(e,t,n){let r={},i=`kwargs`in e?e.kwargs:void 0;wb(r,Rg,t?.temperature??n?.ls_temperature??i?.temperature),wb(r,zg,t?.max_tokens??n?.ls_max_tokens??i?.max_tokens),wb(r,Hg,t?.top_p??i?.top_p);let a=t?.frequency_penalty;wb(r,Bg,a);let o=t?.presence_penalty;return wb(r,Vg,o),t&&`stream`in t&&Cb(r,Lg,!!t.stream),r}function jb(e,t,n,r,i){return{[Fg]:pr(e??`langchain`,String),[$g]:`chat`,[Ig]:pr(t,String),[L]:xb,...Ab(n,r,i)}}function Mb(e,t,n,r,i,a){let o=a?.ls_provider,s=jb(o,i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){Cb(s,e_,t.length);let e=t.map(e=>({role:`user`,content:e}));Cb(s,t_,r?uv(e):pr(e))}return s}function Nb(e,t,n,r,i,a){let o=jb(a?.ls_provider??e.id?.[2],i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){let{systemInstructions:e,filteredMessages:n}=dv(kb(t.flat()));e&&Cb(o,r_,e),Cb(o,e_,Array.isArray(n)?n.length:0),Cb(o,t_,r?uv(n):pr(n))}return o}function Pb(e,t){let n=[],r=e.flat();for(let e of r){let t=e.message?.tool_calls;if(Array.isArray(t)&&t.length>0)n.push(...t);else{let t=e.message?.content;if(Array.isArray(t))for(let e of t){let t=e;t.type===`tool_use`&&n.push(t)}}}n.length>0&&Cb(t,s_,pr(n,String))}function Fb(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)wb(t,Xg,n.promptTokens),wb(t,Zg,n.completionTokens),wb(t,Qg,n.totalTokens);else if(r){wb(t,Xg,r.input_tokens),wb(t,Zg,r.output_tokens);let e=Number(r.input_tokens),n=Number(r.output_tokens),i=(Number.isNaN(e)?0:e)+(Number.isNaN(n)?0:n);i>0&&wb(t,Qg,i),r.cache_creation_input_tokens!==void 0&&wb(t,d_,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&wb(t,f_,r.cache_read_input_tokens)}}function Ib(e,t){if(!e)return;let n={};if(Array.isArray(e.generations)){let r=e.generations.flat().map(e=>e.generationInfo?.finish_reason?e.generationInfo.finish_reason:e.generation_info?.finish_reason?e.generation_info.finish_reason:null).filter(e=>typeof e==`string`);if(r.length>0&&Cb(n,Kg,pr(r,String)),Pb(e.generations,n),t){let t=e.generations.flat().map(e=>e.text??e.message?.content).filter(e=>typeof e==`string`);t.length>0&&Cb(n,i_,pr(t,String))}}Fb(e.llmOutput,n);let r=e.llmOutput,i=e.generations?.[0]?.[0]?.message,a=r?.model_name??r?.model??i?.response_metadata?.model_name;a&&Cb(n,qg,a);let o=r?.id??i?.id;o&&Cb(n,Jg,o);let s=r?.stop_reason??i?.response_metadata?.finish_reason;return s&&Cb(n,Yg,pr(s,String)),n}function Lb(e){let t={},n=e?.lc_agent_name;return typeof n==`string`&&(t[c_]=n),t}function Rb(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(e=>{let t=e.function;return{type:`function`,name:e.name??t?.name??``,description:e.description??t?.description}});return JSON.stringify(n)}function zb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.addHandler==`function`&&typeof t.copy==`function`}function Bb(e){return typeof e==`object`&&e?.name===`SentryCallbackHandler`}function Vb(e){return e.some(Bb)}function Hb(e,t){if(!e)return[t];if(zb(e)){if(Vb(e.handlers??[]))return e;let n=e.copy();return n.addHandler(t,!0),n}let n=Array.isArray(e)?e:[e];return Vb(n)?e:[...n,t]}function Ub(e={}){let{recordInputs:t,recordOutputs:n}=av(e),r=ov(e.enableTruncation),i=new Map,a=e=>{let t=i.get(e);t?.isRecording()&&(t.end(),i.delete(e))},o={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(e,n,a,o,s,c,l,u){let d=Ob(c),f=Mb(e,n,t,r,d,l),p=f[Ig],m=f[$g];es({name:`${m} ${p}`,op:`gen_ai.chat`,attributes:{...Lb(l),...f,[I]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleChatModelStart(e,n,a,o,s,c,l,u){let d=Ob(c),f=Nb(e,n,t,r,d,l),p=Rb(s);p&&(f[a_]=p);let m=f[Ig],h=f[$g];es({name:`${h} ${m}`,op:`gen_ai.chat`,attributes:{...Lb(l),...f,[I]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleLLMEnd(e,t,r,o,s){let c=i.get(t);if(c?.isRecording()){let r=Ib(e,n);r&&c.setAttributes(r),a(t)}},handleLLMError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t))},handleChainStart(e,n,r,a,o,s,c,l){if(s?.__sentry_langgraph__)return;let u=l||e.name||`unknown_chain`,d={[L]:`auto.ai.langchain`,"langchain.chain.name":u};t&&(d[`langchain.chain.inputs`]=JSON.stringify(n)),es({name:`chain ${u}`,op:`gen_ai.invoke_agent`,attributes:{...d,[I]:`gen_ai.invoke_agent`}},e=>(i.set(r,e),e))},handleChainEnd(e,t){let r=i.get(t);r?.isRecording()&&(n&&r.setAttributes({"langchain.chain.outputs":JSON.stringify(e)}),a(t))},handleChainError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t))},handleToolStart(e,n,r,a,o,s,c){if(s?.__sentry_langgraph__)return;let l=c||e.name||`unknown_tool`,u={...Lb(s),[L]:xb,[$g]:`execute_tool`,[y_]:l};t&&(u[S_]=n),es({name:`execute_tool ${l}`,op:`gen_ai.execute_tool`,attributes:{...u,[I]:`gen_ai.execute_tool`}},e=>(i.set(r,e),e))},handleToolEnd(e,t){let r=i.get(t);if(r?.isRecording()){if(n){let t=e,n=t&&typeof t==`object`&&`content`in t?t.content:e;r.setAttributes({[C_]:typeof n==`string`?n:JSON.stringify(n)})}a(t)}},handleToolError(e,t){let n=i.get(t);n?.isRecording()&&(n.setStatus({code:2,message:`internal_error`}),a(t))},copy(){return o},toJSON(){return{lc:1,type:`not_implemented`,id:o.lc_id}},toJSONNotImplemented(){return{lc:1,type:`not_implemented`,id:o.lc_id}}};return o}function Wb(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 Gb(e){let t=e??{},n={[L]:xb,[I]:__,[$g]:`embeddings`,[Ig]:t.model??`unknown`};return n[Fg]=Wb(t),`dimensions`in t&&(n[Gg]=t.dimensions),`encodingFormat`in t&&(n[Wg]=t.encodingFormat),n}function Kb(e,t,n={}){let{recordInputs:r}=av(n),i=Gb(e),a=i[`gen_ai.request.model`]||`unknown`;return r&&t!=null&&(i[g_]=typeof t==`string`?t:JSON.stringify(t)),{name:`embeddings ${a}`,op:__,attributes:i}}function qb(e,t={}){return new Proxy(e,{apply(e,n,r){return B(Kb(n,r[0],t),()=>Reflect.apply(e,n,r))}})}function Jb(e,t){let n=e;return typeof n.embedQuery==`function`&&(n.embedQuery=qb(n.embedQuery,t)),typeof n.embedDocuments==`function`&&(n.embedDocuments=qb(n.embedDocuments,t)),e}var Yb=`LangGraph`,Xb=`auto.ai.langgraph`;function Zb(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 Qb(e){let t=e[0];return typeof t==`object`&&t&&`name`in t&&typeof t.name==`string`?t.name:null}function $b(e,t,n){let r=`__sentry_tool_wrapped__`;for(let i of e){if(!i||typeof i!=`object`)continue;let e=i,a=e.invoke;if(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,r))continue;let o=typeof e.name==`string`?e.name:`unknown_tool`,s=typeof e.description==`string`?e.description:void 0;e.invoke=new Proxy(a,{apply(e,r,i){let a={[L]:Xb,[I]:v_,[$g]:`execute_tool`,[y_]:o,[x_]:`function`},c=i[1]?.metadata?.lc_agent_name??n;typeof c==`string`&&(a[c_]=c),s&&(a[w_]=s);let l=i[0];if(typeof l==`object`&&l&&(`id`in l&&typeof l.id==`string`&&(a[b_]=l.id),t.recordInputs)){let e=`args`in l&&typeof l.args==`object`?l.args:l;try{a[S_]=JSON.stringify(e)}catch{}}return B({op:v_,name:`execute_tool ${o}`,attributes:a},async n=>{try{let a=await Reflect.apply(e,r,i);if(t.recordOutputs)try{let e=a,t=e&&typeof e==`object`&&`content`in e?e.content:a;n.setAttribute(C_,typeof t==`string`?t:JSON.stringify(t))}catch{}return a}catch(e){throw n.setStatus({code:2,message:`internal_error`}),e}})}}),Object.defineProperty(e,r,{value:!0,enumerable:!1})}return e}function ex(e){if(!e||e.length===0)return null;let t=[];for(let n of e)if(n&&typeof n==`object`){let e=n.tool_calls;e&&Array.isArray(e)&&t.push(...e)}return t.length>0?t:null}function tx(e){let t=e,n=0,r=0,i=0;if(t.usage_metadata&&typeof t.usage_metadata==`object`){let e=t.usage_metadata;return typeof e.input_tokens==`number`&&(n=e.input_tokens),typeof e.output_tokens==`number`&&(r=e.output_tokens),typeof e.total_tokens==`number`&&(i=e.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:i}}if(t.response_metadata&&typeof t.response_metadata==`object`){let e=t.response_metadata;if(e.tokenUsage&&typeof e.tokenUsage==`object`){let t=e.tokenUsage;typeof t.promptTokens==`number`&&(n=t.promptTokens),typeof t.completionTokens==`number`&&(r=t.completionTokens),typeof t.totalTokens==`number`&&(i=t.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:i}}function nx(e,t){let n=t;if(n.response_metadata&&typeof n.response_metadata==`object`){let t=n.response_metadata;t.model_name&&typeof t.model_name==`string`&&e.setAttribute(qg,t.model_name),t.finish_reason&&typeof t.finish_reason==`string`&&e.setAttribute(Kg,[t.finish_reason])}}function rx(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(e=>({name:e.lc_kwargs?.name,description:e.lc_kwargs?.description,schema:e.lc_kwargs?.schema}))}function ix(e,t,n){let r=n?.messages;if(!r||!Array.isArray(r))return;let i=t?.length??0,a=r.length>i?r.slice(i):[];if(a.length===0)return;let o=ex(a);o&&e.setAttribute(s_,JSON.stringify(o));let s=kb(a);e.setAttribute(i_,JSON.stringify(s));let c=0,l=0,u=0;for(let t of a){let n=tx(t);c+=n.inputTokens,l+=n.outputTokens,u+=n.totalTokens,nx(e,t)}c>0&&e.setAttribute(Xg,c),l>0&&e.setAttribute(Zg,l),u>0&&e.setAttribute(Qg,u)}var ax=!1,ox=`__sentry_patched__`;function sx(e){let t={[L]:Xb,[I]:`gen_ai.create_agent`,[$g]:`create_agent`};return e&&(t[c_]=e),{op:`gen_ai.create_agent`,name:e?`create_agent ${e}`:`create_agent`,attributes:t}}function cx(e,t){if(Object.prototype.hasOwnProperty.call(e,ox))return e;let n=Ub(t),r=new Proxy(e,{apply(e,r,i){return ax?Reflect.apply(e,r,i):B(sx(),a=>{try{let o=Reflect.apply(e,r,i),s=i.length>0?i[0]:{};s?.name&&typeof s.name==`string`&&(a.setAttribute(c_,s.name),a.updateName(`create_agent ${s.name}`));let c=o.invoke;return c&&typeof c==`function`&&(o.invoke=lx(c.bind(o),o,s,t,void 0,n)),o}catch(e){throw a.setStatus({code:2,message:`internal_error`}),e}})}});return Object.defineProperty(r,ox,{value:!0,enumerable:!1}),r}function lx(e,t,n,r,i,a){return new Proxy(e,{apply(e,o,s){let c=i?.modelName??i?.model;return B({op:`gen_ai.invoke_agent`,name:`invoke_agent`,attributes:{[L]:Xb,[I]:h_,[$g]:`invoke_agent`}},async i=>{try{let l=n?.name;l&&typeof l==`string`&&(i.setAttribute(l_,l),i.setAttribute(c_,l),i.updateName(`invoke_agent ${l}`)),c&&i.setAttribute(Ig,c);let u=(s.length>1?s[1]:void 0)?.configurable?.thread_id;if(u&&typeof u==`string`&&i.setAttribute(u_,u),a){let e=s[1]??{};s[1]=e,e.metadata={...e.metadata??{},__sentry_langgraph__:!0,...typeof l==`string`?{lc_agent_name:l}:{}},e.callbacks=Hb(e.callbacks,a)}let d=rx(t);d&&i.setAttribute(a_,JSON.stringify(d));let f=r.recordInputs,p=r.recordOutputs,m=s.length>0?s[0]?.messages??[]:[];if(m&&f){let{systemInstructions:e,filteredMessages:t}=dv(kb(m));e&&i.setAttribute(r_,e);let n=ov(r.enableTruncation),a=Array.isArray(t)?t.length:0;i.setAttributes({[t_]:n?uv(t):pr(t),[e_]:a})}let h=await Reflect.apply(e,o,s);return p&&ix(i,m??null,h),h}catch(e){throw i.setStatus({code:2,message:`internal_error`}),e}})}})}function ux(e,t){if(Object.prototype.hasOwnProperty.call(e,ox))return e;let n=av(t),r=Ub(n),i=new Proxy(e,{apply(e,t,i){let a=Zb(i),o=Qb(i),s=i[0];s&&Array.isArray(s.tools)&&s.tools.length>0&&$b(s.tools,n,o??void 0),ax=!0;let c;try{c=Reflect.apply(e,t,i)}finally{ax=!1}let l=c.invoke;if(l&&typeof l==`function`){let e={};o&&(e.name=o),c.invoke=lx(l.bind(c),c,e,n,a,r)}return c}});return Object.defineProperty(i,ox,{value:!0,enumerable:!1}),i}function dx(e,t){return e.compile=cx(e.compile,av(t)),e}var fx=dx;function px(e,t,n){let r=n.getOptions(),i=n.getDsn(),a=r.tunnel,o=jo(r._metadata),s={sent_at:new Date(Qn()).toISOString(),...mx(t)&&{trace:t},...o&&{sdk:o},...!!a&&i&&{dsn:fa(i)}},c=n.getDataCollectionOptions().userInfo?`auto`:`never`;return yo(s,[[{type:`span`,item_count:e.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...Pd()&&{ingest_settings:{infer_ip:c,infer_user_agent:c}},items:e}]])}function mx(e){return!!e.trace_id&&!!e.public_key}function hx(e){let t=156;if(t+=e.name.length*2,t+=mi(e.attributes),e.links&&e.links.length>0){let n=e.links[0]?.attributes,r=100+(n?mi(n):0);t+=r*e.links.length}return t}var gx=1e3,_x=5e6,vx=class{constructor(e,t){this._traceBuckets=new Map,this._client=e;let{maxSpanLimit:n,flushInterval:r,maxTraceWeightInBytes:i}=t??{};this._maxSpanLimit=n&&n>0&&n<=gx?n:gx,this._flushInterval=r&&r>0?r:5e3,this._maxTraceWeight=i&&i>0?i:_x,this._client.on(`flush`,()=>{this.drain()}),this._client.on(`close`,()=>{this._traceBuckets.forEach(e=>{clearTimeout(e.timeout)}),this._traceBuckets.clear()})}add(e){let t=e.trace_id,n=this._traceBuckets.get(t);n||(n={spans:new Set,size:0,timeout:pd(setTimeout(()=>{this.flush(t)},this._flushInterval))},this._traceBuckets.set(t,n)),n.spans.add(e),n.size+=hx(e),(n.spans.size>=this._maxSpanLimit||n.size>=this._maxTraceWeight)&&this.flush(t)}drain(){this._traceBuckets.size&&(O&&j.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((e,t)=>{this.flush(t)}))}flush(e){let t=this._traceBuckets.get(e);if(!t)return;if(!t.spans.size){this._removeTrace(e);return}let n=Array.from(t.spans),r=n[0]?._segmentSpan;if(!r){O&&j.warn(`No segment span reference found on span JSON, cannot compute DSC`),this._removeTrace(e);return}let i=ho(r),a=n.map(e=>{let{_segmentSpan:t,...n}=e;return n}),o=px(a,i,this._client);O&&j.log(`Sending span envelope for trace ${e} with ${a.length} spans`),this._client.sendEnvelope(o).then(null,e=>{O&&j.error(`Error while sending streamed span envelope:`,e)}),this._removeTrace(e)}_removeTrace(e){let t=this._traceBuckets.get(e);t&&clearTimeout(t.timeout),this._traceBuckets.delete(e)}},yx=G(()=>({name:`SpanStreaming`,setup(e){let t=`SpanStreaming integration requires`,n=`Falling back to static trace lifecycle.`,r=e.getOptions();if(!Uo(e)){r.traceLifecycle=`static`,O&&j.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!vo(i)){r.traceLifecycle=`static`,O&&j.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let a=new vx(e);e.on(`afterSpanEnd`,t=>{Ha(t)&&a.add(mu(t,e))})}}));function bx(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function xx(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 Sx=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let t=this._cache.get(e);if(t!==void 0)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){if(this._cache.size>=this._maxSize){let e=this._cache.keys().next().value;this._cache.delete(e)}this._cache.set(e,t)}remove(e){let t=this._cache.get(e);return t&&this._cache.delete(e),t}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(t=>e.push(t)),e}};function Cx(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 wx=class extends Rf{constructor(e){Cx(e),e.traceLifecycle===`stream`&&!e.integrations.some(e=>e.name===`SpanStreaming`)&&e.integrations.push(yx()),super(e),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(e,t){let n=Dm(this,this._options.stackParser,e,t);return n.level=`error`,Cu(n)}eventFromMessage(e,t=`info`,n){return Cu(Om(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return Tx(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&Tx(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:Sr();if(!this._isEnabled())return O&&j.warn(`SDK not enabled, will not capture check-in.`),r;let{release:i,environment:a,tunnel:o}=this.getOptions(),s={check_in_id:r,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};`duration`in e&&(s.duration=e.duration),t&&(s.monitor_config={schedule:t.schedule,checkin_margin:t.checkinMargin,max_runtime:t.maxRuntime,timezone:t.timezone,failure_issue_threshold:t.failureIssueThreshold,recovery_threshold:t.recoveryThreshold});let[c,l]=Ad(this,n);l&&(s.contexts={trace:l});let u=dp(s,c,this.getSdkMetadata(),o,this.getDsn());return O&&j.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}registerCleanup(e){this._disposeCallbacks.push(e)}dispose(){O&&j.log(`Disposing client...`);for(let e of this._disposeCallbacks)try{e()}catch{}this._disposeCallbacks.length=0;for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=cf(64)}_prepareEvent(e,t,n,r){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,t,n,r)}_setUpMetricsProcessing(){this.on(`processMetric`,e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function Tx(e){let t=P().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}var Ex={mechanism:{handled:!1,type:`auto.rpc.trpc.middleware`}};function Dx(e){typeof e==`object`&&e&&`ok`in e&&!e.ok&&`error`in e&&U(e.error,Ex)}function Ox(e={}){return async function(t){let{path:n,type:r,next:i,rawInput:a,getRawInput:o}=t,s=F(),c=s?.getOptions(),l=s?.getDataCollectionOptions(),u={procedure_path:n,procedure_type:r};if(nr(u,1+(c?.normalizeDepth??5)),(e.attachRpcInput===void 0?l?.httpBodies.includes(`incomingRequest`):e.attachRpcInput)&&(a!==void 0&&(u.input=ar(a)),o!==void 0&&typeof o==`function`))try{u.input=ar(await o())}catch{}return bi(t=>(t.setContext(`trpc`,u),es({name:`trpc/${n}`,op:`rpc.server`,attributes:{[Si]:`route`,[L]:`auto.rpc.trpc`},forceTransaction:!!e.forceTransaction},async e=>{try{let t=await i();return Dx(t),e.end(),t}catch(t){throw U(t,Ex),e.end(),t}})))}}function kx(e,t,n){try{if(!F())return;let r=z();r?.isRecording()&&r.setStatus({code:2,message:`internal_error`}),U(e,{mechanism:{type:`auto.ai.mcp_server`,handled:!1,data:{error_type:t||`handler_execution`,...n}}})}catch{}}function Ax(e,t){Vn(e,t,e=>function(n,...r){let i=r[r.length-1];if(typeof i!=`function`)return e.call(this,n,...r);let a=jx(i,t,n);return e.call(this,n,...r.slice(0,-1),a)})}function jx(e,t,n){return function(...r){try{return Mx.call(this,e,t,n,r)}catch(t){return O&&j.warn(`MCP handler wrapping failed:`,t),e.apply(this,r)}}}function Mx(e,t,n,r){try{let i=e.apply(this,r);return M(i)&&typeof i.then==`function`?Promise.resolve(i).catch(e=>{throw Nx(e,t,n),e}):i}catch(e){throw Nx(e,t,n),e}}function Nx(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`)?kx(e,`validation`,r):e.name===`ServerTimeoutError`||e.message.includes(`timed out`)||e.message.includes(`timeout`)?kx(e,`timeout`,r):kx(e,`tool_execution`,r)):t===`resource`||t===`registerResource`?(r.resource_uri=n,kx(e,`resource_execution`,r)):(t===`prompt`||t===`registerPrompt`)&&(r.prompt_name=n,kx(e,`prompt_execution`,r))}catch{}}function Px(e){typeof e.tool==`function`&&Ax(e,`tool`),typeof e.registerTool==`function`&&Ax(e,`registerTool`)}function Fx(e){typeof e.resource==`function`&&Ax(e,`resource`),typeof e.registerResource==`function`&&Ax(e,`registerResource`)}function Ix(e){typeof e.prompt==`function`&&Ax(e,`prompt`),typeof e.registerPrompt==`function`&&Ax(e,`registerPrompt`)}function Lx(e){Px(e),Fx(e),Ix(e)}function Rx(e){let t=e,n=t._registeredTools;if(M(n))for(let[e,t]of Object.entries(n))typeof t.executor==`function`&&(t.executor=jx(t.executor,`registerTool`,e));let r=t._registeredResources;if(M(r))for(let[e,t]of Object.entries(r))typeof t.readCallback==`function`&&(t.readCallback=jx(t.readCallback,`registerResource`,e));let i=t._registeredResourceTemplates;if(M(i))for(let[e,t]of Object.entries(i))typeof t.readCallback==`function`&&(t.readCallback=jx(t.readCallback,`registerResource`,e));let a=t._registeredPrompts;if(M(a))for(let[e,t]of Object.entries(a))typeof t.handler==`function`&&(t.handler=jx(t.handler,`registerPrompt`,e))}var zx=`mcp.method.name`,Bx=`mcp.transport`,Vx=`mcp.server.name`,Hx=`mcp.server.title`,Ux=`mcp.server.version`,Wx=`mcp.protocol.version`,Gx=`mcp.tool.name`,Kx=`mcp.resource.uri`,qx=`mcp.prompt.name`,Jx=`mcp.tool.result.is_error`,Yx=`mcp.tool.result.content_count`,Xx=`mcp.prompt.result.description`,Zx=`mcp.prompt.result.message_count`,Qx=`mcp.request.argument`,$x=`mcp.logging.level`,eS=`mcp.logging.logger`,tS=`mcp.logging.data_type`,nS=`mcp.logging.message`,rS=`network.transport`,iS=`network.protocol.version`,aS=`client.address`,oS=`client.port`,sS=`mcp.server`,cS=`mcp.notification.client_to_server`,lS=`mcp.notification.server_to_client`,uS=`auto.function.mcp_server`,dS=`auto.mcp.notification`,fS=`route`;function pS(e){return M(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&`id`in e}function mS(e){return M(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&!(`id`in e)}function hS(e){return M(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`id`in e&&(`result`in e||`error`in e)}function gS(e){return M(e)&&`connect`in e&&(`tool`in e&&`resource`in e&&`prompt`in e||`registerTool`in e&&`registerResource`in e&&`registerPrompt`in e)?!0:(O&&j.warn(`Did not patch MCP server. Interface is incompatible.`),!1)}function _S(e){return M(e)}function vS(e,t){let n={[Yx]:e.length};for(let[r,i]of e.entries()){if(!_S(i))continue;let a=e.length===1?`mcp.tool.result`:`mcp.tool.result.${r}`;if(typeof i.type==`string`&&(n[`${a}.content_type`]=i.type),t){let e=(e,t)=>{typeof t==`string`&&(n[`${a}.${e}`]=t)};e(`mime_type`,i.mimeType),e(`uri`,i.uri),e(`name`,i.name),typeof i.text==`string`&&(n[`${a}.content`]=i.text),typeof i.data==`string`&&(n[`${a}.data_size`]=i.data.length);let t=i.resource;_S(t)&&(e(`resource_uri`,t.uri),e(`resource_mime_type`,t.mimeType))}}return n}function yS(e,t){if(!_S(e))return{};let n=Array.isArray(e.content)?vS(e.content,t):{};return typeof e.isError==`boolean`&&(n[Jx]=e.isError),n}function bS(e,t){let n={};if(!_S(e))return n;if(t&&typeof e.description==`string`&&(n[Xx]=e.description),Array.isArray(e.messages)&&(n[Zx]=e.messages.length,t)){let t=e.messages;for(let[e,r]of t.entries()){if(!_S(r))continue;let i=t.length===1?`mcp.prompt.result`:`mcp.prompt.result.${e}`;if(((e,r)=>{if(typeof r==`string`){let a=t.length===1?`${i}.message_${e}`:`${i}.${e}`;n[a]=r}})(`role`,r.role),_S(r.content)){let e=r.content;if(typeof e.text==`string`){let r=t.length===1?`${i}.message_content`:`${i}.content`;n[r]=e.text}}}}return n}var xS=new Map,SS=new WeakMap;function CS(e){let t=e.sessionId;return t?xS.get(t):SS.get(e)}function wS(e,t){let n=e.sessionId;n?xS.set(n,t):SS.set(e,t)}function TS(e,t){wS(e,{...CS(e)||{},...t})}function ES(e){return CS(e)?.clientInfo}function DS(e){return CS(e)?.protocolVersion}function OS(e){return CS(e)}function kS(e){let t=e.sessionId;t&&xS.delete(t)}var AS=`io.modelcontextprotocol/protocolVersion`,jS=`io.modelcontextprotocol/clientInfo`,MS=`io.modelcontextprotocol/serverInfo`;function NS(e){let t={};return _S(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 PS(e){let t={};return _S(e.params)&&(typeof e.params.protocolVersion==`string`&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=NS(e.params.clientInfo))),t}function FS(e){let t={};if(_S(e.params)&&_S(e.params._meta)){let n=e.params._meta;typeof n[AS]==`string`&&(t.protocolVersion=n[AS]),n[jS]&&(t.clientInfo=NS(n[jS]))}return t}function IS(e){let t={};return _S(e)&&(typeof e.protocolVersion==`string`&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=NS(e.serverInfo))),t}function LS(e){let t={};return _S(e)&&_S(e._meta)&&e._meta[MS]&&(t.serverInfo=NS(e._meta[MS])),t}function RS(e){let t=ES(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 zS(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 BS(e){let t=OS(e)?.serverInfo,n={};return t?.name&&(n[Vx]=t.name),t?.title&&(n[Hx]=t.title),t?.version&&(n[Ux]=t.version),n}function VS(e){let t={};return e?.name&&(t[Vx]=e.name),e?.title&&(t[Hx]=e.title),e?.version&&(t[Ux]=e.version),t}function HS(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 US(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 WS(e,t){let n=e&&`sessionId`in e?e.sessionId:void 0,r=t?HS(t):{},{mcpTransport:i,networkTransport:a}=US(e),o=RS(e),s=BS(e),c=DS(e);return{...n&&{"mcp.session.id":n},...r.address&&{"client.address":r.address},...r.port&&{"client.port":r.port},[Bx]:i,[rS]:a,[iS]:`2.0`,...c&&{"mcp.protocol.version":c},...o,...s}}var GS=new Map,KS=new WeakMap;function qS(e){let t=e.sessionId;if(t){let e=GS.get(t);return e||(e=new Map,GS.set(t,e)),e}let n=KS.get(e);return n||(n=new Map,KS.set(e,n)),n}function JS(e,t,n,r,i){qS(e).set(t,{span:n,method:r,capturePolicy:i,startTime:Date.now()})}function YS(e,t,n,r=!1){let i=qS(e),a=i.get(t);if(a){let{span:o,method:s}=a,c=s===`initialize`?IS(n):LS(n);(c.protocolVersion||c.serverInfo)&&TS(e,c);let l={...VS(c.serverInfo)};if(c.protocolVersion&&(l[Wx]=c.protocolVersion),Object.keys(l).length>0&&o.setAttributes(l),r)o.setStatus({code:2,message:`internal_error`});else if(s===`tools/call`){let e=yS(n,a.capturePolicy.recordOutputs);o.setAttributes(e)}else if(s===`prompts/get`){let e=bS(n,a.capturePolicy.recordOutputs);o.setAttributes(e)}o.end(),i.delete(t)}}function XS(e){let t=e.sessionId;if(t){let e=GS.get(t);if(e){for(let[,t]of e)t.span.setStatus({code:2,message:`cancelled`}),t.span.end();GS.delete(t)}return}let n=KS.get(e);if(n){for(let[,e]of n)e.span.setStatus({code:2,message:`cancelled`}),e.span.end();n.clear()}}var ZS={"tools/call":{targetField:`name`,targetAttribute:Gx,captureArguments:!0,argumentsField:`arguments`},"resources/read":{targetField:`uri`,targetAttribute:Kx,captureUri:!0},"resources/subscribe":{targetField:`uri`,targetAttribute:Kx},"resources/unsubscribe":{targetField:`uri`,targetAttribute:Kx},"prompts/get":{targetField:`name`,targetAttribute:qx,captureName:!0,captureArguments:!0,argumentsField:`arguments`}};function QS(e,t){let n=ZS[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 $S(e,t){let n={},r=ZS[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let e=t[r.argumentsField];if(M(e))for(let[t,r]of Object.entries(e))n[`${Qx}.${t.toLowerCase()}`]=JSON.stringify(r)}return r.captureUri&&t?.uri&&(n[`${Qx}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${Qx}.name`]=JSON.stringify(t.name)),n}function eC(e){return typeof e==`string`?e:JSON.stringify(e)}function tC(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[$x]=String(t.level)),t?.logger&&(r[eS]=String(t.logger)),t?.data!==void 0&&(r[tS]=typeof t.data,n&&(r[nS]=eC(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[Kx]=String(t.uri);let e=hp(String(t.uri));e&&!mp(e)&&(r[`mcp.resource.protocol`]=e.protocol.replace(`:`,``))}break;case`notifications/initialized`:r[`mcp.lifecycle.phase`]=`initialization_complete`,r[`mcp.protocol.ready`]=1}return r}function nC(e,t,n,r){if(e===`request`){let e=t,i=QS(e.method,n||{});return{...e.id!==void 0&&{"mcp.request.id":String(e.id)},...i.attributes,...r?$S(e.method,n||{}):{}}}return tC(t.method,n||{},r)}var rC=new Set([aS,oS,Kx]);function iC(e){return rC.has(e)}function aC(e,t){return t?e:Object.entries(e).reduce((e,[t,n])=>(iC(t)||(e[t]=n),e),{})}function oC(e,t){return t?`${e} ${t}`:e}function sC(e){let t,n;switch(e){case`request`:t=sS,n=uS;break;case`notification-incoming`:t=cS,n=dS;break;case`notification-outgoing`:t=lS,n=dS}return{[I]:t,[L]:n,[Si]:fS}}function cC(e){let{type:t,message:n,transport:r,extra:i,callback:a,options:o}=e,{method:s}=n,c=n.params,l;l=t===`request`?oC(s,QS(s,c||{}).target):s;let u=aC({...WS(r,i),[zx]:s,...nC(t,n,c,o?.recordInputs),...sC(t)},!!F()?.getDataCollectionOptions().userInfo);return B({name:l,forceTransaction:!0,attributes:u},a)}function lC(e,t,n,r,i){return cC({type:`notification-incoming`,message:e,transport:t,extra:n,callback:i,options:r})}function uC(e,t,n,r){return cC({type:`notification-outgoing`,message:e,transport:t,options:n,callback:r})}function dC(e,t,n,r){let{method:i}=e,a=e.params;return{name:oC(i,QS(i,a||{}).target),op:sS,forceTransaction:!0,attributes:aC({...WS(t,n),[zx]:i,...nC(`request`,e,a,r?.recordInputs),...sC(`request`)},!!F()?.getDataCollectionOptions().userInfo)}}function fC(e){if(e.recordInputs!==void 0&&e.recordOutputs!==void 0)return{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs};let t=F()?.getDataCollectionOptions().genAI;return{recordInputs:e.recordInputs??t?.inputs??!1,recordOutputs:e.recordOutputs??t?.outputs??!1}}function pC(e,t){e.onmessage&&Vn(e,`onmessage`,n=>function(r,i){let a=pS(r)?r:void 0,o=mS(r)?r:void 0,s=a||o,c;if(s)try{c=a?.method===`initialize`?PS(a):FS(s),(c.protocolVersion||c.clientInfo)&&TS(e,c)}catch{}if(a){let r=fC(t);return bi(P().clone(),()=>{let t=V(dC(a,e,i,r));return a.method===`initialize`&&c&&t.setAttributes({...zS(c.clientInfo),...c.protocolVersion&&{"mcp.protocol.version":c.protocolVersion}}),JS(e,a.id,t,a.method,r),H(t,()=>n.call(this,a,i))})}return o?lC(o,e,i,fC(t),()=>n.call(this,o,i)):n.call(this,r,i)})}function mC(e,t){e.send&&Vn(e,`send`,n=>async function(...r){let[i]=r;return mS(i)?uC(i,e,fC(t),()=>n.call(this,...r)):(hS(i)&&i.id!==null&&i.id!==void 0&&(i.error&&_C(i.error),YS(e,i.id,i.result,!!i.error)),n.call(this,...r))})}function hC(e){e.onclose&&Vn(e,`onclose`,t=>function(...n){return XS(e),kS(e),t.call(this,...n)})}function gC(e){e.onerror&&Vn(e,`onerror`,e=>function(t){return vC(t),e.call(this,t)})}function _C(e){try{if(M(e)&&`code`in e&&`message`in e){let t=e;if(t.code===-32603||t.code>=-32099&&t.code<=-32e3){let e=Error(t.message);e.name=`JsonRpcError_${t.code}`,kx(e,`protocol`)}}}catch{}}function vC(e){try{kx(e,`transport`)}catch{}}var yC=new WeakSet;function bC(e,t){if(yC.has(e)||!gS(e))return e;let n=e,r={...t};return Vn(n,`connect`,e=>async function(t,...n){let i=await e.call(this,t,...n);return pC(t,r),mC(t,r),hC(t),gC(t),i}),Lx(n),Rx(n),yC.add(e),e}function xC(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 SC(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return i=>{let a=i.match(r);if(a)return{filename:`<data:${a[2]}>`,function:a[1]};let o=i.match(n);if(o){let t,n,r,i,a;if(o[1]){r=o[1];let e=r.lastIndexOf(`.`);if(r[e-1]===`.`&&e--,e>0){t=r.slice(0,e),n=r.slice(e+1);let i=t.indexOf(`.Module`);i>0&&(r=r.slice(i+1),t=t.slice(0,i))}i=void 0}n&&(i=t,a=n),n===`<anonymous>`&&(a=void 0,r=void 0),r===void 0&&(a||=`?`,r=i?`${i}.${a}`:a);let s=Cn(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?TC(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:wC(o[3]),colno:wC(o[4]),in_app:xC(s||``,c)}}if(i.match(t))return{filename:i}}}function CC(e){return[90,SC(e)]}function wC(e){return parseInt(e||``,10)||void 0}function TC(e){try{return decodeURI(e)}catch{return}}var EC=new WeakMap,DC=(e,t)=>{let n=EC.get(e);n?n.push(t):EC.set(e,[t])},OC=e=>{let t=EC.get(e);return t||(t=[],EC.set(e,t)),t},kC=`express.name`,AC=`http.route`,jC=`express.type`,MC=`router`,NC=`middleware`,PC=`request_handler`,FC=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function IC(e){return e.includes(`:`)||e.includes(`*`)}var LC=(e,t,n)=>{if(t.name===`router`){let r=RC(``,t)||n||e||`/`;return{attributes:{[kC]:r,[jC]:MC},name:`router - ${r}`}}return t.name===`bound dispatch`||t.name===`handle`?{attributes:{[kC]:(e||n)??`request handler`,[jC]:PC},name:`request handler${t.path?` - ${e||n}`:``}`}:{attributes:{[kC]:t.name,[jC]:NC},name:`middleware - ${t.name}`}},RC=(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)?RC(e,n):e},zC=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return vr(e,n.ignoreLayers,!0)}catch{}return!1};function BC(e,t){let n=OC(e);if(n.length===0)return;if(n.every(e=>e===`/`))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)||IC(r))?r:void 0}function VC(e){let t=OC(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}var HC=e=>{let t=e[0];return Array.isArray(t)?t.map(e=>UC(e)||``).join(`,`):UC(t)},UC=e=>typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0,WC=e=>GC(e?.Router?.prototype),GC=e=>(typeof e==`object`||typeof e==`function`)&&!!e&&`route`in e&&typeof e.route==`function`,KC=e=>GC(e.Router)&&!WC(e);function qC(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function JC(e){return qC(e)>=500}function YC(e){if(!P()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let t=Hp(e);P().setSDKProcessingMetadata({normalizedRequest:t})}}function XC(e,t,n){if(!t?.handle)return;let r=t,i=r.handle;if(Gn(i)||i.length===4)return;function a(t,a,...o){let s=e();YC(t);let c=z();if(!c)return i.apply(this,[t,a,...o]);n&&DC(t,n);let l=OC(t),u=!!n,d=VC(t),f=BC(t,d);s.onRouteResolved?.(f);let p=LC(d,r,n),m=p.attributes[kC],h=p.attributes[jC],g=Object.assign(p.attributes,{[L]:`auto.http.express`,[I]:`${h}.express`});if(f&&(g[AC]=f),zC(p.attributes[`express.name`],h,s))return u&&l.pop(),i.apply(this,[t,a,...o]);let _=P();if(_!==Qr()){if(h===`request_handler`){let e=t.method?t.method.toUpperCase():`GET`;_.setTransactionName(`${e} ${d}`)}}else O&&j.warn(`Isolation scope is still default isolation scope - skipping setting transactionName`);return es({name:m,attributes:g},e=>{let n=!1;p.attributes[`express.type`]===`router`&&(e.end(),n=!0);let r=()=>{n||(n=!0,e.end())};for(let i=0;i<o.length;i++){let s=o[i];if(typeof s==`function`){o[i]=function(...i){let o=i[0],d=!!o&&o!==`route`&&o!==`router`;if(!n&&d){let[t,n]=FC(o);e.setStatus({code:2,message:n})}return n||(n=!0,a.removeListener(`finish`,r),e.end()),!(t.route&&d)&&u&&l.pop(),H(c,()=>s.apply(this,i))};break}}try{return i.apply(this,[t,a,...o])}catch(t){let[n,r]=FC(t);throw e.setStatus({code:2,message:r}),t}finally{n||a.once(`finish`,r)}})}for(let e in i)e in a||Object.defineProperty(a,e,{get(){return i[e]},set(t){i[e]=t}});Un(a,i),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:a})}function ZC(e){return!!e&&typeof e==`object`&&`default`in e&&e.default||e}function QC(e){return!!e.express}var $C=!1;function ew(){$C||($C=!0,O&&j.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function tw(e,t){let n,r;if(!t&&QC(e)){let{express:t,...i}=e;r=t,n=()=>i,ew()}else if(typeof t!=`function`)throw TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");else n=t,r=e;let i=ZC(r),a=WC(i)?i.Router.prototype:KC(i)?i.Router:void 0;if(!a)throw TypeError(`no valid Express route function to instrument`);let o=a.route;try{Wn(a,`route`,function(...e){let t=o.apply(this,e),r=this.stack[this.stack.length-1];return XC(n,r,HC(e)),t})}catch(e){O&&j.error(`Failed to patch express route method:`,e)}let s=a.use;try{Wn(a,`use`,function(...e){let t=s.apply(this,e),r=this.stack[this.stack.length-1];return r&&XC(n,r,HC(e)),t})}catch(e){O&&j.error(`Failed to patch express use method:`,e)}let{application:c}=i,l=c.use;try{Wn(c,`use`,function(...e){let t=l.apply(this,e),r=WC(i)?this.router:this._router;if(r){let t=r.stack[r.stack.length-1];t&&XC(n,t,HC(e))}return t})}catch(e){O&&j.error(`Failed to patch express application.use method:`,e)}return i}function nw(){return F()?.getIntegrationByName(`Express`)?.getShouldHandleError?.()}function rw(e){return function(t,n,r,i){YC(n);let a=e?.shouldHandleError??nw()??JC;if(a===!1){i(t);return}a(t)&&(r.sentry=U(t,{mechanism:{type:`auto.middleware.express`,handled:!1}})),i(t)}}function iw(e,t){e.use(aw()),e.use(rw(t))}function aw(){return function(e,t,n){YC(e),n()}}var ow=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,sw=Symbol(`sentryPostgresConnectionContext`),cw=Symbol.for(`sentry.instrumented.postgresjs`),lw=Symbol.for(`sentry.query.from.instrumented.sql`);function uw(e,t){return!e||typeof e!=`function`?(O&&j.warn(`instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance`),e):dw(e,{requireParentSpan:!0,...t})}function dw(e,t,n){if(e[cw])return e;let r=new Proxy(e,{apply(e,n,i){let a=Reflect.apply(e,n,i);return M(a)&&`handle`in a&&mw(a,r,t),a},get(e,n){let i=e[n];return typeof n!=`string`||typeof i!=`function`?i:n===`unsafe`||n===`file`?fw(i,e,r,t):n===`begin`||n===`reserve`?pw(i,e,r,t):i}});return n?r[sw]=n:Sw(e,r),e[cw]=!0,r[cw]=!0,r}function fw(e,t,n,r){return function(...i){let a=Reflect.apply(e,t,i);return M(a)&&`handle`in a&&mw(a,n,r),a}}function pw(e,t,n,r){return function(...i){let a=n[sw];if(typeof i[i.length-1]!=`function`){let n=Reflect.apply(e,t,i);return n&&typeof n.then==`function`?n.then(e=>dw(e,r,a)):n}let o=i.length===1?i[0]:i[1],s=function(e){let t=dw(e,r,a);return o(t)},c=i.length===1?[s]:[i[0],s];return Reflect.apply(e,t,c)}}function mw(e,t,n){if(e.handle?.__sentryWrapped)return;e[lw]=!0;let r=e.handle,i=async function(...i){if(this.executed||!hw(n))return r.apply(this,i);let a=vw(gw(e.strings));return es({name:a||`postgresjs.query`,op:`db`},e=>{e.setAttribute(L,`auto.db.postgresjs`),e.setAttributes({"db.system.name":`postgres`,"db.query.text":a});let o=t?t[sw]:void 0;if(yw(e,o),n.requestHook)try{n.requestHook(e,a,o)}catch(t){e.setAttribute(`sentry.hook.error`,`requestHook failed`),O&&j.error(`Error in requestHook for PostgresJs instrumentation:`,t)}let s=this;s.resolve=new Proxy(s.resolve,{apply:(t,n,r)=>{try{bw(e,a,r?.[0]?.command),e.end()}catch(e){O&&j.error(`Error ending span in resolve callback:`,e)}return Reflect.apply(t,n,r)}}),s.reject=new Proxy(s.reject,{apply:(t,n,r)=>{try{e.setStatus({code:2,message:r?.[0]?.message||`unknown_error`}),e.setAttribute(`db.response.status_code`,r?.[0]?.code||`unknown`),e.setAttribute(`error.type`,r?.[0]?.name||`unknown`),bw(e,a),e.end()}catch(e){O&&j.error(`Error ending span in reject callback:`,e)}return Reflect.apply(t,n,r)}});try{return r.apply(this,i)}catch(t){throw e.setStatus({code:2,message:t instanceof Error?t.message:`unknown_error`}),e.end(),t}})};i.__sentryWrapped=!0,e.handle=i}function hw(e){return z()!==void 0||!e.requireParentSpan}function gw(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}var _w;function vw(e){return e?(_w||=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(_w,`?`).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 yw(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 bw(e,t,n){if(n){e.setAttribute(`db.operation.name`,n);return}let r=t?.match(ow);r?.[1]&&e.setAttribute(`db.operation.name`,r[1].toUpperCase())}function xw(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 Sw(e,t){let n=e;n.options&&typeof n.options==`object`&&(t[sw]=xw(n.options))}var Cw=`http.client.request.created`,ww=`http.server.request.start`;function Tw(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 Ew(e){try{return String(Dw(e))}catch{return``}}function Dw(e){let t=e.protocol||`http:`,n=e.headers?.host&&String(e.headers?.host)||e.hostname||e.host||``,r=!e.port||e.port===80||e.port===443||/^(.*):(\d+)$/.test(n)?``:`:${e.port}`,i=e.path?e.path:`/`,a=`${t}//${n}${r}`;return new URL(i.startsWith(`//`)?`${a}${i}`:i,a)}function Ow(e){return String(Ew(Tw(e)))}function kw(e,t){let n=yp(Ow(e)),r=t?.statusCode,i=bx(r);Zp({category:`http`,data:{status_code:r,url:xp(n),"http.method":e.method||`GET`,...n.search?{"http.query":sp(n.search)}:{},...n.hash?{"http.fragment":n.hash}:{}},type:`http`,level:i},{event:`response`,request:e,response:t})}function Aw(e){let t=Ow(e),[n,r]=vp(hp(t),`client`,`auto.http.client`,e),i=e.getHeader(`user-agent`);return{name:n,attributes:{[I]:`http.client`,"otel.kind":`CLIENT`,"http.url":op(t),"http.method":e.method,"http.target":op(e.path||`/`),"net.peer.name":e.host,"http.host":e.getHeader(`host`),...i?{"user_agent.original":i}:{},...r},onlyIfParent:!0}}function jw(e,t){let{statusCode:n,statusMessage:r,httpVersion:i,socket:a}=e,o=i?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`;t.setAttributes({"http.response.status_code":n,"network.protocol.version":i,"http.flavor":i,"network.transport":o,"net.transport":o,"http.status_text":r?.toUpperCase(),"http.status_code":n,...Nw(e),...Mw(a)})}function Mw(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 Nw(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 Pw(e,t){let n=Ow(e),{tracePropagationTargets:r,propagateTraceparent:i}=F()?.getOptions()??{};if(!Fp(n,r,t)||e.getHeader(`sentry-trace`))return;let a=jp({propagateTraceparent:i});if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(o)try{e.setHeader(`sentry-trace`,o),O&&j.log(`@sentry/instrumentation-http`,`Added sentry-trace header`)}catch(e){O&&j.error(`@sentry/instrumentation-http`,`Failed to set sentry-trace header:`,An(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),O&&j.log(`@sentry/instrumentation-http`,`Added traceparent header`)}catch(e){O&&j.error(`@sentry/instrumentation-http`,`Failed to set traceparent header:`,An(e)?e.message:`Unknown error`)}if(s){let t=ca(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),O&&j.log(`@sentry/instrumentation-http`,`Added baggage header`)}catch(e){O&&j.error(`@sentry/instrumentation-http`,`Failed to set baggage header:`,An(e)?e.message:`Unknown error`)}}}var Fw=e=>typeof e.__unwrap==`function`,Iw=`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`,Lw=!1,Rw=O?e=>{Lw||(Fw(e.request)||Fw(e.get))&&(Lw=!0,j.warn(Iw))}:()=>{};function zw(e){let t=new Sx(100),n=()=>F()?.getOptions(),r=r=>{if(N().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__===!0)return;let i=n(),{errorMonitor:a=`error`,spans:o=!i||eo(i),propagateTrace:s=!1,breadcrumbs:c=!0,http:l,https:u,suppressOtelWarning:d=!1}=e,{request:f}=r,p=Ow(f);if(Cp(p,F())||e.ignoreOutgoingRequests?.(p,f))return;let m=!1;function h(e,t){m||(m=!0,kw(e,t))}function g(e){e.on(a,()=>h(e,void 0)),e.prependListener(`response`,t=>{e.listenerCount(`response`)<=1&&t.resume(),t.on(`end`,()=>h(e,t)),t.on(a,()=>h(e,t))})}if(!o){c&&g(f),s&&Pw(f,t);return}d||(l&&Rw(l),u&&Rw(u));let _=V(Aw(f));e.outgoingRequestHook?.(_,f),s&&(_.isRecording()?H(_,()=>{Pw(f,t)}):Pw(f,t));let v=!1;function y(e){v||(v=!0,_.setStatus(e),_.end())}let b=()=>y({code:0});f.on(`close`,b),f.on(a,e=>{O&&j.log(`@sentry/instrumentation-http`,`outgoingRequest on request error()`,e),c&&h(f,void 0),y({code:2})}),f.prependListener(`response`,t=>{f.removeListener(`close`,b),f.listenerCount(`response`)<=1&&t.resume(),jw(t,_),ks(t),e.outgoingResponseHook?.(_,t);let n=!1;function r(r){if(!n){n=!0,r&&O&&j.log(`@sentry/instrumentation-http`,`outgoingRequest on response error()`,r),c&&h(f,t);let i=t.aborted&&!t.complete,a=r||typeof t.statusCode!=`number`||i?{code:2}:Vi(t.statusCode);e.applyCustomAttributesOnSpan?.(_,f,t),y(a)}}t.on(`end`,()=>r()),t.on(a,r)})};return{[Cw]:r}}var Bw;function Vw(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!=`function`||(Bw=zw({...t,http:e})[Cw],Gn(n._storeHeader)))return;let r=n._storeHeader;Wn(n,`_storeHeader`,function(...e){try{Bw({request:this},Cw)}catch{}return r.apply(this,e)})}function Hw(e,t={}){return Vw(ZC(e),t),e}var Uw=(e,t={})=>Hw(e,t);function Ww(e,t,n,r){let i=0,a=[];O&&j.log(r,`Patching request.on`);let o=new WeakMap,s=zp(n);try{e.on=e.addListener=new Proxy(e.on,{apply:(e,t,n)=>{let[c,l,...u]=n;if(c===`data`){O&&j.log(r,`Handling request.on("data") with maximum body size of ${s}b`);let n=new Proxy(l,{apply:(e,t,n)=>{try{let e=n[0],t=Buffer.from(e);i<s?(a.push(t),i+=t.byteLength):O&&j.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{O&&j.error(r,`Encountered error while storing body chunk.`)}return Reflect.apply(e,t,n)}});return o.set(l,n),Reflect.apply(e,t,[c,n,...u])}return Reflect.apply(e,t,n)}}),e.off=e.removeListener=new Proxy(e.off,{apply:(e,t,n)=>{let[,r]=n,i=o.get(r);if(i){o.delete(r);let a=n.slice();return a[1]=i,Reflect.apply(e,t,a)}return Reflect.apply(e,t,n)}}),e.on(`end`,()=>{try{let e=Buffer.concat(a).toString(`utf-8`);if(e){let n=Buffer.byteLength(e,`utf-8`)>s?`${Buffer.from(e).subarray(0,s-3).toString(`utf-8`)}...`:e;t.setSDKProcessingMetadata({normalizedRequest:{data:n}})}}catch(e){O&&j.error(r,`Error building captured request body`,e)}})}catch(e){O&&j.error(r,`Error patching request to capture body`,e)}}var Gw=new WeakMap;function Kw(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:`ok`}}),n.once(`close`,()=>{let n=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&n){O&&j.log(`Recorded request session with status: ${n.status}`);let t=new Date(Qn());t.setSeconds(0,0);let i=t.toISOString(),a=Gw.get(e),o=a?.[i]||{exited:0,crashed:0,errored:0};if(o[{ok:`exited`,crashed:`crashed`,errored:`errored`}[n.status]]++,a)a[i]=o;else{O&&j.log(`Opened new request session aggregate.`);let t={[i]:o};Gw.set(e,t);let n=()=>{clearTimeout(s),a(),Gw.delete(e);let n=Object.entries(t).map(([e,t])=>({started:e,exited:t.exited,errored:t.errored,crashed:t.crashed}));e.sendSession({aggregates:n})},a=e.on(`flush`,()=>{O&&j.log(`Sending request session aggregate due to client flush`),n()}),s=setTimeout(()=>{O&&j.log(`Sending request session aggregate due to flushing schedule`),n()},r);pd(s)}}})}var qw=`Http.Server`,Jw=`Http.SentryServerSpans`,Yw=new WeakMap,Xw=Symbol.for(`sentry_http_server_instrumented`);function Zw(e){return!e[Xw]&&(e[Xw]=!0)}function Qw(e,t){let n=t.emit;if(n===Yw.get(t))return;let r=new Proxy(n,{apply(t,n,r){let[i,...a]=r;if(i!==`request`)return t.apply(n,r);let o=F(),[s,c]=a;if(!o||!Zw(s))return t.apply(n,r);O&&j.log(qw,`Handling incoming request`);let l=P().clone();l.setClient(o);let u=s.socket?.remoteAddress,d=s.url||`/`,f=Hp(s),{maxRequestBodySize:p=`medium`,ignoreRequestBody:m,sessions:h=!0,sessionFlushingDelayMS:g=6e4}=e;p!==`none`&&!m?.(d,s)&&Ww(s,l,p,qw),l.setSDKProcessingMetadata({normalizedRequest:f,ipAddress:u});let _=`${(s.method||`GET`).toUpperCase()} ${bp(d)}`;return l.setTransactionName(_),h&&Kw(o,{requestIsolationScope:l,response:c,sessionFlushingDelayMS:g??6e4}),bi(l,()=>{let i=f.headers?.[`sentry-trace`],a=f.headers?.baggage,o=Array.isArray(i)?i[0]:i;return rs({sentryTrace:o,baggage:Array.isArray(a)?a[0]:a},()=>{let i=N().getPropagationContext();i.propagationSpanId=Ur(),o||(i.traceId=Hr(),i.sampleRand=Zn()),c.once(`close`,()=>{l.setContext(`response`,{status_code:c.statusCode})});let a=e.wrapServerEmitRequest,u=!1;return a?a(s,c,f,()=>{u=t.apply(n,r)}):u=t.apply(n,r),u})})}});Yw.set(t,r),t.emit=r}function $w(e){let t=e.wrapServerEmitRequest,n=eT(e),r={...e,wrapServerEmitRequest(r,i,a,o){let s=F()?.getOptions();e.spans??(s?eo(s):!1)?n(r,i,a,o):t?t(r,i,a,o):o()}},i=e=>{let{server:t}=e;Qw(r,t)};return{[ww]:i}}function eT(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:i,errorMonitor:a=`error`,onSpanEnd:o}=e;return(e,s,c,l)=>{return typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__?l():t?t(e,s,c,u):u();function u(){let t=P().getClient();if(!t)return l();if(tT(e,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return O&&j.log(Jw,`Skipping span creation for incoming request`,e.url),l();let u=c.url||e.url||`/`,d=hp(u),f=d?d.pathname:bp(u),p=(e.method||`GET`).toUpperCase(),m=`${p} ${f}`,h=e.headers,g=h[`user-agent`],_=h[`x-forwarded-for`],v=e.httpVersion,y=h.host,b=y?.replace(/^(.*)(:[0-9]{1,5})/,`$1`)||`localhost`,ee=u.startsWith(`https`)?`https`:`http`,{socket:te}=e,{localAddress:ne,localPort:re,remoteAddress:ie,remotePort:ae}=te??{};return es({name:m,kind:K.SERVER,attributes:{[I]:`http.server`,[L]:`auto.http.server`,[Si]:`url`,"http.route":f,"otel.kind":`SERVER`,"net.host.ip":ne,"net.host.port":re,"net.peer.ip":ie,"net.peer.port":ae,"sentry.http.prefetch":rT(e)||void 0,[lu]:d&&!mp(d)?op(d.href,t):void 0,[uu]:d?.pathname??f,[Tl]:op(u,t),"http.method":p,"http.target":op(d?`${d.pathname}${d.search}`:f,t),"http.host":y,"net.host.name":b,"http.client_ip":typeof _==`string`?_.split(`,`)[0]:void 0,"http.user_agent":g,"http.scheme":ee,"http.flavor":v,"net.transport":v?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...iT(e),...Wp(c.headers||{},t.getDataCollectionOptions())}},n=>{i?.(n,e,s);let r=!1;function c(i){r||(r=!0,n.setAttributes({"http.status_text":s.statusMessage?.toUpperCase(),"http.response.status_code":s.statusCode,"http.status_code":s.statusCode,...Wp(Vp(s.headers),t?.getDataCollectionOptions()??!1,`response`)}),n.setStatus(i),o?.(n,e,s),n.end())}s.once(`close`,()=>{c(Vi(s.statusCode))}),s.once(a,()=>{let e=Vi(s.statusCode);c(e.code===2?e:{code:2})}),l()})}}}function tT(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&nT(r)||n?.(r,e))}function nT(e){let t=bp(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 rT(e){return e.headers[`next-router-prefetch`]===`1`}function iT(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}:{}}var aT=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;x();var oT=o(`sentry_http_server_instrumented`),sT=`Http.Server`;function cT(e,t){Hn(e,`_startSpanCallback`,new WeakRef(t))}var lT=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??`medium`,spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(e,t,n,i){let a=F();if(!a||r.active().getValue(oT))return i();let o=d.extract(r.active(),n.headers).setValue(oT,!0);r.with(o,()=>{a.emit(`httpServerRequest`,e,t,n);let r=e._startSpanCallback?.deref();r?r(()=>(i(),!0)):i()})}};return{name:sT,setupOnce(){let{[ww]:e}=$w(t);Ke(ww,e)},afterAllSetup(e){aT&&e.getIntegrationByName(`Http`)&&j.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}});x();var uT=`Http.ServerSpans`,dT=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,i=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:a}=e,{requestHook:o,responseHook:s,applyCustomAttributesOnSpan:c}=e.instrumentation??{};return{name:uT,setup(e){typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__||e.on(`httpServerRequest`,(i,l,u)=>{let d=i,f=l;cT(d,i=>{if(mT(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return aT&&j.log(uT,`Skipping span creation for incoming request`,d.url),i();let l=u.url||d.url||`/`,p=hp(l),m=d.headers,h=m[`user-agent`],g=m[`x-forwarded-for`],_=d.httpVersion,v=m.host,y=v?.replace(/^(.*)(:[0-9]{1,5})/,`$1`)||`localhost`,b=l.startsWith(`https`)?`https`:`http`,ee=u.method||d.method?.toUpperCase()||`GET`,te=p?p.pathname:bp(l),ne=V({name:`${ee} ${te}`,kind:K.SERVER,attributes:{[I]:`http.server`,[L]:`auto.http.otel.http`,[Ql]:fT(d)||void 0,[lu]:p&&!mp(p)?op(p.href,e):void 0,[uu]:p?.pathname??te,[Tl]:op(l,e),[vl]:u.method,[wl]:op(p?`${p.pathname}${p.search}`:te,e),[_l]:v,[Vl]:y,[hl]:typeof g==`string`?g.split(`,`)[0]:void 0,[El]:h,[Sl]:b,[gl]:_,[Kl]:_?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...hT(d),...Wp(u.headers||{},e.getDataCollectionOptions())}});o?.(ne,d),s?.(ne,f),c?.(ne,d,f),a?.(ne,d,f);let re={type:wt.HTTP,span:ne};return H(ne,()=>r.with(Tt(r.active(),re),()=>{ks(d),ks(f);let e=!1;function t(t){if(e)return;e=!0;let n=vT(d,f,re);ne.setAttributes(n),ne.setStatus(t),ne.end();let r=n[`http.route`];r&&P().setTransactionName(`${d.method?.toUpperCase()||`GET`} ${r}`)}return f.on(`close`,()=>{t(Vi(f.statusCode))}),f.on(xe,()=>{let e=Vi(f.statusCode);t(e.code===2?e:{code:2})}),i()}))})})},processEvent(e){if(e.type===`transaction`){let t=e.contexts?.trace?.data?.[`http.response.status_code`];if(typeof t==`number`){if(yT(t,i))return aT&&j.log(`Dropping transaction due to status code`,t),null;e.contexts={...e.contexts,response:{...e.contexts?.response,status_code:t}}}}return e},afterAllSetup(e){aT&&(e.getIntegrationByName(`Http`)&&j.warn("It seems that you have manually added `httpServerSpansIntegration` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),e.getIntegrationByName(`Http.Server`)||j.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."))}}});function fT(e){return e.headers[`next-router-prefetch`]===`1`}function pT(e){let t=bp(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 mT(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(as())return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&pT(r)||n?.(r,e))}function hT(e){let t=gT(e.headers);return t==null?{}:_T(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function gT(e){let t=e[`content-length`];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function _T(e){let t=e[`content-encoding`];return!!t&&t!==`identity`}function vT(e,t,n){let{socket:r}=e,{statusCode:i,statusMessage:a}=t,o={[bl]:i,[Cl]:i,"http.status_text":a?.toUpperCase()};if(r){let{localAddress:e,localPort:t,remoteAddress:n,remotePort:i}=r;o[Bl]=e,o[Hl]=t,o[Ul]=n,o[Gl]=i}return o[Cl]=i,o[`http.status_text`]=(a||``).toUpperCase(),n?.type===wt.HTTP&&n.route!==void 0&&(o[xl]=n.route),o}function yT(e,t){return t.some(t=>{if(typeof t==`number`)return t===e;let[n,r]=t;return e>=n&&e<=r})}var bT=class{emit(e){}enabled(){return!1}},xT=new bT,ST=Symbol.for(`io.opentelemetry.js.api.logs`),CT=globalThis;function wT(e,t,n){return r=>r===e?t:n}var TT=new class{getLogger(e,t,n){return new bT}},ET=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):xT}},DT=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new ET(this,e,t,n)}_getDelegate(){return this._delegate??TT}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},OT=class e{constructor(){this._proxyLoggerProvider=new DT}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return CT[ST]?this.getLoggerProvider():(CT[ST]=wT(1,e,TT),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return CT[ST]?.call(CT,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete CT[ST],this._proxyLoggerProvider=new DT}}.getInstance();function kT(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function AT(e){e.forEach(e=>e.disable())}x();function jT(e){let t=e.tracerProvider||g.getTracerProvider(),n=e.meterProvider||oe.getMeterProvider(),r=e.loggerProvider||OT.getLoggerProvider(),i=e.instrumentations?.flat()??[];return kT(i,t,n,r),()=>{AT(i)}}x();var MT=/^(?: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-]+)*))?$/,NT=/^(?<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-]+)*))?$/,PT={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function FT(e,t,n){if(!IT(e))return f.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,`$1`);let r=UT(e);if(!r)return!1;let i=[],a=LT(r,t,i,n);return a&&!n?.includePrerelease?BT(r,i):a}function IT(e){return typeof e==`string`&&MT.test(e)}function LT(e,t,n,r){if(t.includes(`||`)){let i=t.trim().split(`||`);for(let t of i)if(RT(e,t,n,r))return!0;return!1}if(t.includes(` - `))t=_E(t,r);else if(t.includes(` `)){let i=t.trim().replace(/\s{2,}/g,` `).split(` `);for(let t of i)if(!RT(e,t,n,r))return!1;return!0}return RT(e,t,n,r)}function RT(e,t,n,r){if(t=VT(t,r),t.includes(` `))return LT(e,t,n,r);{let r=WT(t);return n.push(r),zT(e,r)}}function zT(e,t){if(t.invalid)return!1;if(!t.version||GT(t.version))return!0;let n=YT(e.versionSegments||[],t.versionSegments||[]);if(n===0){let r=e.prereleaseSegments||[],i=t.prereleaseSegments||[];n=!r.length&&!i.length?0:!r.length&&i.length?1:r.length&&!i.length?-1:YT(r,i)}return PT[t.op]?.includes(n)}function BT(e,t){return!e.prerelease||t.some(t=>t.prerelease&&t.version===e.version)}function VT(e,t){return e=e.trim(),e=hE(e,t),e=mE(e),e=gE(e,t),e=e.trim(),e}function HT(e){return!e||e.toLowerCase()===`x`||e===`*`}function UT(e){let t=e.match(MT);if(!t){f.error(`Invalid version: ${e}`);return}let n=t.groups.version,r=t.groups.prerelease,i=t.groups.build,a=n.split(`.`),o=r?.split(`.`);return{op:void 0,version:n,versionSegments:a,versionSegmentCount:a.length,prerelease:r,prereleaseSegments:o,prereleaseSegmentCount:o?o.length:0,build:i}}function WT(e){if(!e)return{};let t=e.match(NT);if(!t)return f.error(`Invalid range: ${e}`),{invalid:!0};let n=t.groups.op,r=t.groups.version,i=t.groups.prerelease,a=t.groups.build,o=r.split(`.`),s=i?.split(`.`);return n===`==`&&(n=`=`),{op:n||`=`,version:r,versionSegments:o,versionSegmentCount:o.length,prerelease:i,prereleaseSegments:s,prereleaseSegmentCount:s?s.length:0,build:a}}function GT(e){return e===`*`||e===`x`||e===`X`}function KT(e){let t=parseInt(e,10);return isNaN(t)?e:t}function qT(e,t){if(typeof e==typeof t){if(typeof e==`number`||typeof e==`string`)return[e,t];throw Error(`Version segments can only be strings or numbers`)}return[String(e),String(t)]}function JT(e,t){if(GT(e)||GT(t))return 0;let[n,r]=qT(KT(e),KT(t));return n>r?1:n<r?-1:0}function YT(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=JT(e[n]||`0`,t[n]||`0`);if(r!==0)return r}return 0}var XT=`[a-zA-Z0-9-]`,ZT=`0|[1-9]\\d*`,QT=`\\d*[a-zA-Z-]${XT}*`,$T=`((?:<|>)?=?)`,eE=`(?:${ZT}|${QT})`,tE=`(?:-(${eE}(?:\\.${eE})*))`,nE=`${XT}+`,rE=`(?:\\+(${nE}(?:\\.${nE})*))`,iE=`${ZT}|x|X|\\*`,aE=`[v=\\s]*(${iE})(?:\\.(${iE})(?:\\.(${iE})(?:${tE})?${rE}?)?)?`,oE=`^${$T}\\s*${aE}$`,sE=new RegExp(oE),cE=`^\\s*(${aE})\\s+-\\s+(${aE})\\s*\$`,lE=new RegExp(cE),uE=`^(?:~>?)${aE}$`,dE=new RegExp(uE),fE=`^(?:\\^)${aE}$`,pE=new RegExp(fE);function mE(e){let t=dE;return e.replace(t,(e,t,n,r,i)=>{let a;return a=HT(t)?``:HT(n)?`>=${t}.0.0 <${+t+1}.0.0-0`:HT(r)?`>=${t}.${n}.0 <${t}.${+n+1}.0-0`:i?`>=${t}.${n}.${r}-${i} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${r} <${t}.${+n+1}.0-0`,a})}function hE(e,t){let n=pE,r=t?.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>{let o;return o=HT(t)?``:HT(n)?`>=${t}.0.0${r} <${+t+1}.0.0-0`:HT(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.0${r} <${+t+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i}-${a} <${+t+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i}${r} <${t}.${n}.${+i+1}-0`:`>=${t}.${n}.${i}${r} <${t}.${+n+1}.0-0`:`>=${t}.${n}.${i} <${+t+1}.0.0-0`,o})}function gE(e,t){let n=sE;return e.replace(n,(e,n,r,i,a,o)=>{let s=HT(r),c=s||HT(i),l=c||HT(a),u=l;return n===`=`&&u&&(n=``),o=t?.includePrerelease?`-0`:``,s?e=n===`>`||n===`<`?`<0.0.0-0`:`*`:n&&u?(c&&(i=0),a=0,n===`>`?(n=`>=`,c?(r=+r+1,i=0,a=0):(i=+i+1,a=0)):n===`<=`&&(n=`<`,c?r=+r+1:i=+i+1),n===`<`&&(o=`-0`),e=`${n+r}.${i}.${a}${o}`):c?e=`>=${r}.0.0${o} <${+r+1}.0.0-0`:l&&(e=`>=${r}.${i}.0${o} <${r}.${+i+1}.0-0`),e})}function _E(e,t){let n=lE;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>(n=HT(r)?``:HT(i)?`>=${r}.0.0${t?.includePrerelease?`-0`:``}`:HT(a)?`>=${r}.${i}.0${t?.includePrerelease?`-0`:``}`:o?`>=${n}`:`>=${n}${t?.includePrerelease?`-0`:``}`,c=HT(l)?``:HT(u)?`<${+l+1}.0.0-0`:HT(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t?.includePrerelease?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()))}var vE=console.error.bind(console);function yE(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 bE=(e,t,n)=>{if(!e||!e[t]){vE(`no original function `+String(t)+` to wrap`);return}if(!n){vE(`no wrapper function`),vE(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){vE(`original object and wrapper must be functions`);return}let i=n(r,t);return yE(i,`__original`,r),yE(i,`__unwrap`,()=>{e[t]===i&&yE(e,t,r)}),yE(i,`__wrapped`,!0),yE(e,t,i),i},xE=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{vE(`must provide one or more modules to patch`),vE(Error().stack);return}if(!(t&&Array.isArray(t))){vE(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{bE(e,t,n)})})},SE=(e,t)=>{if(!e||!e[t]){vE(`no function to unwrap.`),vE(Error().stack);return}let n=e[t];if(!n.__unwrap)vE(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},CE=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{vE(`must provide one or more modules to patch`),vE(Error().stack);return}if(!(t&&Array.isArray(t))){vE(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{SE(e,t)})})};x();var wE=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=f.createComponentLogger({namespace:e}),this._tracer=g.getTracer(e,t),this._meter=oe.getMeter(e,t),this._logger=OT.getLogger(e,t),this._updateMetricInstruments()}_wrap=bE;_unwrap=SE;_massWrap=xE;_massUnwrap=CE;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},TE=n(((t,n)=>{var r=e(`path`).sep;n.exports=function(e){var t=e.split(r),n=t.lastIndexOf(`node_modules`);if(n!==-1&&t[n+1]){for(var i=t[n+1][0]===`@`,a=i?t[n+1]+`/`+t[n+2]:t[n+1],o=i?3:2,s=``,c=n+o-1,l=0;l<=c;l++)s+=l===c?t[l]:t[l]+r;for(var u=``,d=t.length-1,f=n+o;f<=d;f++)u+=f===d?t[f]:t[f]+r;return{name:a,basedir:s,path:u}}}})),EE=n(((t,n)=>{var r=e(`path`),i=e(`module`),a=ge()(`require-in-the-middle`),o=TE();n.exports=d,n.exports.Hook=d;var s,c;if(i.isBuiltin)c=i.isBuiltin;else if(i.builtinModules)c=e=>e.startsWith(`node:`)?!0:(s===void 0&&(s=new Set(i.builtinModules)),s.has(e));else throw Error(`'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0`);var l=/([/\\]index)?(\.js)?$/,u=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 n=e.cache[t];return!!(n&&this._kRitmExports in n)}}get(t,n){let r=this._localCache.get(t);if(r!==void 0)return r;if(!n){let n=e.cache[t];return n&&n[this._kRitmExports]}}set(t,n,r){r?this._localCache.set(t,n):t in e.cache?e.cache[t][this._kRitmExports]=n:(a(`non-core module is unexpectedly not in require.cache: "%s"`,t),this._localCache.set(t,n))}};function d(t,n,s){if(!(this instanceof d))return new d(t,n,s);if(typeof t==`function`?(s=t,t=null,n=null):typeof n==`function`&&(s=n,n=null),typeof i._resolveFilename!=`function`){console.error(`Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!`,typeof i._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 u,this._unhooked=!1,this._origRequire=i.prototype.require;let l=this,p=new Set,m=n?n.internals===!0:!1,h=Array.isArray(t);a(`registering require hook`),this._require=i.prototype.require=function(e){return l._unhooked===!0?(a(`ignoring require call - module is soft-unhooked`),l._origRequire.apply(this,arguments)):g.call(this,arguments,!1)},typeof process.getBuiltinModule==`function`&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(e){return l._unhooked===!0?(a(`ignoring process.getBuiltinModule call - module is soft-unhooked`),l._origGetBuiltinModule.apply(this,arguments)):g.call(this,arguments,!0)});function g(n,u){let d=n[0],g=c(d),_;if(g){if(_=d,d.startsWith(`node:`)){let e=d.slice(5);c(e)&&(_=e)}}else if(u)return a(`call to process.getBuiltinModule with unknown built-in id`),l._origGetBuiltinModule.apply(this,n);else try{_=i._resolveFilename(d,this)}catch(e){return a(`Module._resolveFilename("%s") threw %j, calling original Module.require`,d,e.message),l._origRequire.apply(this,n)}let v,y;if(a(`processing %s module require('%s'): %s`,g===!0?`core`:`non-core`,d,_),l._cache.has(_,g)===!0)return a(`returning already patched cached module: %s`,_),l._cache.get(_,g);let b=p.has(_);b===!1&&p.add(_);let ee=u?l._origGetBuiltinModule.apply(this,n):l._origRequire.apply(this,n);if(b===!0)return a(`module is in the process of being patched already - ignoring: %s`,_),ee;if(p.delete(_),g===!0){if(h===!0&&t.includes(_)===!1)return a(`ignoring core module not on whitelist: %s`,_),ee;v=_}else if(h===!0&&t.includes(_)){let e=r.parse(_);v=e.name,y=e.dir}else{let n=o(_);if(n===void 0)return a(`could not parse filename: %s`,_),ee;v=n.name,y=n.basedir;let i=f(n);a(`resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)`,v,d,i,y);let s=!1;if(h){if(!d.startsWith(`.`)&&t.includes(d)&&(v=d,s=!0),!t.includes(v)&&!t.includes(i))return ee;t.includes(i)&&i!==v&&(v=i,s=!0)}if(!s){let t;try{t=e.resolve(v,{paths:[y]})}catch{return a(`could not resolve module: %s`,v),l._cache.set(_,ee,g),ee}if(t!==_){if(m===!0)v=v+r.sep+r.relative(y,_),a(`preparing to process require of internal file: %s`,v);else return a(`ignoring require of non-main module file: %s`,t),l._cache.set(_,ee,g),ee}}}l._cache.set(_,ee,g),a(`calling require hook: %s`,v);let te=s(ee,v,y);return l._cache.set(_,te,g),a(`returning module: %s`,v),te}}d.prototype.unhook=function(){this._unhooked=!0,this._require===i.prototype.require?(i.prototype.require=this._origRequire,a(`require unhook successful`)):a(`require unhook unsuccessful`),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,a(`process.getBuiltinModule unhook successful`)):a(`process.getBuiltinModule unhook unsuccessful`))};function f(e){let t=r.sep===`/`?e.path:e.path.split(r.sep).join(`/`);return r.posix.join(e.name,t).replace(l,``)}})),DE=class{hooks=[];children=new Map},OE=class{_trie=new DE;_counter=0;insert(e){let t=this._trie;for(let n of e.moduleName.split(`/`)){let e=t.children.get(n);e||(e=new DE,t.children.set(n,e)),t=e}t.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:t,fullOnly:n}={}){let r=this._trie,i=[],a=!0;for(let t of e.split(`/`)){let e=r.children.get(t);if(!e){a=!1;break}n||i.push(...e.hooks),r=e}return n&&a&&i.push(...r.hooks),i.length===0?[]:i.length===1?[i[0].hook]:(t&&i.sort((e,t)=>e.insertedId-t.insertedId),i.map(({hook:e})=>e))}},kE=EE(),AE=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(e=>typeof global[e]==`function`),jE=class e{_moduleNameTrie=new OE;static _instance;constructor(){this._initialize()}_initialize(){new kE.Hook(null,{internals:!0},(e,t,n)=>{let r=ME(t),i=this._moduleNameTrie.search(r,{maintainInsertionOrder:!0,fullOnly:n===void 0});for(let{onRequire:r}of i)e=r(e,t,n);return e})}register(e,t){let n={moduleName:e,onRequire:t};return this._moduleNameTrie.insert(n),n}static getInstance(){return AE?new e:this._instance=this._instance??new e}};function ME(e){return Ve.sep===`/`?e:e.split(Ve.sep).join(`/`)}var NE=n((e=>{var t=[],n=new WeakMap,r,i,a,o=new Map,s=[];function c(e,t){return t===`module.exports`&&!Object.hasOwn(e,t)?e.default:e[t]}function l(e,t,r){return n.get(e).write(t,r)}function u(e,t,n){if(!(`value`in n))throw Error(`Getters/setters are not supported for exports property descriptors.`);return l(e,t,n.value)}var d={defineProperty:u,set:l};function f(e,t,n){let i=r.get(e)?.[t];return typeof i!=`function`||i(n)}function p(e,t){if(t===Symbol.toStringTag)return`Module`;let n=i.get(e)[t];if(typeof n==`function`)return n()}function m(e,t,n){if(!(`value`in n))throw Error(`Getters/setters are not supported for exports property descriptors.`);return f(e,t,n.value)}function h(e,n,c,l,u){r??=new WeakMap,i??=new WeakMap,a??={defineProperty:m,get:p,set:f},o.set(e,u),r.set(n,c),i.set(n,l);let d=new Proxy(n,a);t.forEach(t=>t(e,d,u)),s.push([e,d,u])}function g(e,r,i,a,c){if(arguments.length===5){h(e,r,i,a,c);return}let{namespace:l}=r;o.set(e,i),n.set(l,r);let u=new Proxy(l,d);t.forEach(t=>t(e,u,i)),s.push([e,u,i])}var _=[0,10,50],v=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:`Module`}});#e=Object.create(null);#t;#n;#r;constructor(e,t,n,r){if(this.#t=n,t!==void 0)for(let n=0;n<t.length;n++)this.#i(t[n],n,r?.[n]??e)}#i(e,t,n){let r;try{r=c(n,e),this.#t(t,r),this.namespace[e]=r}catch(e){if(!(e instanceof ReferenceError))throw e}r===void 0&&(this.#r??=[]).push(this.#a(e,t,n)),this.#e[e]=t}write(e,t){let n=this.#e[e];return n!==void 0&&(this.#t(n,t),this.#r!==void 0&&(this.#n??=Object.create(null),this.#n[e]=!0),this.namespace[e]=t),!0}#a(e,t,n){return()=>{if(this.#n?.[e]===!0)return!0;try{let r=c(n,e);return r!==void 0&&(this.#t(t,r),this.namespace[e]=r,!0)}catch(e){if(e instanceof ReferenceError)return!1;throw e}}}#o(){let e=this.#r;if(e===void 0)return;let t;for(let n of e)n()!==!0&&(t??=[]).push(n);this.#r=t}flush(){this.#r!==void 0&&queueMicrotask(()=>{this.#o(),this.#s(0)})}#s(e){if(this.#r===void 0)return;if(e>=_.length){this.#r=void 0;return}let t=setTimeout(()=>{this.#o(),this.#s(e+1)},_[e]);t&&typeof t.unref==`function`&&t.unref()}};e.register=g,e.ModuleBinder=v,e.importHooks=t,e.specifiers=o,e.toHook=s})),PE=n(((t,n)=>{var r=e(`path`),i=TE(),{fileURLToPath:a}=e(`url`),{MessageChannel:o}=e(`worker_threads`),{isBuiltin:s}=e(`module`);s||=()=>!0;var{importHooks:c,specifiers:l,toHook:u}=NE();function d(e,t){if(!(process.env.TURBOPACK??process.argv.includes(`--turbo`)))return!1;let n=e.slice(0,e.lastIndexOf(`-`));return t.endsWith(n)}function f(e){c.push(e),u.forEach(([t,n,r])=>e(t,n,r))}function p(e){let t=c.indexOf(e);t>-1&&c.splice(t,1)}function m(e,t,n,r){let i=e(t,n,r);i&&i!==t&&`default`in t&&(t.default=i)}var h;function g(){let{port1:e,port2:t}=new o,n=0,r;h=t=>{n++,e.postMessage(t)},e.on(`message`,()=>{n--,r&&n<=0&&r()}).unref();function i(){let e=setInterval(()=>{},1e3),t=new Promise(e=>{r=e}).then(()=>{clearInterval(e)});return n===0&&r(),t}let a=t;return{registerOptions:{data:{addHookMessagePort:a,include:[]},transferList:[a]},addHookMessagePort:a,waitForAllMessagesAcknowledged:i}}function _(e,t,n){if(!(this instanceof _))return new _(e,t,n);typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null);let o=t?t.internals===!0:!1;h&&Array.isArray(e)&&h(e),this._iitmHook=(t,c,u)=>{let f=t,p=f.startsWith(`node:`),h,g;if(p){let e=t.slice(5);s(e)&&(t=e)}else if(f.startsWith(`file://`)){let e=Error.stackTraceLimit;Error.stackTraceLimit=0;try{h=a(t),t=h}catch{}if(Error.stackTraceLimit=e,h){let e=i(h);e&&(t=e.name,g=e.basedir)}}if(e)for(let i of e)if(h&&i===h)m(n,c,h,void 0);else if(i===t){if(!g)m(n,c,t,g);else if(g.endsWith(l.get(f))||d(l.get(f),g))m(n,c,t,g);else if(o){let e=t+r.sep+r.relative(g,h);m(n,c,e,g)}}else i===u&&m(n,c,u,g);else m(n,c,t,g)},f(this._iitmHook)}_.prototype.unhook=function(){p(this._iitmHook)},n.exports=_,n.exports.Hook=_,n.exports.addHook=f,n.exports.removeHook=p,n.exports.createAddHookMessageChannel=g}));function FE(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function q(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var IE=PE();x();var J=class extends wE{_modules;_hooks=[];_requireInTheMiddleSingleton=jE.getInstance();_enabled=!1;constructor(e,t,n){super(e,t,n);let r=this.init();r&&!Array.isArray(r)&&(r=[r]),this._modules=r||[],this._config.enabled&&this.enable()}_wrap=(e,t,n)=>{if(q(e[t])&&this._unwrap(e,t),Re.isProxy(e)){let r=bE(Object.assign({},e),t,n);return Object.defineProperty(e,t,{value:r}),r}return bE(e,t,n)};_unwrap=(e,t)=>Re.isProxy(e)?Object.defineProperty(e,t,{value:e[t]}):SE(e,t);_massWrap=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{f.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){f.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._wrap(e,t,n)})})};_massUnwrap=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{f.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){f.error(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{this._unwrap(e,t)})})};_warnOnPreloadedModules(){let e=globalThis.require;e?.resolve&&e?.cache&&this._modules.forEach(t=>{let{name:n}=t;try{let t=e.resolve(n);e.cache[t]?.loaded&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let t=Be(Ve.join(e,`package.json`),{encoding:`utf8`}),n=JSON.parse(t).version;return typeof n==`string`?n:void 0}catch{f.warn(`Failed extracting version`,e)}}_onRequire(e,t,n,r){if(!r)return typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for nodejs core module on require hook`,{module:e.name}),e.patch(t)):t;let i=this._extractPackageVersion(r);if(e.moduleVersion=i,e.name===n)return LE(e.supportedVersions,i,e.includePrerelease)&&typeof e.patch==`function`&&(e.moduleExports=t,this._enabled)?(this._diag.debug(`Applying instrumentation patch for module on require hook`,{module:e.name,version:e.moduleVersion,baseDir:r}),e.patch(t,e.moduleVersion)):t;let a=e.files??[],o=Ve.normalize(n);return a.filter(t=>t.name===o&&LE(t.supportedVersions,i,e.includePrerelease)).reduce((t,n)=>(n.moduleExports=t,this._enabled?(this._diag.debug(`Applying instrumentation patch for nodejs module file on require hook`,{module:e.name,version:e.moduleVersion,fileName:n.name,baseDir:r}),n.patch(t,e.moduleVersion)):t),t)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch==`function`&&e.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module on instrumentation enabled`,{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Applying instrumentation patch for nodejs module file on instrumentation enabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.patch(t.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let t=(t,n,r)=>{if(!r&&Ve.isAbsolute(n)){let e=Ve.parse(n);n=e.name,r=e.dir}return this._onRequire(e,t,n,r)},n=(t,n,r)=>this._onRequire(e,t,n,r),r=Ve.isAbsolute(e.name)?new kE.Hook([e.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(e.name,n);this._hooks.push(r);let i=new IE.Hook([e.name],{internals:!0},t);this._hooks.push(i)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch==`function`&&e.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module on instrumentation disabled`,{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let t of e.files)t.moduleExports&&(this._diag.debug(`Removing instrumentation patch for nodejs module file on instrumentation disabled`,{module:e.name,version:e.moduleVersion,fileName:t.name}),t.unpatch(t.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};function LE(e,t,n){return t===void 0?e.includes(`*`):e.some(e=>FT(t,e,{includePrerelease:n}))}var Y=class{files;name;supportedVersions;patch;unpatch;constructor(e,t,n,r,i){this.files=i||[],this.name=e,this.supportedVersions=t,this.patch=n,this.unpatch=r}},RE=kr(process.versions.node),zE=RE.major,BE=RE.minor;x();var VE=RE.major===22&&RE.minor>=12||RE.major===23&&RE.minor>=2||RE.major>=24;function HE(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,i={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(e,t){return as()||!!n.ignoreOutgoingRequests?.(e,Tw(t))},outgoingRequestHook(e,t){n.outgoingRequestHook?.(e,t);let i=t.once;t.once=new Proxy(i,{apply(t,n,i){let[a]=i;if(a!==`response`)return t.apply(n,i);let o=r.active(),s=g.setSpan(o,e);return r.with(s,()=>t.apply(n,i))}})},outgoingResponseHook(e,t){n.outgoingResponseHook?.(e,t)},errorMonitor:xe,http:w};VE?WE(i):GE(i)}var UE;function WE(e){let{[Cw]:t}=zw(e);UE&&E(Cw,UE),Ke(Cw,t),UE=t}function GE(e){Uw(w,e)}var KE=`Http`;Object.assign(HE,{id:`${KE}.sentry`});var qE=G((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},a={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes},o={breadcrumbs:e.breadcrumbs,propagateTraceInOutgoingRequests:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests,spans:t},s=lT(i),c=dT(a);return{name:KE,setup(e){r&&c.setup(e)},setupOnce(){s.setupOnce(),HE(o)},processEvent(e){return c.processEvent(e)}}}),JE=`sentry-trace`,YE=`baggage`,XE=`traceparent`;function ZE(e,t,n){let r=aD(e.origin,e.path),{tracePropagationTargets:i,propagateTraceparent:a}=F()?.getOptions()||{};if(!Fp(r,i,t))return;let o=n&&gs(n)&&z()?void 0:n,s=o?H(o,()=>jp({propagateTraceparent:a})):jp({propagateTraceparent:a});if(!s)return;let{"sentry-trace":c,baggage:l,traceparent:u}=s,d=Array.isArray(e.headers)?QE(e.headers):$E(e.headers);if(tD(d,JE),tD(d,YE),a&&tD(d,XE),nD(d,JE)===-1){c&&d.push(JE,c),u&&nD(d,`traceparent`)===-1&&d.push(`traceparent`,u);let e=nD(d,YE);if(l&&e===-1)d.push(YE,l);else if(l){let t=d[e+1],n=ca(t,l);n&&(d[e+1]=n)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...d):e.headers=eD(d)}function QE(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 $E(e){let t=e.split(`\r
19
- `),n=[];for(let e of t)try{let t=e.indexOf(`:`);if(t===-1)continue;let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&n.push(r,i)}catch{j.warn(`Failed to convert string request header to array header: ${e}`)}return n}function eD(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
20
- `).concat(`\r
21
- `):``}function tD(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===YE&&i){let t=ca(e[r+1],i);t&&(e[n+1]=t)}e.splice(r,2),r-=2}}function nD(e,t){return e.findIndex((e,n)=>n%2==0&&e===t)}function rD(e,t){let n=iD(e),r=t.statusCode,i=bx(r);Zp({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function iD(e){try{let t=yp(aD(e.origin,e.path)),n={url:xp(t),"http.method":e.method||`GET`};return t.search&&(n[`http.query`]=sp(t.search)),t.hash&&(n[`http.fragment`]=t.hash),n}catch{return{}}}function aD(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 oD=`http.request.method_original`,sD=[],cD=new WeakMap,lD=new WeakMap,uD=new Sx(100);function dD(e={}){sD.length||(pD(`undici:request:create`,t=>hD(e,t)),pD(`undici:client:sendHeaders`,t=>gD(e,t)),pD(`undici:request:headers`,t=>_D(e,t)),pD(`undici:request:trailers`,e=>vD(e)),pD(`undici:request:error`,e=>yD(e)))}function fD(e,t){try{return e()}catch(e){t(e);return}}function pD(e,t){let[n=0,r=0]=process.version.replace(`v`,``).split(`.`).map(e=>Number(e));n>18||n===18&&r>=19?sD.push(at.subscribe?.(e,t)):sD.push(at.channel(e).subscribe(t))}function mD(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
22
- `);for(let e of n){if(!e)continue;let n=e.indexOf(`:`);if(n===-1)continue;let r=e.substring(0,n).toLowerCase(),i=e.substring(n+1).trim(),a=t.get(r);a&&Array.isArray(a)?a.push(i):a?t.set(r,[a,i]):t.set(r,i)}}return t}function hD(e,{request:t}){let n=xD(t.origin,t.path),r=fD(()=>!!e.ignoreOutgoingRequests?.(n),e=>e&&aT&&j.error(`caught ignoreOutgoingRequests error: `,e)),i=as()||!!r;if(lD.set(t,i),!e.spans){e.tracePropagation!==!1&&!i&&ZE(t,uD);return}if(t.method===`CONNECT`||r)return;let a;try{a=new et(t.path,t.origin)}catch(e){aT&&j.warn(`could not determine url.full:`,e);return}let o=a.protocol.replace(`:`,``),s=bD(t.method),c={[yl]:s,[oD]:t.method,[lu]:op(a.toString()),[uu]:a.pathname,[du]:sp(a.search),[fu]:o,[L]:`auto.http.otel.node_fetch`};if(n.startsWith(`data:`)){let e=Sp(n);c[`http.url`]=e,c[lu]=e,c[Ni]=`${t.method||`GET`} ${e}`}let l={https:`443`,http:`80`},u=a.hostname,d=a.port||l[o];c[au]=u,d&&!isNaN(Number(d))&&(c[ou]=Number(d));let f=mD(t).get(`user-agent`);f&&(c[pu]=Array.isArray(f)?f[f.length-1]:f);let p=F(),m=V({name:s===`_OTHER`?`HTTP`:s,kind:K.CLIENT,attributes:c,onlyIfParent:!p||!Uo(p)});fD(()=>e.requestHook?.(m,t),e=>e&&aT&&j.error(`caught requestHook error: `,e)),ZE(t,uD,m),cD.set(t,m)}function gD(e,{request:t,socket:n}){let r=cD.get(t);if(!r)return;let{remoteAddress:i,remotePort:a}=n,o={[Il]:i,[Ll]:a};if(e.headersToSpanAttributes?.requestHeaders){let n=new Set(e.headersToSpanAttributes.requestHeaders.map(e=>e.toLowerCase())),r=mD(t);for(let[e,t]of r.entries())if(n.has(e)){let n=Array.isArray(t)?t:[t];o[`http.request.header.${e}`]=n}}r.setAttributes(o)}function _D(e,{request:t,response:n}){e.breadcrumbs!==!1&&!lD.get(t)&&rD(t,n);let r=cD.get(t);if(!r)return;let i={[bl]:n.statusCode};if(fD(()=>e.responseHook?.(r,{request:t,response:n}),e=>e&&aT&&j.error(`caught responseHook error: `,e)),e.headersToSpanAttributes?.responseHeaders){let t=new Set;e.headersToSpanAttributes?.responseHeaders.forEach(e=>t.add(e.toLowerCase()));for(let e=0;e<n.headers.length;e+=2){let r=n.headers[e],a=n.headers[e+1];if(r===void 0||a===void 0)continue;let o=r.toString().toLowerCase(),s=a;if(t.has(o)){let e=`http.response.header.${o}`;Object.prototype.hasOwnProperty.call(i,e)?i[e].push(s.toString()):i[e]=[s.toString()]}}}r.setAttributes(i),n.statusCode>=400&&r.setStatus(Vi(n.statusCode))}function vD({request:e}){let t=cD.get(e);t&&(t.end(),cD.delete(e))}function yD({request:e,error:t}){let n=cD.get(e);n&&(n.setStatus({code:2,message:t.message}),n.end(),cD.delete(e))}function bD(e){return e.toUpperCase()in{CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0}?e.toUpperCase():`_OTHER`}function xD(e,t=`/`){let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}var SD=G(((e={})=>({name:`NodeFetch`,setupOnce(){dD(e)}}))),CD=`exception`,wD=Symbol.for(`nodejs.util.inspect.custom`);function TD(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function ED(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}x(),re();var DD=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:b.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=le.now(),this._performanceOffset=t-(this._performanceStartTime+le.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return f.warn(`Invalid attribute key: ${e}`),this;if(!bt(t))return f.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return f.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&f.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),ce(t)&&(ce(n)||(n=t),t=void 0);let i=vt(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&f.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=vt(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===b.UNSET||this.status.code===b.OK)return this;let t={code:e.code};return e.code===b.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&f.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){f.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=se(this.startTime,this.endTime),this._duration[0]<0&&(f.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&f.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&f.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=le.now())return de(e+this._performanceOffset);if(typeof e==`number`)return _e(e);if(e instanceof Date)return _e(e.getTime());if(fe(e))return e;if(this._startTimeProvided)return _e(Date.now());let t=le.now()-this._performanceStartTime;return he(this.startTime,_e(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[_]=e:e&&(e.code?n[ae]=e.code.toString():e.name&&(n[ae]=e.name),e.message&&(n[_]=e.message),e.stack&&(n[ee]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(CD,n,t):f.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);f.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(f.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[wD](e,t,n){return ED(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:TD(this.resource)}},e,t,n)}},OD;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(OD||={});var kD=`otel.span.parent.origin`,AD=`otel.span.sampling_result`,jD=`otel.sdk.span.live`,MD=`otel.sdk.span.started`,ND=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(MD,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(jD,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=FD(t);if(this.startedSpans.add(1,{[kD]:PD(e),[AD]:n}),t===OD.NOT_RECORD)return()=>{};let r={[AD]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function PD(e){return e?e.isRemote?`remote`:`local`:`none`}function FD(e){switch(e){case OD.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case OD.RECORD:return`RECORD_ONLY`;case OD.NOT_RECORD:return`DROP`}}var ID=`2.11.0`;x();var LD=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,ID);this._tracerMetrics=new ND(n)}startSpan(e,t={},n=r.active()){t.root&&(n=g.deleteSpan(n));let i=g.getSpan(n);if(me(n))return f.debug(`Instrumentation suppressed, returning Noop Span`),g.wrapSpanContext(u);let a=i?.spanContext(),o=this._idGenerator.generateSpanId(),s,l,d;!a||!g.isSpanContextValid(a)?l=this._idGenerator.generateTraceId():(l=a.traceId,d=a.traceState,s=a);let m=t.kind??y.INTERNAL,h=(t.links??[]).map(e=>({context:e.context,attributes:vt(e.attributes)})),_=vt(t.attributes),v=this._sampler.shouldSample(n,l,e,m,_,h),b=this._tracerMetrics.startSpan(a,v.decision);d=v.traceState??d;let ee=v.decision===c.RECORD_AND_SAMPLED?p.SAMPLED:p.NONE,te={traceId:l,spanId:o,traceFlags:ee,traceState:d};if(v.decision===c.NOT_RECORD)return f.debug(`Recording is off, propagating context in a non-recording span`),g.wrapSpanContext(te);let ne=vt(Object.assign(_,v.attributes));return new DD({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:te,name:e,kind:m,links:h,parentSpanContext:s,attributes:ne,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:b})}startActiveSpan(e,t,n,i){let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=i);let c=o??r.active(),l=this.startSpan(e,a,c),u=g.setSpan(c,l);return r.with(u,s,void 0,l)}[wD](e,t,n){return ED(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:TD(this._resource)},spanLimits:this._spanLimits},e,t,n)}},RD=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{ue(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},zD=class{shouldSample(){return{decision:OD.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},BD=class{shouldSample(){return{decision:OD.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};x();var VD=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(ue(Error(`ParentBasedSampler must have a root sampler configured`)),new BD),this._remoteParentSampled=e.remoteParentSampled??new BD,this._remoteParentNotSampled=e.remoteParentNotSampled??new zD,this._localParentSampled=e.localParentSampled??new BD,this._localParentNotSampled=e.localParentNotSampled??new zD}shouldSample(e,t,n,r,i,o){let s=g.getSpanContext(e);return!s||!a(s)?this._root.shouldSample(e,t,n,r,i,o):s.isRemote?s.traceFlags&p.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,o):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,o):s.traceFlags&p.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,o):this._localParentNotSampled.shouldSample(e,t,n,r,i,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},HD=8,UD=16,WD=class{generateTraceId=KD(UD);generateSpanId=KD(HD)},GD=Buffer.allocUnsafe(UD);function KD(e){return function(){for(let t=0;t<e/4;t++)GD.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(GD[t]>0);t++)t===e-1&&(GD[e-1]=1);return GD.toString(`hex`,0,e)}}x();var qD;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(qD||={});var JD=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??ie();let t=e.spanProcessors??[];this._activeSpanProcessor=new RD(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new VD({root:new BD}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new WD,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return i()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new LD({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){let t=e?.timeoutMillis??this._forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${t} ms`)),r=qD.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==qD.timeout&&(r=qD.resolved,n(r))}).catch(e=>{clearTimeout(i),r=qD.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==qD.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[wD](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return ED(`TracerProvider`,{resource:{attributes:TD(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};x();var YD=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:s(t)&&this._accumulate(t)<this._upperBound?OD.RECORD_AND_SAMPLED:OD.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};x();var XD;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(XD||={});var ZD=1;function QD(){return{sampler:$D(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:v(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:v(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:v(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:v(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:v(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:v(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:v(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:v(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function $D(){let e=h(`OTEL_TRACES_SAMPLER`)??XD.ParentBasedAlwaysOn;switch(e){case XD.AlwaysOn:return new BD;case XD.AlwaysOff:return new zD;case XD.ParentBasedAlwaysOn:return new VD({root:new BD});case XD.ParentBasedAlwaysOff:return new VD({root:new zD});case XD.TraceIdRatio:return new YD(eO());case XD.ParentBasedTraceIdRatio:return new VD({root:new YD(eO())});default:return f.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${XD.ParentBasedAlwaysOn}".`),new VD({root:new BD})}}function eO(){let e=v(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(f.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${ZD}.`),ZD):e<0||e>1?(f.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${ZD}.`),ZD):e}function tO(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??v(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??v(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??v(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??v(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}var nO=class extends JD{constructor(e={}){let t=Ht({},QD(),tO(e));delete t.generalLimits,super(t)}};x();var rO=`sentry.parentIsRemote`,iO=`sentry.graphql.operation`;function aO(e){if(`parentSpanId`in e)return e.parentSpanId;if(`parentSpanContext`in e)return e.parentSpanContext?.spanId}function oO(e){return M(e.attributes)}function sO(e){return typeof e.kind==`number`}function cO(e){return!!e.status}function lO(e){return!!e.name}function uO(e){if(!oO(e))return{};let t=e.attributes[`url.full`]||e.attributes[`http.url`],n={url:t,"http.method":e.attributes[`http.request.method`]||e.attributes[`http.method`]};!n[`http.method`]&&n.url&&(n[`http.method`]=`GET`);try{if(typeof t==`string`){let e=yp(t);n.url=xp(e);let r=sp(e.search);r&&(n[`http.query`]=r),e.hash&&(n[`http.fragment`]=e.hash)}}catch{}return n}function dO(e){return sO(e)?e.kind:y.INTERNAL}var fO=`sentry-trace`,pO=`baggage`,mO=`sentry.dsc`,hO=`sentry.sampled_not_recording`,gO=`sentry.url`,_O=`sentry.sample_rand`,vO=`sentry.sample_rate`,yO=`sentry.ignored`,bO=`sentry.segment_ignored`,xO=o(`sentry_scopes`),SO=o(`sentry_fork_isolation_scope`),CO=o(`sentry_fork_set_scope`),wO=o(`sentry_fork_set_isolation_scope`),TO=`_scopeContext`;function EO(e){return e.getValue(xO)}function DO(e,t){return e.setValue(xO,t)}function OO(e,t){Hn(e,TO,Wr(t))}function kO(e){return Gr(e[TO])}function AO(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(hO)===`1`:!1;if(t===p.SAMPLED)return!0;if(r)return!1;let i=n?n.get(mO):void 0,a=i?ra(i):void 0;if(a?.sampled===`true`)return!0;if(a?.sampled===`false`)return!1}function jO(e,t){let n=e.spanContext(),r=Xa(e),i=AO(n);if(i!==void 0)return i;if(gs(r))return!1;if(eo(t?.getOptions())&&!n.isRemote&&Va(r))return Ha(e)}function MO(e,t,n){let r=t[`http.request.method`]||t[`http.method`];if(r)return FO({attributes:t,name:e,kind:n},r);let i=t[`db.system.name`]||t[`db.system`],a=typeof t[`sentry.op`]==`string`&&t[`sentry.op`].startsWith(`cache.`);if(i&&!a)return PO({attributes:t,name:e});let o=t[`sentry.source`]===`custom`?`custom`:`route`;if(t[`rpc.service`])return{...RO(e,t,`route`),op:`rpc`};if(t[`messaging.system`])return{...RO(e,t,o),op:`message`};let s=t[Hc];return s?{...RO(e,t,o),op:s.toString()}:{op:void 0,description:e,source:`custom`}}function NO(e){let t,n;if(oO(e))t=e.attributes,n=lO(e)?e.name:`<unknown>`;else{let r=typeof e.spanContext==`function`?R(e):void 0;t=r?.data||{},n=lO(e)?e.name:r?.description||`<unknown>`}let r=dO(e);return MO(n,t,r)}function PO({attributes:e,name:t}){let n=e[Ni];if(typeof n==`string`)return{op:`db`,description:n,source:e[`sentry.source`]||`custom`};if(e[`sentry.source`]===`custom`)return{op:`db`,description:t,source:`custom`};let r=e[Mc];return{op:`db`,description:r?r.toString():t,source:`task`}}function FO({name:e,kind:t,attributes:n},r){let i=[`http`];switch(t){case y.CLIENT:i.push(`client`);break;case y.SERVER:i.push(`server`)}n[`sentry.http.prefetch`]&&i.push(`prefetch`);let{urlPath:a,url:o,query:s,fragment:c,hasRoute:l}=LO(n,t);if(!a)return{...RO(e,n),op:i.join(`.`)};let u=n[iO],d=`${r} ${a}`,f=u?`${d} (${IO(u)})`:d,p=l||a===`/`?`route`:`url`,m={};o&&(m.url=op(o));let h=sp(s);h&&(m[`http.query`]=h.slice(1)),c&&(m[`http.fragment`]=c.slice(1));let g=t===y.CLIENT||t===y.SERVER,_=!`${n[`sentry.origin`]||`manual`}`.startsWith(`auto`),v=n[Si]===`custom`,b=n[Ni],{description:ee,source:te}=!v&&b==null&&(g||!_)?{description:f,source:p}:RO(e,n);return{op:i.join(`.`),description:ee,source:te,data:m}}function IO(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 LO(e,t){let n=e[wl],r=e[`http.url`]||e[`url.full`],i=e[xl],a=typeof r==`string`?yp(r):void 0,o=a?xp(a):void 0,s=a?.search||void 0,c=a?.hash||void 0;return typeof i==`string`?{urlPath:i,url:o,query:s,fragment:c,hasRoute:!0}:t===y.SERVER&&typeof n==`string`?{urlPath:bp(n),url:o,query:s,fragment:c,hasRoute:!1}:a?{urlPath:o,url:o,query:s,fragment:c,hasRoute:!1}:typeof n==`string`?{urlPath:bp(n),url:o,query:s,fragment:c,hasRoute:!1}:{urlPath:void 0,url:o,query:s,fragment:c,hasRoute:!1}}function RO(e,t,n=`custom`){let r=t[`sentry.source`]||n,i=t[Ni];return i&&typeof i==`string`?{description:i,source:r}:{description:e,source:r}}function zO(e){e.on(`createDsc`,(t,n)=>{if(!n)return;let r=R(n),i=r.data[Si],a=jO(n,e);if(a===!1)delete t.transaction;else if(r.description){let{description:e}=NO(n);i!==`url`&&e&&(t.transaction=e)}eo()&&(t.sampled=a==null?void 0:String(a))})}function BO(){return g.getActiveSpan()}var VO=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,HO=class e{constructor(){this._internalState=new Map}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reverse().map(e=>`${e}=${this._internalState.get(e)}`).join(`,`)}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};function UO({dsc:e,sampled:t}){let n=e?ia(e):void 0,r=new HO,i=n?r.set(mO,n):r;return t===!1?i.set(hO,`1`):i}var WO=new Set;function GO(){return Array.from(WO)}function KO(e){WO.add(e)}var qO=class extends _t{constructor(){super(),KO(`SentryPropagator`),this._urlMatchesTargetsMap=new Sx(100)}inject(e,t,n){if(me(e)){VO&&j.log(`[Tracing] Not injecting trace data for url because tracing is suppressed.`);return}let r=g.getSpan(e),i=r&&ek(r),{tracePropagationTargets:a,propagateTraceparent:o}=F()?.getOptions()||{};if(!Fp(i,a,this._urlMatchesTargetsMap)){VO&&j.log(`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`,i);return}let s=QO(t),c=$O(t),l=d.getBaggage(e)||d.createBaggage({}),{dynamicSamplingContext:u,traceId:f,spanId:p,sampled:m}=JO(e);if(s){let e=aa(s);e&&Object.entries(e).forEach(([e,t])=>{(c||!e.startsWith(`sentry-`))&&(l=l.setEntry(e,{value:t}))})}!c&&u&&(l=Object.entries(u).reduce((e,[t,n])=>n?e.setEntry(`${na}${t}`,{value:n}):e,l)),!c&&f&&f!==`00000000000000000000000000000000`&&(n.set(t,fO,wa(f,p,m)),o&&n.set(t,`traceparent`,Ta(f,p,m))),super.inject(d.setBaggage(e,l),t,n)}extract(e,t,n){let r=n.get(t,fO),i=n.get(t,pO);return ZO(YO(e,{sentryTrace:r?Array.isArray(r)?r[0]:r:void 0,baggage:i}))}fields(){return[fO,pO,`traceparent`]}};function JO(e,t={}){let n=g.getSpan(e);if(n?.spanContext().isRemote){let e=n.spanContext();return{dynamicSamplingContext:ho(n),traceId:e.traceId,spanId:void 0,sampled:AO(e)}}if(n){let e=n.spanContext();return{dynamicSamplingContext:ho(n),traceId:e.traceId,spanId:e.spanId,sampled:jO(n,t.client)}}let r=t.scope||EO(e)?.scope||N(),i=t.client||F(),a=r.getPropagationContext();return{dynamicSamplingContext:i?mo(i,r):void 0,traceId:a.traceId,spanId:a.propagationSpanId,sampled:a.sampled}}function YO(e,{sentryTrace:t,baggage:n}){let{traceId:r,parentSpanId:i,sampled:a,dsc:o}=Ca(t,n),s=F(),c=ra(n);if(!i||s&&!Da(s,c?.org_id))return e;let l=tk({traceId:r,spanId:i,sampled:a,dsc:o});return g.setSpanContext(e,l)}function XO(e,t,n){let i=ZO(YO(e,t));return r.with(i,n)}function ZO(e){let t=EO(e);return DO(e,{scope:t?t.scope:N().clone(),isolationScope:t?t.isolationScope:P()})}function QO(e){try{let t=e[pO];return Array.isArray(t)?t.join(`,`):t}catch{return}}function $O(e){try{return e[fO]}catch{return}}function ek(e){let t=R(e).data,n=t[`http.url`]||t[`url.full`];if(typeof n==`string`)return n;let r=e.spanContext().traceState?.get(gO);if(r)return r}function tk({spanId:e,traceId:t,sampled:n,dsc:r}){let i=UO({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?p.SAMPLED:p.NONE,traceState:i}}function nk(e,t,n){let i=sk(),{name:a,parentSpan:o}=e;return gk(o)(()=>{let o=dk(e.scope,e.forceTransaction),s=e.onlyIfParent&&!g.getSpan(o),c=s?pe(o):o;s&&F()?.recordDroppedEvent(`no_parent_span`,`span`);let l=ck(e);if(!eo()){let e=me(c)?c:pe(c);return r.with(e,()=>i.startActiveSpan(a,l,e,e=>(uk(e),r.with(o,()=>Xo(()=>t(e),()=>{R(e).status===void 0&&e.setStatus({code:b.ERROR})},n?()=>e.end():void 0)))))}return i.startActiveSpan(a,l,c,e=>(uk(e),Xo(()=>t(e),()=>{R(e).status===void 0&&e.setStatus({code:b.ERROR})},n?()=>e.end():void 0)))})}function rk(e,t){return nk(e,t,!0)}function ik(e,t){return nk(e,e=>t(e,()=>e.end()),!1)}function ak(e){let t=sk(),{name:n,parentSpan:r}=e;return gk(r)(()=>{let r=dk(e.scope,e.forceTransaction),i=e.onlyIfParent&&!g.getSpan(r),a=i?pe(r):r;i&&F()?.recordDroppedEvent(`no_parent_span`,`span`);let o=ck(e);eo()||(a=me(a)?a:pe(a));let s=t.startSpan(n,o,a);return uk(s),s})}function ok(e,t){let n=e?g.setSpan(r.active(),e):g.deleteSpan(r.active());return r.with(n,()=>t(N()))}function sk(){return F()?.tracer||g.getTracer(`@sentry/opentelemetry`,`10.75.3`)}function ck(e){let{startTime:t,attributes:n,kind:r,op:i,links:a}=e,o=typeof t==`number`?lk(t):t;return{attributes:i?{[I]:i,...n}:n,kind:r,links:a,startTime:o}}function lk(e){return e<9999999999?e*1e3:e}function uk(e){let t=e.end.bind(e);e.end=e=>t(typeof e==`number`?lk(e):e)}function dk(e,t){let n=fk(e),r=g.getSpan(n);if(!r||!t)return n;let i=g.deleteSpan(n),{spanId:a,traceId:o}=r.spanContext(),s=AO(r.spanContext()),c=UO({dsc:ho(Xa(r)),sampled:s}),l={traceId:o,spanId:a,isRemote:!0,traceFlags:s?p.SAMPLED:p.NONE,traceState:c};return g.setSpanContext(i,l)}function fk(e){if(e){let t=kO(e);if(t)return t}return r.active()}function pk(e,t){return XO(r.active(),e,t)}function mk(e){let t=Hr(),n={traceId:t,spanId:Ur(),isRemote:!0,traceFlags:p.NONE},i=g.setSpanContext(r.active(),n);return r.with(i,()=>(N().setPropagationContext({traceId:t,sampleRand:Zn()}),e()))}function hk(e,t){let n=kO(t),r=n&&g.getSpan(n),i=r?Aa(r):xi(t);return[r?ho(r):mo(e,t),i]}function gk(e){return e===void 0?e=>e():t=>ok(e,t)}function _k(e){let t=pe(r.active());return r.with(t,e)}function vk(e){let t=e?kO(e):r.active();return t?me(t):!1}function yk(e){e.on(`preprocessEvent`,e=>{let t=BO();return!t||e.type===`transaction`?void 0:(e.contexts={trace:Aa(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ho(Xa(t)),...e.sdkProcessingMetadata},e)})}function bk(e,t){let n=g.getSpan(e),r;if(n?.spanContext().traceState?.get(`sentry.ignored`)===`1`){let n=g.deleteSpan(e),i=g.getSpan(t);r=i?g.setSpan(n,i):n}else r=e;let i=EO(r),a=i?.scope||N(),o=i?.isolationScope||P(),s=r.getValue(SO)===!0,c=r.getValue(CO),l=r.getValue(wO),u=c||a.clone(),d={scope:u,isolationScope:l||(s?o.clone():o)},f=DO(r,d).deleteValue(SO).deleteValue(CO).deleteValue(wO);return OO(u,f),f}function xk(e){let t=new Map;for(let n of e)Ck(t,n);return Array.from(t,function([e,t]){return t})}function Sk(e){return e.attributes[rO]===!0?void 0:aO(e)}function Ck(e,t){let n=t.spanContext().spanId,r=Sk(t);if(!r){Tk(e,{id:n,span:t,children:[]});return}let i=wk(e,r),a=Tk(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(a)}function wk(e,t){return e.get(t)||Tk(e,{id:t,children:[]})}function Tk(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 Ek={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`},Dk=e=>Object.values(Ek).includes(e);function Ok(e){let t=oO(e)?e.attributes:{},n=cO(e)?e.status:void 0;if(n){if(n.code===b.OK)return{code:1};if(n.code===b.ERROR){if(n.message===void 0){let e=kk(t);if(e)return e}return n.message&&Dk(n.message)?{code:2,message:n.message}:{code:2,message:`internal_error`}}}return kk(t)||(n?.code===b.UNSET?{code:1}:{code:2,message:`unknown_error`})}function kk(e){let t=e[`http.response.status_code`]||e[`http.status_code`],n=e[ql],r=typeof t==`number`?t:typeof t==`string`?parseInt(t):void 0;if(typeof r==`number`)return Vi(r);if(typeof n==`string`)return{code:2,message:Ek[n]||`unknown_error`}}var Ak=1e3,jk=300,Mk=1e4,Nk=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||jk,this._finishedSpanBuckets=Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Qn()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Sx(Mk),this._debouncedFlush=_s(this.flush.bind(this),1,{maxWait:100})}export(e){let t=Math.floor(Qn()/1e3);if(this._lastCleanupTimestampInS!==t){let e=0;this._finishedSpanBuckets.forEach((n,r)=>{n&&n.timestampInS<=t-this._finishedSpanBucketSize&&(e+=n.spans.size,this._finishedSpanBuckets[r]=void 0)}),e>0&&VO&&j.log(`SpanExporter dropped ${e} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=t}let n=t%this._finishedSpanBucketSize,r=this._finishedSpanBuckets[n]||{timestampInS:t,spans:new Set};this._finishedSpanBuckets[n]=r,r.spans.add(e),this._spansToBucketEntry.set(e,r);let i=Sk(e);(!i||this._sentSpans.get(i))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(e=>e?Array.from(e.spans):[]),t=this._maybeSend(e),n=t.size,r=e.length-n;VO&&j.log(`SpanExporter exported ${n} spans, ${r} spans are waiting for their parent spans to finish`);for(let e of t){this._sentSpans.set(e.spanContext().spanId,1);let t=this._spansToBucketEntry.get(e);t&&t.spans.delete(e)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let t=xk(e),n=new Set,r=this._getCompletedRootNodes(t);for(let e of r){let t=e.span;n.add(t);let r=Fk(t);if(e.parentNode&&this._sentSpans.get(e.parentNode.id)){let e=r.contexts?.trace?.data;e&&(e[`sentry.parent_span_already_sent`]=!0)}let i=r.spans||[],a=!1;for(let t of e.children)Ik(t,i,n)&&(a=!0);r.spans=i.length>Ak?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,Ak):i,a&&(r.sdkProcessingMetadata={...r.sdkProcessingMetadata,hasGenAiSpans:!0});let o=Bo(t.events);o&&(r.measurements=o),Gu(r)}return n}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||!!this._sentSpans.get(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(e=>this._nodeIsCompletedRootNodeOrHasSentParent(e))}};function Pk(e){let t=e.attributes;return{origin:t[L],op:t[I],source:t[Si]}}function Fk(e){let{op:t,description:n,data:r,origin:i=`manual`,source:a}=Lk(e),o=Yi(e),s=e.attributes[Ci],c={[Si]:a,[Ci]:s,[I]:t,[L]:i,...r,...Rk(e.attributes)},{links:l}=e,{traceId:u,spanId:d}=e.spanContext(),f={parent_span_id:aO(e),span_id:d,trace_id:u,data:c,origin:i,op:t,status:Ua(Ok(e)),links:Na(l)},p=c[bl],m=typeof p==`number`?{response:{status_code:p}}:void 0;return{contexts:{trace:f,otel:{resource:e.resource.attributes},...m},spans:[],start_timestamp:Fa(e.startTime),timestamp:Fa(e.endTime),transaction:n,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:o.scope,capturedSpanIsolationScope:o.isolationScope,sampleRate:s,dynamicSamplingContext:ho(e)},...a&&{transaction_info:{source:a}}}}function Ik(e,t,n){let r=e.span;if(r&&n.add(r),!r){let r=!1;return e.children.forEach(e=>{Ik(e,t,n)&&(r=!0)}),r}let i=r.spanContext().spanId,a=r.spanContext().traceId,o=aO(r),{attributes:s,startTime:c,endTime:l,links:u}=r,{op:d,description:f,data:p,origin:m=`manual`}=Lk(r),h={[L]:m,[I]:d,...Rk(s),...p},g=Ok(r),_={span_id:i,trace_id:a,data:h,description:f,parent_span_id:o,start_timestamp:Fa(c),timestamp:Fa(l)||void 0,status:Ua(g),op:d,origin:m,measurements:Bo(r.events),links:Na(u)};t.push(_);let v=!!d?.startsWith(`gen_ai.`);return e.children.forEach(e=>{Ik(e,t,n)&&(v=!0)}),v}function Lk(e){let{op:t,source:n,origin:r}=Pk(e),{op:i,description:a,source:o,data:s}=NO(e);return{op:t||i,description:a,source:n||o,origin:r,data:{...s,...zk(e)}}}function Rk(e){let t={...e};return delete t[Ci],delete t[rO],delete t[Ni],t}function zk(e){let t=e.attributes,n={};e.kind!==y.INTERNAL&&(n[`otel.kind`]=y[e.kind]);let r=t[Cl];r&&(n[bl]=r);let i=uO(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 Bk(e,t){let n=e.attributes??{},r=t?.spanKind??K.INTERNAL,{op:i,description:a,source:o,data:s}=MO(e.name,n,r);e.name=a,gu(e,{[I]:i,[Si]:o,[$l]:`manual`,...s}),r!==K.INTERNAL&&gu(e,{"otel.kind":Yp(r)})}var Vk=class{constructor(e){this._unsubscribePreprocessSpan=void 0,KO(`SentrySpanProcessor`),this._exporter=new Nk(e),this._client=e?.client??F(),this._client&&Uo(this._client)&&(this._unsubscribePreprocessSpan=this._client.on(`preprocessSpan`,Bk))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(e,t){let n=g.getSpan(t),r=EO(t);n&&!n.spanContext().isRemote&&Ja(n,e),n?.spanContext().isRemote&&e.setAttribute(rO,!0),t===te&&(r={scope:Zr(),isolationScope:Qr()}),r&&Ji(e,r.scope,r.isolationScope),Lo(e),this._client?.emit(`spanStart`,e)}onEnd(e){Ro(e),this._client?.emit(`spanEnd`,e),this._client&&Uo(this._client)?this._client.emit(`afterSpanEnd`,e):this._exporter.export(e)}},Hk=class{constructor(e){this._client=e,this._isSpanStreaming=Uo(e),KO(`SentrySampler`)}shouldSample(e,t,n,r,i,a){let o=this._client.getOptions(),{ignoreSpans:s}=o,c=Kk(e),l=c?.spanContext();if(!eo(o))return Wk({decision:void 0,context:e,spanAttributes:i});let u=i[`http.method`]||i[`http.request.method`];if(r===y.CLIENT&&u&&(!c||l?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent(`no_parent_span`,`span`),Wk({decision:void 0,context:e,spanAttributes:i});let d=c?Uk(c,t,n):void 0;if(c&&!l?.isRemote){if(this._isSpanStreaming){if(d&&s?.length){let{description:t,op:a}=MO(n,i,r);if(no({description:t,op:i[`sentry.op`]??a,attributes:i},s))return this._client.recordDroppedEvent(`ignored`,`span`),Wk({decision:OD.NOT_RECORD,context:e,spanAttributes:i,ignoredChildSpan:!0})}if(!d){let e=l?.traceState?.get(bO)===`1`;this._client.recordDroppedEvent(e?`ignored`:`sample_rate`,`span`)}}return Wk({decision:d?OD.RECORD_AND_SAMPLED:OD.NOT_RECORD,context:e,spanAttributes:i})}let{description:f,data:p,op:m}=MO(n,i,r),h={...p,...i};if(m&&(h[I]=m),this._isSpanStreaming&&s?.length&&no({description:f,op:h[`sentry.op`]??m,attributes:h},s))return this._client.recordDroppedEvent(`ignored`,`span`),Wk({decision:OD.NOT_RECORD,context:e,spanAttributes:i,ignoredSegmentSpan:!0});let g={decision:!0};if(this._client.emit(`beforeSampling`,{spanAttributes:h,spanName:f,parentSampled:d,parentContext:l},g),!g.decision)return Wk({decision:void 0,context:e,spanAttributes:i});let{isolationScope:_}=EO(e)??{},v=l?.traceState?l.traceState.get(mO):void 0,b=v?ra(v):void 0,ee=ya(b?.sample_rand)??Zn(),[te,ne,re]=Qo(o,{name:f,attributes:h,normalizedRequest:_?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:ya(b?.sample_rate)},ee),ie=`${u}`.toUpperCase();return ie===`OPTIONS`||ie===`HEAD`?(VO&&j.log(`[Tracing] Not sampling span because HTTP method is '${ie}' for ${n}`),Wk({decision:OD.NOT_RECORD,context:e,spanAttributes:i,sampleRand:ee,downstreamTraceSampleRate:0})):(!te&&d===void 0&&(VO&&j.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),this._client.recordDroppedEvent(`sample_rate`,this._isSpanStreaming?`span`:`transaction`)),{...Wk({decision:te?OD.RECORD_AND_SAMPLED:OD.NOT_RECORD,context:e,spanAttributes:i,sampleRand:ee,downstreamTraceSampleRate:re?ne:void 0}),attributes:{[Ci]:re?ne:void 0}})}toString(){return`SentrySampler`}};function Uk(e,t,n){let r=e.spanContext();if(a(r)&&r.traceId===t){if(r.isRemote){let t=AO(e.spanContext());return VO&&j.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${t}`),t}let t=AO(r);return VO&&j.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${t}`),t}}function Wk({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:a,ignoredSegmentSpan:o}){let s=Gk(t,n);return i!==void 0&&(s=s.set(vO,`${i}`)),r!==void 0&&(s=s.set(_O,`${r}`)),a&&(s=s.set(yO,`1`)),o&&(s=s.set(bO,`1`)),e==null?{decision:OD.NOT_RECORD,traceState:s}:e===OD.NOT_RECORD?{decision:e,traceState:s.set(hO,`1`)}:{decision:e,traceState:s}}function Gk(e,t){let n=g.getSpan(e)?.spanContext()?.traceState||new HO,r=t[`http.url`]||t[`url.full`];return r&&typeof r==`string`&&(n=n.set(gO,r)),n}function Kk(e){let t=g.getSpan(e);return t&&a(t.spanContext())?t:void 0}function qk(e,t={}){let n=R(e),r=n.data,i=e.kind??y.INTERNAL,a=Zi(e),o=r[Ni]!==void 0,s=a&&!o&&!$i(e),c=s&&r[`sentry.source`]===`custom`?{...r,[Si]:void 0}:r,l=MO(n.description||`<unknown>`,c,i);if(i!==y.INTERNAL&&r[`otel.kind`]===void 0&&e.setAttribute(`otel.kind`,y[i]),l.op&&r[`sentry.op`]===void 0&&e.setAttribute(I,l.op),l.source!==void 0&&l.source!==`custom`&&(t.finalizeStatus||l.source!==`url`)&&(n.parent_span_id===void 0||i===y.SERVER)&&(r[`sentry.source`]===void 0||s)&&e.setAttribute(Si,l.source),l.data&&Object.entries(l.data).forEach(([t,n])=>{n!==void 0&&r[t]===void 0&&e.setAttribute(t,n)}),t.finalizeStatus){Xk(e,r);let t=F();Yk(e,r,n.status,!!t&&Uo(t))}a&&l.description!==n.description&&(r[`sentry.source`]!==`custom`||s)&&e.updateName(l.description)}function Jk(e,t){Hn(e,`kind`,t??y.INTERNAL)}function Yk(e,t,n,r){if(n===void 0){e.setStatus(kk(t)||{code:1});return}!r&&n!==`ok`&&!Dk(n)&&e.setStatus({code:2,message:`internal_error`})}function Xk(e,t){let n=t[Cl];t[`http.response.status_code`]===void 0&&n!==void 0&&(e.setAttribute(bl,n),t[bl]=n)}var Zk=class{startSpan(e,t={},n){let i=n||r.active(),a=t.root?void 0:g.getSpan(i);if(me(i))return this._createNonRecordingSpan(a);let o=this._startSentrySpan(e,t,a,n!==void 0);return ea(o),Jk(o,t.kind),t.attributes?.[`sentry.source`]===void 0&&Xi(o),qk(o),o}startActiveSpan(e,t,n,i){let a=typeof t==`function`?{}:t,o=typeof n==`function`||n===void 0?r.active():n,s=typeof t==`function`?t:typeof n==`function`?n:i,c=this.startSpan(e,a,o),l=Yi(c).isolationScope,u=e=>l?e.setValue(wO,l):e;return gs(c)&&g.getSpan(o)?r.with(u(o),()=>s(c)):r.with(u(g.setSpan(o,c)),()=>(qr(N(),c),s(c)))}_startSentrySpan(e,t,n,r){let i={name:e,attributes:t.attributes,links:t.links,startTime:t.startTime};return t.root?os(()=>ts({...i,parentSpan:null})):n?.spanContext().isRemote?this._startRootSpanWithRemoteParent(i,n):n?ts({...i,parentSpan:n}):os(()=>ts({...i,parentSpan:r?null:void 0}))}_startRootSpanWithRemoteParent(e,t){let{spanId:n,traceId:r,traceState:i}=t.spanContext(),a=ho(t),o=typeof a.sample_rand==`string`?Number(a.sample_rand):void 0,s=!!i?.get(mO);return yi(i=>(i.setPropagationContext({traceId:r,parentSpanId:n,sampled:AO(t.spanContext()),dsc:s?a:void 0,sampleRand:typeof o==`number`&&!Number.isNaN(o)?o:Zn()}),qr(i,void 0),ts({...e,parentSpan:null})))}_createNonRecordingSpan(e){let t=new so({traceId:e?.spanContext().traceId});return e&&Ja(e,t),Ji(t,N(),P()),t}},Qk=class{constructor(e={}){this._tracers=new Map,this.resource=e.resource}getTracer(e,t,n){let r=JSON.stringify([e,t,n]),i=this._tracers.get(r);if(i)return i;let a=new Zk;return this._tracers.set(r,a),a}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},$k=`telemetry.sdk.language`,eA=`telemetry.sdk.name`,tA=`telemetry.sdk.version`,nA=`service.namespace`,rA=class e{constructor(e){this._attributes=e}get attributes(){return this._attributes}merge(t){return t?new e({...this._attributes,...t.attributes}):this}getRawAttributes(){return Object.entries(this._attributes)}};function iA(e){if(!e)return{};let t={};for(let n of e.split(`,`)){let e=n.indexOf(`=`);if(e===-1)continue;let r=n.substring(0,e).trim(),i=n.substring(e+1).trim();if(r)try{t[r]=decodeURIComponent(i)}catch{t[r]=i}}return t}function aA(e){let t=typeof process<`u`?process.env:{},n=t.OTEL_SERVICE_NAME,r=iA(t.OTEL_RESOURCE_ATTRIBUTES);return new rA({[nA]:`sentry`,[su]:e,...r,...n?{[su]:n}:{},[cu]:A,[$k]:ne[$k],[eA]:ne[eA],[tA]:ne[tA]})}function oA({span:e,scope:t,client:n,propagateTraceparent:i}={}){let a=(t&&kO(t))??r.active();if(e){let{scope:t}=Yi(e);a=t&&kO(t)||g.setSpan(r.active(),e)}let{traceId:o,spanId:s,sampled:c,dynamicSamplingContext:l}=JO(a,{scope:t,client:n}),u={"sentry-trace":wa(o,s,c),baggage:ia(l)};return i&&(u.traceparent=Ta(o,s,c)),u}function sA(e){function t(){return EO(r.active())||{scope:Zr(),isolationScope:Qr()}}function n(e){let t=r.active();return r.with(t,()=>e(s()))}function i(e,t){let n=kO(e)||r.active();return r.with(n.setValue(CO,e),()=>t(e))}function a(e){let t=r.active();return r.with(t.setValue(SO,!0),()=>{let t=s();return Sa(t.getPropagationContext())||t.setPropagationContext({traceId:Hr(),sampleRand:Zn()}),e(c())})}function o(e,t){let n=r.active();return r.with(n.setValue(wO,e),()=>t(c()))}function s(){return t().scope}function c(){return t().isolationScope}li({withScope:n,withSetScope:i,withSetIsolationScope:o,withIsolationScope:a,getCurrentScope:s,getIsolationScope:c,startSpan:rk,startSpanManual:ik,startInactiveSpan:ak,getActiveSpan:BO,suppressTracing:_k,isTracingSuppressed:vk,getTraceData:oA,continueTrace:pk,startNewTrace:mk,withActiveSpan:ok,getTracingChannelBinding:e?.getTracingChannelBinding})}x();var cA=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`],lA=class{constructor(){this._kOtListeners=Symbol(`OtListeners`),this._wrapped=!1,KO(`SentryContextManager`),this._asyncLocalStorage=ui(Zt()).getTracingChannelBinding?.()?.asyncLocalStorage??new We}active(){return this._asyncLocalStorage.getStore()??te}with(e,t,n,...r){let i=bk(e,this.active()),a=n==null?t:t.bind(n);return this._asyncLocalStorage.run(i,a,...r)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}bind(e,t){return t instanceof be?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:xO}}_bindFunction(e,t){let n=this.with.bind(this),r=function(...r){return n(e,()=>t.apply(this,r))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindEventEmitter(e,t){if(this._getPatchMap(t)!==void 0)return t;this._createPatchMap(t);for(let n of cA)t[n]!==void 0&&(t[n]=this._patchAddListener(t,t[n],e));return typeof t.removeListener==`function`&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off==`function`&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners==`function`&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners)),t}_patchRemoveListener(e,t){let n=this;return function(r,i){let a=n._getPatchMap(e)?.[r];if(a===void 0)return t.call(this,r,i);let o=a.get(i);return t.call(this,r,o||i)}}_patchRemoveAllListeners(e,t){let n=this;return function(r){let i=n._getPatchMap(e);return i!==void 0&&(arguments.length===0?n._createPatchMap(e):r!==void 0&&i[r]!==void 0&&delete i[r]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let r=this;return function(i,a){if(r._wrapped)return t.call(this,i,a);let o=r._getPatchMap(e);o===void 0&&(o=r._createPatchMap(e));let s=o[i];s===void 0&&(s=new WeakMap,o[i]=s);let c=r.bind(n,a);s.set(a,c),r._wrapped=!0;try{return t.call(this,i,c)}finally{r._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};function uA(e){sA({getTracingChannelBinding:e?.skipOpenTelemetrySetup?fA():dA()})}function dA(){let e=new We;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:pA})}function fA(){return()=>{try{let e=r._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return e?{asyncLocalStorage:e,getStoreWithActiveSpan:pA}:void 0}catch{return}}}function pA(e){let t=r.active();return gs(e)&&Xa(e)!==e||e.spanContext().traceState?.get(`sentry.ignored`)===`1`?t:g.setSpan(t,e)}var mA=lA;x();function hA(){f.disable(),f.setLogger({error:j.error,warn:j.warn,info:j.log,debug:j.log,verbose:j.log},l.DEBUG)}var gA={};function X(e,t,n){return n?vA(e,t,n):_A(e,t)}function _A(e,t){return Object.assign(n=>{let r=gA[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return gA[e]=i,jT({instrumentations:[i]}),i},{id:e})}function vA(e,t,n){return Object.assign(r=>{let i=n(r),a=gA[e];if(a)return a.setConfig(i),a;let o=new t(i);return gA[e]=o,jT({instrumentations:[o]}),o},{id:e})}var yA=`ChildProcess`,bA=G((e={})=>({name:yA,setup(){T.channel(`child_process`).subscribe(t=>{M(t)&&`process`in t&&xA(t.process,e)}),T.channel(`worker_threads`).subscribe(t=>{M(t)&&`worker`in t&&SA(t.worker,e)})}}));function xA(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`,e=>{n||(n=!0,e!==null&&e!==0&&Zp({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Zp({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function SA(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Zp({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):U(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}var CA=Fe(ke),wA=Fe(je),TA=`Context`,EA=G(((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?MA():void 0,r=t.device?NA(t.device):void 0,i=t.culture?jA():void 0,a=t.cloudResource?VA():void 0,o=t.os?AA():void 0,s={"process.runtime.engine.name":`v8`,"process.runtime.engine.version":process.versions.v8,...OA({app:n,device:r,culture:i,cloud_resource:a})};o&&o.then(e=>Object.assign(s,OA({os:e}))).catch(()=>{});let c=(async()=>{let e={};return o&&(e.os=await o),n&&(e.app=n),r&&(e.device=r),i&&(e.culture=i),a&&(e.cloud_resource=a),e})();async function l(e){let t=DA(await c);return e.contexts={...e.contexts,app:{...t.app,...e.contexts?.app},os:{...t.os,...e.contexts?.os},device:{...t.device,...e.contexts?.device},culture:{...t.culture,...e.contexts?.culture},cloud_resource:{...t.cloud_resource,...e.contexts?.cloud_resource}},e}return{name:TA,processEvent(e){return l(e)},processSegmentSpan(e){gu(e,s),gu(e,kA(n,r))}}}));function DA(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=Qe.freemem()),e}function OA(e){let t={},{app:n,device:r,os:i,culture:a,cloud_resource:o}=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)),a&&(a.locale&&(t[`culture.locale`]=a.locale),a.timezone&&(t[`culture.timezone`]=a.timezone)),o)for(let[e,n]of Object.entries(o))n!=null&&(t[e]=n);return t}function kA(e,t){let n={};if(e&&(n[`app.memory`]=process.memoryUsage().rss,typeof process.availableMemory==`function`)){let e=process.availableMemory?.();e!=null&&(n[`app.free_memory`]=e)}return t?.free_memory!=null&&(n[`device.free_memory`]=Qe.freemem()),n}async function AA(){let e=Qe.platform();switch(e){case`darwin`:return RA();case`linux`:return BA();default:return{name:PA[e]||e,version:Qe.release()}}}function jA(){try{if(typeof process.versions.icu!=`string`)return;let e=new Date(9e8);if(new Intl.DateTimeFormat(`es`,{month:`long`}).format(e)===`enero`){let e=Intl.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone}}}catch{}}function MA(){let e=process.memoryUsage().rss,t={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory==`function`){let e=process.availableMemory?.();e!=null&&(t.free_memory=e)}return t}function NA(e){let t={},n;try{n=Qe.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=Qe.arch(),(e===!0||e.memory)&&(t.memory_size=Qe.totalmem(),t.free_memory=Qe.freemem()),e===!0||e.cpu){let e=Qe.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}var PA={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},FA=[{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`]}],IA={alpine:e=>e,arch:e=>LA(/distrib_release=(.*)/,e),centos:e=>LA(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>LA(/release (..)/,e),mint:e=>LA(/distrib_release=(.*)/,e),red:e=>LA(/release ([^ ]+)/,e),suse:e=>LA(/VERSION = (.*)\n/,e),ubuntu:e=>LA(/distrib_release=(.*)/,e)};function LA(e,t){let n=e.exec(t);return n?n[1]:void 0}async function RA(){let e={kernel_version:Qe.release(),name:`Mac OS X`,version:`10.${Number(Qe.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{Se(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=LA(/^ProductName:\s+(.*)$/m,t),e.version=LA(/^ProductVersion:\s+(.*)$/m,t),e.build=LA(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function zA(e){return e.split(` `)[0].toLowerCase()}async function BA(){let e={kernel_version:Qe.release(),name:`Linux`};try{let t=await wA(`/etc`),n=FA.find(e=>t.includes(e.name));if(!n)return e;let r=(await CA(we(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(zA(e))>=0)||i[0],e.version=IA[zA(e.name)]?.(r)}catch{}return e}function VA(){if(process.env.VERCEL)return{"cloud.provider":`vercel`,"cloud.region":process.env.VERCEL_REGION};if(process.env.AWS_REGION)return{"cloud.provider":`aws`,"cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV};if(process.env.GCP_PROJECT)return{"cloud.provider":`gcp`};if(process.env.ALIYUN_REGION_ID)return{"cloud.provider":`alibaba_cloud`,"cloud.region":process.env.ALIYUN_REGION_ID};if(process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME)return{"cloud.provider":`azure`,"cloud.region":process.env.REGION_NAME};if(process.env.IBM_CLOUD_REGION)return{"cloud.provider":`ibm_cloud`,"cloud.region":process.env.IBM_CLOUD_REGION};if(process.env.TENCENTCLOUD_REGION)return{"cloud.provider":`tencent_cloud`,"cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE};if(process.env.NETLIFY)return{"cloud.provider":`netlify`};if(process.env.FLY_REGION)return{"cloud.provider":`fly.io`,"cloud.region":process.env.FLY_REGION};if(process.env.DYNO)return{"cloud.provider":`heroku`}}var HA=new Sx(10),UA=new Sx(20),WA=7,GA=`ContextLines`;function KA(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function qA(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function JA(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function YA(e,t){let n=HA.get(e);if(n===void 0)return!1;for(let e=t[0];e<=t[1];e++)if(n[e]===void 0)return!1;return!0}function XA(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=ij(r,t),a=[];for(;;){if(n===e.length-1){a.push(i);break}let r=e[n+1];if(typeof r!=`number`)break;r<=i[1]?i[1]=r+t:(a.push(i),i=ij(r,t)),n++}return a}function ZA(e,t,n){return new Promise((r,i)=>{let a=Oe(e),o=ot({input:a});function s(){a.destroy(),r()}let c=0,l=0,u=t[l];if(u===void 0){s();return}let d=u[0],f=u[1];function p(t){UA.set(e,1),aT&&j.error(`Failed to read file: ${e}. Error: ${t}`),o.close(),o.removeAllListeners(),s()}a.on(`error`,p),o.on(`error`,p),o.on(`close`,s),o.on(`line`,e=>{if(c++,!(c<d)&&(n[c]=hr(e,0),c>=f)){if(l===t.length-1){o.close(),o.removeAllListeners();return}l++;let e=t[l];if(e===void 0){o.close(),o.removeAllListeners();return}d=e[0],f=e[1]}})})}async function QA(e,t){let n={};if(t>0&&e.exception?.values){for(let t of e.exception.values)if(t.stacktrace?.frames?.length)for(let e=t.stacktrace.frames.length-1;e>=0;e--){let r=t.stacktrace.frames[e],i=r?.filename;!r||typeof i!=`string`||typeof r.lineno!=`number`||qA(i)||JA(r)||(n[i]||(n[i]=[]),n[i].push(r.lineno))}}let r=Object.keys(n);if(r.length==0)return e;let i=[];for(let e of r){if(UA.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=XA(r,t);if(a.every(t=>YA(e,t)))continue;let o=KA(HA,e,{});i.push(ZA(e,a,o))}if(await Promise.all(i).catch(()=>{aT&&j.log(`Failed to read one or more source files and resolve context lines`)}),t>0&&e.exception?.values)for(let n of e.exception.values)n.stacktrace?.frames&&n.stacktrace.frames.length>0&&$A(n.stacktrace.frames,t,HA);return e}function $A(e,t,n){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno==`number`){let e=n.get(r.filename);if(e===void 0)continue;tj(r.lineno,r,t,e)}}function ej(e){delete e.pre_context,delete e.context_line,delete e.post_context}function tj(e,t,n,r){if(t.lineno===void 0||r===void 0){aT&&j.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=nj(e,n);i<e;i++){let e=r[i];if(e===void 0){ej(t),aT&&j.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){ej(t),aT&&j.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=rj(e,n);t.post_context=[];for(let n=e+1;n<=i;n++){let e=r[n];if(e===void 0)break;t.post_context.push(e)}}function nj(e,t){return Math.max(1,e-t)}function rj(e,t){return e+t}function ij(e,t){return[nj(e,t),rj(e,t)]}var aj=G(((e={})=>({name:GA,processEvent(t,n,r){return QA(t,e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??WA)}}))),oj;async function sj(){if(oj===void 0)try{oj=!!(await import(`node:inspector`)).url()}catch{oj=!1}return oj}function cj(e,t){return tp(e,t)}var lj=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function uj(e,t,n){let r=0,i=5,a=0;return setInterval(()=>{a===0?r>e&&(i*=2,n(i),i>86400&&(i=86400),a=i):(--a,a===0&&t()),r=0},1e3).unref(),()=>{r+=1}}function dj(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function fj(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||dj(e)&&dj(t)}var pj=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc1LjMgKDNiMjgyYzEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09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ZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`;function mj(...e){j.log(`[LocalVariables]`,...e)}var hj=G(((e={})=>{function t(t,n,r){if(r===!1)return;let i=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<i.length;t++){let a=i.length-t-1,o=n[t],s=i[a];if(!s||!o)break;o.vars===void 0||s.in_app===!1&&e.includeOutOfAppFrames!==!0||!fj(s.function,o.function)||(s.vars=cj(o.vars,r))}}function n(e,n){if(n.originalException&&typeof n.originalException==`object`&&`__SENTRY_ERROR_LOCAL_VARIABLES__`in n.originalException&&Array.isArray(n.originalException.__SENTRY_ERROR_LOCAL_VARIABLES__)){let r=F()?.getDataCollectionOptions().stackFrameVariables??!0;for(let i of e.exception?.values||[])t(i,n.originalException[lj],r);n.originalException[lj]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Ye(new URL(`data:application/javascript;base64,${pj}`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{mj(`Worker error`,e)}),t.once(`exit`,e=>{mj(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await sj()){j.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:j.isEnabled()};r().then(()=>{try{i(n)}catch(e){j.error(`Failed to start worker`,e)}},e=>{j.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function gj(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function _j(e,t){if(t!==void 0)return gj(e(t,1))}function vj(e){let t=[],n=!1;function r(r){t=[],!n&&(n=!0,e(r))}t.push(r);function i(e){t.push(e)}function a(e){let n=t.pop()||r;try{n(e)}catch{r(e)}}return{add:i,next:a}}var yj=class e{constructor(e){this._session=e}static async create(t){if(t)return t;let n=await import(`node:inspector`);return new e(new n.Session)}configureAndConnect(e,t){this._session.connect(),this._session.on(`Debugger.paused`,t=>{e(t,()=>{this._session.post(`Debugger.resume`)})}),this._session.post(`Debugger.enable`),this._session.post(`Debugger.setPauseOnExceptions`,{state:t?`all`:`uncaught`})}setPauseOnExceptions(e){this._session.post(`Debugger.setPauseOnExceptions`,{state:e?`all`:`uncaught`})}getLocalVariables(e,t){this._getProperties(e,e=>{let{add:n,next:r}=vj(t);for(let t of e)if(t.value?.objectId&&t.value.className===`Array`){let e=t.value.objectId;n(n=>this._unrollArray(e,t.name,n,r))}else if(t.value?.objectId&&t.value.className===`Object`){let e=t.value.objectId;n(n=>this._unrollObject(e,t.name,n,r))}else t.value&&n(e=>this._unrollOther(t,e,r));r({})})}_getProperties(e,t){this._session.post(`Runtime.getProperties`,{objectId:e,ownProperties:!0},(e,n)=>{t(e?[]:n.result)})}_unrollArray(e,t,n,r){this._getProperties(e,e=>{n[t]=e.filter(e=>e.name!==`length`&&!isNaN(parseInt(e.name,10))).sort((e,t)=>parseInt(e.name,10)-parseInt(t.name,10)).map(e=>e.value?.value),r(n)})}_unrollObject(e,t,n,r){this._getProperties(e,e=>{n[t]=e.map(e=>[e.name,e.value?.value]).reduce((e,[t,n])=>(e[t]=n,e),{}),r(n)})}_unrollOther(e,t,n){e.value&&(`value`in e.value?e.value.value===void 0||e.value.value===null?t[e.name]=`<${e.value.value}>`:t[e.name]=e.value.value:`description`in e.value&&e.value.type!==`function`?t[e.name]=`<${e.value.description}>`:e.value.type===`undefined`&&(t[e.name]=`<undefined>`)),n(t)}},bj=`LocalVariables`,xj=G(((e={},t)=>{let n=new Sx(20),r,i=!1;function a(t,r){let i=gj(t.stacktrace?.frames);if(i===void 0)return;let a=n.remove(i);if(a===void 0||r===!1)return;let o=(t.stacktrace?.frames||[]).filter(e=>e.function!==`new Promise`);for(let t=0;t<o.length;t++){let n=o.length-t-1,i=a[t],s=o[n];if(!s||!i)break;i.vars===void 0||s.in_app===!1&&e.includeOutOfAppFrames!==!0||!fj(s.function,i.function)||(s.vars=cj(i.vars,r))}}function o(e){for(let t of e.exception?.values||[])a(t,F()?.getDataCollectionOptions().stackFrameVariables??!0);return e}let s;async function c(){let a=F()?.getOptions();if(a?.includeLocalVariables){if(zE<18){j.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await sj()){j.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await yj.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=_j(e,i.description);if(c==null){s();return}let{add:l,next:u}=vj(e=>{n.set(c,e),s()});for(let e=0;e<Math.min(a.length,5);e++){let{scopeChain:t,functionName:n,this:r}=a[e],i=t.find(e=>e.type===`local`),s=r.className===`global`||!r.className?n:`${r.className}.${n}`;if(i?.object.objectId===void 0)l(t=>{t[e]={function:s},u(t)});else{let t=i.object.objectId;l(n=>o.getLocalVariables(t,t=>{n[e]={function:s,vars:t},u(n)}))}}u([])},c=e.captureAllExceptions!==!1;o.configureAndConnect((e,t)=>s(a.stackParser,e,t),c),c&&(r=uj(e.maxExceptionsPerSecond||50,()=>{j.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{j.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){j.log("The `LocalVariables` integration failed to start.",e)}}}return{name:bj,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}})),Sj=(e={})=>RE.major<19?xj(e):hj(e),Cj,wj=`Modules`;function Tj(){return typeof __SENTRY_SERVER_MODULES__<`u`?__SENTRY_SERVER_MODULES__:k.__SENTRY_SERVER_MODULES__??{}}var Ej=(()=>({name:wj,processEvent(e){return e.modules={...e.modules,...Oj()},e},getModules:Oj}));function Dj(){return{...Tj(),...Aj()}}function Oj(){return Cj||=Dj(),Cj}function kj(){try{let e=we(process.cwd(),`package.json`);return JSON.parse(Ae(e,`utf8`))}catch{return{}}}function Aj(){let e=kj();return{...e.dependencies,...e.devDependencies}}var jj=2e3,Mj=!1;function Nj(e){if(Mj)return;Mj=!0,rn(()=>{console.error(e)});let t=F();if(t===void 0){aT&&j.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:jj;t.close(r).then(e=>{e||aT&&j.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{aT&&j.error(e),global.process.exit(1)})}var Pj=`OnUncaughtException`,Fj=G((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:Pj,setup(e){rt&&global.process.on(`uncaughtException`,Ij(e,t))}}});function Ij(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=Nj;t.onFatalError?c=t.onFatalError:o.onFatalError&&(c=o.onFatalError);let l=global.process.listeners(`uncaughtException`).filter(e=>e.name!==`domainUncaughtExceptionClear`&&e._errorHandler!==!0).length===0,u=t.exitEvenIfOtherHandlersAreRegistered||l;n?u&&(i?(aT&&j.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),Nj(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,F()===e&&U(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}var Lj=`OnUnhandledRejection`,Rj=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],zj=G(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Rj,...e.ignore??[]]};return{name:Lj,setup(e){global.process.on(`unhandledRejection`,Uj(e,t))}}}));function Bj(e){if(!M(e))return{name:``,message:String(e??``)};let t=e;return{name:typeof t.name==`string`?t.name:``,message:typeof t.message==`string`?t.message:String(e)}}function Vj(e,t){let n=e.name===void 0||_r(t.name,e.name,!0),r=e.message===void 0||_r(t.message,e.message);return n&&r}function Hj(e,t){let n=Bj(t);return e.some(e=>Vj(e,n))}function Uj(e,t){return function(n,r){if(F()!==e||Hj(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=M(n)?n._sentry_active_span:void 0;(a?e=>H(a,e):e=>e())(()=>{U(n,{originalException:n,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),Wj(n,t.mode)}}function Wj(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`?rn(()=>{console.warn(n),console.error(M(e)&&`stack`in e?e.stack:e)}):t===`strict`&&(rn(()=>{console.warn(n)}),Nj(e))}var Gj=`ProcessSession`,Kj=G(()=>({name:Gj,setupOnce(){sd(),process.on(`beforeExit`,()=>{P().getSession()?.status===`ok`&&cd()})}})),qj=`Spotlight`,Jj=G(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:qj,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&j.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}Yj(e,t)}}}));function Yj(e,t){let n=Xj(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){j.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=wo(e);is(()=>{let e=w.request({method:`POST`,path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":`application/x-sentry-envelope`}},e=>{e.statusCode&&e.statusCode>=200&&e.statusCode<400&&(r=0),e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`)});e.on(`error`,()=>{r++,j.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function Xj(e){try{return new URL(`${e}`)}catch{j.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var Zj=G((e={})=>({name:`Console`,setup(t){process.env.LAMBDA_TASK_ROOT&&Dn(`console`,Qj),Zh({...e,filter:[...e.filter||[],`[DEP0205] DeprecationWarning`]}).setup?.(t)}}));function Qj(){let e=k?.console;e&&en.forEach(t=>{t in e&&$j(e,t)})}function $j(e,t){let n=e[t];nn[t]=n;let r=n,i,a=!1,o=function(...i){if(a){n.apply(e,i);return}a=!0;try{On(`console`,{args:i,level:t}),r.apply(e,i)}finally{a=!1}};Un(o,n);let s=n.bind(e);nn[t]=s;try{let n=o;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return n},set(e){e===o?(i!==void 0&&(r=i,i=void 0),n=o):e===s?(i=r,n=s):typeof e==`function`&&!e.__sentry_original__?(r=e,n=o):n=e}})}catch{Vn(e,t,function(e){return nn[t]=e,function(...e){On(`console`,{args:e,level:t}),nn[t]?.apply(this,e)}})}}var eM=`NodeSystemError`;function tM(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`||typeof Me.getSystemErrorMap!=`function`?!1:Me.getSystemErrorMap().has(e.errno)}var nM=G((e={})=>({name:eM,processEvent:(t,n,r)=>{if(!tM(n.originalException))return t;let i=n.originalException,a={...i};!r.getDataCollectionOptions().userInfo&&e.includePaths!==!0&&(delete a.path,delete a.dest),t.contexts={...t.contexts,node_system_error:a};for(let e of t.exception?.values||[])e.value&&(i.path&&e.value.includes(i.path)&&(e.value=e.value.replace(`'${i.path}'`,``).trim()),i.dest&&e.value.includes(i.dest)&&(e.value=e.value.replace(`'${i.dest}'`,``).trim()));return t}})),rM,iM=Symbol(`AgentBaseInternalState`),aM=class extends (rM=w.Agent,rM){constructor(e){super(e),this[iM]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`&&t.split(`
23
- `).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1)}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)};Promise.resolve().then(()=>this.connect(e,r)).then(i=>{if(i instanceof w.Agent)return i.addRequest(e,r);this[iM].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[iM].currentSocket;if(this[iM].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[iM].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[iM]&&(this[iM].defaultPort=e)}get protocol(){return this[iM].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[iM]&&(this[iM].protocol=e)}};function oM(...e){j.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function sM(e){return new Promise((t,n)=>{let r=0,i=[];function a(){let t=e.read();t?l(t):e.once(`readable`,a)}function o(){e.removeListener(`end`,s),e.removeListener(`error`,c),e.removeListener(`readable`,a)}function s(){o(),oM(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),oM(`onerror %o`,e),n(e)}function l(s){i.push(s),r+=s.length;let c=Buffer.concat(i,r),l=c.indexOf(`\r
24
- \r
25
- `);if(l===-1){oM(`have not received end of HTTP headers yet...`),a();return}let u=c.subarray(0,l).toString(`ascii`).split(`\r
26
- `),d=u.shift();if(!d)return e.destroy(),n(Error(`No header received from proxy CONNECT response`));let f=d.split(` `),p=+(f[1]||0),m=f.slice(2).join(` `),h={};for(let t of u){if(!t)continue;let r=t.indexOf(`:`);if(r===-1)return e.destroy(),n(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,r).toLowerCase(),a=t.slice(r+1).trimStart(),o=h[i];typeof o==`string`?h[i]=[o,a]:Array.isArray(o)?o.push(a):h[i]=a}oM(`got proxy server response: %o %o`,d,h),o(),t({connect:{statusCode:p,statusText:m,headers:h},buffered:c})}e.on(`error`,c),e.on(`end`,s),a()})}function cM(...e){j.log(`[https-proxy-agent]`,...e)}var lM=class extends aM{constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},cM(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?dM(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){cM("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=qe.connect({...this.connectOpts,servername:e&&C.isIP(e)?void 0:e})}else cM("Creating `net.Socket`: %o",this.connectOpts),r=C.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=C.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r
27
- `;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r
28
- `;let s=sM(r);r.write(`${o}\r
29
- `);let{connect:c,buffered:l}=await s;if(e.emit(`proxyConnect`,c),this.emit(`proxyConnect`,c,e),c.statusCode===200){if(e.once(`socket`,uM),t.secureEndpoint){cM(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return qe.connect({...dM(t,`host`,`path`,`port`),socket:r,servername:C.isIP(e)?void 0:e})}return r}r.destroy();let u=new C.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{cM(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};lM.protocols=[`http`,`https`];function uM(e){e.resume()}function dM(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var fM=32768;function pM(e){return new Ge({read(){this.push(e),this.push(null)}})}function mM(e){let t;try{t=new URL(e.url)}catch{return rn(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),mf(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=hM(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?st:w,a=e.keepAlive!==void 0&&e.keepAlive,o=r?new lM(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return mf(e,gM(e,e.httpModule??i,o))}function hM(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function gM(e,t,n){let{hostname:r,pathname:i,port:a,protocol:o,search:s}=new URL(e.url);return function(c){return new Promise((l,u)=>{is(()=>{let d=pM(c.body),f={...e.headers};c.body.length>fM&&(f[`content-encoding`]=`gzip`,d=d.pipe(D()));let p=r.startsWith(`[`),m=t.request({method:`POST`,agent:n,headers:f,hostname:p?r.slice(1,-1):r,path:`${i}${s}`,port:a,protocol:o,ca:e.caCerts},e=>{e.on(`data`,()=>{}),e.on(`end`,()=>{}),e.setEncoding(`utf8`);let t=e.headers[`retry-after`]??null,n=e.headers[`x-sentry-rate-limits`]??null;l({statusCode:e.statusCode,headers:{"retry-after":t,"x-sentry-rate-limits":Array.isArray(n)?n[0]||null:n}})});m.on(`error`,u),d.pipe(m)})})}}function _M(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=up(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}function vM(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function yM(e=process.argv[1]?_h(process.argv[1]):process.cwd(),t=Ee===`\\`){let n=t?vM(e):e;return e=>{if(!e)return;let r=t?vM(e):e,{dir:i,base:a,ext:o}=Te.parse(r);(o===`.js`||o===`.mjs`||o===`.cjs`)&&(a=a.slice(0,o.length*-1));let s=decodeURIComponent(a);i||=`.`;let c=i.lastIndexOf(`/node_modules`);if(c>-1)return`${i.slice(c+14).replace(/\//g,`.`)}:${s}`;if(i.startsWith(n)){let e=i.slice(n.length+1).replace(/\//g,`.`);return e?`${e}:${s}`:s}return s}}function bM(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(k.SENTRY_RELEASE?.id)return k.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 xM=gn(CC(yM()));x();var SM=6e4,CM=class extends wx{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||Qe.hostname(),n={...e,platform:`node`,runtime:e.runtime||{name:`node`,version:global.process.version},serverName:t};e.openTelemetryInstrumentations&&jT({instrumentations:e.openTelemetryInstrumentations}),Ap(n,`node`),j.log(`Initializing Sentry: process: ${process.pid}, thread: ${rt?`main`:`worker-${it}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Hd(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener)),Ss(this)}get tracer(){if(this._tracer)return this._tracer;let e=A,t=g.getTracer(`@sentry/node`,e);return this._tracer=t,t}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off(`beforeExit`,this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off(`beforeExit`,this._logOnExitFlushListener);let t=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),t}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{aT&&j.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??SM).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}_setupIntegrations(){Qf(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?hk(this,e):[void 0,void 0]}},wM;function TM(){return zE>=21||zE===20&&BE>=6||zE===18&&BE>=19||(wM||(wM=!0,rn(()=>{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 EM(){if(TM()&&!k._sentryEsmLoaderHookRegistered){k._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,IE.createAddHookMessageChannel)();nt.register(`import-in-the-middle/hook.mjs`,import.meta.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){j.warn(`Failed to register 'import-in-the-middle' hook`,e)}}}function DM(){return[im(),em(),Mm(),Rm(),nM(),lg(),Zj(),qE(),SD(),Fj(),zj(),aj(),Sj(),EA(),bA(),Kj(),Ej()]}function OM(e={}){return kM(e,DM)}function kM(e={},t){let n=jM(e,t);n.debug===!0&&(aT?j.enable():rn(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&EM(),uA(n),N().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===`Spotlight`)&&n.integrations.push(Jj({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Ap(n,`node-core`);let r=new CM(n);return N().setClient(r),r.init(),j.log(`SDK initialized from ESM`),r.startClientReportTracking(),PM(),zO(r),yk(r),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function AM(){if(!aT)return;let e=GO(),t=[`SentryContextManager`,`SentryPropagator`],n=e.includes(`SentryTracerProvider`);eo()&&!n&&t.push(`SentrySpanProcessor`);for(let n of t)e.includes(n)||j.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);!n&&!e.includes(`SentrySampler`)&&j.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 jM(e,t){let n=MM(e.release),r=_M(e.spotlight),i=NM(e.tracesSampleRate),a={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??mM,stackParser:_n(e.stackParser||xM),release:n,tracesSampleRate:i,spotlight:r,debug:up(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=bd({defaultIntegrations:e.defaultIntegrations??t(a),integrations:o});return{...a,integrations:s}}function MM(e){if(e!==void 0)return e;let t=bM();if(t!==void 0)return t}function NM(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 PM(){if(up(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Ca(e,t);N().setPropagationContext(n)}}var FM=e=>({package:e,"javascript.is_cjs":!1});function IM(e,t){let n=F()?.getOptions();!n?.disableInstrumentationWarnings&&!(q(e)||typeof Gn(e)==`function`)&&ad()&&eo(n)&&(rn(()=>{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/.`)}),vi().setContext(`missing_instrumentation`,FM(t)))}var{isPromise:LM}=Ie,RM=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc1LjMgKDNiMjgyYzEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO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UvMWU2KX0scmVzZXQ6KCk9Pnt0PXByb2Nlc3MuaHJ0aW1lKCl9fX0sYW4ucG9sbEludGVydmFsLGFuLmFuclRocmVzaG9sZCxmdW5jdGlvbigpe2RuKCJXYXRjaGRvZyB0aW1lb3V0IiksU24/KGRuKCJQYXVzaW5nIGRlYnVnZ2VyIHRvIGNhcHR1cmUgc3RhY2sgdHJhY2UiKSxTbigpKTooZG4oIkNhcHR1cmluZyBldmVudCB3aXRob3V0IGEgc3RhY2sgdHJhY2UiKSxfbigpLnRoZW4obnVsbCwoKT0+e2RuKCJTZW5kaW5nIEFOUiBldmVudCBmYWlsZWQgb24gd2F0Y2hkb2cgdGltZW91dC4iKX0pKX0pO2U/Lm9uKCJtZXNzYWdlIix0PT57dC5zZXNzaW9uJiYoZm49SCh0LnNlc3Npb24pKSx0LmRlYnVnSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==`,zM=50,BM=5e3;function VM(e,...t){j.log(`[ANR] ${e}`,...t)}function HM(){return k}function UM(){let e=Bs(P(),N());return e.attachments=[],e.eventProcessors=[],e}async function WM(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 GM=`Anr`,KM=G(((e={})=>{if(RE.major<16||RE.major===16&&RE.minor<17)throw Error(`ANR detection requires Node 16.17.0 or later`);let t,n,r=HM();return r.__SENTRY_GET_SCOPES__=UM,{name:GM,startWorker:()=>{t||n&&(t=qM(n,e))},stopWorker:()=>{t&&t.then(e=>{e(),t=void 0})},async setup(t){n=t,e.captureStackTrace&&await sj()&&(j.warn(`ANR captureStackTrace has been disabled because the debugger was already enabled`),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}));async function qM(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await WM(e);delete r.app?.app_memory,delete r.device?.free_memory;let i=e.getOptions(),a=e.getSdkMetadata()||{};a.sdk&&(a.sdk.integrations=i.integrations.map(e=>e.name));let o={debug:j.isEnabled(),dsn:n,tunnel:i.tunnel,environment:i.environment||`production`,release:i.release,dist:i.dist,sdkMetadata:a,appRootPath:t.appRootPath,pollInterval:t.pollInterval||zM,anrThreshold:t.anrThreshold||BM,captureStackTrace:!!t.captureStackTrace,maxAnrEvents:t.maxAnrEvents||1,staticTags:t.staticTags||{},contexts:r};if(o.captureStackTrace){let e=await import(`node:inspector`);e.url()||e.open(0)}let s=new Ye(new URL(`data:application/javascript;base64,${RM}`),{workerData:o,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{s.terminate()});let c=setInterval(()=>{try{let e=P().getSession(),t=e?{...e,toJSON:void 0}:void 0;s.postMessage({session:t,debugImages:Mu(i.stackParser)})}catch{}},o.pollInterval);return c.unref(),s.on(`message`,e=>{e===`session-ended`&&(VM(`ANR event sent from ANR worker. Clearing session in this thread.`),P().setSession(void 0))}),s.once(`error`,e=>{clearInterval(c),VM(`ANR worker error`,e)}),s.once(`exit`,e=>{clearInterval(c),VM(`ANR worker exit`,e)}),s.unref(),()=>{s.terminate(),clearInterval(c)}}function JM(e){let t=F()?.getIntegrationByName(GM);if(!t)return e();t.stopWorker();let n=e();return LM(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}function YM(e,...t){let[n,r,i,a]=t;if(Array.isArray(r)){let t={...i};t[`sentry.message.template`]=n,r.forEach((e,n)=>{t[`sentry.message.parameter.${n}`]=e}),Vd({level:e,message:Pe(n,...r),attributes:t},a?.scope)}else Vd({level:e,message:n,attributes:r},i?.scope??a?.scope)}var XM=t({debug:()=>QM,error:()=>tN,fatal:()=>nN,fmt:()=>kp,info:()=>$M,trace:()=>ZM,warn:()=>eN});function ZM(...e){YM(`trace`,...e)}function QM(...e){YM(`debug`,...e)}function $M(...e){YM(`info`,...e)}function eN(...e){YM(`warn`,...e)}function tN(...e){YM(`error`,...e)}function nN(...e){YM(`fatal`,...e)}var rN=`NodeRuntimeMetrics`,iN=3e4,aN=1e3,oN=10;function sN(e,t,n){return Number.isFinite(e)?e<aN?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${aN}ms. Using minimum of ${aN}ms.`),aN):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var cN=G((e={})=>{let t=sN(e.collectionIntervalMs??iN,rN,iN),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,a,o,s,c=0,l,u=oN*1e6,d=e=>Math.max(0,(e-u)/1e9),f={attributes:{"sentry.origin":`auto.node.runtime_metrics`}},p={unit:`byte`,attributes:{"sentry.origin":`auto.node.runtime_metrics`}},m={unit:`second`,attributes:{"sentry.origin":`auto.node.runtime_metrics`}};function h(){let e=Qn(),t=e-c;if(i&&o!==void 0){let e=process.cpuUsage(o);n.cpuTime&&(Tg(`node.runtime.cpu.user`,e.user/1e6,m),Tg(`node.runtime.cpu.system`,e.system/1e6,m)),n.cpuUtilization&&t>0&&Tg(`node.runtime.cpu.utilization`,(e.user+e.system)/(t*1e3),f),o=process.cpuUsage()}if(n.memRss||n.memHeapUsed||n.memHeapTotal||n.memExternal){let e=process.memoryUsage();n.memRss&&Tg(`node.runtime.mem.rss`,e.rss,p),n.memHeapUsed&&Tg(`node.runtime.mem.heap_used`,e.heapUsed,p),n.memHeapTotal&&Tg(`node.runtime.mem.heap_total`,e.heapTotal,p),n.memExternal&&(Tg(`node.runtime.mem.external`,e.external,p),Tg(`node.runtime.mem.array_buffers`,e.arrayBuffers,p))}if(r&&l&&(n.eventLoopDelayMin&&Tg(`node.runtime.event_loop.delay.min`,d(l.min),m),n.eventLoopDelayMax&&Tg(`node.runtime.event_loop.delay.max`,d(l.max),m),n.eventLoopDelayMean&&Tg(`node.runtime.event_loop.delay.mean`,d(l.mean),m),n.eventLoopDelayP50&&Tg(`node.runtime.event_loop.delay.p50`,d(l.percentile(50)),m),n.eventLoopDelayP90&&Tg(`node.runtime.event_loop.delay.p90`,d(l.percentile(90)),m),n.eventLoopDelayP99&&Tg(`node.runtime.event_loop.delay.p99`,d(l.percentile(99)),m),l.reset()),n.eventLoopUtilization&&s!==void 0){let e=lt.eventLoopUtilization();Tg(`node.runtime.event_loop.utilization`,lt.eventLoopUtilization(e,s).utilization,f),s=e}n.uptime&&t>0&&wg(`node.runtime.process.uptime`,t/1e3,m),c=e}return{name:rN,setup(){if(r){l?.disable();try{l=ct({resolution:oN}),l.enable()}catch{l=void 0}}i&&(o=process.cpuUsage()),n.eventLoopUtilization&&(s=lt.eventLoopUtilization()),c=Qn(),a&&clearInterval(a),a=pd(setInterval(h,t))}}}),lN=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`],uN=Symbol.for(`level`),dN=Symbol.for(`message`),fN=Symbol.for(`splat`);function pN(e,t){class n extends e{constructor(e){super(e),this._levels=new Set(t?.levels??lN)}log(e,n){try{if(setImmediate(()=>{this.emit(`logged`,e)}),!M(e))return;let n=e[uN],{level:r,message:i,timestamp:a,...o}=e;o[uN]=void 0,o[dN]=void 0,o[fN]=void 0;let s=t?.customLevelMap?.[n],c=mN[n],l=s??c??`info`;this._levels.has(l)?YM(l,i,{...o,"sentry.origin":`auto.log.winston`}):!s&&!c&&aT&&j.log(`Winston log level ${n} is not captured by Sentry. Please add ${n} to the "customLevelMap" option of the Sentry Winston transport.`)}catch{}n&&n()}}return n}var mN={silly:`trace`,debug:`debug`,verbose:`debug`,http:`debug`,info:`info`,notice:`info`,warn:`warn`,warning:`warn`,error:`error`,emerg:`fatal`,alert:`fatal`,crit:`fatal`},hN=Symbol(`sentry-track-pino-logger`);function gN(e,t,n){let r=Object.getOwnPropertySymbols(e),i=`Symbol(${t})`;for(let t of r)if(t.toString()===i){let r=e[t];return typeof r==`string`?r:n}return n}var _N={error:{levels:[],handled:!0},log:{levels:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]}};function vN(e){let{level:t,time:n,pid:r,hostname:i,...a}=e;return a}var yN=G((e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{..._N.error,...e.error},log:{..._N.log,...e.log}};function n(e){let n=e[hN];return n===`track`||n!==`ignore`&&t.autoInstrument}return{name:`Pino`,setup:e=>{let r=!!e.getOptions().enableLogs,i=T.tracingChannel(`pino_asJson`);function a(e,i,a){if(!n(e))return;let o=vN(a),[s,c,l]=i,u=e?.levels?.labels?.[l]||`info`,d=gN(e,`pino.messageKey`,`msg`),f=c||o?.[d]||``;if(r&&t.log.levels.includes(u)&&Vd({level:u,message:f,attributes:{...o,"sentry.origin":`auto.log.pino`,"pino.logger.level":l}}),t.error.levels.includes(u)){let n=gN(e,`pino.errorKey`,`err`),r={};for(let[e,t]of Object.entries(o))e!==n&&e!==d&&(r[e]=t);f&&(r[d]=f);let i={level:Ym(u),contexts:{pino:r}};yi(e=>{e.addEventProcessor(e=>(e.logger=`pino`,Er(e,{handled:t.error.handled,type:`auto.log.pino`}),e));let r=s[n];if(r){U(r,i);return}Wu(f,i)})}}i.end.subscribe(e=>{let{instance:t,arguments:n,result:r}=e;a(t,n,JSON.parse(r))})}}}),bN=Object.assign(yN,{trackLogger(e){M(e)&&`levels`in e&&(e[hN]=`track`)},untrackLogger(e){M(e)&&`levels`in e&&(e[hN]=`ignore`)}});function xN(e,t){e.setAttribute(L,t)}var SN=[[`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 CN(e){return SN.reduce((e,[t,n])=>e.replace(new RegExp(t,`gi`),n),e)}var wN=`Automatic instrumentation of CronJob only supports crontab string`;function TN(e,t){let n=!1;return new Proxy(e,{construct(e,r){let[i,a,o,s,c,...l]=r;if(typeof i!=`string`)throw Error(wN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let u=CN(i);async function d(e,n){return dd(t,async()=>{try{await a(e,n)}catch(e){throw U(e,{mechanism:{handled:!1,type:`auto.function.cron.instrumentCron`}}),e}},{schedule:{type:`crontab`,value:u},timezone:c||void 0})}return new e(i,d,o,s,c,...l)},get(e,r){return r===`from`?r=>{let{cronTime:i,onTick:a,timeZone:o}=r;if(typeof i!=`string`)throw Error(wN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let s=CN(i);return r.onTick=async(e,n)=>dd(t,async()=>{try{await a(e,n)}catch(e){throw U(e,{mechanism:{handled:!1,type:`auto.function.cron.instrumentCron`}}),e}},{schedule:{type:`crontab`,value:s},timezone:o||void 0}),e.from(r)}:e[r]}})}function EN(e,t={}){return new Proxy(e,{get(e,n){return n===`schedule`&&e.schedule?new Proxy(e.schedule,{apply(e,n,r){let[i,a,o]=r,s=o?.name,c=o?.timezone;if(!s)throw Error(`Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.`);return e.apply(n,[i,async(...e)=>dd(s,async()=>{try{return await a(...e)}catch(e){throw U(e,{mechanism:{handled:!1,type:`auto.function.node-cron.instrumentNodeCron`}}),e}},{schedule:{type:`crontab`,value:CN(i)},timezone:c,...t}),o])}}):e[n]}})}function DN(e){return new Proxy(e,{get(e,t){return t===`scheduleJob`?new Proxy(e.scheduleJob,{apply(e,t,n){let[r,i,a]=n;if(typeof r!=`string`||typeof i!=`string`||typeof a!=`function`)throw 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 o=r,s=i;async function c(){return dd(o,async()=>{await a?.()},{schedule:{type:`crontab`,value:CN(s)}})}return e.apply(t,[o,s,c])}}):e[t]}})}var ON={instrumentCron:TN,instrumentNodeCron:EN,instrumentNodeSchedule:DN},kN=`Http`,AN=Object.assign(HE,{id:`${kN}.sentry`}),jN=G((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},a={ignoreIncomingRequests:e.ignoreIncomingRequests,ignoreStaticAssets:e.ignoreStaticAssets,ignoreStatusCodes:e.dropSpansForIncomingRequestStatusCodes,instrumentation:e.instrumentation,onSpanCreated:e.incomingRequestSpanHook},o=lT(i),s=dT(a);return{name:kN,setup(e){let t=e.getOptions();r&&eo(t)&&s.setup(e)},setupOnce(){o.setupOnce(),HE({breadcrumbs:e.breadcrumbs,spans:t,propagateTraceInOutgoingRequests:e.tracePropagation??!0,createSpansForOutgoingRequests:t,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(t,n)=>{let r=Ow(n);if(r.startsWith(`data:`)){let e=Sp(r);t.setAttribute(`http.url`,e),t.setAttribute(lu,e),t.updateName(`${n.method||`GET`} ${e}`)}e.instrumentation?.requestHook?.(t,n)},outgoingResponseHook:e.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:e.instrumentation?.applyCustomAttributesOnSpan})},processEvent(e){return s.processEvent(e)}}}),MN=G(((e={})=>({name:`NodeFetch`,setupOnce(){let t=F()?.getOptions();dD({...e,spans:NN(e,t)})}})));function NN(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&eo(t))}var PN=`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`.split(`.`),FN=`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`.split(`,`),IN=`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`.split(`,`);function LN(e){let t=e.split(`.`);if(t.length>1){if(t.length!==2)throw Error(`Invalid member function name ${e}`);return t}return[e]}function RN(e,t){if(!t)throw Error(JSON.stringify({member:t}));let[n,r]=LN(t);return r?{objectToPatch:e[n],functionNameToPatch:r}:{objectToPatch:e,functionNameToPatch:n}}var zN=`auto.file.fs`,BN=`file`,VN=[`rename`,`renameSync`],HN=[`copyFile`,`cp`,`copyFileSync`,`cpSync`],UN=[`link`,`linkSync`],WN=[`mkdtemp`,`mkdtempSync`],GN=[`symlink`,`symlinkSync`],KN=`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`.split(`,`);function qN(e,t,n){let r={[I]:BN,[L]:zN};return n.recordFilePaths&&(typeof t[0]==`string`&&KN.includes(e)?r.path_argument=t[0]:typeof t[0]==`string`&&typeof t[1]==`string`?GN.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):UN.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):HN.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):VN.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]==`string`&&WN.includes(e)&&(r.prefix_argument=t[0])),r}function JN(e,t){return Object.assign(e,t)}var YN=new WeakMap;function XN(e,t,n){let r=e[t];if(typeof r!=`function`)return;let i=YN.get(e);i||(i=new Set,YN.set(e,i)),!i.has(t)&&(i.add(t),e[t]=n(r))}function ZN(e,t,n){return JN(function(...r){let i=qN(e,r,n);return B({name:`fs.${e}`,onlyIfParent:!0,attributes:i},e=>{try{return is(()=>t.apply(this,r))}catch(t){throw nP(e,t,n),t}})},t)}function QN(e,t,n){return JN(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return t.apply(this,r);let o=qN(e,r,n),s=V({name:`fs.${e}`,onlyIfParent:!0,attributes:o}),c=z();r[i]=function(...e){let t=e[0];return t&&nP(s,t,n),s.end(),c?H(c,()=>a.apply(this,e)):a.apply(this,e)};try{return is(()=>t.apply(this,r))}catch(e){throw nP(s,e,n),s.end(),e}},t)}function $N(e,t){let n=`exists`,r=JN(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return e.apply(this,r);let o=qN(n,r,t),s=V({name:`fs.${n}`,onlyIfParent:!0,attributes:o}),c=z();r[i]=function(...e){return s.end(),c?H(c,()=>a.apply(this,e)):a.apply(this,e)};try{return is(()=>e.apply(this,r))}catch(e){throw nP(s,e,t),s.end(),e}},e),i=function(e){return new Promise(t=>r(e,t))};return Object.defineProperty(i,"name",{value:n}),Object.defineProperty(r,Le.custom,{value:i}),r}function eP(e,t,n){return JN(async function(...r){let i=qN(e,r,n);return B({name:`fs.${e}`,onlyIfParent:!0,attributes:i},async e=>{try{return await is(()=>t.apply(this,r))}catch(t){throw nP(e,t,n),t}})},t)}function tP(e={}){for(let t of IN){let{objectToPatch:n,functionNameToPatch:r}=RN(ze,t);XN(n,r,n=>ZN(t,n,e))}for(let t of FN){let{objectToPatch:n,functionNameToPatch:r}=RN(ze,t);t===`exists`?XN(n,r,t=>$N(t,e)):XN(n,r,n=>QN(t,n,e))}let t=ze.promises;for(let n of PN)XN(t,n,t=>eP(n,t,e))}function nP(e,t,n){e.setStatus({code:2,message:`internal_error`}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute(`fs_error`,t.message)}var rP=`FileSystem`,iP=G((e={})=>({name:rP,setupOnce(){tP(e)}})),aP=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;function oP(e){let t=z();if(!t)return;let n=Xa(t);n&&R(n).data[`sentry.op`]===`http.server`&&n.setAttribute(`http.route`,e)}var sP=`Express`,cP=[`>=4.0.0 <6`];function lP(e,t){iw(e,t),IM(e.use,`express`)}var uP=X(sP,e=>new dP(e)),dP=class extends J{constructor(e={}){super(`sentry-express`,A,e)}init(){return new Y(`express`,cP,e=>{try{tw(e,()=>({...this.getConfig(),onRouteResolved(e){e&&oP(e)}}))}catch(e){aP&&j.error(`Failed to patch express module:`,e)}return e},e=>e)}},fP=G((e=>({name:sP,setupOnce(){uP(e)},getShouldHandleError(){return e?.shouldHandleError}}))),pP=(e=>(e.FASTIFY_NAME=`fastify.name`,e.FASTIFY_TYPE=`fastify.type`,e.HOOK_NAME=`hook.name`,e.PLUGIN_NAME=`plugin.name`,e))(pP||{}),mP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(mP||{}),hP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request handler`,e))(hP||{}),gP=Symbol(`opentelemetry.instrumentation.fastify.request_active_span`);x();function _P(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),a=e[gP]||[];return a.push(i),Object.defineProperty(e,gP,{enumerable:!1,configurable:!0,value:a}),i}function vP(e,t){let n=e[gP]||[];n.length&&(n.forEach(e=>{t&&(e.setStatus({code:b.ERROR,message:t.message}),e.recordException(t)),e.end()}),delete e[gP])}function yP(e,t,n){let r,i;try{i=e(),bP(i)&&i.then(e=>t(void 0,e),e=>t(e))}catch(e){r=e}finally{if(!bP(i)&&(t(r,i),r))throw r;return i}}function bP(e){return typeof e==`object`&&e&&typeof Object.getOwnPropertyDescriptor(e,`then`)?.value==`function`||!1}x();var xP=`@sentry/instrumentation-fastify-v3`,SP=`anonymous`,CP=new Set([`onTimeout`,`onRequest`,`preParsing`,`preValidation`,`preSerialization`,`preHandler`,`onSend`,`onResponse`,`onError`]),wP=class extends J{constructor(e={}){super(xP,A,e)}init(){return[new Y(`fastify`,[`>=3.0.0 <3.21.0`],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(t,n,r){if(!e.isEnabled())return r();e._wrap(n,`send`,e._patchSend());let i=t,a=i.routeOptions?i.routeOptions.url:t.routerPath;a&&oP(a);let o=t.method||`GET`;P().setTransactionName(`${o} ${a}`),r()}}_wrapHandler(e,t,n,i){let a=this;return this._diag.debug(`Patching fastify route.handler function`),function(...o){if(!a.isEnabled())return n.apply(this,o);let s=n.name||e||SP,c=`${hP.MIDDLEWARE} - ${s}`,l=o[1],u=_P(l,a.tracer,c,{[pP.FASTIFY_TYPE]:mP.MIDDLEWARE,[pP.PLUGIN_NAME]:e,[pP.HOOK_NAME]:t}),d=i&&o[o.length-1];return d&&(o[o.length-1]=function(...e){vP(l),d.apply(this,e)}),r.with(g.setSpan(r.active(),u),()=>yP(()=>n.apply(this,o),e=>{e instanceof Error&&(u.setStatus({code:b.ERROR,message:e.message}),u.recordException(e)),i||vP(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug(`Patching fastify server.addHook function`),function(t){return function(...n){let r=n[0],i=n[1],a=this.pluginName;if(!CP.has(r))return t.apply(this,n);let o=typeof n[n.length-1]==`function`&&i.constructor.name!==`AsyncFunction`;return t.apply(this,[r,e._wrapHandler(a,r,i,o)])}}}_patchConstructor(e){let t=this;function n(...n){let r=e.fastify.apply(this,n);return r.addHook(`onRequest`,t._hookOnRequest()),r.addHook(`preHandler`,t._hookPreHandler()),TP(),t._wrap(r,`addHook`,t._wrapAddHook()),r}return e.errorCodes!==void 0&&(n.errorCodes=e.errorCodes),n.fastify=n,n.default=n,n}_patchSend(){let e=this;return this._diag.debug(`Patching fastify reply.send function`),function(t){return function(...n){let r=n[0];return e.isEnabled()?FE(()=>t.apply(this,n),e=>{!e&&r instanceof Error&&(e=r),vP(this,e)}):t.apply(this,n)}}}_hookPreHandler(){let e=this;return this._diag.debug(`Patching fastify preHandler function`),function(t,n,i){if(!e.isEnabled())return i();let a=t,o=a.routeOptions?.handler||a.context?.handler,s=o?.name.startsWith(`bound `)?o.name.substring(6):o?.name,c=`${hP.REQUEST_HANDLER} - ${s||this.pluginName||SP}`,l={[pP.PLUGIN_NAME]:this.pluginName,[pP.FASTIFY_TYPE]:mP.REQUEST_HANDLER,[xl]:a.routeOptions?a.routeOptions.url:t.routerPath};s&&(l[pP.FASTIFY_NAME]=s);let u=_P(n,e.tracer,c,l);EP(u);let{requestHook:d}=e.getConfig();return d&&FE(()=>d(u,{request:t}),t=>{t&&e._diag.error(`request hook failed`,t)},!0),r.with(g.setSpan(r.active(),u),()=>{i()})}}};function TP(){let e=F();e&&e.on(`spanStart`,e=>{EP(e)})}function EP(e){let t=R(e).data,n=t[`fastify.type`];if(t[`sentry.op`]||!n)return;e.setAttributes({[L]:`auto.http.otel.fastify`,[I]:`${n}.fastify`});let r=t[`fastify.name`]||t[`plugin.name`]||t[`hook.name`];if(typeof r==`string`){let t=r.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``);e.updateName(t)}}var DP=`execute_tool`,OP=`invoke_agent`,kP=`graphql`,Z=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,AP=()=>{};function Q(e,t,n){let r=jP(e,t,n),i=n?.beforeSpanEnd,a=n?.deferSpanEnd,o=e=>typeof n?.captureError==`function`?n.captureError(e):{mechanism:{type:`auto.diagnostic_channels.bind_span`,handled:!1}},s=(e,t)=>{n?.captureError&&U(t,o(t));let{message:r,attributes:i}=NP(t);e.setStatus({code:2,message:r}),e.setAttributes(i)},c=(e,t)=>{let n=!1;return r=>{n||(n=!0,r!==void 0&&(s(e,r),t.error=r),MP(t,i))}},l={start:AP,asyncStart:AP,end(e){if(`error`in e||`result`in e){let t=e._sentrySpan;if(t&&a?.({span:t,data:e,end:c(t,e)}))return;MP(e,i)}},error(e){let t=e._sentrySpan;t&&s(t,e.error)},asyncEnd(e){let t=e._sentrySpan;t&&a?.({span:t,data:e,end:c(t,e)})||MP(e,i)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function jP(e,t,n){let r=ui(Zt()).getTracingChannelBinding?.();if(!r)return Z&&j.log(`[TracingChannel] Could not access async context binding.`),{channel:e,unbind:AP};let i=r.asyncLocalStorage;return e.start.bindStore(i,e=>{e._sentryCallerStore=i.getStore();let a=!n?.requiresParentSpan||z()?t(e):void 0;return a?(e._sentrySpan=a,r.getStoreWithActiveSpan(a)):e._sentryCallerStore}),e.asyncStart.bindStore(i,e=>e._sentryCallerStore),{channel:e,unbind:()=>{e.start.unbindStore(i),e.asyncStart.unbindStore(i)}}}function MP(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function NP(e){let t=M(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:{[Ic]:i}}}var PP=`original-description`,FP=new Set([`Int`,`Float`,`String`,`BlockString`]);function IP(e,t,n){let r=Xa(e);if(r===e)return;let i=R(r),a=n?`${t} ${n}`:t,o=i.data[Zl],s;s=Array.isArray(o)?[...o,a]:typeof o==`string`?[o,a]:a,r.setAttribute(Zl,s);let c=i.data[PP]??i.description;i.data[PP]||r.setAttribute(PP,c),r.updateName(`${c} (${LP(s)})`)}function LP(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 RP(e,t,n){return e&&t?`${e} ${t}`:e||n}function zP(e){if(M(e)&&`errors`in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function BP(e){let t=e?.loc,n=t?.source?.body;if(typeof n==`string`&&t?.startToken)try{let e=[];for(let n=t.startToken;n;n=n.next)FP.has(n.kind)&&e.push({start:n.start,end:n.end,kind:n.kind});let r=n;for(let t=e.length-1;t>=0;t--){let{start:n,end:i,kind:a}=e[t],o=a===`String`||a===`BlockString`?`"*"`:`*`;r=r.slice(0,n)+o+r.slice(i)}return r}catch{return}}function VP(e){if(F()?.getDataCollectionOptions().graphQL.document===!0)return BP(e)}var HP=`graphql:parse`,UP=`graphql:validate`,WP=`graphql:execute`,GP=`graphql:subscribe`,KP=`graphql:resolve`,qP=`auto.graphql.diagnostic_channel`,JP=`graphql.parse`,YP=`graphql.validate`,XP=`graphql.execute`,ZP=`graphql.subscribe`,QP=`graphql.resolve`,$P=`graphql.field.name`,eF=`graphql.field.path`,tF=`graphql.field.type`,nF=`graphql.parent.name`;function rF(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,i=t.useOperationNameForRootSpan!==!1;iF(e),aF(e),oF(e,WP,XP,i),oF(e,GP,ZP,i),n||sF(e,r)}function iF(e){Q(e(HP),()=>V({name:JP,attributes:{[L]:qP,[I]:kP}}))}function aF(e){Q(e(UP),e=>V({name:YP,attributes:{[L]:qP,[I]:kP,[fl]:VP(e.document)}}),{beforeSpanEnd:(e,t)=>{Array.isArray(t.result)&&t.result.length>0&&e.setStatus({code:2,message:`invalid_argument`})}})}function oF(e,t,n,r){Q(e(t),e=>{let t=V({name:RP(e.operationType,e.operationName,n),attributes:{[L]:qP,[I]:kP,[ml]:e.operationType,[pl]:e.operationName||void 0,[fl]:VP(e.document)}});return r&&e.operationType&&IP(t,e.operationType,e.operationName),t},{beforeSpanEnd:(e,t)=>{zP(t.result)&&e.setStatus({code:2,message:`internal_error`})}})}function sF(e,t){Q(e(KP),e=>{if(!(t&&e.isDefaultResolver))return V({name:`${QP} ${e.fieldPath}`,attributes:{[L]:qP,[I]:kP,[$P]:e.fieldName,[eF]:e.fieldPath,[tF]:e.fieldType,[nF]:e.parentType}})})}var cF=G(((e={})=>({name:`Graphql`,setupOnce(){T.tracingChannel&&W(()=>{rF(T.tracingChannel,e)})}}))),lF=`mongoose:query`,uF=`mongoose:aggregate`,dF=`mongoose:model:save`,fF=`mongoose:model:insertMany`,pF=`mongoose:model:bulkWrite`,mF=`mongoose:cursor:next`,hF=`auto.db.mongoose.diagnostic_channel`,gF=`mongodb`,_F=10,vF=!1;function yF(e){if(!vF){vF=!0;try{bF(e,lF),bF(e,uF),bF(e,dF),bF(e,fF),bF(e,pF),bF(e,mF)}catch{Z&&j.log(`Mongoose node:diagnostics_channel subscription failed.`)}}}function bF(e,t){Q(e(t),e=>{let t=e.collection,n=SF(e.args?.pipeline??e.args?.filter),r=xF(e);return V({name:t?`mongoose.${t}.${e.operation}`:`mongoose.${e.operation}`,attributes:{[L]:hF,[I]:`db`,[Pc]:gF,[Ac]:e.operation,[Tc]:t??void 0,[Dc]:e.database??void 0,[jc]:n??void 0,[kc]:r??void 0,[au]:e.serverAddress??void 0,[ou]:e.serverPort??void 0}})})}function xF(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 SF(e){if(e!=null)try{let t=CF(e,0),n=JSON.stringify(t);return n==null||n===`{}`||n===`[]`?void 0:n}catch{return}}function CF(e,t){if(t>_F)return`?`;if(Array.isArray(e))return e.map(e=>CF(e,t+1));if(M(e)){let n={};for(let r of Object.keys(e))n[r]=CF(e[r],t+1);return n}return`?`}var wF=G((()=>({name:`Mongoose`,setupOnce(){T.tracingChannel&&W(()=>{yF(T.tracingChannel)})}}))),TF=`db.system`,EF=`db.name`,DF=`db.operation`,OF=`db.statement`,kF=`db.mongodb.collection`,AF=`db.connection_string`,jF=`net.peer.name`,MF=`net.peer.port`,NF=`mongodb`;function PF(e){return JSON.stringify(FF(e))}function FF(e){return Array.isArray(e)?e.map(e=>FF(e)):IF(e)?Object.entries(e).map(([e,t])=>[e,FF(t)]).reduce((e,t)=>(RF(t)&&(e[t[0]]=t[1]),e),{}):`?`}function IF(e){return M(e)&&!LF(e)}function LF(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}function RF(e){return Array.isArray(e)}function zF(e,t,n,r,i){let a,o;if(e){let t=typeof e.address==`string`?e.address.split(`:`):``;t.length===2&&(a=t[0],o=t[1])}let s;return s=n?.documents?.[0]?n.documents[0]:n?.cursors?n.cursors:n,BF(t.db,t.collection,a,o,s,r,i)}function BF(e,t,n,r,i,a,o){let s={[L]:o,[TF]:NF,[EF]:e,[kF]:t,[DF]:a,[AF]:`mongodb://${n}:${r}/${e}`};if(n&&r){s[jF]=n;let e=parseInt(r,10);isNaN(e)||(s[MF]=e)}if(i)try{s[OF]=PF(i)}catch{}return s}function VF(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 HF(e,t,n,r,i){let a,o;if(t?.s&&(a=t.s.options?.host??t.s.host,o=(t.s.options?.port??t.s.port)?.toString(),a==null||o==null)){let e=t.description?.address;if(e){let t=e.split(`:`);a=t[0],o=t[1]}}let[s,c]=e.toString().split(`.`),l=n?.query??n?.q??n;return BF(s,c,a,o,l,r,i)}function UF(e){return V({name:`mongodb.${e[DF]||`command`}`,op:`db`,kind:K.CLIENT,attributes:e})}var WF=`mysql2:query`,GF=`mysql2:execute`,KF=`mysql2:connect`,qF=`mysql2:pool:connect`,JF=`auto.db.mysql2.diagnostic_channel`,YF=`mysql`,XF=/^\s*(\w+)/;function ZF(e){QF(e,WF),QF(e,GF),$F(e,KF,`mysql2.connect`),$F(e,qF,`mysql2.pool.connect`)}function QF(e,t){Q(e(t),e=>{let t=e.query?vw(e.query):void 0,n=t?.match(XF)?.[1]?.toUpperCase();return V({name:t||`mysql2.query`,attributes:{[L]:JF,[I]:`db`,[Pc]:YF,[jc]:t,[Ac]:n,[Dc]:e.database||void 0,[au]:e.serverAddress,[ou]:e.serverPort}})},{requiresParentSpan:!0})}function $F(e,t,n){Q(e(t),e=>V({name:n,attributes:{[L]:JF,[I]:`db`,[Pc]:YF,[Dc]:e.database||void 0,[au]:e.serverAddress,[ou]:e.serverPort}}),{requiresParentSpan:!0})}var eI=G((()=>({name:`Mysql2`,setupOnce(){T.tracingChannel&&W(()=>{ZF(T.tracingChannel)})}}))),tI=`7`,nI=`PRISMA_INSTRUMENTATION`,rI=`V${tI}_PRISMA_INSTRUMENTATION`,iI=globalThis;function aI(e){let t={helper:e};iI[rI]=t,iI[nI]=t}var oI=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES===`true`}catch{return!1}})(),sI=`00-10-10-00`,cI=`auto.db.otel.prisma`,lI=1e3,uI=new Sx(lI),dI=[];function fI(e,t){uI.set(e,t)}function pI(e,t){let n={...t,[L]:cI};return e===`prisma:engine:db_query`&&n[`db.system`]==null&&(n[Nc]=`prisma`),n}function mI(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 hI(){let e=!0;for(;e;){e=!1;for(let t=dI.length-1;t>=0;t--){let n=dI[t],r=uI.get(n.parent_span_id);if(!r)continue;let i=pI(n.name,n.attributes),a=V({name:mI(n.name,i),attributes:i,kind:n.kind===`client`?K.CLIENT:K.INTERNAL,startTime:n.start_time,parentSpan:r});fI(n.span_id,a),n.links&&a.addLinks(n.links.flatMap(e=>{let t=uI.get(e.span_id);return t?[{context:t.spanContext()}]:[]})),a.end(n.end_time),dI.splice(t,1),e=!0}}}var gI=class{constructor({ignoreSpanTypes:e}){this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(e){let t=(e??z())?.spanContext();return t?`00-${t.traceId}-${t.spanId}-0${t.traceFlags}`:sI}dispatchEngineSpans(e){let t=new Map,n=e.filter(e=>e.parentId===null);for(let r of n)_I(r,e,t,this.ignoreSpanTypes)}createEngineSpan(e){dI.push(...e.spans),hI();let t=dI.length-lI;t>0&&(Z&&j.log(`[Prisma] Dropping ${t} unresolved v5 engine span(s) whose parent was never registered.`),dI.splice(0,t))}getActiveContext(){return z()}runInChildSpan(e,t){let n=typeof e==`string`?{name:e}:e;if(n.internal&&!oI)return t();let r=`prisma:client:${n.name}`;if(bI(r,this.ignoreSpanTypes))return t();let i=z(),a=pI(r,n.attributes),o={name:mI(r,a),attributes:a,kind:n.kind,links:n.links,startTime:n.startTime,parentSpan:i};if(n.active===!1){let e=V(o);return fI(e.spanContext().spanId,e),vI(e,()=>t(e,i))}return es(o,e=>(fI(e.spanContext().spanId,e),vI(e,()=>t(e,i))))}};function _I(e,t,n,r){if(bI(e.name,r))return;let i=pI(e.name,e.attributes);es({name:mI(e.name,i),attributes:i,kind:e.kind===`client`?K.CLIENT:K.INTERNAL,startTime:e.startTime},i=>{n.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(e=>{let t=n.get(e);return t?{context:{spanId:t,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=t.filter(t=>t.parentId===e.id);for(let e of a)_I(e,t,n,r);i.end(e.endTime)})}function vI(e,t){let n;try{n=t()}catch(t){throw e.end(),t}return yI(n)?n.then(t=>(e.end(),t),t=>{throw e.end(),t}):(e.end(),n)}function yI(e){return e!=null&&typeof e.then==`function`}function bI(e,t){return t.some(t=>typeof t==`string`?t===e:t.test(e))}var xI=`Prisma`;function SI(e){aI(new gI({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var CI=G((e=>({name:xI,setupOnce(){SI(e)}}))),wI=`node-redis:command`,TI=`node-redis:batch`,EI=`node-redis:connect`,DI=`ioredis:command`,OI=`ioredis:connect`,kI=`auto.db.redis.diagnostic_channel`,AI=`redis`;function jI(e,t){MI(e,wI,e=>e.args.slice(1),t),NI(e,TI,e=>e.batchMode===`PIPELINE`?`PIPELINE`:`MULTI`),PI(e,EI),MI(e,DI,e=>e.args,t),PI(e,OI)}function MI(e,t,n,r){Q(e(t),e=>{let t=n(e),r=t.length?`${e.command} ${t.join(` `)}`:e.command;return V({name:`redis-${e.command}`,attributes:{[L]:kI,[I]:`db.redis`,[Pc]:AI,[jc]:r,...e.serverAddress==null?{}:{[au]:e.serverAddress},...e.serverPort==null?{}:{[ou]:e.serverPort}}})},{beforeSpanEnd(e,t){`error`in t||FI(r,e,t.command,n(t),t.result)}})}function NI(e,t,n){Q(e(t),e=>V({name:n(e),attributes:{[L]:kI,[I]:`db.redis`,[Pc]:AI,...Number(e.batchSize)>1?{[kc]:e.batchSize}:{},...e.serverAddress==null?{}:{[au]:e.serverAddress},...e.serverPort==null?{}:{[ou]:e.serverPort}}}))}function PI(e,t){Q(e(t),e=>V({name:`redis-connect`,attributes:{[L]:kI,[I]:`db.redis.connect`,[Pc]:AI,...e.serverAddress==null?{}:{[au]:e.serverAddress},...e.serverPort==null?{}:{[ou]:e.serverPort}}}))}function FI(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}var II=G(((e={})=>({name:`Redis`,setupOnce(){T.tracingChannel&&W(()=>{jI(T.tracingChannel,e.responseHook)})}}))),LI=[{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}],RI=(e,t)=>{if(Array.isArray(t)&&t.length){let n=LI.find(({regex:t})=>t.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 zI(e){return typeof e==`string`?e:void 0}function BI(e){return typeof e==`number`&&!isNaN(e)?e:void 0}function VI(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function HI(e){return M(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`}function UI(e,t,n){let r=e.getReader(),i={toolCalls:[]},a=``,o=!1,s=()=>{o||(o=!0,a&&(i.text=a),t(i))},c=e=>{o||(o=!0,n(e))};return new ReadableStream({async pull(e){try{let{done:t,value:n}=await r.read();if(t){s(),e.close();return}a+=WI(i,n)??``,e.enqueue(n)}catch(t){c(t),e.error(t)}},cancel(e){return s(),r.cancel(e)}})}function WI(e,t){if(!M(t))return;let{type:n,delta:r,textDelta:i,id:a,modelId:o,toolCallId:s,toolName:c,input:l,args:u,finishReason:d,usage:f,providerMetadata:p}=t;switch(n){case`text-delta`:{let e=r??i;return typeof e==`string`?e:void 0}case`tool-call`:e.toolCalls.push({toolCallId:s,toolName:c,input:l??u});return;case`response-metadata`:typeof a==`string`&&(e.responseId=a),typeof o==`string`&&(e.responseModel=o);return;case`finish`:e.finishReason=d,e.usage=f,p!==void 0&&(e.providerMetadata=p);return;default:return}}var GI=`ai:telemetry`,KI=`auto.vercelai.channel`,qI=`gen_ai.tool.call.id`,JI=`gen_ai.tool.description`,YI=`embeddings`,XI=`rerank`,ZI=`generate_content`,QI=`WorkersAI`,$I=`vercel.ai.operationId`,eL=`vercel.ai.model.provider`,tL=`vercel.ai.settings.maxRetries`,nL=new Map,rL=new Map,iL=new Map,aL=new Set([`generateText`,`streamText`,`generateObject`,`embed`,`embedMany`,`rerank`]);function oL(e){if(!aL.has(e.type))return;let t=zI(e.event.callId);t&&sL(t)}function sL(e){nL.delete(e),rL.delete(e),iL.delete(e)}function cL(e,t){if(aL.has(t))for(let t of ly)delete e[t]}function lL(e,t){if(!e||!Array.isArray(t))return;let n=rL.get(e);for(let e of t)M(e)&&typeof e.name==`string`&&typeof e.description==`string`&&(n??=new Map,n.has(e.name)||n.set(e.name,e.description));n&&rL.set(e,n)}function uL(e,t,n){let r=e?rL.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let e=n.find(e=>M(e)&&e.name===t);return M(e)?zI(e.description):void 0}if(M(n)){let e=n[t];return M(e)?zI(e.description):void 0}}function dL(e,t={}){Q(e(GI),e=>gL(e,t),{beforeSpanEnd:(e,n)=>{xL(e,n,t),oL(n)},deferSpanEnd:({data:e,end:n})=>fL(e,t,n)})}function fL(e,t,n){if(e.type!==`languageModelCall`||!M(e.result))return!1;let r=e.result,i=r.stream;if(!HI(i))return!1;let a=zI(e.event.callId),{recordOutputs:o}=AL(e.event,t);return r.stream=UI(i,t=>{e.result={...r,...pL(t)},n(),mL(a,t,o)},e=>n(e)),!0}function pL(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 mL(e,t,n){let r=e?iL.get(e):void 0;if(!r)return;let i=M(t.usage)?t.usage:void 0;if(i){let e=wL(i.inputTokens)??wL(i.promptTokens)??wL(i.tokens),t=wL(i.outputTokens)??wL(i.completionTokens);hL(r,ll,e),hL(r,ul,t),hL(r,dl,wL(i.totalTokens)??VI(e,t))}if(n){let e=TL(OL(t.text,t.toolCalls),CL({finishReason:t.finishReason}));e&&r.setAttribute(qc,e)}}function hL(e,t,n){if(n===void 0)return;let r=R(e).data[t];e.setAttribute(t,(typeof r==`number`?r:0)+n)}function gL(e,t){let{type:n,event:r}=e;if(n===`step`||!r||typeof r!=`object`)return;let{recordInputs:i,enableTruncation:a}=AL(r,t),o=zI(r.provider),s=zI(r.modelId),c=zI(r.callId),l=BI(r.maxRetries);i&&lL(c,r.tools);let u={[L]:KI,...o?{[il]:o,[eL]:o}:{},...s?{[Xc]:s}:{},...l===void 0?{}:{[tL]:l}};switch(n){case`generateText`:case`streamText`:case`generateObject`:return vL(r,u,i,a,c,n===`streamText`);case`languageModelCall`:return Xf([QI]),yL(r,u,i,a,c,s);case`executeTool`:return bL(r,i);case`embed`:case`embedMany`:{let e=n===`embedMany`?r.values:r.value;return _L(YI,s,{...u,...i&&e!==void 0?{[Uc]:pr(e)}:{}})}case`rerank`:return _L(XI,s,u);default:return}}function _L(e,t,n){return V({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[Kc]:e,...n}})}function vL(e,t,n,r,i,a){let o=zI(e.functionId),s=zI(e.operationId)??(a?`ai.streamText`:`ai.generateText`);i&&nL.set(i,{operationId:s,isStream:a});let c=_L(OP,o,{...t,[$I]:s,[rl]:a,...o?{[Wc]:o}:{},...n?ML(e,r):{}});return a&&i&&iL.set(i,c),c}function yL(e,t,n,r,i,a){let o=i?nL.get(i):void 0,s=o?`${o.operationId}.${o.isStream?`doStream`:`doGenerate`}`:`ai.generateText.doGenerate`;return _L(ZI,a,{...t,[$I]:s,...n?ML(e,r):{},...n&&Array.isArray(e.tools)?{[Jc]:pr(e.tools)}:{}})}function bL(e,t){let n=M(e.toolCall)?e.toolCall:{},r=zI(n.toolName),i=zI(e.toolCallId)??zI(n.toolCallId),a=n.input??n.args,o=t&&r?uL(zI(e.callId),r,e.tools):void 0;return _L(DP,r,{[L]:KI,[cl]:`function`,...r?{[ol]:r}:{},...i?{[qI]:i}:{},...o?{[JI]:o}:{},...t&&a!==void 0?{[al]:pr(a)}:{}})}function xL(e,t,n){let{type:r,result:i}=t;if(!M(i))return;let{recordOutputs:a}=AL(t.event,n);if(r===`executeTool`){a&&e.setAttribute(sl,pr(i.output??i));let n=M(i.output)?i.output:void 0;n?.type===`tool-error`&&kL(e,t,n.error);return}let o=M(i.usage)?i.usage:void 0;if(o){let t=wL(o.inputTokens)??wL(o.promptTokens)??wL(o.tokens),n=wL(o.outputTokens)??wL(o.completionTokens),r=wL(o.totalTokens)??VI(t,n);t!==void 0&&e.setAttribute(ll,t),n!==void 0&&e.setAttribute(ul,n),r!==void 0&&e.setAttribute(dl,r)}let s=CL(i);s&&r===`languageModelCall`&&e.setAttribute(el,pr([s]));let c=M(i.response)?i.response:void 0,l=zI(c?.id)??zI(i.responseId);l&&e.setAttribute(tl,l);let u=zI(c?.modelId)??zI(t.event.modelId);u&&e.setAttribute(nl,u);let d=i.providerMetadata,f=cy(d);if(`gen_ai.conversation.id`in f&&R(e).data[`gen_ai.conversation.id`]&&delete f[Bi],cL(f,r),e.setAttributes(f),a){let t=TL(r===`languageModelCall`&&Array.isArray(i.content)?DL(i.content):OL(i.text,i.toolCalls),s);t&&e.setAttribute(qc,t)}}function SL(e){return e===`tool-calls`?`tool_call`:e??`stop`}function CL(e){let t=e.finishReason;return typeof t==`string`?t:M(t)?zI(t.unified):void 0}function wL(e){return BI(e)??(M(e)?BI(e.total):void 0)}function TL(e,t){if(e.length)return pr([{role:`assistant`,parts:e,finish_reason:SL(t)}])}function EL(e){let t=e.input??e.args;return{type:`tool_call`,id:zI(e.toolCallId),name:zI(e.toolName),arguments:typeof t==`string`?t:pr(t??{})}}function DL(e){let t=[];for(let n of e)M(n)&&(n.type===`text`&&typeof n.text==`string`?t.push({type:`text`,content:n.text}):n.type===`tool-call`&&t.push(EL(n)));return t}function OL(e,t){let n=[];if(typeof e==`string`&&e.length&&n.push({type:`text`,content:e}),Array.isArray(t))for(let e of t)M(e)&&n.push(EL(e));return n}function kL(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:`tool_error`});let r=M(t.event.toolCall)?t.event.toolCall:{},i=zI(r.toolName),a=zI(t.event.toolCallId)??zI(r.toolCallId);yi(t=>{t.setContext(`trace`,Aa(e)),i&&t.setTag(`vercel.ai.tool.name`,i),a&&t.setTag(`vercel.ai.tool.callId`,a),t.setLevel(`error`),U(n instanceof Error?n:Error(typeof n==`string`?n:`Tool execution failed`),{mechanism:{type:`auto.vercelai.channel`,handled:!1}})})}function AL(e,t){let n=F()?.getDataCollectionOptions().genAI;return{recordInputs:jL(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:jL(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:ov(t.enableTruncation)}}function jL(e,t,n){return typeof e==`boolean`?e:typeof t==`boolean`?t:n===!0}function ML(e,t){let n={},r=zI(e.instructions);r&&(n[r_]=pr([{type:`text`,content:r}]));let i=e.messages??e.prompt;return i!==void 0&&(n[Gc]=t?uv(i):pr(i),n[e_]=Array.isArray(i)?i.length:1),n}var NL=G(((e={})=>({name:`VercelAI`,setupOnce(){T.tracingChannel&&W(()=>{dL(T.tracingChannel,e)})}}))),PL=`@sentry/instrumentation-fastify`,FL=`>=3.21.0 <6`,IL=`auto.http.otel.fastify`,LL=`hook.fastify`,RL=`request_handler.fastify`,zL=[`onRequest`,`preParsing`,`preValidation`,`preHandler`,`preSerialization`,`onSend`,`onResponse`,`onError`],BL=`hook.name`,VL=`fastify.type`,HL=`hook.callback.name`,UL=`fastify.root`,WL=`route-hook`,GL=`hook`,KL=`request-handler`,qL=`anonymous`,JL=Symbol(`sentry fastify request span`),YL=Symbol(`sentry fastify addHook original`),XL=Symbol(`sentry fastify setNotFoundHandler original`);function ZL(e){return e.routeOptions?.url??e.routerPath}function QL(e){return e.routeOptions?.config??e.routeConfig}function $L(e){return M(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||`routerPath`in e)}function eR(e,t,n){e.decorate(YL,e.addHook),e.decorate(XL,e.setNotFoundHandler),e.decorateRequest(`opentelemetry`,function(){return{span:this[JL]}}),e.decorateRequest(JL,null),e.addHook(`onRoute`,nR),e.addHook(`onRequest`,aR),e.addHook(`onResponse`,oR),e.addHook=lR,e.setNotFoundHandler=uR,n()}var tR=eR;tR[Symbol.for(`skip-override`)]=!0,tR[Symbol.for(`fastify.display-name`)]=PL,tR[Symbol.for(`plugin-meta`)]={fastify:FL,name:PL};function nR(e){if(e.config?.otel!==!1){for(let t of zL){let n=e[t];typeof n==`function`?e[t]=fR(n,t,rR(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(n=>fR(n,t,rR(this.pluginName,t,n,e.url))))}e.onSend=iR(e.onSend,sR),e.onError=iR(e.onError,cR),e.handler=fR(e.handler,`handler`,{[BL]:`${this.pluginName} - route-handler`,[VL]:KL,[xl]:e.url,[HL]:e.handler.name.length>0?e.handler.name:qL})}}function rR(e,t,n,r){return{[BL]:`${e} - route -> ${t}`,[VL]:WL,[xl]:r,[HL]:n.name?.length>0?n.name:qL}}function iR(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function aR(e,t,n){if(QL(e)?.otel===!1)return n();let r={[L]:IL,[UL]:PL,[yl]:e.method,[uu]:e.url},i=ZL(e);if(i!=null){r[xl]=i;let e=z(),t=e&&Xa(e);t&&R(t).data[`sentry.op`]===`http.server`&&t.setAttribute(xl,i)}let a=V({name:`request`,op:RL,attributes:r});e[JL]=a,H(a,()=>{n()})}function oR(e,t,n){let r=e[JL];r!=null&&(r.setAttributes({[bl]:t.statusCode}),r.end()),e[JL]=null,n()}function sR(e,t,n,r){let i=e[JL];i!=null&&(t.statusCode>=500&&i.setStatus({code:2}),i.setAttributes({[bl]:t.statusCode}),i.end()),e[JL]=null,r(null,n)}function cR(e,t,n,r){e[JL]?.setStatus({code:2,message:n.message}),r()}function lR(e,t){let n=this[YL];return zL.includes(e)?n.call(this,e,fR(t,e,{[BL]:`${this.pluginName} - ${e}`,[VL]:GL,[HL]:t.name?.length>0?t.name:qL})):n.call(this,e,t)}function uR(e,t){let n=this[XL];if(typeof e==`function`){n.call(this,fR(e,`notFoundHandler`,{[BL]:`${this.pluginName} - not-found-handler`,[VL]:GL,[HL]:e.name?.length>0?e.name:qL}));return}if(e.preValidation!=null&&(e.preValidation=fR(e.preValidation,`notFoundHandler - preValidation`,{[BL]:`${this.pluginName} - not-found-handler - preValidation`,[VL]:GL,[HL]:e.preValidation.name?.length>0?e.preValidation.name:qL})),e.preHandler!=null&&(e.preHandler=fR(e.preHandler,`notFoundHandler - preHandler`,{[BL]:`${this.pluginName} - not-found-handler - preHandler`,[VL]:GL,[HL]:e.preHandler.name?.length>0?e.preHandler.name:qL})),t==null){n.call(this,e);return}n.call(this,e,fR(t,`notFoundHandler`,{[BL]:`${this.pluginName} - not-found-handler`,[VL]:GL,[HL]:t.name?.length>0?t.name:qL}))}function dR(e){for(let t of e)if($L(t))return t;return null}function fR(e,t,n={}){return function(...r){let i=dR(r);if(i===null||QL(i)?.otel===!1)return e.call(this,...r);let a=i[JL]??void 0,o=e.name?.length>0?e.name:this.pluginName??qL,s=n[VL],c=s===GL?LL:s===KL?RL:void 0;return B({name:c?pR(n[BL]):`${t} - ${o}`,op:c,attributes:{...n,[L]:IL},parentSpan:a},()=>e.call(this,...r))}}function pR(e=``){return e.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``).replace(/^@sentry\/instrumentation-fastify -> /,``)}function mR(e){e.addHook(`onRequest`,async(e,t)=>{let n=ZL(e),r=e.method||`GET`;P().setTransactionName(`${r} ${n}`)})}var hR=!1,gR=Object.assign(function(){hR||(hR=!0,T.subscribe(`fastify.initialization`,e=>{let t=e.fastify;t?.register(eR).after(e=>{e?Z&&j.error(`Failed to setup Fastify instrumentation`,e):t&&mR(t)})}))},{id:`Fastify.v5`}),_R=`Fastify`;function vR(e,t,n){let r=n.statusCode;return r>=500||r<=299}function yR(){return F()?.getIntegrationByName(_R)}function bR(){T.subscribe(`tracing:fastify.request.handler:error`,e=>{let{error:t,request:n,reply:r}=e;xR.call(xR,t,n,r,`diagnostics-channel`)})}function xR(e,t,n,r){let i=yR()?.getShouldHandleError()||vR;if(r===`diagnostics-channel`&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r===`onError-hook`){Z&&j.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)&&U(e,{mechanism:{handled:!1,type:`auto.function.fastify`}})}var SR=G((({shouldHandleError:e}={})=>{let t;return{name:_R,setupOnce(){t=e||vR,bR(),gR()},getShouldHandleError(){return t},setShouldHandleError(e){t=e}}})),CR=xR,wR=`db.mongodb.collection`,TR=`db.name`,ER=`db.user`,DR=`net.peer.name`,OR=`net.peer.port`,kR=`db.operation`,AR=`db.system`;function jR({collection:e,modelName:t,operation:n,origin:r,parentSpan:i}){let a={[wR]:e?.name,[TR]:e?.conn?.name,[ER]:e?.conn?.user,[DR]:e?.conn?.host,[OR]:e?.conn?.port,[kR]:n,[AR]:`mongoose`,[L]:r};return V({name:`mongoose.${t}.${n}`,op:`db`,kind:K.CLIENT,attributes:a,parentSpan:i})}var MR=`Fastify`,NR=X(`${MR}.v3`,()=>new wP);function PR(){let e=F();if(e)return e.getIntegrationByName(MR)}var FR=(e=>Td(SR(e),{setupOnce(){NR()}})),IR=G((e={})=>FR(e));function LR(e,t){t?.shouldHandleError&&PR()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(e,t,n){e.addHook(`onError`,async(e,t,n)=>{CR.call(CR,n,e,t,`onError-hook`)}),n()},{[Symbol.for(`skip-override`)]:!0,[Symbol.for(`fastify.display-name`)]:`sentry-fastify-error-handler`});e.register(n)}var RR=class{constructor(e,t,n,r){this.name=S(e),this.supportedVersions=t,this.patch=n,this.unpatch=r}},zR=(e=>(e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`,e))(zR||{}),BR=(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))(BR||{}),VR=(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))(VR||{}),HR=(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))(HR||{}),UR=Symbol.for(`opentelemetry.patched`),WR=Symbol.for(`opentelemetry.graphql_data`),GR=`Operation$operationName$not supported`,KR=Object.values(zR),qR=e=>typeof e?.then==`function`;function JR(e,t,n,r){if(F()?.getDataCollectionOptions().graphQL.document===!0){let i=cz(t,n,r);e.setAttribute(HR.SOURCE,i)}}function YR(e,t,n){let r=ez(e,n);return r?{field:r,spanAdded:!1}:(r={span:XR(e,t,n,tz(e,n))},$R(e,n,r),{field:r,spanAdded:!0})}function XR(e,t,n,r){let i={[HR.FIELD_NAME]:t.fieldName,[HR.FIELD_PATH]:n.join(`.`),[HR.FIELD_TYPE]:t.returnType.toString(),[HR.PARENT_NAME]:t.parentType.name},a=V({name:`${VR.RESOLVE} ${i[HR.FIELD_PATH]}`,attributes:i,parentSpan:r}),o=e[WR].source,s=t.fieldNodes.find(e=>e.kind===`Field`);return s&&JR(a,o.loc,s.loc?.start,s.loc?.end),a}function ZR(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function QR(e,t){if(e&&Array.isArray(e.definitions))return t?e.definitions.filter(e=>KR.indexOf(e?.operation)!==-1).find(e=>t===e?.name?.value):e.definitions.find(e=>KR.indexOf(e?.operation)!==-1)}function $R(e,t,n){return e[WR].fields[t.join(`.`)]=n}function ez(e,t){return e[WR].fields[t.join(`.`)]}function tz(e,t){for(let n=t.length-1;n>0;n--){let r=ez(e,t.slice(0,n));if(r)return r.span}return nz(e)}function nz(e){return e[WR].span}function rz(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function iz(e){return oz(`
30
- `,e)}function az(e){return oz(` `,e)}function oz(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}var sz=[BR.FLOAT,BR.STRING,BR.INT,BR.BLOCK_STRING];function cz(e,t,n){let r=``;if(e?.startToken){let i=typeof t==`number`?t:e.start,a=typeof n==`number`?n:e.end,o=e.startToken.next,s=1;for(;o;){if(o.start<i){o=o.next,s=o?.line;continue}if(o.end>a){o=o.next,s=o?.line;continue}let e=o.value||o.kind,t=``;sz.indexOf(o.kind)>=0&&(e=`*`),o.kind===BR.STRING&&(e=`"${e}"`),o.kind===BR.EOF&&(e=``),o.line>s?(r+=iz(o.line-s),s=o.line,t=az(o.column-1)):o.line===o.prev?.line&&(t=az(o.start-(o.prev?.end||0))),r+=t+e,o&&=o.next}}return r}function lz(e,t){if(!e||e[UR])return;let n=e.getFields();e[UR]=!0,Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=hz(t,r.resolve),r.type)){let e=uz(r.type);for(let n of e)lz(n,t)}})}function uz(e){return`ofType`in e?uz(e.ofType):dz(e)?e.getTypes():fz(e)?[e]:[]}function dz(e){return`getTypes`in e&&typeof e.getTypes==`function`}function fz(e){return`getFields`in e&&typeof e.getFields==`function`}var pz=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},mz=(e,t)=>{t&&e.end()};function hz(e,t,n=!1){if(r[UR]||typeof t!=`function`)return t;function r(r,i,a,o){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(M(r)||typeof r==`function`)&&typeof r[o.fieldName]!=`function`||!a[WR])return t.call(this,r,i,a,o);let{field:s,spanAdded:c}=YR(a,o,rz(o?.path)),l=s.span,u=c;return H(l,()=>{try{let e=t.call(this,r,i,a,o);return qR(e)?e.then(e=>(mz(l,u),e),e=>{throw pz(l,e,u),e}):(mz(l,u),e)}catch(e){throw pz(l,e,u),e}})}return r[UR]=!0,r}var gz=`@sentry/instrumentation-graphql`,_z=`auto.graphql.otel.graphql`,vz={ignoreResolveSpans:!1},yz=[`>=14.0.0 <17`],bz=class extends J{constructor(e={}){super(gz,A,{...vz,...e})}setConfig(e={}){super.setConfig({...vz,...e})}init(){let e=new Y(`graphql`,yz);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new RR(`graphql/execution/execute.js`,yz,e=>(q(e.execute)&&this._unwrap(e,`execute`),this._wrap(e,`execute`,this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,`execute`)})}_addPatchingParser(){return new RR(`graphql/language/parser.js`,yz,e=>(q(e.parse)&&this._unwrap(e,`parse`),this._wrap(e,`parse`,this._patchParse()),e),e=>{e&&this._unwrap(e,`parse`)})}_addPatchingValidate(){return new RR(`graphql/validation/validate.js`,yz,e=>(q(e.validate)&&this._unwrap(e,`validate`),this._wrap(e,`validate`,this._patchValidate()),e),e=>{e&&this._unwrap(e,`validate`)})}_patchExecute(e){let t=this;return function(n){return function(){let r;if(arguments.length>=2){let n=arguments;r=t._wrapExecuteArgs(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],e)}else{let n=arguments[0];r=t._wrapExecuteArgs(n.schema,n.document,n.rootValue,n.contextValue,n.variableValues,n.operationName,n.fieldResolver,n.typeResolver,e)}let i=QR(r.document,r.operationName),a=t._createExecuteSpan(i,r);return r.contextValue[WR]={source:r.document?r.document||r.document[WR]:void 0,span:a,fields:{}},H(a,()=>FE(()=>n.apply(this,[r]),(e,n)=>{t._handleExecutionResult(a,e,n)}))}}}_handleExecutionResult(e,t,n){if(n===void 0||t){ZR(e,t);return}qR(n)?n.then(t=>{this._updateSpanFromResult(e,t),ZR(e)},t=>{ZR(e,t)}):(this._updateSpanFromResult(e,n),ZR(e))}_updateSpanFromResult(e,t){if(t.errors?.length&&!R(e).status&&e.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let n=R(e).data,r=n[HR.OPERATION_TYPE],i=n[HR.OPERATION_NAME];if(!r)return;let a=Xa(e),o=R(a).data[`sentry.graphql.operation`]||[],s=i?`${r} ${i}`:`${r}`;Array.isArray(o)?(o.push(s),a.setAttribute(iO,o)):typeof o==`string`?a.setAttribute(iO,[o,s]):a.setAttribute(iO,s),R(a).data[`original-description`]||a.setAttribute(`original-description`,R(a).description),a.updateName(`${R(a).data[`original-description`]} (${xz(o)})`)}_patchParse(){let e=this;return function(t){return function(n,r){return e._parse(this,t,n,r)}}}_patchValidate(){let e=this;return function(t){return function(n,r,i,a,o){return e._validate(this,t,n,r,i,o,a)}}}_parse(e,t,n,r){let i=V({name:VR.PARSE});return H(i,()=>FE(()=>t.call(e,n,r),(e,t)=>{t&&(QR(t)?t.loc&&JR(i,t.loc):i.updateName(VR.SCHEMA_PARSE)),ZR(i,e)}))}_validate(e,t,n,r,i,a,o){let s=V({name:VR.VALIDATE});return H(s,()=>FE(()=>t.call(e,n,r,i,o,a),(e,t)=>{r.loc||s.updateName(VR.SCHEMA_VALIDATE),ZR(s,e)}))}_createExecuteSpan(e,t){let n=V({name:VR.EXECUTE,attributes:{[L]:_z}});if(e){let{operation:t,name:r}=e;n.setAttribute(HR.OPERATION_TYPE,t);let i=r?.value;i?(n.setAttribute(HR.OPERATION_NAME,i),n.updateName(`${t} ${i}`)):n.updateName(t)}else{let e=` `;t.operationName&&(e=` "${t.operationName}" `),e=GR.replace(`$operationName$`,e),n.setAttribute(HR.OPERATION_NAME,e)}return t.document?.loc&&JR(n,t.document.loc),n}_wrapExecuteArgs(e,t,n,r,i,a,o,s,c){return r||={},r[WR]||this.getConfig().ignoreResolveSpans?{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s}:(o=hz(()=>this.getConfig(),o??c,o==null),e&&(lz(e.getQueryType(),()=>this.getConfig()),lz(e.getMutationType(),()=>this.getConfig())),{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s})}};function xz(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 Sz=`Graphql`,Cz=X(Sz,bz,e=>Tz(e)),wz=G(((e={})=>Td(cF(Tz(e)),{name:Sz,setupOnce(){Cz(Tz(e))}})));function Tz(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var Ez=`messaging.destination.partition.id`,Dz=`messaging.kafka.message.key`,Oz=`messaging.kafka.message.tombstone`,kz=`messaging.kafka.offset`,Az=`process`,jz=`receive`,Mz=`send`,Nz=`kafka`,Pz=`_OTHER`;x();var Fz=`auto.kafkajs.otel.producer`,Iz=`auto.kafkajs.otel.consumer`;function Lz(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function Rz(e){let t=Lz(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=Ca(t,Lz(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?p.SAMPLED:p.NONE}}]}function zz({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return V({name:`${a} ${e}`,kind:n===`receive`?K.CLIENT:K.CONSUMER,links:r,attributes:{...i,[Fl]:Nz,[jl]:e,[Pl]:n,[Nl]:a,[Dz]:t?.key?String(t.key):void 0,[Oz]:t?.key&&t.value===null?!0:void 0,[kz]:t?.offset,...t?{[L]:Iz}:{}}})}function Bz(e,t){let n=V({name:`send ${e}`,kind:K.PRODUCER,attributes:{[Fl]:Nz,[jl]:e,[Dz]:t.key?String(t.key):void 0,[Oz]:t.key&&t.value===null?!0:void 0,[Ez]:t.partition===void 0?void 0:String(t.partition),[Nl]:`send`,[Pl]:Mz,[L]:Fz}});t.headers=t.headers??{};let r=jp({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function Vz(e,t){return Promise.resolve(t).catch(t=>{let n,r=Pz;throw typeof t==`string`||t===void 0?n=t:typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`message`)&&(n=t.message,r=t.constructor.name),e.forEach(e=>{e.setAttribute(Ic,r),e.setStatus({code:2,message:n})}),t}).finally(()=>{e.forEach(e=>e.end())})}var Hz=`@sentry/instrumentation-kafkajs`,Uz=class extends J{constructor(e={}){super(Hz,A,e)}init(){let e=e=>{q(e?.Kafka?.prototype.producer)&&this._unwrap(e.Kafka.prototype,`producer`),q(e?.Kafka?.prototype.consumer)&&this._unwrap(e.Kafka.prototype,`consumer`)};return new Y(`kafkajs`,[`>=0.3.0 <3`],t=>(e(t),this._wrap(t?.Kafka?.prototype,`producer`,this._getProducerPatch()),this._wrap(t?.Kafka?.prototype,`consumer`,this._getConsumerPatch()),t),e)}_getConsumerPatch(){let e=this;return t=>function(...n){let r=t.apply(this,n);return q(r.run)&&e._unwrap(r,`run`),e._wrap(r,`run`,e._getConsumerRunPatch()),r}}_getProducerPatch(){let e=this;return t=>function(...n){let r=t.apply(this,n);return q(r.sendBatch)&&e._unwrap(r,`sendBatch`),e._wrap(r,`sendBatch`,e._getSendBatchPatch()),q(r.send)&&e._unwrap(r,`send`),e._wrap(r,`send`,e._getSendPatch()),q(r.transaction)&&e._unwrap(r,`transaction`),e._wrap(r,`transaction`,e._getProducerTransactionPatch()),r}}_getConsumerRunPatch(){let e=this;return t=>function(...n){let r=n[0];return r?.eachMessage&&(q(r.eachMessage)&&e._unwrap(r,`eachMessage`),e._wrap(r,`eachMessage`,e._getConsumerEachMessagePatch())),r?.eachBatch&&(q(r.eachBatch)&&e._unwrap(r,`eachBatch`),e._wrap(r,`eachBatch`,e._getConsumerEachBatchPatch())),t.call(this,r)}}_getConsumerEachMessagePatch(){return e=>function(...t){let n=t[0];return rs({sentryTrace:Lz(n.message.headers,`sentry-trace`),baggage:Lz(n.message.headers,`baggage`)},()=>{let r=zz({topic:n.topic,message:n.message,operationType:Az,attributes:{[Ez]:String(n.partition)}}),i=H(r,()=>e.apply(this,t));return Vz([r],i)})}}_getConsumerEachBatchPatch(){return e=>function(...t){let n=t[0],r=os(()=>zz({topic:n.batch.topic,message:void 0,operationType:jz,attributes:{[kl]:n.batch.messages.length,[Ez]:String(n.batch.partition)}}));return H(r,()=>{let i=[r];return n.batch.messages.forEach(e=>{i.push(zz({topic:n.batch.topic,message:e,operationType:Az,links:Rz(e.headers),attributes:{[Ez]:String(n.batch.partition)}}))}),Vz(i,e.apply(this,t))})}}_getProducerTransactionPatch(){let e=this;return t=>function(...n){let r=V({name:`transaction`}),i=t.apply(this,n);return i.then(t=>{let n=t.send;t.send=function(...t){return H(r,()=>e._getSendPatch()(n).apply(this,t).catch(e=>{throw r.setStatus({code:2,message:e?.message}),e}))};let i=t.sendBatch;t.sendBatch=function(...t){return H(r,()=>e._getSendBatchPatch()(i).apply(this,t).catch(e=>{throw r.setStatus({code:2,message:e?.message}),e}))};let a=t.commit;t.commit=function(...e){let t=a.apply(this,e).then(()=>{r.setStatus({code:1})});return Vz([r],t)};let o=t.abort;t.abort=function(...e){let t=o.apply(this,e);return Vz([r],t)}}).catch(e=>{r.setStatus({code:2,message:e?.message}),r.end()}),i}}_getSendBatchPatch(){return e=>function(...t){let n=t[0].topicMessages||[],r=[];return n.forEach(e=>{e.messages.forEach(t=>{r.push(Bz(e.topic,t))})}),Vz(r,e.apply(this,t))}}_getSendPatch(){return e=>function(...t){let n=t[0];return Vz(n.messages.map(e=>Bz(n.topic,e)),e.apply(this,t))}}},Wz=`Kafka`,Gz=X(Wz,()=>new Uz),Kz=G((()=>({name:Wz,setupOnce(){Gz()}}))),qz=`@sentry/instrumentation-lru-memoizer`,Jz=class extends J{constructor(){super(qz,A,{})}init(){return[new Y(`lru-memoizer`,[`>=1.3 <4`],e=>Object.assign(function(...t){let n=e.apply(this,t);return function(...e){let t=e.pop(),r=N(),i=typeof t==`function`?function(...e){return yi(r,()=>t.apply(this,e))}:t;return n.apply(this,[...e,i])}},{sync:e.sync}),void 0)]}},Yz=`LruMemoizer`,Xz=X(Yz,()=>new Jz),Zz=G((()=>({name:Yz,setupOnce(){Xz()}}))),Qz=`auto.db.otel.mongo`;function $z(e,t,n,r){return zF(e,t,n,r,Qz)}function eB(e,t,n,r){return HF(e,t,n,r,Qz)}function tB(e,t){let n=z(),r=!1;return function(...i){if(!r){r=!0;let t=i[0];e&&(t instanceof Error&&e.setStatus({code:2,message:t.message}),e.end())}return H(n??null,()=>t.apply(this,i))}}function nB(){return!z()}function rB(e){return t=>function(n,r,i,a,o){let s=typeof a==`function`?a:o;if(nB()||typeof s!=`function`||typeof i!=`object`)return typeof a==`function`?t.call(this,n,r,i,a):t.call(this,n,r,i,a,o);let c=tB(UF(eB(r,n,i[0],e)),s);return typeof a==`function`?t.call(this,n,r,i,c):t.call(this,n,r,i,a,c)}}function iB(){return e=>function(t,n,r,i,a){let o=typeof i==`function`?i:a;if(nB()||typeof o!=`function`||typeof r!=`object`)return typeof i==`function`?e.call(this,t,n,r,i):e.call(this,t,n,r,i,a);let s=tB(UF(eB(n,t,r,VF(r))),o);return typeof i==`function`?e.call(this,t,n,r,s):e.call(this,t,n,r,i,s)}}function aB(){return e=>function(t,n,r,i){let a=i,o=Object.keys(n)[0];if(typeof n!=`object`||n.ismaster||n.hello)return e.call(this,t,n,r,i);let s;nB()||(s=UF($z(this,t,n,o)));let c=tB(s,a);return e.call(this,t,n,r,c)}}function oB(){return e=>function(...t){let[n,r]=t,i=Object.keys(r)[0],a=()=>void 0;if(typeof r!=`object`||r.ismaster||r.hello)return e.apply(this,t);let o;nB()||(o=UF($z(this,n,r,i)));let s=tB(o,a),c=e.apply(this,t);return c.then(e=>s(null,e),e=>s(e)),c}}function sB(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(nB()||typeof s!=`function`||typeof r!=`object`)return typeof a==`function`?e.call(this,t,n,r,i,a):e.call(this,t,n,r,i,a,o);let c=tB(UF(eB(n,t,r,`find`)),s);return typeof a==`function`?e.call(this,t,n,r,i,c):e.call(this,t,n,r,i,a,c)}}function cB(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(nB()||typeof s!=`function`)return typeof a==`function`?e.call(this,t,n,r,i,a):e.call(this,t,n,r,i,a,o);let c=tB(UF(eB(n,t,r.cmd,`getMore`)),s);return typeof a==`function`?e.call(this,t,n,r,i,c):e.call(this,t,n,r,i,a,c)}}function lB(){return e=>function(t){let n=z();return e.call(this,function(...e){return H(n??null,()=>t.apply(this,e))})}}var uB=`@sentry/instrumentation-mongodb`,dB=class extends J{constructor(e={}){super(uB,A,e)}init(){let{v3PatchConnection:e,v3UnpatchConnection:t}=this._getV3ConnectionPatches(),{v4PatchConnectionCallback:n,v4PatchConnectionPromise:r,v4UnpatchConnection:i}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:a,v4UnpatchConnectionPool:o}=this._getV4ConnectionPoolPatches();return[new Y(`mongodb`,[`>=3.3.0 <4`],void 0,void 0,[new RR(`mongodb/lib/core/wireprotocol/index.js`,[`>=3.3.0 <4`],e,t)]),new Y(`mongodb`,[`>=4.0.0 <8`],void 0,void 0,[new RR(`mongodb/lib/cmap/connection.js`,[`>=4.0.0 <6.4`],n,i),new RR(`mongodb/lib/cmap/connection.js`,[`>=6.4.0 <8`],r,i),new RR(`mongodb/lib/cmap/connection_pool.js`,[`>=4.0.0 <6.4`],a,o)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>(q(e.insert)&&this._unwrap(e,`insert`),this._wrap(e,`insert`,rB(`insert`)),q(e.remove)&&this._unwrap(e,`remove`),this._wrap(e,`remove`,rB(`remove`)),q(e.update)&&this._unwrap(e,`update`),this._wrap(e,`update`,rB(`update`)),q(e.command)&&this._unwrap(e,`command`),this._wrap(e,`command`,iB()),q(e.query)&&this._unwrap(e,`query`),this._wrap(e,`query`,sB()),q(e.getMore)&&this._unwrap(e,`getMore`),this._wrap(e,`getMore`,cB()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,`insert`),this._unwrap(e,`remove`),this._unwrap(e,`update`),this._unwrap(e,`command`),this._unwrap(e,`query`),this._unwrap(e,`getMore`))}}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let t=e.ConnectionPool.prototype;return q(t.checkOut)&&this._unwrap(t,`checkOut`),this._wrap(t,`checkOut`,lB()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,`checkOut`)}}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>(q(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,aB()),e),v4PatchConnectionPromise:e=>(q(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,oB()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,`command`)}}}},fB=`Mongo`,pB=X(fB,()=>new dB),mB=G((()=>({name:fB,setupOnce(){pB()}})));function hB(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
31
- Mongoose Error Code: ${t.code}`:``}`})}function gB(e,t){return e instanceof Promise?e.catch(e=>{throw hB(t,e),e}).finally(()=>t.end()):(t.end(),e)}function _B(e,t,n,r,i){let a=0;return i.length===2?a=1:i.length===3&&(a=2),i[a]=(t,n)=>(t&&hB(r,t),r.end(),e(t,n)),t.apply(n,i)}var vB=`@sentry/instrumentation-mongoose`,yB=`auto.db.otel.mongoose`,bB=[`deleteOne`,`deleteMany`,`find`,`findOne`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`],xB=[`remove`,`count`,`findOneAndRemove`,...bB],SB=[`count`,`findOneAndRemove`,...bB],CB=[...bB];function wB(e){return e?e.startsWith(`6.`)||e.startsWith(`5.`)?xB:e.startsWith(`7.`)?SB:CB:bB}function TB(e){return e&&(e.startsWith(`5.`)||e.startsWith(`6.`))||!1}function EB(e){return!e||!e.startsWith(`8.`)?!1:parseInt(e.split(`.`)[1],10)>=21}var DB=Symbol(`stored-parent-span`),OB=Symbol(`already-instrumented`),kB=class extends J{constructor(e={}){super(vB,A,e)}init(){return new Y(`mongoose`,[`>=5.9.7 <9.7.0`],this.patch.bind(this),this.unpatch.bind(this))}patch(e,t){let n=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;return this._wrap(n.Model.prototype,`save`,this.patchOnModelMethods(`save`)),n.Model.prototype.$save=n.Model.prototype.save,TB(t)&&this._wrap(n.Model.prototype,`remove`,this.patchOnModelMethods(`remove`)),EB(t)&&(this._wrap(n.Model.prototype,`updateOne`,this._patchDocumentUpdateMethods(`updateOne`)),this._wrap(n.Model.prototype,`deleteOne`,this._patchDocumentUpdateMethods(`deleteOne`))),this._wrap(n.Query.prototype,`exec`,this.patchQueryExec()),this._wrap(n.Aggregate.prototype,`exec`,this.patchAggregateExec()),wB(t).forEach(e=>{this._wrap(n.Query.prototype,e,this.patchAndCaptureSpanContext(e))}),this._wrap(n.Model,`aggregate`,this.patchModelAggregate()),this._wrap(n.Model,`insertMany`,this.patchModelStatic(`insertMany`)),this._wrap(n.Model,`bulkWrite`,this.patchModelStatic(`bulkWrite`)),n}unpatch(e,t){let n=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e,r=wB(t);this._unwrap(n.Model.prototype,`save`),n.Model.prototype.$save=n.Model.prototype.save,TB(t)&&this._unwrap(n.Model.prototype,`remove`),EB(t)&&(this._unwrap(n.Model.prototype,`updateOne`),this._unwrap(n.Model.prototype,`deleteOne`)),this._unwrap(n.Query.prototype,`exec`),this._unwrap(n.Aggregate.prototype,`exec`),r.forEach(e=>{this._unwrap(n.Query.prototype,e)}),this._unwrap(n.Model,`aggregate`),this._unwrap(n.Model,`insertMany`),this._unwrap(n.Model,`bulkWrite`)}patchAggregateExec(){let e=this;return t=>function(n){let r=this[DB],i=jR({collection:this._model.collection,modelName:this._model?.modelName,operation:`aggregate`,origin:yB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchQueryExec(){let e=this;return t=>function(n){if(this[OB])return t.apply(this,arguments);let r=this[DB],i=jR({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:yB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchOnModelMethods(e){let t=this;return n=>function(r,i){let a=jR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:yB});return r instanceof Function&&(i=r),t._handleResponse(a,n,this,arguments,i)}}_patchDocumentUpdateMethods(e){let t=this;return n=>function(r,i,a){let o=a;typeof r==`function`?o=r:typeof i==`function`&&(o=i);let s=jR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:yB}),c=t._handleResponse(s,n,this,arguments,o);return c&&typeof c==`object`&&(c[OB]=!0),c}}patchModelStatic(e){let t=this;return n=>function(r,i,a){typeof i==`function`&&(a=i);let o=jR({collection:this.collection,modelName:this.modelName,operation:e,origin:yB});return t._handleResponse(o,n,this,arguments,a)}}patchModelAggregate(){return e=>function(){let t=z(),n=e.apply(this,arguments);return n&&(n[DB]=t),n}}patchAndCaptureSpanContext(e){return e=>function(){return this[DB]=z(),e.apply(this,arguments)}}_handleResponse(e,t,n,r,i){return H(e,()=>i instanceof Function?_B(i,t,n,e,r):gB(t.apply(n,r),e))}},AB=`Mongoose`,jB=X(AB,()=>new kB),MB=G((()=>Td(wF(),{name:AB,setupOnce(){jB()}}))),NB=`db.connection_string`,PB=`mysql`;function FB(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function IB(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function LB(e){return typeof e==`string`?e:e.sql}function RB(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var zB=`@sentry/instrumentation-mysql`,BB=`auto.db.otel.mysql`,VB=class extends J{constructor(e={}){super(zB,A,e)}init(){return[new Y(`mysql`,[`>=2.0.0 <3`],e=>(q(e.createConnection)&&this._unwrap(e,`createConnection`),this._wrap(e,`createConnection`,this._patchCreateConnection()),q(e.createPool)&&this._unwrap(e,`createPool`),this._wrap(e,`createPool`,this._patchCreatePool()),q(e.createPoolCluster)&&this._unwrap(e,`createPoolCluster`),this._wrap(e,`createPoolCluster`,this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,`createConnection`),this._unwrap(e,`createPool`),this._unwrap(e,`createPoolCluster`))})]}_patchCreateConnection(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`query`,t._patchQuery(r)),r}}}_patchCreatePool(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`query`,t._patchQuery(r)),t._wrap(r,`getConnection`,t._patchGetConnection(r)),r}}}_patchCreatePoolCluster(){return e=>{let t=this;return function(n){let r=e(...arguments);return t._wrap(r,`getConnection`,t._patchGetConnection(r)),r}}}_patchGetConnection(e){return t=>{let n=this;return function(r,i,a){if(!n._enabled)return n._unwrap(e,`getConnection`),t.apply(e,arguments);if(arguments.length===1&&typeof r==`function`){let i=n._getConnectionCallbackPatchFn(r);return t.call(e,i)}if(arguments.length===2&&typeof i==`function`){let a=n._getConnectionCallbackPatchFn(i);return t.call(e,r,a)}if(arguments.length===3&&typeof a==`function`){let o=n._getConnectionCallbackPatchFn(a);return t.call(e,r,i,o)}return t.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let t=this,n=N();return function(r,i){i&&(q(i.query)||t._wrap(i,`query`,t._patchQuery(i))),typeof e==`function`&&yi(n,()=>e.call(this,r,i))}}_patchQuery(e){return t=>{let n=this;return function(r,i,a){if(!n._enabled)return n._unwrap(e,`query`),t.apply(e,arguments);let{host:o,port:s,database:c,user:l}=FB(e.config),u=parseInt(String(s),10),d={[L]:BB,[Nc]:PB,[NB]:IB(o,s,c),[Ec]:c,[Fc]:l,[Mc]:LB(r),[Wl]:o};isNaN(u)||(d[Gl]=u);let f=V({name:RB(r),kind:K.CLIENT,attributes:d}),p=Array.from(arguments).findIndex(e=>typeof e==`function`),m=N();if(p===-1){let n=H(f,()=>t.apply(e,arguments));return ks(n,m),n.on(`error`,e=>{f.setStatus({code:2,message:e.message})}).on(`end`,()=>{f.end()})}return n._wrap(arguments,p,n._patchCallbackQuery(f,m)),H(f,()=>t.apply(e,arguments))}}}_patchCallbackQuery(e,t){return n=>function(r,i,a){return r&&e.setStatus({code:2,message:r.message}),e.end(),yi(t,()=>n(...arguments))}}},HB=`Mysql`,UB=X(HB,()=>new VB({})),WB=G((()=>({name:HB,setupOnce(){UB()}}))),GB=`db.connection_string`,KB=`mysql`;function qB(e){let{host:t,port:n,database:r,user:i}=JB(e),a={[GB]:YB(t,n,r),[Ec]:r,[Fc]:i,[Wl]:t},o=parseInt(n,10);return isNaN(o)||(a[Gl]=o),a}function JB(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function YB(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function XB(e,t,n){let[r,i]=typeof e==`string`?[e,n]:[e.sql,ZB(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 ZB(e){return`values`in e}function QB(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var $B=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function eV(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query==`function`&&typeof n?.execute==`function`?n:t}var tV=`@sentry/instrumentation-mysql2`,nV=`auto.db.otel.mysql2`,rV=[`>=1.4.2 <3.20.0`],iV=class extends J{constructor(e={}){super(tV,A,e)}init(){let e;function t(t){!e&&t.format&&(e=t.format)}let n=t=>{q(t.query)&&this._unwrap(t,`query`),this._wrap(t,`query`,this._patchQuery(e)),q(t.execute)&&this._unwrap(t,`execute`),this._wrap(t,`execute`,this._patchQuery(e))},r=e=>{this._unwrap(e,`query`),this._unwrap(e,`execute`)};return[new Y(`mysql2`,rV,e=>(t(e),e),()=>{},[new RR(`mysql2/promise.js`,rV,e=>(t(e),e),()=>{}),new RR(`mysql2/lib/connection.js`,rV,e=>{let t=eV(e);return n(t),e},e=>{if(e===void 0)return;let t=eV(e);r(t)})])]}_patchQuery(e){let t=this;return n=>function(r,i,a){let o;Array.isArray(i)?o=i:arguments[2]&&(o=[i]);let s={...qB(this.config),[Nc]:KB,[Mc]:XB(r,e,o),[L]:nV},c=V({name:QB(r),kind:K.CLIENT,attributes:s}),l=$B(e=>{e&&c.setStatus({code:2,message:e.message}),c.end()});if(arguments.length===1){typeof r.onResult==`function`&&t._wrap(r,`onResult`,t._patchCallbackQuery(l));let e=n.apply(this,arguments);return e.once(`error`,e=>{l(e)}).once(`result`,()=>{l()}),e}return typeof arguments[1]==`function`?t._wrap(arguments,1,t._patchCallbackQuery(l)):typeof arguments[2]==`function`&&t._wrap(arguments,2,t._patchCallbackQuery(l)),n.apply(this,arguments)}}_patchCallbackQuery(e){return t=>function(...n){return e(n[0]),t(...n)}}},aV=`Mysql2`,oV=X(aV,()=>new iV),sV=G((()=>Td(eI(),{name:aV,setupOnce(){oV()}}))),cV,lV;function uV(e){cV=e}function dV(){return!!cV}function fV(){if(cV)return lV??=cV()}var pV=[`get`,`set`,`setex`],mV=[`get`,`mget`],hV=[`set`,`setex`],gV=[`del`,`unlink`];function _V(e,t){return e.includes(t.toLowerCase())}function vV(e){if(_V(mV,e))return`cache.get`;if(_V(hV,e))return`cache.put`;if(_V(gV,e))return`cache.remove`}function yV(e,t){return t.some(t=>e.startsWith(t))}function bV(e,t){try{if(t.length===0)return;let n=e=>typeof e==`string`||typeof e==`number`||Buffer.isBuffer(e)?[e.toString()]:Array.isArray(e)?CV(e.map(e=>n(e))):[`<unknown>`],r=t[0];return _V(pV,e)&&r!=null?n(r):CV(t.map(e=>n(e)))}catch{return}}function xV(e,t,n){if(!vV(e))return!1;for(let e of t)if(yV(e,n))return!0;return!1}function SV(e){let t=e=>{try{return Buffer.isBuffer(e)?e.byteLength:typeof e==`string`?e.length:typeof e==`number`?e.toString().length:e==null?0:JSON.stringify(e).length}catch{return}};return Array.isArray(e)?e.reduce((e,n)=>{let r=t(n);return typeof r==`number`?e===void 0?r:e+r:e},0):t(e)}function CV(e){let t=[],n=e=>{e.forEach(e=>{Array.isArray(e)?n(e):t.push(e)})};return n(e),t}var wV={};function TV(e){wV=e}var EV=(e,t,n,r)=>{let i=bV(t,n),a=vV(t);if(!i||!a||!wV.cachePrefixes||!xV(t,i,wV.cachePrefixes))return;let o=R(e).data,s=o[`net.peer.name`]??o[`server.address`],c=o[`net.peer.port`]??o[`server.port`];c&&s&&e.setAttributes({"network.peer.address":s,"network.peer.port":c});let l=_V(gV,t)?void 0:SV(r);l&&e.setAttribute(Ri,l),_V(mV,t)&&l!==void 0&&e.setAttribute(Ii,l>0),e.setAttributes({[I]:a,[Li]:i});let u=i.join(`, `);e.updateName(wV.maxCacheKeyLength?mr(u,wV.maxCacheKeyLength):u)},DV=`db.connection_string`,OV=`redis`,kV=`@sentry/instrumentation-ioredis`,AV=`auto.db.otel.redis`,jV=[`>=2.0.0 <5.11.0`];function MV(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var NV=class extends J{constructor(e={}){super(kV,A,e)}init(){return[new Y(`ioredis`,jV,e=>{let t=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;return q(t.prototype.sendCommand)&&this._unwrap(t.prototype,`sendCommand`),this._wrap(t.prototype,`sendCommand`,this._patchSendCommand()),q(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`connect`,this._patchConnection()),e},e=>{if(e===void 0)return;let t=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;this._unwrap(t.prototype,`sendCommand`),this._unwrap(t.prototype,`connect`)})]}_patchSendCommand(){let e=this;return t=>function(...n){let r=n[0];if(n.length<1||typeof r!=`object`||!z())return t.apply(this,n);let{host:i,port:a}=this.options,o={[Nc]:OV,[Mc]:RI(r.name,r.args),[DV]:`redis://${i}:${a}`,[Wl]:i,[Gl]:a,[L]:AV},s=V({name:r.name,kind:K.CLIENT,attributes:o});try{let i=t.apply(this,n),a=r.resolve;r.resolve=function(t){e._callResponseHook(s,r,t),MV(s,null),a(t)};let o=r.reject;return r.reject=function(e){MV(s,e),o(e)},i}catch(e){throw MV(s,e),e}}}_patchConnection(){return e=>function(...t){if(!z())return e.apply(this,t);let{host:n,port:r}=this.options,i={[Nc]:OV,[Mc]:`connect`,[DV]:`redis://${n}:${r}`,[Wl]:n,[Gl]:r,[L]:AV},a=V({name:`connect`,kind:K.CLIENT,attributes:i});try{let n=e.apply(this,t);return n instanceof Promise?n.then(e=>(MV(a,null),e),e=>(MV(a,e),Promise.reject(e))):(MV(a,null),n)}catch(e){throw MV(a,e),e}}}_callResponseHook(e,t,n){let{responseHook:r}=this.getConfig();if(r)try{r(e,t.name,t.args,n)}catch{}}},PV=`@sentry/instrumentation-redis`,FV=`auto.db.otel.redis`,IV=Symbol(`opentelemetry.instrumentation.redis.open_spans`),LV=Symbol(`opentelemetry.instrumentation.redis.multi_command_options`);function RV(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function zV(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function BV(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(e){aP&&j.error(`failed to sanitize redis connection url`,e)}}function VV(e){return{[Nc]:OV,[Wl]:e?.socket?.host,[Gl]:e?.socket?.port,[DV]:BV(e?.url),[L]:FV}}var HV=class e extends J{constructor(e={}){super(PV,A,e)}init(){return[new Y(`redis`,[`>=2.6.0 <4`],e=>(q(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,`internal_send_command`),this._wrap(e.RedisClient.prototype,`internal_send_command`,this._getPatchInternalSendCommand()),e),e=>{e!==void 0&&this._unwrap(e.RedisClient.prototype,`internal_send_command`)})]}_getPatchInternalSendCommand(){let t=this;return function(n){return function(r){if(arguments.length!==1||typeof r!=`object`)return n.apply(this,arguments);let i={[Nc]:OV,[Mc]:RI(r.command,r.args),[L]:FV};this.connection_options&&(i[Wl]=this.connection_options.host,i[Gl]=this.connection_options.port),this.address&&(i[DV]=`redis://${this.address}`);let a=V({name:`${e.COMPONENT}-${r.command}`,kind:K.CLIENT,attributes:i}),o=arguments[0].callback;if(o){let e=z();arguments[0].callback=function(n,i){return zV(t.getConfig().responseHook,a,r.command,r.args,i),RV(a,n),H(e??null,()=>o.apply(this,arguments))}}try{return n.apply(this,arguments)}catch(e){throw RV(a,e),e}}}}};HV.COMPONENT=`redis`;var UV=HV,WV=class e extends J{constructor(e={}){super(PV,A,e)}init(){return[this._getInstrumentationNodeModuleDefinition(`@redis/client`),this._getInstrumentationNodeModuleDefinition(`@node-redis/client`)]}_getInstrumentationNodeModuleDefinition(e){return new Y(e,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>e,()=>{},[new RR(`${e}/dist/lib/commander.js`,[`^1.0.0`],(e,t)=>{let n=e.transformCommandArguments;if(!n)return aP&&j.error(`internal instrumentation error, missing transformCommandArguments function`),e;let r=t?.startsWith(`1.0.`)?`extendWithCommands`:`attachCommands`;return q(e?.[r])&&this._unwrap(e,r),this._wrap(e,r,this._getPatchExtendWithCommands(n)),e},e=>{q(e?.extendWithCommands)&&this._unwrap(e,`extendWithCommands`),q(e?.attachCommands)&&this._unwrap(e,`attachCommands`)}),new RR(`${e}/dist/lib/client/multi-command.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return q(t?.exec)&&this._unwrap(t,`exec`),this._wrap(t,`exec`,this._getPatchMultiCommandsExec()),q(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),this._wrap(t,`execAsPipeline`,this._getPatchMultiCommandsExec()),q(t?.addCommand)&&this._unwrap(t,`addCommand`),this._wrap(t,`addCommand`,this._getPatchMultiCommandsAddCommand()),e},e=>{let t=e?.default?.prototype;q(t?.exec)&&this._unwrap(t,`exec`),q(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),q(t?.addCommand)&&this._unwrap(t,`addCommand`)}),new RR(`${e}/dist/lib/client/index.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return t?.multi&&(q(t?.multi)&&this._unwrap(t,`multi`),this._wrap(t,`multi`,this._getPatchRedisClientMulti())),t?.MULTI&&(q(t?.MULTI)&&this._unwrap(t,`MULTI`),this._wrap(t,`MULTI`,this._getPatchRedisClientMulti())),q(t?.sendCommand)&&this._unwrap(t,`sendCommand`),this._wrap(t,`sendCommand`,this._getPatchRedisClientSendCommand()),q(t?.connect)&&this._unwrap(t,`connect`),this._wrap(t,`connect`,this._getPatchedClientConnect()),e},e=>{let t=e?.default?.prototype;q(t?.multi)&&this._unwrap(t,`multi`),q(t?.MULTI)&&this._unwrap(t,`MULTI`),q(t?.sendCommand)&&this._unwrap(t,`sendCommand`),q(t?.connect)&&this._unwrap(t,`connect`)})])}_getPatchExtendWithCommands(e){let t=this;return function(n){return function(r){if(r?.BaseClass?.name!==`RedisClient`)return n.apply(this,arguments);let i=r.executor;return r.executor=function(n,r){let a=e(n,r).args;return t._traceClientCommand(i,this,arguments,a)},n.apply(this,arguments)}}}_getPatchMultiCommandsExec(){let e=this;return function(t){return function(){let n=t.apply(this,arguments);return typeof n?.then==`function`?n.then(t=>{let n=this[IV];return e._endSpansWithRedisReplies(n,t),t}).catch(t=>{let n=this[IV];if(!n)aP&&j.error(`cannot find open spans to end for multi/pipeline`);else{let r=t.constructor.name===`MultiErrorReply`?t.replies:Array(n.length).fill(t);e._endSpansWithRedisReplies(n,r)}return Promise.reject(t)}):(aP&&j.error(`non-promise result when patching exec/execAsPipeline`),n)}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(t){return function(n){return e._traceClientCommand(t,this,arguments,n)}}}_getPatchRedisClientMulti(){return function(e){return function(){let t=e.apply(this,arguments);return t[LV]=this.options,t}}}_getPatchRedisClientSendCommand(){let e=this;return function(t){return function(n){return e._traceClientCommand(t,this,arguments,n)}}}_getPatchedClientConnect(){return function(t){return function(){let n=VV(this.options),r=V({name:`${e.COMPONENT}-connect`,kind:K.CLIENT,attributes:n});return H(r,()=>t.apply(this)).then(e=>(r.end(),e),e=>(RV(r,e),Promise.reject(e)))}}}_traceClientCommand(t,n,r,i){let a=n.options||n[LV],o=i[0],s=i.slice(1),c=VV(a),l=RI(o,s);l!=null&&(c[Mc]=l);let u=V({name:`${e.COMPONENT}-${o}`,kind:K.CLIENT,attributes:c}),d=H(u,()=>t.apply(n,r));if(d instanceof Promise)d.then(e=>{this._endSpanWithResponse(u,o,s,e,void 0)},e=>{this._endSpanWithResponse(u,o,s,null,e)});else{let e=d;e[IV]=e[IV]||[],e[IV].push({span:u,commandName:o,commandArgs:s})}return d}_endSpansWithRedisReplies(e,t){if(!e){aP&&j.error(`cannot find open spans to end for redis multi/pipeline`);return}if(t.length!==e.length){aP&&j.error(`number of multi command spans does not match response from redis`);return}for(let n=0;n<e.length;n++){let{span:r,commandName:i,commandArgs:a}=e[n],o=t[n],[s,c]=o instanceof Error?[null,o]:[o,void 0];this._endSpanWithResponse(r,i,a,s,c)}}_endSpanWithResponse(e,t,n,r,i){i||zV(this.getConfig().responseHook,e,t,n,r),RV(e,i)}};WV.COMPONENT=`redis`;var GV=WV,KV=class extends J{constructor(e={}){super(PV,A,e),this.initialized=!1,this.instrumentationV2_V3=new UV(this.getConfig()),this.instrumentationV4_V5=new GV(this.getConfig()),this.initialized=!0}setConfig(e={}){super.setConfig(e),this.initialized&&(this.instrumentationV2_V3.setConfig(e),this.instrumentationV4_V5.setConfig(e))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}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())}},qV=`Redis`,JV=X(`${qV}.IORedis`,()=>new NV({responseHook:EV})),YV=X(`${qV}.Redis`,()=>new KV({responseHook:EV})),XV=Object.assign(()=>{(!dV()||!T.tracingChannel)&&(JV(),YV())},{id:qV}),ZV=G(((e={})=>Td(II({responseHook:EV}),{name:qV,setupOnce(){TV(e),XV()}}))),QV=(e=>(e.QUERY_PREFIX=`pg.query`,e.CONNECT=`pg.connect`,e.POOL_CONNECT=`pg-pool.connect`,e))(QV||{}),$V=(e=>(e.PG_PLAN=`db.postgresql.plan`,e.IDLE_TIMEOUT_MILLIS=`db.postgresql.idle.timeout.millis`,e.MAX_CLIENT=`db.postgresql.max.client`,e))($V||{}),eH=`db.connection_string`,tH=`postgresql`,nH=`auto.db.otel.postgres`;function rH(e,t){if(!t)return QV.QUERY_PREFIX;let n=typeof t.name==`string`&&t.name?t.name:iH(t.text);return`${QV.QUERY_PREFIX}:${n}${e?` ${e}`:``}`}function iH(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 aH(e){try{let t=new URL(e);return t.username=``,t.password=``,t.toString()}catch{return`postgresql://localhost:5432/`}}function oH(e){return`connectionString`in e&&e.connectionString?aH(e.connectionString):`postgresql://${e.host||`localhost`}:${e.port||5432}/${e.database||``}`}function sH(e){if(Number.isInteger(e))return e}function cH(e){return{[Nc]:tH,[Ec]:e.database,[eH]:oH(e),[Fc]:e.user,[Wl]:e.host,[Gl]:sH(e.port)}}function lH(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[$V.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[$V.MAX_CLIENT]:e.maxClient,[Nc]:tH,[Ec]:t?.pathname.slice(1)??e.database,[eH]:oH(e),[Wl]:t?.hostname??e.host,[Gl]:Number(t?.port)||sH(e.port),[Fc]:t?.username??e.user}}function uH(){return z()===void 0}function dH(e){let{connectionParameters:t}=this,n=t.database,r=V({name:rH(n,e),kind:K.CLIENT,attributes:{...cH(t),[L]:nH}});return e?(e.text&&r.setAttribute(Mc,e.text),typeof e.name==`string`&&r.setAttribute($V.PG_PLAN,e.name),r):r}function fH(e,t){return function(n,r){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r)}}function pH(e,t){return function(n,r,i){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r,i)}}function mH(e,t){return function(...n){let r=n[0];r instanceof Error&&e.setStatus({code:2,message:r.message}),e.end(),t.apply(this,n)}}function hH(e){return typeof e==`object`&&e&&`message`in e?String(e.message):void 0}function gH(e){return typeof e==`object`&&typeof e?.text==`string`}var _H=`@sentry/instrumentation-pg`;function vH(e){return e[Symbol.toStringTag]===`Module`?e.default:e}function yH(e,t){return function(...n){return H(e,()=>t.apply(this,n))}}var bH=class extends J{constructor(e={}){super(_H,A,e)}init(){let e=[`>=8.0.3 <9`],t=[`>=2.0.0 <4`],n=new RR(`pg/lib/native/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this));return[new Y(`pg`,e,e=>{let t=vH(e);return this._patchPgClient(t.Client),e},e=>{let t=vH(e);return this._unpatchPgClient(t.Client),e},[new RR(`pg/lib/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),n]),new Y(`pg-pool`,t,e=>{let t=vH(e);return q(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`connect`,this._getPoolConnectPatch()),t},e=>{let t=vH(e);q(t.prototype.connect)&&this._unwrap(t.prototype,`connect`)})]}_patchPgClient(e){if(!e)return;let t=vH(e);return q(t.prototype.query)&&this._unwrap(t.prototype,`query`),q(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`query`,this._getClientQueryPatch()),this._wrap(t.prototype,`connect`,this._getClientConnectPatch()),e}_unpatchPgClient(e){let t=vH(e);return q(t.prototype.query)&&this._unwrap(t.prototype,`query`),q(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),e}_getClientConnectPatch(){let e=this;return t=>function(n){if(uH()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=V({name:QV.CONNECT,kind:K.CLIENT,attributes:cH(this)}),i=n;if(i){let e=z();i=mH(r,i),e&&(i=yH(e,i))}return xH(r,H(r,()=>t.call(this,i)))}}_getClientQueryPatch(){return e=>(this._diag.debug(`Patching pg.Client.prototype.query`),function(...t){if(uH())return e.apply(this,t);let n=t[0],r=typeof n==`string`,i=gH(n),a=r?{text:n,values:Array.isArray(t[1])?t[1]:void 0}:i?{...n,name:n.name,text:n.text,values:n.values??(Array.isArray(t[1])?t[1]:void 0)}:void 0,o=dH.call(this,a);if(t.length>0){let e=z();if(typeof t[t.length-1]==`function`)t[t.length-1]=fH(o,t[t.length-1]),e&&(t[t.length-1]=yH(e,t[t.length-1]));else if(typeof a?.callback==`function`){let n=fH(o,a.callback);e&&(n=yH(e,n)),t[0].callback=n}}let s;try{s=e.apply(this,t)}catch(e){throw o.setStatus({code:2,message:hH(e)}),o.end(),e}return s instanceof Promise?s.then(e=>(o.end(),e)).catch(e=>(o.setStatus({code:2,message:hH(e)}),o.end(),Promise.reject(e))):s})}_getPoolConnectPatch(){let e=this;return t=>function(n){if(uH()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=V({name:QV.POOL_CONNECT,kind:K.CLIENT,attributes:lH(this.options)}),i=n;if(i){let e=z();i=pH(r,i),e&&(i=yH(e,i))}return xH(r,H(r,()=>t.call(this,i)))}}};function xH(e,t){return t instanceof Promise?t.then(t=>(e.end(),t)).catch(t=>(e.setStatus({code:2,message:hH(t)}),e.end(),Promise.reject(t))):t}var SH=`Postgres`,CH=X(SH,bH,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),wH=G((e=>({name:SH,setupOnce(){CH(e)}})));x();var TH=`PostgresJs`,EH=[`>=3.0.0 <4`],DH=`db.response.status_code`,OH=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,kH=Symbol.for(`sentry.query.from.instrumented.sql`),AH=X(TH,e=>new jH({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),jH=class extends J{constructor(e){super(`sentry-postgres-js`,A,e)}init(){let e=new Y(`postgres`,EH,e=>{try{return this._patchPostgres(e)}catch(t){return aP&&j.error(`Failed to patch postgres module:`,t),e}},e=>e);return[`src`,`cf/src`,`cjs/src`].forEach(t=>{e.files.push(new RR(`postgres/${t}/query.js`,EH,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let t=typeof e==`function`,n=t?e:e.default;if(typeof n!=`function`)return aP&&j.warn(`postgres module does not export a function. Skipping instrumentation.`),e;let r=this,i=function(...e){let t=Reflect.construct(n,e);if(!t||typeof t!=`function`)return aP&&j.warn(`postgres() did not return a valid instance`),t;let i=r.getConfig();return uw(t,{requireParentSpan:i.requireParentSpan,requestHook:i.requestHook})};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let e of Object.getOwnPropertyNames(n))if(![`length`,`name`,`prototype`].includes(e)){let t=Object.getOwnPropertyDescriptor(n,e);t&&Object.defineProperty(i,e,t)}return t?i:(xx(e,`default`,i),e)}_shouldCreateSpans(){let e=this.getConfig();return g.getSpan(r.active())!==void 0||!e.requireParentSpan}_setOperationName(e,t,n){if(n){e.setAttribute(Ac,n);return}let r=t?.match(OH);r?.[1]&&e.setAttribute(Ac,r[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}_sanitizeSqlQuery(e){return e?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(/(?<!\$)-?\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(e){let t=this,n=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...e){if(this.executed||this[kH]||!t._shouldCreateSpans())return n.apply(this,e);let r=t._reconstructQuery(this.strings),i=t._sanitizeSqlQuery(r);return es({name:i||`postgresjs.query`,op:`db`},r=>{xN(r,`auto.db.postgresjs`),r.setAttributes({[Pc]:`postgres`,[jc]:i});let{requestHook:a}=t.getConfig();a&&FE(()=>a(r,i,void 0),e=>{e&&(r.setAttribute(`sentry.hook.error`,`requestHook failed`),aP&&j.error(`Error in requestHook for ${TH} integration:`,e))},!0);let o=this.resolve;this.resolve=new Proxy(o,{apply:(e,n,a)=>{try{t._setOperationName(r,i,a?.[0]?.command),r.end()}catch(e){aP&&j.error(`Error ending span in resolve callback:`,e)}return Reflect.apply(e,n,a)}});let s=this.reject;this.reject=new Proxy(s,{apply:(e,n,a)=>{try{r.setStatus({code:2,message:a?.[0]?.message||`unknown_error`}),r.setAttribute(DH,a?.[0]?.code||`unknown`),r.setAttribute(Ic,a?.[0]?.name||`unknown`),t._setOperationName(r,i),r.end()}catch(e){aP&&j.error(`Error ending span in reject callback:`,e)}return Reflect.apply(e,n,a)}});try{return n.apply(this,e)}catch(e){throw r.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),r.end(),e}})},e.Query.prototype.handle.__sentry_original__=n,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},MH=G((e=>({name:TH,setupOnce(){AH(e)}}))),NH=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(NH||{}),PH=`@hapi/hapi`,FH=Symbol(`hapi-handler-patched`),IH={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},LH=new Set([`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`]);function RH(e){return e.name?e.name:e.pkg.name}var zH=e=>typeof e==`string`&&LH.has(e),BH=e=>{let t=e?.type;return t!==void 0&&zH(t)},VH=e=>Array.isArray(e)&&e.length<=3&&zH(e[0])&&typeof e[1]==`function`,HH=e=>!Array.isArray(e),UH=(e,t)=>{let n={[xl]:e.path,[vl]:e.method},r;return t?(n[NH.HAPI_TYPE]=IH.PLUGIN,n[NH.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[NH.HAPI_TYPE]=IH.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},WH=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[NH.EXT_TYPE]:e,[NH.HAPI_TYPE]:IH.EXT,[NH.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[NH.EXT_TYPE]:e,[NH.HAPI_TYPE]:IH.EXT},name:r}},GH=e=>`plugin`in e?`plugin`in e.plugin?e.plugin.plugin:e.plugin:e;x();var KH=`@sentry/instrumentation-hapi`,qH=class extends J{constructor(e={}){super(KH,A,e)}init(){return new Y(PH,[`>=17.0.0 <22`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return q(t.server)||this._wrap(t,`server`,this._getServerPatch.bind(this)),q(t.Server)||this._wrap(t,`Server`,this._getServerPatch.bind(this)),t},e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;this._massUnwrap([t],[`server`,`Server`])})}_getServerPatch(e){let t=this,n=this;return function(r){let i=e.apply(this,[r]);return n._wrap(i,`route`,e=>t._getServerRoutePatch.bind(t)(e)),n._wrap(i,`ext`,e=>t._getServerExtPatch.bind(t)(e)),n._wrap(i,`register`,t._getServerRegisterPatch.bind(t)),i}}_getServerRegisterPatch(e){let t=this;return function(n,r){if(Array.isArray(n))for(let e of n){let n=GH(e);t._wrapRegisterHandler(n)}else{let e=GH(n);t._wrapRegisterHandler(e)}return e.apply(this,[n,r])}}_getServerExtPatch(e,t){let n=this;return function(...r){if(Array.isArray(r[0])){let i=r[0];for(let e=0;e<i.length;e++){let r=i[e];if(zH(r.type)){let a=r;a.method=n._wrapExtMethods(a.method,r.type,t),i[e]=a}}return e.apply(this,r)}if(VH(r)){let i=r,a=i[1],o=n._wrapExtMethods(a,i[0],t);return e.apply(this,[i[0],o,i[2]])}if(BH(r[0])){let i=r[0];return i.method=n._wrapExtMethods(i.method,i.type,t),e.call(this,i)}return e.apply(this,r)}}_getServerRoutePatch(e,t){let n=this;return function(r){if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=n._wrapRouteHandler.call(n,r[e],t);r[e]=i}else r=n._wrapRouteHandler.call(n,r,t);return e.apply(this,[r])}}_wrapRegisterHandler(e){let t=this,n=RH(e),r=e.register,i=this;e.register=function(e,a){return i._wrap(e,`route`,e=>t._getServerRoutePatch.bind(t)(e,n)),i._wrap(e,`ext`,e=>t._getServerExtPatch.bind(t)(e,n)),r.call(this,e,a)}}_wrapExtMethods(e,t,n){let i=this;if(e instanceof Array){for(let n=0;n<e.length;n++)e[n]=i._wrapExtMethods(e[n],t);return e}return HH(e)?e[FH]===!0?e:(e[FH]=!0,function(...i){if(g.getSpan(r.active())===void 0)return e.apply(this,i);let a=WH(t,n,e.name);return B({name:a.name,op:`${a.attributes[NH.HAPI_TYPE]}.hapi`,attributes:{...a.attributes,[L]:`auto.http.otel.hapi`}},()=>e.apply(void 0,i))}):e}_wrapRouteHandler(e,t){if(e[FH]===!0)return e;e[FH]=!0;let n=n=>function(...i){if(g.getSpan(r.active())===void 0)return n.call(this,...i);oP(e.path);let a=UH(e,t);return B({name:a.name,op:`${a.attributes[NH.HAPI_TYPE]}.hapi`,attributes:{...a.attributes,[L]:`auto.http.otel.hapi`}},()=>n.call(this,...i))};if(typeof e.handler==`function`)e.handler=n(e.handler);else if(typeof e.options==`function`){let t=e.options;e.options=function(e){let r=t(e);return typeof r.handler==`function`&&(r.handler=n(r.handler)),r}}else typeof e.options?.handler==`function`&&(e.options.handler=n(e.options.handler));return e}},JH=`Hapi`,YH=X(JH,()=>new qH),XH=G((()=>({name:JH,setupOnce(){YH()}})));function ZH(e){return!!(e&&typeof e==`object`&&`error`in e&&e.error)}function QH(e){U(e,{mechanism:{type:`auto.function.hapi`,handled:!1}})}var $H={name:`SentryHapiErrorPlugin`,version:A,register:async function(e){e.events.on({name:`request`,channels:[`error`]},(e,t)=>{if(P()!==Qr()){let t=e.route;t.path&&P().setTransactionName(`${t.method.toUpperCase()} ${t.path}`)}else aP&&j.warn(`Isolation scope is still the default isolation scope - skipping setting transactionName`);ZH(t)&&QH(t.error)})}};async function eU(e){await e.register($H),IM(e.register,`hapi`)}var tU={HONO_TYPE:`hono.type`,HONO_NAME:`hono.name`},nU={MIDDLEWARE:`middleware`,REQUEST_HANDLER:`request_handler`};x();var rU=`@sentry/instrumentation-hono`,iU=`0.0.1`,aU=class extends J{constructor(e={}){super(rU,iU,e)}init(){return[new Y(`hono`,[`>=4.0.0 <5`],e=>this._patch(e))]}_patch(e){let t=this;class n extends e.Hono{constructor(...e){super(...e),t._wrap(this,`get`,t._patchHandler()),t._wrap(this,`post`,t._patchHandler()),t._wrap(this,`put`,t._patchHandler()),t._wrap(this,`delete`,t._patchHandler()),t._wrap(this,`options`,t._patchHandler()),t._wrap(this,`patch`,t._patchHandler()),t._wrap(this,`all`,t._patchHandler()),t._wrap(this,`on`,t._patchOnHandler()),t._wrap(this,`use`,t._patchMiddlewareHandler())}}try{e.Hono=n}catch{return{...e,Hono:n}}return e}_patchHandler(){let e=this;return function(t){return function(...n){if(typeof n[0]==`string`){let r=n[0];if(n.length===1)return t.apply(this,[r]);let i=n.slice(1);return t.apply(this,[r,...i.map(t=>e._wrapHandler(t))])}return t.apply(this,n.map(t=>e._wrapHandler(t)))}}}_patchOnHandler(){let e=this;return function(t){return function(...n){let r=n.slice(2);return t.apply(this,[...n.slice(0,2),...r.map(t=>e._wrapHandler(t))])}}}_patchMiddlewareHandler(){let e=this;return function(t){return function(...n){if(typeof n[0]==`string`){let r=n[0];if(n.length===1)return t.apply(this,[r]);let i=n.slice(1);return t.apply(this,[r,...i.map(t=>e._wrapHandler(t))])}return t.apply(this,n.map(t=>e._wrapHandler(t)))}}}_wrapHandler(e){let t=this;return function(n,i){if(!t.isEnabled())return e.apply(this,[n,i]);let a=n.req.path,o=t.tracer.startSpan(a);return r.with(g.setSpan(r.active(),o),()=>t._safeExecute(()=>{let r=e.apply(this,[n,i]);if(zn(r))return r.then(n=>{let r=t._determineHandlerType(n);return o.setAttributes({[tU.HONO_TYPE]:r,[tU.HONO_NAME]:r===nU.REQUEST_HANDLER?a:e.name||`anonymous`}),t.getConfig().responseHook?.(o),n});{let n=t._determineHandlerType(r);return o.setAttributes({[tU.HONO_TYPE]:n,[tU.HONO_NAME]:n===nU.REQUEST_HANDLER?a:e.name||`anonymous`}),t.getConfig().responseHook?.(o),r}},()=>o.end(),e=>{t._handleError(o,e),o.end()}))}}_safeExecute(e,t,n){try{let r=e();return zn(r)?r.then(()=>t(),e=>n(e)):t(),r}catch(e){throw n(e),e}}_determineHandlerType(e){return e===void 0?nU.MIDDLEWARE:nU.REQUEST_HANDLER}_handleError(e,t){t instanceof Error&&(e.setStatus({code:b.ERROR,message:t.message}),e.recordException(t))}},oU=`Hono`;function sU(e){let t=R(e).data,n=t[tU.HONO_TYPE];if(t[`sentry.op`]||!n)return;e.setAttributes({[L]:`auto.http.otel.hono`,[I]:`${n}.hono`});let r=t[tU.HONO_NAME];if(typeof r==`string`&&e.updateName(r),P()===Qr()){aP&&j.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let i=t[xl],a=t[yl];typeof i==`string`&&typeof a==`string`&&P().setTransactionName(`${a} ${i}`)}var cU=X(oU,()=>new aU({responseHook:e=>{sU(e)}})),lU=G((()=>({name:oU,setupOnce(){cU()}})));function uU(){return async function(e,t){let n=Hp(e.req);P().setSDKProcessingMetadata({normalizedRequest:n}),await t()}}function dU(e){return e.res.status>=500}function fU(e){return async function(t,n){await n(),(e?.shouldHandleError||dU)(t)&&(t.res.sentry=U(t.error,{mechanism:{type:`auto.middleware.hono`,handled:!1}}))}}function pU(e,t){e.use(uU()),e.use(fU(t)),IM(e.use,`hono`)}var mU=(e=>(e.ROUTER=`router`,e.MIDDLEWARE=`middleware`,e))(mU||{}),hU=(e=>(e.KOA_TYPE=`koa.type`,e.KOA_NAME=`koa.name`,e))(hU||{}),gU=(e,t,n,r)=>n?{attributes:{[hU.KOA_NAME]:r?.toString(),[hU.KOA_TYPE]:mU.ROUTER,[xl]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[hU.KOA_NAME]:t.name??`middleware`,[hU.KOA_TYPE]:mU.MIDDLEWARE,[wc]:t.name??`middleware`},name:`middleware - ${t.name}`},_U=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e)),vU=Symbol(`koa-layer-patched`);x();var yU=`@sentry/instrumentation-koa`,bU=class extends J{constructor(e={}){super(yU,A,e)}init(){return new Y(`koa`,[`>=2.0.0 <4`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return t==null?t:(q(t.prototype.use)&&this._unwrap(t.prototype,`use`),this._wrap(t.prototype,`use`,this._getKoaUsePatch.bind(this)),e)},e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;t&&q(t.prototype.use)&&this._unwrap(t.prototype,`use`)})}_getKoaUsePatch(e){let t=this._patchRouterDispatch.bind(this),n=this._patchLayer.bind(this);return function(r){let i=r.router?t(r):n(r,!1);return e.apply(this,[i])}}_patchRouterDispatch(e){let t=e.router?.stack??[];for(let e of t){let t=e.path,n=e.stack;for(let e=0;e<n.length;e++){let r=n[e];n[e]=this._patchLayer(r,!0,t)}}return e}_patchLayer(e,t,n){let i=t?mU.ROUTER:mU.MIDDLEWARE;return e[vU]===!0||_U(i,this.getConfig())||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[vU]=!0,(a,o)=>{if(g.getSpan(r.active())===void 0)return e(a,o);let s=gU(a,e,t,n);a._matchedRoute&&oP(a._matchedRoute.toString());let c=s.attributes[hU.KOA_NAME];return B({name:typeof c==`string`?c||`< unknown >`:s.name,op:`${i}.koa`,attributes:{...s.attributes,[L]:`auto.http.otel.koa`}},()=>{let t=s.attributes[xl];if(P()===Qr())aP&&j.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);else if(t){let e=a.request?.method?.toUpperCase()||`GET`;P().setTransactionName(`${e} ${t}`)}return e(a,o)})})}},xU=`Koa`,SU=X(xU,bU,(e={})=>({ignoreLayersType:e.ignoreLayersType})),CU=G(((e={})=>({name:xU,setupOnce(){SU(e)}}))),wU=e=>{e.use(async(e,t)=>{try{await t()}catch(e){throw U(e,{mechanism:{handled:!1,type:`auto.middleware.koa`}}),e}}),IM(e.use,`koa`)},TU=(e=>(e.CONNECT_TYPE=`connect.type`,e.CONNECT_NAME=`connect.name`,e))(TU||{}),EU=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(EU||{}),DU=Symbol(`opentelemetry.instrumentation-connect.request-route-stack`),OU=e=>{Array.isArray(e[DU])===!1&&Object.defineProperty(e,DU,{enumerable:!1,value:[]}),e[DU].push(`/`);let t=e[DU].length;return()=>{t===e[DU].length?e[DU].pop():aP&&j.warn(`Connect: Trying to pop the stack multiple time`)}},kU=(e,t)=>{t&&e[DU].splice(-1,1,t)},AU=e=>e[DU].reduce((e,t)=>e.replace(/\/+$/,``)+t),jU=`@sentry/instrumentation-connect`,MU=`anonymous`,NU=class extends J{constructor(e={}){super(jU,A,e)}init(){return[new Y(`connect`,[`>=3.0.0 <4`],e=>this._patchConstructor(e))]}_patchApp(e){q(e.use)||this._wrap(e,`use`,this._patchUse.bind(this)),q(e.handle)||this._wrap(e,`handle`,this._patchHandle.bind(this))}_patchConstructor(e){let t=this._patchApp.bind(this);return function(...n){let r=Reflect.apply(e,this,n);return t(r),r}}_patchNext(e,t,n){return function(r){An(r)&&t.setStatus({code:2,message:`internal_error`});let i=e.apply(this,[r]);return n(),i}}_startSpan(e,t){let n=e?EU.REQUEST_HANDLER:EU.MIDDLEWARE,r=e||t.name||MU;return V({name:r,op:`${n}.connect`,attributes:{[L]:`auto.http.otel.connect`,[xl]:e.length>0?e:`/`,[TU.CONNECT_TYPE]:n,[TU.CONNECT_NAME]:r}})}_patchMiddleware(e,t){let n=this.isEnabled.bind(this),r=this._startSpan.bind(this),i=this._patchNext.bind(this),a=t.length===4;function o(){if(!n())return Reflect.apply(t,this,arguments);let[o,s,c]=a?[1,2,3]:[0,1,2],l=arguments[o],u=arguments[s],d=arguments[c];kU(l,e),e&&oP(AU(l));let f=r(e,t),p=!1;function m(){p||(p=!0,f.end()),u.removeListener(`close`,m)}u.addListener(`close`,m),arguments[c]=i(d,f,m);try{return Reflect.apply(t,this,arguments)}catch(e){throw f.setStatus({code:2,message:`internal_error`}),m(),e}}return Object.defineProperty(o,"length",{value:t.length,writable:!1,configurable:!0}),o}_patchUse(e){let t=this._patchMiddleware.bind(this);return function(...n){let r=n[n.length-1],i=n[n.length-2]||``;return n[n.length-1]=t(i,r),e.apply(this,n)}}_patchHandle(e){let t=this._patchOut.bind(this);return function(){let[n,r]=[0,2],i=arguments[n],a=arguments[r],o=OU(i);return typeof a==`function`&&(arguments[r]=t(a,o)),Reflect.apply(e,this,arguments)}}_patchOut(e,t){return function(...n){return t(),Reflect.apply(e,this,n)}}},PU=`Connect`,FU=X(PU,()=>new NU),IU=G((()=>({name:PU,setupOnce(){FU()}})));function LU(e,t,n,r){U(e,{mechanism:{handled:!1,type:`auto.middleware.connect`}}),r(e)}var RU=e=>{e.use(LU),IM(e.use,`connect`)},zU=`db.sql.table`,BU=`sqlite`,VU=`postgresql`,HU=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>`},UU=new Map([[`sqlite3`,BU],[`pg`,VU]]),WU=e=>UU.get(e)||e,GU=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,KU=(e,t)=>typeof e==`string`&&typeof t==`number`&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,qU=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}},JU=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},YU=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},XU=e=>{let t=e?._single?.table;return typeof t==`object`?XU(t):t},ZU=`@sentry/instrumentation-knex`,QU=`auto.db.otel.knex`,$U=`knex`,eW=[`>=0.22.0 <4`,`>=0.10.0 <0.18.0`,`>=0.19.0 <0.22.0`,`>=0.18.0 <0.19.0`],tW=1022,nW=Symbol(`sentry.instrumentation-knex.parent-span`),rW=class extends J{constructor(e={}){super(ZU,A,e)}init(){let e=new Y($U,eW);return e.files.push(this._getClientNodeModuleFileInstrumentation(`src`),this._getClientNodeModuleFileInstrumentation(`lib`),this._getRunnerNodeModuleFileInstrumentation(`src`),this._getRunnerNodeModuleFileInstrumentation(`lib`),this._getRunnerNodeModuleFileInstrumentation(`lib/execution`)),e}_getRunnerNodeModuleFileInstrumentation(e){return new RR(`knex/${e}/runner.js`,eW,(e,t)=>(this._ensureWrapped(e.prototype,`query`,this._createQueryWrapper(t)),e),e=>(this._unwrap(e.prototype,`query`),e))}_getClientNodeModuleFileInstrumentation(e){return new RR(`knex/${e}/client.js`,eW,e=>(this._ensureWrapped(e.prototype,`queryBuilder`,this._storeContext.bind(this)),this._ensureWrapped(e.prototype,`schemaBuilder`,this._storeContext.bind(this)),this._ensureWrapped(e.prototype,`raw`,this._storeContext.bind(this)),e),e=>(this._unwrap(e.prototype,`queryBuilder`),this._unwrap(e.prototype,`schemaBuilder`),this._unwrap(e.prototype,`raw`),e))}_createQueryWrapper(e){return function(t){return function(n){let r=this.client.config,i=XU(this.builder),a=n?.method,o=r?.connection?.connectionString,s=r?.connection?.filename||r?.connection?.database||qU(o),c={[L]:QU,"knex.version":e,[Nc]:WU(this.client.driverName),[zU]:i,[Oc]:a,[Fc]:r?.connection?.user,[Ec]:s,[Wl]:r?.connection?.host??JU(o),[Gl]:r?.connection?.port??YU(o),[Kl]:r?.connection?.filename===`:memory:`?`inproc`:void 0,[Mc]:KU(n?.sql,tW)},l=this.builder[nW]||z(),u=arguments;return B({name:GU(s,a,i),kind:K.CLIENT,attributes:c,parentSpan:l,onlyIfParent:!0},e=>t.apply(this,u).catch(t=>{let r=HU(this)(n.sql,n.bindings||[]),i=t.message.replace(`${r} - `,``);throw e.setStatus({code:2,message:i}),t}))}}}_storeContext(e){return function(){let t=e.apply(this,arguments);return Object.defineProperty(t,nW,{value:z()}),t}}_ensureWrapped(e,t,n){q(e[t])&&this._unwrap(e,t),this._wrap(e,t,n)}},iW=`sentrySubscribeOrchestrionChannel`;function aW(e){let t=new Set,n=[];for(let{module:r}of e){let e=`${r.name}\0${r.versionRange}\0${String(r.filePath)}`;t.has(e)||(t.add(e),n.push({channelName:r.name,module:r,astQuery:`Program`,transform:iW}))}return n}var oW={name:`amqplib`,versionRange:`>=0.5.5 <2`},sW=[{channelName:`publish`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`publish`,kind:`Sync`}},{channelName:`confirmPublish`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`ConfirmChannel`,methodName:`publish`,kind:`Callback`}},{channelName:`consume`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`consume`,kind:`Async`}},{channelName:`dispatch`,module:{...oW,filePath:`lib/channel.js`},functionQuery:{className:`BaseChannel`,methodName:`dispatchMessage`,kind:`Sync`}},{channelName:`ack`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ack`,kind:`Sync`}},{channelName:`nack`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nack`,kind:`Sync`}},{channelName:`reject`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`reject`,kind:`Sync`}},{channelName:`ackAll`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ackAll`,kind:`Sync`}},{channelName:`nackAll`,module:{...oW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nackAll`,kind:`Sync`}},{channelName:`connect`,module:{...oW,filePath:`lib/connect.js`},functionQuery:{functionName:`connect`,kind:`Callback`}}],cW={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`},lW=aW(sW),uW=[...[`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`}}))],dW={ANTHROPIC_CHAT:`orchestrion:@anthropic-ai/sdk:chat`,ANTHROPIC_MODELS:`orchestrion:@anthropic-ai/sdk:models`,ANTHROPIC_MESSAGES_STREAM:`orchestrion:@anthropic-ai/sdk:messages-stream`},fW=aW(uW),pW=[{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`}}],mW={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`},hW=aW(pW),gW={name:`dataloader`,versionRange:`>=2.0.0 <3`,filePath:`index.js`},_W=[{channelName:`construct`,module:gW,functionQuery:{functionName:`DataLoader`,kind:`Sync`}},{channelName:`load`,module:gW,functionQuery:{expressionName:`load`,kind:`Async`}},{channelName:`loadMany`,module:gW,functionQuery:{expressionName:`loadMany`,kind:`Async`}},{channelName:`prime`,module:gW,functionQuery:{expressionName:`prime`,kind:`Sync`}},{channelName:`clear`,module:gW,functionQuery:{expressionName:`clear`,kind:`Sync`}},{channelName:`clearAll`,module:gW,functionQuery:{expressionName:`clearAll`,kind:`Sync`}}],vW={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`},yW=aW(_W),bW=[{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`}}],xW={EXPRESS_HANDLE:`orchestrion:express:handle`,ROUTER_HANDLE:`orchestrion:router:handle`,EXPRESS_REGISTER:`orchestrion:express:register`,ROUTER_REGISTER:`orchestrion:router:register`},SW=aW(bW),CW=`>=3.0.0 <5`,wW=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,TW=[{functionName:`addDoc`,channelName:`add-doc`},{functionName:`getDocs`,channelName:`get-docs`},{functionName:`setDoc`,channelName:`set-doc`},{functionName:`deleteDoc`,channelName:`delete-doc`}],EW=`>=6.0.0 <7`,DW=[{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`}],OW=[...TW.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:`@firebase/firestore`,versionRange:CW,filePath:wW},functionQuery:{functionName:e,kind:`Auto`}})),...DW.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:`firebase-functions`,versionRange:EW,filePath:e},functionQuery:{functionName:t,kind:`Sync`}}))],kW={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`},AW=aW(OW),jW=[{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`}}],MW={GENERIC_POOL_ACQUIRE:`orchestrion:generic-pool:acquire`},NW=aW(jW),PW=[`dist/node/index.js`,`dist/node/index.mjs`,`dist/node/index.cjs`],FW=[...PW.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`}}))),...PW.map(e=>({channelName:`embed-content`,module:{name:`@google/genai`,versionRange:`>=0.10.0 <2`,filePath:e},functionQuery:{className:`Models`,methodName:`embedContent`,kind:`Auto`}})),...PW.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`}})))],IW={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`},LW=aW(FW),RW=[{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`}}],zW={GRAPHQL_PARSE:`orchestrion:graphql:parse`,GRAPHQL_VALIDATE:`orchestrion:graphql:validate`,GRAPHQL_EXECUTE:`orchestrion:graphql:execute`},BW=aW(RW),VW=[{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`}}],HW={HAPI_ROUTE:`orchestrion:@hapi/hapi:route`,HAPI_EXT:`orchestrion:@hapi/hapi:ext`},UW=aW(VW),WW=[...[`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`}}],GW={IOREDIS_COMMAND:`orchestrion:ioredis:command`,IOREDIS_CONNECT:`orchestrion:ioredis:connect`},KW=aW(WW),qW=[{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`}}],JW={KAFKAJS_SEND_BATCH:`orchestrion:kafkajs:send_batch`,KAFKAJS_CONSUMER_RUN:`orchestrion:kafkajs:consumer_run`},YW=aW(qW),XW=`knex`,ZW=[{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`}],QW=[{filePath:`lib/client.js`,versionRange:`>=0.10.0 <4`},{filePath:`src/client.js`,versionRange:`>=0.18.0 <0.19.0`}],$W=[`queryBuilder`,`schemaBuilder`,`raw`];function eG(e,t){return{channelName:`query`,module:{name:XW,versionRange:t,filePath:e},functionQuery:{className:`Runner`,methodName:`query`,kind:`Async`}}}function tG(e,t,n){return{channelName:e,module:{name:XW,versionRange:n,filePath:t},functionQuery:{className:`Client`,methodName:e,kind:`Sync`}}}var nG=[...ZW.map(({filePath:e,versionRange:t})=>eG(e,t)),...QW.flatMap(({filePath:e,versionRange:t})=>$W.map(n=>tG(n,e,t)))],rG={KNEX_QUERY:`orchestrion:knex:query`,KNEX_QUERY_BUILDER:`orchestrion:knex:queryBuilder`,KNEX_SCHEMA_BUILDER:`orchestrion:knex:schemaBuilder`,KNEX_RAW:`orchestrion:knex:raw`},iG=aW(nG),aG=[{channelName:`use`,module:{name:`koa`,versionRange:`>=2.0.0 <4`,filePath:`lib/application.js`},functionQuery:{className:`Application`,methodName:`use`,kind:`Sync`}}],oG={KOA_USE:`orchestrion:koa:use`},sG=aW(aG),cG=[`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`}}]}),lG=`embedQuery`,uG=`embedDocuments`,dG=[{name:`@langchain/openai`,versionRange:`>=0.1.0 <2.0.0`,methods:[lG,uG]},{name:`@langchain/google-genai`,versionRange:`>=0.1.0 <3.0.0`,methods:[lG,uG]},{name:`@langchain/mistralai`,versionRange:`>=0.1.0 <2.0.0`,methods:[lG,uG]},{name:`@langchain/google-common`,versionRange:`>=0.1.0 <3.0.0`,methods:[uG]}],fG=dG.flatMap(({name:e,versionRange:t,methods:n})=>[`dist/embeddings.cjs`,`dist/embeddings.js`].flatMap(r=>n.map(n=>({channelName:n,module:{name:e,versionRange:t,filePath:r},functionQuery:{methodName:n,kind:`Async`}})))),pG=[...cG,...fG],mG=dG.flatMap(({name:e,methods:t})=>t.map(t=>`orchestrion:${e}:${t}`)),hG={LANGCHAIN_CHAT_MODEL_INVOKE:`orchestrion:@langchain/core:chatModelInvoke`,LANGCHAIN_CHAT_MODEL_STREAM:`orchestrion:@langchain/core:chatModelStream`},gG=aW(pG),_G=e=>({name:`@langchain/langgraph`,versionRange:`>=0.0.0 <2.0.0`,filePath:e}),vG=[`dist/graph/state.cjs`,`dist/graph/state.js`].map(e=>({channelName:`stateGraphCompile`,module:_G(e),functionQuery:{className:`StateGraph`,methodName:`compile`,kind:`Sync`}})),yG=[`dist/prebuilt/react_agent_executor.cjs`,`dist/prebuilt/react_agent_executor.js`].map(e=>({channelName:`createReactAgent`,module:_G(e),functionQuery:{functionName:`createReactAgent`,kind:`Sync`}})),bG=[...vG,...yG],xG={LANGGRAPH_STATE_GRAPH_COMPILE:`orchestrion:@langchain/langgraph:stateGraphCompile`,LANGGRAPH_CREATE_REACT_AGENT:`orchestrion:@langchain/langgraph:createReactAgent`},SG=aW(bG),CG=[{channelName:`load`,module:{name:`lru-memoizer`,versionRange:`>=2.1.0 <4`,filePath:`lib/async.js`},functionQuery:{functionName:`memoizedFunction`,kind:`Callback`}}],wG={LRU_MEMOIZER_LOAD:`orchestrion:lru-memoizer:load`},TG=aW(CG),EG={name:`mongodb`},DG=[{channelName:`command`,module:{...EG,versionRange:`>=6.4.0 <8`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Async`}},{channelName:`command`,module:{...EG,versionRange:`>=4.0.0 <6.4`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Callback`}},{channelName:`checkout`,module:{...EG,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:{...EG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/index.js`},functionQuery:{expressionName:e,kind:`Callback`}})),{channelName:`v3_command`,module:{...EG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/command.js`},functionQuery:{functionName:`command`,kind:`Callback`}},{channelName:`v3_query`,module:{...EG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/query.js`},functionQuery:{functionName:`query`,kind:`Callback`}},{channelName:`v3_get_more`,module:{...EG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/get_more.js`},functionQuery:{functionName:`getMore`,kind:`Callback`}}],OG={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`},kG=aW(DG),AG={name:`mongoose`,versionRange:`>=5.9.7 <9.7.0`},jG=[`find`,`findOne`,`deleteOne`,`deleteMany`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`,`remove`,`count`,`findOneAndRemove`],MG=[{channelName:`query_exec`,module:{...AG,filePath:`lib/query.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`aggregate_exec`,module:{...AG,filePath:`lib/aggregate.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`model_save`,module:{...AG,filePath:`lib/model.js`},functionQuery:{expressionName:`save`,kind:`Auto`}},{channelName:`model_insert_many`,module:{...AG,filePath:`lib/model.js`},functionQuery:{expressionName:`insertMany`,kind:`Auto`}},{channelName:`model_bulk_write`,module:{...AG,filePath:`lib/model.js`},functionQuery:{expressionName:`bulkWrite`,kind:`Auto`}},{channelName:`model_remove`,module:{...AG,filePath:`lib/model.js`},functionQuery:{expressionName:`remove`,kind:`Auto`}},{channelName:`model_aggregate`,module:{...AG,filePath:`lib/model.js`},functionQuery:{expressionName:`aggregate`,kind:`Sync`}},...jG.map(e=>({channelName:`ctx_${e}`,module:{...AG,filePath:`lib/query.js`},functionQuery:{expressionName:e,kind:`Sync`}}))],NG={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`},PG=jG.map(e=>`orchestrion:mongoose:ctx_${e}`),FG=aW(MG),IG=[{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`}}],LG={MYSQL2_QUERY:`orchestrion:mysql2:query`,MYSQL2_EXECUTE:`orchestrion:mysql2:execute`},RG=aW(IG),zG=[{channelName:`query`,module:{name:`mysql`,versionRange:`>=2.0.0 <3`,filePath:`lib/Connection.js`},functionQuery:{expressionName:`query`,kind:`Auto`}}],BG={MYSQL_QUERY:`orchestrion:mysql:query`},VG=aW(zG);function HG(e){return e}var UG=[{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`}},HG({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`}}),HG({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`}}],WG={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`},GG=aW(UG),KG=[...[`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`}}))],qG={OPENAI_CHAT:`orchestrion:openai:chat`,OPENAI_EMBEDDINGS:`orchestrion:openai:embeddings`},JG=aW(KG),YG=[{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`}}],XG={PG_QUERY:`orchestrion:pg:query`,PG_CONNECT:`orchestrion:pg:connect`,PGPOOL_CONNECT:`orchestrion:pg-pool:connect`},ZG=aW(YG),QG=[`src`,`cjs/src`].flatMap(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`}}]),$G={POSTGRESJS_HANDLE:`orchestrion:postgres:handle`,POSTGRESJS_CONNECTION:`orchestrion:postgres:connection`,POSTGRESJS_EXECUTE:`orchestrion:postgres:execute`,POSTGRESJS_CONNECT:`orchestrion:postgres:connect`},eK=aW(QG),tK=[{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`}}],nK={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`},rK=aW(tK),iK=[`dist`,`dist/esm`].flatMap(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`}}]),aK={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`},oK=aW(iK),sK=`tedious`,cK=`lib/connection.js`,lK=`>=1.11.0 <20`,uK=[`connect`,`execSql`,`execSqlBatch`,`callProcedure`,`execBulkLoad`,`prepare`,`execute`].map(e=>({channelName:e,module:{name:sK,versionRange:lK,filePath:cK},functionQuery:{className:`Connection`,methodName:e,kind:`Sync`}})),dK={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`},fK=aW(uK),pK=[...hK(`>=4.0.0 <7.0.0`,`generateText`,`generateText`,`Async`),...hK(`>=4.0.0 <7.0.0`,`streamText`,`streamText`,`Sync`),...hK(`>=4.0.0 <7.0.0`,`generateObject`,`generateObject`,`Async`),...hK(`>=4.0.0 <7.0.0`,`embed`,`embed`,`Async`),...hK(`>=4.0.0 <7.0.0`,`embedMany`,`embedMany`,`Async`),...hK(`>=5.0.0 <7.0.0`,`resolveLanguageModel`,`resolveLanguageModel`,`Sync`),...hK(`>=6.0.0 <7.0.0`,`executeToolCall`,`executeToolCall`,`Async`)],mK={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 hK(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 gK=aW(pK),$={...cW,...dW,...mW,...vW,...xW,...kW,...MW,...IW,...zW,...HW,...GW,...JW,...rG,...oG,...hG,...xG,...wG,...OG,...NG,...LG,...BG,...WG,...qG,...XG,...$G,...nK,...aK,...dK,...mK},_K=`Amqplib`,vK=`auto.amqplib.orchestrion.publisher`,yK=`auto.amqplib.orchestrion.consumer`,bK=`messaging.operation`,xK=`messaging.destination`,SK=`messaging.destination_kind`,CK=`messaging.rabbitmq.routing_key`,wK=`messaging.protocol`,TK=`messaging.protocol_version`,EK=`messaging.url`,DK=`messaging.message_id`,OK=`messaging.conversation_id`,kK=`messaging.rabbitmq.destination.routing_key`,AK=`messaging.message.conversation_id`,jK=`topic`,MK=`process`,NK=`send`,PK=6e4,FK={Ack:`ack`,AckAll:`ackAll`,Reject:`reject`,Nack:`nack`,NackAll:`nackAll`,ChannelClosed:`channel closed`,ChannelError:`channel error`,InstrumentationTimeout:`instrumentation timeout`},IK=Symbol(`sentry.amqplib.message.stored-span`),LK=Symbol(`sentry.amqplib.channel.spans-not-ended`),RK=Symbol(`sentry.amqplib.channel.consume-timeout-timer`),zK=Symbol(`sentry.amqplib.channel.consumer-info`),BK=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),VK=Symbol(`sentry.amqplib.connection.attributes`),HK=()=>{},UK=!1,WK=(()=>({name:_K,setupOnce(){T.tracingChannel&&!UK&&(UK=!0,Z&&j.log(`[orchestrion:amqplib] subscribing to amqplib tracing channels`),W(()=>{XK(),GK(),KK(),qK(),JK(),YK()}))}}));function GK(){Q(T.tracingChannel($.AMQPLIB_PUBLISH),e=>{if(!e.self?.[BK])return rq(e)})}function KK(){let e=T.tracingChannel($.AMQPLIB_CONFIRM_PUBLISH);Q(e,e=>(e.self&&(e.self[BK]=!0),rq(e))),e.end.subscribe(e=>{let t=e.self;t&&(t[BK]=!1)})}function qK(){let e=T.tracingChannel($.AMQPLIB_CONSUME);e.start.subscribe(HK),e.asyncEnd.subscribe(e=>{let t=e,n=t.self,r=t.result?.consumerTag;if(!n||!r)return;QK(n);let i=t.arguments[0],a=typeof i==`string`?i:`<unknown>`,o=t.arguments[2];n[zK]?.set(r,{noAck:!!o?.noAck,queue:a})})}function JK(){Q(T.tracingChannel($.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;QK(t);let i=n?.consumerTag?t[zK]?.get(n.consumerTag):void 0,a=i?.queue??r.fields?.routingKey??`<unknown>`,o=i?.noAck??!1,s=r.properties?.headers,c=rs({sentryTrace:pq(s,`sentry-trace`),baggage:pq(s,`baggage`)},()=>iq(a,r,t));return o||(t[LK]?.push({msg:r,timeOfConsume:Ir()}),r[IK]=c),e._sentryNoAck=o,c},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function YK(){T.tracingChannel($.AMQPLIB_ACK).start.subscribe(e=>ZK(e,!1,FK.Ack)),T.tracingChannel($.AMQPLIB_NACK).start.subscribe(e=>ZK(e,!0,FK.Nack)),T.tracingChannel($.AMQPLIB_REJECT).start.subscribe(e=>ZK(e,!0,FK.Reject)),T.tracingChannel($.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&tq(t.self,!1,FK.AckAll,void 0)}),T.tracingChannel($.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&tq(t.self,!0,FK.NackAll,t.arguments[0])})}function XK(){let e=T.tracingChannel($.AMQPLIB_CONNECT);e.start.subscribe(HK),e.asyncEnd.subscribe(e=>{let t=e,n=t.result;n&&typeof n==`object`&&(n[VK]={...sq(t.arguments?.[0]),...oq(n)})})}function ZK(e,t,n){let r=e.self;if(!r)return;let i=e.arguments[0];if(!i)return;let a=e.arguments[1],o=e.arguments[2],s=n===FK.Reject?a:o,c=r[LK]??[],l=c.findIndex(e=>e.msg===i);if(l<0)nq(i,t,n,s);else if(n!==FK.Reject&&a){for(let e=0;e<=l;e++)nq(c[e].msg,t,n,s);c.splice(0,l+1)}else nq(i,t,n,s),c.splice(l,1)}function QK(e){if(Object.prototype.hasOwnProperty.call(e,LK))return;e[LK]=[],e[zK]=new Map;let t=setInterval(()=>eq(e),PK);t.unref?.(),e[RK]=t,typeof e.on==`function`&&(e.on(`close`,()=>{tq(e,!0,FK.ChannelClosed,void 0),$K(e)}),e.on(`error`,()=>{tq(e,!0,FK.ChannelError,void 0),$K(e)}))}function $K(e){let t=e[RK];t&&(clearInterval(t),e[RK]=void 0)}function eq(e){let t=Ir(),n=e[LK]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<PK)break;nq(e.msg,null,FK.InstrumentationTimeout,!0)}n.splice(0,r)}function tq(e,t,n,r){(e[LK]??[]).forEach(e=>{nq(e.msg,t,n,r)}),e[LK]=[]}function nq(e,t,n,r){let i=e[IK];i&&(t!==!1&&i.setStatus({code:2,message:n!==FK.ChannelClosed&&n!==FK.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[IK]=void 0)}function rq(e){let t=e.arguments[0],n=e.arguments[1],r=typeof t==`string`?t:``,i=typeof n==`string`?n:``,a=e.arguments[3],o=V({name:`publish ${cq(r)}`,op:`message`,kind:K.PRODUCER,attributes:{...aq(e.self),[xK]:r,[jl]:r,[SK]:jK,[CK]:i,[kK]:i,[Pl]:NK,[DK]:a?.messageId,[Ml]:a?.messageId,[OK]:a?.correlationId,[AK]:a?.correlationId,[L]:vK}});(!a||typeof a!=`object`)&&(a={},e.arguments[3]=a);let s=a.headers&&typeof a.headers==`object`?a.headers:a.headers={},c=jp({span:o});return c[`sentry-trace`]&&(s[`sentry-trace`]=c[`sentry-trace`]),c.baggage&&(s.baggage=c.baggage),o}function iq(e,t,n){return V({name:`${e} process`,op:`message`,kind:K.CONSUMER,attributes:{...aq(n),[xK]:t.fields?.exchange,[jl]:t.fields?.exchange,[SK]:jK,[CK]:t.fields?.routingKey,[kK]:t.fields?.routingKey,[bK]:MK,[Pl]:MK,[DK]:t.properties?.messageId,[Ml]:t.properties?.messageId,[OK]:t.properties?.correlationId,[AK]:t.properties?.correlationId,[L]:yK}})}function aq(e){let t=e?.connection,n=t?.[VK];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r==`string`&&r?{[Fl]:r.toLowerCase()}:{}}function oq(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t==`string`&&t?{[Fl]:t.toLowerCase()}:{}}function sq(e){let t={[TK]:`0.9.1`,[zl]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=dq(e.protocol),i=fq(e.hostname),a=uq(e.port,r);t[wK]=r,t[Rl]=r,t[au]=i,t[ou]=a,t[Wl]=i,t[Gl]=a}else if(typeof n==`string`){let e=lq(n);t[EK]=e,t[lu]=e;try{let n=new URL(e),r=dq(n.protocol),i=fq(n.hostname),a=uq(n.port?parseInt(n.port,10):void 0,r);t[wK]=r,t[Rl]=r,t[au]=i,t[ou]=a,t[Wl]=i,t[Gl]=a}catch{}}return t}function cq(e){return e===``?`<default>`:e}function lq(e){return e.replace(/:[^:@/]*@/,`:***@`)}function uq(e,t){return e||(t===`AMQP`?5672:5671)}function dq(e){let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()}function fq(e){return e||`localhost`}function pq(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}var mq=G(WK),hq=`Anthropic_AI`,gq=`auto.ai.orchestrion.anthropic`,_q=[{channel:$.ANTHROPIC_CHAT,operation:`chat`,methodPath:`messages.create`,stream:`async-iterable`},{channel:$.ANTHROPIC_MODELS,operation:`models`,methodPath:`models.retrieve`,stream:`none`},{channel:$.ANTHROPIC_MESSAGES_STREAM,operation:`chat`,methodPath:`messages.stream`,stream:`message-stream`}],vq=!1,yq=((e={})=>({name:hq,setupOnce(){T.tracingChannel&&!vq&&(vq=!0,W(()=>{for(let{channel:t,operation:n,methodPath:r,stream:i}of _q)Z&&j.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),Q(T.tracingChannel(t),t=>bq(t,n,r,e),{beforeSpanEnd:(t,n)=>{Zy(t,n.result,av(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>Cq(t,n,i,e)})}))}}));function bq(e,t,n,r){let i=e.arguments??[];if(Zf(hq)||i[1]?.headers?.[`X-Stainless-Helper-Method`]===`stream`)return;let a=typeof i[0]==`object`&&i[0]!==null?i[0]:void 0,{recordInputs:o}=av(r),s=ov(r.enableTruncation),c=qy(i,n,t),l=c[`gen_ai.request.model`]||`unknown`;c[L]=gq;let u=V({name:`${t} ${l}`,op:`gen_ai.${t}`,attributes:c});return o&&a&&Jy(u,a,s),u}function xq(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function Sq(e){return!!e&&typeof e.on==`function`}function Cq(e,t,n,r){let{recordOutputs:i}=av(r),a=t.result;if(n===`async-iterable`&&xq(a)){let t=a[Symbol.asyncIterator].bind(a),n=Uy({[Symbol.asyncIterator]:t},e,i);return a[Symbol.asyncIterator]=()=>n,!0}return n===`message-stream`&&Sq(a)?(Wy(a,e,i),!0):!1}var wq=G(yq),Tq=`auto.aws.orchestrion.aws_sdk`,Eq=`dynamodb`,Dq=`messaging.destination_kind`,Oq=`topic`,kq=`chat`,Aq=`aws.bedrock`,jq=new TextDecoder,Mq=class{requestPreSpanHook(e){switch(e.commandName){case`Converse`:return this._requestPreSpanHookConverse(e,!1);case`ConverseStream`:return this._requestPreSpanHookConverse(e,!0);case`InvokeModel`:return this._requestPreSpanHookInvokeModel(e,!1);case`InvokeModelWithResponseStream`:return this._requestPreSpanHookInvokeModel(e,!0)}return{}}responseHook(e,t){let n=e.request.commandName;if(!t.isRecording()){(n===`ConverseStream`||n===`InvokeModelWithResponseStream`)&&t.end();return}switch(n){case`Converse`:return this._responseHookConverse(e,t);case`ConverseStream`:return this._responseHookConverseStream(e,t);case`InvokeModel`:return this._responseHookInvokeModel(e,t);case`InvokeModelWithResponseStream`:return this._responseHookInvokeModelWithResponseStream(e,t)}}_requestPreSpanHookConverse(e,t){let n=kq,r={[il]:Aq,[Kc]:kq},i=e.commandInput.modelId;i&&(r[Xc]=i,n&&(n+=` ${i}`));let a=e.commandInput.inferenceConfig;if(a){let{maxTokens:e,temperature:t,topP:n,stopSequences:i}=a;e!==void 0&&(r[Yc]=e),t!==void 0&&(r[Qc]=t),n!==void 0&&(r[$c]=n),i!==void 0&&(r[Zc]=i)}return{spanName:n,isStream:t,spanAttributes:r}}_requestPreSpanHookInvokeModel(e,t){let n={[il]:Aq},r=e.commandInput?.modelId;if(r&&(n[Xc]=r),e.commandInput?.body){let t=JSON.parse(e.commandInput.body);r.includes(`amazon.titan`)?(t.textGenerationConfig?.temperature!==void 0&&(n[Qc]=t.textGenerationConfig.temperature),t.textGenerationConfig?.topP!==void 0&&(n[$c]=t.textGenerationConfig.topP),t.textGenerationConfig?.maxTokenCount!==void 0&&(n[Yc]=t.textGenerationConfig.maxTokenCount),t.textGenerationConfig?.stopSequences!==void 0&&(n[Zc]=t.textGenerationConfig.stopSequences)):r.includes(`amazon.nova`)?(t.inferenceConfig?.temperature!==void 0&&(n[Qc]=t.inferenceConfig.temperature),t.inferenceConfig?.top_p!==void 0&&(n[$c]=t.inferenceConfig.top_p),t.inferenceConfig?.max_new_tokens!==void 0&&(n[Yc]=t.inferenceConfig.max_new_tokens),t.inferenceConfig?.stopSequences!==void 0&&(n[Zc]=t.inferenceConfig.stopSequences)):r.includes(`anthropic.claude`)?(t.max_tokens!==void 0&&(n[Yc]=t.max_tokens),t.temperature!==void 0&&(n[Qc]=t.temperature),t.top_p!==void 0&&(n[$c]=t.top_p),t.stop_sequences!==void 0&&(n[Zc]=t.stop_sequences)):r.includes(`meta.llama`)?(t.max_gen_len!==void 0&&(n[Yc]=t.max_gen_len),t.temperature!==void 0&&(n[Qc]=t.temperature),t.top_p!==void 0&&(n[$c]=t.top_p)):r.includes(`cohere.command-r`)?(t.max_tokens!==void 0&&(n[Yc]=t.max_tokens),t.temperature!==void 0&&(n[Qc]=t.temperature),t.p!==void 0&&(n[$c]=t.p),t.message!==void 0&&(n[ll]=Math.ceil(t.message.length/6)),t.stop_sequences!==void 0&&(n[Zc]=t.stop_sequences)):r.includes(`cohere.command`)?(t.max_tokens!==void 0&&(n[Yc]=t.max_tokens),t.temperature!==void 0&&(n[Qc]=t.temperature),t.p!==void 0&&(n[$c]=t.p),t.prompt!==void 0&&(n[ll]=Math.ceil(t.prompt.length/6)),t.stop_sequences!==void 0&&(n[Zc]=t.stop_sequences)):r.includes(`mistral`)&&(t.prompt!==void 0&&(n[ll]=Math.ceil(t.prompt.length/6)),t.max_tokens!==void 0&&(n[Yc]=t.max_tokens),t.temperature!==void 0&&(n[Qc]=t.temperature),t.top_p!==void 0&&(n[$c]=t.top_p),t.stop!==void 0&&(n[Zc]=t.stop))}return{isStream:t,spanAttributes:n}}_responseHookConverse(e,t){let{stopReason:n,usage:r}=e.data;Fq(t,n),Iq(t,r)}_responseHookConverseStream(e,t){e.data.stream=Pq(e.data.stream,t)}_responseHookInvokeModel(e,t){let n=e.request.commandInput?.modelId;if(e.data?.body){let r=jq.decode(e.data.body),i=JSON.parse(r);n.includes(`amazon.titan`)?(i.inputTextTokenCount!==void 0&&t.setAttribute(ll,i.inputTextTokenCount),i.results?.[0]?.tokenCount!==void 0&&t.setAttribute(ul,i.results[0].tokenCount),i.results?.[0]?.completionReason!==void 0&&t.setAttribute(el,[i.results[0].completionReason])):n.includes(`amazon.nova`)?(i.usage!==void 0&&(i.usage.inputTokens!==void 0&&t.setAttribute(ll,i.usage.inputTokens),i.usage.outputTokens!==void 0&&t.setAttribute(ul,i.usage.outputTokens)),i.stopReason!==void 0&&t.setAttribute(el,[i.stopReason])):n.includes(`anthropic.claude`)?(i.usage?.input_tokens!==void 0&&t.setAttribute(ll,i.usage.input_tokens),i.usage?.output_tokens!==void 0&&t.setAttribute(ul,i.usage.output_tokens),i.stop_reason!==void 0&&t.setAttribute(el,[i.stop_reason])):n.includes(`meta.llama`)?(i.prompt_token_count!==void 0&&t.setAttribute(ll,i.prompt_token_count),i.generation_token_count!==void 0&&t.setAttribute(ul,i.generation_token_count),i.stop_reason!==void 0&&t.setAttribute(el,[i.stop_reason])):n.includes(`cohere.command-r`)?(i.text!==void 0&&t.setAttribute(ul,Math.ceil(i.text.length/6)),i.finish_reason!==void 0&&t.setAttribute(el,[i.finish_reason])):n.includes(`cohere.command`)?(i.generations?.[0]?.text!==void 0&&t.setAttribute(ul,Math.ceil(i.generations[0].text.length/6)),i.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(el,[i.generations[0].finish_reason])):n.includes(`mistral`)&&(i.outputs?.[0]?.text!==void 0&&t.setAttribute(ul,Math.ceil(i.outputs[0].text.length/6)),i.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(el,[i.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(e,t){let n=e.data?.body,r=e.request.commandInput?.modelId;if(!n||!r)return;let i=Nq(r);e.data.body=(async function*(){try{for await(let e of n){if(i){let n=Lq(e?.chunk?.bytes);n&&i(n,t)}yield e}}finally{t.end()}})()}};function Nq(e){if(e.includes(`amazon.titan`))return Bq;if(e.includes(`anthropic.claude`))return zq;if(e.includes(`amazon.nova`))return Rq;if(e.includes(`meta.llama`))return Vq;if(e.includes(`cohere.command-r`))return Wq;if(e.includes(`cohere.command`))return Uq;if(e.includes(`mistral`))return Hq}async function*Pq(e,t){try{let n;for await(let r of e)Fq(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;Iq(t,n)}finally{t.end()}}function Fq(e,t){t!==void 0&&e.setAttribute(el,[t])}function Iq(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(ll,n),r!==void 0&&e.setAttribute(ul,r)}}function Lq(e){if(!e||!(e instanceof Uint8Array))return null;try{let t=Buffer.from(e).toString(`utf-8`);return JSON.parse(t)}catch(e){return Z&&j.warn(`[orchestrion:aws-sdk] failed to parse streamed bedrock chunk`,e),null}}function Rq(e,t){e.metadata?.usage!==void 0&&(e.metadata?.usage.inputTokens!==void 0&&t.setAttribute(ll,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(ul,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(el,[e.messageStop.stopReason])}function zq(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(ll,e.message.usage.input_tokens),e.message?.usage?.output_tokens!==void 0&&t.setAttribute(ul,e.message.usage.output_tokens),e.delta?.stop_reason!==void 0&&t.setAttribute(el,[e.delta.stop_reason])}function Bq(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(ll,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(ul,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(el,[e.completionReason])}function Vq(e,t){e.prompt_token_count!==void 0&&t.setAttribute(ll,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(ul,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(el,[e.stop_reason])}function Hq(e,t){e.outputs?.[0]?.text!==void 0&&t.setAttribute(ul,Math.ceil(e.outputs[0].text.length/6)),e.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(el,[e.outputs[0].stop_reason])}function Uq(e,t){e.generations?.[0]?.text!==void 0&&t.setAttribute(ul,Math.ceil(e.generations[0].text.length/6)),e.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(el,[e.generations[0].finish_reason])}function Wq(e,t){e.text!==void 0&&t.setAttribute(ul,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(el,[e.finish_reason])}function Gq(e){return Array.isArray(e)?e:[e]}var Kq=class{requestPreSpanHook(e){let t=e.commandName,n=e.commandInput?.TableName,r={};return r[Nc]=Eq,r[Ec]=n,r[Oc]=t,e.commandInput?.TableName?r[fc]=[e.commandInput.TableName]:e.commandInput?.RequestItems&&(r[fc]=Object.keys(e.commandInput.RequestItems)),(t===`CreateTable`||t===`UpdateTable`)&&e.commandInput?.ProvisionedThroughput&&(r[ac]=e.commandInput.ProvisionedThroughput.ReadCapacityUnits,r[oc]=e.commandInput.ProvisionedThroughput.WriteCapacityUnits),(t===`GetItem`||t===`Scan`||t===`Query`)&&e.commandInput?.ConsistentRead&&(r[Js]=e.commandInput.ConsistentRead),(t===`Query`||t===`Scan`)&&e.commandInput?.ProjectionExpression&&(r[ic]=e.commandInput.ProjectionExpression),t===`CreateTable`&&(e.commandInput?.GlobalSecondaryIndexes&&(r[Qs]=Gq(e.commandInput.GlobalSecondaryIndexes).map(e=>JSON.stringify(e))),e.commandInput?.LocalSecondaryIndexes&&(r[rc]=Gq(e.commandInput.LocalSecondaryIndexes).map(e=>JSON.stringify(e)))),(t===`ListTables`||t===`Query`||t===`Scan`)&&e.commandInput?.Limit&&(r[nc]=e.commandInput.Limit),t===`ListTables`&&e.commandInput?.ExclusiveStartTableName&&(r[Zs]=e.commandInput.ExclusiveStartTableName),t===`Query`&&(e.commandInput?.ScanIndexForward&&(r[cc]=e.commandInput.ScanIndexForward),e.commandInput?.IndexName&&(r[ec]=e.commandInput.IndexName),e.commandInput?.Select&&(r[uc]=e.commandInput.Select)),t===`Scan`&&(e.commandInput?.Segment&&(r[lc]=e.commandInput?.Segment),e.commandInput?.TotalSegments&&(r[pc]=e.commandInput?.TotalSegments),e.commandInput?.IndexName&&(r[ec]=e.commandInput.IndexName),e.commandInput?.Select&&(r[uc]=e.commandInput.Select)),t===`UpdateTable`&&(e.commandInput?.AttributeDefinitions&&(r[qs]=Gq(e.commandInput.AttributeDefinitions).map(e=>JSON.stringify(e))),e.commandInput?.GlobalSecondaryIndexUpdates&&(r[$s]=Gq(e.commandInput.GlobalSecondaryIndexUpdates).map(e=>JSON.stringify(e)))),{spanAttributes:r,spanKind:K.CLIENT,spanOp:`db`}}responseHook(e,t){e.data?.ConsumedCapacity&&t.setAttribute(Ys,Gq(e.data.ConsumedCapacity).map(e=>JSON.stringify(e))),e.data?.ItemCollectionMetrics&&t.setAttribute(tc,Gq(e.data.ItemCollectionMetrics).map(e=>JSON.stringify(e))),e.data?.TableNames&&t.setAttribute(dc,e.data?.TableNames.length),e.data?.Count&&t.setAttribute(Xs,e.data?.Count),e.data?.ScannedCount&&t.setAttribute(sc,e.data?.ScannedCount)}},qq=class{requestPreSpanHook(e){let t=e.commandInput?.StreamName,n={};return t&&(n[mc]=t),{spanAttributes:n,spanKind:K.CLIENT}}},Jq=`Invoke`,Yq=class{requestPreSpanHook(e){let t=e.commandInput?.FunctionName,n={},r;return e.commandName===Jq&&(n[Rc]=t,n[zc]=`aws`,r=`${t} ${Jq}`),{spanAttributes:n,spanKind:K.CLIENT,spanName:r}}requestPostSpanHook(e,t){e.commandName===Jq&&e.commandInput&&(e.commandInput.ClientContext=Xq(e.commandInput.ClientContext,t))}responseHook(e,t){e.request.commandName===Jq&&(t.setAttribute(Lc,e.requestId),e.request.region&&t.setAttribute(Bc,e.request.region))}};function Xq(e,t){try{let n=jp({span:t}),r=e?JSON.parse(Buffer.from(e,`base64`).toString(`utf8`)):{},i={...r,custom:{...r.custom,...n}},a=Buffer.from(JSON.stringify(i)).toString(`base64`);return a.length>3583?(Z&&j.warn(`[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations.`),e):a}catch(t){return Z&&j.log(`[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext`,t),e}}var Zq=class{requestPreSpanHook(e){let t=e.commandInput?.Bucket,n={};return t&&(n[_c]=t),{spanAttributes:n,spanKind:K.CLIENT}}},Qq=class{requestPreSpanHook(e){let t=e.commandInput?.SecretId,n={};return typeof t==`string`&&t.startsWith(`arn:aws:secretsmanager:`)&&(n[vc]=t),{spanAttributes:n,spanKind:K.CLIENT}}responseHook(e,t){let n=e.data?.ARN;n&&t.setAttribute(vc,n)}},$q=`sentry-trace`,eJ=`baggage`,tJ=[$q,eJ];function nJ(e,t){let n=e??{},r=Object.keys(t);if(Object.keys(n).length+r.length<=10)for(let e of r){let r=t[e];r&&(n[e]={DataType:`String`,StringValue:r})}else Z&&j.warn(`[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes`);return n}function rJ(e){let t=e.MessageAttributes??{},n=t[$q]?.StringValue??t[$q]?.Value;if(n)return{sentryTrace:n,baggage:t[eJ]?.StringValue??t[eJ]?.Value}}function iJ(e=[]){return Lp([...e,...tJ])}var aJ=class{requestPreSpanHook(e){let t=K.CLIENT,n=`SNS ${e.commandName}`,r={[Fl]:`aws.sns`};if(e.commandName===`Publish`){t=K.PRODUCER,r[Dq]=Oq;let{TopicArn:i,TargetArn:a,PhoneNumber:o}=e.commandInput,s=oJ(i,a,o);r[Al]=s,r[jl]=i||a||o||`unknown`,n=`${o?`phone_number`:s} send`}let i=e.commandInput?.TopicArn;return i&&(r[yc]=i),{spanAttributes:r,spanKind:t,spanName:n}}requestPostSpanHook(e,t){if(e.commandName===`Publish`){let n=e.commandInput.MessageAttributes??{};e.commandInput.MessageAttributes=nJ(n,jp({span:t}))}}responseHook(e,t){let n=e.data?.TopicArn;n&&t.setAttribute(yc,n)}};function oJ(e,t,n){if(e||t){let n=e??t;try{return n.substring(n.lastIndexOf(`:`)+1)}catch{return n}}return n||`unknown`}var sJ=class{requestPreSpanHook(e){let t=lJ(e.commandInput),n=uJ(t),r=K.CLIENT,i,a={[Fl]:`aws_sqs`,[jl]:n,[lu]:t};switch(e.commandName){case`ReceiveMessage`:r=K.CONSUMER,i=`${n} receive`,a[Pl]=`receive`,e.commandInput.MessageAttributeNames=iJ(e.commandInput.MessageAttributeNames);break;case`SendMessage`:case`SendMessageBatch`:r=K.PRODUCER,i=`${n} send`}return{spanAttributes:a,spanKind:r,spanName:i}}requestPostSpanHook(e,t){switch(e.commandName){case`SendMessage`:{let n=e.commandInput.MessageAttributes??{};e.commandInput.MessageAttributes=nJ(n,jp({span:t}))}break;case`SendMessageBatch`:{let n=e.commandInput?.Entries;if(Array.isArray(n)){let e=jp({span:t});n.forEach(t=>{t.MessageAttributes=nJ(t.MessageAttributes??{},e)})}}}}responseHook(e,t){switch(e.request.commandName){case`SendMessage`:t.setAttribute(Ml,e?.data?.MessageId);break;case`SendMessageBatch`:break;case`ReceiveMessage`:{let n=e?.data?.Messages||[];t.setAttribute(kl,n.length);for(let e of n)cJ(t,e);break}}}};function cJ(e,t){let n=rJ(t);if(!n)return;let{parentSpanId:r,traceId:i,sampled:a}=Ca(n.sentryTrace,n.baggage);i&&r&&e.addLink({context:{traceId:i,spanId:r,traceFlags:+!!a},attributes:{[Ml]:t.MessageId}})}function lJ(e){return e?.QueueUrl}function uJ(e){if(!e)return;let t=e.split(`/`);if(t.length!==0)return t[t.length-1]}var dJ=class{requestPreSpanHook(e){let t=e.commandInput?.stateMachineArn,n=e.commandInput?.activityArn,r={};return t&&(r[xc]=t),n&&(r[bc]=n),{spanAttributes:r,spanKind:K.CLIENT}}},fJ=class{constructor(){this._services=new Map([[`SecretsManager`,new Qq],[`SFN`,new dJ],[`SQS`,new sJ],[`SNS`,new aJ],[`DynamoDB`,new Kq],[`Lambda`,new Yq],[`S3`,new Zq],[`Kinesis`,new qq],[`BedrockRuntime`,new Mq]])}requestPreSpanHook(e){let t=this._services.get(e.serviceName);return t?t.requestPreSpanHook(e):{}}requestPostSpanHook(e,t){this._services.get(e.serviceName)?.requestPostSpanHook?.(e,t)}responseHook(e,t){this._services.get(e.request.serviceName)?.responseHook?.(e,t)}};function pJ(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function mJ(e,t,n,r){return{serviceName:e?.replace(/\s+/g,``),commandName:pJ(t,`Command`),commandInput:n,region:r}}function hJ(e){return{[Xl]:`aws-api`,[Jl]:e.commandName,[Yl]:e.serviceName,[Cc]:e.region}}var gJ=`Aws`;function _J(e){try{return e()}catch(e){Z&&j.warn(`[orchestrion:aws-sdk] error building span`,e);return}}function vJ(e,t){t&&(t.requestId&&e.setAttribute(gc,t.requestId),t.httpStatusCode&&e.setAttribute(Cl,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(hc,t.extendedRequestId))}var yJ=G((()=>{let e=new fJ;return{name:gJ,setupOnce(){if(!T.tracingChannel)return;let t=t=>_J(()=>{let n=t.arguments[0],r=n?.constructor?.name;if(!n||!r)return;let i=t.self?.config,a=i?.serviceId??pJ(t.self?.constructor?.name||`AWS`,`Client`);n.input||={};let o=mJ(a,r,n.input,void 0),s=e.requestPreSpanHook(o),c=V({name:s.spanName??`${o.serviceName}.${o.commandName}`,kind:s.spanKind??K.CLIENT,op:s.spanOp||`rpc`,attributes:{[L]:Tq,...hJ(o),...s.spanAttributes}});t._sentryNormalizedRequest=o,t._sentryRequestMetadata=s;let l;try{l=i?.region?.()}catch{}let u={settled:!1,promise:Promise.resolve(l).then(e=>{e&&(o.region=e,c.setAttribute(Cc,e))}).catch(()=>{}).finally(()=>{u.settled=!0})};return t._sentryRegion=u,_J(()=>e.requestPostSpanHook(o,c)),c}),n={deferSpanEnd({span:t,data:n,end:r}){let i=n._sentryNormalizedRequest,a=n._sentryRequestMetadata;if(!i)return!1;let o=`error`in n;if(_J(()=>{if(o){let e=n.error,r=e?.$metadata;vJ(t,{requestId:e?.RequestId??r?.requestId,httpStatusCode:r?.httpStatusCode,extendedRequestId:e?.extendedRequestId??r?.extendedRequestId});return}let r=n.result;vJ(t,r?.$metadata);let a={data:r,request:i,requestId:r?.$metadata?.requestId};e.responseHook(a,t)}),a?.isStream&&!o)return!0;let s=n._sentryRegion;return s&&!s.settled?(s.promise.then(()=>r()),!0):!1}},r=[$.AWS_SMITHY_CORE_SEND,$.AWS_SMITHY_CLIENT_SEND,$.AWS_SDK_SMITHY_CLIENT_SEND];Z&&j.log(`[orchestrion:aws-sdk] subscribing to channels "${r.join(`", "`)}"`),W(()=>{for(let e of r)Q(T.tracingChannel(e),t,n)})}}})),bJ=`Dataloader`,xJ=`dataloader`,SJ=`auto.db.orchestrion.dataloader`,CJ=`cache.get`,wJ=Symbol(`sentry.dataloader.wrapped`);function TJ(e,t){let n=e?.name;return n?`${xJ}.${t} ${n}`:`${xJ}.${t}`}function EJ(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}function DJ(e,t,n){let r=t===`load`||t===`loadMany`||t===`batch`;return{name:TJ(e,t),kind:t===`batch`?void 0:K.CLIENT,op:r?CJ:void 0,onlyIfParent:!0,attributes:{[L]:SJ,[Sc]:r?EJ(n):void 0}}}var OJ=(()=>({name:bJ,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:dataloader] subscribing to dataloader tracing channels`),W(()=>{kJ(),AJ(),jJ($.DATALOADER_LOAD_MANY,`loadMany`),jJ($.DATALOADER_PRIME,`prime`),jJ($.DATALOADER_CLEAR,`clear`),jJ($.DATALOADER_CLEAR_ALL,`clearAll`)}))}}));function kJ(){T.tracingChannel($.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!=`function`||n[wJ])return;let r=n,i=function(...e){return B({...DJ(this,`batch`,e[0]),links:this._batch?.spanLinks},()=>r.apply(this,e))};i[wJ]=!0,t.arguments[0]=i})}function AJ(){let e=T.tracingChannel($.DATALOADER_LOAD);Q(e,e=>MJ(e.self,`load`,e.arguments[0]),{requiresParentSpan:!0}),e.end.subscribe(e=>{let t=e,n=t._sentrySpan,r=t.self?._batch;n&&r&&n.isRecording()&&(r.spanLinks??=[]).push({context:n.spanContext()})})}function jJ(e,t){Q(T.tracingChannel(e),e=>MJ(e.self,t,e.arguments[0]),{requiresParentSpan:!0})}function MJ(e,t,n){return V(DJ(e,t,n))}var NJ=G(OJ),PJ=`GenericPool`,FJ=G((()=>({name:PJ,setupOnce(){T.tracingChannel&&W(()=>IJ())}})));function IJ(){Q(T.tracingChannel($.GENERIC_POOL_ACQUIRE),()=>V({name:`generic-pool.acquire`,attributes:{[L]:`auto.db.orchestrion.generic_pool`}}))}var LJ=`Google_GenAI`,RJ=`auto.ai.orchestrion.google_genai`,zJ=[{channel:$.GOOGLE_GENAI_GENERATE_CONTENT,operation:`generate_content`},{channel:$.GOOGLE_GENAI_EMBED_CONTENT,operation:`embeddings`},{channel:$.GOOGLE_GENAI_CHAT,operation:`chat`}],BJ=!1,VJ=((e={})=>({name:LJ,setupOnce(){T.tracingChannel&&!BJ&&(BJ=!0,W(()=>{for(let{channel:t,operation:n}of zJ)Z&&j.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),Q(T.tracingChannel(t),t=>HJ(t,n,e),{beforeSpanEnd:(t,r)=>{n!==`embeddings`&&gb(t,r.result,av(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>WJ(t,n,e)})}))}}));function HJ(e,t,n){if(Zf(LJ))return;if(t!==`chat`){let e=z();if(e){let{op:t,origin:n}=R(e);if(n===RJ&&t===`gen_ai.chat`)return}}let r=(e.arguments??[])[0],{recordInputs:i}=av(n),a=ov(n.enableTruncation),o=mb(t,r,e.self),s=o[`gen_ai.request.model`]||`unknown`;o[L]=RJ;let c=V({name:`${t} ${s}`,op:`gen_ai.${t}`,attributes:o});return i&&r&&hb(c,r,t,a),c}function UJ(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function WJ(e,t,n){let r=t.result;if(!UJ(r))return!1;let{recordOutputs:i}=av(n),a=r[Symbol.asyncIterator].bind(r),o=ub({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var GJ=G(VJ),KJ=`auto.graphql.diagnostic_channel`,qJ=`graphql.parse`,JJ=`graphql.validate`,YJ=`graphql.execute`,XJ=`graphql.resolve`,ZJ=`graphql.field.name`,QJ=`graphql.field.path`,$J=`graphql.field.type`,eY=`graphql.parent.name`,tY=Symbol.for(`opentelemetry.graphql_data`),nY=Symbol.for(`opentelemetry.patched`);function rY(e){return typeof e?.then==`function`}function iY(e,t){if(!e||e[nY])return;e[nY]=!0;let n=e.getFields();Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=aY(t,r.resolve),r.type))for(let e of pY(r.type))iY(e,t)})}function aY(e,t,n=!1){if(typeof t!=`function`||t[nY])return t;function r(r,i,a,o){if(!t)return;let s=a??{};if(e().ignoreTrivialResolveSpans&&n&&(M(r)||typeof r==`function`)&&typeof r[o.fieldName]!=`function`||!s[tY])return t.call(this,r,i,s,o);let{field:c,spanAdded:l}=sY(s,o,fY(o.path)),u=c.span;return H(u,()=>{try{let e=t.call(this,r,i,s,o);return rY(e)?e.then(e=>(oY(u,l),e),e=>{throw oY(u,l,e),e}):(oY(u,l),e)}catch(e){throw oY(u,l,e),e}})}return r[nY]=!0,r}function oY(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function sY(e,t,n){let r=uY(e,n);if(r)return{field:r,spanAdded:!1};let i={span:cY(t,n,dY(e,n))};return lY(e,n,i),{field:i,spanAdded:!0}}function cY(e,t,n){let r={[L]:KJ,[I]:kP,[ZJ]:e.fieldName,[QJ]:t.join(`.`),[$J]:e.returnType.toString(),[eY]:e.parentType.name};return V({name:`${XJ} ${t.join(`.`)}`,attributes:r,parentSpan:n})}function lY(e,t,n){let r=e[tY];r&&(r.fields[t.join(`.`)]=n)}function uY(e,t){return e[tY]?.fields[t.join(`.`)]}function dY(e,t){for(let n=t.length-1;n>0;n--){let r=uY(e,t.slice(0,n));if(r)return r.span}return e[tY]?.span}function fY(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function pY(e){return`ofType`in e&&e.ofType?pY(e.ofType):mY(e)?e.getTypes():hY(e)?[e]:[]}function mY(e){return`getTypes`in e&&typeof e.getTypes==`function`}function hY(e){return`getFields`in e&&typeof e.getFields==`function`}function gY(e,t){let n=e?.definitions;if(!n||!Array.isArray(n))return;let r=e=>!!e?.operation&&[`query`,`mutation`,`subscription`].indexOf(e.operation)!==-1;return t?n.filter(r).find(e=>t===e?.name?.value):n.find(r)}var _Y={[L]:KJ,[I]:kP};function vY(){return V({name:qJ,attributes:{..._Y}})}function yY(e){return V({name:JJ,attributes:{..._Y,[fl]:VP(e)}})}function bY(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:`invalid_argument`})}function xY(e){if(e.length>=2)return{schema:e[0],document:e[1],contextValue:e[3]??{},operationName:e[5],fieldResolver:e[6],writeBack:(t,n)=>{e[3]=t,e[6]=n}};let t=e[0]??{};return{schema:t.schema,document:t.document,contextValue:t.contextValue??{},operationName:t.operationName,fieldResolver:t.fieldResolver,writeBack:(e,n)=>{t.contextValue=e,t.fieldResolver=n}}}function SY(e,t,n,r){let i=xY(e),{schema:a,document:o}=i,{contextValue:s,fieldResolver:c}=i,l=!!s[tY];if(!n.ignoreResolveSpans&&!l){let e=c==null,n=t?.defaultFieldResolver,i=c??n;i&&(c=aY(r,i,e)),a&&(iY(a.getQueryType(),r),iY(a.getMutationType(),r))}let u=gY(o,i.operationName),d=u?.operation,f=u?.name?.value??i.operationName??void 0,p=V({name:RP(d,f||void 0,YJ),attributes:{..._Y,[ml]:d,[pl]:f||void 0,[fl]:VP(o)}});return n.useOperationNameForRootSpan&&d&&IP(p,d,f||void 0),s[tY]={source:o,span:p,fields:{}},i.writeBack(s,c),p}function CY(e,t){zP(t)&&e.setStatus({code:2,message:`internal_error`})}var wY=`Graphql`;function TY(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function EY(e){try{return e()}catch(e){Z&&j.warn(`[orchestrion:graphql] error building span`,e);return}}var DY=G(((e={})=>{let t=TY(e),n=()=>t;return{name:wY,setupOnce(){T.tracingChannel&&W(()=>{Q(T.tracingChannel($.GRAPHQL_PARSE),()=>EY(()=>vY())),Q(T.tracingChannel($.GRAPHQL_VALIDATE),e=>EY(()=>yY(e.arguments[1])),{beforeSpanEnd:(e,t)=>void EY(()=>bY(e,t.result))}),Q(T.tracingChannel($.GRAPHQL_EXECUTE),e=>EY(()=>SY(e.arguments,e.self,t,n)),{beforeSpanEnd:(e,t)=>void EY(()=>CY(e,t.result))})})}}})),OY=e=>{let t=DY(e);return Td(cF(e),{name:wY,setupOnce:()=>t.setupOnce?.()})},kY=[`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`],AY=Symbol(`hapi-handler-patched`),jY={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},MY=new Set(kY),NY=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(NY||{});function PY(e){let t=z();if(!t)return;let n=Xa(t);n&&R(n).data[`sentry.op`]===`http.server`&&n.setAttribute(xl,e)}var FY=e=>typeof e==`string`&&MY.has(e),IY=e=>{let t=e?.type;return t!==void 0&&FY(t)},LY=e=>Array.isArray(e)&&e.length<=3&&FY(e[0])&&typeof e[1]==`function`,RY=e=>!Array.isArray(e),zY=(e,t)=>{let n={[xl]:e.path,[vl]:e.method},r;return t?(n[NY.HAPI_TYPE]=jY.PLUGIN,n[NY.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[NY.HAPI_TYPE]=jY.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},BY=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[NY.EXT_TYPE]:e,[NY.HAPI_TYPE]:jY.EXT,[NY.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[NY.EXT_TYPE]:e,[NY.HAPI_TYPE]:jY.EXT},name:r}};function VY(e,t){return B({name:e.name,op:`${e.attributes[NY.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[L]:`auto.http.orchestrion.hapi`}},t)}function HY(e,t){if(e[AY]===!0)return e;e[AY]=!0;let n=n=>function(...r){return z()?(PY(e.path),VY(zY(e,t),()=>n.call(this,...r))):n.call(this,...r)};if(typeof e.handler==`function`)e.handler=n(e.handler);else if(typeof e.options==`function`){let t=e.options;e.options=function(e){let r=t(e);return typeof r.handler==`function`&&(r.handler=n(r.handler)),r}}else typeof e.options?.handler==`function`&&(e.options.handler=n(e.options.handler));return e}function UY(e,t,n){if(Array.isArray(e)){for(let n=0;n<e.length;n++)e[n]=UY(e[n],t);return e}if(RY(e)){if(e[AY]===!0)return e;e[AY]=!0;let r=function(...r){return z()?VY(BY(t,n,e.name),()=>e.apply(void 0,r)):e.apply(this,r)};return r[AY]=!0,r}return e}function WY(e,t){let n=e[0];if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=HY(n[e],t);else e[0]=HY(n,t)}function GY(e,t){if(Array.isArray(e[0])){let n=e[0];for(let e=0;e<n.length;e++){let r=n[e];if(FY(r.type)){let i=r;i.method=UY(i.method,r.type,t),n[e]=i}}return}if(LY(e)){let n=e,r=n[1];e[1]=UY(r,n[0],t);return}if(IY(e[0])){let n=e[0];n.method=UY(n.method,n.type,t)}}var KY=`Hapi`,qY=G((()=>({name:KY,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:hapi] subscribing to channels "${$.HAPI_ROUTE}" / "${$.HAPI_EXT}"`),T.tracingChannel($.HAPI_ROUTE).subscribe({start(e){let t=e;WY(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),T.tracingChannel($.HAPI_EXT).subscribe({start(e){let t=e;GY(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}))),JY=`Koa`,YY=`auto.http.orchestrion.koa`,XY={ROUTER:`router`,MIDDLEWARE:`middleware`},ZY=Symbol(`sentry.koa.layer-patched`),QY=!1,$Y=((e={})=>{let t=e.ignoreLayersType??[];return{name:JY,setupOnce(){T.tracingChannel&&!QY&&(QY=!0,Z&&j.log(`[orchestrion:koa] subscribing to channel "${$.KOA_USE}"`),T.tracingChannel($.KOA_USE).subscribe({start(e){eX(e,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function eX(e,t){let n=e.arguments[0];typeof n==`function`&&(e.arguments[0]=tX(n,t))}function tX(e,t){return e.router?nX(e,t):rX(e,!1,t)}function nX(e,t){let n=e.router?.stack??[];for(let e of n){let n=e.path,r=e.stack;r.forEach((e,i)=>{r[i]=rX(e,!0,t,n)})}return e}function rX(e,t,n,r){let i=t?XY.ROUTER:XY.MIDDLEWARE;return e[ZY]===!0||n.includes(i)||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[ZY]=!0,(n,a)=>{if(!z())return e(n,a);let o=iX(n,e,t,r);n._matchedRoute&&aX(n._matchedRoute.toString());let s=o.attributes[Dl];return B({name:typeof s==`string`?s||`< unknown >`:o.name,op:`${i}.koa`,attributes:{...o.attributes,[L]:YY}},()=>{let t=o.attributes[xl];if(P()===Qr())Z&&j.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);else if(t){let e=n.request?.method?.toUpperCase()||`GET`;P().setTransactionName(`${e} ${t}`)}return e(n,a)})})}function iX(e,t,n,r){return n?{attributes:{[Dl]:r?.toString(),[Ol]:XY.ROUTER,[xl]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[Dl]:t.name||`middleware`,[Ol]:XY.MIDDLEWARE,[wc]:t.name||`middleware`},name:`middleware - ${t.name}`}}function aX(e){let t=z();if(!t)return;let n=Xa(t);n&&R(n).data[`sentry.op`]===`http.server`&&n.setAttribute(xl,e)}var oX=G($Y),sX=`IORedis`,cX=`auto.db.orchestrion.redis`,lX=`db.connection_string`;function uX(e){return{host:e?.options?.host,port:e?.options?.port}}function dX(e,t){return{[Nc]:`redis`,[lX]:`redis://${e}:${t}`,[Wl]:e,[Gl]:t,[L]:cX}}var fX=new WeakSet;function pX(e){let t=e.arguments?.[0];if(!t||typeof t!=`object`||fX.has(t))return;fX.add(t);let{host:n,port:r}=uX(e.self),i=RI(t.name,t.args??[]);return V({name:i,op:`db`,attributes:{...dX(n,r),[Mc]:i}})}var mX=((e={})=>{let t=e.responseHook;return{name:sX,setupOnce(){if(!T.tracingChannel)return;Z&&j.log(`[orchestrion:ioredis] subscribing to "${$.IOREDIS_COMMAND}"/"${$.IOREDIS_CONNECT}"`);let e=T.tracingChannel($.IOREDIS_COMMAND),n=T.tracingChannel($.IOREDIS_CONNECT);W(()=>{Q(e,pX,{requiresParentSpan:!0,beforeSpanEnd(e,n){if(`error`in n||!t)return;let r=n.arguments?.[0];r&&hX(t,e,r,n.result)}}),Q(n,e=>{let{host:t,port:n}=uX(e.self);return V({name:`connect`,op:`db`,attributes:{...dX(t,n),[Mc]:`connect`}})},{requiresParentSpan:!0})})}}});function hX(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var gX=G(mX),_X=`messaging.destination.partition.id`,vX=`messaging.kafka.message.key`,yX=`messaging.kafka.message.tombstone`,bX=`messaging.kafka.offset`,xX=`process`,SX=`receive`,CX=`send`,wX=`kafka`,TX=`_OTHER`,EX=`auto.kafkajs.orchestrion.producer`,DX=`auto.kafkajs.orchestrion.consumer`,OX=1,kX=0;function AX(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function jX(e){let t=AX(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=Ca(t,AX(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?OX:kX}}]}function MX({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return V({name:`${a} ${e}`,op:`message`,kind:n===`receive`?K.CLIENT:K.CONSUMER,links:r,attributes:{...i,[Fl]:wX,[jl]:e,[Pl]:n,[Nl]:a,[vX]:t?.key?String(t.key):void 0,[yX]:t?.key&&t.value===null?!0:void 0,[bX]:t?.offset,...t?{[L]:DX}:{}}})}function NX(e,t){let n=V({name:`send ${e}`,op:`message`,kind:K.PRODUCER,attributes:{[Fl]:wX,[jl]:e,[vX]:t.key?String(t.key):void 0,[yX]:t.key&&t.value===null?!0:void 0,[_X]:t.partition===void 0?void 0:String(t.partition),[Nl]:`send`,[Pl]:CX,[L]:EX}});t.headers=t.headers??{};let r=jp({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function PX(e,t){let n,r=TX;typeof t==`string`||t===void 0?n=t:typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(t,`message`)&&(n=t.message,r=t.constructor.name),e.forEach(e=>{e.setAttribute(Ic,r),e.setStatus({code:2,message:n})})}function FX(e,t){return Promise.resolve(t).catch(t=>{throw PX(e,t),t}).finally(()=>{e.forEach(e=>e.end())})}var IX=Symbol(`sentry-kafkajs-consumer-callback-wrapped`);function LX(e){return typeof e==`function`&&e[IX]===!0}function RX(e){let t=function(t){return rs({sentryTrace:AX(t.message.headers,`sentry-trace`),baggage:AX(t.message.headers,`baggage`)},()=>{let n=MX({topic:t.topic,message:t.message,operationType:xX,attributes:{[_X]:String(t.partition)}}),r=H(n,()=>e.call(this,t));return FX([n],r)})};return t[IX]=!0,t}function zX(e){let t=function(t){let n=os(()=>MX({topic:t.batch.topic,message:void 0,operationType:SX,attributes:{[kl]:t.batch.messages.length,[_X]:String(t.batch.partition)}}));return H(n,()=>{let r=[n];return t.batch.messages.forEach(e=>{r.push(MX({topic:t.batch.topic,message:e,operationType:xX,links:jX(e.headers),attributes:{[_X]:String(t.batch.partition)}}))}),FX(r,e.call(this,t))})};return t[IX]=!0,t}var BX=`Kafka`;function VX(){T.tracingChannel($.KAFKAJS_SEND_BATCH).subscribe({start(e){let t=[];(e.arguments[0]?.topicMessages??[]).forEach(e=>{e.messages.forEach(n=>{t.push(NX(e.topic,n))})}),e._sentrySpans=t},error(e){e._sentrySpans&&PX(e._sentrySpans,e.error)},asyncEnd(e){e._sentrySpans?.forEach(e=>e.end())}})}function HX(){T.tracingChannel($.KAFKAJS_CONSUMER_RUN).subscribe({start(e){let t=e.arguments[0];t&&typeof t==`object`&&(typeof t.eachMessage==`function`&&!LX(t.eachMessage)&&(t.eachMessage=RX(t.eachMessage)),typeof t.eachBatch==`function`&&!LX(t.eachBatch)&&(t.eachBatch=zX(t.eachBatch)))}})}var UX=G((()=>({name:BX,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:kafkajs] subscribing to channels "${$.KAFKAJS_SEND_BATCH}", "${$.KAFKAJS_CONSUMER_RUN}"`),VX(),HX())}}))),WX=`Knex`,GX=`auto.db.orchestrion.knex`,KX=1021,qX=`db.sql.table`,JX=`sqlite`,YX=`postgresql`,XX=Symbol(`sentry.orchestrion.knex.parent-span`),ZX=(()=>({name:WX,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:knex] subscribing to channel "${$.KNEX_QUERY}"`),W(()=>{QX($.KNEX_QUERY_BUILDER),QX($.KNEX_SCHEMA_BUILDER),QX($.KNEX_RAW),$X()}))}}));function QX(e){T.tracingChannel(e).end.subscribe(e=>{let t=e.result;if(!t||typeof t!=`object`||XX in t)return;let n=z();n&&Object.defineProperty(t,XX,{value:n})})}function $X(){Q(T.tracingChannel($.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[XX]??z();if(!r)return;let i=e.arguments[0],a=t?.client,o=a?.config?.connection,s=o?.connectionString,c=iZ(n),l=i?.method,u=o?.filename||o?.database||aZ(s),d={[L]:GX,"knex.version":e.moduleVersion,[Nc]:nZ(a?.driverName),[qX]:c,[Oc]:l,[Fc]:o?.user,[Ec]:u,[Wl]:o?.host??oZ(s),[Gl]:o?.port??sZ(s),[Kl]:o?.filename===`:memory:`?`inproc`:void 0,[Mc]:i?.sql==null?void 0:mr(i.sql,KX)};return V({name:rZ(u,l,c)??`knex.query`,kind:K.CLIENT,op:`db`,parentSpan:r,attributes:d})},{beforeSpanEnd(e,t){if(`error`in t){let n=eZ(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function eZ(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 t=tZ(e.self)(r.sql,r.bindings||[]);return n.replace(`${t} - `,``)}catch{return n}}function tZ(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 nZ(e){return e===`sqlite3`?JX:e===`pg`?YX:e}function rZ(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function iZ(e){let t=e?._single?.table;return t&&typeof t==`object`?iZ(t):typeof t==`string`?t:void 0}function aZ(e){if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}}function oZ(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function sZ(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var cZ=G(ZX),lZ=bb,uZ=[fy,Ay,rb],dZ=!1;function fZ(){Xf(uZ)}var pZ=((e={})=>({name:lZ,setupOnce(){if(!T.tracingChannel||dZ)return;dZ=!0;let t=Ub(e),n=e=>{fZ();let n=e.arguments;if(!Array.isArray(n))return;let r=n[1];(!r||typeof r!=`object`||Array.isArray(r))&&(r={},n[1]=r),r.callbacks=Hb(r.callbacks,t)};for(let e of[$.LANGCHAIN_CHAT_MODEL_INVOKE,$.LANGCHAIN_CHAT_MODEL_STREAM])Z&&j.log(`[orchestrion:langchain] subscribing to channel "${e}"`),T.tracingChannel(e).start.subscribe(n);W(()=>{for(let t of mG)Z&&j.log(`[orchestrion:langchain] subscribing to channel "${t}"`),Q(T.tracingChannel(t),t=>mZ(t,e))})}}));function mZ(e,t){fZ();let n=(e.arguments??[])[0];return V(Kb(e.self,n,t))}var hZ=G(pZ),gZ=Yb,_Z=!1,vZ=!1,yZ=((e={})=>({name:gZ,setupOnce(){if(!T.tracingChannel||_Z)return;_Z=!0;let t=av(e),n=Ub(t);W(()=>{Z&&j.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_STATE_GRAPH_COMPILE}"`),Q(T.tracingChannel($.LANGGRAPH_STATE_GRAPH_COMPILE),e=>{if(vZ)return;let t=bZ(e.arguments);return V(sx(typeof t?.name==`string`?t.name:void 0))},{beforeSpanEnd:(e,r)=>{xZ(r.result,bZ(r.arguments)??{},t,null,n)}}),Z&&j.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_CREATE_REACT_AGENT}"`);let e=T.tracingChannel($.LANGGRAPH_CREATE_REACT_AGENT);e.start.subscribe(e=>{vZ=!0;try{let{arguments:n}=e,r=bZ(n);r&&Array.isArray(r.tools)&&r.tools.length>0&&$b(r.tools,t,Qb(n)??void 0)}catch(e){Z&&j.error(`[orchestrion:langgraph] failed to wrap createReactAgent tools`,e)}}),e.end.subscribe(e=>{vZ=!1;let{arguments:r,result:i}=e,a=Qb(r)??void 0;xZ(i,a?{name:a}:{},t,Zb(r),n)}),e.error.subscribe(()=>{vZ=!1})})}}));function bZ(e){let t=(e??[])[0];return typeof t==`object`&&t?t:void 0}function xZ(e,t,n,r,i){if(!e||typeof e!=`object`)return;let a=e,o=a.invoke;typeof o==`function`&&(a.invoke=lx(o.bind(a),a,t,n,r,i))}var SZ=G(yZ),CZ=`LruMemoizer`,wZ=G((()=>({name:CZ,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:lru-memoizer] subscribing to channel "${$.LRU_MEMOIZER_LOAD}"`),W(()=>{Q(T.tracingChannel($.LRU_MEMOIZER_LOAD),()=>void 0)}))}}))),TZ=`Mongo`,EZ=`auto.db.orchestrion.mongo`,DZ=new Set([`insert`,`update`,`delete`,`find`,`getMore`,`killCursors`]),OZ=(()=>({name:TZ,setupOnce(){T.tracingChannel&&W(()=>{kZ(),AZ(),jZ()})}}));function kZ(){Q(T.tracingChannel($.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 UF(zF(e.self,n,r,i,EZ))},{requiresParentSpan:!0})}function AZ(){Q(T.tracingChannel($.MONGODB_CHECKOUT),()=>void 0)}function jZ(){for(let e of[`insert`,`update`,`remove`])MZ(e===`insert`?$.MONGODB_V3_INSERT:e===`update`?$.MONGODB_V3_UPDATE:$.MONGODB_V3_REMOVE,t=>({topology:t[0],ns:t[1],command:t[2]?.[0],operation:e}));MZ($.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&DZ.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?VF(t):void 0}}),MZ($.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:`find`})),MZ($.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:`getMore`}))}function MZ(e,t){Q(T.tracingChannel(e),e=>{let n=e.arguments;if(!n)return;let r=t(n);if(r&&typeof r.ns==`string`)return UF(HF(r.ns,r.topology,r.command,r.operation,EZ))},{requiresParentSpan:!0})}var NZ=G(OZ),PZ=`Mongoose`,FZ=`auto.db.orchestrion.mongoose`,IZ=new WeakMap,LZ=!1,RZ=(()=>({name:PZ,setupOnce(){T.tracingChannel&&W(()=>{yF(T.tracingChannel),zZ()})}}));function zZ(){if(!LZ){LZ=!0,Z&&j.log(`[orchestrion:mongoose] subscribing to injected channels`);for(let e of PG)VZ(e).subscribe({start(e){UZ(e.self)}});VZ($.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t==`object`&&UZ(t)}}),HZ($.MONGOOSE_QUERY_EXEC,e=>{let t=e;return BZ(t.mongooseCollection,t.model?.modelName,t.op??`exec`,IZ.get(e))}),HZ($.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return BZ(t?.collection,t?.modelName,`aggregate`,IZ.get(e))}),HZ($.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return BZ(t.collection,t.modelName,`save`)}),HZ($.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return BZ(t.collection,t.modelName,`remove`)}),HZ($.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return BZ(t.collection,t.modelName,`insertMany`)}),HZ($.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return BZ(t.collection,t.modelName,`bulkWrite`)})}}function BZ(e,t,n,r){return jR({collection:e,modelName:t,operation:n,origin:FZ,parentSpan:r})}function VZ(e){return T.tracingChannel(e)}function HZ(e,t){Q(T.tracingChannel(e),e=>{let n=e.self;if(n)return t(n)})}function UZ(e){let t=z();e&&t&&IZ.set(e,t)}var WZ=G(RZ),GZ=`Mysql`,KZ=`db.system`,qZ=`db.connection_string`,JZ=`db.name`,YZ=`db.user`,XZ=`db.statement`,ZZ=`net.peer.name`,QZ=`net.peer.port`,$Z=(()=>({name:GZ,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:mysql] subscribing to channel "${$.MYSQL_QUERY}"`),W(()=>{Q(T.tracingChannel($.MYSQL_QUERY),e=>{let t=tQ(e.arguments[0]),{host:n,port:r,database:i,user:a}=nQ(e.self),o=typeof r==`string`?parseInt(r,10):r,s=typeof o==`number`&&!isNaN(o);return e._sentryCallerScope=N(),V({name:t??`mysql.query`,kind:K.CLIENT,op:`db`,attributes:{[KZ]:`mysql`,[L]:`auto.db.orchestrion.mysql`,[qZ]:rQ(n,s?o:void 0,i),...i?{[JZ]:i}:{},...a?{[YZ]:a}:{},...t?{[XZ]:t}:{},...n?{[ZZ]:n}:{},...s?{[QZ]:o}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!eQ(n))return!1;let r=e._sentryCallerScope;return r&&ks(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}})}))}}));function eQ(e){return`on`in e&&typeof e.on==`function`}function tQ(e){if(typeof e==`string`)return e;if(M(e)&&`sql`in e){let t=e.sql;return typeof t==`string`?t:void 0}}function nQ(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function rQ(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var iQ=G($Z),aQ=`Mysql2`,oQ=`auto.db.orchestrion.mysql2`,sQ=`mysql`;function cQ(){ZF(T.tracingChannel),lQ($.MYSQL2_QUERY),lQ($.MYSQL2_EXECUTE)}function lQ(e){Q(T.tracingChannel(e),e=>{let t=uQ(e.arguments);return V({name:t??`mysql2.query`,kind:K.CLIENT,attributes:{[L]:oQ,[I]:`db`,[Nc]:sQ,...fQ(e.self?.config),[Mc]:t||void 0}})},{requiresParentSpan:!0})}function uQ(e){return dQ(e[0])}function dQ(e){if(typeof e==`string`)return e;if(M(e)&&`sql`in e){let t=e.sql;return typeof t==`string`?t:void 0}}function fQ(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig??e??{},a=typeof n==`string`?parseInt(n,10):n,o=typeof a==`number`&&!isNaN(a);return{[Ec]:r||void 0,[Fc]:i||void 0,[Wl]:t||void 0,[Gl]:o?a:void 0}}var pQ=G((()=>({name:aQ,setupOnce(){T.tracingChannel&&W(()=>{cQ()})}}))),mQ=`OpenAI`,hQ=`auto.ai.orchestrion.openai`,gQ=[{channel:$.OPENAI_CHAT,operation:`chat`},{channel:$.OPENAI_EMBEDDINGS,operation:`embeddings`}],_Q=!1,vQ=((e={})=>({name:mQ,setupOnce(){T.tracingChannel&&!_Q&&(_Q=!0,W(()=>{for(let{channel:t,operation:n}of gQ)Z&&j.log(`[orchestrion:openai] subscribing to channel "${t}"`),Q(T.tracingChannel(t),t=>yQ(t,n,e),{beforeSpanEnd:(t,n)=>{_y(t,n.result,av(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>xQ(t,n,e)})}))}}));function yQ(e,t,n){if(Zf(mQ))return;let r=e.arguments??[],i=r[0],{recordInputs:a}=av(n),o=ov(n.enableTruncation),s=Ty(r,t);s[L]=hQ;let c=V({name:`${t} ${i?.model||`unknown`}`,op:`gen_ai.${t}`,attributes:s});return a&&i&&Ey(c,i,t,o),c}function bQ(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function xQ(e,t,n){let r=t.result;if(!bQ(r))return!1;let{recordOutputs:i}=av(n),a=r[Symbol.asyncIterator].bind(r),o=Cy({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var SQ=G(vQ),CQ=`Postgres`,wQ=`auto.db.orchestrion.postgres`,TQ=`db.system`,EQ=`db.name`,DQ=`db.connection_string`,OQ=`db.user`,kQ=`db.statement`,AQ=`net.peer.name`,jQ=`net.peer.port`,MQ=`db.postgresql.plan`,NQ=`db.postgresql.idle.timeout.millis`,PQ=`db.postgresql.max.client`,FQ=`postgresql`,IQ=`pg.query`,LQ=`pg.connect`,RQ=`pg-pool.connect`,zQ=((e={})=>({name:CQ,setupOnce(){T.tracingChannel&&W(()=>{BQ($.PG_QUERY,VQ,{deferStreamedResult:!0}),e.ignoreConnectSpans||(BQ($.PG_CONNECT,HQ),BQ($.PGPOOL_CONNECT,UQ))})}}));function BQ(e,t,{deferStreamedResult:n=!1}={}){Z&&j.log(`[orchestrion:pg] subscribing to channel "${e}"`),Q(T.tracingChannel(e),e=>(e._sentryCallerScope=N(),V({...t(e),kind:K.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!WQ(n))return!1;let r=e._sentryCallerScope;return r&&ks(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}}:{requiresParentSpan:!0})}function VQ(e){let t=e.self?.connectionParameters??{},n=GQ(e.arguments);return{name:n?.text??IQ,op:`db`,attributes:{...KQ(t),[L]:wQ,[kQ]:n?.text||void 0,[MQ]:typeof n?.name==`string`?n.name:void 0}}}function HQ(e){return{name:LQ,op:`db`,attributes:KQ(e.self?.connectionParameters??{})}}function UQ(e){return{name:RQ,op:`db`,attributes:qQ(e.self?.options??{})}}function WQ(e){return`on`in e&&typeof e.on==`function`}function GQ(e){let t=e[0];if(typeof t==`string`)return{text:t};if(M(t)&&typeof t.text==`string`){let e=t;return{text:e.text,name:e.name}}}function KQ(e){return{[TQ]:FQ,[DQ]:JQ(e),[EQ]:e.database,[OQ]:e.user,[AQ]:e.host,[jQ]:Number.isInteger(e.port)?e.port:void 0}}function qQ(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),a=t?.username||e.user;return{[TQ]:FQ,[DQ]:JQ(e),[NQ]:e.idleTimeoutMillis,[PQ]:e.max,[EQ]:n,[jQ]:i,[AQ]:r||void 0,[OQ]:a||void 0}}function JQ(e){if(e.connectionString)try{let t=new URL(e.connectionString);return t.username=``,t.password=``,t.toString()}catch{return`postgresql://localhost:5432/`}return`postgresql://${e.host||`localhost`}:${e.port||5432}/${e.database||``}`}var YQ=G(zQ),XQ=`PostgresJs`,ZQ=`auto.db.orchestrion.postgresjs`,QQ=`db.response.status_code`,$Q=()=>{},e$=Symbol.for(`sentry.query.from.instrumented.sql`),t$=Symbol(`sentryPostgresJsSpan`),n$=Symbol(`sentryPostgresJsConnectionAttrsSet`),r$=Symbol(`sentryPostgresJsSpanEnded`),i$=new WeakMap,a$=[];function o$(e){a$.some(t=>t.ATTR_SERVER_ADDRESS===e.ATTR_SERVER_ADDRESS&&t.ATTR_SERVER_PORT===e.ATTR_SERVER_PORT&&t.ATTR_DB_NAMESPACE===e.ATTR_DB_NAMESPACE)||a$.push(e)}function s$(){return a$.length===1?a$[0]:void 0}function c$(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!=`object`||!n)return;let r=xw(n);i$.set(t,r),o$(r)}function l$(e,t,n){let r=t;r[n$]||(r[n$]=!0,yw(e,n))}function u$(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[t$],i=i$.get(t);r&&i&&l$(r,n,i)}function d$(e,t,n){let r=e.self;if(!r)return;let i=()=>{e[r$]=!0},a=r.resolve;typeof a==`function`&&(r.resolve=function(...e){i();try{let r=e[0]?.command;bw(t,n,r),t.end()}catch(e){Z&&j.error(`[orchestrion:postgresjs] error ending span in resolve:`,e)}return a.apply(this,e)});let o=r.reject;typeof o==`function`&&(r.reject=function(...e){i();try{let r=e[0];t.setStatus({code:2,message:r?.message||`unknown_error`}),t.setAttribute(QQ,r?.code||`unknown`),t.setAttribute(Ic,r?.name||`unknown`),bw(t,n),t.end()}catch(e){Z&&j.error(`[orchestrion:postgresjs] error ending span in reject:`,e)}return o.apply(this,e)})}var f$=G(((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:XQ,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:postgresjs] subscribing to "${$.POSTGRESJS_HANDLE}"`),T.tracingChannel($.POSTGRESJS_CONNECTION).subscribe({start:$Q,asyncStart:$Q,asyncEnd:$Q,error:$Q,end:c$}),T.tracingChannel($.POSTGRESJS_EXECUTE).subscribe({end:$Q,asyncStart:$Q,asyncEnd:$Q,error:$Q,start:u$}),T.tracingChannel($.POSTGRESJS_CONNECT).subscribe({end:$Q,asyncStart:$Q,asyncEnd:$Q,error:$Q,start:u$}),W(()=>{Q(T.tracingChannel($.POSTGRESJS_HANDLE),e=>{let t=e.self;if(!t||t.executed===!0||t[e$])return;let r=vw(gw(t.strings)),i=V({name:r||`postgresjs.query`,op:`db`,kind:K.CLIENT,attributes:{[L]:ZQ,[Pc]:`postgres`,[jc]:r}});t[t$]=i;let a=s$();if(a&&l$(i,t,a),n)try{n(i,r,a)}catch(e){i.setAttribute(`sentry.hook.error`,`requestHook failed`),Z&&j.error(`[orchestrion:postgresjs] error in requestHook:`,e)}return d$(e,i,r),i},{requiresParentSpan:t!==!1,deferSpanEnd({data:e}){return e[r$]?!0:!(`error`in e)}})}))}}})),p$=`Tedious`,m$=`auto.db.orchestrion.tedious`,h$=`mssql`,g$=`db.sql.table`,_$=Symbol(`sentry.orchestrion.tedious.current-database`);function v$(e){Object.defineProperty(this,_$,{value:e,writable:!0,configurable:!0})}function y$(){this.removeListener(`databaseChange`,v$)}function b$(){T.tracingChannel($.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(v$.call(t,t.config?.options?.database),t.removeListener(`databaseChange`,v$),t.on(`databaseChange`,v$),t.removeListener(`end`,y$),t.once(`end`,y$))})}function x$(e,t){T.tracingChannel(e).start.subscribe(e=>{let n=e,r=n.self,i=n.arguments[0];if(!r||!(i instanceof be))return;let a=0,o=0,s=()=>{o++},c=()=>{a++},l=r[_$],u=S$(i),d={[L]:m$,[Nc]:h$,[Ec]:l,[Fc]:r.config?.userName??r.config?.authentication?.options?.userName,[Mc]:u,[g$]:i.table,[Wl]:r.config?.server,[Gl]:r.config?.options?.port},f=V({name:C$(t,l,u,i.table),kind:K.CLIENT,op:`db`,attributes:d}),p=w$(e=>{i.removeListener(`done`,s),i.removeListener(`doneInProc`,s),i.removeListener(`doneProc`,c),i.removeListener(`error`,p),r.removeListener(`end`,p),f.setAttribute(`tedious.procedure_count`,a),f.setAttribute(`tedious.statement_count`,o),e&&f.setStatus({code:2,message:e.message}),f.end()});if(i.on(`done`,s),i.on(`doneInProc`,s),i.on(`doneProc`,c),i.once(`error`,p),r.on(`end`,p),typeof i.callback==`function`){let e=i.callback;i.callback=function(...t){return p(t[0]),e.apply(this,t)}}})}function S$(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 C$(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 w$(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var T$=G((()=>({name:p$,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:tedious] subscribing to channel "${$.TEDIOUS_EXEC_SQL}"`),W(()=>{b$(),x$($.TEDIOUS_EXEC_SQL,`execSql`),x$($.TEDIOUS_EXEC_SQL_BATCH,`execSqlBatch`),x$($.TEDIOUS_CALL_PROCEDURE,`callProcedure`),x$($.TEDIOUS_EXEC_BULK_LOAD,`execBulkLoad`),x$($.TEDIOUS_PREPARE,`prepare`),x$($.TEDIOUS_EXECUTE,`execute`)}))}}))),E$=Symbol(`SentryVercelAiModelPatched`),D$=Symbol(`SentryVercelAiToolPatched`),O$=0;function k$(){return`v6-${++O$}`}var A$=new WeakMap,j$=new WeakSet,M$=new WeakSet,N$=new WeakMap,P$=new WeakMap,F$=new WeakMap,I$=new WeakSet,L$=!1;function R$(e,t={}){if(!L$){L$=!0;try{z$(e,$.VERCEL_AI_GENERATE_TEXT,X$(`generateText`),t),z$(e,$.VERCEL_AI_STREAM_TEXT,X$(`streamText`),t),z$(e,$.VERCEL_AI_GENERATE_OBJECT,X$(`generateObject`),t),z$(e,$.VERCEL_AI_EMBED,(e,t)=>({type:`embed`,event:{callId:k$(),...$$(e.model),maxRetries:e.maxRetries,value:e.value,...Q$(t)}}),t),z$(e,$.VERCEL_AI_EMBED_MANY,(e,t)=>({type:`embedMany`,event:{callId:k$(),...$$(e.model),maxRetries:e.maxRetries,values:e.values,...Q$(t)}}),t),z$(e,$.VERCEL_AI_EXECUTE_TOOL_CALL,(e,t)=>({type:`executeTool`,event:{callId:k$(),toolCall:e.toolCall,tools:e.tools,...Q$(t)}}),t),W$(e,$.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{Z&&j.log(`Vercel AI orchestrion channel subscription failed.`)}}}function z$(e,t,n,r){let i=e(t),a=e=>{let t=M(e.arguments[0])?e.arguments[0]:{},i=M(t.experimental_telemetry)?t.experimental_telemetry:{};if(i.isEnabled===!1&&!I$.has(i))return;let a=n(t,i);U$(t,i);let o=z(),s=gL(a,r);if(s){A$.set(e,a),j$.add(s);let n=M(t.model)&&t.model.specificationVersion===`v1`;F$.set(s,{callSiteSpan:o,toolErrorsBubbleToCaller:n}),a.type===`executeTool`&&M$.add(s);let c=zI(a.event.callId);c&&N$.set(s,c),P$.set(s,Q$(i)),M(t.tools)&&J$(t.tools,r),n&&K$(t.model,r)}return s};Q(i,e=>a(e),{beforeSpanEnd:(e,t)=>{let n=A$.get(t);if(n){if(`error`in t){let n=F$.get(e)?.callSiteSpan;n&&M(t.error)&&Hn(t.error,`_sentry_active_span`,n)}else n.result=n.type===`executeTool`?{output:t.result}:t.result,xL(e,n,r);n.type!==`streamText`&&oL(n),A$.delete(t)}},deferSpanEnd:({data:e,end:t})=>B$(e,t)})}function B$(e,t){if(A$.get(e)?.type!==`streamText`||`error`in e||!V$(e.result))return!1;let n=e.result;return(async()=>{try{let[r,i,a,o,s]=await Promise.all([n.totalUsage??n.usage,n.text,n.toolCalls,n.finishReason,n.response]);e.result={usage:r,text:i,toolCalls:a,finishReason:o,response:s},t()}catch(e){t(e)}})(),!0}function V$(e){return M(e)&&(H$(e.totalUsage)||H$(e.usage))}function H$(e){return M(e)&&typeof e.then==`function`}function U$(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};I$.add(n),e.experimental_telemetry=n}function W$(e,t,n){e(t).subscribe({end(e){let t=e;M(t.result)&&K$(t.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function G$(){let e=z();return e&&j$.has(e)?e:void 0}function K$(e,t){e[E$]||(e[E$]=!0,q$(e,`doGenerate`,t),q$(e,`doStream`,t))}function q$(e,t,n){let r=e[t];typeof r==`function`&&(e[t]=function(...i){let a=G$();if(!a)return Promise.resolve(r.apply(this,i));let o=M(i[0])?i[0]:{},s=N$.get(a),c={type:`languageModelCall`,event:{callId:s,provider:e.provider,modelId:e.modelId,tools:o.tools??(M(o.mode)?o.mode.tools:void 0),messages:o.prompt,...P$.get(a)}},l=H(a,()=>gL(c,n));if(!l)return Promise.resolve(r.apply(this,i));let u=()=>{t===`doStream`&&s&&sL(s)},d=e=>{throw l.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),l.end(),u(),e};try{return Promise.resolve(r.apply(this,i)).then(e=>t===`doStream`&&M(e)&&HI(e.stream)?(e.stream=UI(e.stream,t=>{c.result={...e,...pL(t)},xL(l,c,n),l.end(),u()},e=>{l.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),l.end(),u()}),e):(c.result=e,xL(l,c,n),l.end(),u(),e),d)}catch(e){return d(e)}})}function J$(e,t){try{for(let[n,r]of Object.entries(e))M(r)&&Y$(n,r,e,t)}catch{Z&&j.log(`Vercel AI orchestrion tool patching failed.`)}}function Y$(e,t,n,r){let i=t.execute;typeof i!=`function`||t[D$]||(t[D$]=!0,t.execute=function(t,...a){let o=G$();if(!o||M$.has(o))return i.apply(this,[t,...a]);let s=M(a[0])?a[0]:{},c={type:`executeTool`,event:{callId:N$.get(o),toolCall:{toolName:e,toolCallId:zI(s.toolCallId),input:t},tools:n,...P$.get(o)}},l=H(o,()=>gL(c,r));if(!l)return i.apply(this,[t,...a]);let u=e=>{throw F$.get(o)?.toolErrorsBubbleToCaller?l.setStatus({code:2,message:e instanceof Error?e.message:`tool_error`}):kL(l,c,e),l.end(),e};try{return Promise.resolve(i.apply(this,[t,...a])).then(e=>(c.result={output:e},xL(l,c,r),l.end(),e),u)}catch(e){return u(e)}})}function X$(e){return(t,n)=>({type:e,event:{callId:k$(),operationId:`ai.${e}`,functionId:zI(n.functionId),...$$(t.model),maxRetries:t.maxRetries,instructions:zI(t.system),messages:Z$(t),...Q$(n)}})}function Z$(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt==`string`?[{role:`user`,content:e.prompt}]:e.messages??e.prompt}function Q$(e){let t=e.isEnabled===!0||void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function $$(e){return{provider:e1(e,`provider`),modelId:e1(e,`modelId`)}}function e1(e,t){return M(e)?zI(e[t]):void 0}var t1=G(((e={})=>Td(NL(e),{options:e,setupOnce(){T.tracingChannel&&W(()=>{R$(T.tracingChannel,e)})}}))),n1=new WeakMap;function r1(e,t){n1.set(e,t)}function i1(e){return n1.get(e)}var a1=new WeakMap;function o1(e){let t=a1.get(e);return t||(t=[],a1.set(e,t)),t}function s1(e,t){o1(e).push(t)}function c1(e){o1(e).pop()}function l1(e){let t=e[0];return Array.isArray(t)?t.map(e=>u1(e)??``).join(`,`):u1(t)}function u1(e){return typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0}function d1(e){let t=o1(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}function f1(e,t){let n=o1(e);if(n.length===0)return;let r=typeof e.originalUrl==`string`?e.originalUrl:``;if(n.every(e=>e===`/`))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)||p1(i))?i:void 0}function p1(e){return e.includes(`:`)||e.includes(`*`)}var m1=`auto.http.express`,h1=`express.name`,g1=`express.type`,_1=()=>{},v1=!1;function y1(e,t){if(!v1){v1=!0;for(let e of[$.EXPRESS_REGISTER,$.ROUTER_REGISTER])t(e).subscribe({start:_1,asyncStart:_1,asyncEnd:_1,error:_1,end:b1});for(let n of[$.EXPRESS_HANDLE,$.ROUTER_HANDLE]){Z&&j.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);Q(r,t=>S1(t,e),{beforeSpanEnd(e,t){t._sentryCleanup?.()}}),r.subscribe({start:_1,asyncEnd:_1,end:_1,error:_1,asyncStart:x1})}}}function b1(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&r1(n,l1(e.arguments??[]))}function x1(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&c1(t)}function S1(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],a=r[1];if(!i||!z())return;let o=C1(n),s=i1(n);s!=null&&(s1(i,s),e._sentryStoredLayer=!0);let c=o===`request_handler`?d1(i):void 0,l=o===`request_handler`&&c!=null?f1(i,c):void 0,u=o===`request_handler`?c||`request handler`:o===`router`?n.path??`/`:n.name??`<anonymous>`;if(l&&w1(l),o===`request_handler`&&c){let e=P();if(e!==Qr()){let t=typeof i.method==`string`?i.method.toUpperCase():`GET`;e.setTransactionName(`${t} ${c}`)}else Z&&j.warn(`[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name`)}if(T1(u,o,t))return;let d=V({name:u,attributes:{[L]:m1,[I]:`${o}.express`,[h1]:u,[g1]:o,...l?{[xl]:l}:{}}});if(a&&typeof a.once==`function`){let t=()=>{d.end()};a.once(`finish`,t),e._sentryCleanup=()=>a.removeListener(`finish`,t)}return d}function C1(e){return e.name===`router`?`router`:e.name===`bound dispatch`||e.name===`handle`?`request_handler`:`middleware`}function w1(e){let t=z(),n=t&&Xa(t);n&&R(n).data[`sentry.op`]===`http.server`&&n.setAttribute(xl,e)}function T1(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 vr(e,r,!0)}catch{return!1}}var E1=`Express`,D1=G(((e={})=>({name:E1,setupOnce(){T.tracingChannel&&W(()=>{y1(e,T.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})));function O1(e,t){return V({name:`${e} ${t.path}`,op:`db.query`,kind:K.CLIENT,attributes:{[L]:`auto.firebase.orchestrion.firestore`,[Ac]:e,...A1(t)}})}function k1(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(C.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(`:`);r===-1?t=e.host:(t=e.host.slice(0,r),n=e.host.slice(r+1))}}return{address:t,port:n?parseInt(n,10):void 0}}function A1(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},i={[Tc]:e.path,[Dc]:t.name,[Pc]:`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:a,port:o}=k1(r);return a&&(i[au]=a),o&&(i[ou]=o),i}var j1=`auto.firebase.orchestrion.functions`,M1=`__sentryFirebaseWrapped`;function N1(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[M1]||(n[r]=P1(i,t))}function P1(e,t){let n=async function(...n){let r=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,i={[L]:j1,[Vc]:r,[Hc]:t,"faas.provider":`firebase`};return process.env.GCLOUD_PROJECT&&(i[`cloud.project_id`]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(i[`cloud.event_source`]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),es({name:`firebase.function.${t}`,op:`function.firebase`,kind:K.SERVER,attributes:i},async t=>{try{let r=await e.apply(this,n);return t.end(),r}catch(e){throw t.setStatus({code:2}),U(e,{mechanism:{type:j1,handled:!1}}),t.end(),await nd(2e3),e}})};return n[M1]=!0,n}var F1=[{channel:$.FIREBASE_FIRESTORE_ADD_DOC,spanName:`addDoc`,useParent:!1},{channel:$.FIREBASE_FIRESTORE_GET_DOCS,spanName:`getDocs`,useParent:!1},{channel:$.FIREBASE_FIRESTORE_SET_DOC,spanName:`setDoc`,useParent:!0},{channel:$.FIREBASE_FIRESTORE_DELETE_DOC,spanName:`deleteDoc`,useParent:!0}],I1=[{channel:$.FIREBASE_FUNCTIONS_HTTP_REQUEST,triggerType:`http.request`},{channel:$.FIREBASE_FUNCTIONS_HTTP_CALL,triggerType:`http.call`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_CREATED,triggerType:`firestore.document.created`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED,triggerType:`firestore.document.updated`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_DELETED,triggerType:`firestore.document.deleted`},{channel:$.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN,triggerType:`firestore.document.written`},{channel:$.FIREBASE_FUNCTIONS_SCHEDULER,triggerType:`scheduler.scheduled`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_FINALIZED,triggerType:`storage.object.finalized`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED,triggerType:`storage.object.archived`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_DELETED,triggerType:`storage.object.deleted`},{channel:$.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED,triggerType:`storage.object.metadataUpdated`}],L1=()=>{};function R1(e){try{return e()}catch(e){Z&&j.warn(`[orchestrion:firebase] error handling channel event`,e);return}}function z1(){for(let{channel:e,spanName:t,useParent:n}of F1)Q(T.tracingChannel(e),e=>R1(()=>{let r=e.arguments[0];if(!r)return;let i=n&&r.parent||r;return O1(t,i)}));for(let{channel:e,triggerType:t}of I1)T.tracingChannel(e).subscribe({start:e=>void R1(()=>N1(e,t)),end:L1,asyncStart:L1,asyncEnd:L1,error:L1})}var B1=`Firebase`,V1=G((()=>({name:B1,setupOnce(){T.tracingChannel&&W(()=>{z1()})}})));function H1(){return!!k.__SENTRY_ORCHESTRION__}function U1(){let{runtime:e,bundler:t}=k.__SENTRY_ORCHESTRION__??{};if(!e&&!t){j.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}j.log(e?`[Sentry] Runtime hook registered, injected libraries=${JSON.stringify(e)}`:`[Sentry] Runtime hook not registered`),j.log(t?`[Sentry] Bundler plugin ran, injected libraries=${JSON.stringify(t)}`:`[Sentry] Bundler plugin did not run`)}var W1=`RedisChannel`,G1=`auto.db.orchestrion.redis`,K1=`db.connection_string`,q1=`redis`;function J1(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function Y1(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function X1(e){let t=e[0];return M(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function Z1(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 Q1(e){return{[Nc]:q1,[Wl]:e?.socket?.host,[Gl]:e?.socket?.port,[K1]:Z1(e?.url),[L]:G1}}function $1(e,t,n){return V({name:`redis-${e}`,kind:K.CLIENT,attributes:{...n,[I]:`db`,[Mc]:RI(e,t)}})}function e0(e){let t=T.tracingChannel($.REDIS_COMMAND),n=()=>{};t.subscribe({end:n,asyncStart:n,asyncEnd:n,start(t){let n=t.arguments?.[0];if(!n||typeof n!=`object`)return;let r=n.callback;if(typeof r!=`function`)return;let i=t.self,a={[Nc]:q1,[L]:G1};a[Wl]=i?.connection_options?.host,a[Gl]=i?.connection_options?.port,i?.address&&(a[K1]=`redis://${i.address}`);let o=$1(n.command,n.args??[],a);t._sentrySpan=o;let s=z();n.callback=function(t,i){t||Y1(e,o,n.command,n.args??[],i),J1(o,t);let a=arguments;return H(s??null,()=>r.apply(this,a))}},error(e){let t=e._sentrySpan;t&&J1(t,e.error)}})}function t0(e,t,n){Q(T.tracingChannel(e),e=>{let n=t(e);if(!n?.length)return;let r=String(n[0]),i=e.self?.options;return $1(r,n.slice(1),Q1(i))},{beforeSpanEnd(e,r){if(`error`in r||!n)return;let i=t(r);i?.length&&Y1(n,e,String(i[0]),i.slice(1),r.result)}})}function n0(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function r0(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(typeof t?.transformArguments==`function`&&Array.isArray(n))try{return t.transformArguments(...X1(n))}catch{return}}function i0(){Q(T.tracingChannel($.NODE_REDIS_CONNECT),e=>{let t=e.self?.options;return V({name:`redis-connect`,kind:K.CLIENT,attributes:{...Q1(t),[I]:`db`}})})}function a0(e,t){Q(T.tracingChannel(e),e=>{let n=e.arguments?.[0],r=Array.isArray(n)?n.length:void 0,i=e.self?.options?.socket;return V({name:t(e),kind:K.CLIENT,attributes:{[L]:G1,[I]:`db.redis`,[Pc]:q1,...r&&r>1?{[kc]:r}:{},...i?.host==null?{}:{[au]:i.host},...i?.port==null?{}:{[ou]:i.port}}})})}var o0=G(((e={})=>{let t=e.responseHook;return{name:W1,setupOnce(){T.tracingChannel&&(Z&&j.log(`[orchestrion:redis] subscribing to "${$.REDIS_COMMAND}" and node-redis channels`),e0(t),W(()=>{t0($.NODE_REDIS_COMMAND,n0,t),t0($.NODE_REDIS_EXECUTOR,r0,t),i0(),a0($.NODE_REDIS_MULTI,()=>`MULTI`),a0($.NODE_REDIS_PIPELINE,()=>`PIPELINE`),a0($.NODE_REDIS_BATCH,e=>e.arguments?.[2]===void 0?`PIPELINE`:`MULTI`)}))}}})),s0={postgresIntegration:YQ,postgresJsIntegration:f$,mongoIntegration:NZ,mysqlIntegration:iQ,mysql2Integration:pQ,genericPoolIntegration:FJ,mongooseIntegration:WZ,lruMemoizerIntegration:wZ,openaiIntegration:SQ,anthropicIntegration:wq,googleGenAIIntegration:GJ,langChainIntegration:hZ,langGraphIntegration:SZ,vercelAiIntegration:t1,amqplibIntegration:mq,hapiIntegration:qY,koaIntegration:oX,expressIntegration:D1,graphqlIntegration:OY,kafkajsIntegration:UX,tediousIntegration:T$,awsIntegration:yJ,firebaseIntegration:V1},c0=`Knex`,l0=X(c0,()=>new rW),u0=G((()=>({name:c0,setupOnce(){H1()?cZ().setupOnce?.():l0()}}))),d0=`db.sql.table`,f0=`mssql`;function p0(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 m0=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}},h0=`@sentry/instrumentation-tedious`,g0=Symbol(`opentelemetry.instrumentation-tedious.current-database`),_0=[`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`];function v0(e){Object.defineProperty(this,g0,{value:e,writable:!0})}var y0=class e extends J{constructor(e={}){super(h0,A,e)}init(){return[new Y(e.COMPONENT,[`>=1.11.0 <20`],e=>{let t=e.Connection.prototype;for(let e of _0)q(t[e])&&this._unwrap(t,e),this._wrap(t,e,this._patchQuery(e));return q(t.connect)&&this._unwrap(t,`connect`),this._wrap(t,`connect`,this._patchConnect),e},e=>{if(e===void 0)return;let t=e.Connection.prototype;for(let e of _0)this._unwrap(t,e);this._unwrap(t,`connect`)})]}_patchConnect(e){return function(){return v0.call(this,this.config?.options?.database),this.removeListener(`databaseChange`,v0),this.on(`databaseChange`,v0),this.once(`end`,()=>{this.removeListener(`databaseChange`,v0)}),e.apply(this,arguments)}}_patchQuery(e){return t=>{let n=this;function r(r){if(!(r instanceof ut))return n._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),t.apply(this,arguments);let i=0,a=0,o=()=>a++,s=()=>i++,c=this[g0],l=(e=>e.sqlTextOrProcedure===`sp_prepare`&&e.parametersByName?.stmt?.value?e.parametersByName.stmt.value:e.sqlTextOrProcedure)(r),u={[L]:`auto.db.otel.tedious`,[Nc]:f0,[Ec]:c,[Fc]:this.config?.userName??this.config?.authentication?.options?.userName,[Mc]:l,[d0]:r.table,[Wl]:this.config?.server,[Gl]:this.config?.options?.port},d=V({name:p0(e,c,l,r.table),kind:K.CLIENT,attributes:u}),f=m0(e=>{r.removeListener(`done`,o),r.removeListener(`doneInProc`,o),r.removeListener(`doneProc`,s),r.removeListener(`error`,f),this.removeListener(`end`,f),d.setAttribute(`tedious.procedure_count`,i),d.setAttribute(`tedious.statement_count`,a),e&&d.setStatus({code:2,message:e.message}),d.end()});return r.on(`done`,o),r.on(`doneInProc`,o),r.on(`doneProc`,s),r.once(`error`,f),this.on(`end`,f),typeof r.callback==`function`?n._wrap(r,`callback`,n._patchCallbackQuery(f)):n._diag.error(`Expected request.callback to be a function`),H(d,()=>t.apply(this,arguments))}return Object.defineProperty(r,"length",{value:t.length,writable:!1}),r}}_patchCallbackQuery(e){return t=>function(n,r,i){return e(n),t.apply(this,arguments)}}};y0.COMPONENT=`tedious`;var b0=y0,x0=`Tedious`,S0=X(x0,()=>new b0({})),C0=G((()=>({name:x0,setupOnce(){S0()}}))),w0=`generic-pool`,T0=`@sentry/instrumentation-generic-pool`,E0=class extends J{constructor(e={}){super(T0,A,e),this._isDisabled=!1}init(){return[new Y(w0,[`>=3.0.0 <4`],e=>{let t=e.Pool;return q(t.prototype.acquire)&&this._unwrap(t.prototype,`acquire`),this._wrap(t.prototype,`acquire`,this._acquirePatcher.bind(this)),e},e=>{let t=e.Pool;return this._unwrap(t.prototype,`acquire`),e}),new Y(w0,[`>=2.4.0 <3`],e=>{let t=e.Pool;return q(t.prototype.acquire)&&this._unwrap(t.prototype,`acquire`),this._wrap(t.prototype,`acquire`,this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let t=e.Pool;return this._unwrap(t.prototype,`acquire`),e}),new Y(w0,[`>=2.0.0 <2.4`],e=>(this._isDisabled=!1,q(e.Pool)&&this._unwrap(e,`Pool`),this._wrap(e,`Pool`,this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){return function(...t){return B({name:`generic-pool.acquire`,attributes:{[L]:`auto.db.otel.generic_pool`}},()=>e.call(this,...t))}}_poolWrapper(e){let t=this._wrap.bind(this),n=this._acquireWithCallbacksPatcher.bind(this);return function(...r){let i=e.apply(this,r);return t(i,`acquire`,n),i}}_acquireWithCallbacksPatcher(e){let t=()=>this._isDisabled;return function(n,r){return t()?e.call(this,n,r):es({name:`generic-pool.acquire`,attributes:{[L]:`auto.db.otel.generic_pool`}},t=>{e.call(this,(e,r)=>{e&&t.setStatus({code:2,message:`internal_error`}),t.end(),n&&n(e,r)},r)})}}},D0=`GenericPool`,O0=X(D0,()=>new E0({})),k0=G((()=>({name:D0,setupOnce(){O0()}}))),A0=`dataloader`,j0=`@sentry/instrumentation-dataloader`,M0=`auto.db.otel.dataloader`;function N0(e){return e[Symbol.toStringTag]===`Module`}function P0(e){return N0(e)?e.default:e}function F0(e,t){let n=e.name;return n?`${A0}.${t} ${n}`:`${A0}.${t}`}function I0(e){if(e===`load`||e===`loadMany`||e===`batch`)return`cache.get`}function L0(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}var R0=class extends J{constructor(e={}){super(j0,A,e)}init(){return[new Y(A0,[`>=2.0.0 <3`],e=>{let t=P0(e);return this._patchLoad(t.prototype),this._patchLoadMany(t.prototype),this._patchPrime(t.prototype),this._patchClear(t.prototype),this._patchClearAll(t.prototype),this._getPatchedConstructor(t)},e=>{let t=P0(e);[`load`,`loadMany`,`prime`,`clear`,`clearAll`].forEach(e=>{q(t.prototype[e])&&this._unwrap(t.prototype,e)})})]}_wrapBatchLoadFn(e){let t=this;return function(...n){return t.isEnabled()?B({name:F0(this,`batch`),links:this._batch?.spanLinks,attributes:{[L]:M0,[I]:I0(`batch`),[Sc]:L0(n[0])},onlyIfParent:!0},()=>e.apply(this,n)):e.call(this,...n)}}_getPatchedConstructor(e){let t=this,n=e.prototype;if(!t.isEnabled())return e;function r(...n){return typeof n[0]==`function`&&(q(n[0])&&t._unwrap(n,0),n[0]=t._wrapBatchLoadFn(n[0])),e.apply(this,n)}return r.prototype=n,r}_patchLoad(e){q(e.load)&&this._unwrap(e,`load`),this._wrap(e,`load`,this._getPatchedLoad.bind(this))}_getPatchedLoad(e){return function(...t){return B({name:F0(this,`load`),kind:K.CLIENT,attributes:{[L]:M0,[I]:I0(`load`),[Sc]:L0(t[0])},onlyIfParent:!0},n=>{let r=e.call(this,...t);return this._batch&&n.isRecording()&&(this._batch.spanLinks||(this._batch.spanLinks=[]),this._batch.spanLinks.push({context:n.spanContext()})),r})}}_patchLoadMany(e){q(e.loadMany)&&this._unwrap(e,`loadMany`),this._wrap(e,`loadMany`,this._getPatchedLoadMany.bind(this))}_getPatchedLoadMany(e){return function(...t){return B({name:F0(this,`loadMany`),kind:K.CLIENT,attributes:{[L]:M0,[I]:I0(`loadMany`),[Sc]:L0(t[0])},onlyIfParent:!0},()=>e.call(this,...t))}}_patchPrime(e){q(e.prime)&&this._unwrap(e,`prime`),this._wrap(e,`prime`,this._getPatchedPrime.bind(this))}_getPatchedPrime(e){return function(...t){return B({name:F0(this,`prime`),kind:K.CLIENT,attributes:{[L]:M0,[I]:I0(`prime`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClear(e){q(e.clear)&&this._unwrap(e,`clear`),this._wrap(e,`clear`,this._getPatchedClear.bind(this))}_getPatchedClear(e){return function(...t){return B({name:F0(this,`clear`),kind:K.CLIENT,attributes:{[L]:M0,[I]:I0(`clear`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClearAll(e){q(e.clearAll)&&this._unwrap(e,`clearAll`),this._wrap(e,`clearAll`,this._getPatchedClearAll.bind(this))}_getPatchedClearAll(e){return function(...t){return B({name:F0(this,`clearAll`),kind:K.CLIENT,attributes:{[L]:M0,[I]:I0(`clearAll`)},onlyIfParent:!0},()=>e.call(this,...t))}}},z0=`Dataloader`,B0=X(z0,()=>new R0),V0=G((()=>({name:z0,setupOnce(){H1()?NJ().setupOnce?.():B0()}}))),H0=(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))(H0||{}),U0=`messaging.operation`,W0=`messaging.destination`,G0=`messaging.destination_kind`,K0=`messaging.rabbitmq.routing_key`,q0=`messaging.protocol`,J0=`messaging.protocol_version`,Y0=`messaging.url`,X0=`messaging.message_id`,Z0=`messaging.conversation_id`,Q0=`topic`,$0=`process`;x();var e2=`auto.amqplib.otel.publisher`,t2=`auto.amqplib.otel.consumer`,n2=Symbol(`opentelemetry.amqplib.message.stored-span`),r2=Symbol(`opentelemetry.amqplib.channel.spans-not-ended`),i2=Symbol(`opentelemetry.amqplib.channel.consumer-timeout-timer`),a2=Symbol(`opentelemetry.amqplib.connection.attributes`),o2=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),s2=e=>e===``?`<default>`:e,c2=e=>e.replace(/:[^:@/]*@/,`:***@`),l2=(e,t)=>e||(t===`AMQP`?5672:5671),u2=e=>{let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()},d2=e=>e||`localhost`,f2=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Fl]:t}:{}},p2=e=>{let t={[J0]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=u2(e?.protocol);t[q0]=r,t[Wl]=d2(e?.hostname),t[Gl]=l2(e.port,r)}else{let e=c2(n);t[Y0]=e;try{let n=new URL(e),r=u2(n.protocol);t[q0]=r,t[Wl]=d2(n.hostname),t[Gl]=l2(n.port?parseInt(n.port):void 0,r)}catch{}}return t};function m2(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}function h2(e,t,n,r){let i=V({name:`publish ${s2(e)}`,kind:y.PRODUCER,attributes:{...n.connection[a2],[W0]:e,[G0]:Q0,[K0]:t,[X0]:r?.messageId,[Z0]:r?.correlationId,[L]:e2}}),a=r??{};a.headers=a.headers??{};let o=jp({span:i});return o[`sentry-trace`]&&(a.headers[`sentry-trace`]=o[`sentry-trace`]),o.baggage&&(a.headers.baggage=o.baggage),{span:i,modifiedOptions:a}}function g2(e,t,n){return V({name:`${e} process`,kind:y.CONSUMER,attributes:{...n?.connection?.[a2],[W0]:t.fields?.exchange,[G0]:Q0,[K0]:t.fields?.routingKey,[U0]:$0,[X0]:t?.properties.messageId,[Z0]:t?.properties.correlationId,[L]:t2}})}var _2=6e4;function v2(e,t,n,r){let i=e[n2];i&&(t!==!1&&i.setStatus({code:2,message:n!==H0.ChannelClosed&&n!==H0.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[n2]=void 0)}function y2(e,t,n,r){(e[r2]??[]).forEach(e=>{v2(e.msg,t,n,r)}),e[r2]=[]}function b2(e){let t=Ir(),n=e[r2]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<_2)break;v2(e.msg,null,H0.InstrumentationTimeout,!0)}n.splice(0,r)}function x2(e){return function(t,n,r){return e.call(this,t,n,function(e,n){if(e==null){let e=p2(t),r=f2(n);n[a2]={...e,...r}}r.apply(this,arguments)})}}function S2(e){return function(t){if(t===`close`){y2(this,!0,H0.ChannelClosed,void 0);let e=this[i2];e&&clearInterval(e),this[i2]=void 0}else t===`error`&&y2(this,!0,H0.ChannelError,void 0);return e.apply(this,arguments)}}function C2(e,t){return n=>function(r){return y2(this,e,t,r),n.apply(this,arguments)}}function w2(e,t){return n=>function(r,i,a){let o=this,s=t===H0.Reject?i:a,c=o[r2]??[],l=c.findIndex(e=>e.msg===r);if(l<0)v2(r,e,t,s);else if(t!==H0.Reject&&i){for(let n=0;n<=l;n++)v2(c[n].msg,e,t,s);c.splice(0,l+1)}else v2(r,e,t,s),c.splice(l,1);return n.apply(this,arguments)}}function T2(e){return function(t,n,r){let i=this;if(!Object.prototype.hasOwnProperty.call(i,r2)){let e=setInterval(()=>{b2(i)},_2);e.unref(),i[i2]=e,i[r2]=[]}let a=function(e){if(!e)return n.call(this,e);let a=e.properties.headers??{};rs({sentryTrace:m2(a,`sentry-trace`),baggage:m2(a,`baggage`)},()=>{let a=g2(t,e,i);r?.noAck||(i[r2].push({msg:e,timeOfConsume:Ir()}),e[n2]=a),H(a,()=>{n.call(this,e)}),r?.noAck&&a.end()})},o=Array.prototype.slice.call(arguments);return o[1]=a,e.apply(this,o)}}function E2(e){return function(t,n,r,i,a){let o=this,{span:s,modifiedOptions:c}=h2(t,n,o,i),l=function(e,t){try{H(s,()=>{a?.call(this,e,t)})}finally{e&&s.setStatus({code:2,message:`message confirmation has been nack'ed`}),s.end()}},u=[...arguments];u[3]=c,u[4]=l,o[o2]=!0;try{return e.apply(this,u)}finally{o[o2]=!1}}}function D2(e){return function(t,n,r,i){if(this[o2])return e.apply(this,arguments);let{span:a,modifiedOptions:o}=h2(t,n,this,i),s=[...arguments];s[3]=o;let c=e.apply(this,s);return a.end(),c}}var O2=`@sentry/instrumentation-amqplib`,k2=[`>=0.5.5 <2`],A2=class extends J{constructor(e={}){super(O2,A,e)}init(){let e=new RR(`amqplib/lib/channel_model.js`,k2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),t=new RR(`amqplib/lib/callback_model.js`,k2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this));return new Y(`amqplib`,k2,void 0,void 0,[e,new RR(`amqplib/lib/connect.js`,k2,this.patchConnect.bind(this),this.unpatchConnect.bind(this)),t])}patchConnect(e){let t=this.unpatchConnect(e);return q(t.connect)||this._wrap(t,`connect`,x2),t}unpatchConnect(e){return q(e.connect)&&this._unwrap(e,`connect`),e}patchChannelModel(e){return q(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,`publish`,D2),q(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,`consume`,T2),q(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,`ack`,w2(!1,H0.Ack)),q(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,`nack`,w2(!0,H0.Nack)),q(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,`reject`,w2(!0,H0.Reject)),q(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,`ackAll`,C2(!1,H0.AckAll)),q(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,`nackAll`,C2(!0,H0.NackAll)),q(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,`emit`,S2),q(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,`publish`,E2),e}unpatchChannelModel(e){return q(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,`publish`),q(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,`consume`),q(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,`ack`),q(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,`nack`),q(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,`reject`),q(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,`ackAll`),q(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,`nackAll`),q(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,`emit`),q(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,`publish`),e}},j2=`Amqplib`,M2=X(j2,()=>new A2),N2=G((()=>({name:j2,setupOnce(){M2()}}))),P2=`VercelAI`,F2=[`>=3.0.0 <7`],I2=[`generateText`,`streamText`,`generateObject`,`streamObject`,`embed`,`embedMany`,`rerank`];function L2(e){if(typeof e!=`object`||!e)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 R2(e){if(typeof e!=`object`||!e||!(`content`in e)||typeof e.consumeStream==`function`)return;let t=e;Array.isArray(t.content)&&(z2(t.content),B2(t.content))}function z2(e){for(let t of e){if(!L2(t))continue;let e=Wv(t.toolCallId);yi(e?n=>{n.setContext(`trace`,{trace_id:e.traceId,span_id:e.spanId}),n.setTag(`vercel.ai.tool.name`,t.toolName),n.setTag(`vercel.ai.tool.callId`,t.toolCallId),n.setLevel(`error`),U(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})}:e=>{e.setTag(`vercel.ai.tool.name`,t.toolName),e.setTag(`vercel.ai.tool.callId`,t.toolCallId),e.setLevel(`error`),U(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})})}}function B2(e){for(let t of e)typeof t==`object`&&t&&`toolCallId`in t&&typeof t.toolCallId==`string`&&Gv(t.toolCallId)}function V2(e,t,n,r,i){return{recordInputs:e?.recordInputs===void 0?t.recordInputs===void 0?n===!0||r:t.recordInputs:e.recordInputs,recordOutputs:e?.recordOutputs===void 0?t.recordOutputs===void 0?n===!0||i:t.recordOutputs:e.recordOutputs}}var H2=class extends J{constructor(e={}){super(`@sentry/instrumentation-vercel-ai`,A,e),this._isPatched=!1,this._callbacks=[]}init(){return new Y(`ai`,F2,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(e=>e()),this._callbacks=[];let t=e=>new Proxy(e,{apply:(e,t,n)=>{let r=n[0].experimental_telemetry||{},i=r.isEnabled,a=F(),o=a?.getIntegrationByName(P2),s=o?.options,c=o?a?.getDataCollectionOptions().genAI:void 0,{recordInputs:l,recordOutputs:u}=V2(s,r,i,!!c?.inputs,!!c?.outputs);return n[0].experimental_telemetry={...r,isEnabled:i===void 0||i,recordInputs:l,recordOutputs:u},Xo(()=>Reflect.apply(e,t,n),e=>{e&&typeof e==`object`&&Hn(e,`_sentry_active_span`,z())},()=>{},e=>{R2(e)})}});if(Object.prototype.toString.call(e)===`[object Module]`){for(let n of I2)e[n]!=null&&(e[n]=t(e[n]));return e}{let n=I2.reduce((n,r)=>(e[r]!=null&&(n[r]=t(e[r])),n),{});return{...e,...n}}}},U2=X(P2,()=>new H2({}));function W2(e){return!!e.getIntegrationByName(`Modules`)?.getModules?.()?.ai}var G2=G(((e={})=>{let t;return Td(NL(e),{options:e,setupOnce(){t=U2()},afterAllSetup(n){e.force??W2(n)?sy(n):t?.callWhenPatched(()=>sy(n))}})})),K2=[`>=4.0.0 <8`],q2=class extends J{constructor(e={}){super(`@sentry/instrumentation-openai`,A,e)}init(){return new Y(`openai`,K2,this._patch.bind(this))}_patch(e){let t=e;return t=this._patchClient(t,`OpenAI`),t=this._patchClient(t,`AzureOpenAI`),t}_patchClient(e,t){let n=e[t];if(!n)return e;let r=this.getConfig(),i=function(...e){return Zf(`OpenAI`)?Reflect.construct(n,e):ky(Reflect.construct(n,e),r)};Object.setPrototypeOf(i,n),Object.setPrototypeOf(i.prototype,n.prototype);for(let e of Object.getOwnPropertyNames(n))if(![`length`,`name`,`prototype`].includes(e)){let t=Object.getOwnPropertyDescriptor(n,e);t&&Object.defineProperty(i,e,t)}try{e[t]=i}catch{Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=i}catch{Object.defineProperty(e,"default",{value:i,writable:!0,configurable:!0,enumerable:!0})}return e}},J2=X(fy,e=>new q2(e)),Y2=G(((e={})=>({name:fy,setupOnce(){J2(e)}}))),X2=[`>=0.19.2 <1.0.0`],Z2=class extends J{constructor(e={}){super(`@sentry/instrumentation-anthropic-ai`,A,e)}init(){return new Y(`@anthropic-ai/sdk`,X2,this._patch.bind(this))}_patch(e){let t=e.Anthropic,n=this.getConfig(),r=function(...e){return Zf(`Anthropic_AI`)?Reflect.construct(t,e):nb(Reflect.construct(t,e),n)};Object.setPrototypeOf(r,t),Object.setPrototypeOf(r.prototype,t.prototype);for(let e of Object.getOwnPropertyNames(t))if(![`length`,`name`,`prototype`].includes(e)){let n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(r,e,n)}try{e.Anthropic=r}catch{Object.defineProperty(e,"Anthropic",{value:r,writable:!0,configurable:!0,enumerable:!0})}if(e.default===t)try{e.default=r}catch{Object.defineProperty(e,"default",{value:r,writable:!0,configurable:!0,enumerable:!0})}return e}},Q2=X(Ay,e=>new Z2(e)),$2=G(((e={})=>({name:Ay,options:e,setupOnce(){Q2(e)}}))),e4=[`>=0.10.0 <2`],t4=class extends J{constructor(e={}){super(`@sentry/instrumentation-google-genai`,A,e)}init(){return new Y(`@google/genai`,e4,e=>this._patch(e),e=>e,[new RR(`@google/genai/dist/node/index.cjs`,e4,e=>this._patch(e),e=>e)])}_patch(e){let t=e.GoogleGenAI,n=this.getConfig();if(typeof t!=`function`)return e;let r=function(...e){return Zf(`Google_GenAI`)?Reflect.construct(t,e):yb(Reflect.construct(t,e),n)};Object.setPrototypeOf(r,t),Object.setPrototypeOf(r.prototype,t.prototype);for(let e of Object.getOwnPropertyNames(t))if(![`length`,`name`,`prototype`].includes(e)){let n=Object.getOwnPropertyDescriptor(t,e);n&&Object.defineProperty(r,e,n)}return xx(e,`GoogleGenAI`,r),e}},n4=X(rb,e=>new t4(e)),r4=G(((e={})=>({name:rb,setupOnce(){n4(e)}}))),i4=[`>=0.1.0 <2.0.0`];function a4(e,t,n){return new Proxy(e,{apply(e,n,r){let i=r[1];return(!i||typeof i!=`object`||Array.isArray(i))&&(i={},r[1]=i),i.callbacks=Hb(i.callbacks,t),Reflect.apply(e,n,r)}})}var o4=class extends J{constructor(e={}){super(`@sentry/instrumentation-langchain`,A,e)}init(){let e=[];for(let t of[`@langchain/anthropic`,`@langchain/openai`,`@langchain/google-genai`,`@langchain/mistralai`,`@langchain/google-vertexai`,`@langchain/groq`])e.push(new Y(t,i4,this._patch.bind(this),e=>e,[new RR(`${t}/dist/index.cjs`,i4,this._patch.bind(this),e=>e)]));return e.push(new Y(`langchain`,i4,this._patch.bind(this),e=>e,[new RR(`langchain/dist/chat_models/universal.cjs`,i4,this._patch.bind(this),e=>e)])),e}_patch(e){Xf([fy,Ay,rb]);let t=this.getConfig(),n=Ub(t);return this._patchRunnableMethods(e,n),this._patchEmbeddingsMethods(e,t),e}_patchRunnableMethods(e,t){let n=[`ChatAnthropic`,`ChatOpenAI`,`ChatGoogleGenerativeAI`,`ChatMistralAI`,`ChatVertexAI`,`ChatGroq`,`ConfigurableModel`],r=e.universal_exports??e,i=Object.values(r).find(e=>typeof e==`function`&&n.includes(e.name));if(!i)return;let a=i.prototype;if(!a.__sentry_patched__){a.__sentry_patched__=!0;for(let e of[`invoke`,`stream`,`batch`]){let n=a[e];typeof n==`function`&&(a[e]=a4(n,t))}}}_patchEmbeddingsMethods(e,t){let n=e.universal_exports??e;for(let e of Object.values(n)){if(typeof e!=`function`||!e.prototype)continue;let n=e.prototype;typeof n.embedQuery==`function`&&typeof n.embedDocuments==`function`&&(n.__sentry_patched__||(n.__sentry_patched__=!0,Jb(n,t)))}}},s4=X(bb,e=>new o4(e)),c4=G(((e={})=>({name:bb,setupOnce(){s4(e)}}))),l4=[`>=0.0.0 <2.0.0`],u4=class extends J{constructor(e={}){super(`@sentry/instrumentation-langgraph`,A,e)}init(){return[new Y(`@langchain/langgraph`,l4,this._patch.bind(this),e=>e,[new RR(`@langchain/langgraph/dist/index.cjs`,l4,this._patch.bind(this),e=>e),new RR(`@langchain/langgraph/dist/prebuilt/index.cjs`,l4,this._patch.bind(this),e=>e)]),new Y(`@langchain/langgraph/prebuilt`,l4,this._patch.bind(this),e=>e,[new RR(`@langchain/langgraph/dist/prebuilt/index.cjs`,l4,this._patch.bind(this),e=>e)])]}_patch(e){let t=F()?.getDataCollectionOptions().genAI,n={...this.getConfig(),recordInputs:this.getConfig().recordInputs??t?.inputs??!1,recordOutputs:this.getConfig().recordOutputs??t?.outputs??!1};if(e.StateGraph&&typeof e.StateGraph==`function`&&dx(e.StateGraph.prototype,n),e.createReactAgent&&typeof e.createReactAgent==`function`){let t=e.createReactAgent;Object.defineProperty(e,"createReactAgent",{value:ux(t,n),writable:!0,enumerable:!0,configurable:!0})}return e}},d4=X(Yb,e=>new u4(e)),f4=G(((e={})=>({name:Yb,setupOnce(){d4(e)}}))),p4=G(e=>(Pd()||rn(()=>{console.warn(`The launchDarklyIntegration() can only be used in the browser.`)}),{name:`LaunchDarkly`}));function m4(){return Pd()||rn(()=>{console.warn(`The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.`)}),{name:`sentry-flag-auditor`,type:`flag-used`,synchronous:!0,method:()=>null}}var h4=G(e=>(Pd()||rn(()=>{console.warn(`The openFeatureIntegration() can only be used in the browser.`)}),{name:`OpenFeature`})),g4=class{constructor(){Pd()||rn(()=>{console.warn(`The OpenFeatureIntegrationHook can only be used in the browser.`)})}after(){}error(){}},_4=G(e=>(Pd()||rn(()=>{console.warn(`The statsigIntegration() can only be used in the browser.`)}),{name:`Statsig`})),v4=G(e=>(Pd()||rn(()=>{console.warn(`The unleashIntegration() can only be used in the browser.`)}),{name:`Unleash`})),y4=og;function b4(e,t,n){let r=new Y(`@firebase/firestore`,e,e=>x4(e,t,n));for(let i of[`@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`])r.files.push(new RR(i,e,e=>x4(e,t,n),e=>S4(e,n)));return r}function x4(e,t,n){return S4(e,n),t(e,`addDoc`,C4()),t(e,`getDocs`,T4()),t(e,`setDoc`,E4()),t(e,`deleteDoc`,w4()),e}function S4(e,t){for(let n of[`addDoc`,`getDocs`,`setDoc`,`deleteDoc`])q(e[n])&&t(e,n);return e}function C4(){return function(e){return function(t,n){return D4(`addDoc`,t,()=>e(t,n))}}}function w4(){return function(e){return function(t){return D4(`deleteDoc`,t.parent||t,()=>e(t))}}}function T4(){return function(e){return function(t){return D4(`getDocs`,t,()=>e(t))}}}function E4(){return function(e){return function(t,n,r){return D4(`setDoc`,t.parent||t,()=>r===void 0?e(t,n):e(t,n,r))}}}function D4(e,t,n){return B({name:`${e} ${t.path}`,op:`db.query`,kind:K.CLIENT,attributes:{[L]:`auto.firebase.otel.firestore`,[Ac]:e,...k4(t)}},n)}function O4(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(C.isIPv6(e.host))t=e.host;else{let r=e.host.lastIndexOf(`:`);r===-1?t=e.host:(t=e.host.slice(0,r),n=e.host.slice(r+1))}}return{address:t,port:n?parseInt(n,10):void 0}}function k4(e){let t=e.firestore.app,n=t.options,r=(e.firestore.toJSON()||{}).settings||{},i={[Tc]:e.path,[Dc]:t.name,[Pc]:`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:a,port:o}=O4(r);return a&&(i[au]=a),o&&(i[ou]=o),i}function A4(e,t,n){let r=new Y(`firebase-functions`,e);return[{name:`firebase-functions/lib/v2/providers/https.js`,triggerType:`function`},{name:`firebase-functions/lib/v2/providers/firestore.js`,triggerType:`firestore`},{name:`firebase-functions/lib/v2/providers/scheduler.js`,triggerType:`scheduler`},{name:`firebase-functions/lib/v2/storage.js`,triggerType:`storage`}].forEach(({name:i,triggerType:a})=>{r.files.push(new RR(i,e,e=>M4(e,t,n,a),e=>N4(e,n)))}),r}function j4(e){return function(t){return function(...n){let r=typeof n[0]==`function`?n[0]:n[1],i=typeof n[0]==`function`?void 0:n[0];if(!r)return t.call(this,...n);let a=async function(...t){let n=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,i={[L]:`auto.firebase.otel.functions`,"faas.name":n,"faas.trigger":e,"faas.provider":`firebase`};return process.env.GCLOUD_PROJECT&&(i[`cloud.project_id`]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(i[`cloud.event_source`]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),es({name:`firebase.function.${e}`,op:`http.request`,kind:K.SERVER,attributes:i},async e=>{try{let n=await r.apply(this,t);return e.end(),n}catch(t){throw e.setStatus({code:2}),U(t,{mechanism:{type:`auto.firebase.otel.functions`,handled:!1}}),e.end(),await nd(2e3),t}})};return i?t.call(this,i,a):t.call(this,a)}}}function M4(e,t,n,r){switch(N4(e,n),r){case`function`:t(e,`onRequest`,j4(`http.request`)),t(e,`onCall`,j4(`http.call`));break;case`firestore`:t(e,`onDocumentCreated`,j4(`firestore.document.created`)),t(e,`onDocumentUpdated`,j4(`firestore.document.updated`)),t(e,`onDocumentDeleted`,j4(`firestore.document.deleted`)),t(e,`onDocumentWritten`,j4(`firestore.document.written`)),t(e,`onDocumentCreatedWithAuthContext`,j4(`firestore.document.created`)),t(e,`onDocumentUpdatedWithAuthContext`,j4(`firestore.document.updated`)),t(e,`onDocumentDeletedWithAuthContext`,j4(`firestore.document.deleted`)),t(e,`onDocumentWrittenWithAuthContext`,j4(`firestore.document.written`));break;case`scheduler`:t(e,`onSchedule`,j4(`scheduler.scheduled`));break;case`storage`:t(e,`onObjectFinalized`,j4(`storage.object.finalized`)),t(e,`onObjectArchived`,j4(`storage.object.archived`)),t(e,`onObjectDeleted`,j4(`storage.object.deleted`)),t(e,`onObjectMetadataUpdated`,j4(`storage.object.metadataUpdated`))}return e}function N4(e,t){for(let n of[`onSchedule`,`onRequest`,`onCall`,`onObjectFinalized`,`onObjectArchived`,`onObjectDeleted`,`onObjectMetadataUpdated`,`onDocumentCreated`,`onDocumentUpdated`,`onDocumentDeleted`,`onDocumentWritten`,`onDocumentCreatedWithAuthContext`,`onDocumentUpdatedWithAuthContext`,`onDocumentDeletedWithAuthContext`,`onDocumentWrittenWithAuthContext`])q(e[n])&&t(e,n);return e}var P4=[`>=3.0.0 <5`],F4=[`>=6.0.0 <7`],I4=class extends J{constructor(e={}){super(`@sentry/instrumentation-firebase`,A,e)}init(){let e=[];return e.push(b4(P4,this._wrap,this._unwrap)),e.push(A4(F4,this._wrap,this._unwrap)),e}},L4=`Firebase`,R4=X(L4,()=>new I4),z4=G((()=>({name:L4,setupOnce(){R4()}})));function B4(){return[fP(),IR(),wz(),lU(),mB(),MB(),WB(),sV(),ZV(),wH(),CI(),XH(),CU(),IU(),C0(),k0(),Kz(),N2(),Zz(),c4(),f4(),G2(),Y2(),$2(),r4(),MH(),z4()]}function V4(){return[AN,uP,FU,NR,YH,cU,Gz,SU,Xz,pB,jB,UB,oV,CH,YH,Cz,XV,S0,O0,M2,s4,U2,J2,AH,R4,Q2,n4,d4]}x();var H4=1e6,U4=Symbol.for(`opentelemetry.js.api.1`);function W4(e){if(g.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[U4];if(n&&!n.trace){if(aP&&j.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[U4]=void 0,!g.setGlobalTracerProvider(e))return!1;let r=t[U4];if(r){let{propagation:e,context:i,...a}=n;t[U4]={...a,...r}}return!0}return!1}function G4(e,t={}){e.getOptions().debug&&hA();let[n,r]=J4(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function K4(e={}){let{debug:t}=e;t&&j.enable(),EM(),q4(e.integrations).forEach(e=>{e(),t&&j.log(`[Sentry] Preloaded ${e.id} instrumentation`)})}function q4(e){let t=V4();return e?t.filter(t=>{let n=t.id;return e.some(e=>n===e||n.startsWith(`${e}.`))}):t}function J4(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||t.spanProcessors?.length))return Y4(e);let n=new nO({sampler:new Hk(e),resource:aA(`node`),forceFlushTimeoutMillis:500,spanProcessors:[new Vk({timeout:X4(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});W4(n),d.setGlobalPropagator(new qO);let i=new mA;return r.setGlobalContextManager(i),[n,i.getAsyncLocalStorageLookup()]}function Y4(e){let t=new Qk({resource:aA(`node`)});if(!W4(t))return aP&&j.warn(`Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered.`),[void 0,void 0];KO(`SentryTracerProvider`),d.setGlobalPropagator(new qO);let n=new mA;return r.setGlobalContextManager(n),e.on(`spanEnd`,e=>{qk(e,{finalizeStatus:!0})}),Uo(e)&&e.on(`preprocessSpan`,Bk),e.on(`preprocessEvent`,e=>{e.type===`transaction`&&(e.contexts={...e.contexts,otel:{resource:t.resource?.attributes,...e.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function X4(e){if(e!=null){if(e>H4)return aP&&j.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${H4}`),H4;if(e<=0||Number.isNaN(e)){aP&&j.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function Z4(){return DM().filter(e=>e.name!==`Http`&&e.name!==`NodeFetch`).concat(jN(),MN())}function Q4(e){return[...Z4(),...eo(e)?B4():[]]}function $4(e,t){if(dV()&&eo(t)){let t=fV();if(t){let n=new Set(t.replacedOtelIntegrationNames);return[...e.filter(e=>!n.has(e.name)),...t.integrations]}}return e}function e3(e={}){return t3(e,Q4)}function t3(e={},t){Ap(e,`node`);let n=dV()&&eo(e)?fV():void 0;n&&n.register();let r=e.defaultIntegrations??t(e);if(n&&Array.isArray(r)&&r.length>0){let e=new Set(n.replacedOtelIntegrationNames);r=[...r.filter(t=>!e.has(t.name)),...n.integrations]}let i=OM({...e,defaultIntegrations:r});return i&&!e.skipOpenTelemetrySetup&&(G4(i,{spanProcessors:e.openTelemetrySpanProcessors}),AM()),n&&n.detect(),i}function n3(e={}){return t3(e,()=>[])}var r3=[...sW,...uW,...pW,..._W,...bW,...OW,...jW,...FW,...RW,...VW,...WW,...qW,...nG,...aG,...pG,...bG,...CG,...DG,...MG,...IG,...zG,...UG,...KG,...YG,...QG,...tK,...iK,...uK,...pK];[...lW,...fW,...hW,...yW,...SW,...AW,...NW,...LW,...BW,...UW,...KW,...YW,...iG,...sG,...gG,...SG,...TG,...kG,...FG,...RG,...VG,...GG,...JG,...ZG,...eK,...rK,...oK,...fK,...gK];function i3(e=[]){return[...Lp([...r3,...e].map(e=>e.module.name)),`@remix-run/node`]}i3();function a3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var o3=s3;function s3(e,t){let[n]=h3(e,``);for(let e of u3(t))if(c3(e,n))return!0;return!1}function c3(e,t){for(let[n,r]of e)if(!g3(t,r,n))return!1;return!0}function l3(e){return e===`latest`&&(e=`>=0`),e.match(/^([^\d+]*)(\d.*)$/)||[null,``,`*.*.*`]}function u3(e){let t=[],n=[],r=e.trim().split(/\s+/);for(let e=0;e<r.length;e++){let i=r[e];if(i===`-`)continue;if(i===`||`){t.push(n),n=[];continue}if(/^[<>=~v^]+$/.test(i)&&e+1<r.length){r[e+1]=i+r[e+1];continue}let a=l3(i),o=a[1]||`=`;o.endsWith(`v`)&&(o=o.slice(0,-1));let[s,c]=h3(a[2],o);if(e+2<r.length&&r[e+1]===`-`){let t=l3(r[e+2]);r[e+2]=`<=`+(t[2].indexOf(`-`)===-1?t[2]+`.*.*`:t[2]),c=`>=`}if(c[0]===`~`){let e=a[2].split(`-`)[0].split(`.`).length;n.push([`>=`,s]),n.push([`<`,e===1?d3(s,0):d3(s,1)])}else if(c[0]===`^`){let e=s[0]===0?s[1]===0?2:1:0;n.push([`>=`,s]),n.push([`<`,e===0?d3(s,0):e===1?d3(s,1):d3(s,2)])}else n.push([c.replace(`~`,``).replace(`^`,``),s])}return n.length&&t.push(n),t}function d3(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 f3(e){return e===`x`||e===`X`||e===`*`||e===`latest`?-1:Number(e)}function p3(e){return/^\d+$/.test(e)?Number(e):e}function m3(e,t,n){return n===-1?e!==`<`:e===`=`?t===n:e===`>`?t>n:e===`>=`?t>=n:e===`<`?t<n:e===`<=`&&t<=n}function h3(e,t){e=e.split(`+`)[0];let[n,r]=e.split(`-`),i=n.split(`.`).map(f3).slice(0,3),a=Math.max(i.length-1,0);return t===`>`?(t=`>=`,i.push(0,0,0),i[a]++):t===``?i.push(0,0,0):i.push(-1,-1,-1),r?[i.slice(0,3).concat(r.split(`.`).map(p3)),t]:[i.slice(0,3),t]}function g3(e,t,n){if(!m3(`=`,e[0],t[0]))return m3(n,e[0],t[0]);if(!m3(`=`,e[1],t[1]))return m3(n,e[1],t[1]);if(!m3(`=`,e[2],t[2])||e.length===3&&t.length===3)return m3(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(m3(n,e[r]||``,t[r]||``))return!0;return!1}function _3(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 v3(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}})(e,t)||x3(e,t)||(function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
32
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function y3(e){return(function(e){if(Array.isArray(e))return _3(e)})(e)||(function(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)})(e)||x3(e)||(function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
33
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function b3(e){return(b3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e})(e)}function x3(e,t){if(e){if(typeof e==`string`)return _3(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)?_3(e,t):void 0}}function S3(e,t){return e(t={exports:{}},t.exports),t.exports}var C3=S3((function(e,t){(function e(t){var n,r,i,a,o,s;function c(e){var t,n,r={};for(t in e)e.hasOwnProperty(t)&&(n=e[t],r[t]=typeof n==`object`&&n?c(n):n);return r}function l(e,t){this.parent=e,this.key=t}function u(e,t,n,r){this.node=e,this.path=t,this.wrap=n,this.ref=r}function d(){}function f(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function p(e,t){return(e===n.ObjectExpression||e===n.ObjectPattern)&&t===`properties`}function m(e,t){for(var n=e.length-1;n>=0;--n)if(e[n].node===t)return!0;return!1}function h(e,t){return new d().traverse(e,t)}function g(e,t){var n=(function(e,t){for(var n,r=e.length,i=0,a;r;)t(e[a=i+(n=r>>>1)])?r=n:(i=a+1,r-=n+1);return i})(t,(function(t){return t.range[0]>e.range[0]}));return e.extendedRange=[e.range[0],e.range[1]],n!==t.length&&(e.extendedRange[1]=t[n].range[0]),--n>=0&&(e.extendedRange[0]=t[n].range[1]),e}return n={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`},i={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`]},r={Break:a={},Skip:o={},Remove:s={}},l.prototype.replace=function(e){this.parent[this.key]=e},l.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},d.prototype.path=function(){var e,t,n,r,i;function a(e,t){if(Array.isArray(t))for(n=0,r=t.length;n<r;++n)e.push(t[n]);else e.push(t)}if(!this.__current.path)return null;for(i=[],e=2,t=this.__leavelist.length;e<t;++e)a(i,this.__leavelist[e].path);return a(i,this.__current.path),i},d.prototype.type=function(){return this.current().type||this.__current.wrap},d.prototype.parents=function(){var e,t,n=[];for(e=1,t=this.__leavelist.length;e<t;++e)n.push(this.__leavelist[e].node);return n},d.prototype.current=function(){return this.__current.node},d.prototype.__execute=function(e,t){var n,r=void 0;return n=this.__current,this.__current=t,this.__state=null,e&&(r=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=n,r},d.prototype.notify=function(e){this.__state=e},d.prototype.skip=function(){this.notify(o)},d.prototype.break=function(){this.notify(a)},d.prototype.remove=function(){this.notify(s)},d.prototype.__initialize=function(e,t){this.visitor=t,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,t.fallback===`iteration`?this.__fallback=Object.keys:typeof t.fallback==`function`&&(this.__fallback=t.fallback),this.__keys=i,t.keys&&(this.__keys=Object.assign(Object.create(this.__keys),t.keys))},d.prototype.traverse=function(e,t){var n,r,i,s,c,l,d,h,g,_,v,y;for(this.__initialize(e,t),y={},n=this.__worklist,r=this.__leavelist,n.push(new u(e,null,null,null)),r.push(new u(null,null,null,null));n.length;)if((i=n.pop())!==y){if(i.node){if(l=this.__execute(t.enter,i),this.__state===a||l===a)return;if(n.push(y),r.push(i),this.__state===o||l===o)continue;if(c=(s=i.node).type||i.wrap,!(_=this.__keys[c])){if(!this.__fallback)throw Error(`Unknown node type `+c+`.`);_=this.__fallback(s)}for(h=_.length;--h>=0;)if(v=s[d=_[h]]){if(Array.isArray(v)){for(g=v.length;--g>=0;)if(v[g]&&!m(r,v[g])){if(p(c,_[h]))i=new u(v[g],[d,g],`Property`,null);else{if(!f(v[g]))continue;i=new u(v[g],[d,g],null,null)}n.push(i)}}else if(f(v)){if(m(r,v))continue;n.push(new u(v,d,null,null))}}}}else if(i=r.pop(),l=this.__execute(t.leave,i),this.__state===a||l===a)return},d.prototype.replace=function(e,t){var n,r,i,c,d,m,h,g,_,v,y,b,ee;function te(e){var t,r,i,a;if(e.ref.remove()){for(r=e.ref.key,a=e.ref.parent,t=n.length;t--;)if((i=n[t]).ref&&i.ref.parent===a){if(i.ref.key<r)break;--i.ref.key}}}for(this.__initialize(e,t),y={},n=this.__worklist,r=this.__leavelist,m=new u(e,null,null,new l(b={root:e},`root`)),n.push(m),r.push(m);n.length;)if((m=n.pop())!==y){if((d=this.__execute(t.enter,m))!==void 0&&d!==a&&d!==o&&d!==s&&(m.ref.replace(d),m.node=d),this.__state!==s&&d!==s||(te(m),m.node=null),this.__state===a||d===a)return b.root;if((i=m.node)&&(n.push(y),r.push(m),this.__state!==o&&d!==o)){if(c=i.type||m.wrap,!(_=this.__keys[c])){if(!this.__fallback)throw Error(`Unknown node type `+c+`.`);_=this.__fallback(i)}for(h=_.length;--h>=0;)if(v=i[ee=_[h]]){if(Array.isArray(v)){for(g=v.length;--g>=0;)if(v[g]){if(p(c,_[h]))m=new u(v[g],[ee,g],`Property`,new l(v,g));else{if(!f(v[g]))continue;m=new u(v[g],[ee,g],null,new l(v,g))}n.push(m)}}else f(v)&&n.push(new u(v,ee,null,new l(i,ee)))}}}else if(m=r.pop(),(d=this.__execute(t.leave,m))!==void 0&&d!==a&&d!==o&&d!==s&&m.ref.replace(d),this.__state!==s&&d!==s||te(m),this.__state===a||d===a)return b.root;return b.root},t.Syntax=n,t.traverse=h,t.replace=function(e,t){return new d().replace(e,t)},t.attachComments=function(e,t,n){var i,a,o,s,l=[];if(!e.range)throw Error(`attachComments needs range information`);if(!n.length){if(t.length){for(o=0,a=t.length;o<a;o+=1)(i=c(t[o])).extendedRange=[0,e.range[0]],l.push(i);e.leadingComments=l}return e}for(o=0,a=t.length;o<a;o+=1)l.push(g(c(t[o]),n));return s=0,h(e,{enter:function(e){for(var t;s<l.length&&!((t=l[s]).extendedRange[1]>e.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||=[],e.leadingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?r.Break:l[s].extendedRange[0]>e.range[1]?r.Skip:void 0}}),s=0,h(e,{leave:function(e){for(var t;s<l.length&&(t=l[s],!(e.range[1]<t.extendedRange[0]));)e.range[1]===t.extendedRange[0]?(e.trailingComments||=[],e.trailingComments.push(t),l.splice(s,1)):s+=1;return s===l.length?r.Break:l[s].extendedRange[0]>e.range[1]?r.Skip:void 0}}),e},t.VisitorKeys=i,t.VisitorOption=r,t.Controller=d,t.cloneEnvironment=function(){return e({})},t})(t)})),w3=S3((function(e){e.exports&&=(function(){function e(t,n,r,i){this.message=t,this.expected=n,this.found=r,this.location=i,this.name=`SyntaxError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e)}return(function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n})(e,Error),e.buildMessage=function(e,t){var n={literal:function(e){return`"`+i(e.text)+`"`},class:function(e){var t,n=``;for(t=0;t<e.parts.length;t++)n+=e.parts[t]instanceof Array?a(e.parts[t][0])+`-`+a(e.parts[t][1]):a(e.parts[t]);return`[`+(e.inverted?`^`:``)+n+`]`},any:function(e){return`any character`},end:function(e){return`end of input`},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(e){return e.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(e){return`\\x0`+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return`\\x`+r(e)}))}function a(e){return e.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(e){return`\\x0`+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return`\\x`+r(e)}))}return`Expected `+(function(e){var t,r,i,a=Array(e.length);for(t=0;t<e.length;t++)a[t]=(i=e[t],n[i.type](i));if(a.sort(),a.length>0){for(t=1,r=1;t<a.length;t++)a[t-1]!==a[t]&&(a[r]=a[t],r++);a.length=r}switch(a.length){case 1:return a[0];case 2:return a[0]+` or `+a[1];default:return a.slice(0,-1).join(`, `)+`, or `+a[a.length-1]}})(e)+` but `+(function(e){return e?`"`+i(e)+`"`:`end of input`})(t)+` found.`},{SyntaxError:e,parse:function(t,n){n=n===void 0?{}:n;var r,i,a,o,s={},c={start:qe},l=qe,u=w(` `,!1),d=/^[^ [\],():#!=><~+.]/,f=Ge([` `,`[`,`]`,`,`,`(`,`)`,`:`,`#`,`!`,`=`,`>`,`<`,`~`,`+`,`.`],!0,!1),p=w(`>`,!1),m=w(`~`,!1),h=w(`+`,!1),g=w(`,`,!1),_=function(e,t){return[e].concat(t.map((function(e){return e[3]})))},v=w(`!`,!1),y=w(`*`,!1),b=w(`#`,!1),ee=w(`[`,!1),te=w(`]`,!1),ne=/^[><!]/,re=Ge([`>`,`<`,`!`],!1,!1),ie=w(`=`,!1),ae=function(e){return(e||``)+`=`},x=/^[><]/,oe=Ge([`>`,`<`],!1,!1),se=w(`.`,!1),ce=function(e,t,n){return{type:`attribute`,name:e,operator:t,value:n}},le=w(`"`,!1),ue=/^[^\\"]/,de=Ge([`\\`,`"`],!0,!1),fe=w(`\\`,!1),pe={type:`any`},me=function(e,t){return e+t},he=function(e){return{type:`literal`,value:(t=e.join(``),t.replace(/\\(.)/g,(function(e,t){switch(t){case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
34
- `;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;default:return t}})))};var t},ge=w(`'`,!1),_e=/^[^\\']/,ve=Ge([`\\`,`'`],!0,!1),ye=/^[0-9]/,be=Ge([[`0`,`9`]],!1,!1),xe=w(`type(`,!1),Se=/^[^ )]/,Ce=Ge([` `,`)`],!0,!1),we=w(`)`,!1),Te=/^[imsu]/,Ee=Ge([`i`,`m`,`s`,`u`],!1,!1),De=w(`/`,!1),Oe=/^[^\]\\]/,ke=Ge([`]`,`\\`],!0,!1),Ae=/^[^\/\\[]/,je=Ge([`/`,`\\`,`[`],!0,!1),Me=w(`:not(`,!1),Ne=w(`:matches(`,!1),Pe=function(e){return{type:`matches`,selectors:e}},Fe=w(`:is(`,!1),Ie=w(`:has(`,!1),Le=w(`:first-child`,!1),Re=w(`:last-child`,!1),ze=w(`:nth-child(`,!1),Be=w(`:nth-last-child(`,!1),Ve=w(`:`,!1),S=0,He=[{line:1,column:1}],Ue=0,We=[],C={};if(`startRule`in n){if(!(n.startRule in c))throw Error(`Can't start parsing from rule "`+n.startRule+`".`);l=c[n.startRule]}function w(e,t){return{type:`literal`,text:e,ignoreCase:t}}function Ge(e,t,n){return{type:`class`,parts:e,inverted:t,ignoreCase:n}}function T(e){var n,r=He[e];if(r)return r;for(n=e-1;!He[n];)n--;for(r={line:(r=He[n]).line,column:r.column};n<e;)t.charCodeAt(n)===10?(r.line++,r.column=1):r.column++,n++;return He[e]=r,r}function Ke(e,t){var n=T(e),r=T(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function E(e){S<Ue||(S>Ue&&(Ue=S,We=[]),We.push(e))}function qe(){var e,t,n,r,i=36*S+0,a=C[i];return a?(S=a.nextPos,a.result):(e=S,(t=D())!==s&&(n=Xe())!==s&&D()!==s?e=t=(r=n).length===1?r[0]:{type:`matches`,selectors:r}:(S=e,e=s),e===s&&(e=S,(t=D())!==s&&(t=void 0),e=t),C[i]={nextPos:S,result:e},e)}function D(){var e,n,r=36*S+1,i=C[r];if(i)return S=i.nextPos,i.result;for(e=[],t.charCodeAt(S)===32?(n=` `,S++):(n=s,E(u));n!==s;)e.push(n),t.charCodeAt(S)===32?(n=` `,S++):(n=s,E(u));return C[r]={nextPos:S,result:e},e}function Je(){var e,n,r,i=36*S+2,a=C[i];if(a)return S=a.nextPos,a.result;if(n=[],d.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,E(f)),r!==s)for(;r!==s;)n.push(r),d.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,E(f));else n=s;return n!==s&&(n=n.join(``)),e=n,C[i]={nextPos:S,result:e},e}function Ye(){var e,n,r,i=36*S+3,a=C[i];return a?(S=a.nextPos,a.result):(e=S,(n=D())===s?(S=e,e=s):(t.charCodeAt(S)===62?(r=`>`,S++):(r=s,E(p)),r!==s&&D()!==s?e=n=`child`:(S=e,e=s)),e===s&&(e=S,(n=D())===s?(S=e,e=s):(t.charCodeAt(S)===126?(r=`~`,S++):(r=s,E(m)),r!==s&&D()!==s?e=n=`sibling`:(S=e,e=s)),e===s&&(e=S,(n=D())===s?(S=e,e=s):(t.charCodeAt(S)===43?(r=`+`,S++):(r=s,E(h)),r!==s&&D()!==s?e=n=`adjacent`:(S=e,e=s)),e===s&&(e=S,t.charCodeAt(S)===32?(n=` `,S++):(n=s,E(u)),n!==s&&(r=D())!==s?e=n=`descendant`:(S=e,e=s)))),C[i]={nextPos:S,result:e},e)}function Xe(){var e,n,r,i,a,o,c,l,u=36*S+5,d=C[u];if(d)return S=d.nextPos,d.result;if(e=S,(n=Qe())!==s){for(r=[],i=S,(a=D())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,E(g)),o!==s&&(c=D())!==s&&(l=Qe())!==s?i=a=[a,o,c,l]:(S=i,i=s));i!==s;)r.push(i),i=S,(a=D())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,E(g)),o!==s&&(c=D())!==s&&(l=Qe())!==s?i=a=[a,o,c,l]:(S=i,i=s));r===s?(S=e,e=s):e=n=_(n,r)}else S=e,e=s;return C[u]={nextPos:S,result:e},e}function Ze(){var e,t,n,r,i,a=36*S+6,o=C[a];return o?(S=o.nextPos,o.result):(e=S,(t=Ye())===s&&(t=null),t!==s&&(n=Qe())!==s?(i=n,e=t=(r=t)?{type:r,left:{type:`exactNode`},right:i}:i):(S=e,e=s),C[a]={nextPos:S,result:e},e)}function Qe(){var e,t,n,r,i,a,o,c=36*S+7,l=C[c];if(l)return S=l.nextPos,l.result;if(e=S,(t=$e())!==s){for(n=[],r=S,(i=Ye())!==s&&(a=$e())!==s?r=i=[i,a]:(S=r,r=s);r!==s;)n.push(r),r=S,(i=Ye())!==s&&(a=$e())!==s?r=i=[i,a]:(S=r,r=s);n===s?(S=e,e=s):(o=t,e=t=n.reduce((function(e,t){return{type:t[0],left:e,right:t[1]}}),o))}else S=e,e=s;return C[c]={nextPos:S,result:e},e}function $e(){var e,n,r,i,a,o,c,l=36*S+8,u=C[l];if(u)return S=u.nextPos,u.result;if(e=S,t.charCodeAt(S)===33?(n=`!`,S++):(n=s,E(v)),n===s&&(n=null),n!==s){if(r=[],(i=et())!==s)for(;i!==s;)r.push(i),i=et();else r=s;r===s?(S=e,e=s):(a=n,c=(o=r).length===1?o[0]:{type:`compound`,selectors:o},a&&(c.subject=!0),e=n=c)}else S=e,e=s;return C[l]={nextPos:S,result:e},e}function et(){var e,n=36*S+9,r=C[n];return r?(S=r.nextPos,r.result):((e=(function(){var e,n,r=36*S+10,i=C[r];return i?(S=i.nextPos,i.result):(t.charCodeAt(S)===42?(n=`*`,S++):(n=s,E(y)),n!==s&&(n={type:`wildcard`,value:n}),e=n,C[r]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i=36*S+11,a=C[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===35?(n=`#`,S++):(n=s,E(b)),n===s&&(n=null),n!==s&&(r=Je())!==s?e=n={type:`identifier`,value:r}:(S=e,e=s),C[i]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+12,o=C[a];return o?(S=o.nextPos,o.result):(e=S,t.charCodeAt(S)===91?(n=`[`,S++):(n=s,E(ee)),n!==s&&D()!==s&&(r=(function(){var e,n,r,i,a=36*S+16,o=C[a];return o?(S=o.nextPos,o.result):(e=S,(n=tt())!==s&&D()!==s&&(r=(function(){var e,n,r,i=36*S+14,a=C[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===33?(n=`!`,S++):(n=s,E(v)),n===s&&(n=null),n===s?(S=e,e=s):(t.charCodeAt(S)===61?(r=`=`,S++):(r=s,E(ie)),r===s?(S=e,e=s):(n=ae(n),e=n)),C[i]={nextPos:S,result:e},e)})())!==s&&D()!==s?((i=(function(){var e,n,r,i,a,o=36*S+20,c=C[o];if(c)return S=c.nextPos,c.result;if(e=S,t.substr(S,5)===`type(`?(n=`type(`,S+=5):(n=s,E(xe)),n!==s){if(D()!==s){if(r=[],Se.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(Ce)),i!==s)for(;i!==s;)r.push(i),Se.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(Ce));else r=s;r!==s&&(i=D())!==s?(t.charCodeAt(S)===41?(a=`)`,S++):(a=s,E(we)),a===s?(S=e,e=s):(n={type:`type`,value:r.join(``)},e=n)):(S=e,e=s)}else S=e,e=s}else S=e,e=s;return C[o]={nextPos:S,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c=36*S+22,l=C[c];if(l)return S=l.nextPos,l.result;if(e=S,t.charCodeAt(S)===47?(n=`/`,S++):(n=s,E(De)),n!==s){if(r=[],(i=nt())===s&&(i=rt())===s&&(i=it()),i!==s)for(;i!==s;)r.push(i),(i=nt())===s&&(i=rt())===s&&(i=it());else r=s;r===s?(S=e,e=s):(t.charCodeAt(S)===47?(i=`/`,S++):(i=s,E(De)),i===s?(S=e,e=s):((a=(function(){var e,n,r=36*S+21,i=C[r];if(i)return S=i.nextPos,i.result;if(e=[],Te.test(t.charAt(S))?(n=t.charAt(S),S++):(n=s,E(Ee)),n!==s)for(;n!==s;)e.push(n),Te.test(t.charAt(S))?(n=t.charAt(S),S++):(n=s,E(Ee));else e=s;return C[r]={nextPos:S,result:e},e})())===s&&(a=null),a===s?(S=e,e=s):(o=a,n={type:`regexp`,value:new RegExp(r.join(``),o?o.join(``):``)},e=n)))}else S=e,e=s;return C[c]={nextPos:S,result:e},e})()),i===s?(S=e,e=s):(n=ce(n,r,i),e=n)):(S=e,e=s),e===s&&(e=S,(n=tt())!==s&&D()!==s&&(r=(function(){var e,n,r,i=36*S+13,a=C[i];return a?(S=a.nextPos,a.result):(e=S,ne.test(t.charAt(S))?(n=t.charAt(S),S++):(n=s,E(re)),n===s&&(n=null),n===s?(S=e,e=s):(t.charCodeAt(S)===61?(r=`=`,S++):(r=s,E(ie)),r===s?(S=e,e=s):(n=ae(n),e=n)),e===s&&(x.test(t.charAt(S))?(e=t.charAt(S),S++):(e=s,E(oe))),C[i]={nextPos:S,result:e},e)})())!==s&&D()!==s?((i=(function(){var e,n,r,i,a,o,c=36*S+17,l=C[c];if(l)return S=l.nextPos,l.result;if(e=S,t.charCodeAt(S)===34?(n=`"`,S++):(n=s,E(le)),n!==s){for(r=[],ue.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(de)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,E(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,E(pe)),o===s?(S=i,i=s):(a=me(a,o),i=a)));i!==s;)r.push(i),ue.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(de)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,E(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,E(pe)),o===s?(S=i,i=s):(a=me(a,o),i=a)));r===s?(S=e,e=s):(t.charCodeAt(S)===34?(i=`"`,S++):(i=s,E(le)),i===s?(S=e,e=s):(n=he(r),e=n))}else S=e,e=s;if(e===s){if(e=S,t.charCodeAt(S)===39?(n=`'`,S++):(n=s,E(ge)),n!==s){for(r=[],_e.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(ve)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,E(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,E(pe)),o===s?(S=i,i=s):(a=me(a,o),i=a)));i!==s;)r.push(i),_e.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(ve)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,E(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,E(pe)),o===s?(S=i,i=s):(a=me(a,o),i=a)));r===s?(S=e,e=s):(t.charCodeAt(S)===39?(i=`'`,S++):(i=s,E(ge)),i===s?(S=e,e=s):(n=he(r),e=n))}else S=e,e=s}return C[c]={nextPos:S,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c,l=36*S+18,u=C[l];if(u)return S=u.nextPos,u.result;for(e=S,n=S,r=[],ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be));i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be));if(r===s?(S=n,n=s):(t.charCodeAt(S)===46?(i=`.`,S++):(i=s,E(se)),i===s?(S=n,n=s):n=r=[r,i]),n===s&&(n=null),n!==s){if(r=[],ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be));else r=s;r===s?(S=e,e=s):(o=r,c=(a=n)?[].concat.apply([],a).join(``):``,n={type:`literal`,value:parseFloat(c+o.join(``))},e=n)}else S=e,e=s;return C[l]={nextPos:S,result:e},e})())===s&&(i=(function(){var e,t,n=36*S+19,r=C[n];return r?(S=r.nextPos,r.result):((t=Je())!==s&&(t={type:`literal`,value:t}),e=t,C[n]={nextPos:S,result:e},e)})()),i===s?(S=e,e=s):(n=ce(n,r,i),e=n)):(S=e,e=s),e===s&&(e=S,(n=tt())!==s&&(n={type:`attribute`,name:n}),e=n)),C[a]={nextPos:S,result:e},e)})())!==s&&D()!==s?(t.charCodeAt(S)===93?(i=`]`,S++):(i=s,E(te)),i===s?(S=e,e=s):e=n=r):(S=e,e=s),C[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o,c,l,u=36*S+26,d=C[u];if(d)return S=d.nextPos,d.result;if(e=S,t.charCodeAt(S)===46?(n=`.`,S++):(n=s,E(se)),n!==s){if((r=Je())!==s){for(i=[],a=S,t.charCodeAt(S)===46?(o=`.`,S++):(o=s,E(se)),o!==s&&(c=Je())!==s?a=o=[o,c]:(S=a,a=s);a!==s;)i.push(a),a=S,t.charCodeAt(S)===46?(o=`.`,S++):(o=s,E(se)),o!==s&&(c=Je())!==s?a=o=[o,c]:(S=a,a=s);i===s?(S=e,e=s):(l=r,n={type:`field`,name:i.reduce((function(e,t){return e+t[0]+t[1]}),l)},e=n)}else S=e,e=s}else S=e,e=s;return C[u]={nextPos:S,result:e},e})())===s&&(e=(function(){var e,n,r,i,a=36*S+27,o=C[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,5)===`:not(`?(n=`:not(`,S+=5):(n=s,E(Me)),n!==s&&D()!==s&&(r=Xe())!==s&&D()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,E(we)),i===s?(S=e,e=s):e=n={type:`not`,selectors:r}):(S=e,e=s),C[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+28,o=C[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,9)===`:matches(`?(n=`:matches(`,S+=9):(n=s,E(Ne)),n!==s&&D()!==s&&(r=Xe())!==s&&D()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,E(we)),i===s?(S=e,e=s):(n=Pe(r),e=n)):(S=e,e=s),C[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+29,o=C[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,4)===`:is(`?(n=`:is(`,S+=4):(n=s,E(Fe)),n!==s&&D()!==s&&(r=Xe())!==s&&D()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,E(we)),i===s?(S=e,e=s):(n=Pe(r),e=n)):(S=e,e=s),C[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+30,o=C[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,5)===`:has(`?(n=`:has(`,S+=5):(n=s,E(Ie)),n!==s&&D()!==s&&(r=(function(){var e,n,r,i,a,o,c,l,u=36*S+4,d=C[u];if(d)return S=d.nextPos,d.result;if(e=S,(n=Ze())!==s){for(r=[],i=S,(a=D())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,E(g)),o!==s&&(c=D())!==s&&(l=Ze())!==s?i=a=[a,o,c,l]:(S=i,i=s));i!==s;)r.push(i),i=S,(a=D())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,E(g)),o!==s&&(c=D())!==s&&(l=Ze())!==s?i=a=[a,o,c,l]:(S=i,i=s));r===s?(S=e,e=s):e=n=_(n,r)}else S=e,e=s;return C[u]={nextPos:S,result:e},e})())!==s&&D()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,E(we)),i===s?(S=e,e=s):e=n={type:`has`,selectors:r}):(S=e,e=s),C[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r=36*S+31,i=C[r];return i?(S=i.nextPos,i.result):(t.substr(S,12)===`:first-child`?(n=`:first-child`,S+=12):(n=s,E(Le)),n!==s&&(n=at(1)),e=n,C[r]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r=36*S+32,i=C[r];return i?(S=i.nextPos,i.result):(t.substr(S,11)===`:last-child`?(n=`:last-child`,S+=11):(n=s,E(Re)),n!==s&&(n=ot(1)),e=n,C[r]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o=36*S+33,c=C[o];if(c)return S=c.nextPos,c.result;if(e=S,t.substr(S,11)===`:nth-child(`?(n=`:nth-child(`,S+=11):(n=s,E(ze)),n!==s){if(D()!==s){if(r=[],ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be));else r=s;r!==s&&(i=D())!==s?(t.charCodeAt(S)===41?(a=`)`,S++):(a=s,E(we)),a===s?(S=e,e=s):(n=at(parseInt(r.join(``),10)),e=n)):(S=e,e=s)}else S=e,e=s}else S=e,e=s;return C[o]={nextPos:S,result:e},e})())===s&&(e=(function(){var e,n,r,i,a,o=36*S+34,c=C[o];if(c)return S=c.nextPos,c.result;if(e=S,t.substr(S,16)===`:nth-last-child(`?(n=`:nth-last-child(`,S+=16):(n=s,E(Be)),n!==s){if(D()!==s){if(r=[],ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(be));else r=s;r!==s&&(i=D())!==s?(t.charCodeAt(S)===41?(a=`)`,S++):(a=s,E(we)),a===s?(S=e,e=s):(n=ot(parseInt(r.join(``),10)),e=n)):(S=e,e=s)}else S=e,e=s}else S=e,e=s;return C[o]={nextPos:S,result:e},e})())===s&&(e=(function(){var e,n,r,i=36*S+35,a=C[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===58?(n=`:`,S++):(n=s,E(Ve)),n!==s&&(r=Je())!==s?e=n={type:`class`,name:r}:(S=e,e=s),C[i]={nextPos:S,result:e},e)})()),C[n]={nextPos:S,result:e},e)}function tt(){var e,n,r,i,a,o,c,l,u=36*S+15,d=C[u];if(d)return S=d.nextPos,d.result;if(e=S,(n=Je())!==s){for(r=[],i=S,t.charCodeAt(S)===46?(a=`.`,S++):(a=s,E(se)),a!==s&&(o=Je())!==s?i=a=[a,o]:(S=i,i=s);i!==s;)r.push(i),i=S,t.charCodeAt(S)===46?(a=`.`,S++):(a=s,E(se)),a!==s&&(o=Je())!==s?i=a=[a,o]:(S=i,i=s);r===s?(S=e,e=s):(c=n,l=r,e=n=[].concat.apply([c],l).join(``))}else S=e,e=s;return C[u]={nextPos:S,result:e},e}function nt(){var e,n,r,i,a=36*S+23,o=C[a];if(o)return S=o.nextPos,o.result;if(e=S,t.charCodeAt(S)===91?(n=`[`,S++):(n=s,E(ee)),n!==s){if(r=[],Oe.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(ke)),i===s&&(i=rt()),i!==s)for(;i!==s;)r.push(i),Oe.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,E(ke)),i===s&&(i=rt());else r=s;r===s?(S=e,e=s):(t.charCodeAt(S)===93?(i=`]`,S++):(i=s,E(te)),i===s?(S=e,e=s):e=n=`[`+r.join(``)+`]`)}else S=e,e=s;return C[a]={nextPos:S,result:e},e}function rt(){var e,n,r,i=36*S+24,a=C[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===92?(n=`\\`,S++):(n=s,E(fe)),n===s?(S=e,e=s):(t.length>S?(r=t.charAt(S),S++):(r=s,E(pe)),r===s?(S=e,e=s):e=n=`\\`+r),C[i]={nextPos:S,result:e},e)}function it(){var e,n,r,i=36*S+25,a=C[i];if(a)return S=a.nextPos,a.result;if(n=[],Ae.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,E(je)),r!==s)for(;r!==s;)n.push(r),Ae.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,E(je));else n=s;return n!==s&&(n=n.join(``)),e=n,C[i]={nextPos:S,result:e},e}function at(e){return{type:`nth-child`,index:{type:`literal`,value:e}}}function ot(e){return{type:`nth-last-child`,index:{type:`literal`,value:e}}}if((r=l())!==s&&S===t.length)return r;throw r!==s&&S<t.length&&E({type:`end`}),i=We,a=Ue<t.length?t.charAt(Ue):null,o=Ue<t.length?Ke(Ue,Ue+1):Ke(Ue,Ue),new e(e.buildMessage(i,a),i,a,o)}}})()}));function T3(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var E3=typeof WeakMap==`function`?new WeakMap:null;function D3(e){if(e==null)return function(){return!0};if(E3!=null){var t=E3.get(e);return t??(t=O3(e),E3.set(e,t)),t}return O3(e)}function O3(e){switch(e.type){case`wildcard`:return function(){return!0};case`identifier`:var t=e.value.toLowerCase();return function(e,n,r){return t===e[r&&r.nodeTypeKey||`type`].toLowerCase()};case`exactNode`:return function(e,t){return t.length===0};case`field`:var n=e.name.split(`.`);return function(e,t){return(function e(t,n,r,i){for(var a=n,o=i;o<r.length;++o){if(a==null)return!1;var s=a[r[o]];if(Array.isArray(s)){for(var c=0;c<s.length;++c)if(e(t,s[c],r,o+1))return!0;return!1}a=s}return t===a})(e,t[n.length-1],n,0)};case`matches`:var r=e.selectors.map(D3);return function(e,t,n){for(var i=0;i<r.length;++i)if(r[i](e,t,n))return!0;return!1};case`compound`:var i=e.selectors.map(D3);return function(e,t,n){for(var r=0;r<i.length;++r)if(!i[r](e,t,n))return!1;return!0};case`not`:var a=e.selectors.map(D3);return function(e,t,n){for(var r=0;r<a.length;++r)if(a[r](e,t,n))return!1;return!0};case`has`:var o=e.selectors.map(D3);return function(e,t,n){var r=!1,i=[];return C3.traverse(e,{enter:function(e,t){t!=null&&i.unshift(t);for(var a=0;a<o.length;++a)if(o[a](e,i,n))return r=!0,void this.break()},leave:function(){i.shift()},keys:n&&n.visitorKeys,fallback:n&&n.fallback||`iteration`}),r};case`child`:var s=D3(e.left),c=D3(e.right);return function(e,t,n){return!!(t.length>0&&c(e,t,n))&&s(t[0],t.slice(1),n)};case`descendant`:var l=D3(e.left),u=D3(e.right);return function(e,t,n){if(u(e,t,n)){for(var r=0,i=t.length;r<i;++r)if(l(t[r],t.slice(r+1),n))return!0}return!1};case`attribute`:var d=e.name.split(`.`);switch(e.operator){case void 0:return function(e){return T3(e,d)!=null};case`=`:switch(e.value.type){case`regexp`:return function(t){var n=T3(t,d);return typeof n==`string`&&e.value.value.test(n)};case`literal`:var f=`${e.value.value}`;return function(e){return f===`${T3(e,d)}`};case`type`:return function(t){return e.value.value===b3(T3(t,d))}}throw Error(`Unknown selector value type: ${e.value.type}`);case`!=`:switch(e.value.type){case`regexp`:return function(t){return!e.value.value.test(T3(t,d))};case`literal`:var p=`${e.value.value}`;return function(e){return p!==`${T3(e,d)}`};case`type`:return function(t){return e.value.value!==b3(T3(t,d))}}throw Error(`Unknown selector value type: ${e.value.type}`);case`<=`:return function(t){return T3(t,d)<=e.value.value};case`<`:return function(t){return T3(t,d)<e.value.value};case`>`:return function(t){return T3(t,d)>e.value.value};case`>=`:return function(t){return T3(t,d)>=e.value.value}}throw Error(`Unknown operator: ${e.operator}`);case`sibling`:var m=D3(e.left),h=D3(e.right);return function(t,n,r){return h(t,n,r)&&j3(t,m,n,`LEFT_SIDE`,r)||e.left.subject&&m(t,n,r)&&j3(t,h,n,`RIGHT_SIDE`,r)};case`adjacent`:var g=D3(e.left),_=D3(e.right);return function(t,n,r){return _(t,n,r)&&M3(t,g,n,`LEFT_SIDE`,r)||e.right.subject&&g(t,n,r)&&M3(t,_,n,`RIGHT_SIDE`,r)};case`nth-child`:var v=e.index.value,y=D3(e.right);return function(e,t,n){return y(e,t,n)&&N3(e,t,v,n)};case`nth-last-child`:var b=-e.index.value,ee=D3(e.right);return function(e,t,n){return ee(e,t,n)&&N3(e,t,b,n)};case`class`:var te=e.name.toLowerCase();return function(t,n,r){if(r&&r.matchClass)return r.matchClass(e.name,t,n);if(r&&r.nodeTypeKey)return!1;switch(te){case`statement`:if(t.type.slice(-9)===`Statement`)return!0;case`declaration`:return t.type.slice(-11)===`Declaration`;case`pattern`:if(t.type.slice(-7)===`Pattern`)return!0;case`expression`:return t.type.slice(-10)===`Expression`||t.type.slice(-7)===`Literal`||t.type===`Identifier`&&(n.length===0||n[0].type!==`MetaProperty`)||t.type===`MetaProperty`;case`function`:return t.type===`FunctionDeclaration`||t.type===`FunctionExpression`||t.type===`ArrowFunctionExpression`}throw Error(`Unknown class name: ${e.name}`)}}throw Error(`Unknown selector type: ${e.type}`)}function k3(e,t){var n=t&&t.nodeTypeKey||`type`,r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:C3.VisitorKeys[r]?C3.VisitorKeys[r]:t&&typeof t.fallback==`function`?t.fallback(e):Object.keys(e).filter((function(e){return e!==n}))}function A3(e,t){var n=t&&t.nodeTypeKey||`type`;return e!==null&&b3(e)===`object`&&typeof e[n]==`string`}function j3(e,t,n,r,i){var a=v3(n,1)[0];if(!a)return!1;for(var o=k3(a,i),s=0;s<o.length;++s){var c=a[o[s]];if(Array.isArray(c)){var l=c.indexOf(e);if(l<0)continue;var u=void 0,d=void 0;r===`LEFT_SIDE`?(u=0,d=l):(u=l+1,d=c.length);for(var f=u;f<d;++f)if(A3(c[f],i)&&t(c[f],n,i))return!0}}return!1}function M3(e,t,n,r,i){var a=v3(n,1)[0];if(!a)return!1;for(var o=k3(a,i),s=0;s<o.length;++s){var c=a[o[s]];if(Array.isArray(c)){var l=c.indexOf(e);if(l<0)continue;if(r===`LEFT_SIDE`&&l>0&&A3(c[l-1],i)&&t(c[l-1],n,i)||r===`RIGHT_SIDE`&&l<c.length-1&&A3(c[l+1],i)&&t(c[l+1],n,i))return!0}}return!1}function N3(e,t,n,r){if(n===0)return!1;var i=v3(t,1)[0];if(!i)return!1;for(var a=k3(i,r),o=0;o<a.length;++o){var s=i[a[o]];if(Array.isArray(s)){var c=n<0?s.length+n:n-1;if(c>=0&&c<s.length&&s[c]===e)return!0}}return!1}function P3(e,t,n,r){if(t){var i=[],a=D3(t),o=(function e(t,n){if(t==null||b3(t)!=`object`)return[];n??=t;for(var r=t.subject?[n]:[],i=Object.keys(t),a=0;a<i.length;++a){var o=i[a],s=t[o];r.push.apply(r,y3(e(s,o===`left`?s:n)))}return r})(t).map(D3);C3.traverse(e,{enter:function(e,t){if(t!=null&&i.unshift(t),a(e,i,r)){if(o.length)for(var s=0,c=o.length;s<c;++s){o[s](e,i,r)&&n(e,t,i);for(var l=0,u=i.length;l<u;++l){var d=i.slice(l+1);o[s](i[l],d,r)&&n(i[l],t,d)}}else n(e,t,i)}},leave:function(){i.shift()},keys:r&&r.visitorKeys,fallback:r&&r.fallback||`iteration`})}}function F3(e,t,n){var r=[];return P3(e,t,(function(e){r.push(e)}),n),r}function I3(e){return w3.parse(e)}function L3(e,t,n){return F3(e,I3(t),n)}L3.parse=I3,L3.match=F3,L3.traverse=P3,L3.matches=function(e,t,n,r){return!t||!!e&&(n||=[],D3(t)(e,n,r))},L3.query=L3;var R3={},z3={},B3={exports:{}},V3=L3,{parse:H3}=R3,U3=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name===`tr_ch_apm_tracingChannel`,W3=/[^\w]/g,G3=e=>`tr_ch_apm$${e.replace(W3,`_`)}`,K3=B3.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(U3))return;let r={module:t===`esm`},i=n.body.findIndex(e=>e.directive===`use strict`),a=t===`esm`?`import tr_ch_apm_dc from "${e}"`:`const tr_ch_apm_dc = require("${e}")`;n.body.splice(i+1,0,H3(a,r).body[0],H3(`const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc`,r).body[0],H3(`const tr_ch_apm_hasSubscribers = ch => ch.start.hasSubscribers
35
- || ch.end.hasSubscribers
36
- || ch.asyncStart.hasSubscribers
37
- || ch.asyncEnd.hasSubscribers
38
- || ch.error.hasSubscribers`,r).body[0])},tracingChannelDeclaration(e,t){let{channelName:n,module:{name:r}}=e,i=G3(n);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;K3.tracingChannelImport(e,t);let a=t.body.findIndex(U3),o=`
39
- const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
40
- `;t.body.splice(a+1,0,H3(o).body[0])},traceCallback:J3,tracePromise:J3,traceSync:J3,traceAuto:J3};function q3(e){return[...(e||[]).filter(e=>e.type!==`RestElement`&&e.type!==`AssignmentPattern`).map((e,t)=>({type:`Identifier`,name:`__apm$arg${t}`})),{type:`RestElement`,argument:{type:`Identifier`,name:`__apm$args`}}]}function J3(e,t,n,r){let i=r[r.length-1];t.type===`ClassDeclaration`||t.type===`ClassExpression`?X3(e,t,i):Y3(e,t,i)}function Y3(e,t,n){K3.tracingChannelDeclaration(e,n);let{functionQuery:{methodName:r,privateMethodName:i,functionName:a,expressionName:o,propertyName:s}}=e,c=r===`constructor`||!r&&!i&&!a&&!o&&!s?`ArrowFunctionExpression`:t.type,l=t.params;t.body=Z3(e,{type:c,params:l,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=q3(l),t.generator=!1,t.async=!1,Q3(e,t)}function X3(e,t,n){let{functionQuery:r,operator:i}=e,{methodName:a}=r;if(!a)return;let o=t.body;if(o.body.some(({key:e})=>e.name===a))return;let s=o.body.find(({kind:e})=>e===`constructor`);K3.tracingChannelDeclaration(e,n),s||(s=H3(t.superClass?`class A extends Object { constructor (...args) { super(...args) } }`:`class A { constructor () {} }`).body[0].body.body[0],o.body.unshift(s));let c=H3(`
41
- const __apm$${a} = this["${a}"]
42
- this["${a}"] = function () {}
43
- if (typeof __apm$${a} === 'function') {
44
- Object.defineProperty(this["${a}"], 'length', {
45
- value: __apm$${a}.length,
46
- configurable: true
47
- })
48
- }
49
- `).body,l=c[1].expression.right;l.params=[{type:`RestElement`,argument:{type:`Identifier`,name:`__apm$args`}}],l.async=i===`tracePromise`,l.body=Z3(e,{type:`Identifier`,name:`__apm$${a}`},n),Q3(e,l),s.value.body.body.push(...c)}function Z3(e,t,n){let{operator:r,moduleVersion:i}=e,{returnKind:a}=e.functionQuery,o=a?i6(e,a,n):``,s;r===`traceCallback`&&(s=e6(e,t,o)),r===`tracePromise`&&(s=t6(e,t,o)),r===`traceSync`&&(s=n6(e,t,o)),r===`traceAuto`&&(s=$3(e,t,o));let c=(t.params||[]).filter(e=>e.type!==`RestElement`&&e.type!==`AssignmentPattern`).map((e,t)=>`__apm$arg${t}`).concat(`...__apm$args`).join(`, `),l=s.body[0].body,u=H3(t.type===`ArrowFunctionExpression`?`
50
- const __apm$arguments = [${c}];
51
- const __apm$ctx = {
52
- arguments: __apm$arguments,
53
- moduleVersion: ${JSON.stringify(i)}
54
- };
55
- const __apm$traced = () => {
56
- const __apm$wrapped = () => {};
57
- return __apm$wrapped(...__apm$arguments);
58
- };
59
- `:`
60
- const __apm$arguments = [${c}].slice(0, arguments.length);
61
- const __apm$ctx = {
62
- arguments: __apm$arguments,
63
- self: this,
64
- moduleVersion: ${JSON.stringify(i)}
65
- };
66
- const __apm$traced = () => {
67
- const __apm$wrapped = () => {};
68
- return __apm$wrapped.apply(this, __apm$arguments);
69
- };
70
- `).body;return l.body.unshift(...u),V3.query(l,`[id.name=__apm$wrapped]`)[0].init=t,l}function Q3(e,t){let n=new Set;V3.traverse(t.body,V3.parse(`[object.type=Super]`),(e,t)=>{let{name:r}=e.property,i;if(t.callee){let{expression:e}=H3(`__apm$super['${r}'].call(this)`).body[0];t.callee=i=e.callee,t.arguments.unshift(...e.arguments)}else t.expression=i=H3(`__apm$super['${r}']`).body[0];i.computed=t.callee.computed,i.optional=t.callee.optional,n.add(r)});for(let e of n){let n=H3(`
71
- class Wrapper {
72
- wrapper () {
73
- __apm$super['${e}'] = super['${e}']
74
- }
75
- }
76
- `).body[0].body.body[0].value.body.body[0];t.body.body.unshift(n)}n.size>0&&t.body.body.unshift(H3(`const __apm$super = {}`).body[0])}function $3(e,t,n=``){let r=e6(e,t,n),i=t6(e,t,n),[a,o,s,c,l,u]=r.body[0].body.body,d={type:`IfStatement`,test:c.test,consequent:{type:`BlockStatement`,body:i.body[0].body.body},alternate:null};return r.body[0].body.body=[a,d,o,s,l,u],r}function e6(e,t,n=``){let{channelName:r,functionQuery:{callbackIndex:i=-1}}=e,a=G3(r);return H3(`
77
- function wrapper () {
78
- const __apm$cb = Array.prototype.at.call(__apm$arguments, ${i});
79
-
80
- if (!${a}.start.hasSubscribers) return __apm$traced();
81
-
82
- function __apm$wrappedCb(err, res) {
83
- if (err) {
84
- __apm$ctx.error = err;
85
- ${a}.error.publish(__apm$ctx);
86
- } else {
87
- __apm$ctx.result = res;
88
- ${n}
89
- }
90
-
91
- ${a}.asyncStart.runStores(__apm$ctx, () => {
92
- try {
93
- if (__apm$cb) {
94
- return __apm$cb.apply(this, arguments);
95
- }
96
- } finally {
97
- ${a}.asyncEnd.publish(__apm$ctx);
98
- }
99
- });
100
- }
101
-
102
- if (typeof __apm$cb !== 'function') {
103
- return __apm$traced();
104
- }
105
- Array.prototype.splice.call(__apm$arguments, ${i}, 1, __apm$wrappedCb);
106
-
107
- return ${a}.start.runStores(__apm$ctx, () => {
108
- try {
109
- return __apm$traced();
110
- } catch (err) {
111
- __apm$ctx.error = err;
112
- ${a}.error.publish(__apm$ctx);
113
- throw err;
114
- } finally {
115
- __apm$ctx.self ??= this;
116
- ${a}.end.publish(__apm$ctx);
117
- }
118
- });
119
- }
120
- `)}function t6(e,t,n=``){let{channelName:r}=e,i=G3(r);return H3(`
121
- function wrapper () {
122
- if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
123
-
124
- return ${i}.start.runStores(__apm$ctx, () => {
125
- try {
126
- let promise = __apm$traced();
127
- if (typeof promise?.then !== 'function') {
128
- __apm$ctx.result = promise;
129
- ${n}
130
- return __apm$ctx.result;
131
- }
132
- // Mirror Node.js core diagnostics_channel behaviour: for native Promise
133
- // instances, chain normally (safe since there is no subclass API to
134
- // preserve). For Promise subclasses and other thenables, side-chain the
135
- // callbacks for event publishing and return the original so that any
136
- // subclass-specific methods (e.g. APIPromise.withResponse()) remain
137
- // accessible to the caller.
138
- if (promise instanceof Promise && promise.constructor === Promise) {
139
- return promise.then(
140
- result => {
141
- __apm$ctx.result = result;
142
- ${n}
143
- ${i}.asyncStart.publish(__apm$ctx);
144
- ${i}.asyncEnd.publish(__apm$ctx);
145
- return __apm$ctx.result;
146
- },
147
- err => {
148
- __apm$ctx.error = err;
149
- ${i}.error.publish(__apm$ctx);
150
- ${i}.asyncStart.publish(__apm$ctx);
151
- ${i}.asyncEnd.publish(__apm$ctx);
152
- throw err;
153
- }
154
- );
155
- }
156
- promise.then(
157
- result => {
158
- __apm$ctx.result = result;
159
- ${n}
160
- ${i}.asyncStart.publish(__apm$ctx);
161
- ${i}.asyncEnd.publish(__apm$ctx);
162
- },
163
- err => {
164
- __apm$ctx.error = err;
165
- ${i}.error.publish(__apm$ctx);
166
- ${i}.asyncStart.publish(__apm$ctx);
167
- ${i}.asyncEnd.publish(__apm$ctx);
168
- }
169
- );
170
- return promise;
171
- } catch (err) {
172
- __apm$ctx.error = err;
173
- ${i}.error.publish(__apm$ctx);
174
- throw err;
175
- } finally {
176
- __apm$ctx.self ??= this;
177
- ${i}.end.publish(__apm$ctx);
178
- }
179
- });
180
- }
181
- `)}function n6(e,t,n=``){let{channelName:r}=e,i=G3(r);return H3(`
182
- function wrapper () {
183
- if (!tr_ch_apm_hasSubscribers(${i})) return __apm$traced();
184
-
185
- return ${i}.start.runStores(__apm$ctx, () => {
186
- try {
187
- __apm$ctx.result = __apm$traced();
188
- ${n}
189
- } catch (err) {
190
- __apm$ctx.error = err;
191
- ${i}.error.publish(__apm$ctx);
192
- throw err;
193
- } finally {
194
- __apm$ctx.self ??= this;
195
- ${i}.end.publish(__apm$ctx);
196
- }
197
- return __apm$ctx.result;
198
- });
199
- }
200
- `)}function r6(e,t){let{channelName:n,module:{name:r}}=e,i=G3(n+`:next`);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;let a=G3(n),o=t.body.findIndex(e=>e.declarations?.[0]?.id?.name===a),s=`const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}:next")`;t.body.splice(o+1,0,H3(s).body[0])}function i6(e,t,n){let{channelName:r}=e,i=t===`Iterator`?`traceSync`:`tracePromise`,a=G3(r+`:next`);return r6(e,n),`
201
- const __apm$iter = __apm$ctx.result;
202
- if (__apm$iter != null && typeof __apm$iter.next === 'function') {
203
- const __apm$patchIter = function (method) {
204
- const __apm$orig = __apm$iter[method];
205
- if (typeof __apm$orig !== 'function') return;
206
- __apm$iter[method] = function () {
207
- const __apm$iterArgs = Array.prototype.slice.call(arguments);
208
- if (!tr_ch_apm_hasSubscribers(${a})) return __apm$orig.apply(this, __apm$iterArgs);
209
- __apm$ctx.method = method;
210
- __apm$ctx.arguments = __apm$iterArgs;
211
- return ${a}.${i}(__apm$orig, __apm$ctx, this, ...__apm$iterArgs);
212
- };
213
- };
214
- __apm$patchIter('next');
215
- __apm$patchIter('throw');
216
- __apm$patchIter('return');
217
- }
218
- `}var a6=B3.exports,o6={},s6=e=>{throw TypeError(e)},c6=(e,t,n)=>t.has(e)||s6(`Cannot `+n),l6=(e,t,n)=>(c6(e,t,`read from private field`),n?n.call(e):t.get(e)),u6=(e,t,n)=>t.has(e)?s6(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),d6=(e,t,n,r)=>(c6(e,t,`write to private field`),t.set(e,n),n),f6=(e,t,n)=>(c6(e,t,`access private method`),n),p6,m6,h6,g6,_6,v6,y6,b6,x6,S6,C6,w6,T6=L3,{parse:E6}=R3,{generate:D6}=z3,O6=a6,k6,A6,j6=class{constructor(e,t,n,r,i,a={}){u6(this,y6),u6(this,p6,null),u6(this,m6,null),u6(this,h6,null),u6(this,g6,[]),u6(this,_6,null),u6(this,v6,{}),d6(this,p6,e),d6(this,m6,t),d6(this,h6,n),d6(this,g6,r),d6(this,_6,i),d6(this,v6,a)}free(){}get moduleName(){return l6(this,p6)}get filePath(){return l6(this,h6)}transform(e,t,n){if(Buffer.isBuffer(e)&&(e=e.toString()),!e)return{code:e};let r,i={},a=0;for(let n of l6(this,g6)){let{astQuery:o,functionQuery:s={}}=n;if(!r){let n={loc:!0,ranges:!0,raw:!0,module:t===`esm`};try{r=E6(e,n)}catch{r=E6(e,{...n,module:!n.module})}t===`esm`&&(i=f6(this,y6,S6).call(this,r))}let c=f6(this,y6,C6).call(this,s,i),l=o||f6(this,y6,w6).call(this,c),u={...n,dcModule:l6(this,_6),moduleType:t,moduleVersion:l6(this,m6),functionQuery:c};u.operator=f6(this,y6,x6).call(this,u),T6.traverse(r,T6.parse(l),(...e)=>{a++,f6(this,y6,b6).call(this,u,...e)})}if(a===0&&l6(this,g6).length>0){let e=l6(this,g6).map(({astQuery:e,functionQuery:t={}})=>{if(e)return e;let n=f6(this,y6,C6).call(this,t,i),r=(e=>e.methodName||e.privateMethodName||e.functionName||e.expressionName||`constructor`)(t),a=t.className||t.functionName||t.expressionName,o=n.className||n.functionName||n.expressionName;return a&&a!==o?`${a} (local name: ${o})`:r});throw Error(`Failed to find injection points for: ${JSON.stringify(e)}`)}if(r){k6??=o6.SourceMapConsumer,A6??=o6.SourceMapGenerator;let e=`${l6(this,p6)}/${l6(this,h6)}`,t;if(n){let r=new k6(n);r.file=e,t=A6.fromSourceMap(r)}else t=new A6({file:e});return{code:D6(r,{sourceMap:t}),map:t.toString()}}return{code:e}}};p6=new WeakMap,m6=new WeakMap,h6=new WeakMap,g6=new WeakMap,_6=new WeakMap,v6=new WeakMap,y6=new WeakSet,b6=function(e,...t){let n=l6(this,v6)[e.operator]??O6[e.operator],{index:r=0}=e.functionQuery,[i]=t,a=i.init?.type||i.type;a!==`ClassDeclaration`&&a!==`ClassExpression`&&(i.type===`VariableDeclarator`||(e.functionIndex=++e.functionIndex||0,r!==null&&r!==e.functionIndex))||n(e,...t)},x6=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`}},S6=function(e){let t={};for(let n of e.body)if(n.type===`ExportNamedDeclaration`&&!n.source){for(let e of n.specifiers)if(e.exported&&e.local){let n=e.exported.name??e.exported.value,r=e.local.name??e.local.value;n&&r&&(t[n]=r)}}return t},C6=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},w6=function(e){let{functionName:t,expressionName:n,className:r,objectName:i,propertyName:a}=e,o=e.privateMethodName?`PrivateIdentifier`:`Identifier`,s=[],c=e.methodName||e.privateMethodName;if(r?(c??=`constructor`,s.push(`[id.name="${r}"]`,`[id.name="${r}"] > ClassExpression`,`[id.name="${r}"] > ClassBody > [key.name="${c}"][key.type=${o}] > [async]`,`[id.name="${r}"] > ClassExpression > ClassBody > [key.name="${c}"][key.type=${o}] > [async]`)):c&&s.push(`ClassBody > [key.name="${c}"][key.type=${o}] > [async]`,`Property[key.name="${c}"][key.type=${o}] > [async]`),t?s.push(`FunctionDeclaration[id.name="${t}"][async]`):n&&s.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||a){if(!i||!a)throw Error(`functionQuery: 'objectName' and 'propertyName' must be used together (got objectName=${i}, propertyName=${a})`);let e=i===`this`?`left.object.type=ThisExpression`:`left.object.name="${i}"`;s.push(`AssignmentExpression[${e}][left.property.name="${a}"] > [async]`)}return s.join(`, `)};var M6={Transformer:j6},N6=e=>{throw TypeError(e)},P6=(e,t,n)=>t.has(e)||N6(`Cannot `+n),F6=(e,t,n)=>(P6(e,t,`read from private field`),n?n.call(e):t.get(e)),I6=(e,t,n)=>t.has(e)?N6(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),L6=(e,t,n,r)=>(P6(e,t,`write to private field`),t.set(e,n),n),R6,z6,B6,V6,H6=o3,{Transformer:U6}=M6,W6=class{constructor(e,t){I6(this,R6,[]),I6(this,z6,null),I6(this,B6,{}),I6(this,V6,{}),L6(this,R6,e),L6(this,z6,t||`diagnostics_channel`)}free(){L6(this,B6,{})}addTransform(e,t){F6(this,V6)[e]=t}getTransformer(e,t,n){n=n.replace(/\\/g,`/`);let r=`${e}/${n}@${t}`;if(F6(this,B6)[r])return F6(this,B6)[r];let i=F6(this,R6).filter(({module:r})=>r.name===e&&(typeof r.filePath==`string`?r.filePath===n:r.filePath.test(n))&&H6(t,r.versionRange));if(i.length!==0)return F6(this,B6)[r]=new U6(e,t,n,i,F6(this,z6),F6(this,V6)),F6(this,B6)[r]}};R6=new WeakMap,z6=new WeakMap,B6=new WeakMap,V6=new WeakMap;var{InstrumentationMatcher:G6}={InstrumentationMatcher:W6};function K6(e,t){return new G6(e,t)}var q6={create:K6},J6=Ce.sep,Y6=function(e){var t=e.split(J6),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],a=r?3:2,o=``,s=n+a-1,c=0;c<=s;c++)o+=c===s?t[c]:t[c]+J6;for(var l=``,u=t.length-1,d=n+a;d<=u;d++)l+=d===u?t[d]:t[d]+J6;return{name:i,basedir:o,path:l}}},X6=a3(Y6),{readFileSync:Z6}=De,{join:Q6}=Ce,$6=new Map;function e8(e){if($6.has(e))return $6.get(e);try{let t=Z6(Q6(e,`package.json`)),{version:n}=JSON.parse(t);return $6.set(e,n),n}catch{return process.version.slice(1)}}var t8=e8,n8=a3(t8),r8;function i8(e){r8=e}function a8(e){r8&&r8(e)}var o8={setDiagnosticsHook:i8,emitDiagnostics:a8},s8={exports:{}},c8=(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)},l8=$e,u8=tt,d8=c8,{env:f8}=process,p8;d8(`no-color`)||d8(`no-colors`)||d8(`color=false`)||d8(`color=never`)?p8=0:(d8(`color`)||d8(`colors`)||d8(`color=true`)||d8(`color=always`))&&(p8=1),`FORCE_COLOR`in f8&&(p8=f8.FORCE_COLOR===`true`?1:f8.FORCE_COLOR===`false`?0:f8.FORCE_COLOR.length===0?1:Math.min(parseInt(f8.FORCE_COLOR,10),3));function m8(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function h8(e,t){if(p8===0)return 0;if(d8(`color=16m`)||d8(`color=full`)||d8(`color=truecolor`))return 3;if(d8(`color=256`))return 2;if(e&&!t&&p8===void 0)return 0;let n=p8||0;if(f8.TERM===`dumb`)return n;if(process.platform===`win32`){let e=l8.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in f8)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in f8)||f8.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in f8)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(f8.TEAMCITY_VERSION);if(f8.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in f8){let e=parseInt((f8.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(f8.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(f8.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(f8.TERM)||`COLORTERM`in f8?1:n}function g8(e){return m8(h8(e,e&&e.isTTY))}var _8={supportsColor:g8,stdout:m8(h8(!0,u8.isatty(1))),stderr:m8(h8(!0,u8.isatty(2)))},v8=1e3,y8=v8*60,b8=y8*60,x8=b8*24,S8=x8*7,C8=x8*365.25,w8=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return T8(e);if(n===`number`&&isFinite(e))return t.long?D8(e):E8(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function T8(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]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return n*C8;case`weeks`:case`week`:case`w`:return n*S8;case`days`:case`day`:case`d`:return n*x8;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return n*b8;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return n*y8;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return n*v8;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return n;default:return}}}}function E8(e){var t=Math.abs(e);return t>=x8?Math.round(e/x8)+`d`:t>=b8?Math.round(e/b8)+`h`:t>=y8?Math.round(e/y8)+`m`:t>=v8?Math.round(e/v8)+`s`:e+`ms`}function D8(e){var t=Math.abs(e);return t>=x8?O8(e,t,x8,`day`):t>=b8?O8(e,t,b8,`hour`):t>=y8?O8(e,t,y8,`minute`):t>=v8?O8(e,t,v8,`second`):e+` ms`}function O8(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}function k8(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=w8,n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}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 A8=k8;(function(e,t){let n=tt,r=Ne;t.init=u,t.log=s,t.formatArgs=a,t.save=c,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 e=_8;e&&(e.stderr||e).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(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function i(){return`colors`in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function a(t){let{namespace:n,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${n} \x1B[0m`;t[0]=a+t[0].split(`
219
- `).join(`
220
- `+a),t.push(i+`m+`+e.exports.humanize(this.diff)+`\x1B[0m`)}else t[0]=o()+n+` `+t[0]}function o(){return t.inspectOpts.hideDate?``:new Date().toISOString()+` `}function s(...e){return process.stderr.write(r.formatWithOptions(t.inspectOpts,...e)+`
221
- `)}function c(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function l(){return process.env.DEBUG}function u(e){e.inspectOpts={};let n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]}e.exports=A8(t);let{formatters:d}=e.exports;d.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split(`
222
- `).map(e=>e.trim()).join(` `)},d.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}})(s8,s8.exports);var j8=s8.exports,M8=a3(j8),{create:N8}=q6,P8=ye,F8=Y6,{pathToFileURL:I8}=He,L8=t8,{emitDiagnostics:R8}=o8,z8=j8(`@apm-js-collab/tracing-hooks:module-patch`),B8=class{constructor({instrumentations:e=[]}={}){this.packages=new Set(e.map(e=>e.module.name)),this.instrumentator=N8(e),this.compile=P8.prototype._compile}patch(){let e=this;P8.prototype._compile=function(...t){let[n,r]=t,i=F8(r);if(i&&e.packages.has(i.name)){z8(`found resolved module, checking if there is a transformer %s`,r);let a=L8(i.basedir,i.name),o=e.instrumentator.getTransformer(i.name,a,i.path);if(o){z8(`transforming file %s`,r);try{t[0]=o.transform(n,`cjs`)?.code,R8({url:I8(r).href,moduleName:o.moduleName}),process.env.TRACING_DUMP&&V8(t[0],r)}catch(e){z8(`Error transforming module %s: %o`,r,e),R8({url:I8(r).href,moduleName:o.moduleName,error:e})}finally{o.free()}}}return e.compile.apply(this,t)}}unpatch(){P8.prototype._compile=this.compile}};function V8(e,t){let n=$e,r=Ce,i=De,a=process.env.TRACING_DUMP_DIR??n.tmpdir(),o=r.dirname(t),s=r.basename(t),c=r.join(a,o),l=r.join(c,s);z8(`Dumping patched code to: %s`,l),i.mkdirSync(c,{recursive:!0}),i.writeFileSync(l,e)}var H8=a3(B8),U8=M8(`@apm-js-collab/tracing-hooks:esm-hook`),W8=null,G8=null,K8=null,q8=o8.emitDiagnostics;function J8(){let{port1:e,port2:t}=new Je;return e.on(`message`,o8.emitDiagnostics),e.unref(),t}function Y8(e={}){let t=e?.instrumentations||[];K8=q6.create(t),G8=new Set(t.map(e=>e.module.name)),W8=new Map,q8=e?.diagnosticsPort?X8(e.diagnosticsPort):o8.emitDiagnostics}function X8(e){return t=>{try{let n=t.error===void 0||t.error instanceof Error?t.error:Error(String(t.error));e.postMessage({...t,error:n})}catch(e){U8(`failed to post diagnostics for %s: %o`,t.url,e)}}}function Z8(e){let t=X6(e.url);if(t&&G8.has(t.name)){let n=n8(Ue(t.basedir)),r=K8.getTransformer(t.name,n,t.path);r&&W8.set(e.url,r)}return e}function Q8(e,t,n){return Z8(n(e,t))}function $8(e,t,n){let r=n(e,t);if(W8.has(e)===!1)return r;if(r.format===`commonjs`){let t=new URL(r.responseURL??e);r.source??=Ae(t)}return e5(e,r)}function e5(e,t){let n=t.source;if(n){let r=W8.get(e);try{let i=t.format===`module`?`esm`:t.format===`commonjs`?`cjs`:`unknown`,a=typeof n==`string`?n:Buffer.from(n).toString(`utf8`);t.source=r.transform(a,i)?.code,t.shortCircuit=!0,q8({url:e,moduleName:r.moduleName})}catch(t){U8(`Error transforming module %s: %o`,e,t),q8({url:e,moduleName:r.moduleName,error:t})}finally{r.free()}}return t}o8.setDiagnosticsHook;function t5(e){if(e){let{major:t=0,minor:n=0}=kr(e);return t>2||t===2&&n>=8}let{major:t=0,minor:n=0}=kr(process.versions.node??`0.0.0`);return t>25||t===25&&n>=1||t===24&&n>=13}function n5(e){if(!Xe&&!Ze||k?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=t5(t.Deno?.version?.deno),r=ve;o8.setDiagnosticsHook(({moduleName:e,error:t})=>{t?j.warn(`[orchestrion] failed to inject diagnostics-channel into ${e}:`,t):(k.__SENTRY_ORCHESTRION__=k.__SENTRY_ORCHESTRION__||{},k.__SENTRY_ORCHESTRION__.runtime=k.__SENTRY_ORCHESTRION__.runtime||[],k.__SENTRY_ORCHESTRION__.runtime.push(e))});try{if(typeof r.registerHooks==`function`&&n)Y8({instrumentations:r3}),r.registerHooks({resolve:Q8,load:$8}),j.log(`Registered diagnostics-channel injection via Module.registerHooks()`);else if(typeof r.register==`function`&&!t.Bun&&!t.Deno){let e=J8(),t;t=import.meta.url,r.register(`@sentry/server-utils/orchestrion/hook`,{parentURL:t,data:{instrumentations:r3,diagnosticsPort:e},transferList:[e]}),new H8({instrumentations:r3}).patch(),j.log(`Registered diagnostics-channel injection via Module.register()`)}else{j.warn(`No available Node API to register diagnostics-channel injection hooks; skipping.`);return}}catch(e){j.warn(`Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.`,e);return}k.__SENTRY_ORCHESTRION__=k.__SENTRY_ORCHESTRION__||{},k.__SENTRY_ORCHESTRION__.runtime=k.__SENTRY_ORCHESTRION__.runtime||[]}function r5(){return s0}function i5(e){uV(()=>{let e=Object.values(s0).map(e=>e()),t=e.map(e=>e.name);return{integrations:[...e,gX({responseHook:EV}),o0({responseHook:EV})],replacedOtelIntegrationNames:t,register:()=>n5(),detect:U1}})}export{RE as NODE_VERSION,CM as NodeClient,g4 as OpenFeatureIntegrationHook,A as SDK_VERSION,I as SEMANTIC_ATTRIBUTE_SENTRY_OP,L as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Ci as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,Si as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,Xr as Scope,mA as SentryContextManager,sN as _INTERNAL_normalizeCollectionInterval,Zp as addBreadcrumb,od as addEventProcessor,wd as addIntegration,N2 as amqplibIntegration,KM as anrIntegration,$2 as anthropicAIIntegration,$4 as applyDiagnosticsChannelInjectionIntegrations,ks as bindScopeToEmitter,m4 as buildLaunchDarklyFlagUsedHandler,fd as captureCheckIn,Zm as captureConsoleIntegration,Gu as captureEvent,U as captureException,mg as captureFeedback,Wu as captureMessage,ud as captureSession,bA as childProcessIntegration,rd as close,IU as connectIntegration,Zj as consoleIntegration,xg as consoleLoggingIntegration,aj as contextLinesIntegration,rs as continueTrace,Og as createConsolaReporter,yM as createGetModuleFromFilename,Ub as createLangChainCallbackHandler,pN as createSentryWinstonTransport,mf as createTransport,ON as cron,V0 as dataloaderIntegration,eh as dedupeIntegration,xM as defaultStackParser,r5 as diagnosticsChannelInjectionIntegrations,JM as disableAnrDetectionForCallback,cd as endSession,rm as eventFiltersIntegration,i5 as experimentalUseDiagnosticsChannelInjection,rw as expressErrorHandler,fP as expressIntegration,ch as extraErrorDataIntegration,IR as fastifyIntegration,ag as featureFlagsIntegration,z4 as firebaseIntegration,nd as flush,iP as fsIntegration,em as functionToStringIntegration,X as generateInstrumentOnce,k0 as genericPoolIntegration,z as getActiveSpan,B4 as getAutoPerformanceIntegrations,F as getClient,N as getCurrentScope,Q4 as getDefaultIntegrations,Z4 as getDefaultIntegrationsWithoutPerformance,vi as getGlobalScope,P as getIsolationScope,Xa as getRootSpan,bM as getSentryRelease,Ya as getSpanDescendants,Vi as getSpanStatusFromHttpCode,jp as getTraceData,Ip as getTraceMetaTags,r4 as googleGenAIIntegration,wz as graphqlIntegration,y4 as growthbookIntegration,XH as hapiIntegration,lU as honoIntegration,Wp as httpHeadersToSpanAttributes,jN as httpIntegration,lT as httpServerIntegration,dT as httpServerSpansIntegration,im as inboundFiltersIntegration,e3 as init,G4 as initOpenTelemetry,n3 as initWithoutDefaultIntegrations,nb as instrumentAnthropicAiClient,yb as instrumentGoogleGenAIClient,Jb as instrumentLangChainEmbeddings,fx as instrumentLangGraph,ky as instrumentOpenAiClient,dx as instrumentStateGraph,cx as instrumentStateGraphCompile,Rh as instrumentSupabaseClient,dV as isDiagnosticsChannelInjectionEnabled,ad as isEnabled,id as isInitialized,Kz as kafkaIntegration,u0 as knexIntegration,CU as koaIntegration,c4 as langChainIntegration,f4 as langGraphIntegration,td as lastEventId,p4 as launchDarklyIntegration,Mm as linkedErrorsIntegration,Sj as localVariablesIntegration,XM as logger,Zz as lruMemoizerIntegration,mM as makeNodeTransport,Sg as metrics,Ej as modulesIntegration,mB as mongoIntegration,MB as mongooseIntegration,sV as mysql2Integration,WB as mysqlIntegration,MN as nativeNodeFetchIntegration,EA as nodeContextIntegration,cN as nodeRuntimeMetricsIntegration,Fj as onUncaughtExceptionIntegration,zj as onUnhandledRejectionIntegration,Y2 as openAIIntegration,h4 as openFeatureIntegration,Op as parameterize,bN as pinoIntegration,wH as postgresIntegration,MH as postgresJsIntegration,K4 as preloadOpenTelemetry,CI as prismaIntegration,Kj as processSessionIntegration,pg as profiler,ZV as redisIntegration,Rm as requestDataIntegration,bh as rewriteFramesIntegration,Qu as setAttribute,Zu as setAttributes,Ku as setContext,ed as setConversationId,Jf as setCurrentClient,Ju as setExtra,qu as setExtras,Hi as setHttpStatus,zo as setMeasurement,uA as setNodeAsyncContextStrategy,Xu as setTag,Yu as setTags,$u as setUser,RU as setupConnectErrorHandler,lP as setupExpressErrorHandler,LR as setupFastifyErrorHandler,eU as setupHapiErrorHandler,pU as setupHonoErrorHandler,wU as setupKoaErrorHandler,yx as spanStreamingIntegration,go as spanToBaggageHeader,R as spanToJSON,ja as spanToTraceHeader,Jj as spotlightIntegration,V as startInactiveSpan,os as startNewTrace,sd as startSession,B as startSpan,es as startSpanManual,_4 as statsigIntegration,Vh as supabaseIntegration,is as suppressTracing,nM as systemErrorIntegration,C0 as tediousIntegration,Ox as trpcMiddleware,v4 as unleashIntegration,$a as updateSpanName,AM as validateOpenTelemetrySetup,G2 as vercelAIIntegration,Bp as winterCGHeadersToDict,H as withActiveSpan,bi as withIsolationScope,dd as withMonitor,yi as withScope,_o as withStreamedSpan,bC as wrapMcpServerWithSentry,Yh as zodErrorsIntegration};