@aventurevc/mcp-server 0.7.283

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.
@@ -0,0 +1,222 @@
1
+ import{B as e,E as t,G as n,H as r,I as i,M as a,N as o,O as s,Q as c,S as l,U as u,Y as d,Z as f,_ as p,a as m,b as h,c as g,h as _,i as v,j as y,l as ee,n as b,o as te,p as x,q as ne,r as re,s as ie,u as ae,w as oe,y as se}from"./esm-VTPP_TTM.js";import{t as ce}from"./src-D3OljkFc.js";import*as le from"node:module";import ue from"node:module";import{execFile as de}from"node:child_process";import*as fe from"node:os";import pe from"node:os";import me,{join as he,posix as ge,sep as _e}from"node:path";import{inspect as ve,promisify as ye,types as be}from"util";import*as xe from"fs";import{readFileSync as Se}from"fs";import*as Ce from"path";import{normalize as we}from"path";import Te,{createReadStream as Ee,readFile as De,readFileSync as Oe,readdir as ke}from"node:fs";import Ae,{fileURLToPath as je}from"node:url";import{EventEmitter as Me,errorMonitor as Ne}from"node:events";import*as Pe from"node:util";import Fe,{format as Ie,promisify as Le,types as Re}from"node:util";import{AsyncLocalStorage as ze}from"node:async_hooks";import*as Be from"node:net";import*as Ve from"node:http";import{Readable as S}from"node:stream";import*as C from"node:diagnostics_channel";import{subscribe as He,unsubscribe as Ue}from"node:diagnostics_channel";import*as w from"node:tls";import{createGzip as We}from"node:zlib";import{MessageChannel as Ge,Worker as Ke,isMainThread as qe,parentPort as T}from"node:worker_threads";import{URL as Je}from"url";import E from"node:tty";import*as Ye from"module";import{isMainThread as Xe,threadId as Ze}from"worker_threads";import*as Qe from"diagnostics_channel";import{createInterface as $e}from"node:readline";import*as et from"node:https";import{monitorEventLoopDelay as tt,performance as nt}from"perf_hooks";import{EventEmitter as rt}from"events";var D=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,O=globalThis,k=`10.73.0`;function it(){return at(O),O}function at(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.73.0`,t[k]=t[`10.73.0`]||{}}function ot(e,t,n=O){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[k]=r[`10.73.0`]||{};return i[e]||(i[e]=t())}var st=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],ct=`Sentry Logger `,lt={};function ut(e){if(!(`console`in O))return e();let t=O.console,n={},r=Object.keys(lt);r.forEach(e=>{let r=lt[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function dt(){vt().enabled=!0}function ft(){vt().enabled=!1}function pt(){return vt().enabled}function mt(...e){_t(`log`,...e)}function ht(...e){_t(`warn`,...e)}function gt(...e){_t(`error`,...e)}function _t(e,...t){D&&pt()&&ut(()=>{O.console[e](`${ct}[${e}]:`,...t)})}function vt(){return D?ot(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var A={enable:dt,disable:ft,isEnabled:pt,log:mt,warn:ht,error:gt},yt=50,bt=/\(error: (.*)\)/,xt=/captureMessage|captureException/;function St(...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=bt.test(n)?n.replace(bt,`$1`):n;if(!o.includes(`Error: `)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=yt+r)break}}return wt(i.slice(r))}}function Ct(e){return Array.isArray(e)?St(...e):e}function wt(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Tt(t).function||``)&&t.pop(),t.reverse(),xt.test(Tt(t).function||``)&&(t.pop(),xt.test(Tt(t).function||``)&&t.pop()),t.slice(0,yt).map(e=>({...e,filename:e.filename||Tt(t).filename,function:e.function||`?`}))}function Tt(e){return e[e.length-1]||{}}var Et=`<anonymous>`;function Dt(e){try{return!e||typeof e!=`function`?Et:e.name||Et}catch{return Et}}function Ot(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 kt(e){let t=e?.startsWith(`file://`)?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var At={},jt={};function Mt(e,t){return At[e]=At[e]||[],At[e].push(t),()=>{let n=At[e];if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}function Nt(e,t){if(!jt[e]){jt[e]=!0;try{t()}catch(t){D&&A.error(`Error while instrumenting ${e}`,t)}}}function Pt(e,t){let n=e&&At[e];if(n)for(let r of n)try{r(t)}catch(t){D&&A.error(`Error while triggering instrumentation handler.
3
+ Type: ${e}
4
+ Name: ${Dt(r)}
5
+ Error:`,t)}}var Ft=Object.prototype.toString;function It(e){switch(Ft.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Kt(e,Error)}}function Lt(e,t){return Ft.call(e)===`[object ${t}]`}function Rt(e){return Lt(e,`ErrorEvent`)}function zt(e){return Lt(e,`String`)}function Bt(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function Vt(e){return e===null||Bt(e)||typeof e!=`object`&&typeof e!=`function`}function Ht(e){return Lt(e,`Object`)}function j(e){return typeof e==`object`&&!!e}function Ut(e){return typeof Event<`u`&&Kt(e,Event)}function Wt(e){return Lt(e,`RegExp`)}function Gt(e){return!!(e?.then&&typeof e.then==`function`)}function Kt(e,t){try{return e instanceof t}catch{return!1}}function qt(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Yt(i,r);try{e[t]=i}catch{D&&A.log(`Failed to replace method "${t}" in object`,e)}}function Jt(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{D&&A.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Yt(e,t){try{e.prototype=t.prototype=t.prototype||{},Jt(e,`__sentry_original__`,t)}catch{}}function Xt(e,t,n,r=!0){let i=e[t];if(typeof i!=`function`)throw Error(`Cannot wrap method: ${t} is not a function`);if(Zt(i))throw Error(`Attempting to wrap method ${t} multiple times`);Yt(n,i),Object.defineProperty(e,t,{writable:!0,configurable:!0,enumerable:r,value:n})}function Zt(e){return e.__sentry_original__}function Qt(e){if(It(e))return{message:e.message,name:e.name,stack:e.stack,...$t(e)};if(Ut(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...$t(e)}}return e}function $t(e){return j(e)?Object.fromEntries(Object.entries(e)):{}}function en(e){let t=Object.keys(Qt(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}var tn;function nn(e){if(tn!==void 0)return tn?tn(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=O;return t in n&&typeof n[t]==`function`?(tn=n[t],tn(e)):(tn=null,e())}function rn(){return nn(()=>Math.random())}function an(){return nn(()=>Date.now())}var on=Symbol.for(`sentry.skipNormalization`),sn=Symbol.for(`sentry.overrideNormalizationDepth`);function cn(e){Jt(e,on,!0)}function ln(e,t){Jt(e,sn,t)}function un(e){return!!e[on]}function dn(e){let t=e[sn];return typeof t==`number`?t:void 0}function fn(e,t=100,n=1/0){try{return mn(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function pn(e,t=3,n=102400){let r=fn(e,t);return vn(r)>n?pn(e,t-1,n):r}function mn(e,t,n=1/0,r=1/0,i=yn()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=hn(e,t);if(!s.startsWith(`[object `))return s;if(un(t))return t;let c=dn(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 mn(``,u.toJSON(),l-1,r,i)}catch{}let d=Array.isArray(t)?[]:{},f=0,p=Qt(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]=mn(e,t,l-1,r,i),f++}return o(t),d}function hn(e,t){try{return typeof global<`u`&&t===global?`[Global]`:typeof t==`number`&&!Number.isFinite(t)?`[${t}]`:typeof t==`function`?`[Function: ${Dt(t)}]`:typeof t==`symbol`?`[${String(t)}]`:typeof t==`bigint`?`[BigInt: ${String(t)}]`:`[object ${gn(t)}]`}catch(e){return`**non-serializable** (${e})`}}function gn(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function _n(e){return~-encodeURI(e).split(/%..|./).length}function vn(e){return _n(JSON.stringify(e))}function yn(){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 bn(e,t=`[unserializable]`){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return typeof t==`function`?t(e):t}}function xn(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Sn(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 Cn(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];Vt(r)?n.push(String(r)):r instanceof Error?n.push(r.message?`${r.name}: ${r.message}`:r.name):n.push(hn(void 0,r))}return n.join(t)}function wn(e,t,n=!1){return zt(e)?Wt(t)?t.test(e):zt(t)?n?e===t:e.includes(t):typeof t==`function`&&t(e):!1}function Tn(e,t=[],n=!1){for(let r of t)if(wn(e,r,n))return!0;return!1}function En(){let e=O;return e.crypto||e.msCrypto}var Dn;function On(){return rn()*16}function kn(e=En()){try{if(e?.randomUUID)return nn(()=>e.randomUUID()).replace(/-/g,``)}catch{}return Dn||=`10000000100040008000100000000000`,Dn.replace(/[018]/g,e=>(e^(On()&15)>>e/4).toString(16))}function An(e){return e.exception?.values?.[0]}function jn(e){let{message:t,event_id:n}=e;if(t)return t;let r=An(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function Mn(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 Nn(e,t){let n=An(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 Pn=/^(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 Fn(e){return parseInt(e||``,10)}function In(e){let t=e.match(Pn)||[],n=Fn(t[1]),r=Fn(t[2]),i=Fn(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 Ln(e){if(Rn(e))return!0;try{Jt(e,`__sentry_captured__`,!0)}catch{}return!1}function Rn(e){try{return e.__sentry_captured__}catch{}}var zn=1e3;function Bn(){return an()/zn}function Vn(){let{performance:e}=O;if(!e?.now||!e.timeOrigin)return Bn;let t=e.timeOrigin;return()=>(t+nn(()=>e.now()))/zn}var Hn;function Un(){return(Hn??=Vn())()}function Wn(e){let t=Un(),n={sid:kn(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>qn(n)};return e&&Gn(n,e),n}function Gn(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||Un(),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:kn()),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 Kn(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),Gn(e,n)}function qn(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 Jn(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]=Jn(r[e],t[e],n-1));return r}function Yn(){return kn()}function Xn(){return kn().substring(16)}function Zn(e){try{let t=O.WeakRef;if(typeof t==`function`)return new t(e)}catch{}return e}function Qn(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}var $n=`_sentrySpan`;function er(e,t){t?Jt(e,$n,Zn(t)):delete e[$n]}function tr(e){return Qn(e[$n])}var nr=100,rr=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:Yn(),sampleRand:rn()}}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,er(t,tr(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&&Gn(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():Ht(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,er(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Yn(),sampleRand:rn()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:nr;if(n<=0)return this;let r={timestamp:Bn(),...e,message:e.message?xn(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:tr(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Jn(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||kn();if(!this._client)return D&&A.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||kn();if(!this._client)return D&&A.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||kn();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(D&&A.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 ir(){return ot(`defaultCurrentScope`,()=>new rr)}function ar(){return ot(`defaultIsolationScope`,()=>new rr)}var or=e=>e instanceof Promise&&!e[sr],sr=Symbol(`chained PromiseLike`),cr=(e,t,n)=>{let r=e.then(e=>(t(e),e),e=>{throw n(e),e});return or(r)&&or(e)?r:lr(e,r)},lr=(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,{[sr]:!0}),t},ur=class{constructor(e,t){let n;n=e||new rr;let r;r=t||new rr,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 Gt(n)?cr(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 dr(){let e=at(it());return e.stack=e.stack||new ur(ir(),ar())}function fr(e){return dr().withScope(e)}function pr(e,t){let n=dr();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function mr(e){return dr().withScope(()=>e(dr().getIsolationScope()))}function hr(){return{withIsolationScope:mr,withScope:fr,withSetScope:pr,withSetIsolationScope:(e,t)=>mr(t),getCurrentScope:()=>dr().getScope(),getIsolationScope:()=>dr().getIsolationScope()}}function gr(e){let t=at(it());t.acs=e}function _r(e){let t=at(e);return t.acs?t.acs:hr()}function vr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).includes(`value`)}function yr(e,t){let{value:n,unit:r}=vr(e)?e:{value:e,unit:void 0},i=Cr(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 br(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let e=yr(i,t);e&&(n[r]=e)}return n}function xr(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+=Sr(e[0])*e.length:Vt(e)?t+=Sr(e):t+=100}return t}function Sr(e){return typeof e==`string`?e.length*2:typeof e==`boolean`?4:typeof e==`number`?8:0}function Cr(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 wr(){return!1}function M(){return _r(it()).getCurrentScope()}function N(){return _r(it()).getIsolationScope()}function Tr(){return ot(`globalScope`,()=>new rr)}function Er(...e){let t=_r(it());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Dr(...e){let t=_r(it());if(e.length===2){let[n,r]=e;return n?t.withSetIsolationScope(n,r):t.withIsolationScope(r)}return t.withIsolationScope(e[0])}function P(){return M().getClient()}function Or(e){let{traceId:t,parentSpanId:n,propagationSpanId:r}=e.getPropagationContext(),i={trace_id:t,span_id:r||Xn()};return n&&(i.parent_span_id=n),i}var kr=`sentry.source`,Ar=`sentry.sample_rate`,F=`sentry.op`,I=`sentry.origin`,jr=`sentry.measurement_unit`,Mr=`sentry.measurement_value`,Nr=`sentry.release`,Pr=`sentry.environment`,Fr=`sentry.sdk.integrations`,Ir=`user.id`,Lr=`user.email`,Rr=`user.ip_address`,zr=`user.name`,Br=`sentry.custom_span_name`,Vr=`sentry.profile_id`,Hr=`sentry.exclusive_time`,Ur=`cache.hit`,Wr=`cache.key`,Gr=`cache.item_size`,Kr=`http.request.method`,qr=`gen_ai.conversation.id`;function Jr(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 Yr(e,t){e.setAttribute(`http.response.status_code`,t);let n=Jr(t);n.message!==`unknown_error`&&e.setStatus(n)}var Xr=`_sentryScope`,Zr=`_sentryIsolationScope`,Qr=Symbol.for(`sentry.otelSourceInference`),$r=Symbol.for(`sentry.otelSourceExplicitlySet`),ei=Symbol.for(`sentry.tracerProviderSpan`);function ti(e,t,n){e&&(Jt(e,Zr,Zn(n)),Jt(e,Xr,t))}function ni(e){let t=e;return{scope:t[Xr],isolationScope:Qn(t[Zr])}}function ri(e){Jt(e,Qr,!0)}function ii(e){return e[Qr]===!0}function ai(e){Jt(e,$r,!0)}function oi(e){return e[$r]===!0}function si(e){Jt(e,ei,!0)}function ci(e){return e[ei]===!0}var li=`sentry-`;function ui(e){let t=fi(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 di(e){if(e)return mi(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`${li}${t}`]=n),e),{}))}function fi(e){if(e&&(zt(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=pi(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):pi(e)}function pi(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 mi(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?(D&&A.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):a},``)}function hi(e,t){if(!e)return t;let n=fi(e),r=fi(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 mi(i)}var gi=/^o(\d+)\./,_i=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function vi(e){return e===`http`||e===`https`}function yi(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 bi(e){let t=_i.exec(e);if(!t){ut(()=>{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 xi({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function xi(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Si(e){if(!D)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>!e[t]&&(A.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?vi(r)?t&&isNaN(parseInt(t,10))?(A.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(A.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(A.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Ci(e){return e.match(gi)?.[1]}function wi(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=Ci(n)),r}function Ti(e){let t=typeof e==`string`?bi(e):xi(e);if(t&&Si(t))return t}function Ei(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 Di=RegExp(`^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$`);function Oi(e){if(!e)return;let t=e.match(Di);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 ki(e,t){let n=Oi(e),r=ui(t);if(!n?.traceId)return{traceId:Yn(),sampleRand:rn()};let i=Mi(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 Ai(e=Yn(),t=Xn(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function ji(e=Yn(),t=Xn(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Mi(e,t){let n=Ei(t?.sample_rand);if(n!==void 0)return n;let r=Ei(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?rn()*r:r+rn()*(1-r):rn()}function Ni(e,t){let n=wi(e);return t&&n&&t!==n?(A.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)?(A.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 Pi=!1;function Fi(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:a,status:o,origin:s,links:c}=L(e);return{parent_span_id:a,span_id:t,trace_id:n,data:r,op:i,status:o,origin:s,links:c}}function Ii(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:L(e).parent_span_id,a=ni(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||Xn():t,trace_id:n}}function Li(e){let{traceId:t,spanId:n}=e.spanContext();return Ai(t,n,Ji(e))}function Ri(e){let{traceId:t,spanId:n}=e.spanContext();return ji(t,n,Ji(e))}function zi(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 Bi(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 Vi(e){return typeof e==`number`?Hi(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Hi(e.getTime()):Un()}function Hi(e){return e>9999999999?e/1e3:e}function L(e){if(qi(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Ki(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:Wi(e),start_timestamp:Vi(i),timestamp:Vi(o)||void 0,status:Yi(s),op:r[F],origin:r[I],links:zi(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Ui(e){if(qi(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(Ki(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:Wi(e),start_timestamp:Vi(i),end_timestamp:Vi(o),is_segment:e===ra(e),status:Xi(s),attributes:Zi(r,s),links:Bi(c)}}return{span_id:t,trace_id:n,start_timestamp:0,name:``,end_timestamp:0,status:`ok`,is_segment:e===ra(e)}}function Wi(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function Gi(e){return{...e,attributes:br(e.attributes),links:e.links?.map(e=>({...e,attributes:br(e.attributes)}))}}function Ki(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function qi(e){return typeof e.getSpanJSON==`function`}function Ji(e){let{traceFlags:t}=e.spanContext();return t===1}function Yi(e){if(e&&e.code!==0)return e.code===1?`ok`:e.message||`internal_error`}function Xi(e){return!e||e.code===1||e.code===0||e.message===`cancelled`?`ok`:`error`}function Zi(e,t){let n=Xi(t)===`error`?t?.message:void 0;return{...n&&{"sentry.status.message":n},...e}}var Qi=`_sentryChildSpans`,$i=`_sentryRootSpan`;function ea(e,t){let n=e[$i]||e;Jt(t,$i,n),Ji(e)&&(e.isRecording()||n.isRecording())&&(e[Qi]?e[Qi].add(t):Jt(e,Qi,new Set([t])))}function ta(e){let t=new Set;function n(e){if(!t.has(e)&&Ji(e)){t.add(e);let r=e[Qi]?Array.from(e[Qi]):[];for(let e of r)n(e)}}return n(e),Array.from(t)}var na=ra;function ra(e){return e[$i]||e}function R(){let e=_r(it());return e.getActiveSpan?e.getActiveSpan():tr(M())}function ia(){Pi||=(ut(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}function aa(e,t){e.updateName(t),e.setAttributes({[kr]:`custom`,[Br]:t})}function oa(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||P()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function sa(e){A.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function ca(e,t){if(!t?.length)return!1;for(let n of t){if(da(n)){if(e.description&&wn(e.description,n))return D&&sa(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&&wn(e.description,n.name),i=!n.op||e.op&&wn(e.op,n.op),a=!n.attributes||Object.entries(n.attributes).every(([t,n])=>la(e.attributes?.[t],n));if(r&&i&&a)return D&&sa(e),!0}return!1}function la(e,t){return typeof e==`string`&&(typeof t==`string`||t instanceof RegExp)?wn(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function ua(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 da(e){return typeof e==`string`||e instanceof RegExp}var fa=Symbol.for(`sentry.nonRecordingSpan`),pa=class{constructor(e={}){this._traceId=e.traceId||Yn(),this._spanId=e.spanId||Xn(),this.dropReason=e.dropReason,Jt(this,fa,!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 ma(e){return!!e&&e[fa]===!0}var ha=`production`,ga=`_frozenDsc`;function _a(e,t){Jt(e,ga,t)}function va(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:wi(t)};return t.emit(`createDsc`,i),i}function ya(e,t){let n=t.getPropagationContext();return n.dsc||va(n.traceId,e)}function ba(e){let t=P();if(!t)return{};let n=na(e),r=L(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[ga];if(c)return s(c);let l=ma(n),u=l&&n.dropReason===`ignored`;if(l&&(!oa(t.getOptions())||u)){let e=ni(n).scope;if(e){let n={...ya(t,e)};return u&&(n.sampled=`false`),s(n)}}let d=a?.get(`sentry.dsc`),f=d&&ui(d);if(f)return s(f);let p=va(e.spanContext().traceId,t),m=i[`sentry.source`]??i[`sentry.segment.name.source`],h=r.description;return m!==`url`&&h&&(p.transaction=h),oa()&&(p.sampled=String(Ji(n)),p.sample_rand=a?.get(`sentry.sample_rand`)??ni(n).scope?.getPropagationContext().sampleRand.toString()),s(p),t.emit(`createDsc`,p,n),p}function xa(e){return di(ba(e))}function Sa(e){return Jt(e,`_streamed`,!0),e}function Ca(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}function wa(e,t=[]){return[e,t]}function Ta(e,t){let[n,r]=e;return[n,[...r,t]]}function Ea(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 Da(e,t){return Ea(e,(e,n)=>t.includes(n))}function Oa(e){let t=at(O);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function ka(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[Oa(r),e]:r.push(typeof e==`string`?Oa(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(fn(n))}i(e)}}return typeof r==`string`?r:Aa(r)}function Aa(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 ja(e){return[{type:`span`},e]}function Ma(e){let t=typeof e.data==`string`?Oa(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var Na={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 Pa(e){return e in Na}function Fa(e){return Pa(e)?Na[e]:e}function Ia(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function La(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(an()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:yi(r)},...i&&{trace:i}}}function Ra(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 za(e,t,n,r){let i=Ia(n);return wa({sent_at:new Date(an()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:yi(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function Ba(e,t,n,r){let i=Ia(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;Ra(e,n?.sdk);let o=La(e,i,r,t);return delete e.sdkProcessingMetadata,wa(o,[[{type:a},e]])}function Va(e,t){function n(e){return!!e.trace_id&&!!e.public_key}let r=ba(e[0]),i=t?.getDsn(),a=t?.getOptions().tunnel,o={sent_at:new Date(an()).toISOString(),...n(r)&&{trace:r},...!!a&&i&&{dsn:yi(i)}},{beforeSendSpan:s,ignoreSpans:c}=t?.getOptions()||{},l=c?.length?e.filter(e=>{let t=L(e);return!ca({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=L(e);return(Ca(s)?t:s(t))||(ia(),t)}:L,f=[];for(let e of l){let t=d(e);t&&f.push(ja(t))}return wa(o,f)}function Ha(e){if(!D)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`,parent_span_id:r}=L(e),{spanId:i}=e.spanContext(),a=Ji(e),o=na(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}=L(o);l.push(`root ID: ${o.spanContext().spanId}`),e&&l.push(`root op: ${e}`),t&&l.push(`root description: ${t}`)}A.log(`${c}
8
+ ${l.join(`
9
+ `)}`)}function Ua(e){if(!D)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`}=L(e),{spanId:r}=e.spanContext(),i=`[Tracing] Finishing "${n}" ${na(e)===e?`root `:``}span "${t}" with ID ${r}`;A.log(i)}function Wa(e,t,n,r=R()){let i=r&&na(r);i&&(D&&A.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Mr]:t,[jr]:n}))}function Ga(e){if(!e||e.length===0)return;let t={};return e.forEach(e=>{let n=e.attributes||{},r=n[jr],i=n[Mr];typeof r==`string`&&typeof i==`number`&&(t[e.name]={value:i,unit:r})}),t}function Ka(e){at(it()).segmentSpanCaptureStrategy=e}function qa(){return at(it()).segmentSpanCaptureStrategy}function Ja(e){return e.getOptions().traceLifecycle===`stream`}var Ya=1e3,Xa=class{constructor(e={}){this._traceId=e.traceId||Yn(),this._spanId=e.spanId||Xn(),this._startTime=e.startTimestamp||Un(),this._links=e.links,this._attributes={},this.setAttributes({[I]:`manual`,[F]: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&&ii(this)&&ai(this),this)}setAttributes(e){return Object.keys(e).forEach(t=>this.setAttribute(t,e[t])),this}updateStartTime(e){this._frozen||(this._startTime=Vi(e))}setStatus(e){return this._frozen||(this._status=e),this}updateName(e){return this._frozen?this:(this._name=e,ii(this)||this.setAttribute(kr,`custom`),this)}end(e){if(this._endTime){this._frozen=ci(this);return}this._endTime=Vi(e),Ua(this),this._onSpanEnded(),this._frozen=ci(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[F],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Yi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[I],profile_id:this._attributes[Vr],exclusive_time:this._attributes[Hr],measurements:Ga(this._events),is_segment:this._isStandaloneSpan&&na(this)===this||void 0,segment_id:this._isStandaloneSpan?na(this).spanContext().spanId:void 0,links:zi(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===na(this),status:Xi(this._status),attributes:Zi(this._attributes,this._status),links:Bi(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,t,n){if(this._frozen)return this;D&&A.log(`[Tracing] Adding an event to span:`,e);let r=Za(t)?t:n||Un(),i=Za(t)?{}:t||{},a={name:e,time:Vi(r),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=P();e&&(e.emit(`spanEnd`,this),this._isStandaloneSpan||e.emit(`afterSpanEnd`,this));let t=na(this),n=this._isStandaloneSpan||this===t;if(this._isStandaloneSpan){this._sampled?eo(Va([this],e)):(D&&A.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=qa();if(e){let n=ni(this).scope||M();e.onChildSpanEnded(this,t,e=>this._convertSpanToTransaction(e),n)}return}if(e&&Ja(e)){e.emit(`afterSegmentSpanEnd`,this);return}let r=ni(this).scope||M(),i=qa();if(i)i.onSegmentSpanEnded(e=>this._convertSpanToTransaction(e),r);else{let e=this._convertSpanToTransaction();e&&r.captureEvent(e)}}_convertSpanToTransaction(e={}){if(!Qa(L(this)))return;this._name||=(D&&A.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),`<unlabeled transaction>`);let{scope:t,isolationScope:n}=ni(this),r=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;e.onSpanCaptured?.(this);let i=[];for(let t of ta(this)){if(t===this||$a(t)||e.isSpanAlreadyCaptured?.(t))continue;let n=L(t);Qa(n)&&(e.onSpanCaptured?.(t),i.push(n))}let a=this._attributes[kr];delete this._attributes[Br];let o=!1;i.forEach(e=>{delete e.data[Br],e.op?.startsWith(`gen_ai.`)&&(o=!0)});let s={contexts:{trace:Fi(this)},spans:i.length>Ya?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,Ya):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:ba(this),hasGenAiSpans:o},request:r,...a&&{transaction_info:{source:a}}},c=Ga(this._events);return c&&Object.keys(c).length&&(D&&A.log(`[Measurements] Adding measurements to transaction event`,JSON.stringify(c,void 0,2)),s.measurements=c),s}};function Za(e){return e&&typeof e==`number`||e instanceof Date||Array.isArray(e)}function Qa(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function $a(e){return e instanceof Xa&&e.isStandaloneSpan()}function eo(e){let t=P();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent(`before_send`,`span`);return}t.sendEnvelope(e)}function to(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(e){throw t(e),n(),e}return no(i,t,n,r)}function no(e,t,n,r){return Gt(e)?cr(e,e=>{n(),r(e)},e=>{t(e),n()}):(n(),r(e),e)}function ro(e,t,n){if(!oa(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=Ei(i);if(a===void 0)return D&&A.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 D&&A.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||D&&A.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[o,a,r]}var io=`__SENTRY_SUPPRESS_TRACING__`;function z(e,t){let n=go();if(n.startSpan)return n.startSpan(e,t);let r=ho(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return Er(s,()=>bo(a)(()=>{let n=M(),o=yo(n,a),s=P(),c=e.onlyIfParent&&!o?po(n,s):mo({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!So(c)||!o)&&er(n,c),to(()=>t(c),()=>{let{status:e}=L(c);c.isRecording()&&(!e||e===`ok`)&&c.setStatus({code:2,message:`internal_error`})},()=>{c.end()})}))}function ao(e,t){let n=go();if(n.startSpanManual)return n.startSpanManual(e,t);let r=ho(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return Er(s,()=>bo(a)(()=>{let n=M(),o=yo(n,a),s=e.onlyIfParent&&!o?po(n,P()):mo({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!So(s)||!o)&&er(n,s),to(()=>t(s,()=>s.end()),()=>{let{status:e}=L(s);s.isRecording()&&(!e||e===`ok`)&&s.setStatus({code:2,message:`internal_error`})})}))}function B(e){let t=go();return t.startInactiveSpan?t.startInactiveSpan(e):so(e)}function oo(e){return so(e)}function so(e){let t=ho(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?t=>Er(e.scope,t):r===void 0?e=>e():e=>V(r,e))(()=>{let i=M(),a=yo(i,r),o=P();return e.onlyIfParent&&!a?po(i,o):mo({parentSpan:a,spanArguments:t,forceTransaction:n,scope:i})})}var co=(e,t)=>{let n=_r(it());if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:r,baggage:i}=e,a=P(),o=ui(i);return a&&!Ni(a,o?.org_id)?fo(t):Er(e=>{let n=ki(r,i);return e.setPropagationContext(n),er(e,void 0),t()})};function V(e,t){let n=go();return n.withActiveSpan?n.withActiveSpan(e,t):Er(n=>(er(n,e||void 0),t(n)))}function lo(e){let t=go();return t.suppressTracing?t.suppressTracing(e):Er(t=>{t.setSDKProcessingMetadata({[io]:!0});let n=e();return t.setSDKProcessingMetadata({[io]:void 0}),n})}function uo(e=M()){let t=go();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[io]===!0}function fo(e){let t=go();return t.startNewTrace?t.startNewTrace(e):Er(t=>(t.setPropagationContext({traceId:Yn(),sampleRand:rn()}),D&&A.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),V(null,e)))}function po(e,t){t?.recordDroppedEvent(`no_parent_span`,`span`);let n=new pa({traceId:e.getPropagationContext().traceId});return ti(n,e,N()),n}function mo({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let i=N();if(!oa()){let t={...i.getPropagationContext(),...r.getPropagationContext()},a=new pa({traceId:e?e.spanContext().traceId:t.traceId});return e&&!n&&ea(e,a),ti(a,r,i),a}let a=P();if(xo(a,t)){uo(r)||a?.recordDroppedEvent(`ignored`,`span`);let t=new pa({dropReason:`ignored`,traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&ea(e,t),ti(t,r,i),t}let o;if(e&&!n)o=vo(e,r,t,i),ea(e,o);else if(e){let n=ba(e),{traceId:a,spanId:s}=e.spanContext(),c=Ji(e);o=_o({traceId:a,parentSpanId:s,...t},r,i,c),_a(o,n)}else{let{traceId:e,dsc:n,parentSpanId:a,sampled:s}={...i.getPropagationContext(),...r.getPropagationContext()};o=_o({traceId:e,parentSpanId:a,...t},r,i,s),n&&_a(o,n)}return Ha(o),o}function ho(e){let t={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let n={...t};return n.startTimestamp=Vi(e.startTime),delete n.startTime,n}return t}function go(){return _r(it())}function _o(e,t,n,r){let i=P(),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=uo(t),[f,p,m]=d?[!1]:ro(a,{name:o,parentSampled:c,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:Ei(u.dsc?.sample_rate)},u.sampleRand),h=new Xa({...e,attributes:{[kr]:`custom`,[Ar]:p!==void 0&&m?p:void 0,...l},sampled:f});return!f&&i&&!d&&(D&&A.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),i.recordDroppedEvent(`sample_rate`,Ja(i)?`span`:`transaction`)),ti(h,t,n),i&&i.emit(`spanStart`,h),h}function vo(e,t,n,r){let{spanId:i,traceId:a}=e.spanContext(),o=uo(t),s=!o&&Ji(e),c=s?new Xa({...n,parentSpanId:i,traceId:a,sampled:s}):new pa({traceId:a});ea(e,c),ti(c,t,r);let l=P();return l?(Ja(l)&&ma(c)&&(ma(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 yo(e,t){if(t)return t;if(t===null)return;let n=tr(e);if(!n)return;let r=P();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?na(n):n}function bo(e){return e===void 0?e=>e():t=>V(e,t)}function xo(e,t){let n=e?.getOptions().ignoreSpans;return!e||!Ja(e)||!n?.length?!1:ca({description:t.name||``,op:t.attributes?.[`sentry.op`]||t.op,attributes:t.attributes},n)}function So(e){return ma(e)&&e.dropReason===`ignored`}function Co(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 wo=new WeakSet,To=e=>wo.has(e),Eo=e=>{wo.add(e)},Do=new WeakMap;function Oo(e){if(qa()||Ka(ko),Do.has(e))return;let t=new Set,n=Co(()=>{let e=[...t];t.clear();for(let t of e)t()},1,{maxWait:100});e.on(`flush`,()=>{n.flush()}),Do.set(e,e=>{t.add(e),n()})}var ko={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&Do.get(n);if(!r){let t=e();t&&n?.captureEvent(t);return}r(()=>{let t=e({isSpanAlreadyCaptured:To,onSpanCaptured:Eo});t&&n.captureEvent(t)})},onChildSpanEnded(e,t,n,r){if(wo.has(e)||!wo.has(t))return;let i=r.getClient(),a=i&&Do.get(i),o=()=>{let e=n({isSpanAlreadyCaptured:To,onSpanCaptured:Eo});e?.contexts?.trace?.data&&(e.contexts.trace.data[`sentry.parent_span_already_sent`]=!0),e&&i?.captureEvent(e)};a?a(o):o()}},Ao=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`,`addEventListener`],jo=[`removeListener`,`off`,`removeEventListener`],Mo=Symbol(`SentryScopeBoundListeners`),No;function Po(e){return No!==void 0&&(e===No||e.listener===No)}function Fo(e,t=M()){let n=e;if(Ho(n))return e;Vo(n);for(let e of Ao)typeof n[e]==`function`&&(n[e]=Ro(n,n[e],t));for(let e of jo)typeof n[e]==`function`&&(n[e]=zo(n,n[e]));return typeof n.removeAllListeners==`function`&&(n.removeAllListeners=Bo(n,n.removeAllListeners)),e}function Io(e,t){return function(...n){return Er(t,()=>e.apply(this,n))}}function Lo(e){return typeof e==`function`}function Ro(e,t,n){return function(...r){let i=r[0],a=r[1],o=r.slice(2);if(!Lo(a)||Po(a))return t.apply(this,r);let s=Ho(e)||Vo(e),c=s.get(i);c||(c=new WeakMap,s.set(i,c));let l=c.get(a);l||(l=Io(a,n),c.set(a,l));let u=No;No=l;try{return t.call(this,i,l,...o)}finally{No=u}}}function zo(e,t){return function(...n){let r=n[0],i=n[1],a=n.slice(2),o=Lo(i)?Ho(e)?.get(r)?.get(i):void 0;return o?t.call(this,r,o,...a):t.apply(this,n)}}function Bo(e,t){return function(...n){let r=Ho(e);if(r){if(n.length===0)Vo(e);else{let e=n[0];r.delete(e)}}return t.apply(this,n)}}function Vo(e){let t=new Map;return e[Mo]=t,t}function Ho(e){return e[Mo]}function Uo(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;qo(e,t),r&&Xo(e,r),Zo(e,n),Jo(e,i),Yo(e,a)}function Wo(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;Go(e,`extra`,n),Go(e,`tags`,r),Go(e,`attributes`,i),Go(e,`user`,a),Go(e,`contexts`,o),e.sdkProcessingMetadata=Jn(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 Go(e,t,n){e[t]=Jn(e[t],n,1)}function Ko(e,t){let n=Tr().getScopeData();return e&&Wo(n,e.getScopeData()),t&&Wo(n,t.getScopeData()),n}function qo(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 Jo(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Yo(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Xo(e,t){e.contexts={trace:Ii(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ba(t),...e.sdkProcessingMetadata};let n=L(na(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Zo(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 Qo(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 $o=`aws.dynamodb.attribute_definitions`,es=`aws.dynamodb.consistent_read`,ts=`aws.dynamodb.consumed_capacity`,ns=`aws.dynamodb.count`,rs=`aws.dynamodb.exclusive_start_table`,is=`aws.dynamodb.global_secondary_indexes`,as=`aws.dynamodb.global_secondary_index_updates`,os=`aws.dynamodb.index_name`,ss=`aws.dynamodb.item_collection_metrics`,cs=`aws.dynamodb.limit`,ls=`aws.dynamodb.local_secondary_indexes`,us=`aws.dynamodb.projection`,ds=`aws.dynamodb.provisioned_read_capacity`,fs=`aws.dynamodb.provisioned_write_capacity`,ps=`aws.dynamodb.scanned_count`,ms=`aws.dynamodb.scan_forward`,hs=`aws.dynamodb.segment`,gs=`aws.dynamodb.select`,_s=`aws.dynamodb.table_count`,vs=`aws.dynamodb.table_names`,ys=`aws.dynamodb.total_segments`,bs=`aws.kinesis.stream.name`,xs=`aws.request.extended_id`,Ss=`aws.request.id`,Cs=`aws.s3.bucket`,ws=`aws.secretsmanager.secret.arn`,Ts=`aws.sns.topic.arn`,Es=`aws.step_functions.activity.arn`,Ds=`aws.step_functions.state_machine.arn`,Os=`cache.key`,ks=`cloud.region`,As=`code.function.name`,js=`db.collection.name`,Ms=`db.name`,Ns=`db.namespace`,Ps=`db.operation`,Fs=`db.operation.batch.size`,Is=`db.operation.name`,Ls=`db.query.text`,Rs=`db.statement`,zs=`db.system`,Bs=`db.system.name`,Vs=`db.user`,Hs=`error.type`,Us=`faas.execution`,Ws=`faas.invoked_name`,Gs=`faas.invoked_provider`,Ks=`faas.invoked_region`,qs=`faas.name`,Js=`faas.trigger`,Ys=`gen_ai.embeddings.input`,Xs=`gen_ai.function_id`,Zs=`gen_ai.input.messages`,Qs=`gen_ai.operation.name`,$s=`gen_ai.output.messages`,ec=`gen_ai.request.available_tools`,tc=`gen_ai.request.max_tokens`,nc=`gen_ai.request.model`,rc=`gen_ai.request.stop_sequences`,ic=`gen_ai.request.temperature`,ac=`gen_ai.request.top_p`,oc=`gen_ai.response.finish_reasons`,sc=`gen_ai.response.id`,cc=`gen_ai.response.model`,lc=`gen_ai.response.streaming`,uc=`gen_ai.system`,dc=`gen_ai.tool.input`,fc=`gen_ai.tool.name`,pc=`gen_ai.tool.output`,mc=`gen_ai.tool.type`,hc=`gen_ai.usage.input_tokens`,gc=`gen_ai.usage.output_tokens`,_c=`gen_ai.usage.total_tokens`,vc=`graphql.document`,yc=`graphql.operation.name`,bc=`graphql.operation.type`,xc=`http.client_ip`,Sc=`http.flavor`,Cc=`http.host`,wc=`http.method`,Tc=`http.request.method`,Ec=`http.response.status_code`,Dc=`http.route`,Oc=`http.scheme`,kc=`http.status_code`,Ac=`http.target`,jc=`http.url`,Mc=`http.user_agent`,Nc=`koa.name`,Pc=`koa.type`,Fc=`messaging.batch.message_count`,Ic=`messaging.destination`,Lc=`messaging.destination.name`,Rc=`messaging.message.id`,zc=`messaging.operation.name`,Bc=`messaging.operation.type`,Vc=`messaging.system`,Hc=`network.peer.address`,Uc=`network.peer.port`,Wc=`network.protocol.name`,Gc=`network.protocol.version`,Kc=`net.host.ip`,qc=`net.host.name`,Jc=`net.host.port`,Yc=`net.peer.ip`,Xc=`net.peer.name`,Zc=`net.peer.port`,Qc=`net.transport`,$c=`rpc.grpc.status_code`,el=`rpc.method`,tl=`rpc.service`,nl=`rpc.system`,rl=`sentry.graphql.operation`,il=`sentry.http.prefetch`,al=`sentry.origin`,ol=`sentry.sdk.name`,sl=`sentry.sdk.version`,cl=`sentry.segment.id`,ll=`sentry.segment.name`,ul=`sentry.trace_lifecycle`,dl=`server.address`,fl=`server.port`,pl=`service.name`,ml=`service.version`,hl=`url.full`,gl=`url.path`,_l=`url.query`,vl=`url.scheme`,yl=`user_agent.original`;function bl(e,t){let n=Ui(e),r=ra(e),i=Ui(r),{isolationScope:a,scope:o}=ni(e),s=Ko(a,o);wl(n,i,t,s);let c=e.kind;t.emit(`preprocessSpan`,n,{spanKind:c}),n.is_segment&&(xl(n,s),Cl(n,t),t.emit(`processSegmentSpan`,n)),t.emit(`processSpan`,n);let{beforeSendSpan:l}=t.getOptions(),u=l&&Ca(l)?Tl(n,l):n,d=u.attributes?.[kr];return n.is_segment&&d&&Sl(u,{"sentry.segment.name.source":d}),{...Gi(u),_segmentSpan:r}}function xl(e,t){Sl(e,Qo(t.contexts))}function Sl(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}function Cl(e,t){let n=t.getIntegrationNames();n.length&&Sl(e,{[Fr]:n})}function wl(e,t,n,r){let i=n.getSdkMetadata(),{release:a,environment:o}=n.getOptions();Sl(e,{[ul]:`stream`,[ll]:t.name,[cl]:t.span_id,[ol]:i?.sdk?.name,[sl]:i?.sdk?.version,[Nr]:a,[Pr]:o||`production`,[Ir]:r.user?.id,[Lr]:r.user?.email,[Rr]:r.user?.ip_address,[zr]:r.user?.username,...r.attributes})}function Tl(e,t){return t(e)||(ia(),e)}var El=0,Dl=1,Ol=2;function kl(e){return new jl(t=>{t(e)})}function Al(e){return new jl((t,n)=>{n(e)})}var jl=class e{constructor(e){this._state=El,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===El)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===Dl&&e[1](this._value),this._state===Ol&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===El){if(Gt(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(Dl,e)},r=e=>{t(Ol,e)};try{e(n,r)}catch(e){r(e)}}};function Ml(e,t,n,r=0){try{let i=Nl(t,n,e,r);return Gt(i)?i:kl(i)}catch(e){return Al(e)}}function Nl(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return D&&a===null&&A.log(`Event processor "${i.id||`?`}" dropped event`),Gt(a)?a.then(e=>Nl(e,t,n,r+1)):Nl(a,t,n,r+1)}var Pl,Fl,Il,Ll;function Rl(e){let t=O._sentryDebugIds,n=O._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Ll&&r.length===Fl&&i.length===Il)return Ll;Fl=r.length,Il=i.length,Ll={},Pl||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Pl?.[r];if(i&&Ll&&t)Ll[i[0]]=t,Pl&&(Pl[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&&Ll&&Pl){Ll[i]=t,Pl[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Ll}function zl(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||kn(),timestamp:t.timestamp||Bn()},l=n.integrations||e.integrations.map(e=>e.name);Bl(c,e),Ul(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Vl(c,e.stackParser);let u=Gl(r,n.captureContext);n.mechanism&&Nn(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Ko(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Uo(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?kl(c):Ml(m,c,n)).then(e=>(e&&Hl(e),typeof o==`number`&&o>0?Wl(e,o,s):e))}function Bl(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=xn(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=xn(e.value,a)})}function Vl(e,t){let n=Rl(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Hl(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 Ul(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Wl(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:fn(e.data,t,n)}}))},...e.user&&{user:fn(e.user,t,n)},...e.contexts&&{contexts:fn(e.contexts,t,n)},...e.extra&&{extra:fn(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=fn(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:fn(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=fn(e.contexts.flags,3,n)),r}function Gl(e,t){if(!t)return e;let n=e?e.clone():new rr;return n.update(t),n}function Kl(e){if(e)return ql(e)||Yl(e)?{captureContext:e}:e}function ql(e){return e instanceof rr||typeof e==`function`}var Jl=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Yl(e){return Object.keys(e).some(e=>Jl.includes(e))}function H(e,t){return M().captureException(e,Kl(t))}function Xl(e,t){let n=typeof t==`string`?t:void 0,r=typeof t==`string`?void 0:{captureContext:t};return M().captureMessage(e,n,r)}function Zl(e,t){return M().captureEvent(e,t)}function Ql(e,t){N().setContext(e,t)}function $l(e){N().setExtras(e)}function eu(e,t){N().setExtra(e,t)}function tu(e){N().setTags(e)}function nu(e,t){N().setTag(e,t)}function ru(e){N().setAttributes(e)}function iu(e,t){N().setAttribute(e,t)}function au(e){N().setUser(e)}function ou(e){N().setConversationId(e)}function su(){return N().lastEventId()}function cu(e,t){let n=M(),r=P();if(!r)D&&A.warn(`Cannot capture check-in. No client defined.`);else if(!r.captureCheckIn)D&&A.warn(`Cannot capture check-in. Client does not support sending check-ins.`);else return r.captureCheckIn(e,t,n);return kn()}function lu(e,t,n){function r(){let r=cu({monitorSlug:e,status:`in_progress`},n),i=Un();function a(t){cu({monitorSlug:e,status:t,checkInId:r,duration:Un()-i})}let o;try{o=t()}catch(e){throw a(`error`),e}return Gt(o)?o.then(e=>(a(`ok`),e),e=>{throw a(`error`),e}):(a(`ok`),o)}return Dr(()=>n?.isolateTrace?fo(r):r())}async function uu(e){let t=P();return t?t.flush(e):(D&&A.warn(`Cannot flush events. No client defined.`),Promise.resolve(!1))}async function du(e){let t=P();return t?t.close(e):(D&&A.warn(`Cannot flush events and disable SDK. No client defined.`),Promise.resolve(!1))}function fu(){return!!P()}function pu(){let e=P();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function mu(e){N().addEventProcessor(e)}function hu(e){let t=N(),{user:n}=Ko(t,M()),{userAgent:r}=O.navigator||{},i=Wn({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&Gn(a,{status:`exited`}),gu(),t.setSession(i),i}function gu(){let e=N(),t=M().getSession()||e.getSession();t&&Kn(t),_u(),e.setSession()}function _u(){let e=N(),t=P(),n=e.getSession();n&&t&&t.captureSession(n)}function vu(e=!1){if(e){gu();return}_u()}function yu(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}function U(e,t=1){if(_r(it()).getTracingChannelBinding?.()){e();return}t&&yu(setTimeout(()=>{U(e,t-1)},1))}function bu(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function xu(e){return`${bu(e)}${e.projectId}/envelope/`}function Su(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 Cu(e,t,n){return t||`${xu(e)}?${Su(e,n)}`}var wu=[];function Tu(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 Eu(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 Tu(r)}function Du(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&ku(e,t,n)}),n}function Ou(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function ku(e,t,n){if(n[t.name]){D&&A.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!wu.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),wu.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))}),D&&A.log(`Integration installed: ${t.name}`)}function Au(e){let t=P();if(!t){D&&A.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function W(e){return e}function ju(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 Mu=`sentry.timestamp.sequence`,Nu=0,Pu;function Fu(e){let t=Math.floor(e*1e3);Pu!==void 0&&t!==Pu&&(Nu=0);let n=Nu;return Nu++,Pu=t,{key:Mu,value:{value:n,type:`integer`}}}function Iu(e,t){return t?Er(t,()=>{let n=R(),r=n?Ii(n):Or(t);return[n?ba(n):ya(e,t),r]}):[void 0,void 0]}var Lu={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function Ru(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function zu(){return!Ru()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function Bu(){return typeof window<`u`&&(!zu()||Vu())}function Vu(){return O.process?.type===`renderer`}function Hu(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...Bu()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Uu(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=yi(r)),wa(a,[Hu(e,i)])}var Wu=100;function Gu(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function Ku(e,t){let n=Xu(),r=Yu(e);r===void 0?n.set(e,[t]):r.length>=Wu?(Ju(e,r),n.set(e,[t])):n.set(e,[...r,t])}function qu(e,t=M(),n=Ku){let r=t?.getClient()??P();if(!r){D&&A.warn(`No client available to capture log.`);return}let{release:i,environment:a,enableLogs:o=!0,beforeSendLog:s}=r.getOptions();if(!o){D&&A.warn(`logging option not enabled, log will not be captured.`);return}let[,c]=Iu(r,t),l={...e.attributes},{user:{id:u,email:d,username:f},attributes:p={}}=Ko(N(),t);Gu(l,`user.id`,u,!1),Gu(l,`user.email`,d,!1),Gu(l,`user.name`,f,!1),Gu(l,`sentry.release`,i),Gu(l,`sentry.environment`,a);let{name:m,version:h}=r.getSdkMetadata()?.sdk??{};Gu(l,`sentry.sdk.name`,m),Gu(l,`sentry.sdk.version`,h);let g=r.getIntegrationByName(`Replay`),_=g?.getReplayId(!0);Gu(l,`sentry.replay_id`,_),_&&g?.getRecordingMode()===`buffer`&&Gu(l,`sentry._internal.replay_is_buffering`,!0);let v=e.message;if(Bt(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})}Gu(l,`sentry.trace.parent_span_id`,tr(t)?.spanContext().spanId);let y={...e,attributes:l};r.emit(`beforeCaptureLog`,y);let ee=s?ut(()=>s(y)):y;if(!ee){r.recordDroppedEvent(`before_send`,`log_item`,1),D&&A.warn(`beforeSendLog returned null, log will not be captured.`);return}let{level:b,message:te,attributes:x={},severityNumber:ne}=ee,re=Un(),ie=Fu(re);n(r,{timestamp:re,level:b,body:Qu(String(te)),trace_id:c?.trace_id,severity_number:ne??Lu[b],attributes:Zu({...br(p),...br(x,!0),[ie.key]:ie.value})}),r.emit(`afterCaptureLog`,ee)}function Ju(e,t){let n=t??Yu(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Uu(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Xu().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Yu(e){return Xu().get(e)}function Xu(){return ot(`clientToLogBufferMap`,()=>new WeakMap)}function Zu(e){let t={};for(let[n,r]of Object.entries(e)){let e=Qu(n);t[e]=r.type===`string`?{...r,value:Qu(r.value)}:r}return t}function Qu(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 $u(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,...Bu()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function ed(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=yi(r)),wa(a,[$u(e,i)])}var td=1e3;function nd(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function rd(e,t){let n=ld(),r=cd(e);r===void 0?n.set(e,[t]):r.length>=td?(sd(e,r),n.set(e,[t])):n.set(e,[...r,t])}function id(e,t,n){let{release:r,environment:i}=t.getOptions(),a={...e.attributes};nd(a,`user.id`,n.id,!1),nd(a,`user.email`,n.email,!1),nd(a,`user.name`,n.username,!1),nd(a,`sentry.release`,r),nd(a,`sentry.environment`,i);let{name:o,version:s}=t.getSdkMetadata()?.sdk??{};nd(a,`sentry.sdk.name`,o),nd(a,`sentry.sdk.version`,s);let c=t.getIntegrationByName(`Replay`),l=c?.getReplayId(!0);return nd(a,`sentry.replay_id`,l),l&&c?.getRecordingMode()===`buffer`&&nd(a,`sentry._internal.replay_is_buffering`,!0),{...e,attributes:a}}function ad(e,t,n,r){let[,i]=Iu(t,n),a=tr(n),o=a?a.spanContext().traceId:i?.trace_id,s=a?a.spanContext().spanId:void 0,c=Un(),l=Fu(c);return{timestamp:c,trace_id:o??``,span_id:s,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...br(r),...br(e.attributes,`skip-undefined`),[l.key]:l.value}}}function od(e,t){let n=t?.scope??M(),r=t?.captureSerializedMetric??rd,i=n?.getClient()??P();if(!i){D&&A.warn(`No client available to capture metric.`);return}let{_experiments:a,enableMetrics:o,beforeSendMetric:s}=i.getOptions();if(!(o??a?.enableMetrics??!0)){D&&A.warn(`metrics option not enabled, metric will not be captured.`);return}let{user:c,attributes:l}=Ko(N(),n),u=id(e,i,c);i.emit(`processMetric`,u);let d=s||a?.beforeSendMetric,f=d?d(u):u;if(!f){D&&A.log("`beforeSendMetric` returned `null`, will not send metric.");return}let p=ad(f,i,n,l);D&&A.log(`[Metric]`,p),r(i,p),i.emit(`afterCaptureMetric`,f)}function sd(e,t){let n=t??cd(e)??[];if(n.length===0)return;let r=e.getOptions(),i=ed(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);ld().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function cd(e){return ld().get(e)}function ld(){return ot(`clientToMetricBufferMap`,()=>new WeakMap)}function ud(e){return Gi({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 dd(e,t){if(e.type!==`transaction`||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||Ja(t))return;let n=[],r=[];for(let t of e.spans)t.op?.startsWith(`gen_ai.`)?n.push(ud(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,...Bu()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var fd=Symbol.for(`SentryBufferFullError`);function pd(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Al(fd);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return kl(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>yu(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var md=6e4;function hd(e,t=an()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?md:r-t}function gd(e,t){return e[t]||e.all||0}function _d(e,t,n=an()){return gd(e,t)>n}function vd(e,{statusCode:t,headers:n},r=an()){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+hd(o,r):t===429&&(i.all=r+6e4);return i}function yd(e,t,n=pd(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Ea(i,(t,n)=>{let i=Fa(n);_d(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=wa(i[0],a),s=t=>{if(Da(o,[`client_report`])){D&&A.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Ea(o,(n,r)=>{e.recordDroppedEvent(t,Fa(r))})};return n.add(()=>t({body:ka(o)}).then(e=>e.statusCode===413?(D&&A.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(D&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&A.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=vd(r,e),e),e=>{throw s(`network_error`),D&&A.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===fd)return D&&A.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function bd(e,t,n){let r=[{type:`client_report`},{timestamp:n||Bn(),discarded_events:e}];return wa(t?{dsn:t}:{},[r])}function xd(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 Sd(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?.[Vr],exclusive_time:o?.[Hr],measurements:e.measurements,is_segment:!0}}function Cd(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 wd=`[Filtered]`,Td=[`forwarded`,`-ip`,`remote-`,`via`,`-user`],Ed=[`auth`,`token`,`secret`,`session`,`password`,`passwd`,`pwd`,`key`,`jwt`,`bearer`,`sso`,`saml`,`csrf`,`xsrf`,`credentials`,`sid`,`identity`,`set-cookie`,`cookie`],Dd=[`.sid`,`sessid`,`remember`,`oidc`,`pkce`,`nonce`,`__secure-`,`__host-`,`awsalb`,`awselb`,`akamai`,`__stripe`,`cognito`,`firebase`,`supabase`,`sb-`,`mfa`,`2fa`];function Od(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:Td},httpHeaders:{request:{deny:Td},response:{deny:Td}},httpBodies:[],urlQueryParams:{deny:Td},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var kd={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 Ad(e){let t=e.dataCollection==null?Od(e.sendDefaultPii):kd,n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:n.httpHeaders?.request??t.httpHeaders.request,response:n.httpHeaders?.response??t.httpHeaders.response},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 jd=`Not capturing exception because it's already been captured.`,Md=`Discarded session because of missing or non-string release`,Nd=Symbol.for(`SentryInternalError`),Pd=Symbol.for(`SentryDoNotSendEventError`),Fd=5e3;function Id(e){return{message:e,[Nd]:!0}}function Ld(e){return{message:e,[Pd]:!0}}function Rd(e){return j(e)&&Nd in e}function zd(e){return j(e)&&Pd in e}function Bd(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??Fd;t>0&&(s=!0,o=yu(setTimeout(()=>{i(e)},t)))}}),e.on(`flush`,()=>{i(e)})}var Vd=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=pd(e.transportOptions?.bufferSize??64),this._dataCollection=Ad(e),e.dsn?this._dsn=Ti(e.dsn):D&&A.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Cu(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&&Bd(this,`afterCaptureLog`,`flushLogs`,Jd,Ju),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Bd(this,`afterCaptureMetric`,`flushMetrics`,qd,sd)}captureException(e,t,n){let r=kn();if(Ln(e))return D&&A.log(jd),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:kn(),...n},a=Bt(e)?e:String(e),o=Vt(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=kn();if(t?.originalException&&Ln(t.originalException))return D&&A.log(jd),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Hd(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),Gn(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),ku(this,e,this._integrations),t||Ou(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=dd(e,this),r=Ba(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])r=Ta(r,Ma(e));n&&(r=Ta(r,n)),this.sendEnvelope(r).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=ha}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){D&&A.warn(Md);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){D&&A.warn(Md);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=za(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}`;D&&A.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 D&&A.error(`Error while sending envelope:`,e),{}}return D&&A.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Du(this,e),Ou(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)&&(Gn(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),zl(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...Or(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ya(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=M(),r=N()){return D&&Gd(e)&&A.log(`Captured error event \`${xd(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{D&&(zd(e)?A.log(e.message):Rd(e)?A.warn(e.message):A.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Kd(e),s=Gd(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Ei(a),u=Hd(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Ld("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:Ud(Wd(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 Ld(`${c} returned \`null\`, will not send event.`)}let d=n.getSession()||r.getSession();if(s&&d&&this._updateSessionFromEvent(d,i),s&&typeof l==`number`&&rn()>l)throw this.recordDroppedEvent(`sample_rate`,`error`),Ld(`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 zd(e)||Rd(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Id(`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===fd&&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(){D&&A.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){D&&A.log(`No outcomes to send`);return}if(!this._dsn){D&&A.log(`No dsn provided, will not send outcomes`);return}D&&A.log(`Sending outcomes:`,e);let t=bd(e,this._options.tunnel&&yi(this._dsn));this.sendEnvelope(t)}};function Hd(e){return e===`replay_event`?`replay`:e||`error`}function Ud(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Gt(e))return e.then(e=>{if(!Ht(e)&&e!==null)throw Id(n);return e},e=>{throw Id(`${t} rejected with ${e}`)});if(!Ht(e)&&e!==null)throw Id(n);return e}function Wd(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!Ca(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(Gd(c)&&i)return i(c,r);if(Kd(c)){if(s||o){let t=Sd(c);if(o?.length&&ca({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){let e=s(t);e?c=Jn(n,Cd(e)):ia()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&ca({description:e.description,op:e.op,attributes:e.data},o)){ua(n,e);continue}if(s){let n=s(e);n?t.push(n):(ia(),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 Gd(e){return e.type===void 0}function Kd(e){return e.type===`transaction`}function qd(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Yd(e.attributes)}function Jd(e){let t=0;return e.message&&(t+=e.message.length*2),t+Yd(e.attributes)}function Yd(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Xd(e[0]):Vt(e)?t+=Xd(e):t+=100}),t}function Xd(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function Zd(e){M().setClient(e)}var Qd=new Set;function $d(e){e.forEach(e=>{Qd.add(e),D&&A.log(`AI provider "${e}" wrapping will be skipped`)})}function ef(e){return Qd.has(e)}function tf(){Qd.clear(),D&&A.log(`Cleared AI provider skip registrations`)}function nf(e,t){return t.some(t=>e.includes(t))}function rf(e,t,n){if(t===!1)return{};let r=n==null?Ed:[...Ed,...n],i={};if(t===!0){for(let t of Object.keys(e))i[t]=nf(t.toLowerCase(),r)?wd:e[t];return i}if(`deny`in t){let n=t.deny.map(e=>e.toLowerCase());for(let t of Object.keys(e)){let a=t.toLowerCase();i[t]=nf(a,r)||n.some(e=>a.includes(e))?wd:e[t]}return i}let a=t.allow.map(e=>e.toLowerCase());for(let t of Object.keys(e)){let n=t.toLowerCase();i[t]=nf(n,r)?wd:a.some(e=>n.includes(e))?e[t]:wd}return i}function af(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}var of=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),sf=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function cf(e,t){let n=String(e).toLowerCase();return of.has(n)?!1:sf.has(n)?!0:t?.strict?null:!!e}function lf(e,t,n,r,i){let a={sent_at:new Date(an()).toISOString()};return n?.sdk&&(a.sdk={name:n.sdk.name,version:n.sdk.version}),r&&i&&(a.dsn=yi(i)),t&&(a.trace=t),wa(a,[uf(e)])}function uf(e){return[{type:`check_in`},e]}var df=`thismessage:/`;function ff(e){return`isRelative`in e}function pf(e,t){let n=e.indexOf(`://`)<=0&&e.indexOf(`//`)!==0,r=t??(n?df: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 mf(e){if(ff(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 hf(e,t,n,r){return`${n?.method?.toUpperCase()??`GET`} ${r||(e?t===`client`?mf(e):e.pathname:`/`)}`}function gf(e,t,n,r,i){let a={[I]:n,[kr]:`url`};return i&&(a[t===`server`?`http.route`:`url.template`]=i,a[kr]=`route`),r?.method&&(a[Kr]=r.method.toUpperCase()),e&&(e.search&&(a[`url.query`]=e.search),e.hash&&(a[`url.fragment`]=e.hash),e.pathname&&(a[`url.path`]=e.pathname,e.pathname===`/`&&(a[kr]=`route`)),ff(e)||(a[hl]=e.href,e.port&&(a[`url.port`]=e.port),e.protocol&&(a[`url.scheme`]=e.protocol),e.hostname&&(a[t===`server`?`server.address`:`url.domain`]=e.hostname))),[hf(e,t,r,i),a]}function _f(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 vf(e){return e.split(/[?#]/,1)[0]}function yf(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function bf(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 xf(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 Sf=xf;function Cf(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:k})),i.version=k)}function wf(e={}){let t=e.client||P();if(!pu()||!t)return{};let n=_r(it());if(n.getTraceData)return n.getTraceData(e);let r=e.scope||M(),i=e.span||R(),a=ma(i)&&!oa(t.getOptions());if(!i&&wr())return{};let o=i&&!a?Li(i):Tf(r),s=di(i?ba(i):ya(t,r));if(!Di.test(o))return A.warn(`Invalid sentry-trace data. Cannot generate trace data`),{};let c={"sentry-trace":o,baggage:s};return e.propagateTraceparent&&(c.traceparent=i&&!a?Ri(i):Ef(r)),c}function Tf(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ai(t,r,n)}function Ef(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ji(t,r,n)}var Df=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Of(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return D&&!r&&A.log(Df,e),r;let i=Tn(e,t);return n?.set(e,i),D&&!i&&A.log(Df,e),i}function kf(e){return Object.entries(e||wf()).map(([e,t])=>`<meta name="${e}" content="${t}"/>`).join(``)}function Af(e){return Array.from(new Set(e))}var jf=1048576;function Mf(e){return e===`small`?1e3:e===`medium`?1e4:jf}function Nf(e){let t={};try{e.forEach((e,n)=>{typeof e==`string`&&(t[n]=e)})}catch{}return t}function Pf(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 Ff(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=If({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Bf(i),headers:Pf(t),cookies:s,data:o}}function If({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function Lf(e,t=!1,n=`request`){let r=typeof t==`boolean`?Od(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=rf(zf(r,e===`set-cookie`),a,Dd);for(let[n,r]of Object.entries(t))s[`${o}${Rf(e)}.${Rf(n)}`]=r}else s[`${o}${Rf(e)}`]=wd}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=rf(t,i);for(let[t,n]of Object.entries(e))s[`${o}${Rf(t)}`]=n}}catch{}return s}function Rf(e){return e.replace(/-/g,`_`)}function zf(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 Bf(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}var G={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},Vf={[G.INTERNAL]:`INTERNAL`,[G.SERVER]:`SERVER`,[G.CLIENT]:`CLIENT`,[G.PRODUCER]:`PRODUCER`,[G.CONSUMER]:`CONSUMER`};function Hf(e){return Vf[e]}var Uf=100;function Wf(e,t){let n=P(),r=N();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=Uf}=n.getOptions();if(a<=0)return;let o={timestamp:Bn(),...e},s=i?ut(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}var Gf=`FunctionToString`,Kf=new WeakMap,qf=W((()=>({name:Gf,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Zt(this),r;try{Kf.has(P())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){Kf.set(e,!0)}}))),Jf=[/^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$/],Yf=`EventFilters`,Xf=W((e={})=>{let t;return{name:Yf,setup(n){t=Qf(e,n.getOptions())},processEvent(n,r,i){return t||=Qf(e,i.getOptions()),$f(n,t)?null:n}}}),Zf=W(((e={})=>({...Xf(e),name:`InboundFilters`})));function Qf(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Jf],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function $f(e,t){if(!e.type){if(ep(e,t.ignoreErrors))return D&&A.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
11
+ Event: ${jn(e)}`),!0;if(op(e))return D&&A.warn(`Event dropped due to not having an error message, error type or stacktrace.
12
+ Event: ${jn(e)}`),!0;if(np(e,t.denyUrls))return D&&A.warn(`Event dropped due to being matched by \`denyUrls\` option.
13
+ Event: ${jn(e)}.
14
+ Url: ${ap(e)}`),!0;if(!rp(e,t.allowUrls))return D&&A.warn(`Event dropped due to not being matched by \`allowUrls\` option.
15
+ Event: ${jn(e)}.
16
+ Url: ${ap(e)}`),!0}else if(e.type===`transaction`&&tp(e,t.ignoreTransactions))return D&&A.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
17
+ Event: ${jn(e)}`),!0;return!1}function ep(e,t){return t?.length?xd(e).some(e=>Tn(e,t)):!1}function tp(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Tn(n,t):!1}function np(e,t){if(!t?.length)return!1;let n=ap(e);return n?Tn(n,t):!1}function rp(e,t){if(!t?.length)return!0;let n=ap(e);return!n||Tn(n,t)}function ip(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 ap(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?ip(t):null}catch{return D&&A.error(`Cannot extract url for event ${jn(e)}`),null}}function op(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function sp(e,t,n,r,i,a){if(!i.exception?.values||!a||!It(a.originalException))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=cp(e,t,r,a.originalException,n,i.exception.values,o,0))}function cp(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(It(r[i])){up(o,s,r);let a=e(t,r[i]),l=c.length;dp(a,i,l,s),c=cp(e,t,n,r[i],i,[a,...c],a,l)}return lp(r)&&r.errors.forEach((a,l)=>{if(It(a)){up(o,s,r);let u=e(t,a),d=c.length;dp(u,`errors[${l}]`,d,s),c=cp(e,t,n,a,i,[u,...c],u,d)}}),c}function lp(e){return Array.isArray(e.errors)}function up(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...lp(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function dp(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}function fp(e,t){return e(t.stack||``,1)}function pp(e){return It(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function mp(e){return pp(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function hp(e,t){let n={type:t.name||t.constructor.name,value:mp(t)},r=fp(e,t);return r.length&&(n.stacktrace={frames:r}),n}function gp(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(It(n))return n}}function _p(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=en(e);if(Rt(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let n=vp(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function vp(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function yp(e,t,n,r){if(It(n))return[n,void 0];if(t.synthetic=!0,Ht(n)){let t=e?.getOptions().normalizeDepth,i={__serialized__:pn(n,t)},a=gp(n);if(a)return[a,i];let o=_p(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 bp(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=yp(e,i,n,r),s={exception:{values:[hp(t,a)]}};return o&&(s.extra=o),Mn(s,void 0,void 0),Nn(s,i),{...s,event_id:r?.event_id}}function xp(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=fp(e,r.syntheticException);n.length&&(a.exception={values:[{value:t,stacktrace:{frames:n}}]},Nn(a,{synthetic:!0}))}if(Bt(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 Sp=`cause`,Cp=5,wp=`LinkedErrors`,Tp=W(((e={})=>{let t=e.limit||Cp,n=e.key||Sp;return{name:wp,preprocessEvent(e,r,i){sp(hp,i.getOptions().stackParser,n,t,e,r)}}})),Ep=[`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 Dp(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Ep.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Op(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&kp(e))||null}function Op(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}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]{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 Ap=`RequestData`,jp=W(((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}}};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:Ap,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,{include:s}=t(r);return a&&Mp(e,a,{ipAddress:o},s),e},processSegmentSpan(e,n){let{sdkProcessingMetadata:r={}}=N().getScopeData(),{normalizedRequest:i,ipAddress:a}=r;if(!i)return;let{include:o,dataCollection:s}=t(n);Np(e,i,a,o,s)}}}));function Mp(e,t,n,r){if(e.request={...e.request,...Pp(t,r)},r.ip){let r=t.headers&&Dp(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Np(e,t,n,r,i){let a=Pp(t,r),o={};if(a.url&&(o[hl]=a.url),a.method&&(o[`http.request.method`]=a.method),a.query_string&&(o[_l]=Fp(a.query_string)),Sl(e,o),a.cookies&&Object.keys(a.cookies).length>0&&Sl(e,Lf({cookie:Object.entries(a.cookies).map(([e,t])=>`${e}=${t}`).join(`; `)},i,`request`)),a.headers&&Sl(e,Lf(a.headers,i,`request`)),a.data!=null){let t=typeof a.data==`string`?a.data:JSON.stringify(a.data);t&&Sl(e,{"http.request.body.data":t})}if(r.ip){let r=t.headers&&Dp(t.headers)||n||void 0;r&&Sl(e,{[Rr]:r})}}function Pp(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let e=new Set(Ep.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?af(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Fp(e){return typeof e==`string`?e||void 0:(Array.isArray(e)?e:Object.entries(e)).map(([e,t])=>`${e}=${t}`).join(`&`)||void 0}var Ip=new Set([]);function Lp(e){let t=`console`,n=Mt(t,e);return Nt(t,Bp),n}function Rp(e){for(let t of e)Ip.add(t);return()=>{for(let t of e)Ip.delete(t)}}var zp=new Set;function Bp(){`console`in O&&st.forEach(function(e){!zp.has(e)&&e in O.console&&(zp.add(e),qt(O.console,e,function(t){return lt[e]=t,function(...t){let n=t[0],r=lt[e],i=Ip.size&&typeof n==`string`&&Tn(n,Ip);i||Pt(`console`,{args:t,level:e}),(!i||D&&A.isEnabled())&&r?.apply(O.console,t)}}))})}function Vp(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var Hp=`CaptureConsole`,Up=W(((e={})=>{let t=e.levels||st,n=e.handled??!0;return{name:Hp,setup(e){`console`in O&&Lp(({args:r,level:i})=>{P()===e&&t.includes(i)&&Wp(r,i,n)})}}}));function Wp(e,t,n){let r=Vp(t),i=Error(),a={level:Vp(t),extra:{arguments:e}};Er(o=>{if(o.addEventProcessor(e=>(e.logger=`console`,Nn(e,{handled:n,type:`auto.core.capture_console`}),e)),t===`assert`){if(!e[0]){let t=`Assertion failed: ${Cn(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){H(s,a);return}let c=Cn(e,` `);o.captureMessage(c,r,{captureContext:a,syntheticException:i})})}var Gp=`Dedupe`,Kp=W((()=>{let e;return{name:Gp,processEvent(t){if(t.type)return t;try{if(qp(t,e))return D&&A.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function qp(e,t){return t?!!(Jp(e,t)||Yp(e,t)):!1}function Jp(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Zp(e,t)||!Xp(e,t))}function Yp(e,t){let n=Qp(t),r=Qp(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Zp(e,t)||!Xp(e,t))}function Xp(e,t){let n=Ot(e),r=Ot(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 Zp(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 Qp(e){return e.exception?.values?.[0]}var $p=`ExtraErrorData`,em=W(((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:$p,processEvent(e,r,i){let{maxValueLength:a}=i.getOptions();return tm(e,r,t,n,a)}}}));function tm(e,t={},n,r,i){if(!t.originalException||!It(t.originalException))return e;let a=t.originalException.name||t.originalException.constructor.name,o=nm(t.originalException,r,i);if(o){let t={...e.contexts},r=fn(o,n);return Ht(r)&&(cn(r),t[a]=r),{...e,contexts:t}}return e}function nm(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]=It(a)||typeof a==`string`?n?xn(`${a}`,n):`${a}`:a}if(t&&e.cause!==void 0&&(i.cause=It(e.cause)?{[e.cause.name||e.cause.constructor.name]:nm(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]=It(n)?n.toString():n}}return i}catch(e){D&&A.error(`Unable to extract extra data from the Error object:`,e)}return null}function rm(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 im=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function am(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=im.exec(t);return n?n.slice(1):[]}function om(...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=rm(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`}function sm(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 cm(e,t){e=om(e).slice(1),t=om(t).slice(1);let n=sm(e.split(`/`)),r=sm(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 lm(e){let t=am(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}function um(e,t){let n=am(e)[2]||``;return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var dm=`RewriteFrames`,fm=W((e={})=>{let t=e.root,n=e.prefix||`app:///`,r=`window`in O&&!!O.window,i=e.iteratee||pm({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:dm,processEvent(e){let t=e;return e.exception&&Array.isArray(e.exception.values)&&(t=a(t)),t}}});function pm({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?cm(t,e):um(e)}`}return r}}var mm=[`reauthenticate`,`signInAnonymously`,`signInWithOAuth`,`signInWithIdToken`,`signInWithOtp`,`signInWithPassword`,`signInWithSSO`,`signOut`,`signUp`,`verifyOtp`],hm=[`createUser`,`deleteUser`,`listUsers`,`getUserById`,`updateUserById`,`inviteUserByEmail`],gm={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`},_m=[`select`,`insert`,`upsert`,`update`,`delete`];function vm(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function ym(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function bm(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function xm(e,t){return bm(e,t)!==void 0}function Sm(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 Cm(e,t={}){switch(e){case`GET`:return`select`;case`POST`:return Sm(t,`Prefer`)?.includes(`resolution=`)?`upsert`:`insert`;case`PATCH`:return`update`;case`DELETE`:return`delete`;default:return`<unknown-op>`}}function wm(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&&gm[n]||`filter`,`${i}(${e}, ${r.join(`.`)})`}function Tm(e,t=!1){return new Proxy(e,{apply(n,r,i){return z({name:`auth ${t?`(admin) `:``}${e.name}`,attributes:{[I]:`auto.db.supabase`,[F]:`db`,"db.system":`postgresql`,"db.operation":`auth.${t?`admin.`:``}${e.name}`}},e=>Reflect.apply(n,r,i).then(t=>(j(t)&&`error`in t&&t.error?(e.setStatus({code:2}),H(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(),H(t,{mechanism:{handled:!1,type:`auto.db.supabase.auth`}}),t}).then(...i))}})}function Em(e){let t=e.auth;if(t&&!ym(e.auth)){for(let n of mm){let r=t[n];r&&typeof e.auth[n]==`function`&&(e.auth[n]=Tm(r))}for(let n of hm){let r=t.admin[n];r&&typeof e.auth.admin[n]==`function`&&(e.auth.admin[n]=Tm(r,!0))}vm(e.auth)}}function Dm(e,t){ym(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 km(a,t),i}}),vm(e.prototype.from))}function Om(e,t){ym(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(e,n,r){let i=_m,a=n,o=Cm(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(wm(e,t));let u=Object.create(null);if(Ht(a.body))for(let[e,t]of Object.entries(a.body))u[e]=t;let d=P(),f=t.sendOperationData??d?.getDataCollectionOptions().databaseQueryData===!0,p=bm(a.body,u),m=o===`select`?``:`${o}${xm(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":Sm(a.headers,`X-Client-Info`),"db.system":`postgresql`,"db.operation":o,[I]:`auto.db.supabase`,[F]:`db`};return l.length&&f&&(v[`db.query`]=l),p!==void 0&&f&&(v[`db.body`]=p),z({name:_,attributes:v},t=>Reflect.apply(e,n,[]).then(e=>{if(t&&(e&&typeof e==`object`&&`status`in e&&Yr(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),H(t,e=>(e.addEventProcessor(e=>(Nn(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),Wf(n),e},e=>{throw t&&(Yr(t,500),t.end()),e}).then(...r))}}),vm(e.prototype.then))}function km(e,t){for(let n of _m)ym(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 D&&A.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),Om(o,t),a}}),vm(e.prototype[n]))}var Am=(e,t={})=>{if(!e){D&&A.warn(`Supabase integration was not installed because no Supabase client was provided.`);return}Dm(e.constructor===Function?e:e.constructor,t),Em(e)},jm=`Supabase`,Mm=((e,t)=>({setupOnce(){Am(e,t)},name:jm})),Nm=W(e=>Mm(e.supabaseClient,{sendOperationData:e.sendOperationData})),Pm=10,Fm=`ZodErrors`;function Im(e){return It(e)&&e.name===`ZodError`&&Array.isArray(e.issues)}function Lm(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 Rm(e){return e.map(e=>typeof e==`number`?`<array>`:e).join(`.`)}function zm(e){let t=new Set;for(let n of e.issues){let e=Rm(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: ${xn(n.join(`, `),100)}`}function Bm(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!Im(r.originalException)||r.originalException.issues.length===0)return n;try{let i=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(Lm);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:zm(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 Vm=W(((e={})=>{let t=e.limit??Pm;return{name:Fm,processEvent(n,r){return Bm(t,e.saveZodIssuesAsAttachment,n,r)}}})),Hm=`Console`,Um=W((e={})=>{let t=new Set(e.levels||st);return{name:Hm,setup(n){let r=Lp(({args:e,level:r})=>{P()===n&&t.has(r)&&Wm(r,e)});if(n.registerCleanup(r),e.filter){let t=Rp(e.filter);n.registerCleanup(t)}}}});function Wm(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Vp(e),message:Gm(t)};if(e===`assert`){if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${Gm(e)}`:`Assertion failed`,n.data.arguments=e}else return}Wf(n,{input:t,level:e})}function Gm(e){return`util`in O&&typeof O.util.format==`function`?O.util.format(...e):Cn(e,` `)}var Km=`flag.evaluation.`;function qm(e){if(e.type)return e;let t=M().getScopeData().contexts.flags,n=t?t.values:[];return n.length?(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...n]},e):e}function Jm(e,t,n=100){let r=M().getScopeData().contexts;r.flags||={values:[]};let i=r.flags.values;Ym(i,e,t,n)}function Ym(e,t,n,r){if(typeof n!=`boolean`)return;if(e.length>r){D&&A.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 Xm(e,t,n=10){if(typeof t!=`boolean`)return;let r=R();if(!r)return;let i=L(r).data;if(`${Km}${e}`in i){r.setAttribute(`${Km}${e}`,t);return}Object.keys(i).filter(e=>e.startsWith(Km)).length<n&&r.setAttribute(`${Km}${e}`,t)}var Zm=W(()=>({name:`FeatureFlags`,processEvent(e,t,n){return qm(e)},addFeatureFlag(e,t){Jm(e,t),Xm(e,t)}})),Qm=W(({growthbookClass:e})=>({name:`GrowthBook`,setupOnce(){let t=e.prototype;typeof t.isOn==`function`&&qt(t,`isOn`,$m),typeof t.getFeatureValue==`function`&&qt(t,`getFeatureValue`,$m)},processEvent(e,t,n){return qm(e)}}));function $m(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n==`string`&&typeof r==`boolean`&&(Jm(n,r),Xm(n,r)),r}}var eh=`ConversationId`,th=W((()=>({name:eh,setup(e){e.on(`spanStart`,e=>{let t=M().getScopeData(),n=N().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=L(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(qr,r)}})}})));function nh(e){return!!e&&e._profiler!==void 0&&typeof e._profiler.start==`function`&&typeof e._profiler.stop==`function`}function rh(){let e=P();if(!e){D&&A.warn(`No Sentry client available, profiling is not started`);return}let t=e.getIntegrationByName(`ProfilingIntegration`);if(!t){D&&A.warn(`ProfilingIntegration is not available`);return}if(!nh(t)){D&&A.warn(`Profiler is not available on profiling integration.`);return}t._profiler.start()}function ih(){let e=P();if(!e){D&&A.warn(`No Sentry client available, profiling is not started`);return}let t=e.getIntegrationByName(`ProfilingIntegration`);if(!t){D&&A.warn(`ProfilingIntegration is not available`);return}if(!nh(t)){D&&A.warn(`Profiler is not available on profiling integration.`);return}t._profiler.stop()}var ah={startProfiler:rh,stopProfiler:ih};function oh(e,t={},n=M()){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()||P();return d&&d.emit(`beforeSendFeedback`,u,t),n.captureEvent(u,t)}function sh(e,t,n){return`util`in O&&typeof O.util.format==`function`?O.util.format(...e):ch(e,t,n)}function ch(e,t,n){return e.map(e=>Vt(e)?String(e):JSON.stringify(fn(e,t,n))).join(` `)}function lh(e){return/%[sdifocO]/.test(e)}function uh(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 dh=`ConsoleLogs`,fh={[I]:`auto.log.console`},ph=W(((e={})=>{let t=e.levels||st;return{name:dh,setup(e){let{enableLogs:n,normalizeDepth:r=3,normalizeMaxBreadth:i=1e3}=e.getOptions();if(!n){D&&A.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let a=Lp(({args:n,level:a})=>{if(P()!==e||!t.includes(a))return;let o=n[0],s=n.slice(1);if(a===`assert`){o||qu({level:`error`,message:s.length>0?`Assertion failed: ${sh(s,r,i)}`:`Assertion failed`,attributes:fh});return}let c=a===`log`,l={...fh};if(Ht(o)){Object.assign(l,fn(o,r,i));let e=typeof n[1]==`string`?2:1;n.slice(e).forEach((e,t)=>{l[`sentry.message.parameter.${t}`]=fn(e,r,i)})}else if(s.length>0&&typeof o==`string`&&!lh(o)){let e=uh(o,s);for(let[t,n]of Object.entries(e))l[t]=t.startsWith(`sentry.message.parameter.`)?fn(n,r,i):n}qu({level:c?`info`:a,message:sh(n,r,i),severityNumber:c?10:void 0,attributes:l})});e.registerCleanup(a)}}})),mh=f({count:()=>gh,distribution:()=>vh,gauge:()=>_h});function hh(e,t,n,r){od({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function gh(e,t=1,n){hh(`counter`,e,t,n)}function _h(e,t,n){hh(`gauge`,e,t,n)}function vh(e,t,n){hh(`distribution`,e,t,n)}var yh=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function bh(e={}){let t=new Set(e.levels??yh),n=e.client;return{log(e){let{type:r,level:i,message:a,args:o,tag:s,date:c,...l}=e,u=n||P();if(!u)return;let d=Ch(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]=fn(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=Th(wh(o,f,p),f,p);h?.attributes&&Object.assign(m,h.attributes),qu({level:d,message:h?.message||a||o&&sh(o,f,p)||``,attributes:m})}}}var xh={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`},Sh={0:`fatal`,1:`warn`,2:`info`,3:`info`,4:`debug`,5:`trace`};function Ch(e,t){if(e===`verbose`)return`debug`;if(e===`silent`)return`trace`;if(e){let t=xh[e];if(t)return t}if(typeof t==`number`){let e=Sh[t];if(e)return e}return`info`}function wh(e,t,n){if(!e?.length)return{message:``};let r=sh(e,t,n),i=e[0];if(Ht(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`&&!lh(i);return{message:r,messageTemplate:n?i:void 0,messageParameters:n?t:void 0}}}function Th(e,t,n){let{message:r,attributes:i,messageTemplate:a,messageParameters:o}=e,s={};if(a&&o){let e=uh(a,o);for(let[r,i]of Object.entries(e))s[r]=r.startsWith(`sentry.message.parameter.`)?fn(i,t,n):i}else o&&o.length>0&&o.forEach((e,r)=>{s[`sentry.message.parameter.${r}`]=fn(e,t,n)});return{message:r,attributes:{...fn(i,t,n),...s}}}var Eh=`gen_ai.prompt`,Dh=`gen_ai.system`,Oh=`gen_ai.request.model`,kh=`gen_ai.request.stream`,Ah=`gen_ai.request.temperature`,jh=`gen_ai.request.max_tokens`,Mh=`gen_ai.request.frequency_penalty`,Nh=`gen_ai.request.presence_penalty`,Ph=`gen_ai.request.top_p`,Fh=`gen_ai.request.top_k`,Ih=`gen_ai.request.encoding_format`,Lh=`gen_ai.request.dimensions`,Rh=`gen_ai.response.finish_reasons`,zh=`gen_ai.response.model`,Bh=`gen_ai.response.id`,Vh=`gen_ai.response.stop_reason`,Hh=`gen_ai.usage.input_tokens`,Uh=`gen_ai.usage.output_tokens`,Wh=`gen_ai.usage.total_tokens`,Gh=`gen_ai.operation.name`,Kh=`sentry.sdk_meta.gen_ai.input.messages.original_length`,qh=`gen_ai.input.messages`,Jh=`gen_ai.output.messages`,Yh=`gen_ai.system_instructions`,Xh=`gen_ai.response.text`,Zh=`gen_ai.request.available_tools`,Qh=`gen_ai.response.streaming`,$h=`gen_ai.response.tool_calls`,eg=`gen_ai.agent.name`,tg=`gen_ai.pipeline.name`,ng=`gen_ai.conversation.id`,rg=`gen_ai.usage.cache_creation_input_tokens`,ig=`gen_ai.usage.cache_read_input_tokens`,ag=`gen_ai.usage.input_tokens.cache_write`,og=`gen_ai.usage.input_tokens.cached`,sg=`gen_ai.invoke_agent`,cg=`gen_ai.embeddings.input`,lg=`gen_ai.embeddings`,ug=`gen_ai.execute_tool`,dg=`gen_ai.tool.name`,fg=`gen_ai.tool.call.id`,pg=`gen_ai.tool.type`,mg=`gen_ai.tool.input`,hg=`gen_ai.tool.output`,gg=`gen_ai.tool.description`;function _g(e){return!e||typeof e!=`object`?!1:bg(e)||xg(e)||vg(e)||Sg(e)||Cg(e)||wg(e)||Tg(e)||Eg(e)||Dg(e)||Og(e)||kg(e)||Ag(e)}function vg(e){return`image_url`in e?typeof e.image_url==`string`?e.image_url.startsWith(`data:`):yg(e):!1}function yg(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 bg(e){return`type`in e&&typeof e.type==`string`&&`source`in e&&_g(e.source)}function xg(e){return`inlineData`in e&&!!e.inlineData&&typeof e.inlineData==`object`&&`data`in e.inlineData&&typeof e.inlineData.data==`string`}function Sg(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 Cg(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 wg(e){return`media_type`in e&&typeof e.media_type==`string`&&`data`in e}function Tg(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 Eg(e){return`type`in e&&e.type===`image`&&`image`in e&&typeof e.image==`string`&&!e.image.startsWith(`http://`)&&!e.image.startsWith(`https://`)}function Dg(e){return`type`in e&&(e.type===`blob`||e.type===`base64`)}function Og(e){return`b64_json`in e}function kg(e){return`type`in e&&`result`in e&&e.type===`image_generation`}function Ag(e){return`uri`in e&&typeof e.uri==`string`&&e.uri.startsWith(`data:`)}var jg=`[Blob substitute]`,Mg=[`image_url`,`data`,`content`,`b64_json`,`result`,`uri`,`image`];function Ng(e){let t={...e};_g(t.source)&&(t.source=Ng(t.source)),xg(e)&&(t.inlineData={...e.inlineData,data:jg}),yg(e)&&(t.image_url={...e.image_url,url:jg}),Sg(e)&&(t.input_audio={...e.input_audio,data:jg}),Cg(e)&&(t.file={...e.file,file_data:jg});for(let e of Mg)typeof t[e]==`string`&&(t[e]=jg);return t}var Pg=2e4,Fg=e=>new TextEncoder().encode(e).length,Ig=e=>Fg(JSON.stringify(e));function Lg(e,t){if(Fg(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);Fg(o)<=t?(i=o,n=a+1):r=a-1}return i}function Rg(e){return typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``}function zg(e,t){return typeof e==`string`?t:{...e,text:t}}function Bg(e){return typeof e==`object`&&!!e&&`content`in e&&typeof e.content==`string`}function Vg(e){return typeof e==`object`&&!!e&&`content`in e&&Array.isArray(e.content)}function Hg(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)&&e.parts.length>0}function Ug(e,t){let n=t-Ig({...e,content:``});if(n<=0)return[];let r=Lg(e.content,n);return[{...e,content:r}]}function Wg(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 Gg(e,t){let{key:n,items:r}=Wg(e);if(n===null||r.length===0)return[];let i=r.map(e=>zg(e,``)),a=t-Ig({...e,[n]:i});if(a<=0)return[];let o=[];for(let e of r){let t=Rg(e),n=Fg(t);if(n<=a)o.push(e),a-=n;else if(o.length===0){let n=Lg(t,a);n&&o.push(zg(e,n));break}else break}return o.length<=0?[]:[{...e,[n]:o}]}function Kg(e,t){if(!e)return[];if(typeof e==`string`){let n=Lg(e,t);return n?[n]:[]}return typeof e==`object`?Bg(e)?Ug(e,t):Vg(e)||Hg(e)?Gg(e,t):[]:[]}function qg(e){return e.map(e=>{let t;return e&&typeof e==`object`&&(Vg(e)?t={...e,content:qg(e.content)}:`content`in e&&_g(e.content)&&(t={...e,content:Ng(e.content)}),Hg(e)&&(t={...t??e,parts:qg(e.parts)}),_g(t)?t=Ng(t):_g(e)&&(t=Ng(e))),t??e})}function Jg(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=qg([r]),a=i[0];return Ig(a)<=n?i:Kg(a,n)}function Yg(e){return Jg(e,Pg)}function Xg(e){return Lg(e,Pg)}function Zg(e){let t=P()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function Qg(e){if(e!==void 0)return e;let t=P();return!t||!Ja(t)&&t.getOptions().streamGenAiSpans===!1}function $g(e,t){return e?`${e}.${t}`:t}function e_(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[Hh]:t}),n!==void 0&&e.setAttributes({[Uh]: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({[Wh]:a})}}function t_(e,t,n){if(!e.isRecording())return;let r={[Qh]:!0};t.responseId&&(r[Bh]=t.responseId),t.responseModel&&(r[zh]=t.responseModel),t.promptTokens!==void 0&&(r[Hh]=t.promptTokens),t.completionTokens!==void 0&&(r[Uh]=t.completionTokens),t.totalTokens===void 0?(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Wh]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)):r[Wh]=t.totalTokens,t.finishReasons.length&&(r[Rh]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[Xh]=t.responseTexts.join(``)),n&&t.toolCalls.length&&(r[$h]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function n_(e){if(typeof e==`string`)return Xg(e);try{return JSON.stringify(Array.isArray(e)?Yg(e):e)}catch{return`[unserializable]`}}function r_(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 i_(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r==`object`&&`data`in r?{...r,data:n}:n}function a_(e,t){return Gt(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 i_(i.call(e),t)}:typeof i==`function`?i.bind(r):i}}):t}var o_=`WorkersAI`,s_=new Map,c_=new Map,l_=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`]]),u_=`operation.name`,d_=`ai.operationId`,f_=`ai.prompt`,p_=`ai.schema`,m_=`ai.response.object`,h_=`ai.values`,g_=`ai.response.text`,__=`ai.response.toolCalls`,v_=`ai.response.finishReason`,y_=`ai.prompt.messages`,b_=`ai.prompt.tools`,x_=`ai.model.id`,S_=`ai.response.providerMetadata`,C_=`ai.usage.cachedInputTokens`,w_=`ai.telemetry.functionId`,T_=`ai.usage.completionTokens`,E_=`ai.usage.promptTokens`,D_=`ai.usage.tokens`,O_=`ai.toolCall.name`,k_=`ai.toolCall.id`,A_=`ai.toolCall.args`,j_=`ai.toolCall.result`;function M_(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[Hh],i=e.data[Uh];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 N_(e,t){let n=t.get(e.span_id);n&&e.data&&(n.inputTokens>0&&(e.data[Hh]=n.inputTokens),n.outputTokens>0&&(e.data[Uh]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data[`gen_ai.usage.total_tokens`]=n.inputTokens+n.outputTokens))}function P_(e){let t=new Map;for(let n of e){let e=n.data[Zh];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 F_(e,t){let n=P_(e);for(let r of e){if(r.op===`gen_ai.execute_tool`){let e=r.data[dg];if(typeof e==`string`){let t=n.get(e);t&&(r.data[gg]=t)}}r.op===`gen_ai.invoke_agent`&&N_(r,t)}}function I_(e){return s_.get(e)}function L_(e){s_.delete(e)}function R_(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 z_(e){return e.filter(e=>!!e&&typeof e==`object`&&`role`in e&&`content`in e)}function B_(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(...z_(e)),i;if(Array.isArray(n))return i.push(...z_(n)),i;if(typeof n==`string`&&i.push({role:`user`,content:n}),i.length>0)return i}}catch{}return[]}function V_(e,t,n){if(typeof t[`ai.prompt`]==`string`&&!t[`gen_ai.input.messages`]&&!t[`ai.prompt.messages`]){let r=t[f_],i=B_(r);if(i.length){let{systemInstructions:t,filteredMessages:r}=r_(i);t&&e.setAttribute(Yh,t);let a=Array.isArray(r)?r.length:0,o=n?n_(r):bn(r);e.setAttributes({[f_]:o,[qh]:o,[Kh]:a})}}else if(typeof t[`ai.prompt.messages`]==`string`){let r=t[y_];try{let t=JSON.parse(r);if(Array.isArray(t)){let{systemInstructions:i,filteredMessages:a}=r_(t);i&&e.setAttribute(Yh,i);let o=Array.isArray(a)?a.length:0,s=!n&&a===t?r:n?n_(a):bn(a);e.setAttributes({[y_]:s,[qh]:s,[Kh]:o})}}catch{}}}function H_(e){let{data:t,description:n}=L(e);if(!n)return;if(t[`ai.toolCall.name`]&&t[`ai.toolCall.id`]&&n===`ai.toolCall`){X_(e,t);return}if(!t[`ai.operationId`]&&!n.startsWith(`ai.`))return;l_.get(n)===`generate_content`&&$d([o_]);let r=P()?.getIntegrationByName(`VercelAI`);Z_(e,n,t,Qg(r?.options?.enableTruncation))}function U_(e){if(e.type===`transaction`&&e.spans){let t=new Map;for(let n of e.spans)q_(n),M_(n,t);F_(e.spans,t);let n=e.contexts?.trace;n?.op===`gen_ai.invoke_agent`&&N_(n,t)}return e}function W_(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 G_(e){let t=e[g_],n=e[__],r=e[v_];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[__]}}catch{}if(i.length>0){let t={role:`assistant`,parts:i,finish_reason:W_(r)};e[Jh]=JSON.stringify([t]),delete e[g_]}}function K_(e){if(Y_(e,T_,Uh),Y_(e,E_,Hh),Y_(e,C_,og),Y_(e,`ai.usage.inputTokens`,Hh),Y_(e,`ai.usage.outputTokens`,Uh),Y_(e,D_,Hh),Y_(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[Hh]=e[Hh]+e[og]),typeof e[`gen_ai.usage.input_tokens`]==`number`&&(e[Wh]=(typeof e[`gen_ai.usage.output_tokens`]==`number`?e[Uh]:0)+e[Hh]),e[`ai.prompt.tools`]&&Array.isArray(e[`ai.prompt.tools`])&&(e[b_]=R_(e[b_])),e[`operation.name`]){let t=e[`ai.operationId`]?e[d_]:e[u_];e[Gh]=l_.get(t)??t,delete e[u_]}if(Y_(e,y_,qh),G_(e),Y_(e,m_,`gen_ai.response.object`),Y_(e,b_,`gen_ai.request.available_tools`),Y_(e,A_,mg),Y_(e,j_,hg),Y_(e,p_,`gen_ai.request.schema`),Y_(e,x_,Oh),Array.isArray(e[`ai.values`])){let t=e[h_].map(e=>{try{return JSON.parse(e)}catch{return e}});e[cg]=t.length===1?t[0]:JSON.stringify(t)}ev(e);for(let t of Object.keys(e))Array.isArray(e[t])&&(e[t]=JSON.stringify(e[t])),t.startsWith(`ai.`)&&Y_(e,t,`vercel.${t}`)}function q_(e){let{data:t,origin:n}=e;n===`auto.vercelai.otel`&&(e.status&&e.status!==`ok`&&(e.status=`internal_error`),K_(t))}function J_(e){let t=e.attributes;if(t?.[`sentry.origin`]===`auto.vercelai.otel`){if(K_(t),t[`sentry.op`]===`gen_ai.execute_tool`&&e.parent_span_id){let n=c_.get(e.parent_span_id);if(n){let e=t[dg];if(typeof e==`string`){let r=n.get(e);r&&(t[gg]=r)}}}c_.delete(e.span_id)}}function Y_(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function X_(e,t){e.setAttribute(I,`auto.vercelai.otel`),e.setAttribute(F,`gen_ai.execute_tool`),e.setAttribute(Gh,`execute_tool`),Y_(t,O_,dg),Y_(t,k_,fg);let n=t[fg];typeof n==`string`&&s_.set(n,e.spanContext()),t[`gen_ai.tool.type`]||e.setAttribute(pg,`function`);let r=t[dg];r&&e.updateName(`execute_tool ${r}`)}function Z_(e,t,n,r){e.setAttribute(I,`auto.vercelai.otel`);let i=t.replace(`ai.`,``);e.setAttribute(`ai.pipeline.name`,i),e.updateName(i);let a=n[w_];a&&typeof a==`string`&&e.setAttribute(`gen_ai.function_id`,a),V_(e,n,r),n[`ai.model.id`]&&!n[`gen_ai.response.model`]&&e.setAttribute(zh,n[x_]),e.setAttribute(`ai.streaming`,t.includes(`stream`));let o=l_.get(t);if(o?e.setAttribute(F,`gen_ai.${o}`):t.startsWith(`ai.stream`)&&e.setAttribute(F,`ai.run`),o===`invoke_agent`){a&&typeof a==`string`?e.updateName(`invoke_agent ${a}`):e.updateName(`invoke_agent`);return}let s=n[x_];s&&o&&e.updateName(`${o} ${s}`);let c=P();if(c&&Ja(c)&&n[`ai.prompt.tools`]&&Array.isArray(n[`ai.prompt.tools`])){let t=new Map;for(let e of n[b_])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=L(e).parent_span_id;n&&c_.set(n,t)}}}function Q_(e){e.on(`spanStart`,H_),e.addEventProcessor(Object.assign(U_,{id:`VercelAiEventProcessor`})),e.on(`processSpan`,e=>{J_(e)})}function $_(e){let t={};if(!e||typeof e!=`object`)return t;let n=e,r=n.openai??n.azure;return r&&(tv(t,og,r.cachedPromptTokens),tv(t,`gen_ai.usage.output_tokens.reasoning`,r.reasoningTokens),tv(t,`gen_ai.usage.output_tokens.prediction_accepted`,r.acceptedPredictionTokens),tv(t,`gen_ai.usage.output_tokens.prediction_rejected`,r.rejectedPredictionTokens),tv(t,ng,r.responseId)),n.anthropic&&(tv(t,og,n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens),tv(t,ag,n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens)),n.bedrock?.usage&&(tv(t,og,n.bedrock.usage.cacheReadInputTokens),tv(t,ag,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(tv(t,og,n.deepseek.promptCacheHitTokens),tv(t,`gen_ai.usage.input_tokens.cache_miss`,n.deepseek.promptCacheMissTokens)),t}function ev(e){let t=e[S_];if(t)try{let n=$_(JSON.parse(t));for(let[t,r]of Object.entries(n))t===`gen_ai.conversation.id`&&e[t]||(e[t]=r)}catch{}}function tv(e,t,n){n!=null&&(e[t]=n)}var nv=`OpenAI`,rv={"responses.create":{operation:`chat`},"chat.completions.create":{operation:`chat`},"embeddings.create":{operation:`embeddings`},"conversations.create":{operation:`chat`}},iv=[`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 av(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&e.type.startsWith(`response.`)}function ov(e){return typeof e==`object`&&!!e&&`object`in e&&e.object===`chat.completion.chunk`}function sv(e,t,n){if(!t||typeof t!=`object`)return;let r=t,i={};if(typeof r.id==`string`&&(i[Bh]=r.id),typeof r.model==`string`&&(i[zh]=r.model),r.object===`conversation`&&typeof r.id==`string`&&(i[ng]=r.id),r.usage&&typeof r.usage==`object`){let e=r.usage,t=e.prompt_tokens??e.input_tokens;typeof t==`number`&&(i[Hh]=t);let n=e.completion_tokens??e.output_tokens;typeof n==`number`&&(i[Uh]=n),typeof e.total_tokens==`number`&&(i[Wh]=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[Rh]=JSON.stringify(t)),n){let t=e.map(e=>e.message?.content||``);i[Xh]=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[$h]=JSON.stringify(n))}}if(typeof r.status==`string`&&(i[`gen_ai.response.finish_reasons`]||(i[Rh]=JSON.stringify([r.status]))),n&&(typeof r.output_text==`string`&&!i[`gen_ai.response.text`]&&(i[Xh]=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[$h]=JSON.stringify(e))}e.setAttributes(i)}function cv(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 lv(e){let t={[Oh]:e.model??`unknown`};`temperature`in e&&(t[Ah]=e.temperature),`top_p`in e&&(t[Ph]=e.top_p),`frequency_penalty`in e&&(t[Mh]=e.frequency_penalty),`presence_penalty`in e&&(t[Nh]=e.presence_penalty),`stream`in e&&(t[kh]=e.stream),`encoding_format`in e&&(t[Ih]=e.encoding_format),`dimensions`in e&&(t[Lh]=e.dimensions);let n=cv(e);return n&&(t[ng]=n),t}function uv(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 dv(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&&uv(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function fv(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`}),H(e,{mechanism:{handled:!1,type:`auto.ai.openai.stream-response`}});return}if(!(`type`in e))return;let i=e;if(!iv.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*pv(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)ov(i)?dv(i,r,n):av(i)&&fv(i,r,n,t),yield i}finally{let e=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];t_(t,{...r,toolCalls:e},n)}}function mv(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){D&&A.error(`Failed to serialize OpenAI tools:`,e);return}}function hv(e,t){let n={[Dh]:`openai`,[Gh]:t,[I]:`auto.ai.openai`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0],r=mv(t);r&&(n[Zh]=r),Object.assign(n,lv(t))}else n[Oh]=`unknown`;return n}function gv(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(cg,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}=r_(i);a&&e.setAttribute(Yh,a),e.setAttribute(qh,r?n_(o):bn(o)),Array.isArray(o)?e.setAttribute(Kh,o.length):e.setAttribute(Kh,1)}function _v(e,t,n,r,i){return function(...t){let a=n.operation||`unknown`,o=hv(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=ao(u,o=>(n=e.apply(r,t),i.recordInputs&&c&&gv(o,c,a,Qg(i.enableTruncation)),(async()=>{try{return pv(await n,o,i.recordOutputs??!1)}catch(e){throw o.setStatus({code:2,message:`internal_error`}),o.end(),e}})()));return a_(n,o)}let d,f=z(u,n=>(d=e.apply(r,t),i.recordInputs&&c&&gv(n,c,a,Qg(i.enableTruncation)),d.then(e=>(sv(n,e,i.recordOutputs),e))));return a_(d,f)}}function vv(e,t=``,n){return new Proxy(e,{get(e,r){let i=e[r],a=$g(t,String(r)),o=rv[a];return typeof i==`function`&&o?_v(i,a,o,e,n):typeof i==`function`?i.bind(e):i&&typeof i==`object`?vv(i,a,n):i}})}function yv(e,t){return vv(e,``,Zg(t))}var bv=`Anthropic_AI`,xv={"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 Sv(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=r_(t);r&&e.setAttributes({[Yh]:r});let a=Array.isArray(i)?i.length:1;e.setAttributes({[qh]:n?n_(i):bn(i),[Kh]:a})}var Cv={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 wv(e){return e&&Cv[e]||`internal_error`}function Tv(e,t){t.error&&(e.setStatus({code:2,message:wv(t.error.type)}),H(t.error,{mechanism:{handled:!1,type:`auto.ai.anthropic.anthropic_error`}}))}function Ev(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 Dv(e,t){return`type`in e&&typeof e.type==`string`&&e.type===`error`&&(t.setStatus({code:2,message:wv(e.error?.type)}),!0)}function Ov(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 kv(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 Av(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 jv(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 Mv(e,t,n,r){e&&typeof e==`object`&&(Dv(e,r)||(Ov(e,t),kv(e,t),Av(e,t,n),jv(e,t)))}async function*Nv(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)Mv(i,r,n,t),yield i}finally{t_(t,r,n)}}function Pv(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=>{Mv(e,r,n,t)}),e.on(`message`,()=>{t_(t,r,n)}),e.on(`error`,e=>{H(e,{mechanism:{handled:!1,type:`auto.ai.anthropic.stream_error`}}),t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end())}),e}var Fv=!1,Iv=new WeakSet;function Lv(e,t,n){let r={[Dh]:`anthropic`,[Gh]:n,[I]:`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[Zh]=JSON.stringify(t.tools)),r[Oh]=t.model??`unknown`,`temperature`in t&&(r[Ah]=t.temperature),`top_p`in t&&(r[Ph]=t.top_p),`stream`in t&&(r[kh]=t.stream),`top_k`in t&&(r[Fh]=t.top_k),`frequency_penalty`in t&&(r[Mh]=t.frequency_penalty),`max_tokens`in t&&(r[jh]=t.max_tokens)}else r[Oh]=t===`models.retrieve`||t===`models.get`?e[0]:`unknown`;return r}function Rv(e,t,n){Sv(e,Ev(t),n),`prompt`in t&&e.setAttributes({[Eh]:JSON.stringify(t.prompt)})}function zv(e,t){if(`content`in t&&Array.isArray(t.content)){e.setAttributes({[Xh]: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({[$h]:JSON.stringify(n)})}`completion`in t&&e.setAttributes({[Xh]:t.completion}),`input_tokens`in t&&e.setAttributes({[Xh]:JSON.stringify(t.input_tokens)})}function Bv(e,t){`id`in t&&`model`in t&&(e.setAttributes({[Bh]:t.id,[zh]:t.model}),`usage`in t&&t.usage&&e_(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function Vv(e,t,n){if(t&&typeof t==`object`){if(`type`in t&&t.type===`error`){Tv(e,t);return}n&&zv(e,t),Bv(e,t)}}function Hv(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end()),e}function Uv(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=ao(u,i=>(r=e.apply(t,n),s.recordInputs&&o&&Rv(i,o,Qg(s.enableTruncation)),(async()=>{try{return Nv(await r,i,s.recordOutputs??!1)}catch(e){return Hv(e,i)}})()));return a_(r,i)}return ao(u,r=>{try{s.recordInputs&&o&&Rv(r,o,Qg(s.enableTruncation)),Fv=!0;let i=e.apply(t,n);return Fv=!1,Pv(i,r,s.recordOutputs??!1)}catch(e){return Fv=!1,Hv(e,r)}})}function Wv(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&&Fv)return e.apply(s,o);let l=n.operation||`unknown`,u=Lv(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 Uv(e,s,o,u,l,t,f,i,p,c);let m,h=z({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},t=>(m=e.apply(s,o),i.recordInputs&&f&&Rv(t,f,Qg(i.enableTruncation)),m.then(e=>(Vv(t,e,i.recordOutputs),e))));return a_(m,h)}})}function Gv(e,t){for(let n of Object.keys(xv)){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(Iv.has(o))continue;let s=Wv(o,n,xv[n],a,t);Iv.add(s),a[i]=s}return e}function Kv(e,t){return Gv(e,Zg(t))}var qv=`Google_GenAI`,Jv={"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}},Yv=`google_genai`;function Xv(e,t){let n=e?.promptFeedback;if(n?.blockReason){let e=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:`internal_error`}),H(`Content blocked: ${e}`,{mechanism:{handled:!1,type:`auto.ai.google_genai`}}),!0}return!1}function Zv(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 Qv(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 $v(e,t,n,r){e&&!Xv(e,r)&&(Zv(e,t),Qv(e,t,n))}async function*ey(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)$v(i,r,n,t),yield i}finally{t_(t,r,n)}}function ty(e,t=`user`){return typeof e==`string`?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(e=>ty(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 ny(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 ry(e){let t={};return`temperature`in e&&typeof e.temperature==`number`&&(t[Ah]=e.temperature),`topP`in e&&typeof e.topP==`number`&&(t[Ph]=e.topP),`topK`in e&&typeof e.topK==`number`&&(t[Fh]=e.topK),`maxOutputTokens`in e&&typeof e.maxOutputTokens==`number`&&(t[jh]=e.maxOutputTokens),`frequencyPenalty`in e&&typeof e.frequencyPenalty==`number`&&(t[Mh]=e.frequencyPenalty),`presencePenalty`in e&&typeof e.presencePenalty==`number`&&(t[Nh]=e.presencePenalty),t}function iy(e,t,n){let r={[Dh]:Yv,[Gh]:e,[I]:`auto.ai.google_genai`};if(t){if(r[Oh]=ny(t,n),`config`in t&&typeof t.config==`object`&&t.config){let e=t.config;if(Object.assign(r,ry(e)),`tools`in e&&Array.isArray(e.tools)){let t=e.tools.flatMap(e=>e.functionDeclarations);r[Zh]=JSON.stringify(t)}}}else r[Oh]=ny({},n);return r}function ay(e,t,n,r){if(n===`embeddings`){let n=t.contents;n!=null&&e.setAttribute(cg,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(...ty(t.config.systemInstruction,`system`)),`history`in t&&i.push(...ty(t.history,`user`)),`contents`in t&&i.push(...ty(t.contents,`user`)),`message`in t&&i.push(...ty(t.message,`user`)),Array.isArray(i)&&i.length){let{systemInstructions:t,filteredMessages:n}=r_(i);t&&e.setAttribute(Yh,t);let a=Array.isArray(n)?n.length:0;e.setAttributes({[Kh]:a,[qh]:r?n_(n):bn(n)})}}function oy(e,t,n){if(t&&typeof t==`object`){if(t.modelVersion&&e.setAttribute(zh,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata==`object`){let n=t.usageMetadata;typeof n.promptTokenCount==`number`&&e.setAttributes({[Hh]:n.promptTokenCount}),typeof n.candidatesTokenCount==`number`&&e.setAttributes({[Uh]:n.candidatesTokenCount}),typeof n.totalTokenCount==`number`&&e.setAttributes({[Wh]: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({[Xh]:n.join(``)})}if(n&&t.functionCalls){let n=t.functionCalls;Array.isArray(n)&&n.length>0&&e.setAttributes({[$h]:JSON.stringify(n)})}}}function sy(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=iy(s,c,r),u=l[`gen_ai.request.model`]??`unknown`;return n.streaming?ao({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},async t=>{try{return i.recordInputs&&c&&ay(t,c,s,Qg(i.enableTruncation)),ey(await e.apply(r,o),t,!!i.recordOutputs)}catch(e){throw t.setStatus({code:2,message:`internal_error`}),t.end(),e}}):z({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},t=>(i.recordInputs&&c&&ay(t,c,s,Qg(i.enableTruncation)),to(()=>e.apply(r,o),()=>{},()=>{},e=>{a||oy(t,e,i.recordOutputs)})))}})}function cy(e,t=``,n){return new Proxy(e,{get:(e,r,i)=>{let a=Reflect.get(e,r,i),o=$g(t,String(r)),s=Jv[o];if(typeof a==`function`&&s){let t=s.operation?sy(a,o,s,e,n):a.bind(e);return s.proxyResultPath?function(...e){let r=t(...e);return r&&typeof r==`object`?cy(r,s.proxyResultPath,n):r}:t}return typeof a==`function`?a.bind(e):a&&typeof a==`object`?cy(a,o,n):a}})}function ly(e,t){return cy(e,``,Zg(t))}var uy=`LangChain`,dy=`auto.ai.langchain`,fy={human:`user`,ai:`assistant`,assistant:`assistant`,system:`system`,function:`function`,tool:`tool`},py=(e,t,n)=>{n!=null&&(e[t]=n)},my=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function hy(e){if(Array.isArray(e))try{let t=e.map(e=>e&&typeof e==`object`&&_g(e)?Ng(e):e);return JSON.stringify(t)}catch{return String(e)}return bn(e,String)}function gy(e){let t=e.toLowerCase();return fy[t]??t}function _y(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 vy(e){if(e&&!Array.isArray(e))return e.invocation_params}function yy(e){return e.map(e=>{let t=e._getType;if(typeof t==`function`)return{role:gy(t.call(e)),content:hy(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:gy(typeof n==`string`?_y(n):`user`),content:hy(e.kwargs?.content)}}if(e.type)return{role:gy(String(e.type).toLowerCase()),content:hy(e.content)};if(e.role)return{role:gy(String(e.role)),content:hy(e.content)};let n=e.constructor?.name;return n&&n!==`Object`?{role:gy(_y(n)),content:hy(e.content)}:{role:`user`,content:hy(e.content)}})}function by(e,t,n){let r={},i=`kwargs`in e?e.kwargs:void 0;my(r,Ah,t?.temperature??n?.ls_temperature??i?.temperature),my(r,jh,t?.max_tokens??n?.ls_max_tokens??i?.max_tokens),my(r,Ph,t?.top_p??i?.top_p);let a=t?.frequency_penalty;my(r,Mh,a);let o=t?.presence_penalty;return my(r,Nh,o),t&&`stream`in t&&py(r,kh,!!t.stream),r}function xy(e,t,n,r,i){return{[Dh]:bn(e??`langchain`,String),[Gh]:`chat`,[Oh]:bn(t,String),[I]:dy,...by(n,r,i)}}function Sy(e,t,n,r,i,a){let o=a?.ls_provider,s=xy(o,i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){py(s,Kh,t.length);let e=t.map(e=>({role:`user`,content:e}));py(s,qh,r?n_(e):bn(e))}return s}function Cy(e,t,n,r,i,a){let o=xy(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}=r_(yy(t.flat()));e&&py(o,Yh,e),py(o,Kh,Array.isArray(n)?n.length:0),py(o,qh,r?n_(n):bn(n))}return o}function wy(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&&py(t,$h,bn(n,String))}function Ty(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)my(t,Hh,n.promptTokens),my(t,Uh,n.completionTokens),my(t,Wh,n.totalTokens);else if(r){my(t,Hh,r.input_tokens),my(t,Uh,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&&my(t,Wh,i),r.cache_creation_input_tokens!==void 0&&my(t,rg,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&my(t,ig,r.cache_read_input_tokens)}}function Ey(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&&py(n,Rh,bn(r,String)),wy(e.generations,n),t){let t=e.generations.flat().map(e=>e.text??e.message?.content).filter(e=>typeof e==`string`);t.length>0&&py(n,Xh,bn(t,String))}}Ty(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&&py(n,zh,a);let o=r?.id??i?.id;o&&py(n,Bh,o);let s=r?.stop_reason??i?.response_metadata?.finish_reason;return s&&py(n,Vh,bn(s,String)),n}function Dy(e){let t={},n=e?.lc_agent_name;return typeof n==`string`&&(t[eg]=n),t}function Oy(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 ky(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.addHandler==`function`&&typeof t.copy==`function`}function Ay(e){return typeof e==`object`&&e?.name===`SentryCallbackHandler`}function jy(e){return e.some(Ay)}function My(e,t){if(!e)return[t];if(ky(e)){if(jy(e.handlers??[]))return e;let n=e.copy();return n.addHandler(t,!0),n}let n=Array.isArray(e)?e:[e];return jy(n)?e:[...n,t]}function Ny(e={}){let{recordInputs:t,recordOutputs:n}=Zg(e),r=Qg(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=vy(c),f=Sy(e,n,t,r,d,l),p=f[Oh],m=f[Gh];ao({name:`${m} ${p}`,op:`gen_ai.chat`,attributes:{...Dy(l),...f,[F]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleChatModelStart(e,n,a,o,s,c,l,u){let d=vy(c),f=Cy(e,n,t,r,d,l),p=Oy(s);p&&(f[Zh]=p);let m=f[Oh],h=f[Gh];ao({name:`${h} ${m}`,op:`gen_ai.chat`,attributes:{...Dy(l),...f,[F]:`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=Ey(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={[I]:`auto.ai.langchain`,"langchain.chain.name":u};t&&(d[`langchain.chain.inputs`]=JSON.stringify(n)),ao({name:`chain ${u}`,op:`gen_ai.invoke_agent`,attributes:{...d,[F]:`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={...Dy(s),[I]:dy,[Gh]:`execute_tool`,[dg]:l};t&&(u[mg]=n),ao({name:`execute_tool ${l}`,op:`gen_ai.execute_tool`,attributes:{...u,[F]:`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({[hg]: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 Py(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 Fy(e){let t=e??{},n={[I]:dy,[F]:lg,[Gh]:`embeddings`,[Oh]:t.model??`unknown`};return n[Dh]=Py(t),`dimensions`in t&&(n[Lh]=t.dimensions),`encodingFormat`in t&&(n[Ih]=t.encodingFormat),n}function Iy(e,t,n={}){let{recordInputs:r}=Zg(n),i=Fy(e),a=i[`gen_ai.request.model`]||`unknown`;return r&&t!=null&&(i[cg]=typeof t==`string`?t:JSON.stringify(t)),{name:`embeddings ${a}`,op:lg,attributes:i}}function Ly(e,t={}){return new Proxy(e,{apply(e,n,r){return z(Iy(n,r[0],t),()=>Reflect.apply(e,n,r))}})}function Ry(e,t){let n=e;return typeof n.embedQuery==`function`&&(n.embedQuery=Ly(n.embedQuery,t)),typeof n.embedDocuments==`function`&&(n.embedDocuments=Ly(n.embedDocuments,t)),e}var zy=`LangGraph`,By=`auto.ai.langgraph`;function Vy(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 Hy(e){let t=e[0];return typeof t==`object`&&t&&`name`in t&&typeof t.name==`string`?t.name:null}function Uy(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={[I]:By,[F]:ug,[Gh]:`execute_tool`,[dg]:o,[pg]:`function`},c=i[1]?.metadata?.lc_agent_name??n;typeof c==`string`&&(a[eg]=c),s&&(a[gg]=s);let l=i[0];if(typeof l==`object`&&l&&(`id`in l&&typeof l.id==`string`&&(a[fg]=l.id),t.recordInputs)){let e=`args`in l&&typeof l.args==`object`?l.args:l;try{a[mg]=JSON.stringify(e)}catch{}}return z({op:ug,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(hg,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 Wy(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 Gy(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 Ky(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(zh,t.model_name),t.finish_reason&&typeof t.finish_reason==`string`&&e.setAttribute(Rh,[t.finish_reason])}}function qy(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 Jy(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=Wy(a);o&&e.setAttribute($h,JSON.stringify(o));let s=yy(a);e.setAttribute(Xh,JSON.stringify(s));let c=0,l=0,u=0;for(let t of a){let n=Gy(t);c+=n.inputTokens,l+=n.outputTokens,u+=n.totalTokens,Ky(e,t)}c>0&&e.setAttribute(Hh,c),l>0&&e.setAttribute(Uh,l),u>0&&e.setAttribute(Wh,u)}var Yy=!1,Xy=`__sentry_patched__`;function Zy(e){let t={[I]:By,[F]:`gen_ai.create_agent`,[Gh]:`create_agent`};return e&&(t[eg]=e),{op:`gen_ai.create_agent`,name:e?`create_agent ${e}`:`create_agent`,attributes:t}}function Qy(e,t){if(Object.prototype.hasOwnProperty.call(e,Xy))return e;let n=Ny(t),r=new Proxy(e,{apply(e,r,i){return Yy?Reflect.apply(e,r,i):z(Zy(),a=>{try{let o=Reflect.apply(e,r,i),s=i.length>0?i[0]:{};s?.name&&typeof s.name==`string`&&(a.setAttribute(eg,s.name),a.updateName(`create_agent ${s.name}`));let c=o.invoke;return c&&typeof c==`function`&&(o.invoke=$y(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,Xy,{value:!0,enumerable:!1}),r}function $y(e,t,n,r,i,a){return new Proxy(e,{apply(e,o,s){let c=i?.modelName??i?.model;return z({op:`gen_ai.invoke_agent`,name:`invoke_agent`,attributes:{[I]:By,[F]:sg,[Gh]:`invoke_agent`}},async i=>{try{let l=n?.name;l&&typeof l==`string`&&(i.setAttribute(tg,l),i.setAttribute(eg,l),i.updateName(`invoke_agent ${l}`)),c&&i.setAttribute(Oh,c);let u=(s.length>1?s[1]:void 0)?.configurable?.thread_id;if(u&&typeof u==`string`&&i.setAttribute(ng,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=My(e.callbacks,a)}let d=qy(t);d&&i.setAttribute(Zh,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}=r_(yy(m));e&&i.setAttribute(Yh,e);let n=Qg(r.enableTruncation),a=Array.isArray(t)?t.length:0;i.setAttributes({[qh]:n?n_(t):bn(t),[Kh]:a})}let h=await Reflect.apply(e,o,s);return p&&Jy(i,m??null,h),h}catch(e){throw i.setStatus({code:2,message:`internal_error`}),e}})}})}function eb(e,t){if(Object.prototype.hasOwnProperty.call(e,Xy))return e;let n=Zg(t),r=Ny(n),i=new Proxy(e,{apply(e,t,i){let a=Vy(i),o=Hy(i),s=i[0];s&&Array.isArray(s.tools)&&s.tools.length>0&&Uy(s.tools,n,o??void 0),Yy=!0;let c;try{c=Reflect.apply(e,t,i)}finally{Yy=!1}let l=c.invoke;if(l&&typeof l==`function`){let e={};o&&(e.name=o),c.invoke=$y(l.bind(c),c,e,n,a,r)}return c}});return Object.defineProperty(i,Xy,{value:!0,enumerable:!1}),i}function tb(e,t){return e.compile=Qy(e.compile,Zg(t)),e}var nb=tb;function rb(e,t,n){let r=n.getOptions(),i=n.getDsn(),a=r.tunnel,o=Ia(r._metadata),s={sent_at:new Date(an()).toISOString(),...ib(t)&&{trace:t},...o&&{sdk:o},...!!a&&i&&{dsn:yi(i)}},c=n.getDataCollectionOptions().userInfo?`auto`:`never`;return wa(s,[[{type:`span`,item_count:e.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...Bu()&&{ingest_settings:{infer_ip:c,infer_user_agent:c}},items:e}]])}function ib(e){return!!e.trace_id&&!!e.public_key}function ab(e){let t=156;if(t+=e.name.length*2,t+=xr(e.attributes),e.links&&e.links.length>0){let n=e.links[0]?.attributes,r=100+(n?xr(n):0);t+=r*e.links.length}return t}var ob=1e3,sb=5e6,cb=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<=ob?n:ob,this._flushInterval=r&&r>0?r:5e3,this._maxTraceWeight=i&&i>0?i:sb,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:yu(setTimeout(()=>{this.flush(t)},this._flushInterval))},this._traceBuckets.set(t,n)),n.spans.add(e),n.size+=ab(e),(n.spans.size>=this._maxSpanLimit||n.size>=this._maxTraceWeight)&&this.flush(t)}drain(){this._traceBuckets.size&&(D&&A.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){D&&A.warn(`No segment span reference found on span JSON, cannot compute DSC`),this._removeTrace(e);return}let i=ba(r),a=n.map(e=>{let{_segmentSpan:t,...n}=e;return n}),o=rb(a,i,this._client);D&&A.log(`Sending span envelope for trace ${e} with ${a.length} spans`),this._client.sendEnvelope(o).then(null,e=>{D&&A.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)}},lb=W(()=>({name:`SpanStreaming`,setup(e){let t=`SpanStreaming integration requires`,n=`Falling back to static trace lifecycle.`,r=e.getOptions();if(!Ja(e)){r.traceLifecycle=`static`,D&&A.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!Ca(i)){r.traceLifecycle=`static`,D&&A.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let a=new cb(e);e.on(`afterSpanEnd`,t=>{Ji(t)&&a.add(bl(t,e))})}}));function ub(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function db(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 fb=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 pb(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 mb=class extends Vd{constructor(e){pb(e),e.traceLifecycle===`stream`&&!e.integrations.some(e=>e.name===`SpanStreaming`)&&e.integrations.push(lb()),super(e),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(e,t){let n=bp(this,this._options.stackParser,e,t);return n.level=`error`,kl(n)}eventFromMessage(e,t=`info`,n){return kl(xp(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return hb(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&hb(t),super.captureEvent(e,t,n)}captureCheckIn(e,t,n){let r=`checkInId`in e&&e.checkInId?e.checkInId:kn();if(!this._isEnabled())return D&&A.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]=Iu(this,n);l&&(s.contexts={trace:l});let u=lf(s,c,this.getSdkMetadata(),o,this.getDsn());return D&&A.log(`Sending checkin:`,e.monitorSlug,e.status),this.sendEnvelope(u),r}registerCleanup(e){this._disposeCallbacks.push(e)}dispose(){D&&A.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=pd(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 hb(e){let t=N().getScopeData().sdkProcessingMetadata.requestSession;if(t){let n=e?.mechanism?.handled??!0;n&&t.status!==`crashed`?t.status=`errored`:n||(t.status=`crashed`)}}var gb={mechanism:{handled:!1,type:`auto.rpc.trpc.middleware`}};function _b(e){typeof e==`object`&&e&&`ok`in e&&!e.ok&&`error`in e&&H(e.error,gb)}function vb(e={}){return async function(t){let{path:n,type:r,next:i,rawInput:a,getRawInput:o}=t,s=P(),c=s?.getOptions(),l=s?.getDataCollectionOptions(),u={procedure_path:n,procedure_type:r};if(ln(u,1+(c?.normalizeDepth??5)),(e.attachRpcInput===void 0?l?.httpBodies.includes(`incomingRequest`):e.attachRpcInput)&&(a!==void 0&&(u.input=fn(a)),o!==void 0&&typeof o==`function`))try{u.input=fn(await o())}catch{}return Dr(t=>(t.setContext(`trpc`,u),ao({name:`trpc/${n}`,op:`rpc.server`,attributes:{[kr]:`route`,[I]:`auto.rpc.trpc`},forceTransaction:!!e.forceTransaction},async e=>{try{let t=await i();return _b(t),e.end(),t}catch(t){throw H(t,gb),e.end(),t}})))}}function yb(e,t,n){try{if(!P())return;let r=R();r?.isRecording()&&r.setStatus({code:2,message:`internal_error`}),H(e,{mechanism:{type:`auto.ai.mcp_server`,handled:!1,data:{error_type:t||`handler_execution`,...n}}})}catch{}}function bb(e,t){qt(e,t,e=>function(n,...r){let i=r[r.length-1];if(typeof i!=`function`)return e.call(this,n,...r);let a=xb(i,t,n);return e.call(this,n,...r.slice(0,-1),a)})}function xb(e,t,n){return function(...r){try{return Sb.call(this,e,t,n,r)}catch(t){return D&&A.warn(`MCP handler wrapping failed:`,t),e.apply(this,r)}}}function Sb(e,t,n,r){try{let i=e.apply(this,r);return j(i)&&typeof i.then==`function`?Promise.resolve(i).catch(e=>{throw Cb(e,t,n),e}):i}catch(e){throw Cb(e,t,n),e}}function Cb(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`)?yb(e,`validation`,r):e.name===`ServerTimeoutError`||e.message.includes(`timed out`)||e.message.includes(`timeout`)?yb(e,`timeout`,r):yb(e,`tool_execution`,r)):t===`resource`||t===`registerResource`?(r.resource_uri=n,yb(e,`resource_execution`,r)):(t===`prompt`||t===`registerPrompt`)&&(r.prompt_name=n,yb(e,`prompt_execution`,r))}catch{}}function wb(e){typeof e.tool==`function`&&bb(e,`tool`),typeof e.registerTool==`function`&&bb(e,`registerTool`)}function Tb(e){typeof e.resource==`function`&&bb(e,`resource`),typeof e.registerResource==`function`&&bb(e,`registerResource`)}function Eb(e){typeof e.prompt==`function`&&bb(e,`prompt`),typeof e.registerPrompt==`function`&&bb(e,`registerPrompt`)}function Db(e){wb(e),Tb(e),Eb(e)}function Ob(e){let t=e,n=t._registeredTools;if(j(n))for(let[e,t]of Object.entries(n))typeof t.executor==`function`&&(t.executor=xb(t.executor,`registerTool`,e));let r=t._registeredResources;if(j(r))for(let[e,t]of Object.entries(r))typeof t.readCallback==`function`&&(t.readCallback=xb(t.readCallback,`registerResource`,e));let i=t._registeredResourceTemplates;if(j(i))for(let[e,t]of Object.entries(i))typeof t.readCallback==`function`&&(t.readCallback=xb(t.readCallback,`registerResource`,e));let a=t._registeredPrompts;if(j(a))for(let[e,t]of Object.entries(a))typeof t.handler==`function`&&(t.handler=xb(t.handler,`registerPrompt`,e))}var kb=`mcp.method.name`,Ab=`mcp.transport`,jb=`mcp.server.name`,Mb=`mcp.server.title`,Nb=`mcp.server.version`,Pb=`mcp.protocol.version`,Fb=`mcp.tool.name`,Ib=`mcp.resource.uri`,Lb=`mcp.prompt.name`,Rb=`mcp.tool.result.is_error`,zb=`mcp.tool.result.content_count`,Bb=`mcp.prompt.result.description`,Vb=`mcp.prompt.result.message_count`,Hb=`mcp.request.argument`,Ub=`mcp.logging.level`,Wb=`mcp.logging.logger`,Gb=`mcp.logging.data_type`,Kb=`mcp.logging.message`,qb=`network.transport`,Jb=`network.protocol.version`,Yb=`client.address`,Xb=`client.port`,Zb=`mcp.server`,Qb=`mcp.notification.client_to_server`,$b=`mcp.notification.server_to_client`,ex=`auto.function.mcp_server`,tx=`auto.mcp.notification`,nx=`route`;function rx(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&`id`in e}function ix(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&!(`id`in e)}function ax(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`id`in e&&(`result`in e||`error`in e)}function ox(e){return j(e)&&`connect`in e&&(`tool`in e&&`resource`in e&&`prompt`in e||`registerTool`in e&&`registerResource`in e&&`registerPrompt`in e)?!0:(D&&A.warn(`Did not patch MCP server. Interface is incompatible.`),!1)}function sx(e){return j(e)}function cx(e,t){let n={[zb]:e.length};for(let[r,i]of e.entries()){if(!sx(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;sx(t)&&(e(`resource_uri`,t.uri),e(`resource_mime_type`,t.mimeType))}}return n}function lx(e,t){if(!sx(e))return{};let n=Array.isArray(e.content)?cx(e.content,t):{};return typeof e.isError==`boolean`&&(n[Rb]=e.isError),n}function ux(e,t){let n={};if(!sx(e))return n;if(t&&typeof e.description==`string`&&(n[Bb]=e.description),Array.isArray(e.messages)&&(n[Vb]=e.messages.length,t)){let t=e.messages;for(let[e,r]of t.entries()){if(!sx(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),sx(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 dx=new Map,fx=new WeakMap;function px(e){let t=e.sessionId;return t?dx.get(t):fx.get(e)}function mx(e,t){let n=e.sessionId;n?dx.set(n,t):fx.set(e,t)}function hx(e,t){mx(e,{...px(e)||{},...t})}function gx(e){return px(e)?.clientInfo}function _x(e){return px(e)?.protocolVersion}function vx(e){return px(e)}function yx(e){let t=e.sessionId;t&&dx.delete(t)}var bx=`io.modelcontextprotocol/protocolVersion`,xx=`io.modelcontextprotocol/clientInfo`,Sx=`io.modelcontextprotocol/serverInfo`;function Cx(e){let t={};return sx(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 wx(e){let t={};return sx(e.params)&&(typeof e.params.protocolVersion==`string`&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=Cx(e.params.clientInfo))),t}function Tx(e){let t={};if(sx(e.params)&&sx(e.params._meta)){let n=e.params._meta;typeof n[bx]==`string`&&(t.protocolVersion=n[bx]),n[xx]&&(t.clientInfo=Cx(n[xx]))}return t}function Ex(e){let t={};return sx(e)&&(typeof e.protocolVersion==`string`&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=Cx(e.serverInfo))),t}function Dx(e){let t={};return sx(e)&&sx(e._meta)&&e._meta[Sx]&&(t.serverInfo=Cx(e._meta[Sx])),t}function Ox(e){let t=gx(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 kx(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 Ax(e){let t=vx(e)?.serverInfo,n={};return t?.name&&(n[jb]=t.name),t?.title&&(n[Mb]=t.title),t?.version&&(n[Nb]=t.version),n}function jx(e){let t={};return e?.name&&(t[jb]=e.name),e?.title&&(t[Mb]=e.title),e?.version&&(t[Nb]=e.version),t}function Mx(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 Nx(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 Px(e,t){let n=e&&`sessionId`in e?e.sessionId:void 0,r=t?Mx(t):{},{mcpTransport:i,networkTransport:a}=Nx(e),o=Ox(e),s=Ax(e),c=_x(e);return{...n&&{"mcp.session.id":n},...r.address&&{"client.address":r.address},...r.port&&{"client.port":r.port},[Ab]:i,[qb]:a,[Jb]:`2.0`,...c&&{"mcp.protocol.version":c},...o,...s}}var Fx=new Map,Ix=new WeakMap;function Lx(e){let t=e.sessionId;if(t){let e=Fx.get(t);return e||(e=new Map,Fx.set(t,e)),e}let n=Ix.get(e);return n||(n=new Map,Ix.set(e,n)),n}function Rx(e,t,n,r){Lx(e).set(t,{span:n,method:r,startTime:Date.now()})}function zx(e,t,n,r,i=!1){let a=Lx(e),o=a.get(t);if(o){let{span:s,method:c}=o,l=c===`initialize`?Ex(n):Dx(n);(l.protocolVersion||l.serverInfo)&&hx(e,l);let u={...jx(l.serverInfo)};if(l.protocolVersion&&(u[Pb]=l.protocolVersion),Object.keys(u).length>0&&s.setAttributes(u),i)s.setStatus({code:2,message:`internal_error`});else if(c===`tools/call`){let e=lx(n,r.recordOutputs);s.setAttributes(e)}else if(c===`prompts/get`){let e=ux(n,r.recordOutputs);s.setAttributes(e)}s.end(),a.delete(t)}}function Bx(e){let t=e.sessionId;if(t){let e=Fx.get(t);if(e){for(let[,t]of e)t.span.setStatus({code:2,message:`cancelled`}),t.span.end();Fx.delete(t)}return}let n=Ix.get(e);if(n){for(let[,e]of n)e.span.setStatus({code:2,message:`cancelled`}),e.span.end();n.clear()}}var Vx={"tools/call":{targetField:`name`,targetAttribute:Fb,captureArguments:!0,argumentsField:`arguments`},"resources/read":{targetField:`uri`,targetAttribute:Ib,captureUri:!0},"resources/subscribe":{targetField:`uri`,targetAttribute:Ib},"resources/unsubscribe":{targetField:`uri`,targetAttribute:Ib},"prompts/get":{targetField:`name`,targetAttribute:Lb,captureName:!0,captureArguments:!0,argumentsField:`arguments`}};function Hx(e,t){let n=Vx[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 Ux(e,t){let n={},r=Vx[e];if(!r)return n;if(r.captureArguments&&r.argumentsField&&t?.[r.argumentsField]){let e=t[r.argumentsField];if(j(e))for(let[t,r]of Object.entries(e))n[`${Hb}.${t.toLowerCase()}`]=JSON.stringify(r)}return r.captureUri&&t?.uri&&(n[`${Hb}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${Hb}.name`]=JSON.stringify(t.name)),n}function Wx(e){return typeof e==`string`?e:JSON.stringify(e)}function Gx(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[Ub]=String(t.level)),t?.logger&&(r[Wb]=String(t.logger)),t?.data!==void 0&&(r[Gb]=typeof t.data,n&&(r[Kb]=Wx(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[Ib]=String(t.uri);let e=pf(String(t.uri));e&&!ff(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 Kx(e,t,n,r){if(e===`request`){let e=t,i=Hx(e.method,n||{});return{...e.id!==void 0&&{"mcp.request.id":String(e.id)},...i.attributes,...r?Ux(e.method,n||{}):{}}}return Gx(t.method,n||{},r)}var qx=new Set([Yb,Xb,Ib]);function Jx(e){return qx.has(e)}function Yx(e,t){return t?e:Object.entries(e).reduce((e,[t,n])=>(Jx(t)||(e[t]=n),e),{})}function Xx(e,t){return t?`${e} ${t}`:e}function Zx(e){let t,n;switch(e){case`request`:t=Zb,n=ex;break;case`notification-incoming`:t=Qb,n=tx;break;case`notification-outgoing`:t=$b,n=tx}return{[F]:t,[I]:n,[kr]:nx}}function Qx(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`?Xx(s,Hx(s,c||{}).target):s;let u=Yx({...Px(r,i),[kb]:s,...Kx(t,n,c,o?.recordInputs),...Zx(t)},!!P()?.getDataCollectionOptions().userInfo);return z({name:l,forceTransaction:!0,attributes:u},a)}function $x(e,t,n,r,i){return Qx({type:`notification-incoming`,message:e,transport:t,extra:n,callback:i,options:r})}function eS(e,t,n,r){return Qx({type:`notification-outgoing`,message:e,transport:t,options:n,callback:r})}function tS(e,t,n,r){let{method:i}=e,a=e.params;return{name:Xx(i,Hx(i,a||{}).target),op:Zb,forceTransaction:!0,attributes:Yx({...Px(t,n),[kb]:i,...Kx(`request`,e,a,r?.recordInputs),...Zx(`request`)},!!P()?.getDataCollectionOptions().userInfo)}}function nS(e,t){e.onmessage&&qt(e,`onmessage`,n=>function(r,i){let a=rx(r)?r:void 0,o=ix(r)?r:void 0,s=a||o,c;if(s)try{c=a?.method===`initialize`?wx(a):Tx(s),(c.protocolVersion||c.clientInfo)&&hx(e,c)}catch{}return a?Dr(N().clone(),()=>{let r=B(tS(a,e,i,t));return a.method===`initialize`&&c&&r.setAttributes({...kx(c.clientInfo),...c.protocolVersion&&{"mcp.protocol.version":c.protocolVersion}}),Rx(e,a.id,r,a.method),V(r,()=>n.call(this,a,i))}):o?$x(o,e,i,t,()=>n.call(this,o,i)):n.call(this,r,i)})}function rS(e,t){e.send&&qt(e,`send`,n=>async function(...r){let[i]=r;return ix(i)?eS(i,e,t,()=>n.call(this,...r)):(ax(i)&&i.id!==null&&i.id!==void 0&&(i.error&&oS(i.error),zx(e,i.id,i.result,t,!!i.error)),n.call(this,...r))})}function iS(e){e.onclose&&qt(e,`onclose`,t=>function(...n){return Bx(e),yx(e),t.call(this,...n)})}function aS(e){e.onerror&&qt(e,`onerror`,e=>function(t){return sS(t),e.call(this,t)})}function oS(e){try{if(j(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}`,yb(e,`protocol`)}}}catch{}}function sS(e){try{yb(e,`transport`)}catch{}}var cS=new WeakSet;function lS(e,t){if(cS.has(e)||!ox(e))return e;let n=e,r=P()?.getDataCollectionOptions().genAI,i={recordInputs:t?.recordInputs??r?.inputs??!1,recordOutputs:t?.recordOutputs??r?.outputs??!1};return qt(n,`connect`,e=>async function(t,...n){let r=await e.call(this,t,...n);return nS(t,i),rS(t,i),iS(t),aS(t),r}),Db(n),Ob(n),cS.add(e),e}function uS(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 dS(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=kt(o[2]),c=o[5]===`native`;!s&&o[5]&&!c&&(s=o[5]);let l=s?mS(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:pS(o[3]),colno:pS(o[4]),in_app:uS(s||``,c)}}if(i.match(t))return{filename:i}}}function fS(e){return[90,dS(e)]}function pS(e){return parseInt(e||``,10)||void 0}function mS(e){try{return decodeURI(e)}catch{return}}var hS=new WeakMap,gS=(e,t)=>{let n=hS.get(e);n?n.push(t):hS.set(e,[t])},_S=e=>{let t=hS.get(e);return t||(t=[],hS.set(e,t)),t},vS=`express.name`,yS=`http.route`,bS=`express.type`,xS=`router`,SS=`middleware`,CS=`request_handler`,wS=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function TS(e){return e.includes(`:`)||e.includes(`*`)}var ES=(e,t,n)=>{if(t.name===`router`){let r=DS(``,t)||n||e||`/`;return{attributes:{[vS]:r,[bS]:xS},name:`router - ${r}`}}return t.name===`bound dispatch`||t.name===`handle`?{attributes:{[vS]:(e||n)??`request handler`,[bS]:CS},name:`request handler${t.path?` - ${e||n}`:``}`}:{attributes:{[vS]:t.name,[bS]:SS},name:`middleware - ${t.name}`}},DS=(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)?DS(e,n):e},OS=(e,t,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(t))return!0;if(!Array.isArray(n?.ignoreLayers))return!1;try{return Tn(e,n.ignoreLayers,!0)}catch{}return!1};function kS(e,t){let n=_S(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)||TS(r))?r:void 0}function AS(e){let t=_S(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}var jS=e=>{let t=e[0];return Array.isArray(t)?t.map(e=>MS(e)||``).join(`,`):MS(t)},MS=e=>typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0,NS=e=>PS(e?.Router?.prototype),PS=e=>(typeof e==`object`||typeof e==`function`)&&!!e&&`route`in e&&typeof e.route==`function`,FS=e=>PS(e.Router)&&!NS(e);function IS(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function LS(e){return IS(e)>=500}function RS(e){if(!N()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let t=Ff(e);N().setSDKProcessingMetadata({normalizedRequest:t})}}function zS(e,t,n){if(!t?.handle)return;let r=t,i=r.handle;if(Zt(i)||i.length===4)return;function a(t,a,...o){let s=e();RS(t);let c=R();if(!c)return i.apply(this,[t,a,...o]);n&&gS(t,n);let l=_S(t),u=!!n,d=AS(t),f=kS(t,d);s.onRouteResolved?.(f);let p=ES(d,r,n),m=p.attributes[vS],h=p.attributes[bS],g=Object.assign(p.attributes,{[I]:`auto.http.express`,[F]:`${h}.express`});if(f&&(g[yS]=f),OS(p.attributes[`express.name`],h,s))return u&&l.pop(),i.apply(this,[t,a,...o]);let _=N();if(_!==ar()){if(h===`request_handler`){let e=t.method?t.method.toUpperCase():`GET`;_.setTransactionName(`${e} ${d}`)}}else D&&A.warn(`Isolation scope is still default isolation scope - skipping setting transactionName`);return ao({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]=wS(o);e.setStatus({code:2,message:n})}return n||(n=!0,a.removeListener(`finish`,r),e.end()),!(t.route&&d)&&u&&l.pop(),V(c,()=>s.apply(this,i))};break}}try{return i.apply(this,[t,a,...o])}catch(t){let[n,r]=wS(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}});Yt(a,i),Object.defineProperty(r,"handle",{enumerable:!0,configurable:!0,writable:!0,value:a})}function BS(e){return!!e&&typeof e==`object`&&`default`in e&&e.default||e}function VS(e){return!!e.express}var HS=!1;function US(){HS||(HS=!0,D&&A.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function WS(e,t){let n,r;if(!t&&VS(e)){let{express:t,...i}=e;r=t,n=()=>i,US()}else if(typeof t!=`function`)throw TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");else n=t,r=e;let i=BS(r),a=NS(i)?i.Router.prototype:FS(i)?i.Router:void 0;if(!a)throw TypeError(`no valid Express route function to instrument`);let o=a.route;try{Xt(a,`route`,function(...e){let t=o.apply(this,e),r=this.stack[this.stack.length-1];return zS(n,r,jS(e)),t})}catch(e){D&&A.error(`Failed to patch express route method:`,e)}let s=a.use;try{Xt(a,`use`,function(...e){let t=s.apply(this,e),r=this.stack[this.stack.length-1];return r&&zS(n,r,jS(e)),t})}catch(e){D&&A.error(`Failed to patch express use method:`,e)}let{application:c}=i,l=c.use;try{Xt(c,`use`,function(...e){let t=l.apply(this,e),r=NS(i)?this.router:this._router;if(r){let t=r.stack[r.stack.length-1];t&&zS(n,t,jS(e))}return t})}catch(e){D&&A.error(`Failed to patch express application.use method:`,e)}return i}function GS(){return P()?.getIntegrationByName(`Express`)?.getShouldHandleError?.()}function KS(e){return function(t,n,r,i){RS(n);let a=e?.shouldHandleError??GS()??LS;if(a===!1){i(t);return}a(t)&&(r.sentry=H(t,{mechanism:{type:`auto.middleware.express`,handled:!1}})),i(t)}}function qS(e,t){e.use(JS()),e.use(KS(t))}function JS(){return function(e,t,n){RS(e),n()}}var YS=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,XS=Symbol(`sentryPostgresConnectionContext`),ZS=Symbol.for(`sentry.instrumented.postgresjs`),QS=Symbol.for(`sentry.query.from.instrumented.sql`);function $S(e,t){return!e||typeof e!=`function`?(D&&A.warn(`instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance`),e):eC(e,{requireParentSpan:!0,...t})}function eC(e,t,n){if(e[ZS])return e;let r=new Proxy(e,{apply(e,n,i){let a=Reflect.apply(e,n,i);return j(a)&&`handle`in a&&rC(a,r,t),a},get(e,n){let i=e[n];return typeof n!=`string`||typeof i!=`function`?i:n===`unsafe`||n===`file`?tC(i,e,r,t):n===`begin`||n===`reserve`?nC(i,e,r,t):i}});return n?r[XS]=n:dC(e,r),e[ZS]=!0,r[ZS]=!0,r}function tC(e,t,n,r){return function(...i){let a=Reflect.apply(e,t,i);return j(a)&&`handle`in a&&rC(a,n,r),a}}function nC(e,t,n,r){return function(...i){let a=n[XS];if(typeof i[i.length-1]!=`function`){let n=Reflect.apply(e,t,i);return n&&typeof n.then==`function`?n.then(e=>eC(e,r,a)):n}let o=i.length===1?i[0]:i[1],s=function(e){let t=eC(e,r,a);return o(t)},c=i.length===1?[s]:[i[0],s];return Reflect.apply(e,t,c)}}function rC(e,t,n){if(e.handle?.__sentryWrapped)return;e[QS]=!0;let r=e.handle,i=async function(...i){if(this.executed||!iC(n))return r.apply(this,i);let a=sC(aC(e.strings));return ao({name:a||`postgresjs.query`,op:`db`},e=>{e.setAttribute(I,`auto.db.postgresjs`),e.setAttributes({"db.system.name":`postgres`,"db.query.text":a});let o=t?t[XS]:void 0;if(cC(e,o),n.requestHook)try{n.requestHook(e,a,o)}catch(t){e.setAttribute(`sentry.hook.error`,`requestHook failed`),D&&A.error(`Error in requestHook for PostgresJs instrumentation:`,t)}let s=this;s.resolve=new Proxy(s.resolve,{apply:(t,n,r)=>{try{lC(e,a,r?.[0]?.command),e.end()}catch(e){D&&A.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`),lC(e,a),e.end()}catch(e){D&&A.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 iC(e){return R()!==void 0||!e.requireParentSpan}function aC(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}var oC;function sC(e){return e?(oC||=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(oC,`?`).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 cC(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 lC(e,t,n){if(n){e.setAttribute(`db.operation.name`,n);return}let r=t?.match(YS);r?.[1]&&e.setAttribute(`db.operation.name`,r[1].toUpperCase())}function uC(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 dC(e,t){let n=e;n.options&&typeof n.options==`object`&&(t[XS]=uC(n.options))}var fC=`http.client.request.created`,pC=`http.server.request.start`;function mC(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 hC(e){try{return String(gC(e))}catch{return``}}function gC(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 _C(e){return String(hC(mC(e)))}function vC(e,t){let n=_f(_C(e)),r=t?.statusCode,i=ub(r);Wf({category:`http`,data:{status_code:r,url:yf(n),"http.method":e.method||`GET`,...n.search?{"http.query":n.search}:{},...n.hash?{"http.fragment":n.hash}:{}},type:`http`,level:i},{event:`response`,request:e,response:t})}function yC(e){let t=_C(e),[n,r]=gf(pf(t),`client`,`auto.http.client`,e),i=e.getHeader(`user-agent`);return{name:n,attributes:{[F]:`http.client`,"otel.kind":`CLIENT`,"http.url":t,"http.method":e.method,"http.target":e.path||`/`,"net.peer.name":e.host,"http.host":e.getHeader(`host`),...i?{"user_agent.original":i}:{},...r},onlyIfParent:!0}}function bC(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,...SC(e),...xC(a)})}function xC(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 SC(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 CC(e,t){let n=_C(e),{tracePropagationTargets:r,propagateTraceparent:i}=P()?.getOptions()??{};if(!Of(n,r,t)||e.getHeader(`sentry-trace`))return;let a=wf({propagateTraceparent:i});if(!a)return;let{"sentry-trace":o,baggage:s,traceparent:c}=a;if(o)try{e.setHeader(`sentry-trace`,o),D&&A.log(`@sentry/instrumentation-http`,`Added sentry-trace header`)}catch(e){D&&A.error(`@sentry/instrumentation-http`,`Failed to set sentry-trace header:`,It(e)?e.message:`Unknown error`)}if(c&&!e.getHeader(`traceparent`))try{e.setHeader(`traceparent`,c),D&&A.log(`@sentry/instrumentation-http`,`Added traceparent header`)}catch(e){D&&A.error(`@sentry/instrumentation-http`,`Failed to set traceparent header:`,It(e)?e.message:`Unknown error`)}if(s){let t=hi(e.getHeader(`baggage`),s);if(t)try{e.setHeader(`baggage`,t),D&&A.log(`@sentry/instrumentation-http`,`Added baggage header`)}catch(e){D&&A.error(`@sentry/instrumentation-http`,`Failed to set baggage header:`,It(e)?e.message:`Unknown error`)}}}var wC=e=>typeof e.__unwrap==`function`,TC=`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`,EC=!1,DC=D?e=>{EC||(wC(e.request)||wC(e.get))&&(EC=!0,A.warn(TC))}:()=>{};function OC(e){let t=new fb(100),n=()=>P()?.getOptions(),r=r=>{if(M().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__===!0)return;let i=n(),{errorMonitor:a=`error`,spans:o=!i||oa(i),propagateTrace:s=!1,breadcrumbs:c=!0,http:l,https:u,suppressOtelWarning:d=!1}=e,{request:f}=r;if(e.ignoreOutgoingRequests?.(_C(f),f))return;let p=!1;function m(e,t){p||(p=!0,vC(e,t))}function h(e){e.on(a,()=>m(e,void 0)),e.prependListener(`response`,t=>{e.listenerCount(`response`)<=1&&t.resume(),t.on(`end`,()=>m(e,t)),t.on(a,()=>m(e,t))})}if(!o){c&&h(f),s&&CC(f,t);return}d||(l&&DC(l),u&&DC(u));let g=B(yC(f));e.outgoingRequestHook?.(g,f),s&&(g.isRecording()?V(g,()=>{CC(f,t)}):CC(f,t));let _=!1;function v(e){_||(_=!0,g.setStatus(e),g.end())}let y=()=>v({code:0});f.on(`close`,y),f.on(a,e=>{D&&A.log(`@sentry/instrumentation-http`,`outgoingRequest on request error()`,e),c&&m(f,void 0),v({code:2})}),f.prependListener(`response`,t=>{f.removeListener(`close`,y),f.listenerCount(`response`)<=1&&t.resume(),bC(t,g),Fo(t),e.outgoingResponseHook?.(g,t);let n=!1;function r(r){if(!n){n=!0,r&&D&&A.log(`@sentry/instrumentation-http`,`outgoingRequest on response error()`,r),c&&m(f,t);let i=t.aborted&&!t.complete,a=r||typeof t.statusCode!=`number`||i?{code:2}:Jr(t.statusCode);e.applyCustomAttributesOnSpan?.(g,f,t),v(a)}}t.on(`end`,()=>r()),t.on(a,r)})};return{[fC]:r}}var kC;function AC(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!=`function`||(kC=OC({...t,http:e})[fC],Zt(n._storeHeader)))return;let r=n._storeHeader;Xt(n,`_storeHeader`,function(...e){try{kC({request:this},fC)}catch{}return r.apply(this,e)})}function jC(e,t={}){return AC(BS(e),t),e}var MC=(e,t={})=>jC(e,t);function NC(e,t,n,r){let i=0,a=[];D&&A.log(r,`Patching request.on`);let o=new WeakMap,s=Mf(n);try{e.on=e.addListener=new Proxy(e.on,{apply:(e,t,n)=>{let[c,l,...u]=n;if(c===`data`){D&&A.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):D&&A.log(r,`Dropping request body chunk because maximum body length of ${s}b is exceeded.`)}catch{D&&A.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){D&&A.error(r,`Error building captured request body`,e)}})}catch(e){D&&A.error(r,`Error patching request to capture body`,e)}}var PC=new WeakMap;function FC(e,{requestIsolationScope:t,response:n,sessionFlushingDelayMS:r}){t.setSDKProcessingMetadata({requestSession:{status:`ok`}}),n.once(`close`,()=>{let n=t.getScopeData().sdkProcessingMetadata.requestSession;if(e&&n){D&&A.log(`Recorded request session with status: ${n.status}`);let t=new Date(an());t.setSeconds(0,0);let i=t.toISOString(),a=PC.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{D&&A.log(`Opened new request session aggregate.`);let t={[i]:o};PC.set(e,t);let n=()=>{clearTimeout(s),a(),PC.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`,()=>{D&&A.log(`Sending request session aggregate due to client flush`),n()}),s=setTimeout(()=>{D&&A.log(`Sending request session aggregate due to flushing schedule`),n()},r);yu(s)}}})}var IC=`Http.Server`,LC=`Http.SentryServerSpans`,RC=new WeakMap,zC=Symbol.for(`sentry_http_server_instrumented`);function BC(e){return!e[zC]&&(e[zC]=!0)}function VC(e,t){let n=t.emit;if(n===RC.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=P(),[s,c]=a;if(!o||!BC(s))return t.apply(n,r);D&&A.log(IC,`Handling incoming request`);let l=N().clone();l.setClient(o);let u=s.socket?.remoteAddress,d=s.url||`/`,f=Ff(s),{maxRequestBodySize:p=`medium`,ignoreRequestBody:m,sessions:h=!0,sessionFlushingDelayMS:g=6e4}=e;p!==`none`&&!m?.(d,s)&&NC(s,l,p,IC),l.setSDKProcessingMetadata({normalizedRequest:f,ipAddress:u});let _=`${(s.method||`GET`).toUpperCase()} ${vf(d)}`;return l.setTransactionName(_),h&&FC(o,{requestIsolationScope:l,response:c,sessionFlushingDelayMS:g??6e4}),Dr(l,()=>{let i=f.headers?.[`sentry-trace`],a=f.headers?.baggage,o=Array.isArray(i)?i[0]:i;return co({sentryTrace:o,baggage:Array.isArray(a)?a[0]:a},()=>{let i=M().getPropagationContext();i.propagationSpanId=Xn(),o||(i.traceId=Yn(),i.sampleRand=rn()),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})})}});RC.set(t,r),t.emit=r}function HC(e){let t=e.wrapServerEmitRequest,n=UC(e),r={...e,wrapServerEmitRequest(r,i,a,o){let s=P()?.getOptions();e.spans??(s?oa(s):!1)?n(r,i,a,o):t?t(r,i,a,o):o()}},i=e=>{let{server:t}=e;VC(r,t)};return{[pC]:i}}function UC(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:i,errorMonitor:a=`error`,onSpanEnd:o}=e;return(e,s,c,l)=>{if(typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__)return l();return t?t(e,s,c,u):u();function u(){let t=N().getClient();if(!t)return l();if(WC(e,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return D&&A.log(LC,`Skipping span creation for incoming request`,e.url),l();let u=c.url||e.url||`/`,d=pf(u),f=d?d.pathname:vf(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,ee=y?.replace(/^(.*)(:[0-9]{1,5})/,`$1`)||`localhost`,b=u.startsWith(`https`)?`https`:`http`,{socket:te}=e,{localAddress:x,localPort:ne,remoteAddress:re,remotePort:ie}=te??{};return ao({name:m,kind:G.SERVER,attributes:{[F]:`http.server`,[I]:`auto.http.server`,[kr]:`url`,"http.route":f,"otel.kind":`SERVER`,"net.host.ip":x,"net.host.port":ne,"net.peer.ip":re,"net.peer.port":ie,"sentry.http.prefetch":KC(e)||void 0,[hl]:d&&!ff(d)?d.href:void 0,[gl]:d?.pathname??f,[jc]:u,"http.method":p,"http.target":d?`${d.pathname}${d.search}`:f,"http.host":y,"net.host.name":ee,"http.client_ip":typeof _==`string`?_.split(`,`)[0]:void 0,"http.user_agent":g,"http.scheme":b,"http.flavor":v,"net.transport":v?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...qC(e),...Lf(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,...Lf(Pf(s.headers),t?.getDataCollectionOptions()??!1,`response`)}),n.setStatus(i),o?.(n,e,s),n.end())}s.once(`close`,()=>{c(Jr(s.statusCode))}),s.once(a,()=>{let e=Jr(s.statusCode);c(e.code===2?e:{code:2})}),l()})}}}function WC(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&GC(r)||n?.(r,e))}function GC(e){let t=vf(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 KC(e){return e.headers[`next-router-prefetch`]===`1`}function qC(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 JC=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;x();var YC=u(`sentry_http_server_instrumented`),XC=`Http.Server`;function ZC(e,t){Jt(e,`_startSpanCallback`,new WeakRef(t))}var QC=((e={})=>{let t={sessions:e.sessions??!0,sessionFlushingDelayMS:e.sessionFlushingDelayMS??6e4,maxRequestBodySize:e.maxRequestBodySize??`medium`,spans:!1,ignoreRequestBody:e.ignoreRequestBody,wrapServerEmitRequest(e,t,n,r){let i=P();if(!i||l.active().getValue(YC))return r();let a=p.extract(l.active(),n.headers).setValue(YC,!0);l.with(a,()=>{i.emit(`httpServerRequest`,e,t,n);let a=e._startSpanCallback?.deref();a?a(()=>(r(),!0)):r()})}};return{name:XC,setupOnce(){let{[pC]:e}=HC(t);He(pC,e)},afterAllSetup(e){JC&&e.getIntegrationByName(`Http`)&&A.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}});x();var $C=u(`OpenTelemetry SDK Context Key RPC_METADATA`),ew;(function(e){e.HTTP=`http`})(ew||={});function tw(e,t){return e.setValue($C,t)}x();var nw=`Http.ServerSpans`,rw=((e={})=>{let t=e.ignoreStaticAssets??!0,n=e.ignoreIncomingRequests,r=e.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:i}=e,{requestHook:a,responseHook:o,applyCustomAttributesOnSpan:s}=e.instrumentation??{};return{name:nw,setup(e){typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__||e.on(`httpServerRequest`,(r,c,u)=>{let d=r,f=c;ZC(d,r=>{if(ow(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return JC&&A.log(nw,`Skipping span creation for incoming request`,d.url),r();let c=u.url||d.url||`/`,p=pf(c),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`,ee=c.startsWith(`https`)?`https`:`http`,b=u.method||d.method?.toUpperCase()||`GET`,te=p?p.pathname:vf(c),x=B({name:`${b} ${te}`,kind:G.SERVER,attributes:{[F]:`http.server`,[I]:`auto.http.otel.http`,[il]:iw(d)||void 0,[hl]:p&&!ff(p)?p.href:void 0,[gl]:p?.pathname??te,[jc]:c,[wc]:u.method,[Ac]:p?`${p.pathname}${p.search}`:te,[Cc]:v,[qc]:y,[xc]:typeof g==`string`?g.split(`,`)[0]:void 0,[Mc]:h,[Oc]:ee,[Sc]:_,[Qc]:_?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...sw(d),...Lf(u.headers||{},e.getDataCollectionOptions())}});a?.(x,d),o?.(x,f),s?.(x,d,f),i?.(x,d,f);let ne={type:ew.HTTP,span:x};return V(x,()=>l.with(tw(l.active(),ne),()=>{Fo(d),Fo(f);let e=!1;function t(t){if(e)return;e=!0;let n=uw(d,f,ne);x.setAttributes(n),x.setStatus(t),x.end();let r=n[`http.route`];r&&N().setTransactionName(`${d.method?.toUpperCase()||`GET`} ${r}`)}return f.on(`close`,()=>{t(Jr(f.statusCode))}),f.on(Ne,()=>{let e=Jr(f.statusCode);t(e.code===2?e:{code:2})}),r()}))})})},processEvent(e){if(e.type===`transaction`){let t=e.contexts?.trace?.data?.[`http.response.status_code`];if(typeof t==`number`){if(dw(t,r))return JC&&A.log(`Dropping transaction due to status code`,t),null;e.contexts={...e.contexts,response:{...e.contexts?.response,status_code:t}}}}return e},afterAllSetup(e){JC&&(e.getIntegrationByName(`Http`)&&A.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`)||A.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 iw(e){return e.headers[`next-router-prefetch`]===`1`}function aw(e){let t=vf(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 ow(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(uo())return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&aw(r)||n?.(r,e))}function sw(e){let t=cw(e.headers);return t==null?{}:lw(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function cw(e){let t=e[`content-length`];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function lw(e){let t=e[`content-encoding`];return!!t&&t!==`identity`}function uw(e,t,n){let{socket:r}=e,{statusCode:i,statusMessage:a}=t,o={[Ec]:i,[kc]:i,"http.status_text":a?.toUpperCase()};if(r){let{localAddress:e,localPort:t,remoteAddress:n,remotePort:i}=r;o[Kc]=e,o[Jc]=t,o[Yc]=n,o[Zc]=i}return o[kc]=i,o[`http.status_text`]=(a||``).toUpperCase(),n?.type===ew.HTTP&&n.route!==void 0&&(o[Dc]=n.route),o}function dw(e,t){return t.some(t=>{if(typeof t==`number`)return t===e;let[n,r]=t;return e>=n&&e<=r})}var fw=class{emit(e){}enabled(){return!1}},pw=new fw,mw=Symbol.for(`io.opentelemetry.js.api.logs`),hw=globalThis;function gw(e,t,n){return r=>r===e?t:n}var _w=new class{getLogger(e,t,n){return new fw}},vw=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):pw}},yw=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new vw(this,e,t,n)}_getDelegate(){return this._delegate??_w}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},bw=class e{constructor(){this._proxyLoggerProvider=new yw}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return hw[mw]?this.getLoggerProvider():(hw[mw]=gw(1,e,_w),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return hw[mw]?.call(hw,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete hw[mw],this._proxyLoggerProvider=new yw}}.getInstance();function xw(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 Sw(e){e.forEach(e=>e.disable())}x();function Cw(e){let t=e.tracerProvider||_.getTracerProvider(),n=e.meterProvider||se.getMeterProvider(),r=e.loggerProvider||bw.getLoggerProvider(),i=e.instrumentations?.flat()??[];return xw(i,t,n,r),()=>{Sw(i)}}x();var ww=/^(?: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-]+)*))?$/,Tw=/^(?<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-]+)*))?$/,Ew={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Dw(e,t,n){if(!Ow(e))return h.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,`$1`);let r=Fw(e);if(!r)return!1;let i=[],a=kw(r,t,i,n);return a&&!n?.includePrerelease?Mw(r,i):a}function Ow(e){return typeof e==`string`&&ww.test(e)}function kw(e,t,n,r){if(t.includes(`||`)){let i=t.trim().split(`||`);for(let t of i)if(Aw(e,t,n,r))return!0;return!1}if(t.includes(` - `))t=lT(t,r);else if(t.includes(` `)){let i=t.trim().replace(/\s{2,}/g,` `).split(` `);for(let t of i)if(!Aw(e,t,n,r))return!1;return!0}return Aw(e,t,n,r)}function Aw(e,t,n,r){if(t=Nw(t,r),t.includes(` `))return kw(e,t,n,r);{let r=Iw(t);return n.push(r),jw(e,r)}}function jw(e,t){if(t.invalid)return!1;if(!t.version||Lw(t.version))return!0;let n=Vw(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:Vw(r,i)}return Ew[t.op]?.includes(n)}function Mw(e,t){return!e.prerelease||t.some(t=>t.prerelease&&t.version===e.version)}function Nw(e,t){return e=e.trim(),e=sT(e,t),e=oT(e),e=cT(e,t),e=e.trim(),e}function Pw(e){return!e||e.toLowerCase()===`x`||e===`*`}function Fw(e){let t=e.match(ww);if(!t){h.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 Iw(e){if(!e)return{};let t=e.match(Tw);if(!t)return h.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 Lw(e){return e===`*`||e===`x`||e===`X`}function Rw(e){let t=parseInt(e,10);return isNaN(t)?e:t}function zw(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 Bw(e,t){if(Lw(e)||Lw(t))return 0;let[n,r]=zw(Rw(e),Rw(t));return n>r?1:n<r?-1:0}function Vw(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=Bw(e[n]||`0`,t[n]||`0`);if(r!==0)return r}return 0}var Hw=`[a-zA-Z0-9-]`,Uw=`0|[1-9]\\d*`,Ww=`\\d*[a-zA-Z-]${Hw}*`,Gw=`((?:<|>)?=?)`,Kw=`(?:${Uw}|${Ww})`,qw=`(?:-(${Kw}(?:\\.${Kw})*))`,Jw=`${Hw}+`,Yw=`(?:\\+(${Jw}(?:\\.${Jw})*))`,Xw=`${Uw}|x|X|\\*`,Zw=`[v=\\s]*(${Xw})(?:\\.(${Xw})(?:\\.(${Xw})(?:${qw})?${Yw}?)?)?`,Qw=`^${Gw}\\s*${Zw}$`,$w=new RegExp(Qw),eT=`^\\s*(${Zw})\\s+-\\s+(${Zw})\\s*\$`,tT=new RegExp(eT),nT=`^(?:~>?)${Zw}$`,rT=new RegExp(nT),iT=`^(?:\\^)${Zw}$`,aT=new RegExp(iT);function oT(e){let t=rT;return e.replace(t,(e,t,n,r,i)=>{let a;return a=Pw(t)?``:Pw(n)?`>=${t}.0.0 <${+t+1}.0.0-0`:Pw(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 sT(e,t){let n=aT,r=t?.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>{let o;return o=Pw(t)?``:Pw(n)?`>=${t}.0.0${r} <${+t+1}.0.0-0`:Pw(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 cT(e,t){let n=$w;return e.replace(n,(e,n,r,i,a,o)=>{let s=Pw(r),c=s||Pw(i),l=c||Pw(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 lT(e,t){let n=tT;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>(n=Pw(r)?``:Pw(i)?`>=${r}.0.0${t?.includePrerelease?`-0`:``}`:Pw(a)?`>=${r}.${i}.0${t?.includePrerelease?`-0`:``}`:o?`>=${n}`:`>=${n}${t?.includePrerelease?`-0`:``}`,c=Pw(l)?``:Pw(u)?`<${+l+1}.0.0-0`:Pw(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t?.includePrerelease?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()))}var uT=console.error.bind(console);function dT(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 fT=(e,t,n)=>{if(!e||!e[t]){uT(`no original function `+String(t)+` to wrap`);return}if(!n){uT(`no wrapper function`),uT(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){uT(`original object and wrapper must be functions`);return}let i=n(r,t);return dT(i,`__original`,r),dT(i,`__unwrap`,()=>{e[t]===i&&dT(e,t,r)}),dT(i,`__wrapped`,!0),dT(e,t,i),i},pT=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{uT(`must provide one or more modules to patch`),uT(Error().stack);return}if(!(t&&Array.isArray(t))){uT(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{fT(e,t,n)})})},mT=(e,t)=>{if(!e||!e[t]){uT(`no function to unwrap.`),uT(Error().stack);return}let n=e[t];if(!n.__unwrap)uT(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},hT=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{uT(`must provide one or more modules to patch`),uT(Error().stack);return}if(!(t&&Array.isArray(t))){uT(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{mT(e,t)})})};x();var gT=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=h.createComponentLogger({namespace:e}),this._tracer=_.getTracer(e,t),this._meter=se.getMeter(e,t),this._logger=bw.getLogger(e,t),this._updateMetricInstruments()}_wrap=fT;_unwrap=mT;_massWrap=pT;_massUnwrap=hT;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)}}},_T=d(((e,t)=>{var n=c(`path`).sep;t.exports=function(e){var t=e.split(n),r=t.lastIndexOf(`node_modules`);if(r!==-1&&t[r+1]){for(var i=t[r+1][0]===`@`,a=i?t[r+1]+`/`+t[r+2]:t[r+1],o=i?3:2,s=``,c=r+o-1,l=0;l<=c;l++)s+=l===c?t[l]:t[l]+n;for(var u=``,d=t.length-1,f=r+o;f<=d;f++)u+=f===d?t[f]:t[f]+n;return{name:a,basedir:s,path:u}}}})),vT=d(((e,t)=>{var n=c(`path`),r=c(`module`),i=ce()(`require-in-the-middle`),a=_T();t.exports=d,t.exports.Hook=d;var o,s;if(r.isBuiltin)s=r.isBuiltin;else if(r.builtinModules)s=e=>e.startsWith(`node:`)?!0:(o===void 0&&(o=new Set(r.builtinModules)),o.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(e,t){if(this._localCache.has(e))return!0;if(t)return!1;{let t=c.cache[e];return!!(t&&this._kRitmExports in t)}}get(e,t){let n=this._localCache.get(e);if(n!==void 0)return n;if(!t){let t=c.cache[e];return t&&t[this._kRitmExports]}}set(e,t,n){n?this._localCache.set(e,t):e in c.cache?c.cache[e][this._kRitmExports]=t:(i(`non-core module is unexpectedly not in require.cache: "%s"`,e),this._localCache.set(e,t))}};function d(e,t,o){if(!(this instanceof d))return new d(e,t,o);if(typeof e==`function`?(o=e,e=null,t=null):typeof t==`function`&&(o=t,t=null),typeof r._resolveFilename!=`function`){console.error(`Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!`,typeof r._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=r.prototype.require;let l=this,p=new Set,m=t?t.internals===!0:!1,h=Array.isArray(e);i(`registering require hook`),this._require=r.prototype.require=function(e){return l._unhooked===!0?(i(`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?(i(`ignoring process.getBuiltinModule call - module is soft-unhooked`),l._origGetBuiltinModule.apply(this,arguments)):g.call(this,arguments,!0)});function g(t,u){let d=t[0],g=s(d),_;if(g){if(_=d,d.startsWith(`node:`)){let e=d.slice(5);s(e)&&(_=e)}}else if(u)return i(`call to process.getBuiltinModule with unknown built-in id`),l._origGetBuiltinModule.apply(this,t);else try{_=r._resolveFilename(d,this)}catch(e){return i(`Module._resolveFilename("%s") threw %j, calling original Module.require`,d,e.message),l._origRequire.apply(this,t)}let v,y;if(i(`processing %s module require('%s'): %s`,g===!0?`core`:`non-core`,d,_),l._cache.has(_,g)===!0)return i(`returning already patched cached module: %s`,_),l._cache.get(_,g);let ee=p.has(_);ee===!1&&p.add(_);let b=u?l._origGetBuiltinModule.apply(this,t):l._origRequire.apply(this,t);if(ee===!0)return i(`module is in the process of being patched already - ignoring: %s`,_),b;if(p.delete(_),g===!0){if(h===!0&&e.includes(_)===!1)return i(`ignoring core module not on whitelist: %s`,_),b;v=_}else if(h===!0&&e.includes(_)){let e=n.parse(_);v=e.name,y=e.dir}else{let t=a(_);if(t===void 0)return i(`could not parse filename: %s`,_),b;v=t.name,y=t.basedir;let r=f(t);i(`resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)`,v,d,r,y);let o=!1;if(h){if(!d.startsWith(`.`)&&e.includes(d)&&(v=d,o=!0),!e.includes(v)&&!e.includes(r))return b;e.includes(r)&&r!==v&&(v=r,o=!0)}if(!o){let e;try{e=c.resolve(v,{paths:[y]})}catch{return i(`could not resolve module: %s`,v),l._cache.set(_,b,g),b}if(e!==_){if(m===!0)v=v+n.sep+n.relative(y,_),i(`preparing to process require of internal file: %s`,v);else return i(`ignoring require of non-main module file: %s`,e),l._cache.set(_,b,g),b}}}l._cache.set(_,b,g),i(`calling require hook: %s`,v);let te=o(b,v,y);return l._cache.set(_,te,g),i(`returning module: %s`,v),te}}d.prototype.unhook=function(){this._unhooked=!0,this._require===r.prototype.require?(r.prototype.require=this._origRequire,i(`require unhook successful`)):i(`require unhook unsuccessful`),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,i(`process.getBuiltinModule unhook successful`)):i(`process.getBuiltinModule unhook unsuccessful`))};function f(e){let t=n.sep===`/`?e.path:e.path.split(n.sep).join(`/`);return n.posix.join(e.name,t).replace(l,``)}})),yT=class{hooks=[];children=new Map},bT=class{_trie=new yT;_counter=0;insert(e){let t=this._trie;for(let n of e.moduleName.split(`/`)){let e=t.children.get(n);e||(e=new yT,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))}},xT=vT(),ST=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(e=>typeof global[e]==`function`),CT=class e{_moduleNameTrie=new bT;static _instance;constructor(){this._initialize()}_initialize(){new xT.Hook(null,{internals:!0},(e,t,n)=>{let r=wT(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 ST?new e:this._instance=this._instance??new e}};function wT(e){return Ce.sep===`/`?e:e.split(Ce.sep).join(`/`)}var TT=d((e=>{var t=[],n=new WeakMap,r=new WeakMap,i=new Map,a=[],o={set(e,t,r){let i=n.get(e),a=i&&i[t];return typeof a!=`function`||a(r)},get(e,t){if(t===Symbol.toStringTag)return`Module`;let n=r.get(e)[t];if(typeof n==`function`)return n()},defineProperty(e,t,r){if(!(`value`in r))throw Error(`Getters/setters are not supported for exports property descriptors.`);let i=n.get(e),a=i&&i[t];return typeof a!=`function`||a(r.value)}};function s(e,s,c,l,u){i.set(e,u),n.set(s,c),r.set(s,l);let d=new Proxy(s,o);t.forEach(t=>t(e,d,u)),a.push([e,d,u])}var c=[0,10,50],l=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:`Module`}});set={};get={};#e=Object.create(null);#t=[];bind(e,t,n,r,i){let a=i?()=>t[e]??t.default:()=>t[e];this.#e[e]=!1;let o=!1;try{let t=a();n(t),this.namespace[e]=t}catch(e){if(!(e instanceof ReferenceError))throw e;o=!0}(o||r()===void 0)&&this.#t.push(this.#n(e,a,n)),this.set[e]=t=>(this.#e[e]=!0,n(t),!0),this.get[e]=r}#n(e,t,n){return()=>{if(this.#e[e]===!0)return!0;try{let r=t();return r!==void 0&&(n(r),this.namespace[e]=r,!0)}catch(e){if(e instanceof ReferenceError)return!1;throw e}}}#r(){let e=[];for(let t of this.#t)t()!==!0&&e.push(t);this.#t=e}flush(){this.#t.length!==0&&queueMicrotask(()=>{this.#r(),this.#i(0)})}#i(e){if(this.#t.length===0)return;if(e>=c.length){this.#t=[];return}let t=setTimeout(()=>{this.#r(),this.#i(e+1)},c[e]);t&&typeof t.unref==`function`&&t.unref()}};e.register=s,e.ModuleBinder=l,e.importHooks=t,e.specifiers=i,e.toHook=a})),ET=d(((e,t)=>{var n=c(`path`),r=_T(),{fileURLToPath:i}=c(`url`),{MessageChannel:a}=c(`worker_threads`),{isBuiltin:o}=c(`module`);o||=()=>!0;var{importHooks:s,specifiers:l,toHook:u}=TT();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){s.push(e),u.forEach(([t,n,r])=>e(t,n,r))}function p(e){let t=s.indexOf(e);t>-1&&s.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 a,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 o=t;return{registerOptions:{data:{addHookMessagePort:o,include:[]},transferList:[o]},addHookMessagePort:o,waitForAllMessagesAcknowledged:i}}function _(e,t,a){if(!(this instanceof _))return new _(e,t,a);typeof e==`function`?(a=e,e=null,t=null):typeof t==`function`&&(a=t,t=null);let s=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);o(e)&&(t=e)}else if(f.startsWith(`file://`)){let e=Error.stackTraceLimit;Error.stackTraceLimit=0;try{h=i(t),t=h}catch{}if(Error.stackTraceLimit=e,h){let e=r(h);e&&(t=e.name,g=e.basedir)}}if(e)for(let r of e)if(h&&r===h)m(a,c,h,void 0);else if(r===t){if(!g)m(a,c,t,g);else if(g.endsWith(l.get(f))||d(l.get(f),g))m(a,c,t,g);else if(s){let e=t+n.sep+n.relative(g,h);m(a,c,e,g)}}else r===u&&m(a,c,u,g);else m(a,c,t,g)},f(this._iitmHook)}_.prototype.unhook=function(){p(this._iitmHook)},t.exports=_,t.exports.Hook=_,t.exports.addHook=f,t.exports.removeHook=p,t.exports.createAddHookMessageChannel=g}));function DT(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 K(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var OT=ET();x();var q=class extends gT{_modules;_hooks=[];_requireInTheMiddleSingleton=CT.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(K(e[t])&&this._unwrap(e,t),be.isProxy(e)){let r=fT(Object.assign({},e),t,n);return Object.defineProperty(e,t,{value:r}),r}return fT(e,t,n)};_unwrap=(e,t)=>be.isProxy(e)?Object.defineProperty(e,t,{value:e[t]}):mT(e,t);_massWrap=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{h.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){h.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{h.error(`must provide one or more modules to patch`);return}if(!(t&&Array.isArray(t))){h.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=Se(Ce.join(e,`package.json`),{encoding:`utf8`}),n=JSON.parse(t).version;return typeof n==`string`?n:void 0}catch{h.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 kT(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=Ce.normalize(n);return a.filter(t=>t.name===o&&kT(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&&Ce.isAbsolute(n)){let e=Ce.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=Ce.isAbsolute(e.name)?new xT.Hook([e.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(e.name,n);this._hooks.push(r);let i=new OT.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 kT(e,t,n){return t===void 0?e.includes(`*`):e.some(e=>Dw(t,e,{includePrerelease:n}))}var J=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}},AT=In(process.versions.node),jT=AT.major,MT=AT.minor;x();var NT=AT.major===22&&AT.minor>=12||AT.major===23&&AT.minor>=2||AT.major>=24;function PT(e={}){let{outgoingRequestApplyCustomAttributes:t,...n}=e,r={propagateTrace:n.propagateTraceInOutgoingRequests??!0,applyCustomAttributesOnSpan:t,...n,spans:n.createSpansForOutgoingRequests!==!1&&(n.spans??!0),ignoreOutgoingRequests(e,t){return uo()||!!n.ignoreOutgoingRequests?.(e,mC(t))},outgoingRequestHook(e,t){n.outgoingRequestHook?.(e,t);let r=t.once;t.once=new Proxy(r,{apply(t,n,r){let[i]=r;if(i!==`response`)return t.apply(n,r);let a=l.active(),o=_.setSpan(a,e);return l.with(o,()=>t.apply(n,r))}})},outgoingResponseHook(e,t){n.outgoingResponseHook?.(e,t)},errorMonitor:Ne,http:Ve};NT?IT(r):LT(r)}var FT;function IT(e){let{[fC]:t}=OC(e);FT&&Ue(fC,FT),He(fC,t),FT=t}function LT(e){MC(Ve,e)}var RT=`Http`;Object.assign(PT,{id:`${RT}.sentry`});var zT=W((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=QC(i),c=rw(a);return{name:RT,setup(e){r&&c.setup(e)},setupOnce(){s.setupOnce(),PT(o)},processEvent(e){return c.processEvent(e)}}}),BT=`sentry-trace`,VT=`baggage`,HT=`traceparent`;function UT(e,t,n){let r=ZT(e.origin,e.path),{tracePropagationTargets:i,propagateTraceparent:a}=P()?.getOptions()||{};if(!Of(r,i,t))return;let o=n&&So(n)&&R()?void 0:n,s=o?V(o,()=>wf({propagateTraceparent:a})):wf({propagateTraceparent:a});if(!s)return;let{"sentry-trace":c,baggage:l,traceparent:u}=s,d=Array.isArray(e.headers)?WT(e.headers):GT(e.headers);if(qT(d,BT),qT(d,VT),a&&qT(d,HT),JT(d,BT)===-1){c&&d.push(BT,c),u&&JT(d,`traceparent`)===-1&&d.push(`traceparent`,u);let e=JT(d,VT);if(l&&e===-1)d.push(VT,l);else if(l){let t=d[e+1],n=hi(t,l);n&&(d[e+1]=n)}}Array.isArray(e.headers)?e.headers.splice(0,e.headers.length,...d):e.headers=KT(d)}function WT(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 GT(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{A.warn(`Failed to convert string request header to array header: ${e}`)}return n}function KT(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 qT(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===VT&&i){let t=hi(e[r+1],i);t&&(e[n+1]=t)}e.splice(r,2),r-=2}}function JT(e,t){return e.findIndex((e,n)=>n%2==0&&e===t)}function YT(e,t){let n=XT(e),r=t.statusCode,i=ub(r);Wf({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function XT(e){try{let t=_f(ZT(e.origin,e.path)),n={url:yf(t),"http.method":e.method||`GET`};return t.search&&(n[`http.query`]=t.search),t.hash&&(n[`http.fragment`]=t.hash),n}catch{return{}}}function ZT(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 QT=`http.request.method_original`,$T=[],eE=new WeakMap,tE=new WeakMap,nE=new fb(100);function rE(e={}){$T.length||(aE(`undici:request:create`,t=>sE(e,t)),aE(`undici:client:sendHeaders`,t=>cE(e,t)),aE(`undici:request:headers`,t=>lE(e,t)),aE(`undici:request:trailers`,e=>uE(e)),aE(`undici:request:error`,e=>dE(e)))}function iE(e,t){try{return e()}catch(e){t(e);return}}function aE(e,t){let[n=0,r=0]=process.version.replace(`v`,``).split(`.`).map(e=>Number(e));n>18||n===18&&r>=19?$T.push(Qe.subscribe?.(e,t)):$T.push(Qe.channel(e).subscribe(t))}function oE(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 sE(e,{request:t}){let n=pE(t.origin,t.path),r=iE(()=>!!e.ignoreOutgoingRequests?.(n),e=>e&&JC&&A.error(`caught ignoreOutgoingRequests error: `,e)),i=uo()||!!r;if(tE.set(t,i),!e.spans){e.tracePropagation!==!1&&!i&&UT(t,nE);return}if(t.method===`CONNECT`||r)return;let a;try{a=new Je(t.path,t.origin)}catch(e){JC&&A.warn(`could not determine url.full:`,e);return}let o=a.protocol.replace(`:`,``),s=fE(t.method),c={[Tc]:s,[QT]:t.method,[hl]:a.toString(),[gl]:a.pathname,[_l]:a.search,[vl]:o,[I]:`auto.http.otel.node_fetch`};if(n.startsWith(`data:`)){let e=bf(n);c[`http.url`]=e,c[hl]=e,c[Br]=`${t.method||`GET`} ${e}`}let l={https:`443`,http:`80`},u=a.hostname,d=a.port||l[o];c[dl]=u,d&&!isNaN(Number(d))&&(c[fl]=Number(d));let f=oE(t).get(`user-agent`);f&&(c[yl]=Array.isArray(f)?f[f.length-1]:f);let p=P(),m=B({name:s===`_OTHER`?`HTTP`:s,kind:G.CLIENT,attributes:c,onlyIfParent:!p||!Ja(p)});iE(()=>e.requestHook?.(m,t),e=>e&&JC&&A.error(`caught requestHook error: `,e)),UT(t,nE,m),eE.set(t,m)}function cE(e,{request:t,socket:n}){let r=eE.get(t);if(!r)return;let{remoteAddress:i,remotePort:a}=n,o={[Hc]:i,[Uc]:a};if(e.headersToSpanAttributes?.requestHeaders){let n=new Set(e.headersToSpanAttributes.requestHeaders.map(e=>e.toLowerCase())),r=oE(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 lE(e,{request:t,response:n}){e.breadcrumbs!==!1&&!tE.get(t)&&YT(t,n);let r=eE.get(t);if(!r)return;let i={[Ec]:n.statusCode};if(iE(()=>e.responseHook?.(r,{request:t,response:n}),e=>e&&JC&&A.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(Jr(n.statusCode))}function uE({request:e}){let t=eE.get(e);t&&(t.end(),eE.delete(e))}function dE({request:e,error:t}){let n=eE.get(e);n&&(n.setStatus({code:2,message:t.message}),n.end(),eE.delete(e))}function fE(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 pE(e,t=`/`){let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}var mE=W(((e={})=>({name:`NodeFetch`,setupOnce(){rE(e)}})));x();function hE(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){h.warn(`Unknown value ${ve(t)} for ${e}, expected a number, using defaults`);return}return n}function gE(e){let t=process.env[e];if(t!=null&&t.trim()!==``)return t}var _E=`[object Object]`,vE=`[object Null]`,yE=`[object Undefined]`,bE=Function.prototype.toString,xE=bE.call(Object),SE=Object.getPrototypeOf,CE=Object.prototype,wE=CE.hasOwnProperty,TE=Symbol?Symbol.toStringTag:void 0,EE=CE.toString;function DE(e){if(!OE(e)||kE(e)!==_E)return!1;let t=SE(e);if(t===null)return!0;let n=wE.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&bE.call(n)===xE}function OE(e){return typeof e==`object`&&!!e}function kE(e){return e==null?e===void 0?yE:vE:TE&&TE in Object(e)?AE(e):jE(e)}function AE(e){let t=wE.call(e,TE),n=e[TE],r=!1;try{e[TE]=void 0,r=!0}catch{}let i=EE.call(e);return r&&(t?e[TE]=n:delete e[TE]),i}function jE(e){return EE.call(e)}var ME=20;function NE(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=FE(t,e.shift(),0,n);return t}function PE(e){return LE(e)?e.slice():e}function FE(e,t,n=0,r){let i;if(!(n>ME)){if(n++,BE(e)||BE(t)||RE(t))i=PE(t);else if(LE(e)){if(i=e.slice(),LE(t))for(let e=0,n=t.length;e<n;e++)i.push(PE(t[e]));else if(zE(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]=PE(t[r]))}}}else if(zE(e)){if(zE(t)){if(!VE(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(BE(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(IE(e,s,r)||IE(t,s,r))delete i[s];else{if(zE(a)&&zE(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]=FE(i[s],c,n,r)}}}}else i=t}return i}}function IE(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 LE(e){return Array.isArray(e)}function RE(e){return typeof e==`function`}function zE(e){return!BE(e)&&!LE(e)&&!RE(e)&&typeof e==`object`}function BE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function VE(e,t){return!(!DE(e)||!DE(t))}x();var HE=u(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function UE(e){return e.getValue(HE)===!0}x();function WE(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!GE(n)){h.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!KE(r)){h.warn(`Invalid attribute value set for key: ${n}`);continue}t[n]=Array.isArray(r)?r.slice():r}return t}function GE(e){return typeof e==`string`&&e!==``}function KE(e){return e==null?!0:Array.isArray(e)?qE(e):JE(typeof e)}function qE(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(JE(e)){t=e;continue}return!1}return!1}}return!0}function JE(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}x();function YE(){return e=>{h.error(XE(e))}}function XE(e){return typeof e==`string`?e:JSON.stringify(ZE(e))}function ZE(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var QE=YE();function $E(e){try{QE(e)}catch{}}var eD=`2.11.0`,tD=`process.runtime.name`;b();var nD={[g]:`opentelemetry`,[tD]:`node`,[ie]:ae,[ee]:eD},rD=performance,iD=9,aD=10**6,oD=10**iD;function sD(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*aD)]}function cD(e){return fD(sD(rD.timeOrigin),sD(typeof e==`number`?e:rD.now()))}function lD(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=oD),[n,r]}function uD(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function dD(e){return uD(e)||typeof e==`number`||e instanceof Date}function fD(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=oD&&(n[1]-=oD,n[0]+=1),n}var pD;function mD(){if(pD===void 0)try{let e=globalThis.process.argv0;pD=e?`unknown_service:${e}`:`unknown_service`}catch{pD=`unknown_service`}return pD}var hD=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;x(),b();var gD=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=yD(t),r._asyncAttributesPending=t.filter(([e,t])=>hD(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(hD(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=yD(this._rawAttributes),this._schemaUrl=bD(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,hD(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&h.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(hD(n)){h.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=xD(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function _D(e,t){return gD.FromAttributeList(Object.entries(e),t)}function vD(){return _D({[te]:mD(),[ie]:nD[ie],[g]:nD[g],[ee]:nD[ee]})}function yD(e){return e.map(([e,t])=>hD(t)?[e,t.catch(t=>{h.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function bD(e){if(typeof e==`string`||e===void 0)return e;h.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function xD(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;h.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var SD=`exception`,CD=Symbol.for(`nodejs.util.inspect.custom`);function wD(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function TD(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(),b();var ED=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:oe.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=rD.now(),this._performanceOffset=t-(this._performanceStartTime+rD.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 h.warn(`Invalid attribute key: ${e}`),this;if(!KE(t))return h.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 h.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&h.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),dD(t)&&(dD(n)||(n=t),t=void 0);let i=WE(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&&h.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=WE(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===oe.UNSET||this.status.code===oe.OK)return this;let t={code:e.code};return e.code===oe.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&h.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()){h.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=lD(this.startTime,this.endTime),this._duration[0]<0&&(h.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&&h.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&h.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<=rD.now())return cD(e+this._performanceOffset);if(typeof e==`number`)return sD(e);if(e instanceof Date)return sD(e.getTime());if(uD(e))return e;if(this._startTimeProvided)return sD(Date.now());let t=rD.now()-this._performanceStartTime;return fD(this.startTime,sD(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[re]=e:e&&(e.code?n[m]=e.code.toString():e.name&&(n[m]=e.name),e.message&&(n[re]=e.message),e.stack&&(n[v]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(SD,n,t):h.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}}`);h.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?(h.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}[CD](e,t,n){return TD(`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:wD(this.resource)}},e,t,n)}},DD;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(DD||={});var OD=`otel.span.parent.origin`,kD=`otel.span.sampling_result`,AD=`otel.sdk.span.live`,jD=`otel.sdk.span.started`,MD=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(jD,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(AD,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=PD(t);if(this.startedSpans.add(1,{[OD]:ND(e),[kD]:n}),t===DD.NOT_RECORD)return()=>{};let r={[kD]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function ND(e){return e?e.isRemote?`remote`:`local`:`none`}function PD(e){switch(e){case DD.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case DD.RECORD:return`RECORD_ONLY`;case DD.NOT_RECORD:return`DROP`}}var FD=`2.11.0`;x();var ID=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`,FD);this._tracerMetrics=new MD(n)}startSpan(e,n={},r=l.active()){n.root&&(r=_.deleteSpan(r));let a=_.getSpan(r);if(UE(r))return h.debug(`Instrumentation suppressed, returning Noop Span`),_.wrapSpanContext(o);let c=a?.spanContext(),u=this._idGenerator.generateSpanId(),d,f,p;!c||!_.isSpanContextValid(c)?f=this._idGenerator.generateTraceId():(f=c.traceId,p=c.traceState,d=c);let m=n.kind??t.INTERNAL,g=(n.links??[]).map(e=>({context:e.context,attributes:WE(e.attributes)})),v=WE(n.attributes),y=this._sampler.shouldSample(r,f,e,m,v,g),ee=this._tracerMetrics.startSpan(c,y.decision);p=y.traceState??p;let b=y.decision===s.RECORD_AND_SAMPLED?i.SAMPLED:i.NONE,te={traceId:f,spanId:u,traceFlags:b,traceState:p};if(y.decision===s.NOT_RECORD)return h.debug(`Recording is off, propagating context in a non-recording span`),_.wrapSpanContext(te);let x=WE(Object.assign(v,y.attributes));return new ED({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:te,name:e,kind:m,links:g,parentSpanContext:d,attributes:x,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:ee})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??l.active(),c=this.startSpan(e,i,s),u=_.setSpan(s,c);return l.with(u,o,void 0,c)}[CD](e,t,n){return TD(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:wD(this._resource)},spanLimits:this._spanLimits},e,t,n)}},LD=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=>{$E(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)})}},RD=class{shouldSample(){return{decision:DD.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},zD=class{shouldSample(){return{decision:DD.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};x();var BD=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=($E(Error(`ParentBasedSampler must have a root sampler configured`)),new zD),this._remoteParentSampled=e.remoteParentSampled??new zD,this._remoteParentNotSampled=e.remoteParentNotSampled??new RD,this._localParentSampled=e.localParentSampled??new zD,this._localParentNotSampled=e.localParentNotSampled??new RD}shouldSample(e,t,n,r,a,o){let s=_.getSpanContext(e);return!s||!y(s)?this._root.shouldSample(e,t,n,r,a,o):s.isRemote?s.traceFlags&i.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,a,o):this._remoteParentNotSampled.shouldSample(e,t,n,r,a,o):s.traceFlags&i.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,a,o):this._localParentNotSampled.shouldSample(e,t,n,r,a,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},VD=8,HD=16,UD=class{generateTraceId=GD(HD);generateSpanId=GD(VD)},WD=Buffer.allocUnsafe(HD);function GD(e){return function(){for(let t=0;t<e/4;t++)WD.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(WD[t]>0);t++)t===e-1&&(WD[e-1]=1);return WD.toString(`hex`,0,e)}}x();var KD;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(KD||={});var qD=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(t={}){this._forceFlushTimeoutMillis=t.forceFlushTimeoutMillis??3e4,this._resource=t.resource??vD();let n=t.spanProcessors??[];this._activeSpanProcessor=new LD(n),this._tracerOptions={resource:this._resource,sampler:t.sampler??new BD({root:new zD}),spanLimits:{attributeCountLimit:t.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:t.spanLimits?.eventCountLimit??128,linkCountLimit:t.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:t.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:t.spanLimits?.attributePerLinkCountLimit??128},idGenerator:t.idGenerator||new UD,spanProcessor:this._activeSpanProcessor,meterProvider:t.meterProvider??{getMeter(){return e()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new ID({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=KD.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==KD.timeout&&(r=KD.resolved,n(r))}).catch(e=>{clearTimeout(i),r=KD.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==KD.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[CD](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return TD(`TracerProvider`,{resource:{attributes:wD(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};x();var JD=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:a(t)&&this._accumulate(t)<this._upperBound?DD.RECORD_AND_SAMPLED:DD.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 YD;(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`})(YD||={});var XD=1;function ZD(){return{sampler:QD(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:hE(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:hE(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:hE(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:hE(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:hE(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:hE(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:hE(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:hE(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function QD(){let e=gE(`OTEL_TRACES_SAMPLER`)??YD.ParentBasedAlwaysOn;switch(e){case YD.AlwaysOn:return new zD;case YD.AlwaysOff:return new RD;case YD.ParentBasedAlwaysOn:return new BD({root:new zD});case YD.ParentBasedAlwaysOff:return new BD({root:new RD});case YD.TraceIdRatio:return new JD($D());case YD.ParentBasedTraceIdRatio:return new BD({root:new JD($D())});default:return h.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${YD.ParentBasedAlwaysOn}".`),new BD({root:new zD})}}function $D(){let e=hE(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(h.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${XD}.`),XD):e<0||e>1?(h.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${XD}.`),XD):e}function eO(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??hE(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??hE(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??hE(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??hE(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}var tO=class extends qD{constructor(e={}){let t=NE({},ZD(),eO(e));delete t.generalLimits,super(t)}};x();var nO=u(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function rO(e){return e.setValue(nO,!0)}function iO(e){return e.getValue(nO)===!0}var aO=`baggage`,oO=4096;x();function sO(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function cO(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 lO(e){if(!e)return;let t=e.indexOf(`;`),r=t===-1?e:e.substring(0,t),i=r.indexOf(`=`);if(i<=0)return;let a=r.substring(0,i).trim(),o=r.substring(i+1).trim();if(!a||!o)return;let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch{return}let l;if(t!==-1&&t<e.length-1){let r=e.substring(t+1);l=n(r)}return{key:s,value:c,metadata:l}}function uO(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=lO(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 dO=class{inject(e,t,n){let r=p.getBaggage(e);if(!r||iO(e))return;let i=sO(cO(r).filter(e=>e.length<=oO).slice(0,180));i.length>0&&n.set(t,aO,i)}extract(e,t,n){let r=n.get(t,aO);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=uO(r[e],i,a,o);else[a]=uO(r,i,a,o);return a===0?e:p.setBaggage(e,p.createBaggage(i))}fields(){return[aO]}},fO=`2.11.0`,pO=`process.runtime.name`;b();var mO={[g]:`opentelemetry`,[pO]:`node`,[ie]:ae,[ee]:fO};x();var hO=`sentry.parentIsRemote`,gO=`sentry.graphql.operation`;function _O(e){if(`parentSpanId`in e)return e.parentSpanId;if(`parentSpanContext`in e)return e.parentSpanContext?.spanId}function vO(e){return j(e.attributes)}function yO(e){return typeof e.kind==`number`}function bO(e){return!!e.status}function xO(e){return!!e.name}function SO(e){if(!vO(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=_f(t);n.url=yf(e),e.search&&(n[`http.query`]=e.search),e.hash&&(n[`http.fragment`]=e.hash)}}catch{}return n}function CO(e){return yO(e)?e.kind:t.INTERNAL}var wO=`sentry-trace`,TO=`baggage`,EO=`sentry.dsc`,DO=`sentry.sampled_not_recording`,OO=`sentry.url`,kO=`sentry.sample_rand`,AO=`sentry.sample_rate`,jO=`sentry.ignored`,MO=`sentry.segment_ignored`,NO=u(`sentry_scopes`),PO=u(`sentry_fork_isolation_scope`),FO=u(`sentry_fork_set_scope`),IO=u(`sentry_fork_set_isolation_scope`),LO=`_scopeContext`;function RO(e){return e.getValue(NO)}function zO(e,t){return e.setValue(NO,t)}function BO(e,t){Jt(e,LO,Zn(t))}function VO(e){return Qn(e[LO])}function HO(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(DO)===`1`:!1;if(t===i.SAMPLED)return!0;if(r)return!1;let a=n?n.get(EO):void 0,o=a?ui(a):void 0;if(o?.sampled===`true`)return!0;if(o?.sampled===`false`)return!1}function UO(e,t){let n=e.spanContext(),r=na(e),i=HO(n);if(i!==void 0)return i;if(So(r))return!1;if(oa(t?.getOptions())&&!n.isRemote&&qi(r))return Ji(e)}function WO(e,t,n){let r=t[`http.request.method`]||t[`http.method`];if(r)return qO({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 KO({attributes:t,name:e});let o=t[`sentry.source`]===`custom`?`custom`:`route`;if(t[`rpc.service`])return{...XO(e,t,`route`),op:`rpc`};if(t[`messaging.system`])return{...XO(e,t,o),op:`message`};let s=t[Js];return s?{...XO(e,t,o),op:s.toString()}:{op:void 0,description:e,source:`custom`}}function GO(e){let t,n;if(vO(e))t=e.attributes,n=xO(e)?e.name:`<unknown>`;else{let r=typeof e.spanContext==`function`?L(e):void 0;t=r?.data||{},n=xO(e)?e.name:r?.description||`<unknown>`}let r=CO(e);return WO(n,t,r)}function KO({attributes:e,name:t}){let n=e[Br];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[Rs];return{op:`db`,description:r?r.toString():t,source:`task`}}function qO({name:e,kind:n,attributes:r},i){let a=[`http`];switch(n){case t.CLIENT:a.push(`client`);break;case t.SERVER:a.push(`server`)}r[`sentry.http.prefetch`]&&a.push(`prefetch`);let{urlPath:o,url:s,query:c,fragment:l,hasRoute:u}=YO(r,n);if(!o)return{...XO(e,r),op:a.join(`.`)};let d=r[gO],f=`${i} ${o}`,p=d?`${f} (${JO(d)})`:f,m=u||o===`/`?`route`:`url`,h={};s&&(h.url=s),c&&(h[`http.query`]=c.slice(1)),l&&(h[`http.fragment`]=l.slice(1));let g=n===t.CLIENT||n===t.SERVER,_=!`${r[`sentry.origin`]||`manual`}`.startsWith(`auto`),v=r[kr]===`custom`,y=r[Br],{description:ee,source:b}=!v&&y==null&&(g||!_)?{description:p,source:m}:XO(e,r);return{op:a.join(`.`),description:ee,source:b,data:h}}function JO(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 YO(e,n){let r=e[Ac],i=e[`http.url`]||e[`url.full`],a=e[Dc],o=typeof i==`string`?_f(i):void 0,s=o?yf(o):void 0,c=o?.search||void 0,l=o?.hash||void 0;return typeof a==`string`?{urlPath:a,url:s,query:c,fragment:l,hasRoute:!0}:n===t.SERVER&&typeof r==`string`?{urlPath:vf(r),url:s,query:c,fragment:l,hasRoute:!1}:o?{urlPath:s,url:s,query:c,fragment:l,hasRoute:!1}:typeof r==`string`?{urlPath:vf(r),url:s,query:c,fragment:l,hasRoute:!1}:{urlPath:void 0,url:s,query:c,fragment:l,hasRoute:!1}}function XO(e,t,n=`custom`){let r=t[`sentry.source`]||n,i=t[Br];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=L(n),i=r.data[kr],a=UO(n,e);if(a===!1)delete t.transaction;else if(r.description){let{description:e}=GO(n);i!==`url`&&e&&(t.transaction=e)}oa()&&(t.sampled=a==null?void 0:String(a))})}function QO(){return _.getActiveSpan()}var $O=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,ek=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 tk({dsc:e,sampled:t}){let n=e?di(e):void 0,r=new ek,i=n?r.set(EO,n):r;return t===!1?i.set(DO,`1`):i}var nk=new Set;function rk(){return Array.from(nk)}function ik(e){nk.add(e)}var ak=class extends dO{constructor(){super(),ik(`SentryPropagator`),this._urlMatchesTargetsMap=new fb(100)}inject(e,t,n){if(iO(e)){$O&&A.log(`[Tracing] Not injecting trace data for url because tracing is suppressed.`);return}let r=_.getSpan(e),i=r&&fk(r),{tracePropagationTargets:a,propagateTraceparent:o}=P()?.getOptions()||{};if(!Of(i,a,this._urlMatchesTargetsMap)){$O&&A.log(`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`,i);return}let s=uk(t),c=dk(t),l=p.getBaggage(e)||p.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:f,sampled:m}=ok(e);if(s){let e=fi(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(`${li}${t}`,{value:n}):e,l)),!c&&d&&d!==`00000000000000000000000000000000`&&(n.set(t,wO,Ai(d,f,m)),o&&n.set(t,`traceparent`,ji(d,f,m))),super.inject(p.setBaggage(e,l),t,n)}extract(e,t,n){let r=n.get(t,wO),i=n.get(t,TO);return lk(sk(e,{sentryTrace:r?Array.isArray(r)?r[0]:r:void 0,baggage:i}))}fields(){return[wO,TO,`traceparent`]}};function ok(e,t={}){let n=_.getSpan(e);if(n?.spanContext().isRemote){let e=n.spanContext();return{dynamicSamplingContext:ba(n),traceId:e.traceId,spanId:void 0,sampled:HO(e)}}if(n){let e=n.spanContext();return{dynamicSamplingContext:ba(n),traceId:e.traceId,spanId:e.spanId,sampled:UO(n,t.client)}}let r=t.scope||RO(e)?.scope||M(),i=t.client||P(),a=r.getPropagationContext();return{dynamicSamplingContext:i?ya(i,r):void 0,traceId:a.traceId,spanId:a.propagationSpanId,sampled:a.sampled}}function sk(e,{sentryTrace:t,baggage:n}){let{traceId:r,parentSpanId:i,sampled:a,dsc:o}=ki(t,n),s=P(),c=ui(n);if(!i||s&&!Ni(s,c?.org_id))return e;let l=pk({traceId:r,spanId:i,sampled:a,dsc:o});return _.setSpanContext(e,l)}function ck(e,t,n){let r=lk(sk(e,t));return l.with(r,n)}function lk(e){let t=RO(e);return zO(e,{scope:t?t.scope:M().clone(),isolationScope:t?t.isolationScope:N()})}function uk(e){try{let t=e[TO];return Array.isArray(t)?t.join(`,`):t}catch{return}}function dk(e){try{return e[wO]}catch{return}}function fk(e){let t=L(e).data,n=t[`http.url`]||t[`url.full`];if(typeof n==`string`)return n;let r=e.spanContext().traceState?.get(OO);if(r)return r}function pk({spanId:e,traceId:t,sampled:n,dsc:r}){let a=tk({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?i.SAMPLED:i.NONE,traceState:a}}function mk(e,t,n){let r=yk(),{name:i,parentSpan:a}=e;return Ok(a)(()=>{let a=Ck(e.scope,e.forceTransaction),o=e.onlyIfParent&&!_.getSpan(a),s=o?rO(a):a;o&&P()?.recordDroppedEvent(`no_parent_span`,`span`);let c=bk(e);if(!oa()){let e=iO(s)?s:rO(s);return l.with(e,()=>r.startActiveSpan(i,c,e,e=>(Sk(e),l.with(a,()=>to(()=>t(e),()=>{L(e).status===void 0&&e.setStatus({code:oe.ERROR})},n?()=>e.end():void 0)))))}return r.startActiveSpan(i,c,s,e=>(Sk(e),to(()=>t(e),()=>{L(e).status===void 0&&e.setStatus({code:oe.ERROR})},n?()=>e.end():void 0)))})}function hk(e,t){return mk(e,t,!0)}function gk(e,t){return mk(e,e=>t(e,()=>e.end()),!1)}function _k(e){let t=yk(),{name:n,parentSpan:r}=e;return Ok(r)(()=>{let r=Ck(e.scope,e.forceTransaction),i=e.onlyIfParent&&!_.getSpan(r),a=i?rO(r):r;i&&P()?.recordDroppedEvent(`no_parent_span`,`span`);let o=bk(e);oa()||(a=iO(a)?a:rO(a));let s=t.startSpan(n,o,a);return Sk(s),s})}function vk(e,t){let n=e?_.setSpan(l.active(),e):_.deleteSpan(l.active());return l.with(n,()=>t(M()))}function yk(){return P()?.tracer||_.getTracer(`@sentry/opentelemetry`,`10.73.0`)}function bk(e){let{startTime:t,attributes:n,kind:r,op:i,links:a}=e,o=typeof t==`number`?xk(t):t;return{attributes:i?{[F]:i,...n}:n,kind:r,links:a,startTime:o}}function xk(e){return e<9999999999?e*1e3:e}function Sk(e){let t=e.end.bind(e);e.end=e=>t(typeof e==`number`?xk(e):e)}function Ck(e,t){let n=wk(e),r=_.getSpan(n);if(!r||!t)return n;let a=_.deleteSpan(n),{spanId:o,traceId:s}=r.spanContext(),c=HO(r.spanContext()),l=tk({dsc:ba(na(r)),sampled:c}),u={traceId:s,spanId:o,isRemote:!0,traceFlags:c?i.SAMPLED:i.NONE,traceState:l};return _.setSpanContext(a,u)}function wk(e){if(e){let t=VO(e);if(t)return t}return l.active()}function Tk(e,t){return ck(l.active(),e,t)}function Ek(e){let t=Yn(),n={traceId:t,spanId:Xn(),isRemote:!0,traceFlags:i.NONE},r=_.setSpanContext(l.active(),n);return l.with(r,()=>(M().setPropagationContext({traceId:t,sampleRand:rn()}),e()))}function Dk(e,t){let n=VO(t),r=n&&_.getSpan(n),i=r?Ii(r):Or(t);return[r?ba(r):ya(e,t),i]}function Ok(e){return e===void 0?e=>e():t=>vk(e,t)}function kk(e){let t=rO(l.active());return l.with(t,e)}function Ak(e){let t=e?VO(e):l.active();return t?iO(t):!1}function jk(e){e.on(`preprocessEvent`,e=>{let t=QO();return!t||e.type===`transaction`?void 0:(e.contexts={trace:Ii(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ba(na(t)),...e.sdkProcessingMetadata},e)})}function Mk(e,t){let n=_.getSpan(e),r;if(n?.spanContext().traceState?.get(`sentry.ignored`)===`1`){let n=_.deleteSpan(e),i=_.getSpan(t);r=i?_.setSpan(n,i):n}else r=e;let i=RO(r),a=i?.scope||M(),o=i?.isolationScope||N(),s=r.getValue(PO)===!0,c=r.getValue(FO),l=r.getValue(IO),u=c||a.clone(),d={scope:u,isolationScope:l||(s?o.clone():o)},f=zO(r,d).deleteValue(PO).deleteValue(FO).deleteValue(IO);return BO(u,f),f}function Nk(e){let t=new Map;for(let n of e)Fk(t,n);return Array.from(t,function([e,t]){return t})}function Pk(e){return e.attributes[hO]===!0?void 0:_O(e)}function Fk(e,t){let n=t.spanContext().spanId,r=Pk(t);if(!r){Lk(e,{id:n,span:t,children:[]});return}let i=Ik(e,r),a=Lk(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(a)}function Ik(e,t){return e.get(t)||Lk(e,{id:t,children:[]})}function Lk(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 Rk={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`},zk=e=>Object.values(Rk).includes(e);function Bk(e){let t=vO(e)?e.attributes:{},n=bO(e)?e.status:void 0;if(n){if(n.code===oe.OK)return{code:1};if(n.code===oe.ERROR){if(n.message===void 0){let e=Vk(t);if(e)return e}return n.message&&zk(n.message)?{code:2,message:n.message}:{code:2,message:`internal_error`}}}return Vk(t)||(n?.code===oe.UNSET?{code:1}:{code:2,message:`unknown_error`})}function Vk(e){let t=e[`http.response.status_code`]||e[`http.status_code`],n=e[$c],r=typeof t==`number`?t:typeof t==`string`?parseInt(t):void 0;if(typeof r==`number`)return Jr(r);if(typeof n==`string`)return{code:2,message:Rk[n]||`unknown_error`}}var Hk=1e3,Uk=300,Wk=1e4,Gk=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||Uk,this._finishedSpanBuckets=Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(an()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new fb(Wk),this._debouncedFlush=Co(this.flush.bind(this),1,{maxWait:100})}export(e){let t=Math.floor(an()/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&&$O&&A.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=Pk(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;$O&&A.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=Nk(e),n=new Set,r=this._getCompletedRootNodes(t);for(let e of r){let t=e.span;n.add(t);let r=qk(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)Jk(t,i,n)&&(a=!0);r.spans=i.length>Hk?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,Hk):i,a&&(r.sdkProcessingMetadata={...r.sdkProcessingMetadata,hasGenAiSpans:!0});let o=Ga(t.events);o&&(r.measurements=o),Zl(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 Kk(e){let t=e.attributes;return{origin:t[I],op:t[F],source:t[kr]}}function qk(e){let{op:t,description:n,data:r,origin:i=`manual`,source:a}=Yk(e),o=ni(e),s=e.attributes[Ar],c={[kr]:a,[Ar]:s,[F]:t,[I]:i,...r,...Xk(e.attributes)},{links:l}=e,{traceId:u,spanId:d}=e.spanContext(),f={parent_span_id:_O(e),span_id:d,trace_id:u,data:c,origin:i,op:t,status:Yi(Bk(e)),links:zi(l)},p=c[Ec],m=typeof p==`number`?{response:{status_code:p}}:void 0;return{contexts:{trace:f,otel:{resource:e.resource.attributes},...m},spans:[],start_timestamp:Vi(e.startTime),timestamp:Vi(e.endTime),transaction:n,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:o.scope,capturedSpanIsolationScope:o.isolationScope,sampleRate:s,dynamicSamplingContext:ba(e)},...a&&{transaction_info:{source:a}}}}function Jk(e,t,n){let r=e.span;if(r&&n.add(r),!r){let r=!1;return e.children.forEach(e=>{Jk(e,t,n)&&(r=!0)}),r}let i=r.spanContext().spanId,a=r.spanContext().traceId,o=_O(r),{attributes:s,startTime:c,endTime:l,links:u}=r,{op:d,description:f,data:p,origin:m=`manual`}=Yk(r),h={[I]:m,[F]:d,...Xk(s),...p},g=Bk(r),_={span_id:i,trace_id:a,data:h,description:f,parent_span_id:o,start_timestamp:Vi(c),timestamp:Vi(l)||void 0,status:Yi(g),op:d,origin:m,measurements:Ga(r.events),links:zi(u)};t.push(_);let v=!!d?.startsWith(`gen_ai.`);return e.children.forEach(e=>{Jk(e,t,n)&&(v=!0)}),v}function Yk(e){let{op:t,source:n,origin:r}=Kk(e),{op:i,description:a,source:o,data:s}=GO(e);return{op:t||i,description:a,source:n||o,origin:r,data:{...s,...Zk(e)}}}function Xk(e){let t={...e};return delete t[Ar],delete t[hO],delete t[Br],t}function Zk(e){let n=e.attributes,r={};e.kind!==t.INTERNAL&&(r[`otel.kind`]=t[e.kind]);let i=n[kc];i&&(r[Ec]=i);let a=SO(e);return a.url&&(r.url=a.url),a[`http.query`]&&(r[`http.query`]=a[`http.query`].slice(1)),a[`http.fragment`]&&(r[`http.fragment`]=a[`http.fragment`].slice(1)),r}function Qk(e,t){let n=e.attributes??{},r=t?.spanKind??G.INTERNAL,{op:i,description:a,source:o,data:s}=WO(e.name,n,r);e.name=a,Sl(e,{[F]:i,[kr]:o,[al]:`manual`,...s}),r!==G.INTERNAL&&Sl(e,{"otel.kind":Hf(r)})}var $k=class{constructor(e){this._unsubscribePreprocessSpan=void 0,ik(`SentrySpanProcessor`),this._exporter=new Gk(e),this._client=e?.client??P(),this._client&&Ja(this._client)&&(this._unsubscribePreprocessSpan=this._client.on(`preprocessSpan`,Qk))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(e,t){let n=_.getSpan(t),i=RO(t);n&&!n.spanContext().isRemote&&ea(n,e),n?.spanContext().isRemote&&e.setAttribute(hO,!0),t===r&&(i={scope:ir(),isolationScope:ar()}),i&&ti(e,i.scope,i.isolationScope),Ha(e),this._client?.emit(`spanStart`,e)}onEnd(e){Ua(e),this._client?.emit(`spanEnd`,e),this._client&&Ja(this._client)?this._client.emit(`afterSpanEnd`,e):this._exporter.export(e)}},eA=class{constructor(e){this._client=e,this._isSpanStreaming=Ja(e),ik(`SentrySampler`)}shouldSample(e,n,r,i,a,o){let s=this._client.getOptions(),{ignoreSpans:c}=s,l=iA(e),u=l?.spanContext();if(!oa(s))return nA({decision:void 0,context:e,spanAttributes:a});let d=a[`http.method`]||a[`http.request.method`];if(i===t.CLIENT&&d&&(!l||u?.isRemote)&&!this._isSpanStreaming)return this._client.recordDroppedEvent(`no_parent_span`,`span`),nA({decision:void 0,context:e,spanAttributes:a});let f=l?tA(l,n,r):void 0;if(l&&!u?.isRemote){if(this._isSpanStreaming){if(f&&c?.length){let{description:t,op:n}=WO(r,a,i);if(ca({description:t,op:a[`sentry.op`]??n,attributes:a},c))return this._client.recordDroppedEvent(`ignored`,`span`),nA({decision:DD.NOT_RECORD,context:e,spanAttributes:a,ignoredChildSpan:!0})}if(!f){let e=u?.traceState?.get(MO)===`1`;this._client.recordDroppedEvent(e?`ignored`:`sample_rate`,`span`)}}return nA({decision:f?DD.RECORD_AND_SAMPLED:DD.NOT_RECORD,context:e,spanAttributes:a})}let{description:p,data:m,op:h}=WO(r,a,i),g={...m,...a};if(h&&(g[F]=h),this._isSpanStreaming&&c?.length&&ca({description:p,op:g[`sentry.op`]??h,attributes:g},c))return this._client.recordDroppedEvent(`ignored`,`span`),nA({decision:DD.NOT_RECORD,context:e,spanAttributes:a,ignoredSegmentSpan:!0});let _={decision:!0};if(this._client.emit(`beforeSampling`,{spanAttributes:g,spanName:p,parentSampled:f,parentContext:u},_),!_.decision)return nA({decision:void 0,context:e,spanAttributes:a});let{isolationScope:v}=RO(e)??{},y=u?.traceState?u.traceState.get(EO):void 0,ee=y?ui(y):void 0,b=Ei(ee?.sample_rand)??rn(),[te,x,ne]=ro(s,{name:p,attributes:g,normalizedRequest:v?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:f,parentSampleRate:Ei(ee?.sample_rate)},b),re=`${d}`.toUpperCase();return re===`OPTIONS`||re===`HEAD`?($O&&A.log(`[Tracing] Not sampling span because HTTP method is '${re}' for ${r}`),nA({decision:DD.NOT_RECORD,context:e,spanAttributes:a,sampleRand:b,downstreamTraceSampleRate:0})):(!te&&f===void 0&&($O&&A.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),this._client.recordDroppedEvent(`sample_rate`,this._isSpanStreaming?`span`:`transaction`)),{...nA({decision:te?DD.RECORD_AND_SAMPLED:DD.NOT_RECORD,context:e,spanAttributes:a,sampleRand:b,downstreamTraceSampleRate:ne?x:void 0}),attributes:{[Ar]:ne?x:void 0}})}toString(){return`SentrySampler`}};function tA(e,t,n){let r=e.spanContext();if(y(r)&&r.traceId===t){if(r.isRemote){let t=HO(e.spanContext());return $O&&A.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${t}`),t}let t=HO(r);return $O&&A.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${t}`),t}}function nA({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:a,ignoredSegmentSpan:o}){let s=rA(t,n);return i!==void 0&&(s=s.set(AO,`${i}`)),r!==void 0&&(s=s.set(kO,`${r}`)),a&&(s=s.set(jO,`1`)),o&&(s=s.set(MO,`1`)),e==null?{decision:DD.NOT_RECORD,traceState:s}:e===DD.NOT_RECORD?{decision:e,traceState:s.set(DO,`1`)}:{decision:e,traceState:s}}function rA(e,t){let n=_.getSpan(e)?.spanContext()?.traceState||new ek,r=t[`http.url`]||t[`url.full`];return r&&typeof r==`string`&&(n=n.set(OO,r)),n}function iA(e){let t=_.getSpan(e);return t&&y(t.spanContext())?t:void 0}function aA(e,n={}){let r=L(e),i=r.data,a=e.kind??t.INTERNAL,o=ii(e),s=i[Br]!==void 0,c=o&&!s&&!oi(e),l=c&&i[`sentry.source`]===`custom`?{...i,[kr]:void 0}:i,u=WO(r.description||`<unknown>`,l,a);if(a!==t.INTERNAL&&i[`otel.kind`]===void 0&&e.setAttribute(`otel.kind`,t[a]),u.op&&i[`sentry.op`]===void 0&&e.setAttribute(F,u.op),u.source!==void 0&&u.source!==`custom`&&(n.finalizeStatus||u.source!==`url`)&&(r.parent_span_id===void 0||a===t.SERVER)&&(i[`sentry.source`]===void 0||c)&&e.setAttribute(kr,u.source),u.data&&Object.entries(u.data).forEach(([t,n])=>{n!==void 0&&i[t]===void 0&&e.setAttribute(t,n)}),n.finalizeStatus){cA(e,i);let t=P();sA(e,i,r.status,!!t&&Ja(t))}o&&u.description!==r.description&&(i[`sentry.source`]!==`custom`||c)&&e.updateName(u.description)}function oA(e,n){Jt(e,`kind`,n??t.INTERNAL)}function sA(e,t,n,r){if(n===void 0){e.setStatus(Vk(t)||{code:1});return}!r&&n!==`ok`&&!zk(n)&&e.setStatus({code:2,message:`internal_error`})}function cA(e,t){let n=t[kc];t[`http.response.status_code`]===void 0&&n!==void 0&&(e.setAttribute(Ec,n),t[Ec]=n)}var lA=class{startSpan(e,t={},n){let r=n||l.active(),i=t.root?void 0:_.getSpan(r);if(iO(r))return this._createNonRecordingSpan(i);let a=this._startSentrySpan(e,t,i,n!==void 0);return si(a),oA(a,t.kind),t.attributes?.[`sentry.source`]===void 0&&ri(a),aA(a),a}startActiveSpan(e,t,n,r){let i=typeof t==`function`?{}:t,a=typeof n==`function`||n===void 0?l.active():n,o=typeof t==`function`?t:typeof n==`function`?n:r,s=this.startSpan(e,i,a),c=ni(s).isolationScope,u=e=>c?e.setValue(IO,c):e;return So(s)&&_.getSpan(a)?l.with(u(a),()=>o(s)):l.with(u(_.setSpan(a,s)),()=>(er(M(),s),o(s)))}_startSentrySpan(e,t,n,r){let i={name:e,attributes:t.attributes,links:t.links,startTime:t.startTime};return t.root?fo(()=>oo({...i,parentSpan:null})):n?.spanContext().isRemote?this._startRootSpanWithRemoteParent(i,n):n?oo({...i,parentSpan:n}):fo(()=>oo({...i,parentSpan:r?null:void 0}))}_startRootSpanWithRemoteParent(e,t){let{spanId:n,traceId:r,traceState:i}=t.spanContext(),a=ba(t),o=typeof a.sample_rand==`string`?Number(a.sample_rand):void 0,s=!!i?.get(EO);return Er(i=>(i.setPropagationContext({traceId:r,parentSpanId:n,sampled:HO(t.spanContext()),dsc:s?a:void 0,sampleRand:typeof o==`number`&&!Number.isNaN(o)?o:rn()}),er(i,void 0),oo({...e,parentSpan:null})))}_createNonRecordingSpan(e){let t=new pa({traceId:e?.spanContext().traceId});return e&&ea(e,t),ti(t,M(),N()),t}},uA=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 lA;return this._tracers.set(r,a),a}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},dA=`telemetry.sdk.language`,fA=`telemetry.sdk.name`,pA=`telemetry.sdk.version`,mA=`service.namespace`,hA=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 gA(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 _A(e){let t=typeof process<`u`?process.env:{},n=t.OTEL_SERVICE_NAME,r=gA(t.OTEL_RESOURCE_ATTRIBUTES);return new hA({[mA]:`sentry`,[pl]:e,...r,...n?{[pl]:n}:{},[ml]:k,[dA]:mO[dA],[fA]:mO[fA],[pA]:mO[pA]})}function vA({span:e,scope:t,client:n,propagateTraceparent:r}={}){let i=(t&&VO(t))??l.active();if(e){let{scope:t}=ni(e);i=t&&VO(t)||_.setSpan(l.active(),e)}let{traceId:a,spanId:o,sampled:s,dynamicSamplingContext:c}=ok(i,{scope:t,client:n}),u={"sentry-trace":Ai(a,o,s),baggage:di(c)};return r&&(u.traceparent=ji(a,o,s)),u}function yA(e){function t(){return RO(l.active())||{scope:ir(),isolationScope:ar()}}function n(e){let t=l.active();return l.with(t,()=>e(o()))}function r(e,t){let n=VO(e)||l.active();return l.with(n.setValue(FO,e),()=>t(e))}function i(e){let t=l.active();return l.with(t.setValue(PO,!0),()=>e(s()))}function a(e,t){let n=l.active();return l.with(n.setValue(IO,e),()=>t(s()))}function o(){return t().scope}function s(){return t().isolationScope}gr({withScope:n,withSetScope:r,withSetIsolationScope:a,withIsolationScope:i,getCurrentScope:o,getIsolationScope:s,startSpan:hk,startSpanManual:gk,startInactiveSpan:_k,getActiveSpan:QO,suppressTracing:kk,isTracingSuppressed:Ak,getTraceData:vA,continueTrace:Tk,startNewTrace:Ek,withActiveSpan:vk,getTracingChannelBinding:e?.getTracingChannelBinding})}x();var bA=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`],xA=class{constructor(){this._kOtListeners=Symbol(`OtListeners`),this._wrapped=!1,ik(`SentryContextManager`),this._asyncLocalStorage=_r(it()).getTracingChannelBinding?.()?.asyncLocalStorage??new ze}active(){return this._asyncLocalStorage.getStore()??r}with(e,t,n,...r){let i=Mk(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 Me?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:NO}}_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 bA)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 SA(e){yA({getTracingChannelBinding:e?.skipOpenTelemetrySetup?wA():CA()})}function CA(){let e=new ze;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:TA})}function wA(){return()=>{try{let e=l._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return e?{asyncLocalStorage:e,getStoreWithActiveSpan:TA}:void 0}catch{return}}}function TA(e){let t=l.active();return So(e)&&na(e)!==e||e.spanContext().traceState?.get(`sentry.ignored`)===`1`?t:_.setSpan(t,e)}var EA=xA;x();function DA(){h.disable(),h.setLogger({error:A.error,warn:A.warn,info:A.log,debug:A.log,verbose:A.log},ne.DEBUG)}var OA={};function Y(e,t,n){return n?AA(e,t,n):kA(e,t)}function kA(e,t){return Object.assign(n=>{let r=OA[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return OA[e]=i,Cw({instrumentations:[i]}),i},{id:e})}function AA(e,t,n){return Object.assign(r=>{let i=n(r),a=OA[e];if(a)return a.setConfig(i),a;let o=new t(i);return OA[e]=o,Cw({instrumentations:[o]}),o},{id:e})}var jA=`ChildProcess`,MA=W((e={})=>({name:jA,setup(){C.channel(`child_process`).subscribe(t=>{j(t)&&`process`in t&&NA(t.process,e)}),C.channel(`worker_threads`).subscribe(t=>{j(t)&&`worker`in t&&PA(t.worker,e)})}}));function NA(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&&Wf({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Wf({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function PA(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Wf({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):H(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}var FA=Le(De),IA=Le(ke),LA=`Context`,RA=W(((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?WA():void 0,r=t.device?GA(t.device):void 0,i=t.culture?UA():void 0,a=t.cloudResource?$A():void 0,o=t.os?HA():void 0,s={"process.runtime.engine.name":`v8`,"process.runtime.engine.version":process.versions.v8,...BA({app:n,device:r,culture:i,cloud_resource:a})};o&&o.then(e=>Object.assign(s,BA({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=zA(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:LA,processEvent(e){return l(e)},processSegmentSpan(e){Sl(e,s),Sl(e,VA(n,r))}}}));function zA(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=fe.freemem()),e}function BA(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 VA(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`]=fe.freemem()),n}async function HA(){let e=fe.platform();switch(e){case`darwin`:return XA();case`linux`:return QA();default:return{name:KA[e]||e,version:fe.release()}}}function UA(){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 WA(){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 GA(e){let t={},n;try{n=fe.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=fe.arch(),(e===!0||e.memory)&&(t.memory_size=fe.totalmem(),t.free_memory=fe.freemem()),e===!0||e.cpu){let e=fe.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}var KA={aix:`IBM AIX`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,sunos:`SunOS`,win32:`Windows`,ohos:`OpenHarmony`,android:`Android`},qA=[{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`]}],JA={alpine:e=>e,arch:e=>YA(/distrib_release=(.*)/,e),centos:e=>YA(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>YA(/release (..)/,e),mint:e=>YA(/distrib_release=(.*)/,e),red:e=>YA(/release ([^ ]+)/,e),suse:e=>YA(/VERSION = (.*)\n/,e),ubuntu:e=>YA(/distrib_release=(.*)/,e)};function YA(e,t){let n=e.exec(t);return n?n[1]:void 0}async function XA(){let e={kernel_version:fe.release(),name:`Mac OS X`,version:`10.${Number(fe.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{de(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=YA(/^ProductName:\s+(.*)$/m,t),e.version=YA(/^ProductVersion:\s+(.*)$/m,t),e.build=YA(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function ZA(e){return e.split(` `)[0].toLowerCase()}async function QA(){let e={kernel_version:fe.release(),name:`Linux`};try{let t=await IA(`/etc`),n=qA.find(e=>t.includes(e.name));if(!n)return e;let r=(await FA(he(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(ZA(e))>=0)||i[0],e.version=JA[ZA(e.name)]?.(r)}catch{}return e}function $A(){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 ej=new fb(10),tj=new fb(20),nj=7,rj=`ContextLines`;function ij(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function aj(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function oj(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function sj(e,t){let n=ej.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 cj(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=gj(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=gj(r,t)),n++}return a}function lj(e,t,n){return new Promise((r,i)=>{let a=Ee(e),o=$e({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){tj.set(e,1),JC&&A.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]=Sn(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 uj(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`||aj(i)||oj(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(tj.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=cj(r,t);if(a.every(t=>sj(e,t)))continue;let o=ij(ej,e,{});i.push(lj(e,a,o))}if(await Promise.all(i).catch(()=>{JC&&A.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&&dj(n.stacktrace.frames,t,ej);return e}function dj(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;pj(r.lineno,r,t,e)}}function fj(e){delete e.pre_context,delete e.context_line,delete e.post_context}function pj(e,t,n,r){if(t.lineno===void 0||r===void 0){JC&&A.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=mj(e,n);i<e;i++){let e=r[i];if(e===void 0){fj(t),JC&&A.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){fj(t),JC&&A.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=hj(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 mj(e,t){return Math.max(1,e-t)}function hj(e,t){return e+t}function gj(e,t){return[mj(e,t),hj(e,t)]}var _j=W(((e={})=>({name:rj,processEvent(t,n,r){return uj(t,e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??nj)}}))),vj;async function yj(){if(vj===void 0)try{vj=!!(await import(`node:inspector`)).url()}catch{vj=!1}return vj}function bj(e,t){return rf(e,t)}var xj=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Sj(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 Cj(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function wj(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Cj(e)&&Cj(t)}var Tj=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjczLjAgKGYxMDlkOTIpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluY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BsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`;function Ej(...e){A.log(`[LocalVariables]`,...e)}var Dj=W(((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||!wj(s.function,o.function)||(s.vars=bj(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=P()?.getDataCollectionOptions().stackFrameVariables??!0;for(let i of e.exception?.values||[])t(i,n.originalException[xj],r);n.originalException[xj]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new Ke(new URL(`data:application/javascript;base64,${Tj}`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{Ej(`Worker error`,e)}),t.once(`exit`,e=>{Ej(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await yj()){A.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}let n={...e,debug:A.isEnabled()};r().then(()=>{try{i(n)}catch(e){A.error(`Failed to start worker`,e)}},e=>{A.error(`Failed to start inspector`,e)})},processEvent(e,t){return n(e,t)}}}));function Oj(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function kj(e,t){if(t!==void 0)return Oj(e(t,1))}function Aj(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 jj=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}=Aj(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)}},Mj=`LocalVariables`,Nj=W(((e={},t)=>{let n=new fb(20),r,i=!1;function a(t,r){let i=Oj(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||!wj(s.function,i.function)||(s.vars=bj(i.vars,r))}}function o(e){for(let t of e.exception?.values||[])a(t,P()?.getDataCollectionOptions().stackFrameVariables??!0);return e}let s;async function c(){let a=P()?.getOptions();if(a?.includeLocalVariables){if(jT<18){A.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await yj()){A.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await jj.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=kj(e,i.description);if(c==null){s();return}let{add:l,next:u}=Aj(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=Sj(e.maxExceptionsPerSecond||50,()=>{A.log(`Local variables rate-limit lifted.`),o.setPauseOnExceptions(!0)},e=>{A.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${e} seconds.`),o.setPauseOnExceptions(!1)})),i=!0}catch(e){A.log("The `LocalVariables` integration failed to start.",e)}}}return{name:Mj,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}})),Pj=(e={})=>AT.major<19?Nj(e):Dj(e),Fj,Ij=`Modules`;function Lj(){return typeof __SENTRY_SERVER_MODULES__<`u`?__SENTRY_SERVER_MODULES__:O.__SENTRY_SERVER_MODULES__??{}}var Rj=(()=>({name:Ij,processEvent(e){return e.modules={...e.modules,...Bj()},e},getModules:Bj}));function zj(){return{...Lj(),...Hj()}}function Bj(){return Fj||=zj(),Fj}function Vj(){try{let e=he(process.cwd(),`package.json`);return JSON.parse(Oe(e,`utf8`))}catch{return{}}}function Hj(){let e=Vj();return{...e.dependencies,...e.devDependencies}}var Uj=2e3;function Wj(e){ut(()=>{console.error(e)});let t=P();if(t===void 0){JC&&A.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:Uj;t.close(r).then(e=>{e||JC&&A.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{JC&&A.error(e)})}var Gj=`OnUncaughtException`,Kj=W((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:Gj,setup(e){Xe&&global.process.on(`uncaughtException`,qj(e,t))}}});function qj(e,t){let n=!1,r=!1,i=!1,a,o=e.getOptions();return Object.assign(s=>{let c=Wj;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?(JC&&A.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),Wj(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,P()===e&&H(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}var Jj=`OnUnhandledRejection`,Yj=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],Xj=W(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...Yj,...e.ignore??[]]};return{name:Jj,setup(e){global.process.on(`unhandledRejection`,eM(e,t))}}}));function Zj(e){if(!j(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 Qj(e,t){let n=e.name===void 0||wn(t.name,e.name,!0),r=e.message===void 0||wn(t.message,e.message);return n&&r}function $j(e,t){let n=Zj(t);return e.some(e=>Qj(e,n))}function eM(e,t){return function(n,r){if(P()!==e||$j(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=j(n)?n._sentry_active_span:void 0;(a?e=>V(a,e):e=>e())(()=>{H(n,{originalException:n,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),tM(n,t.mode)}}function tM(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`?ut(()=>{console.warn(n),console.error(j(e)&&`stack`in e?e.stack:e)}):t===`strict`&&(ut(()=>{console.warn(n)}),Wj(e))}var nM=`ProcessSession`,rM=W(()=>({name:nM,setupOnce(){hu(),process.on(`beforeExit`,()=>{N().getSession()?.status===`ok`&&gu()})}})),iM=`Spotlight`,aM=W(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:iM,setup(e){try{process.env.NODE_ENV&&process.env.NODE_ENV!==`development`&&A.warn(`[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?`)}catch{}oM(e,t)}}}));function oM(e,t){let n=sM(t.sidecarUrl);if(!n)return;let r=0;e.on(`beforeEnvelope`,e=>{if(r>3){A.warn(`[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests`);return}let t=ka(e);lo(()=>{let e=Ve.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++,A.warn(`[Spotlight] Failed to send envelope to Spotlight Sidecar`)}),e.write(t),e.end()})})}function sM(e){try{return new URL(`${e}`)}catch{A.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var cM=W((e={})=>({name:`Console`,setup(t){process.env.LAMBDA_TASK_ROOT&&Nt(`console`,lM),Um({...e,filter:[...e.filter||[],`[DEP0205] DeprecationWarning`]}).setup?.(t)}}));function lM(){let e=O?.console;e&&st.forEach(t=>{t in e&&uM(e,t)})}function uM(e,t){let n=e[t];lt[t]=n;let r=n,i,a=!1,o=function(...i){if(a){n.apply(e,i);return}a=!0;try{Pt(`console`,{args:i,level:t}),r.apply(e,i)}finally{a=!1}};Yt(o,n);let s=n.bind(e);lt[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{qt(e,t,function(e){return lt[t]=e,function(...e){Pt(`console`,{args:e,level:t}),lt[t]?.apply(this,e)}})}}var dM=`NodeSystemError`;function fM(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`||typeof Pe.getSystemErrorMap!=`function`?!1:Pe.getSystemErrorMap().has(e.errno)}var pM=W((e={})=>({name:dM,processEvent:(t,n,r)=>{if(!fM(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}})),mM,hM=Symbol(`AgentBaseInternalState`),gM=class extends (mM=Ve.Agent,mM){constructor(e){super(e),this[hM]={}}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 Ve.Agent)return i.addRequest(e,r);this[hM].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[hM].currentSocket;if(this[hM].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[hM].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[hM]&&(this[hM].defaultPort=e)}get protocol(){return this[hM].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[hM]&&(this[hM].protocol=e)}};function _M(...e){A.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function vM(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(),_M(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),_M(`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){_M(`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}_M(`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 yM(...e){A.log(`[https-proxy-agent]`,...e)}var bM=class extends gM{constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},yM(`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?SM(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:`){yM("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=w.connect({...this.connectOpts,servername:e&&Be.isIP(e)?void 0:e})}else yM("Creating `net.Socket`: %o",this.connectOpts),r=Be.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=Be.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=vM(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`,xM),t.secureEndpoint){yM(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return w.connect({...SM(t,`host`,`path`,`port`),socket:r,servername:Be.isIP(e)?void 0:e})}return r}r.destroy();let u=new Be.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{yM(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};bM.protocols=[`http`,`https`];function xM(e){e.resume()}function SM(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var CM=32768;function wM(e){return new S({read(){this.push(e),this.push(null)}})}function TM(e){let t;try{t=new URL(e.url)}catch{return ut(()=>{console.warn(`[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.`)}),yd(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=EM(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?et:Ve,a=e.keepAlive!==void 0&&e.keepAlive,o=r?new bM(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return yd(e,DM(e,e.httpModule??i,o))}function EM(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function DM(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)=>{lo(()=>{let d=wM(c.body),f={...e.headers};c.body.length>CM&&(f[`content-encoding`]=`gzip`,d=d.pipe(We()));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 OM(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=cf(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 kM(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function AM(e=process.argv[1]?lm(process.argv[1]):process.cwd(),t=_e===`\\`){let n=t?kM(e):e;return e=>{if(!e)return;let r=t?kM(e):e,{dir:i,base:a,ext:o}=ge.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 jM(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(O.SENTRY_RELEASE?.id)return O.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 MM=St(fS(AM()));x();var NM=6e4,PM=class extends mb{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||fe.hostname(),n={...e,platform:`node`,runtime:e.runtime||{name:`node`,version:global.process.version},serverName:t};e.openTelemetryInstrumentations&&Cw({instrumentations:e.openTelemetryInstrumentations}),Cf(n,`node`),A.log(`Initializing Sentry: process: ${process.pid}, thread: ${Xe?`main`:`worker-${Ze}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Ju(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener)),Oo(this)}get tracer(){if(this._tracer)return this._tracer;let e=k,t=_.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(()=>{JC&&A.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??NM).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}_setupIntegrations(){tf(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?Dk(this,e):[void 0,void 0]}},FM;function IM(){return jT>=21||jT===20&&MT>=6||jT===18&&MT>=19||(FM||(FM=!0,ut(()=>{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 LM(){if(IM()&&!O._sentryEsmLoaderHookRegistered){O._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,OT.createAddHookMessageChannel)();Ye.register(`import-in-the-middle/hook.mjs`,import.meta.url,{data:{addHookMessagePort:e,include:[]},transferList:[e]})}catch(e){A.warn(`Failed to register 'import-in-the-middle' hook`,e)}}}function RM(){return[Zf(),qf(),Tp(),jp(),pM(),th(),cM(),zT(),mE(),Kj(),Xj(),_j(),Pj(),RA(),MA(),rM(),Rj()]}function zM(e={}){return BM(e,RM)}function BM(e={},t){let n=HM(e,t);n.debug===!0&&(JC?A.enable():ut(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&LM(),SA(n),M().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===`Spotlight`)&&n.integrations.push(aM({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Cf(n,`node-core`);let r=new PM(n);return M().setClient(r),r.init(),A.log(`SDK initialized from ESM`),r.startClientReportTracking(),GM(),ZO(r),jk(r),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function VM(){if(!JC)return;let e=rk(),t=[`SentryContextManager`,`SentryPropagator`],n=e.includes(`SentryTracerProvider`);oa()&&!n&&t.push(`SentrySpanProcessor`);for(let n of t)e.includes(n)||A.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);!n&&!e.includes(`SentrySampler`)&&A.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 HM(e,t){let n=UM(e.release),r=OM(e.spotlight),i=WM(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??TM,stackParser:Ct(e.stackParser||MM),release:n,tracesSampleRate:i,spotlight:r,debug:cf(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=Eu({defaultIntegrations:e.defaultIntegrations??t(a),integrations:o});return{...a,integrations:s}}function UM(e){if(e!==void 0)return e;let t=jM();if(t!==void 0)return t}function WM(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 GM(){if(cf(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=ki(e,t);M().setPropagationContext(n)}}var KM=e=>({package:e,"javascript.is_cjs":!1});function qM(e,t){let n=P()?.getOptions();!n?.disableInstrumentationWarnings&&!(K(e)||typeof Zt(e)==`function`)&&pu()&&oa(n)&&(ut(()=>{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/.`)}),Tr().setContext(`missing_instrumentation`,KM(t)))}var{isPromise:JM}=Re,YM=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjczLjAgKGYxMDlkOTIpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIG4scGFyZW50UG9ydCBhcyBlfWZyb20ibm9kZTp3b3JrZXJfdGhyZWFkcyI7aW1wb3J0e3Bvc2l4IGFzIHIsc2VwIGFzIG99ZnJvbSJub2RlOnBhdGgiO2ltcG9ydCphcyBpIGZyb20ibm9kZTpodHRwIjtpbXBvcnQqYXMgcyBmcm9tIm5vZGU6aHR0cHMiO2ltcG9ydHtSZWFkYWJsZSBhcyBjfWZyb20ibm9kZTpzdHJlYW0iO2ltcG9ydHtjcmVhdGVHemlwIGFzIHV9ZnJvbSJub2RlOnpsaWIiO2ltcG9ydCphcyBhIGZyb20ibm9kZTpuZXQiO2ltcG9ydCphcyBmIGZyb20ibm9kZTp0bHMiO2NvbnN0IGg9InVuZGVmaW5lZCI9PXR5cGVvZiBfX1NFTlRSWV9ERUJVR19ffHxfX1NFTlRSWV9ERUJVR19fLHA9Z2xvYmFsVGhpcyxkPSIxMC43My4wIjtmdW5jdGlvbiBsKCl7cmV0dXJuIGcocCkscH1mdW5jdGlvbiBnKHQpe2NvbnN0IG49dC5fX1NFTlRSWV9fPXQuX19TRU5UUllfX3x8e307cmV0dXJuIG4udmVyc2lvbj1uLnZlcnNpb258fGQsbltkXT1uW2RdfHx7fX1mdW5jdGlvbiBtKHQsbixlPXApe2NvbnN0IHI9ZS5fX1NFTlRSWV9fPWUuX19TRU5UUllfX3x8e30sbz1yW2RdPXJbZF18fHt9O3JldHVybiBvW3RdfHwob1t0XT1uKCkpfWNvbnN0IHk9e307Zn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D5uK2UmJihpPSEwLHMmJnIoKSksdDxuK2UmJihpPSExKX0sMjApLHtwb2xsOigpPT57by5yZXNldCgpfSxlbmFibGVkOnQ9PntzPXR9fX0oZnVuY3Rpb24oKXtsZXQgdD1wcm9jZXNzLmhydGltZSgpO3JldHVybntnZXRUaW1lTXM6KCk9Pntjb25zdFtuLGVdPXByb2Nlc3MuaHJ0aW1lKHQpO3JldHVybiBNYXRoLmZsb29yKDFlMypuK2UvMWU2KX0scmVzZXQ6KCk9Pnt0PXByb2Nlc3MuaHJ0aW1lKCl9fX0sYW4ucG9sbEludGVydmFsLGFuLmFuclRocmVzaG9sZCxmdW5jdGlvbigpe2RuKCJXYXRjaGRvZyB0aW1lb3V0IiksU24/KGRuKCJQYXVzaW5nIGRlYnVnZ2VyIHRvIGNhcHR1cmUgc3RhY2sgdHJhY2UiKSxTbigpKTooZG4oIkNhcHR1cmluZyBldmVudCB3aXRob3V0IGEgc3RhY2sgdHJhY2UiKSxfbigpLnRoZW4obnVsbCwoKT0+e2RuKCJTZW5kaW5nIEFOUiBldmVudCBmYWlsZWQgb24gd2F0Y2hkb2cgdGltZW91dC4iKX0pKX0pO2U/Lm9uKCJtZXNzYWdlIix0PT57dC5zZXNzaW9uJiYoZm49SCh0LnNlc3Npb24pKSx0LmRlYnVnSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==`,XM=50,ZM=5e3;function QM(e,...t){A.log(`[ANR] ${e}`,...t)}function $M(){return O}function eN(){let e=Ko(N(),M());return e.attachments=[],e.eventProcessors=[],e}async function tN(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 nN=`Anr`,rN=W(((e={})=>{if(AT.major<16||AT.major===16&&AT.minor<17)throw Error(`ANR detection requires Node 16.17.0 or later`);let t,n,r=$M();return r.__SENTRY_GET_SCOPES__=eN,{name:nN,startWorker:()=>{t||n&&(t=iN(n,e))},stopWorker:()=>{t&&t.then(e=>{e(),t=void 0})},async setup(t){n=t,e.captureStackTrace&&await yj()&&(A.warn(`ANR captureStackTrace has been disabled because the debugger was already enabled`),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}));async function iN(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await tN(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:A.isEnabled(),dsn:n,tunnel:i.tunnel,environment:i.environment||`production`,release:i.release,dist:i.dist,sdkMetadata:a,appRootPath:t.appRootPath,pollInterval:t.pollInterval||XM,anrThreshold:t.anrThreshold||ZM,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 Ke(new URL(`data:application/javascript;base64,${YM}`),{workerData:o,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{s.terminate()});let c=setInterval(()=>{try{let e=N().getSession(),t=e?{...e,toJSON:void 0}:void 0;s.postMessage({session:t,debugImages:Rl(i.stackParser)})}catch{}},o.pollInterval);return c.unref(),s.on(`message`,e=>{e===`session-ended`&&(QM(`ANR event sent from ANR worker. Clearing session in this thread.`),N().setSession(void 0))}),s.once(`error`,e=>{clearInterval(c),QM(`ANR worker error`,e)}),s.once(`exit`,e=>{clearInterval(c),QM(`ANR worker exit`,e)}),s.unref(),()=>{s.terminate(),clearInterval(c)}}function aN(e){let t=P()?.getIntegrationByName(nN);if(!t)return e();t.stopWorker();let n=e();return JM(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}function oN(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}),qu({level:e,message:Ie(n,...r),attributes:t},a?.scope)}else qu({level:e,message:n,attributes:r},i?.scope??a?.scope)}var sN=f({debug:()=>lN,error:()=>fN,fatal:()=>pN,fmt:()=>Sf,info:()=>uN,trace:()=>cN,warn:()=>dN});function cN(...e){oN(`trace`,...e)}function lN(...e){oN(`debug`,...e)}function uN(...e){oN(`info`,...e)}function dN(...e){oN(`warn`,...e)}function fN(...e){oN(`error`,...e)}function pN(...e){oN(`fatal`,...e)}var mN=`NodeRuntimeMetrics`,hN=3e4,gN=1e3,_N=10;function vN(e,t,n){return Number.isFinite(e)?e<gN?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${gN}ms. Using minimum of ${gN}ms.`),gN):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var yN=W((e={})=>{let t=vN(e.collectionIntervalMs??hN,mN,hN),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=_N*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=an(),t=e-c;if(i&&o!==void 0){let e=process.cpuUsage(o);n.cpuTime&&(_h(`node.runtime.cpu.user`,e.user/1e6,m),_h(`node.runtime.cpu.system`,e.system/1e6,m)),n.cpuUtilization&&t>0&&_h(`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&&_h(`node.runtime.mem.rss`,e.rss,p),n.memHeapUsed&&_h(`node.runtime.mem.heap_used`,e.heapUsed,p),n.memHeapTotal&&_h(`node.runtime.mem.heap_total`,e.heapTotal,p),n.memExternal&&(_h(`node.runtime.mem.external`,e.external,p),_h(`node.runtime.mem.array_buffers`,e.arrayBuffers,p))}if(r&&l&&(n.eventLoopDelayMin&&_h(`node.runtime.event_loop.delay.min`,d(l.min),m),n.eventLoopDelayMax&&_h(`node.runtime.event_loop.delay.max`,d(l.max),m),n.eventLoopDelayMean&&_h(`node.runtime.event_loop.delay.mean`,d(l.mean),m),n.eventLoopDelayP50&&_h(`node.runtime.event_loop.delay.p50`,d(l.percentile(50)),m),n.eventLoopDelayP90&&_h(`node.runtime.event_loop.delay.p90`,d(l.percentile(90)),m),n.eventLoopDelayP99&&_h(`node.runtime.event_loop.delay.p99`,d(l.percentile(99)),m),l.reset()),n.eventLoopUtilization&&s!==void 0){let e=nt.eventLoopUtilization();_h(`node.runtime.event_loop.utilization`,nt.eventLoopUtilization(e,s).utilization,f),s=e}n.uptime&&t>0&&gh(`node.runtime.process.uptime`,t/1e3,m),c=e}return{name:mN,setup(){if(r){l?.disable();try{l=tt({resolution:_N}),l.enable()}catch{l=void 0}}i&&(o=process.cpuUsage()),n.eventLoopUtilization&&(s=nt.eventLoopUtilization()),c=an(),a&&clearInterval(a),a=yu(setInterval(h,t))}}}),bN=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`],xN=Symbol.for(`level`),SN=Symbol.for(`message`),CN=Symbol.for(`splat`);function wN(e,t){class n extends e{constructor(e){super(e),this._levels=new Set(t?.levels??bN)}log(e,n){try{if(setImmediate(()=>{this.emit(`logged`,e)}),!j(e))return;let n=e[xN],{level:r,message:i,timestamp:a,...o}=e;o[xN]=void 0,o[SN]=void 0,o[CN]=void 0;let s=t?.customLevelMap?.[n],c=TN[n],l=s??c??`info`;this._levels.has(l)?oN(l,i,{...o,"sentry.origin":`auto.log.winston`}):!s&&!c&&JC&&A.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 TN={silly:`trace`,debug:`debug`,verbose:`debug`,http:`debug`,info:`info`,notice:`info`,warn:`warn`,warning:`warn`,error:`error`,emerg:`fatal`,alert:`fatal`,crit:`fatal`},EN=Symbol(`sentry-track-pino-logger`);function DN(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 ON={error:{levels:[],handled:!0},log:{levels:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]}};function kN(e){let{level:t,time:n,pid:r,hostname:i,...a}=e;return a}var AN=W((e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...ON.error,...e.error},log:{...ON.log,...e.log}};function n(e){let n=e[EN];return n===`track`||n!==`ignore`&&t.autoInstrument}return{name:`Pino`,setup:e=>{let r=!!e.getOptions().enableLogs,i=C.tracingChannel(`pino_asJson`);function a(e,i,a){if(!n(e))return;let o=kN(a),[s,c,l]=i,u=e?.levels?.labels?.[l]||`info`,d=DN(e,`pino.messageKey`,`msg`),f=c||o?.[d]||``;if(r&&t.log.levels.includes(u)&&qu({level:u,message:f,attributes:{...o,"sentry.origin":`auto.log.pino`,"pino.logger.level":l}}),t.error.levels.includes(u)){let n=DN(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:Vp(u),contexts:{pino:r}};Er(e=>{e.addEventProcessor(e=>(e.logger=`pino`,Nn(e,{handled:t.error.handled,type:`auto.log.pino`}),e));let r=s[n];if(r){H(r,i);return}Xl(f,i)})}}i.end.subscribe(e=>{let{instance:t,arguments:n,result:r}=e;a(t,n,JSON.parse(r))})}}}),jN=Object.assign(AN,{trackLogger(e){j(e)&&`levels`in e&&(e[EN]=`track`)},untrackLogger(e){j(e)&&`levels`in e&&(e[EN]=`ignore`)}});function MN(e,t){e.setAttribute(I,t)}var NN=[[`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 PN(e){return NN.reduce((e,[t,n])=>e.replace(new RegExp(t,`gi`),n),e)}var FN=`Automatic instrumentation of CronJob only supports crontab string`;function IN(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(FN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let u=PN(i);async function d(e,n){return lu(t,async()=>{try{await a(e,n)}catch(e){throw H(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(FN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let s=PN(i);return r.onTick=async(e,n)=>lu(t,async()=>{try{await a(e,n)}catch(e){throw H(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 LN(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)=>lu(s,async()=>{try{return await a(...e)}catch(e){throw H(e,{mechanism:{handled:!1,type:`auto.function.node-cron.instrumentNodeCron`}}),e}},{schedule:{type:`crontab`,value:PN(i)},timezone:c,...t}),o])}}):e[n]}})}function RN(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 lu(o,async()=>{await a?.()},{schedule:{type:`crontab`,value:PN(s)}})}return e.apply(t,[o,s,c])}}):e[t]}})}var zN={instrumentCron:IN,instrumentNodeCron:LN,instrumentNodeSchedule:RN},BN=`Http`,VN=Object.assign(PT,{id:`${BN}.sentry`}),HN=W((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=QC(i),s=rw(a);return{name:BN,setup(e){let t=e.getOptions();r&&oa(t)&&s.setup(e)},setupOnce(){o.setupOnce(),PT({breadcrumbs:e.breadcrumbs,spans:t,propagateTraceInOutgoingRequests:e.tracePropagation??!0,createSpansForOutgoingRequests:t,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(t,n)=>{let r=_C(n);if(r.startsWith(`data:`)){let e=bf(r);t.setAttribute(`http.url`,e),t.setAttribute(hl,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)}}}),UN=W(((e={})=>({name:`NodeFetch`,setupOnce(){let t=P()?.getOptions();rE({...e,spans:WN(e,t)})}})));function WN(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&oa(t))}var GN=`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(`.`),KN=`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(`,`),qN=`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 JN(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 YN(e,t){if(!t)throw Error(JSON.stringify({member:t}));let[n,r]=JN(t);return r?{objectToPatch:e[n],functionNameToPatch:r}:{objectToPatch:e,functionNameToPatch:n}}var XN=`auto.file.fs`,ZN=`file`,QN=[`rename`,`renameSync`],$N=[`copyFile`,`cp`,`copyFileSync`,`cpSync`],eP=[`link`,`linkSync`],tP=[`mkdtemp`,`mkdtempSync`],nP=[`symlink`,`symlinkSync`],rP=`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 iP(e,t,n){let r={[F]:ZN,[I]:XN};return n.recordFilePaths&&(typeof t[0]==`string`&&rP.includes(e)?r.path_argument=t[0]:typeof t[0]==`string`&&typeof t[1]==`string`?nP.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):eP.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):$N.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):QN.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]==`string`&&tP.includes(e)&&(r.prefix_argument=t[0])),r}function aP(e,t){return Object.assign(e,t)}var oP=new WeakMap;function sP(e,t,n){let r=e[t];if(typeof r!=`function`)return;let i=oP.get(e);i||(i=new Set,oP.set(e,i)),!i.has(t)&&(i.add(t),e[t]=n(r))}function cP(e,t,n){return aP(function(...r){let i=iP(e,r,n);return z({name:`fs.${e}`,onlyIfParent:!0,attributes:i},e=>{try{return lo(()=>t.apply(this,r))}catch(t){throw pP(e,t,n),t}})},t)}function lP(e,t,n){return aP(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return t.apply(this,r);let o=iP(e,r,n),s=B({name:`fs.${e}`,onlyIfParent:!0,attributes:o}),c=R();r[i]=function(...e){let t=e[0];return t&&pP(s,t,n),s.end(),c?V(c,()=>a.apply(this,e)):a.apply(this,e)};try{return lo(()=>t.apply(this,r))}catch(e){throw pP(s,e,n),s.end(),e}},t)}function uP(e,t){let n=`exists`,r=aP(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return e.apply(this,r);let o=iP(n,r,t),s=B({name:`fs.${n}`,onlyIfParent:!0,attributes:o}),c=R();r[i]=function(...e){return s.end(),c?V(c,()=>a.apply(this,e)):a.apply(this,e)};try{return lo(()=>e.apply(this,r))}catch(e){throw pP(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,ye.custom,{value:i}),r}function dP(e,t,n){return aP(async function(...r){let i=iP(e,r,n);return z({name:`fs.${e}`,onlyIfParent:!0,attributes:i},async e=>{try{return await lo(()=>t.apply(this,r))}catch(t){throw pP(e,t,n),t}})},t)}function fP(e={}){for(let t of qN){let{objectToPatch:n,functionNameToPatch:r}=YN(xe,t);sP(n,r,n=>cP(t,n,e))}for(let t of KN){let{objectToPatch:n,functionNameToPatch:r}=YN(xe,t);t===`exists`?sP(n,r,t=>uP(t,e)):sP(n,r,n=>lP(t,n,e))}let t=xe.promises;for(let n of GN)sP(t,n,t=>dP(n,t,e))}function pP(e,t,n){e.setStatus({code:2,message:`internal_error`}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute(`fs_error`,t.message)}var mP=`FileSystem`,hP=W((e={})=>({name:mP,setupOnce(){fP(e)}})),gP=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;function _P(e){let t=R();if(!t)return;let n=na(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(`http.route`,e)}var vP=`Express`,yP=[`>=4.0.0 <6`];function bP(e,t){qS(e,t),qM(e.use,`express`)}var xP=Y(vP,e=>new SP(e)),SP=class extends q{constructor(e={}){super(`sentry-express`,k,e)}init(){return new J(`express`,yP,e=>{try{WS(e,()=>({...this.getConfig(),onRouteResolved(e){e&&_P(e)}}))}catch(e){gP&&A.error(`Failed to patch express module:`,e)}return e},e=>e)}},CP=W((e=>({name:vP,setupOnce(){xP(e)},getShouldHandleError(){return e?.shouldHandleError}}))),wP=(e=>(e.FASTIFY_NAME=`fastify.name`,e.FASTIFY_TYPE=`fastify.type`,e.HOOK_NAME=`hook.name`,e.PLUGIN_NAME=`plugin.name`,e))(wP||{}),TP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(TP||{}),EP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request handler`,e))(EP||{}),DP=Symbol(`opentelemetry.instrumentation.fastify.request_active_span`);x();function OP(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),a=e[DP]||[];return a.push(i),Object.defineProperty(e,DP,{enumerable:!1,configurable:!0,value:a}),i}function kP(e,t){let n=e[DP]||[];n.length&&(n.forEach(e=>{t&&(e.setStatus({code:oe.ERROR,message:t.message}),e.recordException(t)),e.end()}),delete e[DP])}function AP(e,t,n){let r,i;try{i=e(),jP(i)&&i.then(e=>t(void 0,e),e=>t(e))}catch(e){r=e}finally{if(!jP(i)&&(t(r,i),r))throw r;return i}}function jP(e){return typeof e==`object`&&e&&typeof Object.getOwnPropertyDescriptor(e,`then`)?.value==`function`||!1}x();var MP=`@sentry/instrumentation-fastify-v3`,NP=`anonymous`,PP=new Set([`onTimeout`,`onRequest`,`preParsing`,`preValidation`,`preSerialization`,`preHandler`,`onSend`,`onResponse`,`onError`]),FP=class extends q{constructor(e={}){super(MP,k,e)}init(){return[new J(`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&&_P(a);let o=t.method||`GET`;N().setTransactionName(`${o} ${a}`),r()}}_wrapHandler(e,t,n,r){let i=this;return this._diag.debug(`Patching fastify route.handler function`),function(...a){if(!i.isEnabled())return n.apply(this,a);let o=n.name||e||NP,s=`${EP.MIDDLEWARE} - ${o}`,c=a[1],u=OP(c,i.tracer,s,{[wP.FASTIFY_TYPE]:TP.MIDDLEWARE,[wP.PLUGIN_NAME]:e,[wP.HOOK_NAME]:t}),d=r&&a[a.length-1];return d&&(a[a.length-1]=function(...e){kP(c),d.apply(this,e)}),l.with(_.setSpan(l.active(),u),()=>AP(()=>n.apply(this,a),e=>{e instanceof Error&&(u.setStatus({code:oe.ERROR,message:e.message}),u.recordException(e)),r||kP(c)}))}}_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(!PP.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()),IP(),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()?DT(()=>t.apply(this,n),e=>{!e&&r instanceof Error&&(e=r),kP(this,e)}):t.apply(this,n)}}}_hookPreHandler(){let e=this;return this._diag.debug(`Patching fastify preHandler function`),function(t,n,r){if(!e.isEnabled())return r();let i=t,a=i.routeOptions?.handler||i.context?.handler,o=a?.name.startsWith(`bound `)?a.name.substring(6):a?.name,s=`${EP.REQUEST_HANDLER} - ${o||this.pluginName||NP}`,c={[wP.PLUGIN_NAME]:this.pluginName,[wP.FASTIFY_TYPE]:TP.REQUEST_HANDLER,[Dc]:i.routeOptions?i.routeOptions.url:t.routerPath};o&&(c[wP.FASTIFY_NAME]=o);let u=OP(n,e.tracer,s,c);LP(u);let{requestHook:d}=e.getConfig();return d&&DT(()=>d(u,{request:t}),t=>{t&&e._diag.error(`request hook failed`,t)},!0),l.with(_.setSpan(l.active(),u),()=>{r()})}}};function IP(){let e=P();e&&e.on(`spanStart`,e=>{LP(e)})}function LP(e){let t=L(e).data,n=t[`fastify.type`];if(t[`sentry.op`]||!n)return;e.setAttributes({[I]:`auto.http.otel.fastify`,[F]:`${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 RP=`execute_tool`,zP=`invoke_agent`,BP=`graphql`,X=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,VP=()=>{};function Z(e,t,n){let r=HP(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&&H(t,o(t));let{message:r,attributes:i}=WP(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),UP(t,i))}},l={start:VP,asyncStart:VP,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;UP(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)})||UP(e,i)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function HP(e,t,n){let r=_r(it()).getTracingChannelBinding?.();if(!r)return X&&A.log(`[TracingChannel] Could not access async context binding.`),{channel:e,unbind:VP};let i=r.asyncLocalStorage;return e.start.bindStore(i,e=>{e._sentryCallerStore=i.getStore();let a=!n?.requiresParentSpan||R()?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 UP(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function WP(e){let t=j(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:{[Hs]:i}}}var GP=`original-description`,KP=new Set([`Int`,`Float`,`String`,`BlockString`]);function qP(e,t,n){let r=na(e);if(r===e)return;let i=L(r),a=n?`${t} ${n}`:t,o=i.data[rl],s;s=Array.isArray(o)?[...o,a]:typeof o==`string`?[o,a]:a,r.setAttribute(rl,s);let c=i.data[GP]??i.description;i.data[GP]||r.setAttribute(GP,c),r.updateName(`${c} (${JP(s)})`)}function JP(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 YP(e,t,n){return e&&t?`${e} ${t}`:e||n}function XP(e){if(j(e)&&`errors`in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function ZP(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)KP.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 QP(e){if(P()?.getDataCollectionOptions().graphQL.document===!0)return ZP(e)}var $P=`graphql:parse`,eF=`graphql:validate`,tF=`graphql:execute`,nF=`graphql:subscribe`,rF=`graphql:resolve`,iF=`auto.graphql.diagnostic_channel`,aF=`graphql.parse`,oF=`graphql.validate`,sF=`graphql.execute`,cF=`graphql.subscribe`,lF=`graphql.resolve`,uF=`graphql.field.name`,dF=`graphql.field.path`,fF=`graphql.field.type`,pF=`graphql.parent.name`;function mF(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,i=t.useOperationNameForRootSpan!==!1;hF(e),gF(e),_F(e,tF,sF,i),_F(e,nF,cF,i),n||vF(e,r)}function hF(e){Z(e($P),()=>B({name:aF,attributes:{[I]:iF,[F]:BP}}))}function gF(e){Z(e(eF),e=>B({name:oF,attributes:{[I]:iF,[F]:BP,[vc]:QP(e.document)}}),{beforeSpanEnd:(e,t)=>{Array.isArray(t.result)&&t.result.length>0&&e.setStatus({code:2,message:`invalid_argument`})}})}function _F(e,t,n,r){Z(e(t),e=>{let t=B({name:YP(e.operationType,e.operationName,n),attributes:{[I]:iF,[F]:BP,[bc]:e.operationType,[yc]:e.operationName||void 0,[vc]:QP(e.document)}});return r&&e.operationType&&qP(t,e.operationType,e.operationName),t},{beforeSpanEnd:(e,t)=>{XP(t.result)&&e.setStatus({code:2,message:`internal_error`})}})}function vF(e,t){Z(e(rF),e=>{if(!(t&&e.isDefaultResolver))return B({name:`${lF} ${e.fieldPath}`,attributes:{[I]:iF,[F]:BP,[uF]:e.fieldName,[dF]:e.fieldPath,[fF]:e.fieldType,[pF]:e.parentType}})})}var yF=W(((e={})=>({name:`Graphql`,setupOnce(){C.tracingChannel&&U(()=>{mF(C.tracingChannel,e)})}}))),bF=`mongoose:query`,xF=`mongoose:aggregate`,SF=`mongoose:model:save`,CF=`mongoose:model:insertMany`,wF=`mongoose:model:bulkWrite`,TF=`mongoose:cursor:next`,EF=`auto.db.mongoose.diagnostic_channel`,DF=`mongodb`,OF=10,kF=!1;function AF(e){if(!kF){kF=!0;try{jF(e,bF),jF(e,xF),jF(e,SF),jF(e,CF),jF(e,wF),jF(e,TF)}catch{X&&A.log(`Mongoose node:diagnostics_channel subscription failed.`)}}}function jF(e,t){Z(e(t),e=>{let t=e.collection,n=NF(e.args?.pipeline??e.args?.filter),r=MF(e);return B({name:t?`mongoose.${t}.${e.operation}`:`mongoose.${e.operation}`,attributes:{[I]:EF,[F]:`db`,[Bs]:DF,[Is]:e.operation,[js]:t??void 0,[Ns]:e.database??void 0,[Ls]:n??void 0,[Fs]:r??void 0,[dl]:e.serverAddress??void 0,[fl]:e.serverPort??void 0}})})}function MF(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 NF(e){if(e!=null)try{let t=PF(e,0),n=JSON.stringify(t);return n==null||n===`{}`||n===`[]`?void 0:n}catch{return}}function PF(e,t){if(t>OF)return`?`;if(Array.isArray(e))return e.map(e=>PF(e,t+1));if(j(e)){let n={};for(let r of Object.keys(e))n[r]=PF(e[r],t+1);return n}return`?`}var FF=W((()=>({name:`Mongoose`,setupOnce(){C.tracingChannel&&U(()=>{AF(C.tracingChannel)})}}))),IF=`db.system`,LF=`db.name`,RF=`db.operation`,zF=`db.statement`,BF=`db.mongodb.collection`,VF=`db.connection_string`,HF=`net.peer.name`,UF=`net.peer.port`,WF=`mongodb`;function GF(e){return JSON.stringify(KF(e))}function KF(e){return Array.isArray(e)?e.map(e=>KF(e)):qF(e)?Object.entries(e).map(([e,t])=>[e,KF(t)]).reduce((e,t)=>(YF(t)&&(e[t[0]]=t[1]),e),{}):`?`}function qF(e){return j(e)&&!JF(e)}function JF(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}function YF(e){return Array.isArray(e)}function XF(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,ZF(t.db,t.collection,a,o,s,r,i)}function ZF(e,t,n,r,i,a,o){let s={[I]:o,[IF]:WF,[LF]:e,[BF]:t,[RF]:a,[VF]:`mongodb://${n}:${r}/${e}`};if(n&&r){s[HF]=n;let e=parseInt(r,10);isNaN(e)||(s[UF]=e)}if(i)try{s[zF]=GF(i)}catch{}return s}function QF(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 $F(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 ZF(s,c,a,o,l,r,i)}function eI(e){return B({name:`mongodb.${e[RF]||`command`}`,op:`db`,kind:G.CLIENT,attributes:e})}var tI=`mysql2:query`,nI=`mysql2:execute`,rI=`mysql2:connect`,iI=`mysql2:pool:connect`,aI=`auto.db.mysql2.diagnostic_channel`,oI=`mysql`,sI=/^\s*(\w+)/;function cI(e){lI(e,tI),lI(e,nI),uI(e,rI,`mysql2.connect`),uI(e,iI,`mysql2.pool.connect`)}function lI(e,t){Z(e(t),e=>{let t=e.query?sC(e.query):void 0,n=t?.match(sI)?.[1]?.toUpperCase();return B({name:t||`mysql2.query`,attributes:{[I]:aI,[F]:`db`,[Bs]:oI,[Ls]:t,[Is]:n,[Ns]:e.database||void 0,[dl]:e.serverAddress,[fl]:e.serverPort}})},{requiresParentSpan:!0})}function uI(e,t,n){Z(e(t),e=>B({name:n,attributes:{[I]:aI,[F]:`db`,[Bs]:oI,[Ns]:e.database||void 0,[dl]:e.serverAddress,[fl]:e.serverPort}}),{requiresParentSpan:!0})}var dI=W((()=>({name:`Mysql2`,setupOnce(){C.tracingChannel&&U(()=>{cI(C.tracingChannel)})}}))),fI=`7`,pI=`PRISMA_INSTRUMENTATION`,mI=`V${fI}_PRISMA_INSTRUMENTATION`,hI=globalThis;function gI(e){let t={helper:e};hI[mI]=t,hI[pI]=t}var _I=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES===`true`}catch{return!1}})(),vI=`00-10-10-00`,yI=`auto.db.otel.prisma`,bI=1e3,xI=new fb(bI),SI=[];function CI(e,t){xI.set(e,t)}function wI(e,t){let n={...t,[I]:yI};return e===`prisma:engine:db_query`&&n[`db.system`]==null&&(n[zs]=`prisma`),n}function TI(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 EI(){let e=!0;for(;e;){e=!1;for(let t=SI.length-1;t>=0;t--){let n=SI[t],r=xI.get(n.parent_span_id);if(!r)continue;let i=wI(n.name,n.attributes),a=B({name:TI(n.name,i),attributes:i,kind:n.kind===`client`?G.CLIENT:G.INTERNAL,startTime:n.start_time,parentSpan:r});CI(n.span_id,a),n.links&&a.addLinks(n.links.flatMap(e=>{let t=xI.get(e.span_id);return t?[{context:t.spanContext()}]:[]})),a.end(n.end_time),SI.splice(t,1),e=!0}}}var DI=class{constructor({ignoreSpanTypes:e}){this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(e){let t=(e??R())?.spanContext();return t?`00-${t.traceId}-${t.spanId}-0${t.traceFlags}`:vI}dispatchEngineSpans(e){let t=new Map,n=e.filter(e=>e.parentId===null);for(let r of n)OI(r,e,t,this.ignoreSpanTypes)}createEngineSpan(e){SI.push(...e.spans),EI();let t=SI.length-bI;t>0&&(X&&A.log(`[Prisma] Dropping ${t} unresolved v5 engine span(s) whose parent was never registered.`),SI.splice(0,t))}getActiveContext(){return R()}runInChildSpan(e,t){let n=typeof e==`string`?{name:e}:e;if(n.internal&&!_I)return t();let r=`prisma:client:${n.name}`;if(jI(r,this.ignoreSpanTypes))return t();let i=R(),a=wI(r,n.attributes),o={name:TI(r,a),attributes:a,kind:n.kind,links:n.links,startTime:n.startTime,parentSpan:i};if(n.active===!1){let e=B(o);return CI(e.spanContext().spanId,e),kI(e,()=>t(e,i))}return ao(o,e=>(CI(e.spanContext().spanId,e),kI(e,()=>t(e,i))))}};function OI(e,t,n,r){if(jI(e.name,r))return;let i=wI(e.name,e.attributes);ao({name:TI(e.name,i),attributes:i,kind:e.kind===`client`?G.CLIENT:G.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)OI(e,t,n,r);i.end(e.endTime)})}function kI(e,t){let n;try{n=t()}catch(t){throw e.end(),t}return AI(n)?n.then(t=>(e.end(),t),t=>{throw e.end(),t}):(e.end(),n)}function AI(e){return e!=null&&typeof e.then==`function`}function jI(e,t){return t.some(t=>typeof t==`string`?t===e:t.test(e))}var MI=`Prisma`;function NI(e){gI(new DI({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var PI=W((e=>({name:MI,setupOnce(){NI(e)}}))),FI=`node-redis:command`,II=`node-redis:batch`,LI=`node-redis:connect`,RI=`ioredis:command`,zI=`ioredis:connect`,BI=`auto.db.redis.diagnostic_channel`,VI=`redis`;function HI(e,t){UI(e,FI,e=>e.args.slice(1),t),WI(e,II,e=>e.batchMode===`PIPELINE`?`PIPELINE`:`MULTI`),GI(e,LI),UI(e,RI,e=>e.args,t),GI(e,zI)}function UI(e,t,n,r){Z(e(t),e=>{let t=n(e),r=t.length?`${e.command} ${t.join(` `)}`:e.command;return B({name:`redis-${e.command}`,attributes:{[I]:BI,[F]:`db.redis`,[Bs]:VI,[Ls]:r,...e.serverAddress==null?{}:{[dl]:e.serverAddress},...e.serverPort==null?{}:{[fl]:e.serverPort}}})},{beforeSpanEnd(e,t){`error`in t||KI(r,e,t.command,n(t),t.result)}})}function WI(e,t,n){Z(e(t),e=>B({name:n(e),attributes:{[I]:BI,[F]:`db.redis`,[Bs]:VI,...Number(e.batchSize)>1?{[Fs]:e.batchSize}:{},...e.serverAddress==null?{}:{[dl]:e.serverAddress},...e.serverPort==null?{}:{[fl]:e.serverPort}}}))}function GI(e,t){Z(e(t),e=>B({name:`redis-connect`,attributes:{[I]:BI,[F]:`db.redis.connect`,[Bs]:VI,...e.serverAddress==null?{}:{[dl]:e.serverAddress},...e.serverPort==null?{}:{[fl]:e.serverPort}}}))}function KI(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}var qI=W(((e={})=>({name:`Redis`,setupOnce(){C.tracingChannel&&U(()=>{HI(C.tracingChannel,e.responseHook)})}}))),JI=[{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}],YI=(e,t)=>{if(Array.isArray(t)&&t.length){let n=JI.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 XI(e){return typeof e==`string`?e:void 0}function ZI(e){return typeof e==`number`&&!isNaN(e)?e:void 0}function QI(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function $I(e){return j(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`}function eL(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+=tL(i,n)??``,e.enqueue(n)}catch(t){c(t),e.error(t)}},cancel(e){return s(),r.cancel(e)}})}function tL(e,t){if(!j(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 nL=`ai:telemetry`,rL=`auto.vercelai.channel`,iL=`gen_ai.tool.call.id`,aL=`gen_ai.tool.description`,oL=`embeddings`,sL=`rerank`,cL=`generate_content`,lL=`WorkersAI`,uL=`vercel.ai.operationId`,dL=`vercel.ai.model.provider`,fL=`vercel.ai.settings.maxRetries`,pL=new Map,mL=new Map,hL=new Map,gL=new Set([`generateText`,`streamText`,`generateObject`,`embed`,`embedMany`,`rerank`]);function _L(e){if(!gL.has(e.type))return;let t=XI(e.event.callId);t&&vL(t)}function vL(e){pL.delete(e),mL.delete(e),hL.delete(e)}function yL(e,t){if(!e||!Array.isArray(t))return;let n=mL.get(e);for(let e of t)j(e)&&typeof e.name==`string`&&typeof e.description==`string`&&(n??=new Map,n.has(e.name)||n.set(e.name,e.description));n&&mL.set(e,n)}function bL(e,t,n){let r=e?mL.get(e)?.get(t):void 0;if(r)return r;if(Array.isArray(n)){let e=n.find(e=>j(e)&&e.name===t);return j(e)?XI(e.description):void 0}if(j(n)){let e=n[t];return j(e)?XI(e.description):void 0}}function xL(e,t={}){Z(e(nL),e=>EL(e,t),{beforeSpanEnd:(e,n)=>{jL(e,n,t),_L(n)},deferSpanEnd:({data:e,end:n})=>SL(e,t,n)})}function SL(e,t,n){if(e.type!==`languageModelCall`||!j(e.result))return!1;let r=e.result,i=r.stream;if(!$I(i))return!1;let a=XI(e.event.callId),{recordOutputs:o}=BL(e.event,t);return r.stream=eL(i,t=>{e.result={...r,...CL(t)},n(),wL(a,t,o)},e=>n(e)),!0}function CL(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 wL(e,t,n){let r=e?hL.get(e):void 0;if(!r)return;let i=j(t.usage)?t.usage:void 0;if(i){let e=PL(i.inputTokens)??PL(i.promptTokens)??PL(i.tokens),t=PL(i.outputTokens)??PL(i.completionTokens);TL(r,hc,e),TL(r,gc,t),TL(r,_c,PL(i.totalTokens)??QI(e,t))}if(n){let e=FL(RL(t.text,t.toolCalls),NL({finishReason:t.finishReason}));e&&r.setAttribute($s,e)}}function TL(e,t,n){if(n===void 0)return;let r=L(e).data[t];e.setAttribute(t,(typeof r==`number`?r:0)+n)}function EL(e,t){let{type:n,event:r}=e;if(n===`step`||!r||typeof r!=`object`)return;let{recordInputs:i,enableTruncation:a}=BL(r,t),o=XI(r.provider),s=XI(r.modelId),c=XI(r.callId),l=ZI(r.maxRetries);i&&yL(c,r.tools);let u={[I]:rL,...o?{[uc]:o,[dL]:o}:{},...s?{[nc]:s}:{},...l===void 0?{}:{[fL]:l}};switch(n){case`generateText`:case`streamText`:case`generateObject`:return OL(r,u,i,a,c,n===`streamText`);case`languageModelCall`:return $d([lL]),kL(r,u,i,a,c,s);case`executeTool`:return AL(r,i);case`embed`:case`embedMany`:{let e=n===`embedMany`?r.values:r.value;return DL(oL,s,{...u,...i&&e!==void 0?{[Ys]:bn(e)}:{}})}case`rerank`:return DL(sL,s,u);default:return}}function DL(e,t,n){return B({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[Qs]:e,...n}})}function OL(e,t,n,r,i,a){let o=XI(e.functionId),s=XI(e.operationId)??(a?`ai.streamText`:`ai.generateText`);i&&pL.set(i,{operationId:s,isStream:a});let c=DL(zP,o,{...t,[uL]:s,[lc]:a,...o?{[Xs]:o}:{},...n?HL(e,r):{}});return a&&i&&hL.set(i,c),c}function kL(e,t,n,r,i,a){let o=i?pL.get(i):void 0,s=o?`${o.operationId}.${o.isStream?`doStream`:`doGenerate`}`:`ai.generateText.doGenerate`;return DL(cL,a,{...t,[uL]:s,...n?HL(e,r):{},...n&&Array.isArray(e.tools)?{[ec]:bn(e.tools)}:{}})}function AL(e,t){let n=j(e.toolCall)?e.toolCall:{},r=XI(n.toolName),i=XI(e.toolCallId)??XI(n.toolCallId),a=n.input??n.args,o=t&&r?bL(XI(e.callId),r,e.tools):void 0;return DL(RP,r,{[I]:rL,[mc]:`function`,...r?{[fc]:r}:{},...i?{[iL]:i}:{},...o?{[aL]:o}:{},...t&&a!==void 0?{[dc]:bn(a)}:{}})}function jL(e,t,n){let{type:r,result:i}=t;if(!j(i))return;let{recordOutputs:a}=BL(t.event,n);if(r===`executeTool`){a&&e.setAttribute(pc,bn(i.output??i));let n=j(i.output)?i.output:void 0;n?.type===`tool-error`&&zL(e,t,n.error);return}let o=j(i.usage)?i.usage:void 0;if(o){let t=PL(o.inputTokens)??PL(o.promptTokens)??PL(o.tokens),n=PL(o.outputTokens)??PL(o.completionTokens),r=PL(o.totalTokens)??QI(t,n);t!==void 0&&e.setAttribute(hc,t),n!==void 0&&e.setAttribute(gc,n),r!==void 0&&e.setAttribute(_c,r)}let s=NL(i);s&&r===`languageModelCall`&&e.setAttribute(oc,bn([s]));let c=j(i.response)?i.response:void 0,l=XI(c?.id)??XI(i.responseId);l&&e.setAttribute(sc,l);let u=XI(c?.modelId)??XI(t.event.modelId);u&&e.setAttribute(cc,u);let d=i.providerMetadata,f=$_(d);if(`gen_ai.conversation.id`in f&&L(e).data[`gen_ai.conversation.id`]&&delete f[qr],e.setAttributes(f),a){let t=FL(r===`languageModelCall`&&Array.isArray(i.content)?LL(i.content):RL(i.text,i.toolCalls),s);t&&e.setAttribute($s,t)}}function ML(e){return e===`tool-calls`?`tool_call`:e??`stop`}function NL(e){let t=e.finishReason;return typeof t==`string`?t:j(t)?XI(t.unified):void 0}function PL(e){return ZI(e)??(j(e)?ZI(e.total):void 0)}function FL(e,t){if(e.length)return bn([{role:`assistant`,parts:e,finish_reason:ML(t)}])}function IL(e){let t=e.input??e.args;return{type:`tool_call`,id:XI(e.toolCallId),name:XI(e.toolName),arguments:typeof t==`string`?t:bn(t??{})}}function LL(e){let t=[];for(let n of e)j(n)&&(n.type===`text`&&typeof n.text==`string`?t.push({type:`text`,content:n.text}):n.type===`tool-call`&&t.push(IL(n)));return t}function RL(e,t){let n=[];if(typeof e==`string`&&e.length&&n.push({type:`text`,content:e}),Array.isArray(t))for(let e of t)j(e)&&n.push(IL(e));return n}function zL(e,t,n){e.setStatus({code:2,message:n instanceof Error?n.message:`tool_error`});let r=j(t.event.toolCall)?t.event.toolCall:{},i=XI(r.toolName),a=XI(t.event.toolCallId)??XI(r.toolCallId);Er(t=>{t.setContext(`trace`,Ii(e)),i&&t.setTag(`vercel.ai.tool.name`,i),a&&t.setTag(`vercel.ai.tool.callId`,a),t.setLevel(`error`),H(n instanceof Error?n:Error(typeof n==`string`?n:`Tool execution failed`),{mechanism:{type:`auto.vercelai.channel`,handled:!1}})})}function BL(e,t){let n=P()?.getDataCollectionOptions().genAI;return{recordInputs:VL(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:VL(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:Qg(t.enableTruncation)}}function VL(e,t,n){return typeof e==`boolean`?e:typeof t==`boolean`?t:n===!0}function HL(e,t){let n={},r=XI(e.instructions);r&&(n[Yh]=bn([{type:`text`,content:r}]));let i=e.messages??e.prompt;return i!==void 0&&(n[Zs]=t?n_(i):bn(i),n[Kh]=Array.isArray(i)?i.length:1),n}var UL=W(((e={})=>({name:`VercelAI`,setupOnce(){C.tracingChannel&&U(()=>{xL(C.tracingChannel,e)})}}))),WL=`@sentry/instrumentation-fastify`,GL=`>=3.21.0 <6`,KL=`auto.http.otel.fastify`,qL=`hook.fastify`,JL=`request_handler.fastify`,YL=[`onRequest`,`preParsing`,`preValidation`,`preHandler`,`preSerialization`,`onSend`,`onResponse`,`onError`],XL=`hook.name`,ZL=`fastify.type`,QL=`hook.callback.name`,$L=`fastify.root`,eR=`route-hook`,tR=`hook`,nR=`request-handler`,rR=`anonymous`,iR=Symbol(`sentry fastify request span`),aR=Symbol(`sentry fastify addHook original`),oR=Symbol(`sentry fastify setNotFoundHandler original`);function sR(e){return e.routeOptions?.url??e.routerPath}function cR(e){return e.routeOptions?.config??e.routeConfig}function lR(e){return j(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||`routerPath`in e)}function uR(e,t,n){e.decorate(aR,e.addHook),e.decorate(oR,e.setNotFoundHandler),e.decorateRequest(`opentelemetry`,function(){return{span:this[iR]}}),e.decorateRequest(iR,null),e.addHook(`onRoute`,fR),e.addHook(`onRequest`,hR),e.addHook(`onResponse`,gR),e.addHook=yR,e.setNotFoundHandler=bR,n()}var dR=uR;dR[Symbol.for(`skip-override`)]=!0,dR[Symbol.for(`fastify.display-name`)]=WL,dR[Symbol.for(`plugin-meta`)]={fastify:GL,name:WL};function fR(e){if(e.config?.otel!==!1){for(let t of YL){let n=e[t];typeof n==`function`?e[t]=SR(n,t,pR(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(n=>SR(n,t,pR(this.pluginName,t,n,e.url))))}e.onSend=mR(e.onSend,_R),e.onError=mR(e.onError,vR),e.handler=SR(e.handler,`handler`,{[XL]:`${this.pluginName} - route-handler`,[ZL]:nR,[Dc]:e.url,[QL]:e.handler.name.length>0?e.handler.name:rR})}}function pR(e,t,n,r){return{[XL]:`${e} - route -> ${t}`,[ZL]:eR,[Dc]:r,[QL]:n.name?.length>0?n.name:rR}}function mR(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function hR(e,t,n){if(cR(e)?.otel===!1)return n();let r={[I]:KL,[$L]:WL,[Tc]:e.method,[gl]:e.url},i=sR(e);if(i!=null){r[Dc]=i;let e=R(),t=e&&na(e);t&&L(t).data[`sentry.op`]===`http.server`&&t.setAttribute(Dc,i)}let a=B({name:`request`,op:JL,attributes:r});e[iR]=a,V(a,()=>{n()})}function gR(e,t,n){let r=e[iR];r!=null&&(r.setAttributes({[Ec]:t.statusCode}),r.end()),e[iR]=null,n()}function _R(e,t,n,r){let i=e[iR];i!=null&&(t.statusCode>=500&&i.setStatus({code:2}),i.setAttributes({[Ec]:t.statusCode}),i.end()),e[iR]=null,r(null,n)}function vR(e,t,n,r){e[iR]?.setStatus({code:2,message:n.message}),r()}function yR(e,t){let n=this[aR];return YL.includes(e)?n.call(this,e,SR(t,e,{[XL]:`${this.pluginName} - ${e}`,[ZL]:tR,[QL]:t.name?.length>0?t.name:rR})):n.call(this,e,t)}function bR(e,t){let n=this[oR];if(typeof e==`function`){n.call(this,SR(e,`notFoundHandler`,{[XL]:`${this.pluginName} - not-found-handler`,[ZL]:tR,[QL]:e.name?.length>0?e.name:rR}));return}if(e.preValidation!=null&&(e.preValidation=SR(e.preValidation,`notFoundHandler - preValidation`,{[XL]:`${this.pluginName} - not-found-handler - preValidation`,[ZL]:tR,[QL]:e.preValidation.name?.length>0?e.preValidation.name:rR})),e.preHandler!=null&&(e.preHandler=SR(e.preHandler,`notFoundHandler - preHandler`,{[XL]:`${this.pluginName} - not-found-handler - preHandler`,[ZL]:tR,[QL]:e.preHandler.name?.length>0?e.preHandler.name:rR})),t==null){n.call(this,e);return}n.call(this,e,SR(t,`notFoundHandler`,{[XL]:`${this.pluginName} - not-found-handler`,[ZL]:tR,[QL]:t.name?.length>0?t.name:rR}))}function xR(e){for(let t of e)if(lR(t))return t;return null}function SR(e,t,n={}){return function(...r){let i=xR(r);if(i===null||cR(i)?.otel===!1)return e.call(this,...r);let a=i[iR]??void 0,o=e.name?.length>0?e.name:this.pluginName??rR,s=n[ZL],c=s===tR?qL:s===nR?JL:void 0;return z({name:c?CR(n[XL]):`${t} - ${o}`,op:c,attributes:{...n,[I]:KL},parentSpan:a},()=>e.call(this,...r))}}function CR(e=``){return e.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``).replace(/^@sentry\/instrumentation-fastify -> /,``)}function wR(e){e.addHook(`onRequest`,async(e,t)=>{let n=sR(e),r=e.method||`GET`;N().setTransactionName(`${r} ${n}`)})}var TR=!1,ER=Object.assign(function(){TR||(TR=!0,C.subscribe(`fastify.initialization`,e=>{let t=e.fastify;t?.register(uR).after(e=>{e?X&&A.error(`Failed to setup Fastify instrumentation`,e):t&&wR(t)})}))},{id:`Fastify.v5`}),DR=`Fastify`;function OR(e,t,n){let r=n.statusCode;return r>=500||r<=299}function kR(){return P()?.getIntegrationByName(DR)}function AR(){C.subscribe(`tracing:fastify.request.handler:error`,e=>{let{error:t,request:n,reply:r}=e;jR.call(jR,t,n,r,`diagnostics-channel`)})}function jR(e,t,n,r){let i=kR()?.getShouldHandleError()||OR;if(r===`diagnostics-channel`&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r===`onError-hook`){X&&A.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)&&H(e,{mechanism:{handled:!1,type:`auto.function.fastify`}})}var MR=W((({shouldHandleError:e}={})=>{let t;return{name:DR,setupOnce(){t=e||OR,AR(),ER()},getShouldHandleError(){return t},setShouldHandleError(e){t=e}}})),NR=jR,PR=`db.mongodb.collection`,FR=`db.name`,IR=`db.user`,LR=`net.peer.name`,RR=`net.peer.port`,zR=`db.operation`,BR=`db.system`;function VR({collection:e,modelName:t,operation:n,origin:r,parentSpan:i}){let a={[PR]:e?.name,[FR]:e?.conn?.name,[IR]:e?.conn?.user,[LR]:e?.conn?.host,[RR]:e?.conn?.port,[zR]:n,[BR]:`mongoose`,[I]:r};return B({name:`mongoose.${t}.${n}`,op:`db`,kind:G.CLIENT,attributes:a,parentSpan:i})}var HR=`Fastify`,UR=Y(`${HR}.v3`,()=>new FP);function WR(){let e=P();if(e)return e.getIntegrationByName(HR)}var GR=(e=>ju(MR(e),{setupOnce(){UR()}})),KR=W((e={})=>GR(e));function qR(e,t){t?.shouldHandleError&&WR()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(e,t,n){e.addHook(`onError`,async(e,t,n)=>{NR.call(NR,n,e,t,`onError-hook`)}),n()},{[Symbol.for(`skip-override`)]:!0,[Symbol.for(`fastify.display-name`)]:`sentry-fastify-error-handler`});e.register(n)}var JR=class{constructor(e,t,n,r){this.name=we(e),this.supportedVersions=t,this.patch=n,this.unpatch=r}},YR=(e=>(e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`,e))(YR||{}),XR=(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))(XR||{}),ZR=(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))(ZR||{}),QR=(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))(QR||{}),$R=Symbol.for(`opentelemetry.patched`),ez=Symbol.for(`opentelemetry.graphql_data`),tz=`Operation$operationName$not supported`,nz=Object.values(YR),rz=e=>typeof e?.then==`function`;function iz(e,t,n,r){if(P()?.getDataCollectionOptions().graphQL.document===!0){let i=vz(t,n,r);e.setAttribute(QR.SOURCE,i)}}function az(e,t,n){let r=uz(e,n);return r?{field:r,spanAdded:!1}:(r={span:oz(e,t,n,dz(e,n))},lz(e,n,r),{field:r,spanAdded:!0})}function oz(e,t,n,r){let i={[QR.FIELD_NAME]:t.fieldName,[QR.FIELD_PATH]:n.join(`.`),[QR.FIELD_TYPE]:t.returnType.toString(),[QR.PARENT_NAME]:t.parentType.name},a=B({name:`${ZR.RESOLVE} ${i[QR.FIELD_PATH]}`,attributes:i,parentSpan:r}),o=e[ez].source,s=t.fieldNodes.find(e=>e.kind===`Field`);return s&&iz(a,o.loc,s.loc?.start,s.loc?.end),a}function sz(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function cz(e,t){if(e&&Array.isArray(e.definitions))return t?e.definitions.filter(e=>nz.indexOf(e?.operation)!==-1).find(e=>t===e?.name?.value):e.definitions.find(e=>nz.indexOf(e?.operation)!==-1)}function lz(e,t,n){return e[ez].fields[t.join(`.`)]=n}function uz(e,t){return e[ez].fields[t.join(`.`)]}function dz(e,t){for(let n=t.length-1;n>0;n--){let r=uz(e,t.slice(0,n));if(r)return r.span}return fz(e)}function fz(e){return e[ez].span}function pz(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function mz(e){return gz(`
30
+ `,e)}function hz(e){return gz(` `,e)}function gz(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}var _z=[XR.FLOAT,XR.STRING,XR.INT,XR.BLOCK_STRING];function vz(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=``;_z.indexOf(o.kind)>=0&&(e=`*`),o.kind===XR.STRING&&(e=`"${e}"`),o.kind===XR.EOF&&(e=``),o.line>s?(r+=mz(o.line-s),s=o.line,t=hz(o.column-1)):o.line===o.prev?.line&&(t=hz(o.start-(o.prev?.end||0))),r+=t+e,o&&=o.next}}return r}function yz(e,t){if(!e||e[$R])return;let n=e.getFields();e[$R]=!0,Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=Tz(t,r.resolve),r.type)){let e=bz(r.type);for(let n of e)yz(n,t)}})}function bz(e){return`ofType`in e?bz(e.ofType):xz(e)?e.getTypes():Sz(e)?[e]:[]}function xz(e){return`getTypes`in e&&typeof e.getTypes==`function`}function Sz(e){return`getFields`in e&&typeof e.getFields==`function`}var Cz=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},wz=(e,t)=>{t&&e.end()};function Tz(e,t,n=!1){if(r[$R]||typeof t!=`function`)return t;function r(r,i,a,o){if(!t)return;if(e().ignoreTrivialResolveSpans&&n&&(j(r)||typeof r==`function`)&&typeof r[o.fieldName]!=`function`||!a[ez])return t.call(this,r,i,a,o);let{field:s,spanAdded:c}=az(a,o,pz(o?.path)),l=s.span,u=c;return V(l,()=>{try{let e=t.call(this,r,i,a,o);return rz(e)?e.then(e=>(wz(l,u),e),e=>{throw Cz(l,e,u),e}):(wz(l,u),e)}catch(e){throw Cz(l,e,u),e}})}return r[$R]=!0,r}var Ez=`@sentry/instrumentation-graphql`,Dz=`auto.graphql.otel.graphql`,Oz={ignoreResolveSpans:!1},kz=[`>=14.0.0 <17`],Az=class extends q{constructor(e={}){super(Ez,k,{...Oz,...e})}setConfig(e={}){super.setConfig({...Oz,...e})}init(){let e=new J(`graphql`,kz);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new JR(`graphql/execution/execute.js`,kz,e=>(K(e.execute)&&this._unwrap(e,`execute`),this._wrap(e,`execute`,this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,`execute`)})}_addPatchingParser(){return new JR(`graphql/language/parser.js`,kz,e=>(K(e.parse)&&this._unwrap(e,`parse`),this._wrap(e,`parse`,this._patchParse()),e),e=>{e&&this._unwrap(e,`parse`)})}_addPatchingValidate(){return new JR(`graphql/validation/validate.js`,kz,e=>(K(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=cz(r.document,r.operationName),a=t._createExecuteSpan(i,r);return r.contextValue[ez]={source:r.document?r.document||r.document[ez]:void 0,span:a,fields:{}},V(a,()=>DT(()=>n.apply(this,[r]),(e,n)=>{t._handleExecutionResult(a,e,n)}))}}}_handleExecutionResult(e,t,n){if(n===void 0||t){sz(e,t);return}rz(n)?n.then(t=>{this._updateSpanFromResult(e,t),sz(e)},t=>{sz(e,t)}):(this._updateSpanFromResult(e,n),sz(e))}_updateSpanFromResult(e,t){if(t.errors?.length&&!L(e).status&&e.setStatus({code:2}),!this.getConfig().useOperationNameForRootSpan)return;let n=L(e).data,r=n[QR.OPERATION_TYPE],i=n[QR.OPERATION_NAME];if(!r)return;let a=na(e),o=L(a).data[`sentry.graphql.operation`]||[],s=i?`${r} ${i}`:`${r}`;Array.isArray(o)?(o.push(s),a.setAttribute(gO,o)):typeof o==`string`?a.setAttribute(gO,[o,s]):a.setAttribute(gO,s),L(a).data[`original-description`]||a.setAttribute(`original-description`,L(a).description),a.updateName(`${L(a).data[`original-description`]} (${jz(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=B({name:ZR.PARSE});return V(i,()=>DT(()=>t.call(e,n,r),(e,t)=>{t&&(cz(t)?t.loc&&iz(i,t.loc):i.updateName(ZR.SCHEMA_PARSE)),sz(i,e)}))}_validate(e,t,n,r,i,a,o){let s=B({name:ZR.VALIDATE});return V(s,()=>DT(()=>t.call(e,n,r,i,o,a),(e,t)=>{r.loc||s.updateName(ZR.SCHEMA_VALIDATE),sz(s,e)}))}_createExecuteSpan(e,t){let n=B({name:ZR.EXECUTE,attributes:{[I]:Dz}});if(e){let{operation:t,name:r}=e;n.setAttribute(QR.OPERATION_TYPE,t);let i=r?.value;i?(n.setAttribute(QR.OPERATION_NAME,i),n.updateName(`${t} ${i}`)):n.updateName(t)}else{let e=` `;t.operationName&&(e=` "${t.operationName}" `),e=tz.replace(`$operationName$`,e),n.setAttribute(QR.OPERATION_NAME,e)}return t.document?.loc&&iz(n,t.document.loc),n}_wrapExecuteArgs(e,t,n,r,i,a,o,s,c){return r||={},r[ez]||this.getConfig().ignoreResolveSpans?{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s}:(o=Tz(()=>this.getConfig(),o??c,o==null),e&&(yz(e.getQueryType(),()=>this.getConfig()),yz(e.getMutationType(),()=>this.getConfig())),{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s})}};function jz(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 Mz=`Graphql`,Nz=Y(Mz,Az,e=>Fz(e)),Pz=W(((e={})=>ju(yF(Fz(e)),{name:Mz,setupOnce(){Nz(Fz(e))}})));function Fz(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var Iz=`messaging.destination.partition.id`,Lz=`messaging.kafka.message.key`,Rz=`messaging.kafka.message.tombstone`,zz=`messaging.kafka.offset`,Bz=`process`,Vz=`receive`,Hz=`send`,Uz=`kafka`,Wz=`_OTHER`;x();var Gz=`auto.kafkajs.otel.producer`,Kz=`auto.kafkajs.otel.consumer`;function qz(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function Jz(e){let t=qz(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:a}=ki(t,qz(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:a?i.SAMPLED:i.NONE}}]}function Yz({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return B({name:`${a} ${e}`,kind:n===`receive`?G.CLIENT:G.CONSUMER,links:r,attributes:{...i,[Vc]:Uz,[Lc]:e,[Bc]:n,[zc]:a,[Lz]:t?.key?String(t.key):void 0,[Rz]:t?.key&&t.value===null?!0:void 0,[zz]:t?.offset,...t?{[I]:Kz}:{}}})}function Xz(e,t){let n=B({name:`send ${e}`,kind:G.PRODUCER,attributes:{[Vc]:Uz,[Lc]:e,[Lz]:t.key?String(t.key):void 0,[Rz]:t.key&&t.value===null?!0:void 0,[Iz]:t.partition===void 0?void 0:String(t.partition),[zc]:`send`,[Bc]:Hz,[I]:Gz}});t.headers=t.headers??{};let r=wf({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function Zz(e,t){return Promise.resolve(t).catch(t=>{let n,r=Wz;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(Hs,r),e.setStatus({code:2,message:n})}),t}).finally(()=>{e.forEach(e=>e.end())})}var Qz=`@sentry/instrumentation-kafkajs`,$z=class extends q{constructor(e={}){super(Qz,k,e)}init(){let e=e=>{K(e?.Kafka?.prototype.producer)&&this._unwrap(e.Kafka.prototype,`producer`),K(e?.Kafka?.prototype.consumer)&&this._unwrap(e.Kafka.prototype,`consumer`)};return new J(`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 K(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 K(r.sendBatch)&&e._unwrap(r,`sendBatch`),e._wrap(r,`sendBatch`,e._getSendBatchPatch()),K(r.send)&&e._unwrap(r,`send`),e._wrap(r,`send`,e._getSendPatch()),K(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&&(K(r.eachMessage)&&e._unwrap(r,`eachMessage`),e._wrap(r,`eachMessage`,e._getConsumerEachMessagePatch())),r?.eachBatch&&(K(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 co({sentryTrace:qz(n.message.headers,`sentry-trace`),baggage:qz(n.message.headers,`baggage`)},()=>{let r=Yz({topic:n.topic,message:n.message,operationType:Bz,attributes:{[Iz]:String(n.partition)}}),i=V(r,()=>e.apply(this,t));return Zz([r],i)})}}_getConsumerEachBatchPatch(){return e=>function(...t){let n=t[0],r=fo(()=>Yz({topic:n.batch.topic,message:void 0,operationType:Vz,attributes:{[Fc]:n.batch.messages.length,[Iz]:String(n.batch.partition)}}));return V(r,()=>{let i=[r];return n.batch.messages.forEach(e=>{i.push(Yz({topic:n.batch.topic,message:e,operationType:Bz,links:Jz(e.headers),attributes:{[Iz]:String(n.batch.partition)}}))}),Zz(i,e.apply(this,t))})}}_getProducerTransactionPatch(){let e=this;return t=>function(...n){let r=B({name:`transaction`}),i=t.apply(this,n);return i.then(t=>{let n=t.send;t.send=function(...t){return V(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 V(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 Zz([r],t)};let o=t.abort;t.abort=function(...e){let t=o.apply(this,e);return Zz([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(Xz(e.topic,t))})}),Zz(r,e.apply(this,t))}}_getSendPatch(){return e=>function(...t){let n=t[0];return Zz(n.messages.map(e=>Xz(n.topic,e)),e.apply(this,t))}}},eB=`Kafka`,tB=Y(eB,()=>new $z),nB=W((()=>({name:eB,setupOnce(){tB()}}))),rB=`@sentry/instrumentation-lru-memoizer`,iB=class extends q{constructor(){super(rB,k,{})}init(){return[new J(`lru-memoizer`,[`>=1.3 <4`],e=>Object.assign(function(...t){let n=e.apply(this,t);return function(...e){let t=e.pop(),r=M(),i=typeof t==`function`?function(...e){return Er(r,()=>t.apply(this,e))}:t;return n.apply(this,[...e,i])}},{sync:e.sync}),void 0)]}},aB=`LruMemoizer`,oB=Y(aB,()=>new iB),sB=W((()=>({name:aB,setupOnce(){oB()}}))),cB=`auto.db.otel.mongo`;function lB(e,t,n,r){return XF(e,t,n,r,cB)}function uB(e,t,n,r){return $F(e,t,n,r,cB)}function dB(e,t){let n=R(),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 V(n??null,()=>t.apply(this,i))}}function fB(){return!R()}function pB(e){return t=>function(n,r,i,a,o){let s=typeof a==`function`?a:o;if(fB()||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=dB(eI(uB(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 mB(){return e=>function(t,n,r,i,a){let o=typeof i==`function`?i:a;if(fB()||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=dB(eI(uB(n,t,r,QF(r))),o);return typeof i==`function`?e.call(this,t,n,r,s):e.call(this,t,n,r,i,s)}}function hB(){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;fB()||(s=eI(lB(this,t,n,o)));let c=dB(s,a);return e.call(this,t,n,r,c)}}function gB(){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;fB()||(o=eI(lB(this,n,r,i)));let s=dB(o,a),c=e.apply(this,t);return c.then(e=>s(null,e),e=>s(e)),c}}function _B(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(fB()||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=dB(eI(uB(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 vB(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(fB()||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=dB(eI(uB(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 yB(){return e=>function(t){let n=R();return e.call(this,function(...e){return V(n??null,()=>t.apply(this,e))})}}var bB=`@sentry/instrumentation-mongodb`,xB=class extends q{constructor(e={}){super(bB,k,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 J(`mongodb`,[`>=3.3.0 <4`],void 0,void 0,[new JR(`mongodb/lib/core/wireprotocol/index.js`,[`>=3.3.0 <4`],e,t)]),new J(`mongodb`,[`>=4.0.0 <8`],void 0,void 0,[new JR(`mongodb/lib/cmap/connection.js`,[`>=4.0.0 <6.4`],n,i),new JR(`mongodb/lib/cmap/connection.js`,[`>=6.4.0 <8`],r,i),new JR(`mongodb/lib/cmap/connection_pool.js`,[`>=4.0.0 <6.4`],a,o)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>(K(e.insert)&&this._unwrap(e,`insert`),this._wrap(e,`insert`,pB(`insert`)),K(e.remove)&&this._unwrap(e,`remove`),this._wrap(e,`remove`,pB(`remove`)),K(e.update)&&this._unwrap(e,`update`),this._wrap(e,`update`,pB(`update`)),K(e.command)&&this._unwrap(e,`command`),this._wrap(e,`command`,mB()),K(e.query)&&this._unwrap(e,`query`),this._wrap(e,`query`,_B()),K(e.getMore)&&this._unwrap(e,`getMore`),this._wrap(e,`getMore`,vB()),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 K(t.checkOut)&&this._unwrap(t,`checkOut`),this._wrap(t,`checkOut`,yB()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,`checkOut`)}}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>(K(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,hB()),e),v4PatchConnectionPromise:e=>(K(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,gB()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,`command`)}}}},SB=`Mongo`,CB=Y(SB,()=>new xB),wB=W((()=>({name:SB,setupOnce(){CB()}})));function TB(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
31
+ Mongoose Error Code: ${t.code}`:``}`})}function EB(e,t){return e instanceof Promise?e.catch(e=>{throw TB(t,e),e}).finally(()=>t.end()):(t.end(),e)}function DB(e,t,n,r,i){let a=0;return i.length===2?a=1:i.length===3&&(a=2),i[a]=(t,n)=>(t&&TB(r,t),r.end(),e(t,n)),t.apply(n,i)}var OB=`@sentry/instrumentation-mongoose`,kB=`auto.db.otel.mongoose`,AB=[`deleteOne`,`deleteMany`,`find`,`findOne`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`],jB=[`remove`,`count`,`findOneAndRemove`,...AB],MB=[`count`,`findOneAndRemove`,...AB],NB=[...AB];function PB(e){return e?e.startsWith(`6.`)||e.startsWith(`5.`)?jB:e.startsWith(`7.`)?MB:NB:AB}function FB(e){return e&&(e.startsWith(`5.`)||e.startsWith(`6.`))||!1}function IB(e){return!e||!e.startsWith(`8.`)?!1:parseInt(e.split(`.`)[1],10)>=21}var LB=Symbol(`stored-parent-span`),RB=Symbol(`already-instrumented`),zB=class extends q{constructor(e={}){super(OB,k,e)}init(){return new J(`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,FB(t)&&this._wrap(n.Model.prototype,`remove`,this.patchOnModelMethods(`remove`)),IB(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()),PB(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=PB(t);this._unwrap(n.Model.prototype,`save`),n.Model.prototype.$save=n.Model.prototype.save,FB(t)&&this._unwrap(n.Model.prototype,`remove`),IB(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[LB],i=VR({collection:this._model.collection,modelName:this._model?.modelName,operation:`aggregate`,origin:kB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchQueryExec(){let e=this;return t=>function(n){if(this[RB])return t.apply(this,arguments);let r=this[LB],i=VR({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:kB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchOnModelMethods(e){let t=this;return n=>function(r,i){let a=VR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:kB});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=VR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:kB}),c=t._handleResponse(s,n,this,arguments,o);return c&&typeof c==`object`&&(c[RB]=!0),c}}patchModelStatic(e){let t=this;return n=>function(r,i,a){typeof i==`function`&&(a=i);let o=VR({collection:this.collection,modelName:this.modelName,operation:e,origin:kB});return t._handleResponse(o,n,this,arguments,a)}}patchModelAggregate(){return e=>function(){let t=R(),n=e.apply(this,arguments);return n&&(n[LB]=t),n}}patchAndCaptureSpanContext(e){return e=>function(){return this[LB]=R(),e.apply(this,arguments)}}_handleResponse(e,t,n,r,i){return V(e,()=>i instanceof Function?DB(i,t,n,e,r):EB(t.apply(n,r),e))}},BB=`Mongoose`,VB=Y(BB,()=>new zB),HB=W((()=>ju(FF(),{name:BB,setupOnce(){VB()}}))),UB=`db.connection_string`,WB=`mysql`;function GB(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function KB(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function qB(e){return typeof e==`string`?e:e.sql}function JB(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var YB=`@sentry/instrumentation-mysql`,XB=`auto.db.otel.mysql`,ZB=class extends q{constructor(e={}){super(YB,k,e)}init(){return[new J(`mysql`,[`>=2.0.0 <3`],e=>(K(e.createConnection)&&this._unwrap(e,`createConnection`),this._wrap(e,`createConnection`,this._patchCreateConnection()),K(e.createPool)&&this._unwrap(e,`createPool`),this._wrap(e,`createPool`,this._patchCreatePool()),K(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=M();return function(r,i){i&&(K(i.query)||t._wrap(i,`query`,t._patchQuery(i))),typeof e==`function`&&Er(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}=GB(e.config),u=parseInt(String(s),10),d={[I]:XB,[zs]:WB,[UB]:KB(o,s,c),[Ms]:c,[Vs]:l,[Rs]:qB(r),[Xc]:o};isNaN(u)||(d[Zc]=u);let f=B({name:JB(r),kind:G.CLIENT,attributes:d}),p=Array.from(arguments).findIndex(e=>typeof e==`function`),m=M();if(p===-1){let n=V(f,()=>t.apply(e,arguments));return Fo(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)),V(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(),Er(t,()=>n(...arguments))}}},QB=`Mysql`,$B=Y(QB,()=>new ZB({})),eV=W((()=>({name:QB,setupOnce(){$B()}}))),tV=`db.connection_string`,nV=`mysql`;function rV(e){let{host:t,port:n,database:r,user:i}=iV(e),a={[tV]:aV(t,n,r),[Ms]:r,[Vs]:i,[Xc]:t},o=parseInt(n,10);return isNaN(o)||(a[Zc]=o),a}function iV(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function aV(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function oV(e,t,n){let[r,i]=typeof e==`string`?[e,n]:[e.sql,sV(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 sV(e){return`values`in e}function cV(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var lV=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function uV(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query==`function`&&typeof n?.execute==`function`?n:t}var dV=`@sentry/instrumentation-mysql2`,fV=`auto.db.otel.mysql2`,pV=[`>=1.4.2 <3.20.0`],mV=class extends q{constructor(e={}){super(dV,k,e)}init(){let e;function t(t){!e&&t.format&&(e=t.format)}let n=t=>{K(t.query)&&this._unwrap(t,`query`),this._wrap(t,`query`,this._patchQuery(e)),K(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 J(`mysql2`,pV,e=>(t(e),e),()=>{},[new JR(`mysql2/promise.js`,pV,e=>(t(e),e),()=>{}),new JR(`mysql2/lib/connection.js`,pV,e=>{let t=uV(e);return n(t),e},e=>{if(e===void 0)return;let t=uV(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={...rV(this.config),[zs]:nV,[Rs]:oV(r,e,o),[I]:fV},c=B({name:cV(r),kind:G.CLIENT,attributes:s}),l=lV(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)}}},hV=`Mysql2`,gV=Y(hV,()=>new mV),_V=W((()=>ju(dI(),{name:hV,setupOnce(){gV()}}))),vV,yV;function bV(e){vV=e}function xV(){return!!vV}function SV(){if(vV)return yV??=vV()}var CV=[`get`,`set`,`setex`],wV=[`get`,`mget`],TV=[`set`,`setex`],EV=[`del`,`unlink`];function DV(e,t){return e.includes(t.toLowerCase())}function OV(e){if(DV(wV,e))return`cache.get`;if(DV(TV,e))return`cache.put`;if(DV(EV,e))return`cache.remove`}function kV(e,t){return t.some(t=>e.startsWith(t))}function AV(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)?NV(e.map(e=>n(e))):[`<unknown>`],r=t[0];return DV(CV,e)&&r!=null?n(r):NV(t.map(e=>n(e)))}catch{return}}function jV(e,t,n){if(!OV(e))return!1;for(let e of t)if(kV(e,n))return!0;return!1}function MV(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 NV(e){let t=[],n=e=>{e.forEach(e=>{Array.isArray(e)?n(e):t.push(e)})};return n(e),t}var PV={};function FV(e){PV=e}var IV=(e,t,n,r)=>{let i=AV(t,n),a=OV(t);if(!i||!a||!PV.cachePrefixes||!jV(t,i,PV.cachePrefixes))return;let o=L(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=DV(EV,t)?void 0:MV(r);l&&e.setAttribute(Gr,l),DV(wV,t)&&l!==void 0&&e.setAttribute(Ur,l>0),e.setAttributes({[F]:a,[Wr]:i});let u=i.join(`, `);e.updateName(PV.maxCacheKeyLength?xn(u,PV.maxCacheKeyLength):u)},LV=`db.connection_string`,RV=`redis`,zV=`@sentry/instrumentation-ioredis`,BV=`auto.db.otel.redis`,VV=[`>=2.0.0 <5.11.0`];function HV(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var UV=class extends q{constructor(e={}){super(zV,k,e)}init(){return[new J(`ioredis`,VV,e=>{let t=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;return K(t.prototype.sendCommand)&&this._unwrap(t.prototype,`sendCommand`),this._wrap(t.prototype,`sendCommand`,this._patchSendCommand()),K(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`||!R())return t.apply(this,n);let{host:i,port:a}=this.options,o={[zs]:RV,[Rs]:YI(r.name,r.args),[LV]:`redis://${i}:${a}`,[Xc]:i,[Zc]:a,[I]:BV},s=B({name:r.name,kind:G.CLIENT,attributes:o});try{let i=t.apply(this,n),a=r.resolve;r.resolve=function(t){e._callResponseHook(s,r,t),HV(s,null),a(t)};let o=r.reject;return r.reject=function(e){HV(s,e),o(e)},i}catch(e){throw HV(s,e),e}}}_patchConnection(){return e=>function(...t){if(!R())return e.apply(this,t);let{host:n,port:r}=this.options,i={[zs]:RV,[Rs]:`connect`,[LV]:`redis://${n}:${r}`,[Xc]:n,[Zc]:r,[I]:BV},a=B({name:`connect`,kind:G.CLIENT,attributes:i});try{let n=e.apply(this,t);return n instanceof Promise?n.then(e=>(HV(a,null),e),e=>(HV(a,e),Promise.reject(e))):(HV(a,null),n)}catch(e){throw HV(a,e),e}}}_callResponseHook(e,t,n){let{responseHook:r}=this.getConfig();if(r)try{r(e,t.name,t.args,n)}catch{}}},WV=`@sentry/instrumentation-redis`,GV=`auto.db.otel.redis`,KV=Symbol(`opentelemetry.instrumentation.redis.open_spans`),qV=Symbol(`opentelemetry.instrumentation.redis.multi_command_options`);function JV(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function YV(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function XV(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){gP&&A.error(`failed to sanitize redis connection url`,e)}}function ZV(e){return{[zs]:RV,[Xc]:e?.socket?.host,[Zc]:e?.socket?.port,[LV]:XV(e?.url),[I]:GV}}var QV=class e extends q{constructor(e={}){super(WV,k,e)}init(){return[new J(`redis`,[`>=2.6.0 <4`],e=>(K(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={[zs]:RV,[Rs]:YI(r.command,r.args),[I]:GV};this.connection_options&&(i[Xc]=this.connection_options.host,i[Zc]=this.connection_options.port),this.address&&(i[LV]=`redis://${this.address}`);let a=B({name:`${e.COMPONENT}-${r.command}`,kind:G.CLIENT,attributes:i}),o=arguments[0].callback;if(o){let e=R();arguments[0].callback=function(n,i){return YV(t.getConfig().responseHook,a,r.command,r.args,i),JV(a,n),V(e??null,()=>o.apply(this,arguments))}}try{return n.apply(this,arguments)}catch(e){throw JV(a,e),e}}}}};QV.COMPONENT=`redis`;var $V=QV,eH=class e extends q{constructor(e={}){super(WV,k,e)}init(){return[this._getInstrumentationNodeModuleDefinition(`@redis/client`),this._getInstrumentationNodeModuleDefinition(`@node-redis/client`)]}_getInstrumentationNodeModuleDefinition(e){return new J(e,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>e,()=>{},[new JR(`${e}/dist/lib/commander.js`,[`^1.0.0`],(e,t)=>{let n=e.transformCommandArguments;if(!n)return gP&&A.error(`internal instrumentation error, missing transformCommandArguments function`),e;let r=t?.startsWith(`1.0.`)?`extendWithCommands`:`attachCommands`;return K(e?.[r])&&this._unwrap(e,r),this._wrap(e,r,this._getPatchExtendWithCommands(n)),e},e=>{K(e?.extendWithCommands)&&this._unwrap(e,`extendWithCommands`),K(e?.attachCommands)&&this._unwrap(e,`attachCommands`)}),new JR(`${e}/dist/lib/client/multi-command.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return K(t?.exec)&&this._unwrap(t,`exec`),this._wrap(t,`exec`,this._getPatchMultiCommandsExec()),K(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),this._wrap(t,`execAsPipeline`,this._getPatchMultiCommandsExec()),K(t?.addCommand)&&this._unwrap(t,`addCommand`),this._wrap(t,`addCommand`,this._getPatchMultiCommandsAddCommand()),e},e=>{let t=e?.default?.prototype;K(t?.exec)&&this._unwrap(t,`exec`),K(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),K(t?.addCommand)&&this._unwrap(t,`addCommand`)}),new JR(`${e}/dist/lib/client/index.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return t?.multi&&(K(t?.multi)&&this._unwrap(t,`multi`),this._wrap(t,`multi`,this._getPatchRedisClientMulti())),t?.MULTI&&(K(t?.MULTI)&&this._unwrap(t,`MULTI`),this._wrap(t,`MULTI`,this._getPatchRedisClientMulti())),K(t?.sendCommand)&&this._unwrap(t,`sendCommand`),this._wrap(t,`sendCommand`,this._getPatchRedisClientSendCommand()),K(t?.connect)&&this._unwrap(t,`connect`),this._wrap(t,`connect`,this._getPatchedClientConnect()),e},e=>{let t=e?.default?.prototype;K(t?.multi)&&this._unwrap(t,`multi`),K(t?.MULTI)&&this._unwrap(t,`MULTI`),K(t?.sendCommand)&&this._unwrap(t,`sendCommand`),K(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[KV];return e._endSpansWithRedisReplies(n,t),t}).catch(t=>{let n=this[KV];if(!n)gP&&A.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)}):(gP&&A.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[qV]=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=ZV(this.options),r=B({name:`${e.COMPONENT}-connect`,kind:G.CLIENT,attributes:n});return V(r,()=>t.apply(this)).then(e=>(r.end(),e),e=>(JV(r,e),Promise.reject(e)))}}}_traceClientCommand(t,n,r,i){let a=n.options||n[qV],o=i[0],s=i.slice(1),c=ZV(a),l=YI(o,s);l!=null&&(c[Rs]=l);let u=B({name:`${e.COMPONENT}-${o}`,kind:G.CLIENT,attributes:c}),d=V(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[KV]=e[KV]||[],e[KV].push({span:u,commandName:o,commandArgs:s})}return d}_endSpansWithRedisReplies(e,t){if(!e){gP&&A.error(`cannot find open spans to end for redis multi/pipeline`);return}if(t.length!==e.length){gP&&A.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||YV(this.getConfig().responseHook,e,t,n,r),JV(e,i)}};eH.COMPONENT=`redis`;var tH=eH,nH=class extends q{constructor(e={}){super(WV,k,e),this.initialized=!1,this.instrumentationV2_V3=new $V(this.getConfig()),this.instrumentationV4_V5=new tH(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())}},rH=`Redis`,iH=Y(`${rH}.IORedis`,()=>new UV({responseHook:IV})),aH=Y(`${rH}.Redis`,()=>new nH({responseHook:IV})),oH=Object.assign(()=>{(!xV()||!C.tracingChannel)&&(iH(),aH())},{id:rH}),sH=W(((e={})=>ju(qI({responseHook:IV}),{name:rH,setupOnce(){FV(e),oH()}}))),cH=(e=>(e.QUERY_PREFIX=`pg.query`,e.CONNECT=`pg.connect`,e.POOL_CONNECT=`pg-pool.connect`,e))(cH||{}),lH=(e=>(e.PG_PLAN=`db.postgresql.plan`,e.IDLE_TIMEOUT_MILLIS=`db.postgresql.idle.timeout.millis`,e.MAX_CLIENT=`db.postgresql.max.client`,e))(lH||{}),uH=`db.connection_string`,dH=`postgresql`,fH=`auto.db.otel.postgres`;function pH(e,t){if(!t)return cH.QUERY_PREFIX;let n=typeof t.name==`string`&&t.name?t.name:mH(t.text);return`${cH.QUERY_PREFIX}:${n}${e?` ${e}`:``}`}function mH(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 hH(e){try{let t=new URL(e);return t.username=``,t.password=``,t.toString()}catch{return`postgresql://localhost:5432/`}}function gH(e){return`connectionString`in e&&e.connectionString?hH(e.connectionString):`postgresql://${e.host||`localhost`}:${e.port||5432}/${e.database||``}`}function _H(e){if(Number.isInteger(e))return e}function vH(e){return{[zs]:dH,[Ms]:e.database,[uH]:gH(e),[Vs]:e.user,[Xc]:e.host,[Zc]:_H(e.port)}}function yH(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[lH.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[lH.MAX_CLIENT]:e.maxClient,[zs]:dH,[Ms]:t?.pathname.slice(1)??e.database,[uH]:gH(e),[Xc]:t?.hostname??e.host,[Zc]:Number(t?.port)||_H(e.port),[Vs]:t?.username??e.user}}function bH(){return R()===void 0}function xH(e){let{connectionParameters:t}=this,n=t.database,r=B({name:pH(n,e),kind:G.CLIENT,attributes:{...vH(t),[I]:fH}});return e?(e.text&&r.setAttribute(Rs,e.text),typeof e.name==`string`&&r.setAttribute(lH.PG_PLAN,e.name),r):r}function SH(e,t){return function(n,r){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r)}}function CH(e,t){return function(n,r,i){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r,i)}}function wH(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 TH(e){return typeof e==`object`&&e&&`message`in e?String(e.message):void 0}function EH(e){return typeof e==`object`&&typeof e?.text==`string`}var DH=`@sentry/instrumentation-pg`;function OH(e){return e[Symbol.toStringTag]===`Module`?e.default:e}function kH(e,t){return function(...n){return V(e,()=>t.apply(this,n))}}var AH=class extends q{constructor(e={}){super(DH,k,e)}init(){let e=[`>=8.0.3 <9`],t=[`>=2.0.0 <4`],n=new JR(`pg/lib/native/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this));return[new J(`pg`,e,e=>{let t=OH(e);return this._patchPgClient(t.Client),e},e=>{let t=OH(e);return this._unpatchPgClient(t.Client),e},[new JR(`pg/lib/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),n]),new J(`pg-pool`,t,e=>{let t=OH(e);return K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`connect`,this._getPoolConnectPatch()),t},e=>{let t=OH(e);K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`)})]}_patchPgClient(e){if(!e)return;let t=OH(e);return K(t.prototype.query)&&this._unwrap(t.prototype,`query`),K(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=OH(e);return K(t.prototype.query)&&this._unwrap(t.prototype,`query`),K(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),e}_getClientConnectPatch(){let e=this;return t=>function(n){if(bH()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=B({name:cH.CONNECT,kind:G.CLIENT,attributes:vH(this)}),i=n;if(i){let e=R();i=wH(r,i),e&&(i=kH(e,i))}return jH(r,V(r,()=>t.call(this,i)))}}_getClientQueryPatch(){return e=>(this._diag.debug(`Patching pg.Client.prototype.query`),function(...t){if(bH())return e.apply(this,t);let n=t[0],r=typeof n==`string`,i=EH(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=xH.call(this,a);if(t.length>0){let e=R();if(typeof t[t.length-1]==`function`)t[t.length-1]=SH(o,t[t.length-1]),e&&(t[t.length-1]=kH(e,t[t.length-1]));else if(typeof a?.callback==`function`){let n=SH(o,a.callback);e&&(n=kH(e,n)),t[0].callback=n}}let s;try{s=e.apply(this,t)}catch(e){throw o.setStatus({code:2,message:TH(e)}),o.end(),e}return s instanceof Promise?s.then(e=>(o.end(),e)).catch(e=>(o.setStatus({code:2,message:TH(e)}),o.end(),Promise.reject(e))):s})}_getPoolConnectPatch(){let e=this;return t=>function(n){if(bH()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=B({name:cH.POOL_CONNECT,kind:G.CLIENT,attributes:yH(this.options)}),i=n;if(i){let e=R();i=CH(r,i),e&&(i=kH(e,i))}return jH(r,V(r,()=>t.call(this,i)))}}};function jH(e,t){return t instanceof Promise?t.then(t=>(e.end(),t)).catch(t=>(e.setStatus({code:2,message:TH(t)}),e.end(),Promise.reject(t))):t}var MH=`Postgres`,NH=Y(MH,AH,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),PH=W((e=>({name:MH,setupOnce(){NH(e)}})));x();var FH=`PostgresJs`,IH=[`>=3.0.0 <4`],LH=`db.response.status_code`,RH=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,zH=Symbol.for(`sentry.query.from.instrumented.sql`),BH=Y(FH,e=>new VH({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),VH=class extends q{constructor(e){super(`sentry-postgres-js`,k,e)}init(){let e=new J(`postgres`,IH,e=>{try{return this._patchPostgres(e)}catch(t){return gP&&A.error(`Failed to patch postgres module:`,t),e}},e=>e);return[`src`,`cf/src`,`cjs/src`].forEach(t=>{e.files.push(new JR(`postgres/${t}/query.js`,IH,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 gP&&A.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 gP&&A.warn(`postgres() did not return a valid instance`),t;let i=r.getConfig();return $S(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:(db(e,`default`,i),e)}_shouldCreateSpans(){let e=this.getConfig();return _.getSpan(l.active())!==void 0||!e.requireParentSpan}_setOperationName(e,t,n){if(n){e.setAttribute(Is,n);return}let r=t?.match(RH);r?.[1]&&e.setAttribute(Is,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[zH]||!t._shouldCreateSpans())return n.apply(this,e);let r=t._reconstructQuery(this.strings),i=t._sanitizeSqlQuery(r);return ao({name:i||`postgresjs.query`,op:`db`},r=>{MN(r,`auto.db.postgresjs`),r.setAttributes({[Bs]:`postgres`,[Ls]:i});let{requestHook:a}=t.getConfig();a&&DT(()=>a(r,i,void 0),e=>{e&&(r.setAttribute(`sentry.hook.error`,`requestHook failed`),gP&&A.error(`Error in requestHook for ${FH} 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){gP&&A.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(LH,a?.[0]?.code||`unknown`),r.setAttribute(Hs,a?.[0]?.name||`unknown`),t._setOperationName(r,i),r.end()}catch(e){gP&&A.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}},HH=W((e=>({name:FH,setupOnce(){BH(e)}}))),UH=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(UH||{}),WH=`@hapi/hapi`,GH=Symbol(`hapi-handler-patched`),KH={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},qH=new Set([`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`]);function JH(e){return e.name?e.name:e.pkg.name}var YH=e=>typeof e==`string`&&qH.has(e),XH=e=>{let t=e?.type;return t!==void 0&&YH(t)},ZH=e=>Array.isArray(e)&&e.length<=3&&YH(e[0])&&typeof e[1]==`function`,QH=e=>!Array.isArray(e),$H=(e,t)=>{let n={[Dc]:e.path,[wc]:e.method},r;return t?(n[UH.HAPI_TYPE]=KH.PLUGIN,n[UH.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[UH.HAPI_TYPE]=KH.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},eU=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[UH.EXT_TYPE]:e,[UH.HAPI_TYPE]:KH.EXT,[UH.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[UH.EXT_TYPE]:e,[UH.HAPI_TYPE]:KH.EXT},name:r}},tU=e=>`plugin`in e?`plugin`in e.plugin?e.plugin.plugin:e.plugin:e;x();var nU=`@sentry/instrumentation-hapi`,rU=class extends q{constructor(e={}){super(nU,k,e)}init(){return new J(WH,[`>=17.0.0 <22`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return K(t.server)||this._wrap(t,`server`,this._getServerPatch.bind(this)),K(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=tU(e);t._wrapRegisterHandler(n)}else{let e=tU(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(YH(r.type)){let a=r;a.method=n._wrapExtMethods(a.method,r.type,t),i[e]=a}}return e.apply(this,r)}if(ZH(r)){let i=r,a=i[1],o=n._wrapExtMethods(a,i[0],t);return e.apply(this,[i[0],o,i[2]])}if(XH(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=JH(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 r=this;if(e instanceof Array){for(let n=0;n<e.length;n++)e[n]=r._wrapExtMethods(e[n],t);return e}return QH(e)?e[GH]===!0?e:(e[GH]=!0,function(...r){if(_.getSpan(l.active())===void 0)return e.apply(this,r);let i=eU(t,n,e.name);return z({name:i.name,op:`${i.attributes[UH.HAPI_TYPE]}.hapi`,attributes:{...i.attributes,[I]:`auto.http.otel.hapi`}},()=>e.apply(void 0,r))}):e}_wrapRouteHandler(e,t){if(e[GH]===!0)return e;e[GH]=!0;let n=n=>function(...r){if(_.getSpan(l.active())===void 0)return n.call(this,...r);_P(e.path);let i=$H(e,t);return z({name:i.name,op:`${i.attributes[UH.HAPI_TYPE]}.hapi`,attributes:{...i.attributes,[I]:`auto.http.otel.hapi`}},()=>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}},iU=`Hapi`,aU=Y(iU,()=>new rU),oU=W((()=>({name:iU,setupOnce(){aU()}})));function sU(e){return!!(e&&typeof e==`object`&&`error`in e&&e.error)}function cU(e){H(e,{mechanism:{type:`auto.function.hapi`,handled:!1}})}var lU={name:`SentryHapiErrorPlugin`,version:k,register:async function(e){e.events.on({name:`request`,channels:[`error`]},(e,t)=>{if(N()!==ar()){let t=e.route;t.path&&N().setTransactionName(`${t.method.toUpperCase()} ${t.path}`)}else gP&&A.warn(`Isolation scope is still the default isolation scope - skipping setting transactionName`);sU(t)&&cU(t.error)})}};async function uU(e){await e.register(lU),qM(e.register,`hapi`)}var dU={HONO_TYPE:`hono.type`,HONO_NAME:`hono.name`},fU={MIDDLEWARE:`middleware`,REQUEST_HANDLER:`request_handler`};x();var pU=`@sentry/instrumentation-hono`,mU=`0.0.1`,hU=class extends q{constructor(e={}){super(pU,mU,e)}init(){return[new J(`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,r){if(!t.isEnabled())return e.apply(this,[n,r]);let i=n.req.path,a=t.tracer.startSpan(i);return l.with(_.setSpan(l.active(),a),()=>t._safeExecute(()=>{let o=e.apply(this,[n,r]);if(Gt(o))return o.then(n=>{let r=t._determineHandlerType(n);return a.setAttributes({[dU.HONO_TYPE]:r,[dU.HONO_NAME]:r===fU.REQUEST_HANDLER?i:e.name||`anonymous`}),t.getConfig().responseHook?.(a),n});{let n=t._determineHandlerType(o);return a.setAttributes({[dU.HONO_TYPE]:n,[dU.HONO_NAME]:n===fU.REQUEST_HANDLER?i:e.name||`anonymous`}),t.getConfig().responseHook?.(a),o}},()=>a.end(),e=>{t._handleError(a,e),a.end()}))}}_safeExecute(e,t,n){try{let r=e();return Gt(r)?r.then(()=>t(),e=>n(e)):t(),r}catch(e){throw n(e),e}}_determineHandlerType(e){return e===void 0?fU.MIDDLEWARE:fU.REQUEST_HANDLER}_handleError(e,t){t instanceof Error&&(e.setStatus({code:oe.ERROR,message:t.message}),e.recordException(t))}},gU=`Hono`;function _U(e){let t=L(e).data,n=t[dU.HONO_TYPE];if(t[`sentry.op`]||!n)return;e.setAttributes({[I]:`auto.http.otel.hono`,[F]:`${n}.hono`});let r=t[dU.HONO_NAME];if(typeof r==`string`&&e.updateName(r),N()===ar()){gP&&A.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let i=t[Dc],a=t[Tc];typeof i==`string`&&typeof a==`string`&&N().setTransactionName(`${a} ${i}`)}var vU=Y(gU,()=>new hU({responseHook:e=>{_U(e)}})),yU=W((()=>({name:gU,setupOnce(){vU()}})));function bU(){return async function(e,t){let n=Ff(e.req);N().setSDKProcessingMetadata({normalizedRequest:n}),await t()}}function xU(e){return e.res.status>=500}function SU(e){return async function(t,n){await n(),(e?.shouldHandleError||xU)(t)&&(t.res.sentry=H(t.error,{mechanism:{type:`auto.middleware.hono`,handled:!1}}))}}function CU(e,t){e.use(bU()),e.use(SU(t)),qM(e.use,`hono`)}var wU=(e=>(e.ROUTER=`router`,e.MIDDLEWARE=`middleware`,e))(wU||{}),TU=(e=>(e.KOA_TYPE=`koa.type`,e.KOA_NAME=`koa.name`,e))(TU||{}),EU=(e,t,n,r)=>n?{attributes:{[TU.KOA_NAME]:r?.toString(),[TU.KOA_TYPE]:wU.ROUTER,[Dc]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[TU.KOA_NAME]:t.name??`middleware`,[TU.KOA_TYPE]:wU.MIDDLEWARE,[As]:t.name??`middleware`},name:`middleware - ${t.name}`},DU=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e)),OU=Symbol(`koa-layer-patched`);x();var kU=`@sentry/instrumentation-koa`,AU=class extends q{constructor(e={}){super(kU,k,e)}init(){return new J(`koa`,[`>=2.0.0 <4`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return t==null?t:(K(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&&K(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 r=t?wU.ROUTER:wU.MIDDLEWARE;return e[OU]===!0||DU(r,this.getConfig())||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[OU]=!0,(i,a)=>{if(_.getSpan(l.active())===void 0)return e(i,a);let o=EU(i,e,t,n);i._matchedRoute&&_P(i._matchedRoute.toString());let s=o.attributes[TU.KOA_NAME];return z({name:typeof s==`string`?s||`< unknown >`:o.name,op:`${r}.koa`,attributes:{...o.attributes,[I]:`auto.http.otel.koa`}},()=>{let t=o.attributes[Dc];if(N()===ar())gP&&A.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);else if(t){let e=i.request?.method?.toUpperCase()||`GET`;N().setTransactionName(`${e} ${t}`)}return e(i,a)})})}},jU=`Koa`,MU=Y(jU,AU,(e={})=>({ignoreLayersType:e.ignoreLayersType})),NU=W(((e={})=>({name:jU,setupOnce(){MU(e)}}))),PU=e=>{e.use(async(e,t)=>{try{await t()}catch(e){throw H(e,{mechanism:{handled:!1,type:`auto.middleware.koa`}}),e}}),qM(e.use,`koa`)},FU=(e=>(e.CONNECT_TYPE=`connect.type`,e.CONNECT_NAME=`connect.name`,e))(FU||{}),IU=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(IU||{}),LU=Symbol(`opentelemetry.instrumentation-connect.request-route-stack`),RU=e=>{Array.isArray(e[LU])===!1&&Object.defineProperty(e,LU,{enumerable:!1,value:[]}),e[LU].push(`/`);let t=e[LU].length;return()=>{t===e[LU].length?e[LU].pop():gP&&A.warn(`Connect: Trying to pop the stack multiple time`)}},zU=(e,t)=>{t&&e[LU].splice(-1,1,t)},BU=e=>e[LU].reduce((e,t)=>e.replace(/\/+$/,``)+t),VU=`@sentry/instrumentation-connect`,HU=`anonymous`,UU=class extends q{constructor(e={}){super(VU,k,e)}init(){return[new J(`connect`,[`>=3.0.0 <4`],e=>this._patchConstructor(e))]}_patchApp(e){K(e.use)||this._wrap(e,`use`,this._patchUse.bind(this)),K(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){It(r)&&t.setStatus({code:2,message:`internal_error`});let i=e.apply(this,[r]);return n(),i}}_startSpan(e,t){let n=e?IU.REQUEST_HANDLER:IU.MIDDLEWARE,r=e||t.name||HU;return B({name:r,op:`${n}.connect`,attributes:{[I]:`auto.http.otel.connect`,[Dc]:e.length>0?e:`/`,[FU.CONNECT_TYPE]:n,[FU.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];zU(l,e),e&&_P(BU(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=RU(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)}}},WU=`Connect`,GU=Y(WU,()=>new UU),KU=W((()=>({name:WU,setupOnce(){GU()}})));function qU(e,t,n,r){H(e,{mechanism:{handled:!1,type:`auto.middleware.connect`}}),r(e)}var JU=e=>{e.use(qU),qM(e.use,`connect`)},YU=`db.sql.table`,XU=`sqlite`,ZU=`postgresql`,QU=e=>{if(e){if(e.client){if(e.client._formatQuery)return e.client._formatQuery.bind(e.client);if(e.client.SqlString)return e.client.SqlString.format.bind(e.client.SqlString)}if(e.builder)return e.builder.toString.bind(e.builder)}return()=>`<noop formatter>`},$U=new Map([[`sqlite3`,XU],[`pg`,ZU]]),eW=e=>$U.get(e)||e,tW=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,nW=(e,t)=>typeof e==`string`&&typeof t==`number`&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,rW=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}},iW=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},aW=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},oW=e=>{let t=e?._single?.table;return typeof t==`object`?oW(t):t},sW=`@sentry/instrumentation-knex`,cW=`auto.db.otel.knex`,lW=`knex`,uW=[`>=0.22.0 <4`,`>=0.10.0 <0.18.0`,`>=0.19.0 <0.22.0`,`>=0.18.0 <0.19.0`],dW=1022,fW=Symbol(`sentry.instrumentation-knex.parent-span`),pW=class extends q{constructor(e={}){super(sW,k,e)}init(){let e=new J(lW,uW);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 JR(`knex/${e}/runner.js`,uW,(e,t)=>(this._ensureWrapped(e.prototype,`query`,this._createQueryWrapper(t)),e),e=>(this._unwrap(e.prototype,`query`),e))}_getClientNodeModuleFileInstrumentation(e){return new JR(`knex/${e}/client.js`,uW,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=oW(this.builder),a=n?.method,o=r?.connection?.connectionString,s=r?.connection?.filename||r?.connection?.database||rW(o),c={[I]:cW,"knex.version":e,[zs]:eW(this.client.driverName),[YU]:i,[Ps]:a,[Vs]:r?.connection?.user,[Ms]:s,[Xc]:r?.connection?.host??iW(o),[Zc]:r?.connection?.port??aW(o),[Qc]:r?.connection?.filename===`:memory:`?`inproc`:void 0,[Rs]:nW(n?.sql,dW)},l=this.builder[fW]||R(),u=arguments;return z({name:tW(s,a,i),kind:G.CLIENT,attributes:c,parentSpan:l,onlyIfParent:!0},e=>t.apply(this,u).catch(t=>{let r=QU(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,fW,{value:R()}),t}}_ensureWrapped(e,t,n){K(e[t])&&this._unwrap(e,t),this._wrap(e,t,n)}},mW=`sentrySubscribeOrchestrionChannel`;function Q(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:mW}))}return n}var hW={name:`amqplib`,versionRange:`>=0.5.5 <2`},gW=[{channelName:`publish`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`publish`,kind:`Sync`}},{channelName:`confirmPublish`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`ConfirmChannel`,methodName:`publish`,kind:`Callback`}},{channelName:`consume`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`consume`,kind:`Async`}},{channelName:`dispatch`,module:{...hW,filePath:`lib/channel.js`},functionQuery:{className:`BaseChannel`,methodName:`dispatchMessage`,kind:`Sync`}},{channelName:`ack`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ack`,kind:`Sync`}},{channelName:`nack`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nack`,kind:`Sync`}},{channelName:`reject`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`reject`,kind:`Sync`}},{channelName:`ackAll`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ackAll`,kind:`Sync`}},{channelName:`nackAll`,module:{...hW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nackAll`,kind:`Sync`}},{channelName:`connect`,module:{...hW,filePath:`lib/connect.js`},functionQuery:{functionName:`connect`,kind:`Callback`}}],_W={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`},vW=Q(gW),yW=[...[`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`}}))],bW={ANTHROPIC_CHAT:`orchestrion:@anthropic-ai/sdk:chat`,ANTHROPIC_MODELS:`orchestrion:@anthropic-ai/sdk:models`,ANTHROPIC_MESSAGES_STREAM:`orchestrion:@anthropic-ai/sdk:messages-stream`},xW=Q(yW),SW=[{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`}}],CW={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`},wW=Q(SW),TW={name:`dataloader`,versionRange:`>=2.0.0 <3`,filePath:`index.js`},EW=[{channelName:`construct`,module:TW,functionQuery:{functionName:`DataLoader`,kind:`Sync`}},{channelName:`load`,module:TW,functionQuery:{expressionName:`load`,kind:`Async`}},{channelName:`loadMany`,module:TW,functionQuery:{expressionName:`loadMany`,kind:`Async`}},{channelName:`prime`,module:TW,functionQuery:{expressionName:`prime`,kind:`Sync`}},{channelName:`clear`,module:TW,functionQuery:{expressionName:`clear`,kind:`Sync`}},{channelName:`clearAll`,module:TW,functionQuery:{expressionName:`clearAll`,kind:`Sync`}}],DW={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`},OW=Q(EW),kW=[{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`}}],AW={EXPRESS_HANDLE:`orchestrion:express:handle`,ROUTER_HANDLE:`orchestrion:router:handle`,EXPRESS_REGISTER:`orchestrion:express:register`,ROUTER_REGISTER:`orchestrion:router:register`},jW=Q(kW),MW=`>=3.0.0 <5`,NW=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,PW=[{functionName:`addDoc`,channelName:`add-doc`},{functionName:`getDocs`,channelName:`get-docs`},{functionName:`setDoc`,channelName:`set-doc`},{functionName:`deleteDoc`,channelName:`delete-doc`}],FW=`>=6.0.0 <7`,IW=[{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`}],LW=[...PW.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:`@firebase/firestore`,versionRange:MW,filePath:NW},functionQuery:{functionName:e,kind:`Auto`}})),...IW.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:`firebase-functions`,versionRange:FW,filePath:e},functionQuery:{functionName:t,kind:`Sync`}}))],RW={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`},zW=Q(LW),BW=[{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`}}],VW={GENERIC_POOL_ACQUIRE:`orchestrion:generic-pool:acquire`},HW=Q(BW),UW=[`dist/node/index.js`,`dist/node/index.mjs`,`dist/node/index.cjs`],WW=[...UW.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`}}))),...UW.map(e=>({channelName:`embed-content`,module:{name:`@google/genai`,versionRange:`>=0.10.0 <2`,filePath:e},functionQuery:{className:`Models`,methodName:`embedContent`,kind:`Auto`}})),...UW.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`}})))],GW={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`},KW=Q(WW),qW=[{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`}}],JW={GRAPHQL_PARSE:`orchestrion:graphql:parse`,GRAPHQL_VALIDATE:`orchestrion:graphql:validate`,GRAPHQL_EXECUTE:`orchestrion:graphql:execute`},YW=Q(qW),XW=[{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`}}],ZW={HAPI_ROUTE:`orchestrion:@hapi/hapi:route`,HAPI_EXT:`orchestrion:@hapi/hapi:ext`},QW=Q(XW),$W=[...[`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`}}],eG={IOREDIS_COMMAND:`orchestrion:ioredis:command`,IOREDIS_CONNECT:`orchestrion:ioredis:connect`},tG=Q($W),nG=[{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`}}],rG={KAFKAJS_SEND_BATCH:`orchestrion:kafkajs:send_batch`,KAFKAJS_CONSUMER_RUN:`orchestrion:kafkajs:consumer_run`},iG=Q(nG),aG=`knex`,oG=[{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`}],sG=[{filePath:`lib/client.js`,versionRange:`>=0.10.0 <4`},{filePath:`src/client.js`,versionRange:`>=0.18.0 <0.19.0`}],cG=[`queryBuilder`,`schemaBuilder`,`raw`];function lG(e,t){return{channelName:`query`,module:{name:aG,versionRange:t,filePath:e},functionQuery:{className:`Runner`,methodName:`query`,kind:`Async`}}}function uG(e,t,n){return{channelName:e,module:{name:aG,versionRange:n,filePath:t},functionQuery:{className:`Client`,methodName:e,kind:`Sync`}}}var dG=[...oG.map(({filePath:e,versionRange:t})=>lG(e,t)),...sG.flatMap(({filePath:e,versionRange:t})=>cG.map(n=>uG(n,e,t)))],fG={KNEX_QUERY:`orchestrion:knex:query`,KNEX_QUERY_BUILDER:`orchestrion:knex:queryBuilder`,KNEX_SCHEMA_BUILDER:`orchestrion:knex:schemaBuilder`,KNEX_RAW:`orchestrion:knex:raw`},pG=Q(dG),mG=[{channelName:`use`,module:{name:`koa`,versionRange:`>=2.0.0 <4`,filePath:`lib/application.js`},functionQuery:{className:`Application`,methodName:`use`,kind:`Sync`}}],hG={KOA_USE:`orchestrion:koa:use`},gG=Q(mG),_G=[`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`}}]}),vG=`embedQuery`,yG=`embedDocuments`,bG=[{name:`@langchain/openai`,versionRange:`>=0.1.0 <2.0.0`,methods:[vG,yG]},{name:`@langchain/google-genai`,versionRange:`>=0.1.0 <3.0.0`,methods:[vG,yG]},{name:`@langchain/mistralai`,versionRange:`>=0.1.0 <2.0.0`,methods:[vG,yG]},{name:`@langchain/google-common`,versionRange:`>=0.1.0 <3.0.0`,methods:[yG]}],xG=bG.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`}})))),SG=[..._G,...xG],CG=bG.flatMap(({name:e,methods:t})=>t.map(t=>`orchestrion:${e}:${t}`)),wG={LANGCHAIN_CHAT_MODEL_INVOKE:`orchestrion:@langchain/core:chatModelInvoke`,LANGCHAIN_CHAT_MODEL_STREAM:`orchestrion:@langchain/core:chatModelStream`},TG=Q(SG),EG=e=>({name:`@langchain/langgraph`,versionRange:`>=0.0.0 <2.0.0`,filePath:e}),DG=[`dist/graph/state.cjs`,`dist/graph/state.js`].map(e=>({channelName:`stateGraphCompile`,module:EG(e),functionQuery:{className:`StateGraph`,methodName:`compile`,kind:`Sync`}})),OG=[`dist/prebuilt/react_agent_executor.cjs`,`dist/prebuilt/react_agent_executor.js`].map(e=>({channelName:`createReactAgent`,module:EG(e),functionQuery:{functionName:`createReactAgent`,kind:`Sync`}})),kG=[...DG,...OG],AG={LANGGRAPH_STATE_GRAPH_COMPILE:`orchestrion:@langchain/langgraph:stateGraphCompile`,LANGGRAPH_CREATE_REACT_AGENT:`orchestrion:@langchain/langgraph:createReactAgent`},jG=Q(kG),MG=[{channelName:`load`,module:{name:`lru-memoizer`,versionRange:`>=2.1.0 <4`,filePath:`lib/async.js`},functionQuery:{functionName:`memoizedFunction`,kind:`Callback`}}],NG={LRU_MEMOIZER_LOAD:`orchestrion:lru-memoizer:load`},PG=Q(MG),FG={name:`mongodb`},IG=[{channelName:`command`,module:{...FG,versionRange:`>=6.4.0 <8`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Async`}},{channelName:`command`,module:{...FG,versionRange:`>=4.0.0 <6.4`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Callback`}},{channelName:`checkout`,module:{...FG,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:{...FG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/index.js`},functionQuery:{expressionName:e,kind:`Callback`}})),{channelName:`v3_command`,module:{...FG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/command.js`},functionQuery:{functionName:`command`,kind:`Callback`}},{channelName:`v3_query`,module:{...FG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/query.js`},functionQuery:{functionName:`query`,kind:`Callback`}},{channelName:`v3_get_more`,module:{...FG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/get_more.js`},functionQuery:{functionName:`getMore`,kind:`Callback`}}],LG={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`},RG=Q(IG),zG={name:`mongoose`,versionRange:`>=5.9.7 <9.7.0`},BG=[`find`,`findOne`,`deleteOne`,`deleteMany`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`,`remove`,`count`,`findOneAndRemove`],VG=[{channelName:`query_exec`,module:{...zG,filePath:`lib/query.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`aggregate_exec`,module:{...zG,filePath:`lib/aggregate.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`model_save`,module:{...zG,filePath:`lib/model.js`},functionQuery:{expressionName:`save`,kind:`Auto`}},{channelName:`model_insert_many`,module:{...zG,filePath:`lib/model.js`},functionQuery:{expressionName:`insertMany`,kind:`Auto`}},{channelName:`model_bulk_write`,module:{...zG,filePath:`lib/model.js`},functionQuery:{expressionName:`bulkWrite`,kind:`Auto`}},{channelName:`model_remove`,module:{...zG,filePath:`lib/model.js`},functionQuery:{expressionName:`remove`,kind:`Auto`}},{channelName:`model_aggregate`,module:{...zG,filePath:`lib/model.js`},functionQuery:{expressionName:`aggregate`,kind:`Sync`}},...BG.map(e=>({channelName:`ctx_${e}`,module:{...zG,filePath:`lib/query.js`},functionQuery:{expressionName:e,kind:`Sync`}}))],HG={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`},UG=BG.map(e=>`orchestrion:mongoose:ctx_${e}`),WG=Q(VG),GG=[{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`}}],KG={MYSQL2_QUERY:`orchestrion:mysql2:query`,MYSQL2_EXECUTE:`orchestrion:mysql2:execute`},qG=Q(GG),JG=[{channelName:`query`,module:{name:`mysql`,versionRange:`>=2.0.0 <3`,filePath:`lib/Connection.js`},functionQuery:{expressionName:`query`,kind:`Auto`}}],YG={MYSQL_QUERY:`orchestrion:mysql:query`},XG=Q(JG);function ZG(e){return e}var QG=[{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`}},ZG({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`}}),ZG({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`}}],$G={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`},eK=Q(QG),tK=[...[`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`}}))],nK={OPENAI_CHAT:`orchestrion:openai:chat`,OPENAI_EMBEDDINGS:`orchestrion:openai:embeddings`},rK=Q(tK),iK=[{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`}}],aK={PG_QUERY:`orchestrion:pg:query`,PG_CONNECT:`orchestrion:pg:connect`,PGPOOL_CONNECT:`orchestrion:pg-pool:connect`},oK=Q(iK),sK=[`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`}}]),cK={POSTGRESJS_HANDLE:`orchestrion:postgres:handle`,POSTGRESJS_CONNECTION:`orchestrion:postgres:connection`,POSTGRESJS_EXECUTE:`orchestrion:postgres:execute`,POSTGRESJS_CONNECT:`orchestrion:postgres:connect`},lK=Q(sK),uK=[{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`}}],dK={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`},fK=Q(uK),pK=[`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`}}]),mK={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`},hK=Q(pK),gK=`tedious`,_K=`lib/connection.js`,vK=`>=1.11.0 <20`,yK=[`connect`,`execSql`,`execSqlBatch`,`callProcedure`,`execBulkLoad`,`prepare`,`execute`].map(e=>({channelName:e,module:{name:gK,versionRange:vK,filePath:_K},functionQuery:{className:`Connection`,methodName:e,kind:`Sync`}})),bK={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`},xK=Q(yK),SK=[...wK(`>=4.0.0 <7.0.0`,`generateText`,`generateText`,`Async`),...wK(`>=4.0.0 <7.0.0`,`streamText`,`streamText`,`Sync`),...wK(`>=4.0.0 <7.0.0`,`generateObject`,`generateObject`,`Async`),...wK(`>=4.0.0 <7.0.0`,`embed`,`embed`,`Async`),...wK(`>=4.0.0 <7.0.0`,`embedMany`,`embedMany`,`Async`),...wK(`>=5.0.0 <7.0.0`,`resolveLanguageModel`,`resolveLanguageModel`,`Sync`),...wK(`>=6.0.0 <7.0.0`,`executeToolCall`,`executeToolCall`,`Async`)],CK={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 wK(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 TK=Q(SK),$={..._W,...bW,...CW,...DW,...AW,...RW,...VW,...GW,...JW,...ZW,...eG,...rG,...fG,...hG,...wG,...AG,...NG,...LG,...HG,...KG,...YG,...$G,...nK,...aK,...cK,...dK,...mK,...bK,...CK},EK=`Amqplib`,DK=`auto.amqplib.orchestrion.publisher`,OK=`auto.amqplib.orchestrion.consumer`,kK=`messaging.operation`,AK=`messaging.destination`,jK=`messaging.destination_kind`,MK=`messaging.rabbitmq.routing_key`,NK=`messaging.protocol`,PK=`messaging.protocol_version`,FK=`messaging.url`,IK=`messaging.message_id`,LK=`messaging.conversation_id`,RK=`messaging.rabbitmq.destination.routing_key`,zK=`messaging.message.conversation_id`,BK=`topic`,VK=`process`,HK=`send`,UK=6e4,WK={Ack:`ack`,AckAll:`ackAll`,Reject:`reject`,Nack:`nack`,NackAll:`nackAll`,ChannelClosed:`channel closed`,ChannelError:`channel error`,InstrumentationTimeout:`instrumentation timeout`},GK=Symbol(`sentry.amqplib.message.stored-span`),KK=Symbol(`sentry.amqplib.channel.spans-not-ended`),qK=Symbol(`sentry.amqplib.channel.consume-timeout-timer`),JK=Symbol(`sentry.amqplib.channel.consumer-info`),YK=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),XK=Symbol(`sentry.amqplib.connection.attributes`),ZK=()=>{},QK=!1,$K=(()=>({name:EK,setupOnce(){C.tracingChannel&&!QK&&(QK=!0,X&&A.log(`[orchestrion:amqplib] subscribing to amqplib tracing channels`),U(()=>{aq(),eq(),tq(),nq(),rq(),iq()}))}}));function eq(){Z(C.tracingChannel($.AMQPLIB_PUBLISH),e=>{if(!e.self?.[YK])return fq(e)})}function tq(){let e=C.tracingChannel($.AMQPLIB_CONFIRM_PUBLISH);Z(e,e=>(e.self&&(e.self[YK]=!0),fq(e))),e.end.subscribe(e=>{let t=e.self;t&&(t[YK]=!1)})}function nq(){let e=C.tracingChannel($.AMQPLIB_CONSUME);e.start.subscribe(ZK),e.asyncEnd.subscribe(e=>{let t=e,n=t.self,r=t.result?.consumerTag;if(!n||!r)return;sq(n);let i=t.arguments[0],a=typeof i==`string`?i:`<unknown>`,o=t.arguments[2];n[JK]?.set(r,{noAck:!!o?.noAck,queue:a})})}function rq(){Z(C.tracingChannel($.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;sq(t);let i=n?.consumerTag?t[JK]?.get(n.consumerTag):void 0,a=i?.queue??r.fields?.routingKey??`<unknown>`,o=i?.noAck??!1,s=r.properties?.headers,c=co({sentryTrace:Sq(s,`sentry-trace`),baggage:Sq(s,`baggage`)},()=>pq(a,r,t));return o||(t[KK]?.push({msg:r,timeOfConsume:Un()}),r[GK]=c),e._sentryNoAck=o,c},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function iq(){C.tracingChannel($.AMQPLIB_ACK).start.subscribe(e=>oq(e,!1,WK.Ack)),C.tracingChannel($.AMQPLIB_NACK).start.subscribe(e=>oq(e,!0,WK.Nack)),C.tracingChannel($.AMQPLIB_REJECT).start.subscribe(e=>oq(e,!0,WK.Reject)),C.tracingChannel($.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&uq(t.self,!1,WK.AckAll,void 0)}),C.tracingChannel($.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&uq(t.self,!0,WK.NackAll,t.arguments[0])})}function aq(){let e=C.tracingChannel($.AMQPLIB_CONNECT);e.start.subscribe(ZK),e.asyncEnd.subscribe(e=>{let t=e,n=t.result;n&&typeof n==`object`&&(n[XK]={...gq(t.arguments?.[0]),...hq(n)})})}function oq(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===WK.Reject?a:o,c=r[KK]??[],l=c.findIndex(e=>e.msg===i);if(l<0)dq(i,t,n,s);else if(n!==WK.Reject&&a){for(let e=0;e<=l;e++)dq(c[e].msg,t,n,s);c.splice(0,l+1)}else dq(i,t,n,s),c.splice(l,1)}function sq(e){if(Object.prototype.hasOwnProperty.call(e,KK))return;e[KK]=[],e[JK]=new Map;let t=setInterval(()=>lq(e),UK);t.unref?.(),e[qK]=t,typeof e.on==`function`&&(e.on(`close`,()=>{uq(e,!0,WK.ChannelClosed,void 0),cq(e)}),e.on(`error`,()=>{uq(e,!0,WK.ChannelError,void 0),cq(e)}))}function cq(e){let t=e[qK];t&&(clearInterval(t),e[qK]=void 0)}function lq(e){let t=Un(),n=e[KK]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<UK)break;dq(e.msg,null,WK.InstrumentationTimeout,!0)}n.splice(0,r)}function uq(e,t,n,r){(e[KK]??[]).forEach(e=>{dq(e.msg,t,n,r)}),e[KK]=[]}function dq(e,t,n,r){let i=e[GK];i&&(t!==!1&&i.setStatus({code:2,message:n!==WK.ChannelClosed&&n!==WK.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[GK]=void 0)}function fq(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=B({name:`publish ${_q(r)}`,op:`message`,kind:G.PRODUCER,attributes:{...mq(e.self),[AK]:r,[Lc]:r,[jK]:BK,[MK]:i,[RK]:i,[Bc]:HK,[IK]:a?.messageId,[Rc]:a?.messageId,[LK]:a?.correlationId,[zK]:a?.correlationId,[I]:DK}});(!a||typeof a!=`object`)&&(a={},e.arguments[3]=a);let s=a.headers&&typeof a.headers==`object`?a.headers:a.headers={},c=wf({span:o});return c[`sentry-trace`]&&(s[`sentry-trace`]=c[`sentry-trace`]),c.baggage&&(s.baggage=c.baggage),o}function pq(e,t,n){return B({name:`${e} process`,op:`message`,kind:G.CONSUMER,attributes:{...mq(n),[AK]:t.fields?.exchange,[Lc]:t.fields?.exchange,[jK]:BK,[MK]:t.fields?.routingKey,[RK]:t.fields?.routingKey,[kK]:VK,[Bc]:VK,[IK]:t.properties?.messageId,[Rc]:t.properties?.messageId,[LK]:t.properties?.correlationId,[zK]:t.properties?.correlationId,[I]:OK}})}function mq(e){let t=e?.connection,n=t?.[XK];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r==`string`&&r?{[Vc]:r.toLowerCase()}:{}}function hq(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t==`string`&&t?{[Vc]:t.toLowerCase()}:{}}function gq(e){let t={[PK]:`0.9.1`,[Gc]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=bq(e.protocol),i=xq(e.hostname),a=yq(e.port,r);t[NK]=r,t[Wc]=r,t[dl]=i,t[fl]=a,t[Xc]=i,t[Zc]=a}else if(typeof n==`string`){let e=vq(n);t[FK]=e,t[hl]=e;try{let n=new URL(e),r=bq(n.protocol),i=xq(n.hostname),a=yq(n.port?parseInt(n.port,10):void 0,r);t[NK]=r,t[Wc]=r,t[dl]=i,t[fl]=a,t[Xc]=i,t[Zc]=a}catch{}}return t}function _q(e){return e===``?`<default>`:e}function vq(e){return e.replace(/:[^:@/]*@/,`:***@`)}function yq(e,t){return e||(t===`AMQP`?5672:5671)}function bq(e){let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()}function xq(e){return e||`localhost`}function Sq(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}var Cq=W($K),wq=`Anthropic_AI`,Tq=`auto.ai.orchestrion.anthropic`,Eq=[{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`}],Dq=!1,Oq=((e={})=>({name:wq,setupOnce(){C.tracingChannel&&!Dq&&(Dq=!0,U(()=>{for(let{channel:t,operation:n,methodPath:r,stream:i}of Eq)X&&A.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),Z(C.tracingChannel(t),t=>kq(t,n,r,e),{beforeSpanEnd:(t,n)=>{Vv(t,n.result,Zg(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>Mq(t,n,i,e)})}))}}));function kq(e,t,n,r){let i=e.arguments??[];if(ef(wq)||i[1]?.headers?.[`X-Stainless-Helper-Method`]===`stream`)return;let a=typeof i[0]==`object`&&i[0]!==null?i[0]:void 0,{recordInputs:o}=Zg(r),s=Qg(r.enableTruncation),c=Lv(i,n,t),l=c[`gen_ai.request.model`]||`unknown`;c[I]=Tq;let u=B({name:`${t} ${l}`,op:`gen_ai.${t}`,attributes:c});return o&&a&&Rv(u,a,s),u}function Aq(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function jq(e){return!!e&&typeof e.on==`function`}function Mq(e,t,n,r){let{recordOutputs:i}=Zg(r),a=t.result;if(n===`async-iterable`&&Aq(a)){let t=a[Symbol.asyncIterator].bind(a),n=Nv({[Symbol.asyncIterator]:t},e,i);return a[Symbol.asyncIterator]=()=>n,!0}return n===`message-stream`&&jq(a)?(Pv(a,e,i),!0):!1}var Nq=W(Oq),Pq=`auto.aws.orchestrion.aws_sdk`,Fq=`dynamodb`,Iq=`messaging.destination_kind`,Lq=`topic`,Rq=`chat`,zq=`aws.bedrock`,Bq=new TextDecoder,Vq=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=Rq,r={[uc]:zq,[Qs]:Rq},i=e.commandInput.modelId;i&&(r[nc]=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[tc]=e),t!==void 0&&(r[ic]=t),n!==void 0&&(r[ac]=n),i!==void 0&&(r[rc]=i)}return{spanName:n,isStream:t,spanAttributes:r}}_requestPreSpanHookInvokeModel(e,t){let n={[uc]:zq},r=e.commandInput?.modelId;if(r&&(n[nc]=r),e.commandInput?.body){let t=JSON.parse(e.commandInput.body);r.includes(`amazon.titan`)?(t.textGenerationConfig?.temperature!==void 0&&(n[ic]=t.textGenerationConfig.temperature),t.textGenerationConfig?.topP!==void 0&&(n[ac]=t.textGenerationConfig.topP),t.textGenerationConfig?.maxTokenCount!==void 0&&(n[tc]=t.textGenerationConfig.maxTokenCount),t.textGenerationConfig?.stopSequences!==void 0&&(n[rc]=t.textGenerationConfig.stopSequences)):r.includes(`amazon.nova`)?(t.inferenceConfig?.temperature!==void 0&&(n[ic]=t.inferenceConfig.temperature),t.inferenceConfig?.top_p!==void 0&&(n[ac]=t.inferenceConfig.top_p),t.inferenceConfig?.max_new_tokens!==void 0&&(n[tc]=t.inferenceConfig.max_new_tokens),t.inferenceConfig?.stopSequences!==void 0&&(n[rc]=t.inferenceConfig.stopSequences)):r.includes(`anthropic.claude`)?(t.max_tokens!==void 0&&(n[tc]=t.max_tokens),t.temperature!==void 0&&(n[ic]=t.temperature),t.top_p!==void 0&&(n[ac]=t.top_p),t.stop_sequences!==void 0&&(n[rc]=t.stop_sequences)):r.includes(`meta.llama`)?(t.max_gen_len!==void 0&&(n[tc]=t.max_gen_len),t.temperature!==void 0&&(n[ic]=t.temperature),t.top_p!==void 0&&(n[ac]=t.top_p)):r.includes(`cohere.command-r`)?(t.max_tokens!==void 0&&(n[tc]=t.max_tokens),t.temperature!==void 0&&(n[ic]=t.temperature),t.p!==void 0&&(n[ac]=t.p),t.message!==void 0&&(n[hc]=Math.ceil(t.message.length/6)),t.stop_sequences!==void 0&&(n[rc]=t.stop_sequences)):r.includes(`cohere.command`)?(t.max_tokens!==void 0&&(n[tc]=t.max_tokens),t.temperature!==void 0&&(n[ic]=t.temperature),t.p!==void 0&&(n[ac]=t.p),t.prompt!==void 0&&(n[hc]=Math.ceil(t.prompt.length/6)),t.stop_sequences!==void 0&&(n[rc]=t.stop_sequences)):r.includes(`mistral`)&&(t.prompt!==void 0&&(n[hc]=Math.ceil(t.prompt.length/6)),t.max_tokens!==void 0&&(n[tc]=t.max_tokens),t.temperature!==void 0&&(n[ic]=t.temperature),t.top_p!==void 0&&(n[ac]=t.top_p),t.stop!==void 0&&(n[rc]=t.stop))}return{isStream:t,spanAttributes:n}}_responseHookConverse(e,t){let{stopReason:n,usage:r}=e.data;Wq(t,n),Gq(t,r)}_responseHookConverseStream(e,t){e.data.stream=Uq(e.data.stream,t)}_responseHookInvokeModel(e,t){let n=e.request.commandInput?.modelId;if(e.data?.body){let r=Bq.decode(e.data.body),i=JSON.parse(r);n.includes(`amazon.titan`)?(i.inputTextTokenCount!==void 0&&t.setAttribute(hc,i.inputTextTokenCount),i.results?.[0]?.tokenCount!==void 0&&t.setAttribute(gc,i.results[0].tokenCount),i.results?.[0]?.completionReason!==void 0&&t.setAttribute(oc,[i.results[0].completionReason])):n.includes(`amazon.nova`)?(i.usage!==void 0&&(i.usage.inputTokens!==void 0&&t.setAttribute(hc,i.usage.inputTokens),i.usage.outputTokens!==void 0&&t.setAttribute(gc,i.usage.outputTokens)),i.stopReason!==void 0&&t.setAttribute(oc,[i.stopReason])):n.includes(`anthropic.claude`)?(i.usage?.input_tokens!==void 0&&t.setAttribute(hc,i.usage.input_tokens),i.usage?.output_tokens!==void 0&&t.setAttribute(gc,i.usage.output_tokens),i.stop_reason!==void 0&&t.setAttribute(oc,[i.stop_reason])):n.includes(`meta.llama`)?(i.prompt_token_count!==void 0&&t.setAttribute(hc,i.prompt_token_count),i.generation_token_count!==void 0&&t.setAttribute(gc,i.generation_token_count),i.stop_reason!==void 0&&t.setAttribute(oc,[i.stop_reason])):n.includes(`cohere.command-r`)?(i.text!==void 0&&t.setAttribute(gc,Math.ceil(i.text.length/6)),i.finish_reason!==void 0&&t.setAttribute(oc,[i.finish_reason])):n.includes(`cohere.command`)?(i.generations?.[0]?.text!==void 0&&t.setAttribute(gc,Math.ceil(i.generations[0].text.length/6)),i.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(oc,[i.generations[0].finish_reason])):n.includes(`mistral`)&&(i.outputs?.[0]?.text!==void 0&&t.setAttribute(gc,Math.ceil(i.outputs[0].text.length/6)),i.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(oc,[i.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(e,t){let n=e.data?.body,r=e.request.commandInput?.modelId;if(!n||!r)return;let i=Hq(r);e.data.body=(async function*(){try{for await(let e of n){if(i){let n=Kq(e?.chunk?.bytes);n&&i(n,t)}yield e}}finally{t.end()}})()}};function Hq(e){if(e.includes(`amazon.titan`))return Yq;if(e.includes(`anthropic.claude`))return Jq;if(e.includes(`amazon.nova`))return qq;if(e.includes(`meta.llama`))return Xq;if(e.includes(`cohere.command-r`))return $q;if(e.includes(`cohere.command`))return Qq;if(e.includes(`mistral`))return Zq}async function*Uq(e,t){try{let n;for await(let r of e)Wq(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;Gq(t,n)}finally{t.end()}}function Wq(e,t){t!==void 0&&e.setAttribute(oc,[t])}function Gq(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(hc,n),r!==void 0&&e.setAttribute(gc,r)}}function Kq(e){if(!e||!(e instanceof Uint8Array))return null;try{let t=Buffer.from(e).toString(`utf-8`);return JSON.parse(t)}catch(e){return X&&A.warn(`[orchestrion:aws-sdk] failed to parse streamed bedrock chunk`,e),null}}function qq(e,t){e.metadata?.usage!==void 0&&(e.metadata?.usage.inputTokens!==void 0&&t.setAttribute(hc,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(gc,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(oc,[e.messageStop.stopReason])}function Jq(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(hc,e.message.usage.input_tokens),e.message?.usage?.output_tokens!==void 0&&t.setAttribute(gc,e.message.usage.output_tokens),e.delta?.stop_reason!==void 0&&t.setAttribute(oc,[e.delta.stop_reason])}function Yq(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(hc,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(gc,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(oc,[e.completionReason])}function Xq(e,t){e.prompt_token_count!==void 0&&t.setAttribute(hc,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(gc,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(oc,[e.stop_reason])}function Zq(e,t){e.outputs?.[0]?.text!==void 0&&t.setAttribute(gc,Math.ceil(e.outputs[0].text.length/6)),e.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(oc,[e.outputs[0].stop_reason])}function Qq(e,t){e.generations?.[0]?.text!==void 0&&t.setAttribute(gc,Math.ceil(e.generations[0].text.length/6)),e.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(oc,[e.generations[0].finish_reason])}function $q(e,t){e.text!==void 0&&t.setAttribute(gc,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(oc,[e.finish_reason])}function eJ(e){return Array.isArray(e)?e:[e]}var tJ=class{requestPreSpanHook(e){let t=e.commandName,n=e.commandInput?.TableName,r={};return r[zs]=Fq,r[Ms]=n,r[Ps]=t,e.commandInput?.TableName?r[vs]=[e.commandInput.TableName]:e.commandInput?.RequestItems&&(r[vs]=Object.keys(e.commandInput.RequestItems)),(t===`CreateTable`||t===`UpdateTable`)&&e.commandInput?.ProvisionedThroughput&&(r[ds]=e.commandInput.ProvisionedThroughput.ReadCapacityUnits,r[fs]=e.commandInput.ProvisionedThroughput.WriteCapacityUnits),(t===`GetItem`||t===`Scan`||t===`Query`)&&e.commandInput?.ConsistentRead&&(r[es]=e.commandInput.ConsistentRead),(t===`Query`||t===`Scan`)&&e.commandInput?.ProjectionExpression&&(r[us]=e.commandInput.ProjectionExpression),t===`CreateTable`&&(e.commandInput?.GlobalSecondaryIndexes&&(r[is]=eJ(e.commandInput.GlobalSecondaryIndexes).map(e=>JSON.stringify(e))),e.commandInput?.LocalSecondaryIndexes&&(r[ls]=eJ(e.commandInput.LocalSecondaryIndexes).map(e=>JSON.stringify(e)))),(t===`ListTables`||t===`Query`||t===`Scan`)&&e.commandInput?.Limit&&(r[cs]=e.commandInput.Limit),t===`ListTables`&&e.commandInput?.ExclusiveStartTableName&&(r[rs]=e.commandInput.ExclusiveStartTableName),t===`Query`&&(e.commandInput?.ScanIndexForward&&(r[ms]=e.commandInput.ScanIndexForward),e.commandInput?.IndexName&&(r[os]=e.commandInput.IndexName),e.commandInput?.Select&&(r[gs]=e.commandInput.Select)),t===`Scan`&&(e.commandInput?.Segment&&(r[hs]=e.commandInput?.Segment),e.commandInput?.TotalSegments&&(r[ys]=e.commandInput?.TotalSegments),e.commandInput?.IndexName&&(r[os]=e.commandInput.IndexName),e.commandInput?.Select&&(r[gs]=e.commandInput.Select)),t===`UpdateTable`&&(e.commandInput?.AttributeDefinitions&&(r[$o]=eJ(e.commandInput.AttributeDefinitions).map(e=>JSON.stringify(e))),e.commandInput?.GlobalSecondaryIndexUpdates&&(r[as]=eJ(e.commandInput.GlobalSecondaryIndexUpdates).map(e=>JSON.stringify(e)))),{spanAttributes:r,spanKind:G.CLIENT,spanOp:`db`}}responseHook(e,t){e.data?.ConsumedCapacity&&t.setAttribute(ts,eJ(e.data.ConsumedCapacity).map(e=>JSON.stringify(e))),e.data?.ItemCollectionMetrics&&t.setAttribute(ss,eJ(e.data.ItemCollectionMetrics).map(e=>JSON.stringify(e))),e.data?.TableNames&&t.setAttribute(_s,e.data?.TableNames.length),e.data?.Count&&t.setAttribute(ns,e.data?.Count),e.data?.ScannedCount&&t.setAttribute(ps,e.data?.ScannedCount)}},nJ=class{requestPreSpanHook(e){let t=e.commandInput?.StreamName,n={};return t&&(n[bs]=t),{spanAttributes:n,spanKind:G.CLIENT}}},rJ=`Invoke`,iJ=class{requestPreSpanHook(e){let t=e.commandInput?.FunctionName,n={},r;return e.commandName===rJ&&(n[Ws]=t,n[Gs]=`aws`,r=`${t} ${rJ}`),{spanAttributes:n,spanKind:G.CLIENT,spanName:r}}requestPostSpanHook(e,t){e.commandName===rJ&&e.commandInput&&(e.commandInput.ClientContext=aJ(e.commandInput.ClientContext,t))}responseHook(e,t){e.request.commandName===rJ&&(t.setAttribute(Us,e.requestId),e.request.region&&t.setAttribute(Ks,e.request.region))}};function aJ(e,t){try{let n=wf({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?(X&&A.warn(`[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations.`),e):a}catch(t){return X&&A.log(`[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext`,t),e}}var oJ=class{requestPreSpanHook(e){let t=e.commandInput?.Bucket,n={};return t&&(n[Cs]=t),{spanAttributes:n,spanKind:G.CLIENT}}},sJ=class{requestPreSpanHook(e){let t=e.commandInput?.SecretId,n={};return typeof t==`string`&&t.startsWith(`arn:aws:secretsmanager:`)&&(n[ws]=t),{spanAttributes:n,spanKind:G.CLIENT}}responseHook(e,t){let n=e.data?.ARN;n&&t.setAttribute(ws,n)}},cJ=`sentry-trace`,lJ=`baggage`,uJ=[cJ,lJ];function dJ(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 X&&A.warn(`[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes`);return n}function fJ(e){let t=e.MessageAttributes??{},n=t[cJ]?.StringValue??t[cJ]?.Value;if(n)return{sentryTrace:n,baggage:t[lJ]?.StringValue??t[lJ]?.Value}}function pJ(e=[]){return Af([...e,...uJ])}var mJ=class{requestPreSpanHook(e){let t=G.CLIENT,n=`SNS ${e.commandName}`,r={[Vc]:`aws.sns`};if(e.commandName===`Publish`){t=G.PRODUCER,r[Iq]=Lq;let{TopicArn:i,TargetArn:a,PhoneNumber:o}=e.commandInput,s=hJ(i,a,o);r[Ic]=s,r[Lc]=i||a||o||`unknown`,n=`${o?`phone_number`:s} send`}let i=e.commandInput?.TopicArn;return i&&(r[Ts]=i),{spanAttributes:r,spanKind:t,spanName:n}}requestPostSpanHook(e,t){if(e.commandName===`Publish`){let n=e.commandInput.MessageAttributes??{};e.commandInput.MessageAttributes=dJ(n,wf({span:t}))}}responseHook(e,t){let n=e.data?.TopicArn;n&&t.setAttribute(Ts,n)}};function hJ(e,t,n){if(e||t){let n=e??t;try{return n.substring(n.lastIndexOf(`:`)+1)}catch{return n}}return n||`unknown`}var gJ=class{requestPreSpanHook(e){let t=vJ(e.commandInput),n=yJ(t),r=G.CLIENT,i,a={[Vc]:`aws_sqs`,[Lc]:n,[hl]:t};switch(e.commandName){case`ReceiveMessage`:r=G.CONSUMER,i=`${n} receive`,a[Bc]=`receive`,e.commandInput.MessageAttributeNames=pJ(e.commandInput.MessageAttributeNames);break;case`SendMessage`:case`SendMessageBatch`:r=G.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=dJ(n,wf({span:t}))}break;case`SendMessageBatch`:{let n=e.commandInput?.Entries;if(Array.isArray(n)){let e=wf({span:t});n.forEach(t=>{t.MessageAttributes=dJ(t.MessageAttributes??{},e)})}}}}responseHook(e,t){switch(e.request.commandName){case`SendMessage`:t.setAttribute(Rc,e?.data?.MessageId);break;case`SendMessageBatch`:break;case`ReceiveMessage`:{let n=e?.data?.Messages||[];t.setAttribute(Fc,n.length);for(let e of n)_J(t,e);break}}}};function _J(e,t){let n=fJ(t);if(!n)return;let{parentSpanId:r,traceId:i,sampled:a}=ki(n.sentryTrace,n.baggage);i&&r&&e.addLink({context:{traceId:i,spanId:r,traceFlags:+!!a},attributes:{[Rc]:t.MessageId}})}function vJ(e){return e?.QueueUrl}function yJ(e){if(!e)return;let t=e.split(`/`);if(t.length!==0)return t[t.length-1]}var bJ=class{requestPreSpanHook(e){let t=e.commandInput?.stateMachineArn,n=e.commandInput?.activityArn,r={};return t&&(r[Ds]=t),n&&(r[Es]=n),{spanAttributes:r,spanKind:G.CLIENT}}},xJ=class{constructor(){this._services=new Map([[`SecretsManager`,new sJ],[`SFN`,new bJ],[`SQS`,new gJ],[`SNS`,new mJ],[`DynamoDB`,new tJ],[`Lambda`,new iJ],[`S3`,new oJ],[`Kinesis`,new nJ],[`BedrockRuntime`,new Vq]])}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 SJ(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function CJ(e,t,n,r){return{serviceName:e?.replace(/\s+/g,``),commandName:SJ(t,`Command`),commandInput:n,region:r}}function wJ(e){return{[nl]:`aws-api`,[el]:e.commandName,[tl]:e.serviceName,[ks]:e.region}}var TJ=`Aws`;function EJ(e){try{return e()}catch(e){X&&A.warn(`[orchestrion:aws-sdk] error building span`,e);return}}function DJ(e,t){t&&(t.requestId&&e.setAttribute(Ss,t.requestId),t.httpStatusCode&&e.setAttribute(kc,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(xs,t.extendedRequestId))}var OJ=W((()=>{let e=new xJ;return{name:TJ,setupOnce(){if(!C.tracingChannel)return;let t=t=>EJ(()=>{let n=t.arguments[0],r=n?.constructor?.name;if(!n||!r)return;let i=t.self?.config,a=i?.serviceId??SJ(t.self?.constructor?.name||`AWS`,`Client`);n.input||={};let o=CJ(a,r,n.input,void 0),s=e.requestPreSpanHook(o),c=B({name:s.spanName??`${o.serviceName}.${o.commandName}`,kind:s.spanKind??G.CLIENT,op:s.spanOp||`rpc`,attributes:{[I]:Pq,...wJ(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(ks,e))}).catch(()=>{}).finally(()=>{u.settled=!0})};return t._sentryRegion=u,EJ(()=>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(EJ(()=>{if(o){let e=n.error,r=e?.$metadata;DJ(t,{requestId:e?.RequestId??r?.requestId,httpStatusCode:r?.httpStatusCode,extendedRequestId:e?.extendedRequestId??r?.extendedRequestId});return}let r=n.result;DJ(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];X&&A.log(`[orchestrion:aws-sdk] subscribing to channels "${r.join(`", "`)}"`),U(()=>{for(let e of r)Z(C.tracingChannel(e),t,n)})}}})),kJ=`Dataloader`,AJ=`dataloader`,jJ=`auto.db.orchestrion.dataloader`,MJ=`cache.get`,NJ=Symbol(`sentry.dataloader.wrapped`);function PJ(e,t){let n=e?.name;return n?`${AJ}.${t} ${n}`:`${AJ}.${t}`}function FJ(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}function IJ(e,t,n){let r=t===`load`||t===`loadMany`||t===`batch`;return{name:PJ(e,t),kind:t===`batch`?void 0:G.CLIENT,op:r?MJ:void 0,onlyIfParent:!0,attributes:{[I]:jJ,[Os]:r?FJ(n):void 0}}}var LJ=(()=>({name:kJ,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:dataloader] subscribing to dataloader tracing channels`),U(()=>{RJ(),zJ(),BJ($.DATALOADER_LOAD_MANY,`loadMany`),BJ($.DATALOADER_PRIME,`prime`),BJ($.DATALOADER_CLEAR,`clear`),BJ($.DATALOADER_CLEAR_ALL,`clearAll`)}))}}));function RJ(){C.tracingChannel($.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!=`function`||n[NJ])return;let r=n,i=function(...e){return z({...IJ(this,`batch`,e[0]),links:this._batch?.spanLinks},()=>r.apply(this,e))};i[NJ]=!0,t.arguments[0]=i})}function zJ(){let e=C.tracingChannel($.DATALOADER_LOAD);Z(e,e=>VJ(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 BJ(e,t){Z(C.tracingChannel(e),e=>VJ(e.self,t,e.arguments[0]),{requiresParentSpan:!0})}function VJ(e,t,n){return B(IJ(e,t,n))}var HJ=W(LJ),UJ=`GenericPool`,WJ=W((()=>({name:UJ,setupOnce(){C.tracingChannel&&U(()=>GJ())}})));function GJ(){Z(C.tracingChannel($.GENERIC_POOL_ACQUIRE),()=>B({name:`generic-pool.acquire`,attributes:{[I]:`auto.db.orchestrion.generic_pool`}}))}var KJ=`Google_GenAI`,qJ=`auto.ai.orchestrion.google_genai`,JJ=[{channel:$.GOOGLE_GENAI_GENERATE_CONTENT,operation:`generate_content`},{channel:$.GOOGLE_GENAI_EMBED_CONTENT,operation:`embeddings`},{channel:$.GOOGLE_GENAI_CHAT,operation:`chat`}],YJ=!1,XJ=((e={})=>({name:KJ,setupOnce(){C.tracingChannel&&!YJ&&(YJ=!0,U(()=>{for(let{channel:t,operation:n}of JJ)X&&A.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),Z(C.tracingChannel(t),t=>ZJ(t,n,e),{beforeSpanEnd:(t,r)=>{n!==`embeddings`&&oy(t,r.result,Zg(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>$J(t,n,e)})}))}}));function ZJ(e,t,n){if(ef(KJ))return;if(t!==`chat`){let e=R();if(e){let{op:t,origin:n}=L(e);if(n===qJ&&t===`gen_ai.chat`)return}}let r=(e.arguments??[])[0],{recordInputs:i}=Zg(n),a=Qg(n.enableTruncation),o=iy(t,r,e.self),s=o[`gen_ai.request.model`]||`unknown`;o[I]=qJ;let c=B({name:`${t} ${s}`,op:`gen_ai.${t}`,attributes:o});return i&&r&&ay(c,r,t,a),c}function QJ(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function $J(e,t,n){let r=t.result;if(!QJ(r))return!1;let{recordOutputs:i}=Zg(n),a=r[Symbol.asyncIterator].bind(r),o=ey({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var eY=W(XJ),tY=`auto.graphql.diagnostic_channel`,nY=`graphql.parse`,rY=`graphql.validate`,iY=`graphql.execute`,aY=`graphql.resolve`,oY=`graphql.field.name`,sY=`graphql.field.path`,cY=`graphql.field.type`,lY=`graphql.parent.name`,uY=Symbol.for(`opentelemetry.graphql_data`),dY=Symbol.for(`opentelemetry.patched`);function fY(e){return typeof e?.then==`function`}function pY(e,t){if(!e||e[dY])return;e[dY]=!0;let n=e.getFields();Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=mY(t,r.resolve),r.type))for(let e of SY(r.type))pY(e,t)})}function mY(e,t,n=!1){if(typeof t!=`function`||t[dY])return t;function r(r,i,a,o){if(!t)return;let s=a??{};if(e().ignoreTrivialResolveSpans&&n&&(j(r)||typeof r==`function`)&&typeof r[o.fieldName]!=`function`||!s[uY])return t.call(this,r,i,s,o);let{field:c,spanAdded:l}=gY(s,o,xY(o.path)),u=c.span;return V(u,()=>{try{let e=t.call(this,r,i,s,o);return fY(e)?e.then(e=>(hY(u,l),e),e=>{throw hY(u,l,e),e}):(hY(u,l),e)}catch(e){throw hY(u,l,e),e}})}return r[dY]=!0,r}function hY(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function gY(e,t,n){let r=yY(e,n);if(r)return{field:r,spanAdded:!1};let i={span:_Y(t,n,bY(e,n))};return vY(e,n,i),{field:i,spanAdded:!0}}function _Y(e,t,n){let r={[I]:tY,[F]:BP,[oY]:e.fieldName,[sY]:t.join(`.`),[cY]:e.returnType.toString(),[lY]:e.parentType.name};return B({name:`${aY} ${t.join(`.`)}`,attributes:r,parentSpan:n})}function vY(e,t,n){let r=e[uY];r&&(r.fields[t.join(`.`)]=n)}function yY(e,t){return e[uY]?.fields[t.join(`.`)]}function bY(e,t){for(let n=t.length-1;n>0;n--){let r=yY(e,t.slice(0,n));if(r)return r.span}return e[uY]?.span}function xY(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function SY(e){return`ofType`in e&&e.ofType?SY(e.ofType):CY(e)?e.getTypes():wY(e)?[e]:[]}function CY(e){return`getTypes`in e&&typeof e.getTypes==`function`}function wY(e){return`getFields`in e&&typeof e.getFields==`function`}function TY(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 EY={[I]:tY,[F]:BP};function DY(){return B({name:nY,attributes:{...EY}})}function OY(e){return B({name:rY,attributes:{...EY,[vc]:QP(e)}})}function kY(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:`invalid_argument`})}function AY(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 jY(e,t,n,r){let i=AY(e),{schema:a,document:o}=i,{contextValue:s,fieldResolver:c}=i,l=!!s[uY];if(!n.ignoreResolveSpans&&!l){let e=c==null,n=t?.defaultFieldResolver,i=c??n;i&&(c=mY(r,i,e)),a&&(pY(a.getQueryType(),r),pY(a.getMutationType(),r))}let u=TY(o,i.operationName),d=u?.operation,f=u?.name?.value??i.operationName??void 0,p=B({name:YP(d,f||void 0,iY),attributes:{...EY,[bc]:d,[yc]:f||void 0,[vc]:QP(o)}});return n.useOperationNameForRootSpan&&d&&qP(p,d,f||void 0),s[uY]={source:o,span:p,fields:{}},i.writeBack(s,c),p}function MY(e,t){XP(t)&&e.setStatus({code:2,message:`internal_error`})}var NY=`Graphql`;function PY(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function FY(e){try{return e()}catch(e){X&&A.warn(`[orchestrion:graphql] error building span`,e);return}}var IY=W(((e={})=>{let t=PY(e),n=()=>t;return{name:NY,setupOnce(){C.tracingChannel&&U(()=>{Z(C.tracingChannel($.GRAPHQL_PARSE),()=>FY(()=>DY())),Z(C.tracingChannel($.GRAPHQL_VALIDATE),e=>FY(()=>OY(e.arguments[1])),{beforeSpanEnd:(e,t)=>void FY(()=>kY(e,t.result))}),Z(C.tracingChannel($.GRAPHQL_EXECUTE),e=>FY(()=>jY(e.arguments,e.self,t,n)),{beforeSpanEnd:(e,t)=>void FY(()=>MY(e,t.result))})})}}})),LY=e=>{let t=IY(e);return ju(yF(e),{name:NY,setupOnce:()=>t.setupOnce?.()})},RY=[`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`],zY=Symbol(`hapi-handler-patched`),BY={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},VY=new Set(RY),HY=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(HY||{});function UY(e){let t=R();if(!t)return;let n=na(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(Dc,e)}var WY=e=>typeof e==`string`&&VY.has(e),GY=e=>{let t=e?.type;return t!==void 0&&WY(t)},KY=e=>Array.isArray(e)&&e.length<=3&&WY(e[0])&&typeof e[1]==`function`,qY=e=>!Array.isArray(e),JY=(e,t)=>{let n={[Dc]:e.path,[wc]:e.method},r;return t?(n[HY.HAPI_TYPE]=BY.PLUGIN,n[HY.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[HY.HAPI_TYPE]=BY.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},YY=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[HY.EXT_TYPE]:e,[HY.HAPI_TYPE]:BY.EXT,[HY.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[HY.EXT_TYPE]:e,[HY.HAPI_TYPE]:BY.EXT},name:r}};function XY(e,t){return z({name:e.name,op:`${e.attributes[HY.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[I]:`auto.http.orchestrion.hapi`}},t)}function ZY(e,t){if(e[zY]===!0)return e;e[zY]=!0;let n=n=>function(...r){return R()?(UY(e.path),XY(JY(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 QY(e,t,n){if(Array.isArray(e)){for(let n=0;n<e.length;n++)e[n]=QY(e[n],t);return e}if(qY(e)){if(e[zY]===!0)return e;e[zY]=!0;let r=function(...r){return R()?XY(YY(t,n,e.name),()=>e.apply(void 0,r)):e.apply(this,r)};return r[zY]=!0,r}return e}function $Y(e,t){let n=e[0];if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=ZY(n[e],t);else e[0]=ZY(n,t)}function eX(e,t){if(Array.isArray(e[0])){let n=e[0];for(let e=0;e<n.length;e++){let r=n[e];if(WY(r.type)){let i=r;i.method=QY(i.method,r.type,t),n[e]=i}}return}if(KY(e)){let n=e,r=n[1];e[1]=QY(r,n[0],t);return}if(GY(e[0])){let n=e[0];n.method=QY(n.method,n.type,t)}}var tX=`Hapi`,nX=W((()=>({name:tX,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:hapi] subscribing to channels "${$.HAPI_ROUTE}" / "${$.HAPI_EXT}"`),C.tracingChannel($.HAPI_ROUTE).subscribe({start(e){let t=e;$Y(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),C.tracingChannel($.HAPI_EXT).subscribe({start(e){let t=e;eX(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}))),rX=`Koa`,iX=`auto.http.orchestrion.koa`,aX={ROUTER:`router`,MIDDLEWARE:`middleware`},oX=Symbol(`sentry.koa.layer-patched`),sX=!1,cX=((e={})=>{let t=e.ignoreLayersType??[];return{name:rX,setupOnce(){C.tracingChannel&&!sX&&(sX=!0,X&&A.log(`[orchestrion:koa] subscribing to channel "${$.KOA_USE}"`),C.tracingChannel($.KOA_USE).subscribe({start(e){lX(e,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function lX(e,t){let n=e.arguments[0];typeof n==`function`&&(e.arguments[0]=uX(n,t))}function uX(e,t){return e.router?dX(e,t):fX(e,!1,t)}function dX(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]=fX(e,!0,t,n)})}return e}function fX(e,t,n,r){let i=t?aX.ROUTER:aX.MIDDLEWARE;return e[oX]===!0||n.includes(i)||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[oX]=!0,(n,a)=>{if(!R())return e(n,a);let o=pX(n,e,t,r);n._matchedRoute&&mX(n._matchedRoute.toString());let s=o.attributes[Nc];return z({name:typeof s==`string`?s||`< unknown >`:o.name,op:`${i}.koa`,attributes:{...o.attributes,[I]:iX}},()=>{let t=o.attributes[Dc];if(N()===ar())X&&A.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);else if(t){let e=n.request?.method?.toUpperCase()||`GET`;N().setTransactionName(`${e} ${t}`)}return e(n,a)})})}function pX(e,t,n,r){return n?{attributes:{[Nc]:r?.toString(),[Pc]:aX.ROUTER,[Dc]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[Nc]:t.name||`middleware`,[Pc]:aX.MIDDLEWARE,[As]:t.name||`middleware`},name:`middleware - ${t.name}`}}function mX(e){let t=R();if(!t)return;let n=na(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(Dc,e)}var hX=W(cX),gX=`IORedis`,_X=`auto.db.orchestrion.redis`,vX=`db.connection_string`;function yX(e){return{host:e?.options?.host,port:e?.options?.port}}function bX(e,t){return{[zs]:`redis`,[vX]:`redis://${e}:${t}`,[Xc]:e,[Zc]:t,[I]:_X}}var xX=new WeakSet;function SX(e){let t=e.arguments?.[0];if(!t||typeof t!=`object`||xX.has(t))return;xX.add(t);let{host:n,port:r}=yX(e.self),i=YI(t.name,t.args??[]);return B({name:i,op:`db`,attributes:{...bX(n,r),[Rs]:i}})}var CX=((e={})=>{let t=e.responseHook;return{name:gX,setupOnce(){if(!C.tracingChannel)return;X&&A.log(`[orchestrion:ioredis] subscribing to "${$.IOREDIS_COMMAND}"/"${$.IOREDIS_CONNECT}"`);let e=C.tracingChannel($.IOREDIS_COMMAND),n=C.tracingChannel($.IOREDIS_CONNECT);U(()=>{Z(e,SX,{requiresParentSpan:!0,beforeSpanEnd(e,n){if(`error`in n||!t)return;let r=n.arguments?.[0];r&&wX(t,e,r,n.result)}}),Z(n,e=>{let{host:t,port:n}=yX(e.self);return B({name:`connect`,op:`db`,attributes:{...bX(t,n),[Rs]:`connect`}})},{requiresParentSpan:!0})})}}});function wX(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var TX=W(CX),EX=`messaging.destination.partition.id`,DX=`messaging.kafka.message.key`,OX=`messaging.kafka.message.tombstone`,kX=`messaging.kafka.offset`,AX=`process`,jX=`receive`,MX=`send`,NX=`kafka`,PX=`_OTHER`,FX=`auto.kafkajs.orchestrion.producer`,IX=`auto.kafkajs.orchestrion.consumer`,LX=1,RX=0;function zX(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function BX(e){let t=zX(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=ki(t,zX(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?LX:RX}}]}function VX({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return B({name:`${a} ${e}`,op:`message`,kind:n===`receive`?G.CLIENT:G.CONSUMER,links:r,attributes:{...i,[Vc]:NX,[Lc]:e,[Bc]:n,[zc]:a,[DX]:t?.key?String(t.key):void 0,[OX]:t?.key&&t.value===null?!0:void 0,[kX]:t?.offset,...t?{[I]:IX}:{}}})}function HX(e,t){let n=B({name:`send ${e}`,op:`message`,kind:G.PRODUCER,attributes:{[Vc]:NX,[Lc]:e,[DX]:t.key?String(t.key):void 0,[OX]:t.key&&t.value===null?!0:void 0,[EX]:t.partition===void 0?void 0:String(t.partition),[zc]:`send`,[Bc]:MX,[I]:FX}});t.headers=t.headers??{};let r=wf({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function UX(e,t){let n,r=PX;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(Hs,r),e.setStatus({code:2,message:n})})}function WX(e,t){return Promise.resolve(t).catch(t=>{throw UX(e,t),t}).finally(()=>{e.forEach(e=>e.end())})}var GX=Symbol(`sentry-kafkajs-consumer-callback-wrapped`);function KX(e){return typeof e==`function`&&e[GX]===!0}function qX(e){let t=function(t){return co({sentryTrace:zX(t.message.headers,`sentry-trace`),baggage:zX(t.message.headers,`baggage`)},()=>{let n=VX({topic:t.topic,message:t.message,operationType:AX,attributes:{[EX]:String(t.partition)}}),r=V(n,()=>e.call(this,t));return WX([n],r)})};return t[GX]=!0,t}function JX(e){let t=function(t){let n=fo(()=>VX({topic:t.batch.topic,message:void 0,operationType:jX,attributes:{[Fc]:t.batch.messages.length,[EX]:String(t.batch.partition)}}));return V(n,()=>{let r=[n];return t.batch.messages.forEach(e=>{r.push(VX({topic:t.batch.topic,message:e,operationType:AX,links:BX(e.headers),attributes:{[EX]:String(t.batch.partition)}}))}),WX(r,e.call(this,t))})};return t[GX]=!0,t}var YX=`Kafka`;function XX(){C.tracingChannel($.KAFKAJS_SEND_BATCH).subscribe({start(e){let t=[];(e.arguments[0]?.topicMessages??[]).forEach(e=>{e.messages.forEach(n=>{t.push(HX(e.topic,n))})}),e._sentrySpans=t},error(e){e._sentrySpans&&UX(e._sentrySpans,e.error)},asyncEnd(e){e._sentrySpans?.forEach(e=>e.end())}})}function ZX(){C.tracingChannel($.KAFKAJS_CONSUMER_RUN).subscribe({start(e){let t=e.arguments[0];t&&typeof t==`object`&&(typeof t.eachMessage==`function`&&!KX(t.eachMessage)&&(t.eachMessage=qX(t.eachMessage)),typeof t.eachBatch==`function`&&!KX(t.eachBatch)&&(t.eachBatch=JX(t.eachBatch)))}})}var QX=W((()=>({name:YX,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:kafkajs] subscribing to channels "${$.KAFKAJS_SEND_BATCH}", "${$.KAFKAJS_CONSUMER_RUN}"`),XX(),ZX())}}))),$X=`Knex`,eZ=`auto.db.orchestrion.knex`,tZ=1021,nZ=`db.sql.table`,rZ=`sqlite`,iZ=`postgresql`,aZ=Symbol(`sentry.orchestrion.knex.parent-span`),oZ=(()=>({name:$X,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:knex] subscribing to channel "${$.KNEX_QUERY}"`),U(()=>{sZ($.KNEX_QUERY_BUILDER),sZ($.KNEX_SCHEMA_BUILDER),sZ($.KNEX_RAW),cZ()}))}}));function sZ(e){C.tracingChannel(e).end.subscribe(e=>{let t=e.result;if(!t||typeof t!=`object`||aZ in t)return;let n=R();n&&Object.defineProperty(t,aZ,{value:n})})}function cZ(){Z(C.tracingChannel($.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[aZ]??R();if(!r)return;let i=e.arguments[0],a=t?.client,o=a?.config?.connection,s=o?.connectionString,c=pZ(n),l=i?.method,u=o?.filename||o?.database||mZ(s),d={[I]:eZ,"knex.version":e.moduleVersion,[zs]:dZ(a?.driverName),[nZ]:c,[Ps]:l,[Vs]:o?.user,[Ms]:u,[Xc]:o?.host??hZ(s),[Zc]:o?.port??gZ(s),[Qc]:o?.filename===`:memory:`?`inproc`:void 0,[Rs]:i?.sql==null?void 0:xn(i.sql,tZ)};return B({name:fZ(u,l,c)??`knex.query`,kind:G.CLIENT,op:`db`,parentSpan:r,attributes:d})},{beforeSpanEnd(e,t){if(`error`in t){let n=lZ(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function lZ(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=uZ(e.self)(r.sql,r.bindings||[]);return n.replace(`${t} - `,``)}catch{return n}}function uZ(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 dZ(e){return e===`sqlite3`?rZ:e===`pg`?iZ:e}function fZ(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function pZ(e){let t=e?._single?.table;return t&&typeof t==`object`?pZ(t):typeof t==`string`?t:void 0}function mZ(e){if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}}function hZ(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function gZ(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var _Z=W(oZ),vZ=uy,yZ=[nv,bv,qv],bZ=!1;function xZ(){$d(yZ)}var SZ=((e={})=>({name:vZ,setupOnce(){if(!C.tracingChannel||bZ)return;bZ=!0;let t=Ny(e),n=e=>{xZ();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=My(r.callbacks,t)};for(let e of[$.LANGCHAIN_CHAT_MODEL_INVOKE,$.LANGCHAIN_CHAT_MODEL_STREAM])X&&A.log(`[orchestrion:langchain] subscribing to channel "${e}"`),C.tracingChannel(e).start.subscribe(n);U(()=>{for(let t of CG)X&&A.log(`[orchestrion:langchain] subscribing to channel "${t}"`),Z(C.tracingChannel(t),t=>CZ(t,e))})}}));function CZ(e,t){xZ();let n=(e.arguments??[])[0];return B(Iy(e.self,n,t))}var wZ=W(SZ),TZ=zy,EZ=!1,DZ=!1,OZ=((e={})=>({name:TZ,setupOnce(){if(!C.tracingChannel||EZ)return;EZ=!0;let t=Zg(e),n=Ny(t);U(()=>{X&&A.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_STATE_GRAPH_COMPILE}"`),Z(C.tracingChannel($.LANGGRAPH_STATE_GRAPH_COMPILE),e=>{if(DZ)return;let t=kZ(e.arguments);return B(Zy(typeof t?.name==`string`?t.name:void 0))},{beforeSpanEnd:(e,r)=>{AZ(r.result,kZ(r.arguments)??{},t,null,n)}}),X&&A.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_CREATE_REACT_AGENT}"`);let e=C.tracingChannel($.LANGGRAPH_CREATE_REACT_AGENT);e.start.subscribe(e=>{DZ=!0;try{let{arguments:n}=e,r=kZ(n);r&&Array.isArray(r.tools)&&r.tools.length>0&&Uy(r.tools,t,Hy(n)??void 0)}catch(e){X&&A.error(`[orchestrion:langgraph] failed to wrap createReactAgent tools`,e)}}),e.end.subscribe(e=>{DZ=!1;let{arguments:r,result:i}=e,a=Hy(r)??void 0;AZ(i,a?{name:a}:{},t,Vy(r),n)}),e.error.subscribe(()=>{DZ=!1})})}}));function kZ(e){let t=(e??[])[0];return typeof t==`object`&&t?t:void 0}function AZ(e,t,n,r,i){if(!e||typeof e!=`object`)return;let a=e,o=a.invoke;typeof o==`function`&&(a.invoke=$y(o.bind(a),a,t,n,r,i))}var jZ=W(OZ),MZ=`LruMemoizer`,NZ=W((()=>({name:MZ,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:lru-memoizer] subscribing to channel "${$.LRU_MEMOIZER_LOAD}"`),U(()=>{Z(C.tracingChannel($.LRU_MEMOIZER_LOAD),()=>void 0)}))}}))),PZ=`Mongo`,FZ=`auto.db.orchestrion.mongo`,IZ=new Set([`insert`,`update`,`delete`,`find`,`getMore`,`killCursors`]),LZ=(()=>({name:PZ,setupOnce(){C.tracingChannel&&U(()=>{RZ(),zZ(),BZ()})}}));function RZ(){Z(C.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 eI(XF(e.self,n,r,i,FZ))},{requiresParentSpan:!0})}function zZ(){Z(C.tracingChannel($.MONGODB_CHECKOUT),()=>void 0)}function BZ(){for(let e of[`insert`,`update`,`remove`])VZ(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}));VZ($.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&IZ.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?QF(t):void 0}}),VZ($.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:`find`})),VZ($.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:`getMore`}))}function VZ(e,t){Z(C.tracingChannel(e),e=>{let n=e.arguments;if(!n)return;let r=t(n);if(r&&typeof r.ns==`string`)return eI($F(r.ns,r.topology,r.command,r.operation,FZ))},{requiresParentSpan:!0})}var HZ=W(LZ),UZ=`Mongoose`,WZ=`auto.db.orchestrion.mongoose`,GZ=new WeakMap,KZ=!1,qZ=(()=>({name:UZ,setupOnce(){C.tracingChannel&&U(()=>{AF(C.tracingChannel),JZ()})}}));function JZ(){if(!KZ){KZ=!0,X&&A.log(`[orchestrion:mongoose] subscribing to injected channels`);for(let e of UG)XZ(e).subscribe({start(e){QZ(e.self)}});XZ($.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t==`object`&&QZ(t)}}),ZZ($.MONGOOSE_QUERY_EXEC,e=>{let t=e;return YZ(t.mongooseCollection,t.model?.modelName,t.op??`exec`,GZ.get(e))}),ZZ($.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return YZ(t?.collection,t?.modelName,`aggregate`,GZ.get(e))}),ZZ($.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return YZ(t.collection,t.modelName,`save`)}),ZZ($.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return YZ(t.collection,t.modelName,`remove`)}),ZZ($.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return YZ(t.collection,t.modelName,`insertMany`)}),ZZ($.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return YZ(t.collection,t.modelName,`bulkWrite`)})}}function YZ(e,t,n,r){return VR({collection:e,modelName:t,operation:n,origin:WZ,parentSpan:r})}function XZ(e){return C.tracingChannel(e)}function ZZ(e,t){Z(C.tracingChannel(e),e=>{let n=e.self;if(n)return t(n)})}function QZ(e){let t=R();e&&t&&GZ.set(e,t)}var $Z=W(qZ),eQ=`Mysql`,tQ=`db.system`,nQ=`db.connection_string`,rQ=`db.name`,iQ=`db.user`,aQ=`db.statement`,oQ=`net.peer.name`,sQ=`net.peer.port`,cQ=(()=>({name:eQ,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:mysql] subscribing to channel "${$.MYSQL_QUERY}"`),U(()=>{Z(C.tracingChannel($.MYSQL_QUERY),e=>{let t=uQ(e.arguments[0]),{host:n,port:r,database:i,user:a}=dQ(e.self),o=typeof r==`string`?parseInt(r,10):r,s=typeof o==`number`&&!isNaN(o);return e._sentryCallerScope=M(),B({name:t??`mysql.query`,kind:G.CLIENT,op:`db`,attributes:{[tQ]:`mysql`,[I]:`auto.db.orchestrion.mysql`,[nQ]:fQ(n,s?o:void 0,i),...i?{[rQ]:i}:{},...a?{[iQ]:a}:{},...t?{[aQ]:t}:{},...n?{[oQ]:n}:{},...s?{[sQ]:o}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!lQ(n))return!1;let r=e._sentryCallerScope;return r&&Fo(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}})}))}}));function lQ(e){return`on`in e&&typeof e.on==`function`}function uQ(e){if(typeof e==`string`)return e;if(j(e)&&`sql`in e){let t=e.sql;return typeof t==`string`?t:void 0}}function dQ(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function fQ(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var pQ=W(cQ),mQ=`Mysql2`,hQ=`auto.db.orchestrion.mysql2`,gQ=`mysql`;function _Q(){cI(C.tracingChannel),vQ($.MYSQL2_QUERY),vQ($.MYSQL2_EXECUTE)}function vQ(e){Z(C.tracingChannel(e),e=>{let t=yQ(e.arguments);return B({name:t??`mysql2.query`,kind:G.CLIENT,attributes:{[I]:hQ,[F]:`db`,[zs]:gQ,...xQ(e.self?.config),[Rs]:t||void 0}})},{requiresParentSpan:!0})}function yQ(e){return bQ(e[0])}function bQ(e){if(typeof e==`string`)return e;if(j(e)&&`sql`in e){let t=e.sql;return typeof t==`string`?t:void 0}}function xQ(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{[Ms]:r||void 0,[Vs]:i||void 0,[Xc]:t||void 0,[Zc]:o?a:void 0}}var SQ=W((()=>({name:mQ,setupOnce(){C.tracingChannel&&U(()=>{_Q()})}}))),CQ=`OpenAI`,wQ=`auto.ai.orchestrion.openai`,TQ=[{channel:$.OPENAI_CHAT,operation:`chat`},{channel:$.OPENAI_EMBEDDINGS,operation:`embeddings`}],EQ=!1,DQ=((e={})=>({name:CQ,setupOnce(){C.tracingChannel&&!EQ&&(EQ=!0,U(()=>{for(let{channel:t,operation:n}of TQ)X&&A.log(`[orchestrion:openai] subscribing to channel "${t}"`),Z(C.tracingChannel(t),t=>OQ(t,n,e),{beforeSpanEnd:(t,n)=>{sv(t,n.result,Zg(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>AQ(t,n,e)})}))}}));function OQ(e,t,n){if(ef(CQ))return;let r=e.arguments??[],i=r[0],{recordInputs:a}=Zg(n),o=Qg(n.enableTruncation),s=hv(r,t);s[I]=wQ;let c=B({name:`${t} ${i?.model||`unknown`}`,op:`gen_ai.${t}`,attributes:s});return a&&i&&gv(c,i,t,o),c}function kQ(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function AQ(e,t,n){let r=t.result;if(!kQ(r))return!1;let{recordOutputs:i}=Zg(n),a=r[Symbol.asyncIterator].bind(r),o=pv({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var jQ=W(DQ),MQ=`Postgres`,NQ=`auto.db.orchestrion.postgres`,PQ=`db.system`,FQ=`db.name`,IQ=`db.connection_string`,LQ=`db.user`,RQ=`db.statement`,zQ=`net.peer.name`,BQ=`net.peer.port`,VQ=`db.postgresql.plan`,HQ=`db.postgresql.idle.timeout.millis`,UQ=`db.postgresql.max.client`,WQ=`postgresql`,GQ=`pg.query`,KQ=`pg.connect`,qQ=`pg-pool.connect`,JQ=((e={})=>({name:MQ,setupOnce(){C.tracingChannel&&U(()=>{YQ($.PG_QUERY,XQ,{deferStreamedResult:!0}),e.ignoreConnectSpans||(YQ($.PG_CONNECT,ZQ),YQ($.PGPOOL_CONNECT,QQ))})}}));function YQ(e,t,{deferStreamedResult:n=!1}={}){X&&A.log(`[orchestrion:pg] subscribing to channel "${e}"`),Z(C.tracingChannel(e),e=>(e._sentryCallerScope=M(),B({...t(e),kind:G.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!$Q(n))return!1;let r=e._sentryCallerScope;return r&&Fo(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}}:{requiresParentSpan:!0})}function XQ(e){let t=e.self?.connectionParameters??{},n=e$(e.arguments);return{name:n?.text??GQ,op:`db`,attributes:{...t$(t),[I]:NQ,[RQ]:n?.text||void 0,[VQ]:typeof n?.name==`string`?n.name:void 0}}}function ZQ(e){return{name:KQ,op:`db`,attributes:t$(e.self?.connectionParameters??{})}}function QQ(e){return{name:qQ,op:`db`,attributes:n$(e.self?.options??{})}}function $Q(e){return`on`in e&&typeof e.on==`function`}function e$(e){let t=e[0];if(typeof t==`string`)return{text:t};if(j(t)&&typeof t.text==`string`){let e=t;return{text:e.text,name:e.name}}}function t$(e){return{[PQ]:WQ,[IQ]:r$(e),[FQ]:e.database,[LQ]:e.user,[zQ]:e.host,[BQ]:Number.isInteger(e.port)?e.port:void 0}}function n$(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{[PQ]:WQ,[IQ]:r$(e),[HQ]:e.idleTimeoutMillis,[UQ]:e.max,[FQ]:n,[BQ]:i,[zQ]:r||void 0,[LQ]:a||void 0}}function r$(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 i$=W(JQ),a$=`PostgresJs`,o$=`auto.db.orchestrion.postgresjs`,s$=`db.response.status_code`,c$=()=>{},l$=Symbol.for(`sentry.query.from.instrumented.sql`),u$=Symbol(`sentryPostgresJsSpan`),d$=Symbol(`sentryPostgresJsConnectionAttrsSet`),f$=Symbol(`sentryPostgresJsSpanEnded`),p$=new WeakMap,m$=[];function h$(e){m$.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)||m$.push(e)}function g$(){return m$.length===1?m$[0]:void 0}function _$(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!=`object`||!n)return;let r=uC(n);p$.set(t,r),h$(r)}function v$(e,t,n){let r=t;r[d$]||(r[d$]=!0,cC(e,n))}function y$(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[u$],i=p$.get(t);r&&i&&v$(r,n,i)}function b$(e,t,n){let r=e.self;if(!r)return;let i=()=>{e[f$]=!0},a=r.resolve;typeof a==`function`&&(r.resolve=function(...e){i();try{let r=e[0]?.command;lC(t,n,r),t.end()}catch(e){X&&A.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(s$,r?.code||`unknown`),t.setAttribute(Hs,r?.name||`unknown`),lC(t,n),t.end()}catch(e){X&&A.error(`[orchestrion:postgresjs] error ending span in reject:`,e)}return o.apply(this,e)})}var x$=W(((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:a$,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:postgresjs] subscribing to "${$.POSTGRESJS_HANDLE}"`),C.tracingChannel($.POSTGRESJS_CONNECTION).subscribe({start:c$,asyncStart:c$,asyncEnd:c$,error:c$,end:_$}),C.tracingChannel($.POSTGRESJS_EXECUTE).subscribe({end:c$,asyncStart:c$,asyncEnd:c$,error:c$,start:y$}),C.tracingChannel($.POSTGRESJS_CONNECT).subscribe({end:c$,asyncStart:c$,asyncEnd:c$,error:c$,start:y$}),U(()=>{Z(C.tracingChannel($.POSTGRESJS_HANDLE),e=>{let t=e.self;if(!t||t.executed===!0||t[l$])return;let r=sC(aC(t.strings)),i=B({name:r||`postgresjs.query`,op:`db`,kind:G.CLIENT,attributes:{[I]:o$,[Bs]:`postgres`,[Ls]:r}});t[u$]=i;let a=g$();if(a&&v$(i,t,a),n)try{n(i,r,a)}catch(e){i.setAttribute(`sentry.hook.error`,`requestHook failed`),X&&A.error(`[orchestrion:postgresjs] error in requestHook:`,e)}return b$(e,i,r),i},{requiresParentSpan:t!==!1,deferSpanEnd({data:e}){return e[f$]?!0:!(`error`in e)}})}))}}})),S$=`Tedious`,C$=`auto.db.orchestrion.tedious`,w$=`mssql`,T$=`db.sql.table`,E$=Symbol(`sentry.orchestrion.tedious.current-database`);function D$(e){Object.defineProperty(this,E$,{value:e,writable:!0,configurable:!0})}function O$(){this.removeListener(`databaseChange`,D$)}function k$(){C.tracingChannel($.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(D$.call(t,t.config?.options?.database),t.removeListener(`databaseChange`,D$),t.on(`databaseChange`,D$),t.removeListener(`end`,O$),t.once(`end`,O$))})}function A$(e,t){C.tracingChannel(e).start.subscribe(e=>{let n=e,r=n.self,i=n.arguments[0];if(!r||!(i instanceof Me))return;let a=0,o=0,s=()=>{o++},c=()=>{a++},l=r[E$],u=j$(i),d={[I]:C$,[zs]:w$,[Ms]:l,[Vs]:r.config?.userName??r.config?.authentication?.options?.userName,[Rs]:u,[T$]:i.table,[Xc]:r.config?.server,[Zc]:r.config?.options?.port},f=B({name:M$(t,l,u,i.table),kind:G.CLIENT,op:`db`,attributes:d}),p=N$(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 j$(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 M$(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 N$(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var P$=W((()=>({name:S$,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:tedious] subscribing to channel "${$.TEDIOUS_EXEC_SQL}"`),U(()=>{k$(),A$($.TEDIOUS_EXEC_SQL,`execSql`),A$($.TEDIOUS_EXEC_SQL_BATCH,`execSqlBatch`),A$($.TEDIOUS_CALL_PROCEDURE,`callProcedure`),A$($.TEDIOUS_EXEC_BULK_LOAD,`execBulkLoad`),A$($.TEDIOUS_PREPARE,`prepare`),A$($.TEDIOUS_EXECUTE,`execute`)}))}}))),F$=Symbol(`SentryVercelAiModelPatched`),I$=Symbol(`SentryVercelAiToolPatched`),L$=0;function R$(){return`v6-${++L$}`}var z$=new WeakMap,B$=new WeakSet,V$=new WeakSet,H$=new WeakMap,U$=new WeakMap,W$=new WeakMap,G$=new WeakSet,K$=!1;function q$(e,t={}){if(!K$){K$=!0;try{J$(e,$.VERCEL_AI_GENERATE_TEXT,a1(`generateText`),t),J$(e,$.VERCEL_AI_STREAM_TEXT,a1(`streamText`),t),J$(e,$.VERCEL_AI_GENERATE_OBJECT,a1(`generateObject`),t),J$(e,$.VERCEL_AI_EMBED,(e,t)=>({type:`embed`,event:{callId:R$(),...c1(e.model),maxRetries:e.maxRetries,value:e.value,...s1(t)}}),t),J$(e,$.VERCEL_AI_EMBED_MANY,(e,t)=>({type:`embedMany`,event:{callId:R$(),...c1(e.model),maxRetries:e.maxRetries,values:e.values,...s1(t)}}),t),J$(e,$.VERCEL_AI_EXECUTE_TOOL_CALL,(e,t)=>({type:`executeTool`,event:{callId:R$(),toolCall:e.toolCall,tools:e.tools,...s1(t)}}),t),$$(e,$.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{X&&A.log(`Vercel AI orchestrion channel subscription failed.`)}}}function J$(e,t,n,r){let i=e(t),a=e=>{let t=j(e.arguments[0])?e.arguments[0]:{},i=j(t.experimental_telemetry)?t.experimental_telemetry:{};if(i.isEnabled===!1&&!G$.has(i))return;let a=n(t,i);Q$(t,i);let o=R(),s=EL(a,r);if(s){z$.set(e,a),B$.add(s);let n=j(t.model)&&t.model.specificationVersion===`v1`;W$.set(s,{callSiteSpan:o,toolErrorsBubbleToCaller:n}),a.type===`executeTool`&&V$.add(s);let c=XI(a.event.callId);c&&H$.set(s,c),U$.set(s,s1(i)),j(t.tools)&&r1(t.tools,r),n&&t1(t.model,r)}return s};Z(i,e=>a(e),{beforeSpanEnd:(e,t)=>{let n=z$.get(t);if(n){if(`error`in t){let n=W$.get(e)?.callSiteSpan;n&&j(t.error)&&Jt(t.error,`_sentry_active_span`,n)}else n.result=n.type===`executeTool`?{output:t.result}:t.result,jL(e,n,r);n.type!==`streamText`&&_L(n),z$.delete(t)}},deferSpanEnd:({data:e,end:t})=>Y$(e,t)})}function Y$(e,t){if(z$.get(e)?.type!==`streamText`||`error`in e||!X$(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 X$(e){return j(e)&&(Z$(e.totalUsage)||Z$(e.usage))}function Z$(e){return j(e)&&typeof e.then==`function`}function Q$(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};G$.add(n),e.experimental_telemetry=n}function $$(e,t,n){e(t).subscribe({end(e){let t=e;j(t.result)&&t1(t.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function e1(){let e=R();return e&&B$.has(e)?e:void 0}function t1(e,t){e[F$]||(e[F$]=!0,n1(e,`doGenerate`,t),n1(e,`doStream`,t))}function n1(e,t,n){let r=e[t];typeof r==`function`&&(e[t]=function(...i){let a=e1();if(!a)return Promise.resolve(r.apply(this,i));let o=j(i[0])?i[0]:{},s=H$.get(a),c={type:`languageModelCall`,event:{callId:s,provider:e.provider,modelId:e.modelId,tools:o.tools??(j(o.mode)?o.mode.tools:void 0),messages:o.prompt,...U$.get(a)}},l=V(a,()=>EL(c,n));if(!l)return Promise.resolve(r.apply(this,i));let u=()=>{t===`doStream`&&s&&vL(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`&&j(e)&&$I(e.stream)?(e.stream=eL(e.stream,t=>{c.result={...e,...CL(t)},jL(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,jL(l,c,n),l.end(),u(),e),d)}catch(e){return d(e)}})}function r1(e,t){try{for(let[n,r]of Object.entries(e))j(r)&&i1(n,r,e,t)}catch{X&&A.log(`Vercel AI orchestrion tool patching failed.`)}}function i1(e,t,n,r){let i=t.execute;typeof i!=`function`||t[I$]||(t[I$]=!0,t.execute=function(t,...a){let o=e1();if(!o||V$.has(o))return i.apply(this,[t,...a]);let s=j(a[0])?a[0]:{},c={type:`executeTool`,event:{callId:H$.get(o),toolCall:{toolName:e,toolCallId:XI(s.toolCallId),input:t},tools:n,...U$.get(o)}},l=V(o,()=>EL(c,r));if(!l)return i.apply(this,[t,...a]);let u=e=>{throw W$.get(o)?.toolErrorsBubbleToCaller?l.setStatus({code:2,message:e instanceof Error?e.message:`tool_error`}):zL(l,c,e),l.end(),e};try{return Promise.resolve(i.apply(this,[t,...a])).then(e=>(c.result={output:e},jL(l,c,r),l.end(),e),u)}catch(e){return u(e)}})}function a1(e){return(t,n)=>({type:e,event:{callId:R$(),operationId:`ai.${e}`,functionId:XI(n.functionId),...c1(t.model),maxRetries:t.maxRetries,instructions:XI(t.system),messages:o1(t),...s1(n)}})}function o1(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt==`string`?[{role:`user`,content:e.prompt}]:e.messages??e.prompt}function s1(e){let t=e.isEnabled===!0||void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function c1(e){return{provider:l1(e,`provider`),modelId:l1(e,`modelId`)}}function l1(e,t){return j(e)?XI(e[t]):void 0}var u1=W(((e={})=>ju(UL(e),{options:e,setupOnce(){C.tracingChannel&&U(()=>{q$(C.tracingChannel,e)})}}))),d1=new WeakMap;function f1(e,t){d1.set(e,t)}function p1(e){return d1.get(e)}var m1=new WeakMap;function h1(e){let t=m1.get(e);return t||(t=[],m1.set(e,t)),t}function g1(e,t){h1(e).push(t)}function _1(e){h1(e).pop()}function v1(e){let t=e[0];return Array.isArray(t)?t.map(e=>y1(e)??``).join(`,`):y1(t)}function y1(e){return typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0}function b1(e){let t=h1(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}function x1(e,t){let n=h1(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)||S1(i))?i:void 0}function S1(e){return e.includes(`:`)||e.includes(`*`)}var C1=`auto.http.express`,w1=`express.name`,T1=`express.type`,E1=()=>{},D1=!1;function O1(e,t){if(!D1){D1=!0;for(let e of[$.EXPRESS_REGISTER,$.ROUTER_REGISTER])t(e).subscribe({start:E1,asyncStart:E1,asyncEnd:E1,error:E1,end:k1});for(let n of[$.EXPRESS_HANDLE,$.ROUTER_HANDLE]){X&&A.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);Z(r,t=>j1(t,e),{beforeSpanEnd(e,t){t._sentryCleanup?.()}}),r.subscribe({start:E1,asyncEnd:E1,end:E1,error:E1,asyncStart:A1})}}}function k1(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&f1(n,v1(e.arguments??[]))}function A1(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&_1(t)}function j1(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||!R())return;let o=M1(n),s=p1(n);s!=null&&(g1(i,s),e._sentryStoredLayer=!0);let c=o===`request_handler`?b1(i):void 0,l=o===`request_handler`&&c!=null?x1(i,c):void 0,u=o===`request_handler`?c||`request handler`:o===`router`?n.path??`/`:n.name??`<anonymous>`;if(l&&N1(l),o===`request_handler`&&c){let e=N();if(e!==ar()){let t=typeof i.method==`string`?i.method.toUpperCase():`GET`;e.setTransactionName(`${t} ${c}`)}else X&&A.warn(`[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name`)}if(P1(u,o,t))return;let d=B({name:u,attributes:{[I]:C1,[F]:`${o}.express`,[w1]:u,[T1]:o,...l?{[Dc]:l}:{}}});if(a&&typeof a.once==`function`){let t=()=>{d.end()};a.once(`finish`,t),e._sentryCleanup=()=>a.removeListener(`finish`,t)}return d}function M1(e){return e.name===`router`?`router`:e.name===`bound dispatch`||e.name===`handle`?`request_handler`:`middleware`}function N1(e){let t=R(),n=t&&na(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(Dc,e)}function P1(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 Tn(e,r,!0)}catch{return!1}}var F1=`Express`,I1=W(((e={})=>({name:F1,setupOnce(){C.tracingChannel&&U(()=>{O1(e,C.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})));function L1(e,t){return B({name:`${e} ${t.path}`,op:`db.query`,kind:G.CLIENT,attributes:{[I]:`auto.firebase.orchestrion.firestore`,[Is]:e,...z1(t)}})}function R1(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(Be.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 z1(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},i={[js]:e.path,[Ns]:t.name,[Bs]:`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}=R1(r);return a&&(i[dl]=a),o&&(i[fl]=o),i}var B1=`auto.firebase.orchestrion.functions`,V1=`__sentryFirebaseWrapped`;function H1(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[V1]||(n[r]=U1(i,t))}function U1(e,t){let n=async function(...n){let r=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,i={[I]:B1,[qs]:r,[Js]: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),ao({name:`firebase.function.${t}`,op:`function.firebase`,kind:G.SERVER,attributes:i},async t=>{try{let r=await e.apply(this,n);return t.end(),r}catch(e){throw t.setStatus({code:2}),H(e,{mechanism:{type:B1,handled:!1}}),t.end(),await uu(2e3),e}})};return n[V1]=!0,n}var W1=[{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}],G1=[{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`}],K1=()=>{};function q1(e){try{return e()}catch(e){X&&A.warn(`[orchestrion:firebase] error handling channel event`,e);return}}function J1(){for(let{channel:e,spanName:t,useParent:n}of W1)Z(C.tracingChannel(e),e=>q1(()=>{let r=e.arguments[0];if(!r)return;let i=n&&r.parent||r;return L1(t,i)}));for(let{channel:e,triggerType:t}of G1)C.tracingChannel(e).subscribe({start:e=>void q1(()=>H1(e,t)),end:K1,asyncStart:K1,asyncEnd:K1,error:K1})}var Y1=`Firebase`,X1=W((()=>({name:Y1,setupOnce(){C.tracingChannel&&U(()=>{J1()})}})));function Z1(){return!!O.__SENTRY_ORCHESTRION__}function Q1(){let{runtime:e,bundler:t}=O.__SENTRY_ORCHESTRION__??{};if(!e&&!t){A.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}A.log(e?`[Sentry] Runtime hook registered, injected libraries=${JSON.stringify(e)}`:`[Sentry] Runtime hook not registered`),A.log(t?`[Sentry] Bundler plugin ran, injected libraries=${JSON.stringify(t)}`:`[Sentry] Bundler plugin did not run`)}var $1=`RedisChannel`,e0=`auto.db.orchestrion.redis`,t0=`db.connection_string`,n0=`redis`;function r0(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function i0(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function a0(e){let t=e[0];return j(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function o0(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 s0(e){return{[zs]:n0,[Xc]:e?.socket?.host,[Zc]:e?.socket?.port,[t0]:o0(e?.url),[I]:e0}}function c0(e,t,n){return B({name:`redis-${e}`,kind:G.CLIENT,attributes:{...n,[F]:`db`,[Rs]:YI(e,t)}})}function l0(e){let t=C.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={[zs]:n0,[I]:e0};a[Xc]=i?.connection_options?.host,a[Zc]=i?.connection_options?.port,i?.address&&(a[t0]=`redis://${i.address}`);let o=c0(n.command,n.args??[],a);t._sentrySpan=o;let s=R();n.callback=function(t,i){t||i0(e,o,n.command,n.args??[],i),r0(o,t);let a=arguments;return V(s??null,()=>r.apply(this,a))}},error(e){let t=e._sentrySpan;t&&r0(t,e.error)}})}function u0(e,t,n){Z(C.tracingChannel(e),e=>{let n=t(e);if(!n?.length)return;let r=String(n[0]),i=e.self?.options;return c0(r,n.slice(1),s0(i))},{beforeSpanEnd(e,r){if(`error`in r||!n)return;let i=t(r);i?.length&&i0(n,e,String(i[0]),i.slice(1),r.result)}})}function d0(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function f0(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(typeof t?.transformArguments==`function`&&Array.isArray(n))try{return t.transformArguments(...a0(n))}catch{return}}function p0(){Z(C.tracingChannel($.NODE_REDIS_CONNECT),e=>{let t=e.self?.options;return B({name:`redis-connect`,kind:G.CLIENT,attributes:{...s0(t),[F]:`db`}})})}function m0(e,t){Z(C.tracingChannel(e),e=>{let n=e.arguments?.[0],r=Array.isArray(n)?n.length:void 0,i=e.self?.options?.socket;return B({name:t(e),kind:G.CLIENT,attributes:{[I]:e0,[F]:`db.redis`,[Bs]:n0,...r&&r>1?{[Fs]:r}:{},...i?.host==null?{}:{[dl]:i.host},...i?.port==null?{}:{[fl]:i.port}}})})}var h0=W(((e={})=>{let t=e.responseHook;return{name:$1,setupOnce(){C.tracingChannel&&(X&&A.log(`[orchestrion:redis] subscribing to "${$.REDIS_COMMAND}" and node-redis channels`),l0(t),U(()=>{u0($.NODE_REDIS_COMMAND,d0,t),u0($.NODE_REDIS_EXECUTOR,f0,t),p0(),m0($.NODE_REDIS_MULTI,()=>`MULTI`),m0($.NODE_REDIS_PIPELINE,()=>`PIPELINE`),m0($.NODE_REDIS_BATCH,e=>e.arguments?.[2]===void 0?`PIPELINE`:`MULTI`)}))}}})),g0={postgresIntegration:i$,postgresJsIntegration:x$,mongoIntegration:HZ,mysqlIntegration:pQ,mysql2Integration:SQ,genericPoolIntegration:WJ,mongooseIntegration:$Z,lruMemoizerIntegration:NZ,openaiIntegration:jQ,anthropicIntegration:Nq,googleGenAIIntegration:eY,langChainIntegration:wZ,langGraphIntegration:jZ,vercelAiIntegration:u1,amqplibIntegration:Cq,hapiIntegration:nX,koaIntegration:hX,expressIntegration:I1,graphqlIntegration:LY,kafkajsIntegration:QX,tediousIntegration:P$,awsIntegration:OJ,firebaseIntegration:X1},_0=`Knex`,v0=Y(_0,()=>new pW),y0=W((()=>({name:_0,setupOnce(){Z1()?_Z().setupOnce?.():v0()}}))),b0=`db.sql.table`,x0=`mssql`;function S0(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 C0=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}},w0=`@sentry/instrumentation-tedious`,T0=Symbol(`opentelemetry.instrumentation-tedious.current-database`),E0=[`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`];function D0(e){Object.defineProperty(this,T0,{value:e,writable:!0})}var O0=class e extends q{constructor(e={}){super(w0,k,e)}init(){return[new J(e.COMPONENT,[`>=1.11.0 <20`],e=>{let t=e.Connection.prototype;for(let e of E0)K(t[e])&&this._unwrap(t,e),this._wrap(t,e,this._patchQuery(e));return K(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 E0)this._unwrap(t,e);this._unwrap(t,`connect`)})]}_patchConnect(e){return function(){return D0.call(this,this.config?.options?.database),this.removeListener(`databaseChange`,D0),this.on(`databaseChange`,D0),this.once(`end`,()=>{this.removeListener(`databaseChange`,D0)}),e.apply(this,arguments)}}_patchQuery(e){return t=>{let n=this;function r(r){if(!(r instanceof rt))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[T0],l=(e=>e.sqlTextOrProcedure===`sp_prepare`&&e.parametersByName?.stmt?.value?e.parametersByName.stmt.value:e.sqlTextOrProcedure)(r),u={[I]:`auto.db.otel.tedious`,[zs]:x0,[Ms]:c,[Vs]:this.config?.userName??this.config?.authentication?.options?.userName,[Rs]:l,[b0]:r.table,[Xc]:this.config?.server,[Zc]:this.config?.options?.port},d=B({name:S0(e,c,l,r.table),kind:G.CLIENT,attributes:u}),f=C0(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`),V(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)}}};O0.COMPONENT=`tedious`;var k0=O0,A0=`Tedious`,j0=Y(A0,()=>new k0({})),M0=W((()=>({name:A0,setupOnce(){j0()}}))),N0=`generic-pool`,P0=`@sentry/instrumentation-generic-pool`,F0=class extends q{constructor(e={}){super(P0,k,e),this._isDisabled=!1}init(){return[new J(N0,[`>=3.0.0 <4`],e=>{let t=e.Pool;return K(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 J(N0,[`>=2.4.0 <3`],e=>{let t=e.Pool;return K(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 J(N0,[`>=2.0.0 <2.4`],e=>(this._isDisabled=!1,K(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 z({name:`generic-pool.acquire`,attributes:{[I]:`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):ao({name:`generic-pool.acquire`,attributes:{[I]:`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)})}}},I0=`GenericPool`,L0=Y(I0,()=>new F0({})),R0=W((()=>({name:I0,setupOnce(){L0()}}))),z0=`dataloader`,B0=`@sentry/instrumentation-dataloader`,V0=`auto.db.otel.dataloader`;function H0(e){return e[Symbol.toStringTag]===`Module`}function U0(e){return H0(e)?e.default:e}function W0(e,t){let n=e.name;return n?`${z0}.${t} ${n}`:`${z0}.${t}`}function G0(e){if(e===`load`||e===`loadMany`||e===`batch`)return`cache.get`}function K0(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}var q0=class extends q{constructor(e={}){super(B0,k,e)}init(){return[new J(z0,[`>=2.0.0 <3`],e=>{let t=U0(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=U0(e);[`load`,`loadMany`,`prime`,`clear`,`clearAll`].forEach(e=>{K(t.prototype[e])&&this._unwrap(t.prototype,e)})})]}_wrapBatchLoadFn(e){let t=this;return function(...n){return t.isEnabled()?z({name:W0(this,`batch`),links:this._batch?.spanLinks,attributes:{[I]:V0,[F]:G0(`batch`),[Os]:K0(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`&&(K(n[0])&&t._unwrap(n,0),n[0]=t._wrapBatchLoadFn(n[0])),e.apply(this,n)}return r.prototype=n,r}_patchLoad(e){K(e.load)&&this._unwrap(e,`load`),this._wrap(e,`load`,this._getPatchedLoad.bind(this))}_getPatchedLoad(e){return function(...t){return z({name:W0(this,`load`),kind:G.CLIENT,attributes:{[I]:V0,[F]:G0(`load`),[Os]:K0(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){K(e.loadMany)&&this._unwrap(e,`loadMany`),this._wrap(e,`loadMany`,this._getPatchedLoadMany.bind(this))}_getPatchedLoadMany(e){return function(...t){return z({name:W0(this,`loadMany`),kind:G.CLIENT,attributes:{[I]:V0,[F]:G0(`loadMany`),[Os]:K0(t[0])},onlyIfParent:!0},()=>e.call(this,...t))}}_patchPrime(e){K(e.prime)&&this._unwrap(e,`prime`),this._wrap(e,`prime`,this._getPatchedPrime.bind(this))}_getPatchedPrime(e){return function(...t){return z({name:W0(this,`prime`),kind:G.CLIENT,attributes:{[I]:V0,[F]:G0(`prime`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClear(e){K(e.clear)&&this._unwrap(e,`clear`),this._wrap(e,`clear`,this._getPatchedClear.bind(this))}_getPatchedClear(e){return function(...t){return z({name:W0(this,`clear`),kind:G.CLIENT,attributes:{[I]:V0,[F]:G0(`clear`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClearAll(e){K(e.clearAll)&&this._unwrap(e,`clearAll`),this._wrap(e,`clearAll`,this._getPatchedClearAll.bind(this))}_getPatchedClearAll(e){return function(...t){return z({name:W0(this,`clearAll`),kind:G.CLIENT,attributes:{[I]:V0,[F]:G0(`clearAll`)},onlyIfParent:!0},()=>e.call(this,...t))}}},J0=`Dataloader`,Y0=Y(J0,()=>new q0),X0=W((()=>({name:J0,setupOnce(){Z1()?HJ().setupOnce?.():Y0()}}))),Z0=(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))(Z0||{}),Q0=`messaging.operation`,$0=`messaging.destination`,e2=`messaging.destination_kind`,t2=`messaging.rabbitmq.routing_key`,n2=`messaging.protocol`,r2=`messaging.protocol_version`,i2=`messaging.url`,a2=`messaging.message_id`,o2=`messaging.conversation_id`,s2=`topic`,c2=`process`;x();var l2=`auto.amqplib.otel.publisher`,u2=`auto.amqplib.otel.consumer`,d2=Symbol(`opentelemetry.amqplib.message.stored-span`),f2=Symbol(`opentelemetry.amqplib.channel.spans-not-ended`),p2=Symbol(`opentelemetry.amqplib.channel.consumer-timeout-timer`),m2=Symbol(`opentelemetry.amqplib.connection.attributes`),h2=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),g2=e=>e===``?`<default>`:e,_2=e=>e.replace(/:[^:@/]*@/,`:***@`),v2=(e,t)=>e||(t===`AMQP`?5672:5671),y2=e=>{let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()},b2=e=>e||`localhost`,x2=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Vc]:t}:{}},S2=e=>{let t={[r2]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=y2(e?.protocol);t[n2]=r,t[Xc]=b2(e?.hostname),t[Zc]=v2(e.port,r)}else{let e=_2(n);t[i2]=e;try{let n=new URL(e),r=y2(n.protocol);t[n2]=r,t[Xc]=b2(n.hostname),t[Zc]=v2(n.port?parseInt(n.port):void 0,r)}catch{}}return t};function C2(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}function w2(e,n,r,i){let a=B({name:`publish ${g2(e)}`,kind:t.PRODUCER,attributes:{...r.connection[m2],[$0]:e,[e2]:s2,[t2]:n,[a2]:i?.messageId,[o2]:i?.correlationId,[I]:l2}}),o=i??{};o.headers=o.headers??{};let s=wf({span:a});return s[`sentry-trace`]&&(o.headers[`sentry-trace`]=s[`sentry-trace`]),s.baggage&&(o.headers.baggage=s.baggage),{span:a,modifiedOptions:o}}function T2(e,n,r){return B({name:`${e} process`,kind:t.CONSUMER,attributes:{...r?.connection?.[m2],[$0]:n.fields?.exchange,[e2]:s2,[t2]:n.fields?.routingKey,[Q0]:c2,[a2]:n?.properties.messageId,[o2]:n?.properties.correlationId,[I]:u2}})}var E2=6e4;function D2(e,t,n,r){let i=e[d2];i&&(t!==!1&&i.setStatus({code:2,message:n!==Z0.ChannelClosed&&n!==Z0.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[d2]=void 0)}function O2(e,t,n,r){(e[f2]??[]).forEach(e=>{D2(e.msg,t,n,r)}),e[f2]=[]}function k2(e){let t=Un(),n=e[f2]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<E2)break;D2(e.msg,null,Z0.InstrumentationTimeout,!0)}n.splice(0,r)}function A2(e){return function(t,n,r){return e.call(this,t,n,function(e,n){if(e==null){let e=S2(t),r=x2(n);n[m2]={...e,...r}}r.apply(this,arguments)})}}function j2(e){return function(t){if(t===`close`){O2(this,!0,Z0.ChannelClosed,void 0);let e=this[p2];e&&clearInterval(e),this[p2]=void 0}else t===`error`&&O2(this,!0,Z0.ChannelError,void 0);return e.apply(this,arguments)}}function M2(e,t){return n=>function(r){return O2(this,e,t,r),n.apply(this,arguments)}}function N2(e,t){return n=>function(r,i,a){let o=this,s=t===Z0.Reject?i:a,c=o[f2]??[],l=c.findIndex(e=>e.msg===r);if(l<0)D2(r,e,t,s);else if(t!==Z0.Reject&&i){for(let n=0;n<=l;n++)D2(c[n].msg,e,t,s);c.splice(0,l+1)}else D2(r,e,t,s),c.splice(l,1);return n.apply(this,arguments)}}function P2(e){return function(t,n,r){let i=this;if(!Object.prototype.hasOwnProperty.call(i,f2)){let e=setInterval(()=>{k2(i)},E2);e.unref(),i[p2]=e,i[f2]=[]}let a=function(e){if(!e)return n.call(this,e);let a=e.properties.headers??{};co({sentryTrace:C2(a,`sentry-trace`),baggage:C2(a,`baggage`)},()=>{let a=T2(t,e,i);r?.noAck||(i[f2].push({msg:e,timeOfConsume:Un()}),e[d2]=a),V(a,()=>{n.call(this,e)}),r?.noAck&&a.end()})},o=Array.prototype.slice.call(arguments);return o[1]=a,e.apply(this,o)}}function F2(e){return function(t,n,r,i,a){let o=this,{span:s,modifiedOptions:c}=w2(t,n,o,i),l=function(e,t){try{V(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[h2]=!0;try{return e.apply(this,u)}finally{o[h2]=!1}}}function I2(e){return function(t,n,r,i){if(this[h2])return e.apply(this,arguments);let{span:a,modifiedOptions:o}=w2(t,n,this,i),s=[...arguments];s[3]=o;let c=e.apply(this,s);return a.end(),c}}var L2=`@sentry/instrumentation-amqplib`,R2=[`>=0.5.5 <2`],z2=class extends q{constructor(e={}){super(L2,k,e)}init(){let e=new JR(`amqplib/lib/channel_model.js`,R2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),t=new JR(`amqplib/lib/callback_model.js`,R2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this));return new J(`amqplib`,R2,void 0,void 0,[e,new JR(`amqplib/lib/connect.js`,R2,this.patchConnect.bind(this),this.unpatchConnect.bind(this)),t])}patchConnect(e){let t=this.unpatchConnect(e);return K(t.connect)||this._wrap(t,`connect`,A2),t}unpatchConnect(e){return K(e.connect)&&this._unwrap(e,`connect`),e}patchChannelModel(e){return K(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,`publish`,I2),K(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,`consume`,P2),K(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,`ack`,N2(!1,Z0.Ack)),K(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,`nack`,N2(!0,Z0.Nack)),K(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,`reject`,N2(!0,Z0.Reject)),K(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,`ackAll`,M2(!1,Z0.AckAll)),K(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,`nackAll`,M2(!0,Z0.NackAll)),K(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,`emit`,j2),K(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,`publish`,F2),e}unpatchChannelModel(e){return K(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,`publish`),K(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,`consume`),K(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,`ack`),K(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,`nack`),K(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,`reject`),K(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,`ackAll`),K(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,`nackAll`),K(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,`emit`),K(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,`publish`),e}},B2=`Amqplib`,V2=Y(B2,()=>new z2),H2=W((()=>({name:B2,setupOnce(){V2()}}))),U2=`VercelAI`,W2=[`>=3.0.0 <7`],G2=[`generateText`,`streamText`,`generateObject`,`streamObject`,`embed`,`embedMany`,`rerank`];function K2(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 q2(e){if(typeof e!=`object`||!e||!(`content`in e))return;let t=e;Array.isArray(t.content)&&(J2(t.content),Y2(t.content))}function J2(e){for(let t of e){if(!K2(t))continue;let e=I_(t.toolCallId);Er(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`),H(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`),H(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})})}}function Y2(e){for(let t of e)typeof t==`object`&&t&&`toolCallId`in t&&typeof t.toolCallId==`string`&&L_(t.toolCallId)}function X2(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 Z2=class extends q{constructor(e={}){super(`@sentry/instrumentation-vercel-ai`,k,e),this._isPatched=!1,this._callbacks=[]}init(){return new J(`ai`,W2,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=P(),o=a?.getIntegrationByName(U2),s=o?.options,c=o?a?.getDataCollectionOptions().genAI:void 0,{recordInputs:l,recordOutputs:u}=X2(s,r,i,!!c?.inputs,!!c?.outputs);return n[0].experimental_telemetry={...r,isEnabled:i===void 0||i,recordInputs:l,recordOutputs:u},to(()=>Reflect.apply(e,t,n),e=>{e&&typeof e==`object`&&Jt(e,`_sentry_active_span`,R())},()=>{},e=>{q2(e)})}});if(Object.prototype.toString.call(e)===`[object Module]`){for(let n of G2)e[n]!=null&&(e[n]=t(e[n]));return e}{let n=G2.reduce((n,r)=>(e[r]!=null&&(n[r]=t(e[r])),n),{});return{...e,...n}}}},Q2=Y(U2,()=>new Z2({}));function $2(e){return!!e.getIntegrationByName(`Modules`)?.getModules?.()?.ai}var e4=W(((e={})=>{let t;return ju(UL(e),{options:e,setupOnce(){t=Q2()},afterAllSetup(n){e.force??$2(n)?Q_(n):t?.callWhenPatched(()=>Q_(n))}})})),t4=[`>=4.0.0 <8`],n4=class extends q{constructor(e={}){super(`@sentry/instrumentation-openai`,k,e)}init(){return new J(`openai`,t4,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 ef(`OpenAI`)?Reflect.construct(n,e):yv(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}},r4=Y(nv,e=>new n4(e)),i4=W(((e={})=>({name:nv,setupOnce(){r4(e)}}))),a4=[`>=0.19.2 <1.0.0`],o4=class extends q{constructor(e={}){super(`@sentry/instrumentation-anthropic-ai`,k,e)}init(){return new J(`@anthropic-ai/sdk`,a4,this._patch.bind(this))}_patch(e){let t=e.Anthropic,n=this.getConfig(),r=function(...e){return ef(`Anthropic_AI`)?Reflect.construct(t,e):Kv(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}},s4=Y(bv,e=>new o4(e)),c4=W(((e={})=>({name:bv,options:e,setupOnce(){s4(e)}}))),l4=[`>=0.10.0 <2`],u4=class extends q{constructor(e={}){super(`@sentry/instrumentation-google-genai`,k,e)}init(){return new J(`@google/genai`,l4,e=>this._patch(e),e=>e,[new JR(`@google/genai/dist/node/index.cjs`,l4,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 ef(`Google_GenAI`)?Reflect.construct(t,e):ly(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 db(e,`GoogleGenAI`,r),e}},d4=Y(qv,e=>new u4(e)),f4=W(((e={})=>({name:qv,setupOnce(){d4(e)}}))),p4=[`>=0.1.0 <2.0.0`];function m4(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=My(i.callbacks,t),Reflect.apply(e,n,r)}})}var h4=class extends q{constructor(e={}){super(`@sentry/instrumentation-langchain`,k,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 J(t,p4,this._patch.bind(this),e=>e,[new JR(`${t}/dist/index.cjs`,p4,this._patch.bind(this),e=>e)]));return e.push(new J(`langchain`,p4,this._patch.bind(this),e=>e,[new JR(`langchain/dist/chat_models/universal.cjs`,p4,this._patch.bind(this),e=>e)])),e}_patch(e){$d([nv,bv,qv]);let t=this.getConfig(),n=Ny(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]=m4(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,Ry(n,t)))}}},g4=Y(uy,e=>new h4(e)),_4=W(((e={})=>({name:uy,setupOnce(){g4(e)}}))),v4=[`>=0.0.0 <2.0.0`],y4=class extends q{constructor(e={}){super(`@sentry/instrumentation-langgraph`,k,e)}init(){return[new J(`@langchain/langgraph`,v4,this._patch.bind(this),e=>e,[new JR(`@langchain/langgraph/dist/index.cjs`,v4,this._patch.bind(this),e=>e),new JR(`@langchain/langgraph/dist/prebuilt/index.cjs`,v4,this._patch.bind(this),e=>e)]),new J(`@langchain/langgraph/prebuilt`,v4,this._patch.bind(this),e=>e,[new JR(`@langchain/langgraph/dist/prebuilt/index.cjs`,v4,this._patch.bind(this),e=>e)])]}_patch(e){let t=P()?.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`&&tb(e.StateGraph.prototype,n),e.createReactAgent&&typeof e.createReactAgent==`function`){let t=e.createReactAgent;Object.defineProperty(e,"createReactAgent",{value:eb(t,n),writable:!0,enumerable:!0,configurable:!0})}return e}},b4=Y(zy,e=>new y4(e)),x4=W(((e={})=>({name:zy,setupOnce(){b4(e)}}))),S4=W(e=>(Bu()||ut(()=>{console.warn(`The launchDarklyIntegration() can only be used in the browser.`)}),{name:`LaunchDarkly`}));function C4(){return Bu()||ut(()=>{console.warn(`The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.`)}),{name:`sentry-flag-auditor`,type:`flag-used`,synchronous:!0,method:()=>null}}var w4=W(e=>(Bu()||ut(()=>{console.warn(`The openFeatureIntegration() can only be used in the browser.`)}),{name:`OpenFeature`})),T4=class{constructor(){Bu()||ut(()=>{console.warn(`The OpenFeatureIntegrationHook can only be used in the browser.`)})}after(){}error(){}},E4=W(e=>(Bu()||ut(()=>{console.warn(`The statsigIntegration() can only be used in the browser.`)}),{name:`Statsig`})),D4=W(e=>(Bu()||ut(()=>{console.warn(`The unleashIntegration() can only be used in the browser.`)}),{name:`Unleash`})),O4=Qm;function k4(e,t,n){let r=new J(`@firebase/firestore`,e,e=>A4(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 JR(i,e,e=>A4(e,t,n),e=>j4(e,n)));return r}function A4(e,t,n){return j4(e,n),t(e,`addDoc`,M4()),t(e,`getDocs`,P4()),t(e,`setDoc`,F4()),t(e,`deleteDoc`,N4()),e}function j4(e,t){for(let n of[`addDoc`,`getDocs`,`setDoc`,`deleteDoc`])K(e[n])&&t(e,n);return e}function M4(){return function(e){return function(t,n){return I4(`addDoc`,t,()=>e(t,n))}}}function N4(){return function(e){return function(t){return I4(`deleteDoc`,t.parent||t,()=>e(t))}}}function P4(){return function(e){return function(t){return I4(`getDocs`,t,()=>e(t))}}}function F4(){return function(e){return function(t,n,r){return I4(`setDoc`,t.parent||t,()=>r===void 0?e(t,n):e(t,n,r))}}}function I4(e,t,n){return z({name:`${e} ${t.path}`,op:`db.query`,kind:G.CLIENT,attributes:{[I]:`auto.firebase.otel.firestore`,[Is]:e,...R4(t)}},n)}function L4(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(Be.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 R4(e){let t=e.firestore.app,n=t.options,r=(e.firestore.toJSON()||{}).settings||{},i={[js]:e.path,[Ns]:t.name,[Bs]:`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}=L4(r);return a&&(i[dl]=a),o&&(i[fl]=o),i}function z4(e,t,n){let r=new J(`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 JR(i,e,e=>V4(e,t,n,a),e=>H4(e,n)))}),r}function B4(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={[I]:`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),ao({name:`firebase.function.${e}`,op:`http.request`,kind:G.SERVER,attributes:i},async e=>{try{let n=await r.apply(this,t);return e.end(),n}catch(t){throw e.setStatus({code:2}),H(t,{mechanism:{type:`auto.firebase.otel.functions`,handled:!1}}),e.end(),await uu(2e3),t}})};return i?t.call(this,i,a):t.call(this,a)}}}function V4(e,t,n,r){switch(H4(e,n),r){case`function`:t(e,`onRequest`,B4(`http.request`)),t(e,`onCall`,B4(`http.call`));break;case`firestore`:t(e,`onDocumentCreated`,B4(`firestore.document.created`)),t(e,`onDocumentUpdated`,B4(`firestore.document.updated`)),t(e,`onDocumentDeleted`,B4(`firestore.document.deleted`)),t(e,`onDocumentWritten`,B4(`firestore.document.written`)),t(e,`onDocumentCreatedWithAuthContext`,B4(`firestore.document.created`)),t(e,`onDocumentUpdatedWithAuthContext`,B4(`firestore.document.updated`)),t(e,`onDocumentDeletedWithAuthContext`,B4(`firestore.document.deleted`)),t(e,`onDocumentWrittenWithAuthContext`,B4(`firestore.document.written`));break;case`scheduler`:t(e,`onSchedule`,B4(`scheduler.scheduled`));break;case`storage`:t(e,`onObjectFinalized`,B4(`storage.object.finalized`)),t(e,`onObjectArchived`,B4(`storage.object.archived`)),t(e,`onObjectDeleted`,B4(`storage.object.deleted`)),t(e,`onObjectMetadataUpdated`,B4(`storage.object.metadataUpdated`))}return e}function H4(e,t){for(let n of[`onSchedule`,`onRequest`,`onCall`,`onObjectFinalized`,`onObjectArchived`,`onObjectDeleted`,`onObjectMetadataUpdated`,`onDocumentCreated`,`onDocumentUpdated`,`onDocumentDeleted`,`onDocumentWritten`,`onDocumentCreatedWithAuthContext`,`onDocumentUpdatedWithAuthContext`,`onDocumentDeletedWithAuthContext`,`onDocumentWrittenWithAuthContext`])K(e[n])&&t(e,n);return e}var U4=[`>=3.0.0 <5`],W4=[`>=6.0.0 <7`],G4=class extends q{constructor(e={}){super(`@sentry/instrumentation-firebase`,k,e)}init(){let e=[];return e.push(k4(U4,this._wrap,this._unwrap)),e.push(z4(W4,this._wrap,this._unwrap)),e}},K4=`Firebase`,q4=Y(K4,()=>new G4),J4=W((()=>({name:K4,setupOnce(){q4()}})));function Y4(){return[CP(),KR(),Pz(),yU(),wB(),HB(),eV(),_V(),sH(),PH(),PI(),oU(),NU(),KU(),M0(),R0(),nB(),H2(),sB(),_4(),x4(),e4(),i4(),c4(),f4(),HH(),J4()]}function X4(){return[VN,xP,GU,UR,aU,vU,tB,MU,oB,CB,VB,$B,gV,NH,aU,Nz,oH,j0,L0,V2,g4,Q2,r4,BH,q4,s4,d4,b4]}x();var Z4=1e6,Q4=Symbol.for(`opentelemetry.js.api.1`);function $4(e){if(_.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[Q4];if(n&&!n.trace){if(gP&&A.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[Q4]=void 0,!_.setGlobalTracerProvider(e))return!1;let r=t[Q4];if(r){let{propagation:e,context:i,...a}=n;t[Q4]={...a,...r}}return!0}return!1}function e3(e,t={}){e.getOptions().debug&&DA();let[n,r]=r3(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function t3(e={}){let{debug:t}=e;t&&A.enable(),LM(),n3(e.integrations).forEach(e=>{e(),t&&A.log(`[Sentry] Preloaded ${e.id} instrumentation`)})}function n3(e){let t=X4();return e?t.filter(t=>{let n=t.id;return e.some(e=>n===e||n.startsWith(`${e}.`))}):t}function r3(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||t.spanProcessors?.length))return i3(e);let n=new tO({sampler:new eA(e),resource:_A(`node`),forceFlushTimeoutMillis:500,spanProcessors:[new $k({timeout:a3(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});$4(n),p.setGlobalPropagator(new ak);let r=new EA;return l.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function i3(e){let t=new uA({resource:_A(`node`)});if(!$4(t))return gP&&A.warn(`Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered.`),[void 0,void 0];ik(`SentryTracerProvider`),p.setGlobalPropagator(new ak);let n=new EA;return l.setGlobalContextManager(n),e.on(`spanEnd`,e=>{aA(e,{finalizeStatus:!0})}),Ja(e)&&e.on(`preprocessSpan`,Qk),e.on(`preprocessEvent`,e=>{e.type===`transaction`&&(e.contexts={...e.contexts,otel:{resource:t.resource?.attributes,...e.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function a3(e){if(e!=null){if(e>Z4)return gP&&A.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Z4}`),Z4;if(e<=0||Number.isNaN(e)){gP&&A.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function o3(){return RM().filter(e=>e.name!==`Http`&&e.name!==`NodeFetch`).concat(HN(),UN())}function s3(e){return[...o3(),...oa(e)?Y4():[]]}function c3(e,t){if(xV()&&oa(t)){let t=SV();if(t){let n=new Set(t.replacedOtelIntegrationNames);return[...e.filter(e=>!n.has(e.name)),...t.integrations]}}return e}function l3(e={}){return u3(e,s3)}function u3(e={},t){Cf(e,`node`);let n=xV()&&oa(e)?SV():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=zM({...e,defaultIntegrations:r});return i&&!e.skipOpenTelemetrySetup&&(e3(i,{spanProcessors:e.openTelemetrySpanProcessors}),VM()),n&&n.detect(),i}function d3(e={}){return u3(e,()=>[])}var f3=[...gW,...yW,...SW,...EW,...kW,...LW,...BW,...WW,...qW,...XW,...$W,...nG,...dG,...mG,...SG,...kG,...MG,...IG,...VG,...GG,...JG,...QG,...tK,...iK,...sK,...uK,...pK,...yK,...SK];[...vW,...xW,...wW,...OW,...jW,...zW,...HW,...KW,...YW,...QW,...tG,...iG,...pG,...gG,...TG,...jG,...PG,...RG,...WG,...qG,...XG,...eK,...rK,...oK,...lK,...fK,...hK,...xK,...TK];function p3(e=[]){return[...Af([...f3,...e].map(e=>e.module.name)),`@remix-run/node`]}p3();function m3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var h3=g3;function g3(e,t){let[n]=w3(e,``);for(let e of y3(t))if(_3(e,n))return!0;return!1}function _3(e,t){for(let[n,r]of e)if(!T3(t,r,n))return!1;return!0}function v3(e){return e===`latest`&&(e=`>=0`),e.match(/^([^\d+]*)(\d.*)$/)||[null,``,`*.*.*`]}function y3(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=v3(i),o=a[1]||`=`;o.endsWith(`v`)&&(o=o.slice(0,-1));let[s,c]=w3(a[2],o);if(e+2<r.length&&r[e+1]===`-`){let t=v3(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?b3(s,0):b3(s,1)])}else if(c[0]===`^`){let e=s[0]===0?s[1]===0?2:1:0;n.push([`>=`,s]),n.push([`<`,e===0?b3(s,0):e===1?b3(s,1):b3(s,2)])}else n.push([c.replace(`~`,``).replace(`^`,``),s])}return n.length&&t.push(n),t}function b3(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 x3(e){return e===`x`||e===`X`||e===`*`||e===`latest`?-1:Number(e)}function S3(e){return/^\d+$/.test(e)?Number(e):e}function C3(e,t,n){return n===-1?e!==`<`:e===`=`?t===n:e===`>`?t>n:e===`>=`?t>=n:e===`<`?t<n:e===`<=`&&t<=n}function w3(e,t){e=e.split(`+`)[0];let[n,r]=e.split(`-`),i=n.split(`.`).map(x3).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(S3)),t]:[i.slice(0,3),t]}function T3(e,t,n){if(!C3(`=`,e[0],t[0]))return C3(n,e[0],t[0]);if(!C3(`=`,e[1],t[1]))return C3(n,e[1],t[1]);if(!C3(`=`,e[2],t[2])||e.length===3&&t.length===3)return C3(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(C3(n,e[r]||``,t[r]||``))return!0;return!1}function E3(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 D3(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)||A3(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 O3(e){return(function(e){if(Array.isArray(e))return E3(e)})(e)||(function(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)})(e)||A3(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 k3(e){return(k3=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 A3(e,t){if(e){if(typeof e==`string`)return E3(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)?E3(e,t):void 0}}function j3(e,t){return e(t={exports:{}},t.exports),t.exports}var M3=j3((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,ee,b;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(ee={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 ee.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[b=_[h]]){if(Array.isArray(v)){for(g=v.length;--g>=0;)if(v[g]){if(p(c,_[h]))m=new u(v[g],[b,g],`Property`,new l(v,g));else{if(!f(v[g]))continue;m=new u(v[g],[b,g],null,new l(v,g))}n.push(m)}}else f(v)&&n.push(new u(v,b,null,new l(i,b)))}}}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 ee.root;return ee.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)})),N3=j3((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:Je},l=Je,u=We(` `,!1),d=/^[^ [\],():#!=><~+.]/,f=Ge([` `,`[`,`]`,`,`,`(`,`)`,`:`,`#`,`!`,`=`,`>`,`<`,`~`,`+`,`.`],!0,!1),p=We(`>`,!1),m=We(`~`,!1),h=We(`+`,!1),g=We(`,`,!1),_=function(e,t){return[e].concat(t.map((function(e){return e[3]})))},v=We(`!`,!1),y=We(`*`,!1),ee=We(`#`,!1),b=We(`[`,!1),te=We(`]`,!1),x=/^[><!]/,ne=Ge([`>`,`<`,`!`],!1,!1),re=We(`=`,!1),ie=function(e){return(e||``)+`=`},ae=/^[><]/,oe=Ge([`>`,`<`],!1,!1),se=We(`.`,!1),ce=function(e,t,n){return{type:`attribute`,name:e,operator:t,value:n}},le=We(`"`,!1),ue=/^[^\\"]/,de=Ge([`\\`,`"`],!0,!1),fe=We(`\\`,!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=We(`'`,!1),_e=/^[^\\']/,ve=Ge([`\\`,`'`],!0,!1),ye=/^[0-9]/,be=Ge([[`0`,`9`]],!1,!1),xe=We(`type(`,!1),Se=/^[^ )]/,Ce=Ge([` `,`)`],!0,!1),we=We(`)`,!1),Te=/^[imsu]/,Ee=Ge([`i`,`m`,`s`,`u`],!1,!1),De=We(`/`,!1),Oe=/^[^\]\\]/,ke=Ge([`]`,`\\`],!0,!1),Ae=/^[^\/\\[]/,je=Ge([`/`,`\\`,`[`],!0,!1),Me=We(`:not(`,!1),Ne=We(`:matches(`,!1),Pe=function(e){return{type:`matches`,selectors:e}},Fe=We(`:is(`,!1),Ie=We(`:has(`,!1),Le=We(`:first-child`,!1),Re=We(`:last-child`,!1),ze=We(`:nth-child(`,!1),Be=We(`:nth-last-child(`,!1),Ve=We(`:`,!1),S=0,C=[{line:1,column:1}],He=0,Ue=[],w={};if(`startRule`in n){if(!(n.startRule in c))throw Error(`Can't start parsing from rule "`+n.startRule+`".`);l=c[n.startRule]}function We(e,t){return{type:`literal`,text:e,ignoreCase:t}}function Ge(e,t,n){return{type:`class`,parts:e,inverted:t,ignoreCase:n}}function Ke(e){var n,r=C[e];if(r)return r;for(n=e-1;!C[n];)n--;for(r={line:(r=C[n]).line,column:r.column};n<e;)t.charCodeAt(n)===10?(r.line++,r.column=1):r.column++,n++;return C[e]=r,r}function qe(e,t){var n=Ke(e),r=Ke(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function T(e){S<He||(S>He&&(He=S,Ue=[]),Ue.push(e))}function Je(){var e,t,n,r,i=36*S+0,a=w[i];return a?(S=a.nextPos,a.result):(e=S,(t=E())!==s&&(n=Ze())!==s&&E()!==s?e=t=(r=n).length===1?r[0]:{type:`matches`,selectors:r}:(S=e,e=s),e===s&&(e=S,(t=E())!==s&&(t=void 0),e=t),w[i]={nextPos:S,result:e},e)}function E(){var e,n,r=36*S+1,i=w[r];if(i)return S=i.nextPos,i.result;for(e=[],t.charCodeAt(S)===32?(n=` `,S++):(n=s,T(u));n!==s;)e.push(n),t.charCodeAt(S)===32?(n=` `,S++):(n=s,T(u));return w[r]={nextPos:S,result:e},e}function Ye(){var e,n,r,i=36*S+2,a=w[i];if(a)return S=a.nextPos,a.result;if(n=[],d.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,T(f)),r!==s)for(;r!==s;)n.push(r),d.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,T(f));else n=s;return n!==s&&(n=n.join(``)),e=n,w[i]={nextPos:S,result:e},e}function Xe(){var e,n,r,i=36*S+3,a=w[i];return a?(S=a.nextPos,a.result):(e=S,(n=E())===s?(S=e,e=s):(t.charCodeAt(S)===62?(r=`>`,S++):(r=s,T(p)),r!==s&&E()!==s?e=n=`child`:(S=e,e=s)),e===s&&(e=S,(n=E())===s?(S=e,e=s):(t.charCodeAt(S)===126?(r=`~`,S++):(r=s,T(m)),r!==s&&E()!==s?e=n=`sibling`:(S=e,e=s)),e===s&&(e=S,(n=E())===s?(S=e,e=s):(t.charCodeAt(S)===43?(r=`+`,S++):(r=s,T(h)),r!==s&&E()!==s?e=n=`adjacent`:(S=e,e=s)),e===s&&(e=S,t.charCodeAt(S)===32?(n=` `,S++):(n=s,T(u)),n!==s&&(r=E())!==s?e=n=`descendant`:(S=e,e=s)))),w[i]={nextPos:S,result:e},e)}function Ze(){var e,n,r,i,a,o,c,l,u=36*S+5,d=w[u];if(d)return S=d.nextPos,d.result;if(e=S,(n=$e())!==s){for(r=[],i=S,(a=E())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=$e())!==s?i=a=[a,o,c,l]:(S=i,i=s));i!==s;)r.push(i),i=S,(a=E())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=$e())!==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 w[u]={nextPos:S,result:e},e}function Qe(){var e,t,n,r,i,a=36*S+6,o=w[a];return o?(S=o.nextPos,o.result):(e=S,(t=Xe())===s&&(t=null),t!==s&&(n=$e())!==s?(i=n,e=t=(r=t)?{type:r,left:{type:`exactNode`},right:i}:i):(S=e,e=s),w[a]={nextPos:S,result:e},e)}function $e(){var e,t,n,r,i,a,o,c=36*S+7,l=w[c];if(l)return S=l.nextPos,l.result;if(e=S,(t=et())!==s){for(n=[],r=S,(i=Xe())!==s&&(a=et())!==s?r=i=[i,a]:(S=r,r=s);r!==s;)n.push(r),r=S,(i=Xe())!==s&&(a=et())!==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 w[c]={nextPos:S,result:e},e}function et(){var e,n,r,i,a,o,c,l=36*S+8,u=w[l];if(u)return S=u.nextPos,u.result;if(e=S,t.charCodeAt(S)===33?(n=`!`,S++):(n=s,T(v)),n===s&&(n=null),n!==s){if(r=[],(i=tt())!==s)for(;i!==s;)r.push(i),i=tt();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 w[l]={nextPos:S,result:e},e}function tt(){var e,n=36*S+9,r=w[n];return r?(S=r.nextPos,r.result):((e=(function(){var e,n,r=36*S+10,i=w[r];return i?(S=i.nextPos,i.result):(t.charCodeAt(S)===42?(n=`*`,S++):(n=s,T(y)),n!==s&&(n={type:`wildcard`,value:n}),e=n,w[r]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i=36*S+11,a=w[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===35?(n=`#`,S++):(n=s,T(ee)),n===s&&(n=null),n!==s&&(r=Ye())!==s?e=n={type:`identifier`,value:r}:(S=e,e=s),w[i]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+12,o=w[a];return o?(S=o.nextPos,o.result):(e=S,t.charCodeAt(S)===91?(n=`[`,S++):(n=s,T(b)),n!==s&&E()!==s&&(r=(function(){var e,n,r,i,a=36*S+16,o=w[a];return o?(S=o.nextPos,o.result):(e=S,(n=nt())!==s&&E()!==s&&(r=(function(){var e,n,r,i=36*S+14,a=w[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===33?(n=`!`,S++):(n=s,T(v)),n===s&&(n=null),n===s?(S=e,e=s):(t.charCodeAt(S)===61?(r=`=`,S++):(r=s,T(re)),r===s?(S=e,e=s):(n=ie(n),e=n)),w[i]={nextPos:S,result:e},e)})())!==s&&E()!==s?((i=(function(){var e,n,r,i,a,o=36*S+20,c=w[o];if(c)return S=c.nextPos,c.result;if(e=S,t.substr(S,5)===`type(`?(n=`type(`,S+=5):(n=s,T(xe)),n!==s){if(E()!==s){if(r=[],Se.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(Ce)),i!==s)for(;i!==s;)r.push(i),Se.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(Ce));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(S)===41?(a=`)`,S++):(a=s,T(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 w[o]={nextPos:S,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c=36*S+22,l=w[c];if(l)return S=l.nextPos,l.result;if(e=S,t.charCodeAt(S)===47?(n=`/`,S++):(n=s,T(De)),n!==s){if(r=[],(i=rt())===s&&(i=D())===s&&(i=O()),i!==s)for(;i!==s;)r.push(i),(i=rt())===s&&(i=D())===s&&(i=O());else r=s;r===s?(S=e,e=s):(t.charCodeAt(S)===47?(i=`/`,S++):(i=s,T(De)),i===s?(S=e,e=s):((a=(function(){var e,n,r=36*S+21,i=w[r];if(i)return S=i.nextPos,i.result;if(e=[],Te.test(t.charAt(S))?(n=t.charAt(S),S++):(n=s,T(Ee)),n!==s)for(;n!==s;)e.push(n),Te.test(t.charAt(S))?(n=t.charAt(S),S++):(n=s,T(Ee));else e=s;return w[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 w[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=nt())!==s&&E()!==s&&(r=(function(){var e,n,r,i=36*S+13,a=w[i];return a?(S=a.nextPos,a.result):(e=S,x.test(t.charAt(S))?(n=t.charAt(S),S++):(n=s,T(ne)),n===s&&(n=null),n===s?(S=e,e=s):(t.charCodeAt(S)===61?(r=`=`,S++):(r=s,T(re)),r===s?(S=e,e=s):(n=ie(n),e=n)),e===s&&(ae.test(t.charAt(S))?(e=t.charAt(S),S++):(e=s,T(oe))),w[i]={nextPos:S,result:e},e)})())!==s&&E()!==s?((i=(function(){var e,n,r,i,a,o,c=36*S+17,l=w[c];if(l)return S=l.nextPos,l.result;if(e=S,t.charCodeAt(S)===34?(n=`"`,S++):(n=s,T(le)),n!==s){for(r=[],ue.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(de)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,T(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,T(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,T(de)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,T(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,T(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,T(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,T(ge)),n!==s){for(r=[],_e.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(ve)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,T(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,T(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,T(ve)),i===s&&(i=S,t.charCodeAt(S)===92?(a=`\\`,S++):(a=s,T(fe)),a===s?(S=i,i=s):(t.length>S?(o=t.charAt(S),S++):(o=s,T(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,T(ge)),i===s?(S=e,e=s):(n=he(r),e=n))}else S=e,e=s}return w[c]={nextPos:S,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c,l=36*S+18,u=w[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,T(be));i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(be));if(r===s?(S=n,n=s):(t.charCodeAt(S)===46?(i=`.`,S++):(i=s,T(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,T(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(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 w[l]={nextPos:S,result:e},e})())===s&&(i=(function(){var e,t,n=36*S+19,r=w[n];return r?(S=r.nextPos,r.result):((t=Ye())!==s&&(t={type:`literal`,value:t}),e=t,w[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=nt())!==s&&(n={type:`attribute`,name:n}),e=n)),w[a]={nextPos:S,result:e},e)})())!==s&&E()!==s?(t.charCodeAt(S)===93?(i=`]`,S++):(i=s,T(te)),i===s?(S=e,e=s):e=n=r):(S=e,e=s),w[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o,c,l,u=36*S+26,d=w[u];if(d)return S=d.nextPos,d.result;if(e=S,t.charCodeAt(S)===46?(n=`.`,S++):(n=s,T(se)),n!==s){if((r=Ye())!==s){for(i=[],a=S,t.charCodeAt(S)===46?(o=`.`,S++):(o=s,T(se)),o!==s&&(c=Ye())!==s?a=o=[o,c]:(S=a,a=s);a!==s;)i.push(a),a=S,t.charCodeAt(S)===46?(o=`.`,S++):(o=s,T(se)),o!==s&&(c=Ye())!==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 w[u]={nextPos:S,result:e},e})())===s&&(e=(function(){var e,n,r,i,a=36*S+27,o=w[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,5)===`:not(`?(n=`:not(`,S+=5):(n=s,T(Me)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,T(we)),i===s?(S=e,e=s):e=n={type:`not`,selectors:r}):(S=e,e=s),w[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+28,o=w[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,9)===`:matches(`?(n=`:matches(`,S+=9):(n=s,T(Ne)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,T(we)),i===s?(S=e,e=s):(n=Pe(r),e=n)):(S=e,e=s),w[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+29,o=w[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,4)===`:is(`?(n=`:is(`,S+=4):(n=s,T(Fe)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,T(we)),i===s?(S=e,e=s):(n=Pe(r),e=n)):(S=e,e=s),w[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*S+30,o=w[a];return o?(S=o.nextPos,o.result):(e=S,t.substr(S,5)===`:has(`?(n=`:has(`,S+=5):(n=s,T(Ie)),n!==s&&E()!==s&&(r=(function(){var e,n,r,i,a,o,c,l,u=36*S+4,d=w[u];if(d)return S=d.nextPos,d.result;if(e=S,(n=Qe())!==s){for(r=[],i=S,(a=E())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=Qe())!==s?i=a=[a,o,c,l]:(S=i,i=s));i!==s;)r.push(i),i=S,(a=E())===s?(S=i,i=s):(t.charCodeAt(S)===44?(o=`,`,S++):(o=s,T(g)),o!==s&&(c=E())!==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 w[u]={nextPos:S,result:e},e})())!==s&&E()!==s?(t.charCodeAt(S)===41?(i=`)`,S++):(i=s,T(we)),i===s?(S=e,e=s):e=n={type:`has`,selectors:r}):(S=e,e=s),w[a]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r=36*S+31,i=w[r];return i?(S=i.nextPos,i.result):(t.substr(S,12)===`:first-child`?(n=`:first-child`,S+=12):(n=s,T(Le)),n!==s&&(n=k(1)),e=n,w[r]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r=36*S+32,i=w[r];return i?(S=i.nextPos,i.result):(t.substr(S,11)===`:last-child`?(n=`:last-child`,S+=11):(n=s,T(Re)),n!==s&&(n=it(1)),e=n,w[r]={nextPos:S,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o=36*S+33,c=w[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,T(ze)),n!==s){if(E()!==s){if(r=[],ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(be));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(S)===41?(a=`)`,S++):(a=s,T(we)),a===s?(S=e,e=s):(n=k(parseInt(r.join(``),10)),e=n)):(S=e,e=s)}else S=e,e=s}else S=e,e=s;return w[o]={nextPos:S,result:e},e})())===s&&(e=(function(){var e,n,r,i,a,o=36*S+34,c=w[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,T(Be)),n!==s){if(E()!==s){if(r=[],ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(be));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(S)===41?(a=`)`,S++):(a=s,T(we)),a===s?(S=e,e=s):(n=it(parseInt(r.join(``),10)),e=n)):(S=e,e=s)}else S=e,e=s}else S=e,e=s;return w[o]={nextPos:S,result:e},e})())===s&&(e=(function(){var e,n,r,i=36*S+35,a=w[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===58?(n=`:`,S++):(n=s,T(Ve)),n!==s&&(r=Ye())!==s?e=n={type:`class`,name:r}:(S=e,e=s),w[i]={nextPos:S,result:e},e)})()),w[n]={nextPos:S,result:e},e)}function nt(){var e,n,r,i,a,o,c,l,u=36*S+15,d=w[u];if(d)return S=d.nextPos,d.result;if(e=S,(n=Ye())!==s){for(r=[],i=S,t.charCodeAt(S)===46?(a=`.`,S++):(a=s,T(se)),a!==s&&(o=Ye())!==s?i=a=[a,o]:(S=i,i=s);i!==s;)r.push(i),i=S,t.charCodeAt(S)===46?(a=`.`,S++):(a=s,T(se)),a!==s&&(o=Ye())!==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 w[u]={nextPos:S,result:e},e}function rt(){var e,n,r,i,a=36*S+23,o=w[a];if(o)return S=o.nextPos,o.result;if(e=S,t.charCodeAt(S)===91?(n=`[`,S++):(n=s,T(b)),n!==s){if(r=[],Oe.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(ke)),i===s&&(i=D()),i!==s)for(;i!==s;)r.push(i),Oe.test(t.charAt(S))?(i=t.charAt(S),S++):(i=s,T(ke)),i===s&&(i=D());else r=s;r===s?(S=e,e=s):(t.charCodeAt(S)===93?(i=`]`,S++):(i=s,T(te)),i===s?(S=e,e=s):e=n=`[`+r.join(``)+`]`)}else S=e,e=s;return w[a]={nextPos:S,result:e},e}function D(){var e,n,r,i=36*S+24,a=w[i];return a?(S=a.nextPos,a.result):(e=S,t.charCodeAt(S)===92?(n=`\\`,S++):(n=s,T(fe)),n===s?(S=e,e=s):(t.length>S?(r=t.charAt(S),S++):(r=s,T(pe)),r===s?(S=e,e=s):e=n=`\\`+r),w[i]={nextPos:S,result:e},e)}function O(){var e,n,r,i=36*S+25,a=w[i];if(a)return S=a.nextPos,a.result;if(n=[],Ae.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,T(je)),r!==s)for(;r!==s;)n.push(r),Ae.test(t.charAt(S))?(r=t.charAt(S),S++):(r=s,T(je));else n=s;return n!==s&&(n=n.join(``)),e=n,w[i]={nextPos:S,result:e},e}function k(e){return{type:`nth-child`,index:{type:`literal`,value:e}}}function it(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&&T({type:`end`}),i=Ue,a=He<t.length?t.charAt(He):null,o=He<t.length?qe(He,He+1):qe(He,He),new e(e.buildMessage(i,a),i,a,o)}}})()}));function P3(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var F3=typeof WeakMap==`function`?new WeakMap:null;function I3(e){if(e==null)return function(){return!0};if(F3!=null){var t=F3.get(e);return t??(t=L3(e),F3.set(e,t)),t}return L3(e)}function L3(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(I3);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(I3);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(I3);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(I3);return function(e,t,n){var r=!1,i=[];return M3.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=I3(e.left),c=I3(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=I3(e.left),u=I3(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 P3(e,d)!=null};case`=`:switch(e.value.type){case`regexp`:return function(t){var n=P3(t,d);return typeof n==`string`&&e.value.value.test(n)};case`literal`:var f=`${e.value.value}`;return function(e){return f===`${P3(e,d)}`};case`type`:return function(t){return e.value.value===k3(P3(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(P3(t,d))};case`literal`:var p=`${e.value.value}`;return function(e){return p!==`${P3(e,d)}`};case`type`:return function(t){return e.value.value!==k3(P3(t,d))}}throw Error(`Unknown selector value type: ${e.value.type}`);case`<=`:return function(t){return P3(t,d)<=e.value.value};case`<`:return function(t){return P3(t,d)<e.value.value};case`>`:return function(t){return P3(t,d)>e.value.value};case`>=`:return function(t){return P3(t,d)>=e.value.value}}throw Error(`Unknown operator: ${e.operator}`);case`sibling`:var m=I3(e.left),h=I3(e.right);return function(t,n,r){return h(t,n,r)&&B3(t,m,n,`LEFT_SIDE`,r)||e.left.subject&&m(t,n,r)&&B3(t,h,n,`RIGHT_SIDE`,r)};case`adjacent`:var g=I3(e.left),_=I3(e.right);return function(t,n,r){return _(t,n,r)&&V3(t,g,n,`LEFT_SIDE`,r)||e.right.subject&&g(t,n,r)&&V3(t,_,n,`RIGHT_SIDE`,r)};case`nth-child`:var v=e.index.value,y=I3(e.right);return function(e,t,n){return y(e,t,n)&&H3(e,t,v,n)};case`nth-last-child`:var ee=-e.index.value,b=I3(e.right);return function(e,t,n){return b(e,t,n)&&H3(e,t,ee,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 R3(e,t){var n=t&&t.nodeTypeKey||`type`,r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:M3.VisitorKeys[r]?M3.VisitorKeys[r]:t&&typeof t.fallback==`function`?t.fallback(e):Object.keys(e).filter((function(e){return e!==n}))}function z3(e,t){var n=t&&t.nodeTypeKey||`type`;return e!==null&&k3(e)===`object`&&typeof e[n]==`string`}function B3(e,t,n,r,i){var a=D3(n,1)[0];if(!a)return!1;for(var o=R3(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(z3(c[f],i)&&t(c[f],n,i))return!0}}return!1}function V3(e,t,n,r,i){var a=D3(n,1)[0];if(!a)return!1;for(var o=R3(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&&z3(c[l-1],i)&&t(c[l-1],n,i)||r===`RIGHT_SIDE`&&l<c.length-1&&z3(c[l+1],i)&&t(c[l+1],n,i))return!0}}return!1}function H3(e,t,n,r){if(n===0)return!1;var i=D3(t,1)[0];if(!i)return!1;for(var a=R3(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 U3(e,t,n,r){if(t){var i=[],a=I3(t),o=(function e(t,n){if(t==null||k3(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,O3(e(s,o===`left`?s:n)))}return r})(t).map(I3);M3.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 W3(e,t,n){var r=[];return U3(e,t,(function(e){r.push(e)}),n),r}function G3(e){return N3.parse(e)}function K3(e,t,n){return W3(e,G3(t),n)}K3.parse=G3,K3.match=W3,K3.traverse=U3,K3.matches=function(e,t,n,r){return!t||!!e&&(n||=[],I3(t)(e,n,r))},K3.query=K3;var q3={},J3={},Y3={exports:{}},X3=K3,{parse:Z3}=q3,Q3=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name===`tr_ch_apm_tracingChannel`,$3=/[^\w]/g,e6=e=>`tr_ch_apm$${e.replace($3,`_`)}`,t6=Y3.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(Q3))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,Z3(a,r).body[0],Z3(`const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc`,r).body[0],Z3(`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=e6(n);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;t6.tracingChannelImport(e,t);let a=t.body.findIndex(Q3),o=`
39
+ const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
40
+ `;t.body.splice(a+1,0,Z3(o).body[0])},traceCallback:r6,tracePromise:r6,traceSync:r6,traceAuto:r6};function n6(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 r6(e,t,n,r){let i=r[r.length-1];t.type===`ClassDeclaration`||t.type===`ClassExpression`?a6(e,t,i):i6(e,t,i)}function i6(e,t,n){t6.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=o6(e,{type:c,params:l,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=n6(l),t.generator=!1,t.async=!1,s6(e,t)}function a6(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`);t6.tracingChannelDeclaration(e,n),s||(s=Z3(t.superClass?`class A extends Object { constructor (...args) { super(...args) } }`:`class A { constructor () {} }`).body[0].body.body[0],o.body.unshift(s));let c=Z3(`
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=o6(e,{type:`Identifier`,name:`__apm$${a}`},n),s6(e,l),s.value.body.body.push(...c)}function o6(e,t,n){let{operator:r,moduleVersion:i}=e,{returnKind:a}=e.functionQuery,o=a?p6(e,a,n):``,s;r===`traceCallback`&&(s=l6(e,t,o)),r===`tracePromise`&&(s=u6(e,t,o)),r===`traceSync`&&(s=d6(e,t,o)),r===`traceAuto`&&(s=c6(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=Z3(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),X3.query(l,`[id.name=__apm$wrapped]`)[0].init=t,l}function s6(e,t){let n=new Set;X3.traverse(t.body,X3.parse(`[object.type=Super]`),(e,t)=>{let{name:r}=e.property,i;if(t.callee){let{expression:e}=Z3(`__apm$super['${r}'].call(this)`).body[0];t.callee=i=e.callee,t.arguments.unshift(...e.arguments)}else t.expression=i=Z3(`__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=Z3(`
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(Z3(`const __apm$super = {}`).body[0])}function c6(e,t,n=``){let r=l6(e,t,n),i=u6(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 l6(e,t,n=``){let{channelName:r,functionQuery:{callbackIndex:i=-1}}=e,a=e6(r);return Z3(`
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 u6(e,t,n=``){let{channelName:r}=e,i=e6(r);return Z3(`
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 d6(e,t,n=``){let{channelName:r}=e,i=e6(r);return Z3(`
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 f6(e,t){let{channelName:n,module:{name:r}}=e,i=e6(n+`:next`);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;let a=e6(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,Z3(s).body[0])}function p6(e,t,n){let{channelName:r}=e,i=t===`Iterator`?`traceSync`:`tracePromise`,a=e6(r+`:next`);return f6(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 m6=Y3.exports,h6={},g6=e=>{throw TypeError(e)},_6=(e,t,n)=>t.has(e)||g6(`Cannot `+n),v6=(e,t,n)=>(_6(e,t,`read from private field`),n?n.call(e):t.get(e)),y6=(e,t,n)=>t.has(e)?g6(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),b6=(e,t,n,r)=>(_6(e,t,`write to private field`),t.set(e,n),n),x6=(e,t,n)=>(_6(e,t,`access private method`),n),S6,C6,w6,T6,E6,D6,O6,k6,A6,j6,M6,N6,P6=K3,{parse:F6}=q3,{generate:I6}=J3,L6=m6,R6,z6,B6=class{constructor(e,t,n,r,i,a={}){y6(this,O6),y6(this,S6,null),y6(this,C6,null),y6(this,w6,null),y6(this,T6,[]),y6(this,E6,null),y6(this,D6,{}),b6(this,S6,e),b6(this,C6,t),b6(this,w6,n),b6(this,T6,r),b6(this,E6,i),b6(this,D6,a)}free(){}get moduleName(){return v6(this,S6)}get filePath(){return v6(this,w6)}transform(e,t,n){if(Buffer.isBuffer(e)&&(e=e.toString()),!e)return{code:e};let r,i={},a=0;for(let n of v6(this,T6)){let{astQuery:o,functionQuery:s={}}=n;if(!r){let n={loc:!0,ranges:!0,raw:!0,module:t===`esm`};try{r=F6(e,n)}catch{r=F6(e,{...n,module:!n.module})}t===`esm`&&(i=x6(this,O6,j6).call(this,r))}let c=x6(this,O6,M6).call(this,s,i),l=o||x6(this,O6,N6).call(this,c),u={...n,dcModule:v6(this,E6),moduleType:t,moduleVersion:v6(this,C6),functionQuery:c};u.operator=x6(this,O6,A6).call(this,u),P6.traverse(r,P6.parse(l),(...e)=>{a++,x6(this,O6,k6).call(this,u,...e)})}if(a===0&&v6(this,T6).length>0){let e=v6(this,T6).map(({astQuery:e,functionQuery:t={}})=>{if(e)return e;let n=x6(this,O6,M6).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){R6??=h6.SourceMapConsumer,z6??=h6.SourceMapGenerator;let e=`${v6(this,S6)}/${v6(this,w6)}`,t;if(n){let r=new R6(n);r.file=e,t=z6.fromSourceMap(r)}else t=new z6({file:e});return{code:I6(r,{sourceMap:t}),map:t.toString()}}return{code:e}}};S6=new WeakMap,C6=new WeakMap,w6=new WeakMap,T6=new WeakMap,E6=new WeakMap,D6=new WeakMap,O6=new WeakSet,k6=function(e,...t){let n=v6(this,D6)[e.operator]??L6[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)},A6=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`}},j6=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},M6=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},N6=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 V6={Transformer:B6},H6=e=>{throw TypeError(e)},U6=(e,t,n)=>t.has(e)||H6(`Cannot `+n),W6=(e,t,n)=>(U6(e,t,`read from private field`),n?n.call(e):t.get(e)),G6=(e,t,n)=>t.has(e)?H6(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),K6=(e,t,n,r)=>(U6(e,t,`write to private field`),t.set(e,n),n),q6,J6,Y6,X6,Z6=h3,{Transformer:Q6}=V6,$6=class{constructor(e,t){G6(this,q6,[]),G6(this,J6,null),G6(this,Y6,{}),G6(this,X6,{}),K6(this,q6,e),K6(this,J6,t||`diagnostics_channel`)}free(){K6(this,Y6,{})}addTransform(e,t){W6(this,X6)[e]=t}getTransformer(e,t,n){n=n.replace(/\\/g,`/`);let r=`${e}/${n}@${t}`;if(W6(this,Y6)[r])return W6(this,Y6)[r];let i=W6(this,q6).filter(({module:r})=>r.name===e&&(typeof r.filePath==`string`?r.filePath===n:r.filePath.test(n))&&Z6(t,r.versionRange));if(i.length!==0)return W6(this,Y6)[r]=new Q6(e,t,n,i,W6(this,J6),W6(this,X6)),W6(this,Y6)[r]}};q6=new WeakMap,J6=new WeakMap,Y6=new WeakMap,X6=new WeakMap;var{InstrumentationMatcher:e8}={InstrumentationMatcher:$6};function t8(e,t){return new e8(e,t)}var n8={create:t8},r8=me.sep,i8=function(e){var t=e.split(r8),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]+r8;for(var l=``,u=t.length-1,d=n+a;d<=u;d++)l+=d===u?t[d]:t[d]+r8;return{name:i,basedir:o,path:l}}},a8=m3(i8),{readFileSync:o8}=Te,{join:s8}=me,c8=new Map;function l8(e){if(c8.has(e))return c8.get(e);try{let t=o8(s8(e,`package.json`)),{version:n}=JSON.parse(t);return c8.set(e,n),n}catch{return process.version.slice(1)}}var u8=l8,d8=m3(u8),f8;function p8(e){f8=e}function m8(e){f8&&f8(e)}var h8={setDiagnosticsHook:p8,emitDiagnostics:m8},g8={exports:{}},_8=(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)},v8=pe,y8=E,b8=_8,{env:x8}=process,S8;b8(`no-color`)||b8(`no-colors`)||b8(`color=false`)||b8(`color=never`)?S8=0:(b8(`color`)||b8(`colors`)||b8(`color=true`)||b8(`color=always`))&&(S8=1),`FORCE_COLOR`in x8&&(S8=x8.FORCE_COLOR===`true`?1:x8.FORCE_COLOR===`false`?0:x8.FORCE_COLOR.length===0?1:Math.min(parseInt(x8.FORCE_COLOR,10),3));function C8(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function w8(e,t){if(S8===0)return 0;if(b8(`color=16m`)||b8(`color=full`)||b8(`color=truecolor`))return 3;if(b8(`color=256`))return 2;if(e&&!t&&S8===void 0)return 0;let n=S8||0;if(x8.TERM===`dumb`)return n;if(process.platform===`win32`){let e=v8.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in x8)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in x8)||x8.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in x8)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(x8.TEAMCITY_VERSION);if(x8.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in x8){let e=parseInt((x8.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(x8.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(x8.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(x8.TERM)||`COLORTERM`in x8?1:n}function T8(e){return C8(w8(e,e&&e.isTTY))}var E8={supportsColor:T8,stdout:C8(w8(!0,y8.isatty(1))),stderr:C8(w8(!0,y8.isatty(2)))},D8=1e3,O8=D8*60,k8=O8*60,A8=k8*24,j8=A8*7,M8=A8*365.25,N8=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return P8(e);if(n===`number`&&isFinite(e))return t.long?I8(e):F8(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function P8(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*M8;case`weeks`:case`week`:case`w`:return n*j8;case`days`:case`day`:case`d`:return n*A8;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return n*k8;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return n*O8;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return n*D8;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return n;default:return}}}}function F8(e){var t=Math.abs(e);return t>=A8?Math.round(e/A8)+`d`:t>=k8?Math.round(e/k8)+`h`:t>=O8?Math.round(e/O8)+`m`:t>=D8?Math.round(e/D8)+`s`:e+`ms`}function I8(e){var t=Math.abs(e);return t>=A8?L8(e,t,A8,`day`):t>=k8?L8(e,t,k8,`hour`):t>=O8?L8(e,t,O8,`minute`):t>=D8?L8(e,t,D8,`second`):e+` ms`}function L8(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}function R8(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=N8,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 z8=R8;(function(e,t){let n=E,r=Fe;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=E8;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=z8(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)}})(g8,g8.exports);var B8=g8.exports,V8=m3(B8),{create:H8}=n8,U8=ue,W8=i8,{pathToFileURL:G8}=Ae,K8=u8,{emitDiagnostics:q8}=h8,J8=B8(`@apm-js-collab/tracing-hooks:module-patch`),Y8=class{constructor({instrumentations:e=[]}={}){this.packages=new Set(e.map(e=>e.module.name)),this.instrumentator=H8(e),this.compile=U8.prototype._compile}patch(){let e=this;U8.prototype._compile=function(...t){let[n,r]=t,i=W8(r);if(i&&e.packages.has(i.name)){J8(`found resolved module, checking if there is a transformer %s`,r);let a=K8(i.basedir,i.name),o=e.instrumentator.getTransformer(i.name,a,i.path);if(o){J8(`transforming file %s`,r);try{t[0]=o.transform(n,`cjs`)?.code,q8({url:G8(r).href,moduleName:o.moduleName}),process.env.TRACING_DUMP&&X8(t[0],r)}catch(e){J8(`Error transforming module %s: %o`,r,e),q8({url:G8(r).href,moduleName:o.moduleName,error:e})}finally{o.free()}}}return e.compile.apply(this,t)}}unpatch(){U8.prototype._compile=this.compile}};function X8(e,t){let n=pe,r=me,i=Te,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);J8(`Dumping patched code to: %s`,l),i.mkdirSync(c,{recursive:!0}),i.writeFileSync(l,e)}var Z8=m3(Y8),Q8=V8(`@apm-js-collab/tracing-hooks:esm-hook`),$8=null,e5=null,t5=null,n5=h8.emitDiagnostics;function r5(){let{port1:e,port2:t}=new Ge;return e.on(`message`,h8.emitDiagnostics),e.unref(),t}function i5(e={}){let t=e?.instrumentations||[];t5=n8.create(t),e5=new Set(t.map(e=>e.module.name)),$8=new Map,n5=e?.diagnosticsPort?a5(e.diagnosticsPort):h8.emitDiagnostics}function a5(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){Q8(`failed to post diagnostics for %s: %o`,t.url,e)}}}function o5(e){let t=a8(e.url);if(t&&e5.has(t.name)){let n=d8(je(t.basedir)),r=t5.getTransformer(t.name,n,t.path);r&&$8.set(e.url,r)}return e}function s5(e,t,n){return o5(n(e,t))}function c5(e,t,n){let r=n(e,t);if($8.has(e)===!1)return r;if(r.format===`commonjs`){let t=new URL(r.responseURL??e);r.source??=Oe(t)}return l5(e,r)}function l5(e,t){let n=t.source;if(n){let r=$8.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,n5({url:e,moduleName:r.moduleName})}catch(t){Q8(`Error transforming module %s: %o`,e,t),n5({url:e,moduleName:r.moduleName,error:t})}finally{r.free()}}return t}h8.setDiagnosticsHook;function u5(e){if(e){let{major:t=0,minor:n=0}=In(e);return t>2||t===2&&n>=8}let{major:t=0,minor:n=0}=In(process.versions.node??`0.0.0`);return t>25||t===25&&n>=1||t===24&&n>=13}function d5(e){if(!qe&&!T||O?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=u5(t.Deno?.version?.deno),r=le;h8.setDiagnosticsHook(({moduleName:e,error:t})=>{t?A.warn(`[orchestrion] failed to inject diagnostics-channel into ${e}:`,t):(O.__SENTRY_ORCHESTRION__=O.__SENTRY_ORCHESTRION__||{},O.__SENTRY_ORCHESTRION__.runtime=O.__SENTRY_ORCHESTRION__.runtime||[],O.__SENTRY_ORCHESTRION__.runtime.push(e))});try{if(typeof r.registerHooks==`function`&&n)i5({instrumentations:f3}),r.registerHooks({resolve:s5,load:c5}),A.log(`Registered diagnostics-channel injection via Module.registerHooks()`);else if(typeof r.register==`function`&&!t.Bun&&!t.Deno){let e=r5(),t;t=import.meta.url,r.register(`@sentry/server-utils/orchestrion/hook`,{parentURL:t,data:{instrumentations:f3,diagnosticsPort:e},transferList:[e]}),new Z8({instrumentations:f3}).patch(),A.log(`Registered diagnostics-channel injection via Module.register()`)}else{A.warn(`No available Node API to register diagnostics-channel injection hooks; skipping.`);return}}catch(e){A.warn(`Failed to register diagnostics-channel injection hooks; channel-based integrations will not record spans.`,e);return}O.__SENTRY_ORCHESTRION__=O.__SENTRY_ORCHESTRION__||{},O.__SENTRY_ORCHESTRION__.runtime=O.__SENTRY_ORCHESTRION__.runtime||[]}function f5(){return g0}function p5(e){bV(()=>{let e=Object.values(g0).map(e=>e()),t=e.map(e=>e.name);return{integrations:[...e,TX({responseHook:IV}),h0({responseHook:IV})],replacedOtelIntegrationNames:t,register:()=>d5(),detect:Q1}})}export{AT as NODE_VERSION,PM as NodeClient,T4 as OpenFeatureIntegrationHook,k as SDK_VERSION,F as SEMANTIC_ATTRIBUTE_SENTRY_OP,I as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Ar as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,kr as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,rr as Scope,EA as SentryContextManager,vN as _INTERNAL_normalizeCollectionInterval,Wf as addBreadcrumb,mu as addEventProcessor,Au as addIntegration,H2 as amqplibIntegration,rN as anrIntegration,c4 as anthropicAIIntegration,c3 as applyDiagnosticsChannelInjectionIntegrations,Fo as bindScopeToEmitter,C4 as buildLaunchDarklyFlagUsedHandler,cu as captureCheckIn,Up as captureConsoleIntegration,Zl as captureEvent,H as captureException,oh as captureFeedback,Xl as captureMessage,vu as captureSession,MA as childProcessIntegration,du as close,KU as connectIntegration,cM as consoleIntegration,ph as consoleLoggingIntegration,_j as contextLinesIntegration,co as continueTrace,bh as createConsolaReporter,AM as createGetModuleFromFilename,Ny as createLangChainCallbackHandler,wN as createSentryWinstonTransport,yd as createTransport,zN as cron,X0 as dataloaderIntegration,Kp as dedupeIntegration,MM as defaultStackParser,f5 as diagnosticsChannelInjectionIntegrations,aN as disableAnrDetectionForCallback,gu as endSession,Xf as eventFiltersIntegration,p5 as experimentalUseDiagnosticsChannelInjection,KS as expressErrorHandler,CP as expressIntegration,em as extraErrorDataIntegration,KR as fastifyIntegration,Zm as featureFlagsIntegration,J4 as firebaseIntegration,uu as flush,hP as fsIntegration,qf as functionToStringIntegration,Y as generateInstrumentOnce,R0 as genericPoolIntegration,R as getActiveSpan,Y4 as getAutoPerformanceIntegrations,P as getClient,M as getCurrentScope,s3 as getDefaultIntegrations,o3 as getDefaultIntegrationsWithoutPerformance,Tr as getGlobalScope,N as getIsolationScope,na as getRootSpan,jM as getSentryRelease,ta as getSpanDescendants,Jr as getSpanStatusFromHttpCode,wf as getTraceData,kf as getTraceMetaTags,f4 as googleGenAIIntegration,Pz as graphqlIntegration,O4 as growthbookIntegration,oU as hapiIntegration,yU as honoIntegration,Lf as httpHeadersToSpanAttributes,HN as httpIntegration,QC as httpServerIntegration,rw as httpServerSpansIntegration,Zf as inboundFiltersIntegration,l3 as init,e3 as initOpenTelemetry,d3 as initWithoutDefaultIntegrations,Kv as instrumentAnthropicAiClient,ly as instrumentGoogleGenAIClient,Ry as instrumentLangChainEmbeddings,nb as instrumentLangGraph,yv as instrumentOpenAiClient,tb as instrumentStateGraph,Qy as instrumentStateGraphCompile,Am as instrumentSupabaseClient,xV as isDiagnosticsChannelInjectionEnabled,pu as isEnabled,fu as isInitialized,nB as kafkaIntegration,y0 as knexIntegration,NU as koaIntegration,_4 as langChainIntegration,x4 as langGraphIntegration,su as lastEventId,S4 as launchDarklyIntegration,Tp as linkedErrorsIntegration,Pj as localVariablesIntegration,sN as logger,sB as lruMemoizerIntegration,TM as makeNodeTransport,mh as metrics,Rj as modulesIntegration,wB as mongoIntegration,HB as mongooseIntegration,_V as mysql2Integration,eV as mysqlIntegration,UN as nativeNodeFetchIntegration,RA as nodeContextIntegration,yN as nodeRuntimeMetricsIntegration,Kj as onUncaughtExceptionIntegration,Xj as onUnhandledRejectionIntegration,i4 as openAIIntegration,w4 as openFeatureIntegration,xf as parameterize,jN as pinoIntegration,PH as postgresIntegration,HH as postgresJsIntegration,t3 as preloadOpenTelemetry,PI as prismaIntegration,rM as processSessionIntegration,ah as profiler,sH as redisIntegration,jp as requestDataIntegration,fm as rewriteFramesIntegration,iu as setAttribute,ru as setAttributes,Ql as setContext,ou as setConversationId,Zd as setCurrentClient,eu as setExtra,$l as setExtras,Yr as setHttpStatus,Wa as setMeasurement,SA as setNodeAsyncContextStrategy,nu as setTag,tu as setTags,au as setUser,JU as setupConnectErrorHandler,bP as setupExpressErrorHandler,qR as setupFastifyErrorHandler,uU as setupHapiErrorHandler,CU as setupHonoErrorHandler,PU as setupKoaErrorHandler,lb as spanStreamingIntegration,xa as spanToBaggageHeader,L as spanToJSON,Li as spanToTraceHeader,aM as spotlightIntegration,B as startInactiveSpan,fo as startNewTrace,hu as startSession,z as startSpan,ao as startSpanManual,E4 as statsigIntegration,Nm as supabaseIntegration,lo as suppressTracing,pM as systemErrorIntegration,M0 as tediousIntegration,vb as trpcMiddleware,D4 as unleashIntegration,aa as updateSpanName,VM as validateOpenTelemetrySetup,e4 as vercelAIIntegration,Nf as winterCGHeadersToDict,V as withActiveSpan,Dr as withIsolationScope,lu as withMonitor,Er as withScope,Sa as withStreamedSpan,lS as wrapMcpServerWithSentry,Vm as zodErrorsIntegration};