@aventurevc/mcp-server 0.7.302 → 0.7.328

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-UMZE8fVn.js";import*as le from"node:module";import ue from"node:module";import{EventEmitter as de,errorMonitor as fe}from"node:events";import{execFile as pe}from"node:child_process";import me,{join as he,posix as ge,sep as _e}from"node:path";import ve,{createReadStream as ye,readFile as be,readFileSync as xe,readdir as Se}from"node:fs";import*as Ce from"node:util";import we,{format as Te,promisify as Ee,types as De}from"node:util";import{inspect as Oe,promisify as ke,types as Ae}from"util";import*as je from"fs";import{readFileSync as Me}from"fs";import*as Ne from"path";import{normalize as Pe}from"path";import Fe,{fileURLToPath as Ie}from"node:url";import*as Le from"node:net";import*as Re from"node:http";import{Readable as ze}from"node:stream";import*as S from"node:diagnostics_channel";import{subscribe as Be,unsubscribe as C}from"node:diagnostics_channel";import*as Ve from"node:tls";import{createGzip as He}from"node:zlib";import{MessageChannel as Ue,Worker as w,isMainThread as We,parentPort as Ge}from"node:worker_threads";import{AsyncLocalStorage as Ke}from"node:async_hooks";import*as qe from"node:os";import T from"node:os";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.74.0`;function it(){return at(O),O}function at(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.74.0`,t[k]=t[`10.74.0`]||{}}function ot(e,t,n=O){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[k]=r[`10.74.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){return!!e.parentSpanId||!!e.dsc}function Ai(e,t){let n=Oi(e),r=ui(t);if(!n?.traceId)return{traceId:Yn(),sampleRand:rn()};let i=Ni(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 ji(e=Yn(),t=Xn(),n){let r=``;return n!==void 0&&(r=n?`-1`:`-0`),`${e}-${t}${r}`}function Mi(e=Yn(),t=Xn(),n){return`00-${e}-${t}-${n?`01`:`00`}`}function Ni(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 Pi(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 Fi=!1;function Ii(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 Li(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 Ri(e){let{traceId:t,spanId:n}=e.spanContext();return ji(t,n,Yi(e))}function zi(e){let{traceId:t,spanId:n}=e.spanContext();return Mi(t,n,Yi(e))}function Bi(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 Vi(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 Hi(e){return typeof e==`number`?Ui(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Ui(e.getTime()):Un()}function Ui(e){return e>9999999999?e/1e3:e}function L(e){if(Ji(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(qi(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:Gi(e),start_timestamp:Hi(i),timestamp:Hi(o)||void 0,status:Xi(s),op:r[F],origin:r[I],links:Bi(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Wi(e){if(Ji(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(qi(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:Gi(e),start_timestamp:Hi(i),end_timestamp:Hi(o),is_segment:e===ia(e),status:Zi(s),attributes:Qi(r,s),links:Vi(c)}}return{span_id:t,trace_id:n,start_timestamp:0,name:``,end_timestamp:0,status:`ok`,is_segment:e===ia(e)}}function Gi(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function Ki(e){return{...e,attributes:br(e.attributes),links:e.links?.map(e=>({...e,attributes:br(e.attributes)}))}}function qi(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Ji(e){return typeof e.getSpanJSON==`function`}function Yi(e){let{traceFlags:t}=e.spanContext();return t===1}function Xi(e){if(e&&e.code!==0)return e.code===1?`ok`:e.message||`internal_error`}function Zi(e){return!e||e.code===1||e.code===0||e.message===`cancelled`?`ok`:`error`}function Qi(e,t){let n=Zi(t)===`error`?t?.message:void 0;return{...n&&{"sentry.status.message":n},...e}}var $i=`_sentryChildSpans`,ea=`_sentryRootSpan`;function ta(e,t){let n=e[ea]||e;Jt(t,ea,n),Yi(e)&&(e.isRecording()||n.isRecording())&&(e[$i]?e[$i].add(t):Jt(e,$i,new Set([t])))}function na(e){let t=new Set;function n(e){if(!t.has(e)&&Yi(e)){t.add(e);let r=e[$i]?Array.from(e[$i]):[];for(let e of r)n(e)}}return n(e),Array.from(t)}var ra=ia;function ia(e){return e[ea]||e}function R(){let e=_r(it());return e.getActiveSpan?e.getActiveSpan():tr(M())}function aa(){Fi||=(ut(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}function oa(e,t){e.updateName(t),e.setAttributes({[kr]:`custom`,[Br]:t})}function sa(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||P()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function ca(e){A.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function la(e,t){if(!t?.length)return!1;for(let n of t){if(fa(n)){if(e.description&&wn(e.description,n))return D&&ca(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])=>ua(e.attributes?.[t],n));if(r&&i&&a)return D&&ca(e),!0}return!1}function ua(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 da(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 fa(e){return typeof e==`string`||e instanceof RegExp}var pa=Symbol.for(`sentry.nonRecordingSpan`),ma=class{constructor(e={}){this._traceId=e.traceId||Yn(),this._spanId=e.spanId||Xn(),this.dropReason=e.dropReason,Jt(this,pa,!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 ha(e){return!!e&&e[pa]===!0}var ga=`production`,_a=`_frozenDsc`;function va(e,t){Jt(e,_a,t)}function ya(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 ba(e,t){let n=t.getPropagationContext();return n.dsc||ya(n.traceId,e)}function xa(e){let t=P();if(!t)return{};let n=ra(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[_a];if(c)return s(c);let l=ha(n),u=l&&n.dropReason===`ignored`;if(l&&(!sa(t.getOptions())||u)){let e=ni(n).scope;if(e){let n={...ba(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=ya(e.spanContext().traceId,t),m=i[`sentry.source`]??i[`sentry.segment.name.source`],h=r.description;return m!==`url`&&h&&(p.transaction=h),sa()&&(p.sampled=String(Yi(n)),p.sample_rand=a?.get(`sentry.sample_rand`)??ni(n).scope?.getPropagationContext().sampleRand.toString()),s(p),t.emit(`createDsc`,p,n),p}function Sa(e){return di(xa(e))}function Ca(e){return Jt(e,`_streamed`,!0),e}function wa(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}function Ta(e,t=[]){return[e,t]}function Ea(e,t){let[n,r]=e;return[n,[...r,t]]}function Da(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 Oa(e,t){return Da(e,(e,n)=>t.includes(n))}function ka(e){let t=at(O);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Aa(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[ka(r),e]:r.push(typeof e==`string`?ka(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:ja(r)}function ja(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 Ma(e){return[{type:`span`},e]}function Na(e){let t=typeof e.data==`string`?ka(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var Pa={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 Fa(e){return e in Pa}function Ia(e){return Fa(e)?Pa[e]:e}function La(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Ra(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 za(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 Ba(e,t,n,r){let i=La(n);return Ta({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 Va(e,t,n,r){let i=La(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;za(e,n?.sdk);let o=Ra(e,i,r,t);return delete e.sdkProcessingMetadata,Ta(o,[[{type:a},e]])}function Ha(e,t){function n(e){return!!e.trace_id&&!!e.public_key}let r=xa(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!la({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(wa(s)?t:s(t))||(aa(),t)}:L,f=[];for(let e of l){let t=d(e);t&&f.push(Ma(t))}return Ta(o,f)}function Ua(e){if(!D)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`,parent_span_id:r}=L(e),{spanId:i}=e.spanContext(),a=Yi(e),o=ra(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 Wa(e){if(!D)return;let{description:t=`< unknown name >`,op:n=`< unknown op >`}=L(e),{spanId:r}=e.spanContext(),i=`[Tracing] Finishing "${n}" ${ra(e)===e?`root `:``}span "${t}" with ID ${r}`;A.log(i)}function Ga(e,t,n,r=R()){let i=r&&ra(r);i&&(D&&A.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Mr]:t,[jr]:n}))}function Ka(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 qa(e){at(it()).segmentSpanCaptureStrategy=e}function Ja(){return at(it()).segmentSpanCaptureStrategy}function Ya(e){return e.getOptions().traceLifecycle===`stream`}var Xa=1e3,Za=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=Hi(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=Hi(e),Wa(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:Xi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[I],profile_id:this._attributes[Vr],exclusive_time:this._attributes[Hr],measurements:Ka(this._events),is_segment:this._isStandaloneSpan&&ra(this)===this||void 0,segment_id:this._isStandaloneSpan?ra(this).spanContext().spanId:void 0,links:Bi(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===ra(this),status:Zi(this._status),attributes:Qi(this._attributes,this._status),links:Vi(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=Qa(t)?t:n||Un(),i=Qa(t)?{}:t||{},a={name:e,time:Hi(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=ra(this),n=this._isStandaloneSpan||this===t;if(this._isStandaloneSpan){this._sampled?to(Ha([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=Ja();if(e){let n=ni(this).scope||M();e.onChildSpanEnded(this,t,e=>this._convertSpanToTransaction(e),n)}return}if(e&&Ya(e)){e.emit(`afterSegmentSpanEnd`,this);return}let r=ni(this).scope||M(),i=Ja();if(i)i.onSegmentSpanEnded(e=>this._convertSpanToTransaction(e),r);else{let e=this._convertSpanToTransaction();e&&r.captureEvent(e)}}_convertSpanToTransaction(e={}){if(!$a(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 na(this)){if(t===this||eo(t)||e.isSpanAlreadyCaptured?.(t))continue;let n=L(t);$a(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:Ii(this)},spans:i.length>Xa?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,Xa):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:xa(this),hasGenAiSpans:o},request:r,...a&&{transaction_info:{source:a}}},c=Ka(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 Qa(e){return e&&typeof e==`number`||e instanceof Date||Array.isArray(e)}function $a(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function eo(e){return e instanceof Za&&e.isStandaloneSpan()}function to(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 no(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(e){throw t(e),n(),e}return ro(i,t,n,r)}function ro(e,t,n,r){return Gt(e)?cr(e,e=>{n(),r(e)},e=>{t(e),n()}):(n(),r(e),e)}function io(e,t,n){if(!sa(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 ao=`__SENTRY_SUPPRESS_TRACING__`;function oo(e,t){let n=vo();if(n.startSpan)return n.startSpan(e,t);let r=_o(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return Er(s,()=>So(a)(()=>{let n=M(),o=xo(n,a),s=P(),c=e.onlyIfParent&&!o?ho(n,s):go({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!wo(c)||!o)&&er(n,c),no(()=>t(c),()=>{let{status:e}=L(c);c.isRecording()&&(!e||e===`ok`)&&c.setStatus({code:2,message:`internal_error`})},()=>{c.end()})}))}function so(e,t){let n=vo();if(n.startSpanManual)return n.startSpanManual(e,t);let r=_o(e),{forceTransaction:i,parentSpan:a,scope:o}=e,s=o?.clone();return Er(s,()=>So(a)(()=>{let n=M(),o=xo(n,a),s=e.onlyIfParent&&!o?ho(n,P()):go({parentSpan:o,spanArguments:r,forceTransaction:i,scope:n});return(!wo(s)||!o)&&er(n,s),no(()=>t(s,()=>s.end()),()=>{let{status:e}=L(s);s.isRecording()&&(!e||e===`ok`)&&s.setStatus({code:2,message:`internal_error`})})}))}function z(e){let t=vo();return t.startInactiveSpan?t.startInactiveSpan(e):lo(e)}function co(e){return lo(e)}function lo(e){let t=_o(e),{forceTransaction:n,parentSpan:r}=e;return(e.scope?t=>Er(e.scope,t):r===void 0?e=>e():e=>B(r,e))(()=>{let i=M(),a=xo(i,r),o=P();return e.onlyIfParent&&!a?ho(i,o):go({parentSpan:a,spanArguments:t,forceTransaction:n,scope:i})})}var uo=(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&&!Pi(a,o?.org_id)?mo(t):Er(e=>{let n=Ai(r,i);return e.setPropagationContext(n),er(e,void 0),t()})};function B(e,t){let n=vo();return n.withActiveSpan?n.withActiveSpan(e,t):Er(n=>(er(n,e||void 0),t(n)))}function fo(e){let t=vo();return t.suppressTracing?t.suppressTracing(e):Er(t=>{t.setSDKProcessingMetadata({[ao]:!0});let n=e();return t.setSDKProcessingMetadata({[ao]:void 0}),n})}function po(e=M()){let t=vo();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[ao]===!0}function mo(e){let t=vo();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}`),B(null,e)))}function ho(e,t){t?.recordDroppedEvent(`no_parent_span`,`span`);let n=new ma({traceId:e.getPropagationContext().traceId});return ti(n,e,N()),n}function go({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let i=N();if(!sa()){let t=r.getPropagationContext(),a=new ma({traceId:e?e.spanContext().traceId:t.traceId});return e&&!n&&ta(e,a),ti(a,r,i),a}let a=P();if(Co(a,t)){po(r)||a?.recordDroppedEvent(`ignored`,`span`);let t=new ma({dropReason:`ignored`,traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return e&&!n&&ta(e,t),ti(t,r,i),t}let o;if(e&&!n)o=bo(e,r,t,i),ta(e,o);else if(e){let n=xa(e),{traceId:a,spanId:s}=e.spanContext(),c=Yi(e);o=yo({traceId:a,parentSpanId:s,...t},r,i,c),va(o,n)}else{let{traceId:e,dsc:n,parentSpanId:a,sampled:s}=r.getPropagationContext();o=yo({traceId:e,parentSpanId:a,...t},r,i,s),n&&va(o,n)}return Ua(o),o}function _o(e){let t={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let n={...t};return n.startTimestamp=Hi(e.startTime),delete n.startTime,n}return t}function vo(){return _r(it())}function yo(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=po(t),[f,p,m]=d?[!1]:io(a,{name:o,parentSampled:c,attributes:l,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:Ei(u.dsc?.sample_rate)},u.sampleRand),h=new Za({...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`,Ya(i)?`span`:`transaction`)),ti(h,t,n),i&&i.emit(`spanStart`,h),h}function bo(e,t,n,r){let{spanId:i,traceId:a}=e.spanContext(),o=po(t),s=!o&&Yi(e),c=s?new Za({...n,parentSpanId:i,traceId:a,sampled:s}):new ma({traceId:a});ta(e,c),ti(c,t,r);let l=P();return l?(Ya(l)&&ha(c)&&(ha(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 xo(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?ra(n):n}function So(e){return e===void 0?e=>e():t=>B(e,t)}function Co(e,t){let n=e?.getOptions().ignoreSpans;return!e||!Ya(e)||!n?.length?!1:la({description:t.name||``,op:t.attributes?.[`sentry.op`]||t.op,attributes:t.attributes},n)}function wo(e){return ha(e)&&e.dropReason===`ignored`}function To(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 Eo=new WeakSet,Do=e=>Eo.has(e),Oo=e=>{Eo.add(e)},ko=new WeakMap;function Ao(e){if(Ja()||qa(jo),ko.has(e))return;let t=new Set,n=To(()=>{let e=[...t];t.clear();for(let t of e)t()},1,{maxWait:100});e.on(`flush`,()=>{n.flush()}),ko.set(e,e=>{t.add(e),n()})}var jo={onSegmentSpanEnded(e,t){let n=t.getClient(),r=n&&ko.get(n);if(!r){let t=e();t&&n?.captureEvent(t);return}r(()=>{let t=e({isSpanAlreadyCaptured:Do,onSpanCaptured:Oo});t&&n.captureEvent(t)})},onChildSpanEnded(e,t,n,r){if(Eo.has(e)||!Eo.has(t))return;let i=r.getClient(),a=i&&ko.get(i),o=()=>{let e=n({isSpanAlreadyCaptured:Do,onSpanCaptured:Oo});e?.contexts?.trace?.data&&(e.contexts.trace.data[`sentry.parent_span_already_sent`]=!0),e&&i?.captureEvent(e)};a?a(o):o()}},Mo=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`,`addEventListener`],No=[`removeListener`,`off`,`removeEventListener`],Po=Symbol(`SentryScopeBoundListeners`),Fo;function Io(e){return Fo!==void 0&&(e===Fo||e.listener===Fo)}function Lo(e,t=M()){let n=e;if(Wo(n))return e;Uo(n);for(let e of Mo)typeof n[e]==`function`&&(n[e]=Bo(n,n[e],t));for(let e of No)typeof n[e]==`function`&&(n[e]=Vo(n,n[e]));return typeof n.removeAllListeners==`function`&&(n.removeAllListeners=Ho(n,n.removeAllListeners)),e}function Ro(e,t){return function(...n){return Er(t,()=>e.apply(this,n))}}function zo(e){return typeof e==`function`}function Bo(e,t,n){return function(...r){let i=r[0],a=r[1],o=r.slice(2);if(!zo(a)||Io(a))return t.apply(this,r);let s=Wo(e)||Uo(e),c=s.get(i);c||(c=new WeakMap,s.set(i,c));let l=c.get(a);l||(l=Ro(a,n),c.set(a,l));let u=Fo;Fo=l;try{return t.call(this,i,l,...o)}finally{Fo=u}}}function Vo(e,t){return function(...n){let r=n[0],i=n[1],a=n.slice(2),o=zo(i)?Wo(e)?.get(r)?.get(i):void 0;return o?t.call(this,r,o,...a):t.apply(this,n)}}function Ho(e,t){return function(...n){let r=Wo(e);if(r){if(n.length===0)Uo(e);else{let e=n[0];r.delete(e)}}return t.apply(this,n)}}function Uo(e){let t=new Map;return e[Po]=t,t}function Wo(e){return e[Po]}function Go(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Yo(e,t),r&&Qo(e,r),$o(e,n),Xo(e,i),Zo(e,a)}function Ko(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;qo(e,`extra`,n),qo(e,`tags`,r),qo(e,`attributes`,i),qo(e,`user`,a),qo(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 qo(e,t,n){e[t]=Jn(e[t],n,1)}function Jo(e,t){let n=Tr().getScopeData();return e&&Ko(n,e.getScopeData()),t&&Ko(n,t.getScopeData()),n}function Yo(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 Xo(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Zo(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Qo(e,t){e.contexts={trace:Li(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:xa(t),...e.sdkProcessingMetadata};let n=L(ra(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function $o(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 es(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 ts=`aws.dynamodb.attribute_definitions`,ns=`aws.dynamodb.consistent_read`,rs=`aws.dynamodb.consumed_capacity`,is=`aws.dynamodb.count`,as=`aws.dynamodb.exclusive_start_table`,os=`aws.dynamodb.global_secondary_indexes`,ss=`aws.dynamodb.global_secondary_index_updates`,cs=`aws.dynamodb.index_name`,ls=`aws.dynamodb.item_collection_metrics`,us=`aws.dynamodb.limit`,ds=`aws.dynamodb.local_secondary_indexes`,fs=`aws.dynamodb.projection`,ps=`aws.dynamodb.provisioned_read_capacity`,ms=`aws.dynamodb.provisioned_write_capacity`,hs=`aws.dynamodb.scanned_count`,gs=`aws.dynamodb.scan_forward`,_s=`aws.dynamodb.segment`,vs=`aws.dynamodb.select`,ys=`aws.dynamodb.table_count`,bs=`aws.dynamodb.table_names`,xs=`aws.dynamodb.total_segments`,Ss=`aws.kinesis.stream.name`,Cs=`aws.request.extended_id`,ws=`aws.request.id`,Ts=`aws.s3.bucket`,Es=`aws.secretsmanager.secret.arn`,Ds=`aws.sns.topic.arn`,Os=`aws.step_functions.activity.arn`,ks=`aws.step_functions.state_machine.arn`,As=`cache.key`,js=`cloud.region`,Ms=`code.function.name`,Ns=`db.collection.name`,Ps=`db.name`,Fs=`db.namespace`,Is=`db.operation`,Ls=`db.operation.batch.size`,Rs=`db.operation.name`,zs=`db.query.text`,Bs=`db.statement`,Vs=`db.system`,Hs=`db.system.name`,Us=`db.user`,Ws=`error.type`,Gs=`faas.execution`,Ks=`faas.invoked_name`,qs=`faas.invoked_provider`,Js=`faas.invoked_region`,Ys=`faas.name`,Xs=`faas.trigger`,Zs=`gen_ai.embeddings.input`,Qs=`gen_ai.function_id`,$s=`gen_ai.input.messages`,ec=`gen_ai.operation.name`,tc=`gen_ai.output.messages`,nc=`gen_ai.request.available_tools`,rc=`gen_ai.request.max_tokens`,ic=`gen_ai.request.model`,ac=`gen_ai.request.stop_sequences`,oc=`gen_ai.request.temperature`,sc=`gen_ai.request.top_p`,cc=`gen_ai.response.finish_reasons`,lc=`gen_ai.response.id`,uc=`gen_ai.response.model`,dc=`gen_ai.response.streaming`,fc=`gen_ai.system`,pc=`gen_ai.tool.input`,mc=`gen_ai.tool.name`,hc=`gen_ai.tool.output`,gc=`gen_ai.tool.type`,_c=`gen_ai.usage.input_tokens`,vc=`gen_ai.usage.output_tokens`,yc=`gen_ai.usage.total_tokens`,bc=`graphql.document`,xc=`graphql.operation.name`,Sc=`graphql.operation.type`,Cc=`http.client_ip`,wc=`http.flavor`,Tc=`http.host`,Ec=`http.method`,Dc=`http.request.method`,Oc=`http.response.status_code`,kc=`http.route`,Ac=`http.scheme`,jc=`http.status_code`,Mc=`http.target`,Nc=`http.url`,Pc=`http.user_agent`,Fc=`koa.name`,Ic=`koa.type`,Lc=`messaging.batch.message_count`,Rc=`messaging.destination`,zc=`messaging.destination.name`,Bc=`messaging.message.id`,Vc=`messaging.operation.name`,Hc=`messaging.operation.type`,Uc=`messaging.system`,Wc=`network.peer.address`,Gc=`network.peer.port`,Kc=`network.protocol.name`,qc=`network.protocol.version`,Jc=`net.host.ip`,Yc=`net.host.name`,Xc=`net.host.port`,Zc=`net.peer.ip`,Qc=`net.peer.name`,$c=`net.peer.port`,el=`net.transport`,tl=`rpc.grpc.status_code`,nl=`rpc.method`,rl=`rpc.service`,il=`rpc.system`,al=`sentry.graphql.operation`,ol=`sentry.http.prefetch`,sl=`sentry.origin`,cl=`sentry.sdk.name`,ll=`sentry.sdk.version`,ul=`sentry.segment.id`,dl=`sentry.segment.name`,fl=`sentry.trace_lifecycle`,pl=`server.address`,ml=`server.port`,hl=`service.name`,gl=`service.version`,_l=`url.full`,vl=`url.path`,yl=`url.query`,bl=`url.scheme`,xl=`user_agent.original`;function Sl(e,t){let n=Wi(e),r=ia(e),i=Wi(r),{isolationScope:a,scope:o}=ni(e),s=Jo(a,o);El(n,i,t,s);let c=e.kind;t.emit(`preprocessSpan`,n,{spanKind:c}),n.is_segment&&(Cl(n,s),Tl(n,t),t.emit(`processSegmentSpan`,n)),t.emit(`processSpan`,n);let{beforeSendSpan:l}=t.getOptions(),u=l&&wa(l)?Dl(n,l):n,d=u.attributes?.[kr];return n.is_segment&&d&&wl(u,{"sentry.segment.name.source":d}),{...Ki(u),_segmentSpan:r}}function Cl(e,t){wl(e,es(t.contexts))}function wl(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}function Tl(e,t){let n=t.getIntegrationNames();n.length&&wl(e,{[Fr]:n})}function El(e,t,n,r){let i=n.getSdkMetadata(),{release:a,environment:o}=n.getOptions();wl(e,{[fl]:`stream`,[dl]:t.name,[ul]:t.span_id,[cl]:i?.sdk?.name,[ll]: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 Dl(e,t){return t(e)||(aa(),e)}var Ol=0,kl=1,Al=2;function jl(e){return new Nl(t=>{t(e)})}function Ml(e){return new Nl((t,n)=>{n(e)})}var Nl=class e{constructor(e){this._state=Ol,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===Ol)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===kl&&e[1](this._value),this._state===Al&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===Ol){if(Gt(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(kl,e)},r=e=>{t(Al,e)};try{e(n,r)}catch(e){r(e)}}};function Pl(e,t,n,r=0){try{let i=Fl(t,n,e,r);return Gt(i)?i:jl(i)}catch(e){return Ml(e)}}function Fl(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=>Fl(e,t,n,r+1)):Fl(a,t,n,r+1)}var Il,Ll,Rl,zl;function Bl(e){let t=O._sentryDebugIds,n=O._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(zl&&r.length===Ll&&i.length===Rl)return zl;Ll=r.length,Rl=i.length,zl={},Il||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Il?.[r];if(i&&zl&&t)zl[i[0]]=t,Il&&(Il[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&&zl&&Il){zl[i]=t,Il[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),zl}function Vl(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);Hl(c,e),Gl(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&Ul(c,e.stackParser);let u=ql(r,n.captureContext);n.mechanism&&Nn(c,n.mechanism);let d=i?i.getEventProcessors():[],f=Jo(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),Go(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?jl(c):Pl(m,c,n)).then(e=>(e&&Wl(e),typeof o==`number`&&o>0?Kl(e,o,s):e))}function Hl(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 Ul(e,t){let n=Bl(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Wl(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 Gl(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Kl(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 ql(e,t){if(!t)return e;let n=e?e.clone():new rr;return n.update(t),n}function Jl(e){if(e)return Yl(e)||Zl(e)?{captureContext:e}:e}function Yl(e){return e instanceof rr||typeof e==`function`}var Xl=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function Zl(e){return Object.keys(e).some(e=>Xl.includes(e))}function V(e,t){return M().captureException(e,Jl(t))}function Ql(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 $l(e,t){return M().captureEvent(e,t)}function eu(e,t){N().setContext(e,t)}function tu(e){N().setExtras(e)}function nu(e,t){N().setExtra(e,t)}function ru(e){N().setTags(e)}function iu(e,t){N().setTag(e,t)}function au(e){N().setAttributes(e)}function ou(e,t){N().setAttribute(e,t)}function su(e){N().setUser(e)}function cu(e){N().setConversationId(e)}function lu(){return N().lastEventId()}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}=Jo(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,t,n){function r(){let r=bu({monitorSlug:e,status:`in_progress`},n),i=Un();function a(t){bu({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)}let i={...M().getPropagationContext()};return Dr(()=>{if(n?.isolateTrace)return mo(r);let e=M();return ki(e.getPropagationContext())||e.setPropagationContext(i),r()})}function bu(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 xu(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}function H(e,t=1){if(_r(it()).getTracingChannelBinding?.()){e();return}t&&xu(setTimeout(()=>{H(e,t-1)},1))}function Su(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function Cu(e){return`${Su(e)}${e.projectId}/envelope/`}function wu(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 Tu(e,t,n){return t||`${Cu(e)}?${wu(e,n)}`}var Eu=[];function Du(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 Ou(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 Du(r)}function ku(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&ju(e,t,n)}),n}function Au(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function ju(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,!Eu.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),Eu.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 Mu(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 U(e){return e}function Nu(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 Pu=`sentry.timestamp.sequence`,Fu=0,Iu;function Lu(e){let t=Math.floor(e*1e3);Iu!==void 0&&t!==Iu&&(Fu=0);let n=Fu;return Fu++,Iu=t,{key:Pu,value:{value:n,type:`integer`}}}function Ru(e,t){return t?Er(t,()=>{let n=R(),r=n?Li(n):Or(t);return[n?xa(n):ba(e,t),r]}):[void 0,void 0]}var zu={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function Bu(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function Vu(){return!Bu()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function Hu(){return typeof window<`u`&&(!Vu()||Uu())}function Uu(){return O.process?.type===`renderer`}function Wu(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...Hu()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Gu(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)),Ta(a,[Wu(e,i)])}var Ku=100;function qu(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function Ju(e,t){let n=Qu(),r=Zu(e);r===void 0?n.set(e,[t]):r.length>=Ku?(Xu(e,r),n.set(e,[t])):n.set(e,[...r,t])}function Yu(e,t=M(),n=Ju){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]=Ru(r,t),l={...e.attributes},{user:{id:u,email:d,username:f},attributes:p={}}=Jo(N(),t);qu(l,`user.id`,u,!1),qu(l,`user.email`,d,!1),qu(l,`user.name`,f,!1),qu(l,`sentry.release`,i),qu(l,`sentry.environment`,a);let{name:m,version:h}=r.getSdkMetadata()?.sdk??{};qu(l,`sentry.sdk.name`,m),qu(l,`sentry.sdk.version`,h);let g=r.getIntegrationByName(`Replay`),_=g?.getReplayId(!0);qu(l,`sentry.replay_id`,_),_&&g?.getRecordingMode()===`buffer`&&qu(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})}qu(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=Lu(re);n(r,{timestamp:re,level:b,body:ed(String(te)),trace_id:c?.trace_id,severity_number:ne??zu[b],attributes:$u({...br(p),...br(x,!0),[ie.key]:ie.value})}),r.emit(`afterCaptureLog`,ee)}function Xu(e,t){let n=t??Zu(e)??[];if(n.length===0)return;let r=e.getOptions(),i=Gu(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Qu().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function Zu(e){return Qu().get(e)}function Qu(){return ot(`clientToLogBufferMap`,()=>new WeakMap)}function $u(e){let t={};for(let[n,r]of Object.entries(e)){let e=ed(n);t[e]=r.type===`string`?{...r,value:ed(r.value)}:r}return t}function ed(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 td(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,...Hu()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function nd(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)),Ta(a,[td(e,i)])}var rd=1e3;function id(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function ad(e,t){let n=dd(),r=ud(e);r===void 0?n.set(e,[t]):r.length>=rd?(ld(e,r),n.set(e,[t])):n.set(e,[...r,t])}function od(e,t,n){let{release:r,environment:i}=t.getOptions(),a={...e.attributes};id(a,`user.id`,n.id,!1),id(a,`user.email`,n.email,!1),id(a,`user.name`,n.username,!1),id(a,`sentry.release`,r),id(a,`sentry.environment`,i);let{name:o,version:s}=t.getSdkMetadata()?.sdk??{};id(a,`sentry.sdk.name`,o),id(a,`sentry.sdk.version`,s);let c=t.getIntegrationByName(`Replay`),l=c?.getReplayId(!0);return id(a,`sentry.replay_id`,l),l&&c?.getRecordingMode()===`buffer`&&id(a,`sentry._internal.replay_is_buffering`,!0),{...e,attributes:a}}function sd(e,t,n,r){let[,i]=Ru(t,n),a=tr(n),o=a?a.spanContext().traceId:i?.trace_id,s=a?a.spanContext().spanId:void 0,c=Un(),l=Lu(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 cd(e,t){let n=t?.scope??M(),r=t?.captureSerializedMetric??ad,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}=Jo(N(),n),u=od(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=sd(f,i,n,l);D&&A.log(`[Metric]`,p),r(i,p),i.emit(`afterCaptureMetric`,f)}function ld(e,t){let n=t??ud(e)??[];if(n.length===0)return;let r=e.getOptions(),i=nd(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);dd().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function ud(e){return dd().get(e)}function dd(){return ot(`clientToMetricBufferMap`,()=>new WeakMap)}function fd(e){return Ki({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 pd(e,t){if(e.type!==`transaction`||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||Ya(t))return;let n=[],r=[];for(let t of e.spans)t.op?.startsWith(`gen_ai.`)?n.push(fd(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,...Hu()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var md=Symbol.for(`SentryBufferFullError`);function hd(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Ml(md);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return jl(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>xu(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var gd=6e4;function _d(e,t=an()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?gd:r-t}function vd(e,t){return e[t]||e.all||0}function yd(e,t,n=an()){return vd(e,t)>n}function bd(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+_d(o,r):t===429&&(i.all=r+6e4);return i}function xd(e,t,n=hd(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Da(i,(t,n)=>{let i=Ia(n);yd(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Ta(i[0],a),s=t=>{if(Oa(o,[`client_report`])){D&&A.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}Da(o,(n,r)=>{e.recordDroppedEvent(t,Ia(r))})};return n.add(()=>t({body:Aa(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=bd(r,e),e),e=>{throw s(`network_error`),D&&A.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===md)return D&&A.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Sd(e,t,n){let r=[{type:`client_report`},{timestamp:n||Bn(),discarded_events:e}];return Ta(t?{dsn:t}:{},[r])}function Cd(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 wd(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 Td(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 Ed=`[Filtered]`,Dd=[`forwarded`,`-ip`,`remote-`,`via`,`-user`],Od=[`auth`,`token`,`secret`,`session`,`password`,`passwd`,`pwd`,`key`,`jwt`,`bearer`,`sso`,`saml`,`csrf`,`xsrf`,`credentials`,`sid`,`identity`,`set-cookie`,`cookie`],kd=[`.sid`,`sessid`,`remember`,`oidc`,`pkce`,`nonce`,`__secure-`,`__host-`,`awsalb`,`awselb`,`akamai`,`__stripe`,`cognito`,`firebase`,`supabase`,`sb-`,`mfa`,`2fa`];function Ad(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:Dd},httpHeaders:{request:{deny:Dd},response:{deny:Dd}},httpBodies:[],urlQueryParams:{deny:Dd},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var jd={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 Md(e){let t=e.dataCollection==null?Ad(e.sendDefaultPii):jd,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 Nd=`Not capturing exception because it's already been captured.`,Pd=`Discarded session because of missing or non-string release`,Fd=Symbol.for(`SentryInternalError`),Id=Symbol.for(`SentryDoNotSendEventError`),Ld=5e3;function Rd(e){return{message:e,[Fd]:!0}}function zd(e){return{message:e,[Id]:!0}}function Bd(e){return j(e)&&Fd in e}function Vd(e){return j(e)&&Id in e}function Hd(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??Ld;t>0&&(s=!0,o=xu(setTimeout(()=>{i(e)},t)))}}),e.on(`flush`,()=>{i(e)})}var Ud=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=hd(e.transportOptions?.bufferSize??64),this._dataCollection=Md(e),e.dsn?this._dsn=Ti(e.dsn):D&&A.warn(`No DSN provided, client will not send events.`),this._dsn){let t=Tu(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&&Hd(this,`afterCaptureLog`,`flushLogs`,Xd,Xu),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Hd(this,`afterCaptureMetric`,`flushMetrics`,Yd,ld)}captureException(e,t,n){let r=kn();if(Ln(e))return D&&A.log(Nd),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(Nd),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=Wd(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),ju(this,e,this._integrations),t||Au(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=pd(e,this),r=Va(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])r=Ea(r,Na(e));n&&(r=Ea(r,n)),this.sendEnvelope(r).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=ga}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){D&&A.warn(Pd);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){D&&A.warn(Pd);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=Ba(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=ku(this,e),Au(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),Vl(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:ba(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=M(),r=N()){return D&&qd(e)&&A.log(`Captured error event \`${Cd(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{D&&(Vd(e)?A.log(e.message):Bd(e)?A.warn(e.message):A.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=Jd(e),s=qd(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:Ei(a),u=Wd(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),zd("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:Gd(Kd(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 zd(`${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`),zd(`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 Vd(e)||Bd(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Rd(`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===md&&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=Sd(e,this._options.tunnel&&yi(this._dsn));this.sendEnvelope(t)}};function Wd(e){return e===`replay_event`?`replay`:e||`error`}function Gd(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 Rd(n);return e},e=>{throw Rd(`${t} rejected with ${e}`)});if(!Ht(e)&&e!==null)throw Rd(n);return e}function Kd(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!wa(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(qd(c)&&i)return i(c,r);if(Jd(c)){if(s||o){let t=wd(c);if(o?.length&&la({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){let e=s(t);e?c=Jn(n,Td(e)):aa()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&la({description:e.description,op:e.op,attributes:e.data},o)){da(n,e);continue}if(s){let n=s(e);n?t.push(n):(aa(),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 qd(e){return e.type===void 0}function Jd(e){return e.type===`transaction`}function Yd(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Zd(e.attributes)}function Xd(e){let t=0;return e.message&&(t+=e.message.length*2),t+Zd(e.attributes)}function Zd(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Qd(e[0]):Vt(e)?t+=Qd(e):t+=100}),t}function Qd(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function $d(e){M().setClient(e)}var ef=new Set;function tf(e){e.forEach(e=>{ef.add(e),D&&A.log(`AI provider "${e}" wrapping will be skipped`)})}function nf(e){return ef.has(e)}function rf(){ef.clear(),D&&A.log(`Cleared AI provider skip registrations`)}function af(e,t){return t.some(t=>e.includes(t))}function of(e,t,n){if(t===!1)return{};let r=n==null?Od:[...Od,...n],i={};if(t===!0){for(let t of Object.keys(e))i[t]=af(t.toLowerCase(),r)?Ed: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]=af(a,r)||n.some(e=>a.includes(e))?Ed: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]=af(n,r)?Ed:a.some(e=>n.includes(e))?e[t]:Ed}return i}function sf(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 cf=new Set([`false`,`f`,`n`,`no`,`off`,`0`]),lf=new Set([`true`,`t`,`y`,`yes`,`on`,`1`]);function uf(e,t){let n=String(e).toLowerCase();return cf.has(n)?!1:lf.has(n)?!0:t?.strict?null:!!e}function df(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),Ta(a,[ff(e)])}function ff(e){return[{type:`check_in`},e]}var pf=`thismessage:/`;function mf(e){return`isRelative`in e}function hf(e,t){let n=e.indexOf(`://`)<=0&&e.indexOf(`//`)!==0,r=t??(n?pf: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 gf(e){if(mf(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 _f(e,t,n,r){return`${n?.method?.toUpperCase()??`GET`} ${r||(e?t===`client`?gf(e):e.pathname:`/`)}`}function vf(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`)),mf(e)||(a[_l]=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))),[_f(e,t,r,i),a]}function yf(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 bf(e){return e.split(/[?#]/,1)[0]}function xf(e){let{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,`[filtered]:[filtered]@`).replace(/(:80)$/,``).replace(/(:443)$/,``)||``;return`${t?`${t}://`:``}${i}${r}`}function Sf(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 Cf(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 wf=Cf;function Tf(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 Ef(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=ha(i)&&!sa(t.getOptions());if(!i&&wr())return{};let o=i&&!a?Ri(i):Df(r),s=di(i?xa(i):ba(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?zi(i):Of(r)),c}function Df(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return ji(t,r,n)}function Of(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Mi(t,r,n)}var kf=`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`;function Af(e,t,n){if(typeof e!=`string`||!t)return!0;let r=n?.get(e);if(r!==void 0)return D&&!r&&A.log(kf,e),r;let i=Tn(e,t);return n?.set(e,i),D&&!i&&A.log(kf,e),i}function jf(e){return Object.entries(e||Ef()).map(([e,t])=>`<meta name="${e}" content="${t}"/>`).join(``)}function Mf(e){return Array.from(new Set(e))}var Nf=1048576;function Pf(e){return e===`small`?1e3:e===`medium`?1e4:Nf}function Ff(e){let t={};try{e.forEach((e,n)=>{typeof e==`string`&&(t[n]=e)})}catch{}return t}function If(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 Lf(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=Rf({url:i,host:n,protocol:r}),o=e.body||void 0,s=e.cookies;return{url:a,method:e.method,query_string:Hf(i),headers:If(t),cookies:s,data:o}}function Rf({url:e,protocol:t,host:n}){if(e?.startsWith(`http`))return e;if(e&&n)return`${t}://${n}${e}`}function zf(e,t=!1,n=`request`){let r=typeof t==`boolean`?Ad(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=of(Vf(r,e===`set-cookie`),a,kd);for(let[n,r]of Object.entries(t))s[`${o}${Bf(e)}.${Bf(n)}`]=r}else s[`${o}${Bf(e)}`]=Ed}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=of(t,i);for(let[t,n]of Object.entries(e))s[`${o}${Bf(t)}`]=n}}catch{}return s}function Bf(e){return e.replace(/-/g,`_`)}function Vf(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 Hf(e){if(e)try{let t=new URL(e,`http://s.io`).search.slice(1);return t.length?t:void 0}catch{return}}var W={INTERNAL:0,SERVER:1,CLIENT:2,PRODUCER:3,CONSUMER:4},Uf={[W.INTERNAL]:`INTERNAL`,[W.SERVER]:`SERVER`,[W.CLIENT]:`CLIENT`,[W.PRODUCER]:`PRODUCER`,[W.CONSUMER]:`CONSUMER`};function Wf(e){return Uf[e]}var Gf=100;function Kf(e,t){let n=P(),r=N();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=Gf}=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 qf=`FunctionToString`,Jf=new WeakMap,Yf=U((()=>({name:qf,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=function(...t){let n=Zt(this),r;try{Jf.has(P())&&n!==void 0&&(r=n)}catch{}return e.apply(r??this,t)}}catch{}},setup(e){Jf.set(e,!0)}}))),Xf=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/Java exception was raised during method invocation$/,/Java object is gone$/],Zf=`EventFilters`,Qf=U((e={})=>{let t;return{name:Zf,setup(n){t=ep(e,n.getOptions())},processEvent(n,r,i){return t||=ep(e,i.getOptions()),tp(n,t)?null:n}}}),$f=U(((e={})=>({...Qf(e),name:`InboundFilters`})));function ep(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Xf],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function tp(e,t){if(!e.type){if(np(e,t.ignoreErrors))return D&&A.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
11
+ Event: ${jn(e)}`),!0;if(cp(e))return D&&A.warn(`Event dropped due to not having an error message, error type or stacktrace.
12
+ Event: ${jn(e)}`),!0;if(ip(e,t.denyUrls))return D&&A.warn(`Event dropped due to being matched by \`denyUrls\` option.
13
+ Event: ${jn(e)}.
14
+ Url: ${sp(e)}`),!0;if(!ap(e,t.allowUrls))return D&&A.warn(`Event dropped due to not being matched by \`allowUrls\` option.
15
+ Event: ${jn(e)}.
16
+ Url: ${sp(e)}`),!0}else if(e.type===`transaction`&&rp(e,t.ignoreTransactions))return D&&A.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
17
+ Event: ${jn(e)}`),!0;return!1}function np(e,t){return t?.length?Cd(e).some(e=>Tn(e,t)):!1}function rp(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Tn(n,t):!1}function ip(e,t){if(!t?.length)return!1;let n=sp(e);return n?Tn(n,t):!1}function ap(e,t){if(!t?.length)return!0;let n=sp(e);return!n||Tn(n,t)}function op(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 sp(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?op(t):null}catch{return D&&A.error(`Cannot extract url for event ${jn(e)}`),null}}function cp(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function lp(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=up(e,t,r,a.originalException,n,i.exception.values,o,0))}function up(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(It(r[i])){fp(o,s,r);let a=e(t,r[i]),l=c.length;pp(a,i,l,s),c=up(e,t,n,r[i],i,[a,...c],a,l)}return dp(r)&&r.errors.forEach((a,l)=>{if(It(a)){fp(o,s,r);let u=e(t,a),d=c.length;pp(u,`errors[${l}]`,d,s),c=up(e,t,n,a,i,[u,...c],u,d)}}),c}function dp(e){return Array.isArray(e.errors)}function fp(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...dp(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function pp(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}function mp(e,t){return e(t.stack||``,1)}function hp(e){return It(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function gp(e){return hp(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function _p(e,t){let n={type:t.name||t.constructor.name,value:gp(t)},r=mp(e,t);return r.length&&(n.stacktrace={frames:r}),n}function vp(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(It(n))return n}}function yp(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=bp(e);return`${n&&n!==`Object`?`'${n}'`:`Object`} captured as exception with keys: ${t}`}function bp(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function xp(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=vp(n);if(a)return[a,i];let o=yp(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 Sp(e,t,n,r){let i=r?.data&&r.data.mechanism||{handled:!0,type:`generic`},[a,o]=xp(e,i,n,r),s={exception:{values:[_p(t,a)]}};return o&&(s.extra=o),Mn(s,void 0,void 0),Nn(s,i),{...s,event_id:r?.event_id}}function Cp(e,t,n=`info`,r,i){let a={event_id:r?.event_id,level:n};if(i&&r?.syntheticException){let n=mp(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 wp=`cause`,Tp=5,Ep=`LinkedErrors`,Dp=U(((e={})=>{let t=e.limit||Tp,n=e.key||wp;return{name:Ep,preprocessEvent(e,r,i){lp(_p,i.getOptions().stackParser,n,t,e,r)}}})),Op=[`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 kp(e){let t={};for(let n of Object.keys(e))t[n.toLowerCase()]=e[n];return Op.map(e=>{let n=t[e.toLowerCase()],r=Array.isArray(n)?n.join(`;`):n;return e===`Forwarded`?Ap(r):r?.split(`,`).map(e=>e.trim())}).reduce((e,t)=>t?e.concat(t):e,[]).find(e=>e!==null&&jp(e))||null}function Ap(e){if(!e)return null;for(let t of e.split(`;`))if(t.startsWith(`for=`))return t.slice(4);return null}function jp(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}var Mp=`RequestData`,Np=U(((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:Mp,processEvent(e,n,r){let{sdkProcessingMetadata:i={}}=e,{normalizedRequest:a,ipAddress:o}=i,{include:s}=t(r);return a&&Pp(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);Fp(e,i,a,o,s)}}}));function Pp(e,t,n,r){if(e.request={...e.request,...Ip(t,r)},r.ip){let r=t.headers&&kp(t.headers)||n.ipAddress;r&&(e.user={...e.user,ip_address:r})}}function Fp(e,t,n,r,i){let a=Ip(t,r),o={};if(a.url&&(o[_l]=a.url),a.method&&(o[`http.request.method`]=a.method),a.query_string&&(o[yl]=Lp(a.query_string)),wl(e,o),a.cookies&&Object.keys(a.cookies).length>0&&wl(e,zf({cookie:Object.entries(a.cookies).map(([e,t])=>`${e}=${t}`).join(`; `)},i,`request`)),a.headers&&wl(e,zf(a.headers,i,`request`)),a.data!=null){let t=typeof a.data==`string`?a.data:JSON.stringify(a.data);t&&wl(e,{"http.request.body.data":t})}if(r.ip){let r=t.headers&&kp(t.headers)||n||void 0;r&&wl(e,{[Rr]:r})}}function Ip(e,t){let n={},r={...e.headers};if(t.headers&&(n.headers=r,t.cookies||delete r.cookie,!t.ip)){let e=new Set(Op.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?sf(r.cookie):void 0)||{}),t.query_string&&(n.query_string=e.query_string),t.data&&(n.data=e.data),n}function Lp(e){return typeof e==`string`?e||void 0:(Array.isArray(e)?e:Object.entries(e)).map(([e,t])=>`${e}=${t}`).join(`&`)||void 0}var Rp=new Set([]);function zp(e){let t=`console`,n=Mt(t,e);return Nt(t,Hp),n}function Bp(e){for(let t of e)Rp.add(t);return()=>{for(let t of e)Rp.delete(t)}}var Vp=new Set;function Hp(){`console`in O&&st.forEach(function(e){!Vp.has(e)&&e in O.console&&(Vp.add(e),qt(O.console,e,function(t){return lt[e]=t,function(...t){let n=t[0],r=lt[e],i=Rp.size&&typeof n==`string`&&Tn(n,Rp);i||Pt(`console`,{args:t,level:e}),(!i||D&&A.isEnabled())&&r?.apply(O.console,t)}}))})}function Up(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var Wp=`CaptureConsole`,Gp=U(((e={})=>{let t=e.levels||st,n=e.handled??!0;return{name:Wp,setup(e){`console`in O&&zp(({args:r,level:i})=>{P()===e&&t.includes(i)&&Kp(r,i,n)})}}}));function Kp(e,t,n){let r=Up(t),i=Error(),a={level:Up(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){V(s,a);return}let c=Cn(e,` `);o.captureMessage(c,r,{captureContext:a,syntheticException:i})})}var qp=`Dedupe`,Jp=U((()=>{let e;return{name:qp,processEvent(t){if(t.type)return t;try{if(Yp(t,e))return D&&A.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function Yp(e,t){return t?!!(Xp(e,t)||Zp(e,t)):!1}function Xp(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!$p(e,t)||!Qp(e,t))}function Zp(e,t){let n=em(t),r=em(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!$p(e,t)||!Qp(e,t))}function Qp(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 $p(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 em(e){return e.exception?.values?.[0]}var tm=`ExtraErrorData`,nm=U(((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:tm,processEvent(e,r,i){let{maxValueLength:a}=i.getOptions();return rm(e,r,t,n,a)}}}));function rm(e,t={},n,r,i){if(!t.originalException||!It(t.originalException))return e;let a=t.originalException.name||t.originalException.constructor.name,o=im(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 im(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]:im(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 am(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 om=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function sm(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=om.exec(t);return n?n.slice(1):[]}function cm(...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=am(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`}function lm(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 um(e,t){e=cm(e).slice(1),t=cm(t).slice(1);let n=lm(e.split(`/`)),r=lm(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 dm(e){let t=sm(e),n=t[0]||``,r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,r.length-1),n+r)}function fm(e,t){let n=sm(e)[2]||``;return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var pm=`RewriteFrames`,mm=U((e={})=>{let t=e.root,n=e.prefix||`app:///`,r=`window`in O&&!!O.window,i=e.iteratee||hm({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:pm,processEvent(e){let t=e;return e.exception&&Array.isArray(e.exception.values)&&(t=a(t)),t}}});function hm({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?um(t,e):fm(e)}`}return r}}var gm=[`reauthenticate`,`signInAnonymously`,`signInWithOAuth`,`signInWithIdToken`,`signInWithOtp`,`signInWithPassword`,`signInWithSSO`,`signOut`,`signUp`,`verifyOtp`],_m=[`createUser`,`deleteUser`,`listUsers`,`getUserById`,`updateUserById`,`inviteUserByEmail`],vm={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`},ym=[`select`,`insert`,`upsert`,`update`,`delete`];function bm(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function xm(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function Sm(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function Cm(e,t){return Sm(e,t)!==void 0}function wm(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 Tm(e,t={}){switch(e){case`GET`:return`select`;case`POST`:return wm(t,`Prefer`)?.includes(`resolution=`)?`upsert`:`insert`;case`PATCH`:return`update`;case`DELETE`:return`delete`;default:return`<unknown-op>`}}function Em(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&&vm[n]||`filter`,`${i}(${e}, ${r.join(`.`)})`}function Dm(e,t=!1){return new Proxy(e,{apply(n,r,i){return oo({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}),V(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(),V(t,{mechanism:{handled:!1,type:`auto.db.supabase.auth`}}),t}).then(...i))}})}function Om(e){let t=e.auth;if(t&&!xm(e.auth)){for(let n of gm){let r=t[n];r&&typeof e.auth[n]==`function`&&(e.auth[n]=Dm(r))}for(let n of _m){let r=t.admin[n];r&&typeof e.auth.admin[n]==`function`&&(e.auth.admin[n]=Dm(r,!0))}bm(e.auth)}}function km(e,t){xm(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 jm(a,t),i}}),bm(e.prototype.from))}function Am(e,t){xm(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(e,n,r){let i=ym,a=n,o=Tm(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(Em(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=Sm(a.body,u),m=o===`select`?``:`${o}${Cm(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":wm(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),oo({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),V(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),Kf(n),e},e=>{throw t&&(Yr(t,500),t.end()),e}).then(...r))}}),bm(e.prototype.then))}function jm(e,t){for(let n of ym)xm(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`),Am(o,t),a}}),bm(e.prototype[n]))}var Mm=(e,t={})=>{if(!e){D&&A.warn(`Supabase integration was not installed because no Supabase client was provided.`);return}km(e.constructor===Function?e:e.constructor,t),Om(e)},Nm=`Supabase`,Pm=((e,t)=>({setupOnce(){Mm(e,t)},name:Nm})),Fm=U(e=>Pm(e.supabaseClient,{sendOperationData:e.sendOperationData})),Im=10,Lm=`ZodErrors`;function Rm(e){return It(e)&&e.name===`ZodError`&&Array.isArray(e.issues)}function zm(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 Bm(e){return e.map(e=>typeof e==`number`?`<array>`:e).join(`.`)}function Vm(e){let t=new Set;for(let n of e.issues){let e=Bm(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 Hm(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!Rm(r.originalException)||r.originalException.issues.length===0)return n;try{let i=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(zm);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:Vm(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 Um=U(((e={})=>{let t=e.limit??Im;return{name:Lm,processEvent(n,r){return Hm(t,e.saveZodIssuesAsAttachment,n,r)}}})),Wm=`Console`,Gm=U((e={})=>{let t=new Set(e.levels||st);return{name:Wm,setup(n){let r=zp(({args:e,level:r})=>{P()===n&&t.has(r)&&Km(r,e)});if(n.registerCleanup(r),e.filter){let t=Bp(e.filter);n.registerCleanup(t)}}}});function Km(e,t){let n={category:`console`,data:{arguments:t,logger:`console`},level:Up(e),message:qm(t)};if(e===`assert`){if(t[0]===!1){let e=t.slice(1);n.message=e.length>0?`Assertion failed: ${qm(e)}`:`Assertion failed`,n.data.arguments=e}else return}Kf(n,{input:t,level:e})}function qm(e){return`util`in O&&typeof O.util.format==`function`?O.util.format(...e):Cn(e,` `)}var Jm=`flag.evaluation.`;function Ym(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 Xm(e,t,n=100){let r=M().getScopeData().contexts;r.flags||={values:[]};let i=r.flags.values;Zm(i,e,t,n)}function Zm(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 Qm(e,t,n=10){if(typeof t!=`boolean`)return;let r=R();if(!r)return;let i=L(r).data;if(`${Jm}${e}`in i){r.setAttribute(`${Jm}${e}`,t);return}Object.keys(i).filter(e=>e.startsWith(Jm)).length<n&&r.setAttribute(`${Jm}${e}`,t)}var $m=U(()=>({name:`FeatureFlags`,processEvent(e,t,n){return Ym(e)},addFeatureFlag(e,t){Xm(e,t),Qm(e,t)}})),eh=U(({growthbookClass:e})=>({name:`GrowthBook`,setupOnce(){let t=e.prototype;typeof t.isOn==`function`&&qt(t,`isOn`,th),typeof t.getFeatureValue==`function`&&qt(t,`getFeatureValue`,th)},processEvent(e,t,n){return Ym(e)}}));function th(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n==`string`&&typeof r==`boolean`&&(Xm(n,r),Qm(n,r)),r}}var nh=`ConversationId`,rh=U((()=>({name:nh,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 ih(e){return!!e&&e._profiler!==void 0&&typeof e._profiler.start==`function`&&typeof e._profiler.stop==`function`}function ah(){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(!ih(t)){D&&A.warn(`Profiler is not available on profiling integration.`);return}t._profiler.start()}function oh(){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(!ih(t)){D&&A.warn(`Profiler is not available on profiling integration.`);return}t._profiler.stop()}var sh={startProfiler:ah,stopProfiler:oh};function ch(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 lh(e,t,n){return`util`in O&&typeof O.util.format==`function`?O.util.format(...e):uh(e,t,n)}function uh(e,t,n){return e.map(e=>Vt(e)?String(e):JSON.stringify(fn(e,t,n))).join(` `)}function dh(e){return/%[sdifocO]/.test(e)}function fh(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 ph=`ConsoleLogs`,mh={[I]:`auto.log.console`},hh=U(((e={})=>{let t=e.levels||st;return{name:ph,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=zp(({args:n,level:a})=>{if(P()!==e||!t.includes(a))return;let o=n[0],s=n.slice(1);if(a===`assert`){o||Yu({level:`error`,message:s.length>0?`Assertion failed: ${lh(s,r,i)}`:`Assertion failed`,attributes:mh});return}let c=a===`log`,l={...mh};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`&&!dh(o)){let e=fh(o,s);for(let[t,n]of Object.entries(e))l[t]=t.startsWith(`sentry.message.parameter.`)?fn(n,r,i):n}Yu({level:c?`info`:a,message:lh(n,r,i),severityNumber:c?10:void 0,attributes:l})});e.registerCleanup(a)}}})),gh=f({count:()=>vh,distribution:()=>bh,gauge:()=>yh});function _h(e,t,n,r){cd({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function vh(e,t=1,n){_h(`counter`,e,t,n)}function yh(e,t,n){_h(`gauge`,e,t,n)}function bh(e,t,n){_h(`distribution`,e,t,n)}var xh=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function Sh(e={}){let t=new Set(e.levels??xh),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=Th(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=Dh(Eh(o,f,p),f,p);h?.attributes&&Object.assign(m,h.attributes),Yu({level:d,message:h?.message||a||o&&lh(o,f,p)||``,attributes:m})}}}var Ch={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`},wh={0:`fatal`,1:`warn`,2:`info`,3:`info`,4:`debug`,5:`trace`};function Th(e,t){if(e===`verbose`)return`debug`;if(e===`silent`)return`trace`;if(e){let t=Ch[e];if(t)return t}if(typeof t==`number`){let e=wh[t];if(e)return e}return`info`}function Eh(e,t,n){if(!e?.length)return{message:``};let r=lh(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`&&!dh(i);return{message:r,messageTemplate:n?i:void 0,messageParameters:n?t:void 0}}}function Dh(e,t,n){let{message:r,attributes:i,messageTemplate:a,messageParameters:o}=e,s={};if(a&&o){let e=fh(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 Oh=`gen_ai.prompt`,kh=`gen_ai.system`,Ah=`gen_ai.request.model`,jh=`gen_ai.request.stream`,Mh=`gen_ai.request.temperature`,Nh=`gen_ai.request.max_tokens`,Ph=`gen_ai.request.frequency_penalty`,Fh=`gen_ai.request.presence_penalty`,Ih=`gen_ai.request.top_p`,Lh=`gen_ai.request.top_k`,Rh=`gen_ai.request.encoding_format`,zh=`gen_ai.request.dimensions`,Bh=`gen_ai.response.finish_reasons`,Vh=`gen_ai.response.model`,Hh=`gen_ai.response.id`,Uh=`gen_ai.response.stop_reason`,Wh=`gen_ai.usage.input_tokens`,Gh=`gen_ai.usage.output_tokens`,Kh=`gen_ai.usage.total_tokens`,qh=`gen_ai.operation.name`,Jh=`sentry.sdk_meta.gen_ai.input.messages.original_length`,Yh=`gen_ai.input.messages`,Xh=`gen_ai.output.messages`,Zh=`gen_ai.system_instructions`,Qh=`gen_ai.response.text`,$h=`gen_ai.request.available_tools`,eg=`gen_ai.response.streaming`,tg=`gen_ai.response.tool_calls`,ng=`gen_ai.agent.name`,rg=`gen_ai.pipeline.name`,ig=`gen_ai.conversation.id`,ag=`gen_ai.usage.cache_creation_input_tokens`,og=`gen_ai.usage.cache_read_input_tokens`,sg=`gen_ai.usage.input_tokens.cache_write`,cg=`gen_ai.usage.input_tokens.cached`,lg=`gen_ai.invoke_agent`,ug=`gen_ai.embeddings.input`,dg=`gen_ai.embeddings`,fg=`gen_ai.execute_tool`,pg=`gen_ai.tool.name`,mg=`gen_ai.tool.call.id`,hg=`gen_ai.tool.type`,gg=`gen_ai.tool.input`,_g=`gen_ai.tool.output`,vg=`gen_ai.tool.description`;function yg(e){return!e||typeof e!=`object`?!1:Sg(e)||Cg(e)||bg(e)||wg(e)||Tg(e)||Eg(e)||Dg(e)||Og(e)||kg(e)||Ag(e)||jg(e)||Mg(e)}function bg(e){return`image_url`in e?typeof e.image_url==`string`?e.image_url.startsWith(`data:`):xg(e):!1}function xg(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 Sg(e){return`type`in e&&typeof e.type==`string`&&`source`in e&&yg(e.source)}function Cg(e){return`inlineData`in e&&!!e.inlineData&&typeof e.inlineData==`object`&&`data`in e.inlineData&&typeof e.inlineData.data==`string`}function wg(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 Tg(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 Eg(e){return`media_type`in e&&typeof e.media_type==`string`&&`data`in e}function Dg(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 Og(e){return`type`in e&&e.type===`image`&&`image`in e&&typeof e.image==`string`&&!e.image.startsWith(`http://`)&&!e.image.startsWith(`https://`)}function kg(e){return`type`in e&&(e.type===`blob`||e.type===`base64`)}function Ag(e){return`b64_json`in e}function jg(e){return`type`in e&&`result`in e&&e.type===`image_generation`}function Mg(e){return`uri`in e&&typeof e.uri==`string`&&e.uri.startsWith(`data:`)}var Ng=`[Blob substitute]`,Pg=[`image_url`,`data`,`content`,`b64_json`,`result`,`uri`,`image`];function Fg(e){let t={...e};yg(t.source)&&(t.source=Fg(t.source)),Cg(e)&&(t.inlineData={...e.inlineData,data:Ng}),xg(e)&&(t.image_url={...e.image_url,url:Ng}),wg(e)&&(t.input_audio={...e.input_audio,data:Ng}),Tg(e)&&(t.file={...e.file,file_data:Ng});for(let e of Pg)typeof t[e]==`string`&&(t[e]=Ng);return t}var Ig=2e4,Lg=e=>new TextEncoder().encode(e).length,Rg=e=>Lg(JSON.stringify(e));function zg(e,t){if(Lg(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);Lg(o)<=t?(i=o,n=a+1):r=a-1}return i}function Bg(e){return typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``}function Vg(e,t){return typeof e==`string`?t:{...e,text:t}}function Hg(e){return typeof e==`object`&&!!e&&`content`in e&&typeof e.content==`string`}function Ug(e){return typeof e==`object`&&!!e&&`content`in e&&Array.isArray(e.content)}function Wg(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)&&e.parts.length>0}function Gg(e,t){let n=t-Rg({...e,content:``});if(n<=0)return[];let r=zg(e.content,n);return[{...e,content:r}]}function Kg(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 qg(e,t){let{key:n,items:r}=Kg(e);if(n===null||r.length===0)return[];let i=r.map(e=>Vg(e,``)),a=t-Rg({...e,[n]:i});if(a<=0)return[];let o=[];for(let e of r){let t=Bg(e),n=Lg(t);if(n<=a)o.push(e),a-=n;else if(o.length===0){let n=zg(t,a);n&&o.push(Vg(e,n));break}else break}return o.length<=0?[]:[{...e,[n]:o}]}function Jg(e,t){if(!e)return[];if(typeof e==`string`){let n=zg(e,t);return n?[n]:[]}return typeof e==`object`?Hg(e)?Gg(e,t):Ug(e)||Wg(e)?qg(e,t):[]:[]}function Yg(e){return e.map(e=>{let t;return e&&typeof e==`object`&&(Ug(e)?t={...e,content:Yg(e.content)}:`content`in e&&yg(e.content)&&(t={...e,content:Fg(e.content)}),Wg(e)&&(t={...t??e,parts:Yg(e.parts)}),yg(t)?t=Fg(t):yg(e)&&(t=Fg(e))),t??e})}function Xg(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],i=Yg([r]),a=i[0];return Rg(a)<=n?i:Jg(a,n)}function Zg(e){return Xg(e,Ig)}function Qg(e){return zg(e,Ig)}function $g(e){let t=P()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function e_(e){if(e!==void 0)return e;let t=P();return!t||!Ya(t)&&t.getOptions().streamGenAiSpans===!1}function t_(e,t){return e?`${e}.${t}`:t}function n_(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[Wh]:t}),n!==void 0&&e.setAttributes({[Gh]: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({[Kh]:a})}}function r_(e,t,n){if(!e.isRecording())return;let r={[eg]:!0};t.responseId&&(r[Hh]=t.responseId),t.responseModel&&(r[Vh]=t.responseModel),t.promptTokens!==void 0&&(r[Wh]=t.promptTokens),t.completionTokens!==void 0&&(r[Gh]=t.completionTokens),t.totalTokens===void 0?(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Kh]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)):r[Kh]=t.totalTokens,t.finishReasons.length&&(r[Bh]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[Qh]=t.responseTexts.join(``)),n&&t.toolCalls.length&&(r[tg]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function i_(e){if(typeof e==`string`)return Qg(e);try{return JSON.stringify(Array.isArray(e)?Zg(e):e)}catch{return`[unserializable]`}}function a_(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 o_(e,t){let[n,r]=await Promise.all([t,e]);return r&&typeof r==`object`&&`data`in r?{...r,data:n}:n}function s_(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 o_(i.call(e),t)}:typeof i==`function`?i.bind(r):i}}):t}var c_=`WorkersAI`,l_=new Map,u_=new Map,d_=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`]]),f_=`operation.name`,p_=`ai.operationId`,m_=`ai.prompt`,h_=`ai.schema`,g_=`ai.response.object`,__=`ai.values`,v_=`ai.response.text`,y_=`ai.response.toolCalls`,b_=`ai.response.finishReason`,x_=`ai.prompt.messages`,S_=`ai.prompt.tools`,C_=`ai.model.id`,w_=`ai.response.providerMetadata`,T_=`ai.usage.cachedInputTokens`,E_=`ai.telemetry.functionId`,D_=`ai.usage.completionTokens`,O_=`ai.usage.promptTokens`,k_=`ai.usage.tokens`,A_=`ai.toolCall.name`,j_=`ai.toolCall.id`,M_=`ai.toolCall.args`,N_=`ai.toolCall.result`;function P_(e,t){let n=e.parent_span_id;if(!n)return;let r=e.data[Wh],i=e.data[Gh];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 F_(e,t){let n=t.get(e.span_id);n&&e.data&&(n.inputTokens>0&&(e.data[Wh]=n.inputTokens),n.outputTokens>0&&(e.data[Gh]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(e.data[`gen_ai.usage.total_tokens`]=n.inputTokens+n.outputTokens))}function I_(e){let t=new Map;for(let n of e){let e=n.data[$h];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 L_(e,t){let n=I_(e);for(let r of e){if(r.op===`gen_ai.execute_tool`){let e=r.data[pg];if(typeof e==`string`){let t=n.get(e);t&&(r.data[vg]=t)}}r.op===`gen_ai.invoke_agent`&&F_(r,t)}}function R_(e){return l_.get(e)}function z_(e){l_.delete(e)}function B_(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 V_(e){return e.filter(e=>!!e&&typeof e==`object`&&`role`in e&&`content`in e)}function H_(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(...V_(e)),i;if(Array.isArray(n))return i.push(...V_(n)),i;if(typeof n==`string`&&i.push({role:`user`,content:n}),i.length>0)return i}}catch{}return[]}function U_(e,t,n){if(typeof t[`ai.prompt`]==`string`&&!t[`gen_ai.input.messages`]&&!t[`ai.prompt.messages`]){let r=t[m_],i=H_(r);if(i.length){let{systemInstructions:t,filteredMessages:r}=a_(i);t&&e.setAttribute(Zh,t);let a=Array.isArray(r)?r.length:0,o=n?i_(r):bn(r);e.setAttributes({[m_]:o,[Yh]:o,[Jh]:a})}}else if(typeof t[`ai.prompt.messages`]==`string`){let r=t[x_];try{let t=JSON.parse(r);if(Array.isArray(t)){let{systemInstructions:i,filteredMessages:a}=a_(t);i&&e.setAttribute(Zh,i);let o=Array.isArray(a)?a.length:0,s=!n&&a===t?r:n?i_(a):bn(a);e.setAttributes({[x_]:s,[Yh]:s,[Jh]:o})}}catch{}}}function W_(e){let{data:t,description:n}=L(e);if(!n)return;if(t[`ai.toolCall.name`]&&t[`ai.toolCall.id`]&&n===`ai.toolCall`){Q_(e,t);return}if(!t[`ai.operationId`]&&!n.startsWith(`ai.`))return;d_.get(n)===`generate_content`&&tf([c_]);let r=P()?.getIntegrationByName(`VercelAI`);$_(e,n,t,e_(r?.options?.enableTruncation))}function G_(e){if(e.type===`transaction`&&e.spans){let t=new Map;for(let n of e.spans)Y_(n),P_(n,t);L_(e.spans,t);let n=e.contexts?.trace;n?.op===`gen_ai.invoke_agent`&&F_(n,t)}return e}function K_(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 q_(e){let t=e[v_],n=e[y_],r=e[b_];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[y_]}}catch{}if(i.length>0){let t={role:`assistant`,parts:i,finish_reason:K_(r)};e[Xh]=JSON.stringify([t]),delete e[v_]}}function J_(e){if(Z_(e,D_,Gh),Z_(e,O_,Wh),Z_(e,T_,cg),Z_(e,`ai.usage.inputTokens`,Wh),Z_(e,`ai.usage.outputTokens`,Gh),Z_(e,k_,Wh),Z_(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[Wh]=e[Wh]+e[cg]),typeof e[`gen_ai.usage.input_tokens`]==`number`&&(e[Kh]=(typeof e[`gen_ai.usage.output_tokens`]==`number`?e[Gh]:0)+e[Wh]),e[`ai.prompt.tools`]&&Array.isArray(e[`ai.prompt.tools`])&&(e[S_]=B_(e[S_])),e[`operation.name`]){let t=e[`ai.operationId`]?e[p_]:e[f_];e[qh]=d_.get(t)??t,delete e[f_]}if(Z_(e,x_,Yh),q_(e),Z_(e,g_,`gen_ai.response.object`),Z_(e,S_,`gen_ai.request.available_tools`),Z_(e,M_,gg),Z_(e,N_,_g),Z_(e,h_,`gen_ai.request.schema`),Z_(e,C_,Ah),Array.isArray(e[`ai.values`])){let t=e[__].map(e=>{try{return JSON.parse(e)}catch{return e}});e[ug]=t.length===1?t[0]:JSON.stringify(t)}iv(e);for(let t of Object.keys(e))Array.isArray(e[t])&&(e[t]=JSON.stringify(e[t])),t.startsWith(`ai.`)&&Z_(e,t,`vercel.${t}`)}function Y_(e){let{data:t,origin:n}=e;n===`auto.vercelai.otel`&&(e.status&&e.status!==`ok`&&(e.status=`internal_error`),J_(t))}function X_(e){let t=e.attributes;if(t?.[`sentry.origin`]===`auto.vercelai.otel`){if(J_(t),t[`sentry.op`]===`gen_ai.execute_tool`&&e.parent_span_id){let n=u_.get(e.parent_span_id);if(n){let e=t[pg];if(typeof e==`string`){let r=n.get(e);r&&(t[vg]=r)}}}u_.delete(e.span_id)}}function Z_(e,t,n){e[t]!=null&&(e[n]=e[t],delete e[t])}function Q_(e,t){e.setAttribute(I,`auto.vercelai.otel`),e.setAttribute(F,`gen_ai.execute_tool`),e.setAttribute(qh,`execute_tool`),Z_(t,A_,pg),Z_(t,j_,mg);let n=t[mg];typeof n==`string`&&l_.set(n,e.spanContext()),t[`gen_ai.tool.type`]||e.setAttribute(hg,`function`);let r=t[pg];r&&e.updateName(`execute_tool ${r}`)}function $_(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[E_];a&&typeof a==`string`&&e.setAttribute(`gen_ai.function_id`,a),U_(e,n,r),n[`ai.model.id`]&&!n[`gen_ai.response.model`]&&e.setAttribute(Vh,n[C_]),e.setAttribute(`ai.streaming`,t.includes(`stream`));let o=d_.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[C_];s&&o&&e.updateName(`${o} ${s}`);let c=P();if(c&&Ya(c)&&n[`ai.prompt.tools`]&&Array.isArray(n[`ai.prompt.tools`])){let t=new Map;for(let e of n[S_])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&&u_.set(n,t)}}}var ev=new WeakSet;function tv(e){ev.has(e)||(ev.add(e),e.on(`spanStart`,W_),e.addEventProcessor(Object.assign(G_,{id:`VercelAiEventProcessor`})),e.on(`processSpan`,e=>{X_(e)}))}function nv(e){let t={};if(!e||typeof e!=`object`)return t;let n=e,r=n.openai??n.azure;r&&(av(t,cg,r.cachedPromptTokens),av(t,`gen_ai.usage.output_tokens.reasoning`,r.reasoningTokens),av(t,`gen_ai.usage.output_tokens.prediction_accepted`,r.acceptedPredictionTokens),av(t,`gen_ai.usage.output_tokens.prediction_rejected`,r.rejectedPredictionTokens),av(t,ig,r.responseId)),n.anthropic&&(av(t,cg,n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens),av(t,sg,n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens)),n.bedrock?.usage&&(av(t,cg,n.bedrock.usage.cacheReadInputTokens),av(t,sg,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(av(t,cg,n.deepseek.promptCacheHitTokens),av(t,`gen_ai.usage.input_tokens.cache_miss`,n.deepseek.promptCacheMissTokens));let i=(n.google??n.vertex)?.usageMetadata;return i&&typeof i.thoughtsTokenCount==`number`&&i.thoughtsTokenCount>0&&(t[Gh]=(i.candidatesTokenCount??0)+i.thoughtsTokenCount,av(t,Kh,i.totalTokenCount),av(t,`gen_ai.usage.reasoning.output_tokens`,i.thoughtsTokenCount)),t}var rv=new Set([Gh,Kh,`gen_ai.usage.reasoning.output_tokens`]);function iv(e){let t=e[w_];if(!t)return;let n=e[qh]===`invoke_agent`;try{let r=nv(JSON.parse(t));for(let[t,i]of Object.entries(r))t===`gen_ai.conversation.id`&&e[t]||n&&rv.has(t)||(e[t]=i)}catch{}}function av(e,t,n){n!=null&&(e[t]=n)}var ov=`OpenAI`,sv={"responses.create":{operation:`chat`},"chat.completions.create":{operation:`chat`},"embeddings.create":{operation:`embeddings`},"conversations.create":{operation:`chat`}},cv=[`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 lv(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&e.type.startsWith(`response.`)}function uv(e){return typeof e==`object`&&!!e&&`object`in e&&e.object===`chat.completion.chunk`}function dv(e,t,n){if(!t||typeof t!=`object`)return;let r=t,i={};if(typeof r.id==`string`&&(i[Hh]=r.id),typeof r.model==`string`&&(i[Vh]=r.model),r.object===`conversation`&&typeof r.id==`string`&&(i[ig]=r.id),r.usage&&typeof r.usage==`object`){let e=r.usage,t=e.prompt_tokens??e.input_tokens;typeof t==`number`&&(i[Wh]=t);let n=e.completion_tokens??e.output_tokens;typeof n==`number`&&(i[Gh]=n),typeof e.total_tokens==`number`&&(i[Kh]=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[Bh]=JSON.stringify(t)),n){let t=e.map(e=>e.message?.content||``);i[Qh]=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[tg]=JSON.stringify(n))}}if(typeof r.status==`string`&&(i[`gen_ai.response.finish_reasons`]||(i[Bh]=JSON.stringify([r.status]))),n&&(typeof r.output_text==`string`&&!i[`gen_ai.response.text`]&&(i[Qh]=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[tg]=JSON.stringify(e))}e.setAttributes(i)}function fv(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 pv(e){let t={[Ah]:e.model??`unknown`};`temperature`in e&&(t[Mh]=e.temperature),`top_p`in e&&(t[Ih]=e.top_p),`frequency_penalty`in e&&(t[Ph]=e.frequency_penalty),`presence_penalty`in e&&(t[Fh]=e.presence_penalty),`stream`in e&&(t[jh]=e.stream),`encoding_format`in e&&(t[Rh]=e.encoding_format),`dimensions`in e&&(t[zh]=e.dimensions);let n=fv(e);return n&&(t[ig]=n),t}function mv(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 hv(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&&mv(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function gv(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`}),V(e,{mechanism:{handled:!1,type:`auto.ai.openai.stream-response`}});return}if(!(`type`in e))return;let i=e;if(!cv.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*_v(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)uv(i)?hv(i,r,n):lv(i)&&gv(i,r,n,t),yield i}finally{let e=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];r_(t,{...r,toolCalls:e},n)}}function vv(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 yv(e,t){let n={[kh]:`openai`,[qh]:t,[I]:`auto.ai.openai`};if(e.length>0&&typeof e[0]==`object`&&e[0]!==null){let t=e[0],r=vv(t);r&&(n[$h]=r),Object.assign(n,pv(t))}else n[Ah]=`unknown`;return n}function bv(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(ug,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}=a_(i);a&&e.setAttribute(Zh,a),e.setAttribute(Yh,r?i_(o):bn(o)),Array.isArray(o)?e.setAttribute(Jh,o.length):e.setAttribute(Jh,1)}function xv(e,t,n,r,i){return function(...t){let a=n.operation||`unknown`,o=yv(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=so(u,o=>(n=e.apply(r,t),i.recordInputs&&c&&bv(o,c,a,e_(i.enableTruncation)),(async()=>{try{return _v(await n,o,i.recordOutputs??!1)}catch(e){throw o.setStatus({code:2,message:`internal_error`}),o.end(),e}})()));return s_(n,o)}let d,f=oo(u,n=>(d=e.apply(r,t),i.recordInputs&&c&&bv(n,c,a,e_(i.enableTruncation)),d.then(e=>(dv(n,e,i.recordOutputs),e))));return s_(d,f)}}function Sv(e,t=``,n){return new Proxy(e,{get(e,r){let i=e[r],a=t_(t,String(r)),o=sv[a];return typeof i==`function`&&o?xv(i,a,o,e,n):typeof i==`function`?i.bind(e):i&&typeof i==`object`?Sv(i,a,n):i}})}function Cv(e,t){return Sv(e,``,$g(t))}var wv=`Anthropic_AI`,Tv={"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 Ev(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:i}=a_(t);r&&e.setAttributes({[Zh]:r});let a=Array.isArray(i)?i.length:1;e.setAttributes({[Yh]:n?i_(i):bn(i),[Jh]:a})}var Dv={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 Ov(e){return e&&Dv[e]||`internal_error`}function kv(e,t){t.error&&(e.setStatus({code:2,message:Ov(t.error.type)}),V(t.error,{mechanism:{handled:!1,type:`auto.ai.anthropic.anthropic_error`}}))}function Av(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 jv(e,t){return`type`in e&&typeof e.type==`string`&&e.type===`error`&&(t.setStatus({code:2,message:Ov(e.error?.type)}),!0)}function Mv(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 Nv(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 Pv(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 Fv(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 Iv(e,t,n,r){e&&typeof e==`object`&&(jv(e,r)||(Mv(e,t),Nv(e,t),Pv(e,t,n),Fv(e,t)))}async function*Lv(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)Iv(i,r,n,t),yield i}finally{r_(t,r,n)}}function Rv(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=>{Iv(e,r,n,t)}),e.on(`message`,()=>{r_(t,r,n)}),e.on(`error`,e=>{V(e,{mechanism:{handled:!1,type:`auto.ai.anthropic.stream_error`}}),t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end())}),e}var zv=!1,Bv=new WeakSet;function Vv(e,t,n){let r={[kh]:`anthropic`,[qh]: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[$h]=JSON.stringify(t.tools)),r[Ah]=t.model??`unknown`,`temperature`in t&&(r[Mh]=t.temperature),`top_p`in t&&(r[Ih]=t.top_p),`stream`in t&&(r[jh]=t.stream),`top_k`in t&&(r[Lh]=t.top_k),`frequency_penalty`in t&&(r[Ph]=t.frequency_penalty),`max_tokens`in t&&(r[Nh]=t.max_tokens)}else r[Ah]=t===`models.retrieve`||t===`models.get`?e[0]:`unknown`;return r}function Hv(e,t,n){Ev(e,Av(t),n),`prompt`in t&&e.setAttributes({[Oh]:JSON.stringify(t.prompt)})}function Uv(e,t){if(`content`in t&&Array.isArray(t.content)){e.setAttributes({[Qh]: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({[tg]:JSON.stringify(n)})}`completion`in t&&e.setAttributes({[Qh]:t.completion}),`input_tokens`in t&&e.setAttributes({[Qh]:JSON.stringify(t.input_tokens)})}function Wv(e,t){`id`in t&&`model`in t&&(e.setAttributes({[Hh]:t.id,[Vh]:t.model}),`usage`in t&&t.usage&&n_(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function Gv(e,t,n){if(t&&typeof t==`object`){if(`type`in t&&t.type===`error`){kv(e,t);return}n&&Uv(e,t),Wv(e,t)}}function Kv(e,t){throw t.isRecording()&&(t.setStatus({code:2,message:`internal_error`}),t.end()),e}function qv(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=so(u,i=>(r=e.apply(t,n),s.recordInputs&&o&&Hv(i,o,e_(s.enableTruncation)),(async()=>{try{return Lv(await r,i,s.recordOutputs??!1)}catch(e){return Kv(e,i)}})()));return s_(r,i)}return so(u,r=>{try{s.recordInputs&&o&&Hv(r,o,e_(s.enableTruncation)),zv=!0;let i=e.apply(t,n);return zv=!1,Rv(i,r,s.recordOutputs??!1)}catch(e){return zv=!1,Kv(e,r)}})}function Jv(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&&zv)return e.apply(s,o);let l=n.operation||`unknown`,u=Vv(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 qv(e,s,o,u,l,t,f,i,p,c);let m,h=oo({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:u},t=>(m=e.apply(s,o),i.recordInputs&&f&&Hv(t,f,e_(i.enableTruncation)),m.then(e=>(Gv(t,e,i.recordOutputs),e))));return s_(m,h)}})}function Yv(e,t){for(let n of Object.keys(Tv)){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(Bv.has(o))continue;let s=Jv(o,n,Tv[n],a,t);Bv.add(s),a[i]=s}return e}function Xv(e,t){return Yv(e,$g(t))}var Zv=`Google_GenAI`,Qv={"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}},$v=`google_genai`;function ey(e,t){let n=e?.promptFeedback;if(n?.blockReason){let e=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:`internal_error`}),V(`Content blocked: ${e}`,{mechanism:{handled:!1,type:`auto.ai.google_genai`}}),!0}return!1}function ty(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 ny(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 ry(e,t,n,r){e&&!ey(e,r)&&(ty(e,t),ny(e,t,n))}async function*iy(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let i of e)ry(i,r,n,t),yield i}finally{r_(t,r,n)}}function ay(e,t=`user`){return typeof e==`string`?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(e=>ay(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 oy(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 sy(e){let t={};return`temperature`in e&&typeof e.temperature==`number`&&(t[Mh]=e.temperature),`topP`in e&&typeof e.topP==`number`&&(t[Ih]=e.topP),`topK`in e&&typeof e.topK==`number`&&(t[Lh]=e.topK),`maxOutputTokens`in e&&typeof e.maxOutputTokens==`number`&&(t[Nh]=e.maxOutputTokens),`frequencyPenalty`in e&&typeof e.frequencyPenalty==`number`&&(t[Ph]=e.frequencyPenalty),`presencePenalty`in e&&typeof e.presencePenalty==`number`&&(t[Fh]=e.presencePenalty),t}function cy(e,t,n){let r={[kh]:$v,[qh]:e,[I]:`auto.ai.google_genai`};if(t){if(r[Ah]=oy(t,n),`config`in t&&typeof t.config==`object`&&t.config){let e=t.config;if(Object.assign(r,sy(e)),`tools`in e&&Array.isArray(e.tools)){let t=e.tools.flatMap(e=>e.functionDeclarations);r[$h]=JSON.stringify(t)}}}else r[Ah]=oy({},n);return r}function ly(e,t,n,r){if(n===`embeddings`){let n=t.contents;n!=null&&e.setAttribute(ug,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(...ay(t.config.systemInstruction,`system`)),`history`in t&&i.push(...ay(t.history,`user`)),`contents`in t&&i.push(...ay(t.contents,`user`)),`message`in t&&i.push(...ay(t.message,`user`)),Array.isArray(i)&&i.length){let{systemInstructions:t,filteredMessages:n}=a_(i);t&&e.setAttribute(Zh,t);let a=Array.isArray(n)?n.length:0;e.setAttributes({[Jh]:a,[Yh]:r?i_(n):bn(n)})}}function uy(e,t,n){if(t&&typeof t==`object`){if(t.modelVersion&&e.setAttribute(Vh,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata==`object`){let n=t.usageMetadata;typeof n.promptTokenCount==`number`&&e.setAttributes({[Wh]:n.promptTokenCount}),typeof n.candidatesTokenCount==`number`&&e.setAttributes({[Gh]:n.candidatesTokenCount}),typeof n.totalTokenCount==`number`&&e.setAttributes({[Kh]: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({[Qh]:n.join(``)})}if(n&&t.functionCalls){let n=t.functionCalls;Array.isArray(n)&&n.length>0&&e.setAttributes({[tg]:JSON.stringify(n)})}}}function dy(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=cy(s,c,r),u=l[`gen_ai.request.model`]??`unknown`;return n.streaming?so({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},async t=>{try{return i.recordInputs&&c&&ly(t,c,s,e_(i.enableTruncation)),iy(await e.apply(r,o),t,!!i.recordOutputs)}catch(e){throw t.setStatus({code:2,message:`internal_error`}),t.end(),e}}):oo({name:`${s} ${u}`,op:`gen_ai.${s}`,attributes:l},t=>(i.recordInputs&&c&&ly(t,c,s,e_(i.enableTruncation)),no(()=>e.apply(r,o),()=>{},()=>{},e=>{a||uy(t,e,i.recordOutputs)})))}})}function fy(e,t=``,n){return new Proxy(e,{get:(e,r,i)=>{let a=Reflect.get(e,r,i),o=t_(t,String(r)),s=Qv[o];if(typeof a==`function`&&s){let t=s.operation?dy(a,o,s,e,n):a.bind(e);return s.proxyResultPath?function(...e){let r=t(...e);return r&&typeof r==`object`?fy(r,s.proxyResultPath,n):r}:t}return typeof a==`function`?a.bind(e):a&&typeof a==`object`?fy(a,o,n):a}})}function py(e,t){return fy(e,``,$g(t))}var my=`LangChain`,hy=`auto.ai.langchain`,gy={human:`user`,ai:`assistant`,assistant:`assistant`,system:`system`,function:`function`,tool:`tool`},_y=(e,t,n)=>{n!=null&&(e[t]=n)},vy=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function yy(e){if(Array.isArray(e))try{let t=e.map(e=>e&&typeof e==`object`&&yg(e)?Fg(e):e);return JSON.stringify(t)}catch{return String(e)}return bn(e,String)}function by(e){let t=e.toLowerCase();return gy[t]??t}function xy(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 Sy(e){if(e&&!Array.isArray(e))return e.invocation_params}function Cy(e){return e.map(e=>{let t=e._getType;if(typeof t==`function`)return{role:by(t.call(e)),content:yy(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:by(typeof n==`string`?xy(n):`user`),content:yy(e.kwargs?.content)}}if(e.type)return{role:by(String(e.type).toLowerCase()),content:yy(e.content)};if(e.role)return{role:by(String(e.role)),content:yy(e.content)};let n=e.constructor?.name;return n&&n!==`Object`?{role:by(xy(n)),content:yy(e.content)}:{role:`user`,content:yy(e.content)}})}function wy(e,t,n){let r={},i=`kwargs`in e?e.kwargs:void 0;vy(r,Mh,t?.temperature??n?.ls_temperature??i?.temperature),vy(r,Nh,t?.max_tokens??n?.ls_max_tokens??i?.max_tokens),vy(r,Ih,t?.top_p??i?.top_p);let a=t?.frequency_penalty;vy(r,Ph,a);let o=t?.presence_penalty;return vy(r,Fh,o),t&&`stream`in t&&_y(r,jh,!!t.stream),r}function Ty(e,t,n,r,i){return{[kh]:bn(e??`langchain`,String),[qh]:`chat`,[Ah]:bn(t,String),[I]:hy,...wy(n,r,i)}}function Ey(e,t,n,r,i,a){let o=a?.ls_provider,s=Ty(o,i?.model??a?.ls_model_name??`unknown`,e,i,a);if(n&&Array.isArray(t)&&t.length>0){_y(s,Jh,t.length);let e=t.map(e=>({role:`user`,content:e}));_y(s,Yh,r?i_(e):bn(e))}return s}function Dy(e,t,n,r,i,a){let o=Ty(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}=a_(Cy(t.flat()));e&&_y(o,Zh,e),_y(o,Jh,Array.isArray(n)?n.length:0),_y(o,Yh,r?i_(n):bn(n))}return o}function Oy(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&&_y(t,tg,bn(n,String))}function ky(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)vy(t,Wh,n.promptTokens),vy(t,Gh,n.completionTokens),vy(t,Kh,n.totalTokens);else if(r){vy(t,Wh,r.input_tokens),vy(t,Gh,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&&vy(t,Kh,i),r.cache_creation_input_tokens!==void 0&&vy(t,ag,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&vy(t,og,r.cache_read_input_tokens)}}function Ay(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&&_y(n,Bh,bn(r,String)),Oy(e.generations,n),t){let t=e.generations.flat().map(e=>e.text??e.message?.content).filter(e=>typeof e==`string`);t.length>0&&_y(n,Qh,bn(t,String))}}ky(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&&_y(n,Vh,a);let o=r?.id??i?.id;o&&_y(n,Hh,o);let s=r?.stop_reason??i?.response_metadata?.finish_reason;return s&&_y(n,Uh,bn(s,String)),n}function jy(e){let t={},n=e?.lc_agent_name;return typeof n==`string`&&(t[ng]=n),t}function My(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 Ny(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.addHandler==`function`&&typeof t.copy==`function`}function Py(e){return typeof e==`object`&&e?.name===`SentryCallbackHandler`}function Fy(e){return e.some(Py)}function Iy(e,t){if(!e)return[t];if(Ny(e)){if(Fy(e.handlers??[]))return e;let n=e.copy();return n.addHandler(t,!0),n}let n=Array.isArray(e)?e:[e];return Fy(n)?e:[...n,t]}function Ly(e={}){let{recordInputs:t,recordOutputs:n}=$g(e),r=e_(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=Sy(c),f=Ey(e,n,t,r,d,l),p=f[Ah],m=f[qh];so({name:`${m} ${p}`,op:`gen_ai.chat`,attributes:{...jy(l),...f,[F]:`gen_ai.chat`}},e=>(i.set(a,e),e))},handleChatModelStart(e,n,a,o,s,c,l,u){let d=Sy(c),f=Dy(e,n,t,r,d,l),p=My(s);p&&(f[$h]=p);let m=f[Ah],h=f[qh];so({name:`${h} ${m}`,op:`gen_ai.chat`,attributes:{...jy(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=Ay(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)),so({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={...jy(s),[I]:hy,[qh]:`execute_tool`,[pg]:l};t&&(u[gg]=n),so({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({[_g]: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 Ry(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 zy(e){let t=e??{},n={[I]:hy,[F]:dg,[qh]:`embeddings`,[Ah]:t.model??`unknown`};return n[kh]=Ry(t),`dimensions`in t&&(n[zh]=t.dimensions),`encodingFormat`in t&&(n[Rh]=t.encodingFormat),n}function By(e,t,n={}){let{recordInputs:r}=$g(n),i=zy(e),a=i[`gen_ai.request.model`]||`unknown`;return r&&t!=null&&(i[ug]=typeof t==`string`?t:JSON.stringify(t)),{name:`embeddings ${a}`,op:dg,attributes:i}}function Vy(e,t={}){return new Proxy(e,{apply(e,n,r){return oo(By(n,r[0],t),()=>Reflect.apply(e,n,r))}})}function Hy(e,t){let n=e;return typeof n.embedQuery==`function`&&(n.embedQuery=Vy(n.embedQuery,t)),typeof n.embedDocuments==`function`&&(n.embedDocuments=Vy(n.embedDocuments,t)),e}var Uy=`LangGraph`,Wy=`auto.ai.langgraph`;function Gy(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 Ky(e){let t=e[0];return typeof t==`object`&&t&&`name`in t&&typeof t.name==`string`?t.name:null}function qy(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]:Wy,[F]:fg,[qh]:`execute_tool`,[pg]:o,[hg]:`function`},c=i[1]?.metadata?.lc_agent_name??n;typeof c==`string`&&(a[ng]=c),s&&(a[vg]=s);let l=i[0];if(typeof l==`object`&&l&&(`id`in l&&typeof l.id==`string`&&(a[mg]=l.id),t.recordInputs)){let e=`args`in l&&typeof l.args==`object`?l.args:l;try{a[gg]=JSON.stringify(e)}catch{}}return oo({op:fg,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(_g,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 Jy(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 Yy(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 Xy(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(Vh,t.model_name),t.finish_reason&&typeof t.finish_reason==`string`&&e.setAttribute(Bh,[t.finish_reason])}}function Zy(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 Qy(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=Jy(a);o&&e.setAttribute(tg,JSON.stringify(o));let s=Cy(a);e.setAttribute(Qh,JSON.stringify(s));let c=0,l=0,u=0;for(let t of a){let n=Yy(t);c+=n.inputTokens,l+=n.outputTokens,u+=n.totalTokens,Xy(e,t)}c>0&&e.setAttribute(Wh,c),l>0&&e.setAttribute(Gh,l),u>0&&e.setAttribute(Kh,u)}var $y=!1,eb=`__sentry_patched__`;function tb(e){let t={[I]:Wy,[F]:`gen_ai.create_agent`,[qh]:`create_agent`};return e&&(t[ng]=e),{op:`gen_ai.create_agent`,name:e?`create_agent ${e}`:`create_agent`,attributes:t}}function nb(e,t){if(Object.prototype.hasOwnProperty.call(e,eb))return e;let n=Ly(t),r=new Proxy(e,{apply(e,r,i){return $y?Reflect.apply(e,r,i):oo(tb(),a=>{try{let o=Reflect.apply(e,r,i),s=i.length>0?i[0]:{};s?.name&&typeof s.name==`string`&&(a.setAttribute(ng,s.name),a.updateName(`create_agent ${s.name}`));let c=o.invoke;return c&&typeof c==`function`&&(o.invoke=rb(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,eb,{value:!0,enumerable:!1}),r}function rb(e,t,n,r,i,a){return new Proxy(e,{apply(e,o,s){let c=i?.modelName??i?.model;return oo({op:`gen_ai.invoke_agent`,name:`invoke_agent`,attributes:{[I]:Wy,[F]:lg,[qh]:`invoke_agent`}},async i=>{try{let l=n?.name;l&&typeof l==`string`&&(i.setAttribute(rg,l),i.setAttribute(ng,l),i.updateName(`invoke_agent ${l}`)),c&&i.setAttribute(Ah,c);let u=(s.length>1?s[1]:void 0)?.configurable?.thread_id;if(u&&typeof u==`string`&&i.setAttribute(ig,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=Iy(e.callbacks,a)}let d=Zy(t);d&&i.setAttribute($h,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}=a_(Cy(m));e&&i.setAttribute(Zh,e);let n=e_(r.enableTruncation),a=Array.isArray(t)?t.length:0;i.setAttributes({[Yh]:n?i_(t):bn(t),[Jh]:a})}let h=await Reflect.apply(e,o,s);return p&&Qy(i,m??null,h),h}catch(e){throw i.setStatus({code:2,message:`internal_error`}),e}})}})}function ib(e,t){if(Object.prototype.hasOwnProperty.call(e,eb))return e;let n=$g(t),r=Ly(n),i=new Proxy(e,{apply(e,t,i){let a=Gy(i),o=Ky(i),s=i[0];s&&Array.isArray(s.tools)&&s.tools.length>0&&qy(s.tools,n,o??void 0),$y=!0;let c;try{c=Reflect.apply(e,t,i)}finally{$y=!1}let l=c.invoke;if(l&&typeof l==`function`){let e={};o&&(e.name=o),c.invoke=rb(l.bind(c),c,e,n,a,r)}return c}});return Object.defineProperty(i,eb,{value:!0,enumerable:!1}),i}function ab(e,t){return e.compile=nb(e.compile,$g(t)),e}var ob=ab;function sb(e,t,n){let r=n.getOptions(),i=n.getDsn(),a=r.tunnel,o=La(r._metadata),s={sent_at:new Date(an()).toISOString(),...cb(t)&&{trace:t},...o&&{sdk:o},...!!a&&i&&{dsn:yi(i)}},c=n.getDataCollectionOptions().userInfo?`auto`:`never`;return Ta(s,[[{type:`span`,item_count:e.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...Hu()&&{ingest_settings:{infer_ip:c,infer_user_agent:c}},items:e}]])}function cb(e){return!!e.trace_id&&!!e.public_key}function lb(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 ub=1e3,db=5e6,fb=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<=ub?n:ub,this._flushInterval=r&&r>0?r:5e3,this._maxTraceWeight=i&&i>0?i:db,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:xu(setTimeout(()=>{this.flush(t)},this._flushInterval))},this._traceBuckets.set(t,n)),n.spans.add(e),n.size+=lb(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=xa(r),a=n.map(e=>{let{_segmentSpan:t,...n}=e;return n}),o=sb(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)}},pb=U(()=>({name:`SpanStreaming`,setup(e){let t=`SpanStreaming integration requires`,n=`Falling back to static trace lifecycle.`,r=e.getOptions();if(!Ya(e)){r.traceLifecycle=`static`,D&&A.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let i=r.beforeSendSpan;if(i&&!wa(i)){r.traceLifecycle=`static`,D&&A.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let a=new fb(e);e.on(`afterSpanEnd`,t=>{Yi(t)&&a.add(Sl(t,e))})}}));function mb(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}function hb(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 gb=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 _b(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 vb=class extends Ud{constructor(e){_b(e),e.traceLifecycle===`stream`&&!e.integrations.some(e=>e.name===`SpanStreaming`)&&e.integrations.push(pb()),super(e),this._disposeCallbacks=[],this._setUpMetricsProcessing()}eventFromException(e,t){let n=Sp(this,this._options.stackParser,e,t);return n.level=`error`,jl(n)}eventFromMessage(e,t=`info`,n){return jl(Cp(this._options.stackParser,e,t,n,this._options.attachStacktrace))}captureException(e,t,n){return yb(t),super.captureException(e,t,n)}captureEvent(e,t,n){return!e.type&&e.exception?.values&&e.exception.values.length>0&&yb(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]=Ru(this,n);l&&(s.contexts={trace:l});let u=df(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=hd(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 yb(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 bb={mechanism:{handled:!1,type:`auto.rpc.trpc.middleware`}};function xb(e){typeof e==`object`&&e&&`ok`in e&&!e.ok&&`error`in e&&V(e.error,bb)}function Sb(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),so({name:`trpc/${n}`,op:`rpc.server`,attributes:{[kr]:`route`,[I]:`auto.rpc.trpc`},forceTransaction:!!e.forceTransaction},async e=>{try{let t=await i();return xb(t),e.end(),t}catch(t){throw V(t,bb),e.end(),t}})))}}function Cb(e,t,n){try{if(!P())return;let r=R();r?.isRecording()&&r.setStatus({code:2,message:`internal_error`}),V(e,{mechanism:{type:`auto.ai.mcp_server`,handled:!1,data:{error_type:t||`handler_execution`,...n}}})}catch{}}function wb(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=Tb(i,t,n);return e.call(this,n,...r.slice(0,-1),a)})}function Tb(e,t,n){return function(...r){try{return Eb.call(this,e,t,n,r)}catch(t){return D&&A.warn(`MCP handler wrapping failed:`,t),e.apply(this,r)}}}function Eb(e,t,n,r){try{let i=e.apply(this,r);return j(i)&&typeof i.then==`function`?Promise.resolve(i).catch(e=>{throw Db(e,t,n),e}):i}catch(e){throw Db(e,t,n),e}}function Db(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`)?Cb(e,`validation`,r):e.name===`ServerTimeoutError`||e.message.includes(`timed out`)||e.message.includes(`timeout`)?Cb(e,`timeout`,r):Cb(e,`tool_execution`,r)):t===`resource`||t===`registerResource`?(r.resource_uri=n,Cb(e,`resource_execution`,r)):(t===`prompt`||t===`registerPrompt`)&&(r.prompt_name=n,Cb(e,`prompt_execution`,r))}catch{}}function Ob(e){typeof e.tool==`function`&&wb(e,`tool`),typeof e.registerTool==`function`&&wb(e,`registerTool`)}function kb(e){typeof e.resource==`function`&&wb(e,`resource`),typeof e.registerResource==`function`&&wb(e,`registerResource`)}function Ab(e){typeof e.prompt==`function`&&wb(e,`prompt`),typeof e.registerPrompt==`function`&&wb(e,`registerPrompt`)}function jb(e){Ob(e),kb(e),Ab(e)}function Mb(e){let t=e,n=t._registeredTools;if(j(n))for(let[e,t]of Object.entries(n))typeof t.executor==`function`&&(t.executor=Tb(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=Tb(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=Tb(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=Tb(t.handler,`registerPrompt`,e))}var Nb=`mcp.method.name`,Pb=`mcp.transport`,Fb=`mcp.server.name`,Ib=`mcp.server.title`,Lb=`mcp.server.version`,Rb=`mcp.protocol.version`,zb=`mcp.tool.name`,Bb=`mcp.resource.uri`,Vb=`mcp.prompt.name`,Hb=`mcp.tool.result.is_error`,Ub=`mcp.tool.result.content_count`,Wb=`mcp.prompt.result.description`,Gb=`mcp.prompt.result.message_count`,Kb=`mcp.request.argument`,qb=`mcp.logging.level`,Jb=`mcp.logging.logger`,Yb=`mcp.logging.data_type`,Xb=`mcp.logging.message`,Zb=`network.transport`,Qb=`network.protocol.version`,$b=`client.address`,ex=`client.port`,tx=`mcp.server`,nx=`mcp.notification.client_to_server`,rx=`mcp.notification.server_to_client`,ix=`auto.function.mcp_server`,ax=`auto.mcp.notification`,ox=`route`;function sx(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&`id`in e}function cx(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`method`in e&&!(`id`in e)}function lx(e){return j(e)&&`jsonrpc`in e&&e.jsonrpc===`2.0`&&`id`in e&&(`result`in e||`error`in e)}function ux(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 dx(e){return j(e)}function fx(e,t){let n={[Ub]:e.length};for(let[r,i]of e.entries()){if(!dx(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;dx(t)&&(e(`resource_uri`,t.uri),e(`resource_mime_type`,t.mimeType))}}return n}function px(e,t){if(!dx(e))return{};let n=Array.isArray(e.content)?fx(e.content,t):{};return typeof e.isError==`boolean`&&(n[Hb]=e.isError),n}function mx(e,t){let n={};if(!dx(e))return n;if(t&&typeof e.description==`string`&&(n[Wb]=e.description),Array.isArray(e.messages)&&(n[Gb]=e.messages.length,t)){let t=e.messages;for(let[e,r]of t.entries()){if(!dx(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),dx(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 hx=new Map,gx=new WeakMap;function _x(e){let t=e.sessionId;return t?hx.get(t):gx.get(e)}function vx(e,t){let n=e.sessionId;n?hx.set(n,t):gx.set(e,t)}function yx(e,t){vx(e,{..._x(e)||{},...t})}function bx(e){return _x(e)?.clientInfo}function xx(e){return _x(e)?.protocolVersion}function Sx(e){return _x(e)}function Cx(e){let t=e.sessionId;t&&hx.delete(t)}var wx=`io.modelcontextprotocol/protocolVersion`,Tx=`io.modelcontextprotocol/clientInfo`,Ex=`io.modelcontextprotocol/serverInfo`;function Dx(e){let t={};return dx(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 Ox(e){let t={};return dx(e.params)&&(typeof e.params.protocolVersion==`string`&&(t.protocolVersion=e.params.protocolVersion),e.params.clientInfo&&(t.clientInfo=Dx(e.params.clientInfo))),t}function kx(e){let t={};if(dx(e.params)&&dx(e.params._meta)){let n=e.params._meta;typeof n[wx]==`string`&&(t.protocolVersion=n[wx]),n[Tx]&&(t.clientInfo=Dx(n[Tx]))}return t}function Ax(e){let t={};return dx(e)&&(typeof e.protocolVersion==`string`&&(t.protocolVersion=e.protocolVersion),e.serverInfo&&(t.serverInfo=Dx(e.serverInfo))),t}function jx(e){let t={};return dx(e)&&dx(e._meta)&&e._meta[Ex]&&(t.serverInfo=Dx(e._meta[Ex])),t}function Mx(e){let t=bx(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 Nx(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 Px(e){let t=Sx(e)?.serverInfo,n={};return t?.name&&(n[Fb]=t.name),t?.title&&(n[Ib]=t.title),t?.version&&(n[Lb]=t.version),n}function Fx(e){let t={};return e?.name&&(t[Fb]=e.name),e?.title&&(t[Ib]=e.title),e?.version&&(t[Lb]=e.version),t}function Ix(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 Lx(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 Rx(e,t){let n=e&&`sessionId`in e?e.sessionId:void 0,r=t?Ix(t):{},{mcpTransport:i,networkTransport:a}=Lx(e),o=Mx(e),s=Px(e),c=xx(e);return{...n&&{"mcp.session.id":n},...r.address&&{"client.address":r.address},...r.port&&{"client.port":r.port},[Pb]:i,[Zb]:a,[Qb]:`2.0`,...c&&{"mcp.protocol.version":c},...o,...s}}var zx=new Map,Bx=new WeakMap;function Vx(e){let t=e.sessionId;if(t){let e=zx.get(t);return e||(e=new Map,zx.set(t,e)),e}let n=Bx.get(e);return n||(n=new Map,Bx.set(e,n)),n}function Hx(e,t,n,r,i){Vx(e).set(t,{span:n,method:r,capturePolicy:i,startTime:Date.now()})}function Ux(e,t,n,r=!1){let i=Vx(e),a=i.get(t);if(a){let{span:o,method:s}=a,c=s===`initialize`?Ax(n):jx(n);(c.protocolVersion||c.serverInfo)&&yx(e,c);let l={...Fx(c.serverInfo)};if(c.protocolVersion&&(l[Rb]=c.protocolVersion),Object.keys(l).length>0&&o.setAttributes(l),r)o.setStatus({code:2,message:`internal_error`});else if(s===`tools/call`){let e=px(n,a.capturePolicy.recordOutputs);o.setAttributes(e)}else if(s===`prompts/get`){let e=mx(n,a.capturePolicy.recordOutputs);o.setAttributes(e)}o.end(),i.delete(t)}}function Wx(e){let t=e.sessionId;if(t){let e=zx.get(t);if(e){for(let[,t]of e)t.span.setStatus({code:2,message:`cancelled`}),t.span.end();zx.delete(t)}return}let n=Bx.get(e);if(n){for(let[,e]of n)e.span.setStatus({code:2,message:`cancelled`}),e.span.end();n.clear()}}var Gx={"tools/call":{targetField:`name`,targetAttribute:zb,captureArguments:!0,argumentsField:`arguments`},"resources/read":{targetField:`uri`,targetAttribute:Bb,captureUri:!0},"resources/subscribe":{targetField:`uri`,targetAttribute:Bb},"resources/unsubscribe":{targetField:`uri`,targetAttribute:Bb},"prompts/get":{targetField:`name`,targetAttribute:Vb,captureName:!0,captureArguments:!0,argumentsField:`arguments`}};function Kx(e,t){let n=Gx[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 qx(e,t){let n={},r=Gx[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[`${Kb}.${t.toLowerCase()}`]=JSON.stringify(r)}return r.captureUri&&t?.uri&&(n[`${Kb}.uri`]=JSON.stringify(t.uri)),r.captureName&&t?.name&&(n[`${Kb}.name`]=JSON.stringify(t.name)),n}function Jx(e){return typeof e==`string`?e:JSON.stringify(e)}function Yx(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[qb]=String(t.level)),t?.logger&&(r[Jb]=String(t.logger)),t?.data!==void 0&&(r[Yb]=typeof t.data,n&&(r[Xb]=Jx(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[Bb]=String(t.uri);let e=hf(String(t.uri));e&&!mf(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 Xx(e,t,n,r){if(e===`request`){let e=t,i=Kx(e.method,n||{});return{...e.id!==void 0&&{"mcp.request.id":String(e.id)},...i.attributes,...r?qx(e.method,n||{}):{}}}return Yx(t.method,n||{},r)}var Zx=new Set([$b,ex,Bb]);function Qx(e){return Zx.has(e)}function $x(e,t){return t?e:Object.entries(e).reduce((e,[t,n])=>(Qx(t)||(e[t]=n),e),{})}function eS(e,t){return t?`${e} ${t}`:e}function tS(e){let t,n;switch(e){case`request`:t=tx,n=ix;break;case`notification-incoming`:t=nx,n=ax;break;case`notification-outgoing`:t=rx,n=ax}return{[F]:t,[I]:n,[kr]:ox}}function nS(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`?eS(s,Kx(s,c||{}).target):s;let u=$x({...Rx(r,i),[Nb]:s,...Xx(t,n,c,o?.recordInputs),...tS(t)},!!P()?.getDataCollectionOptions().userInfo);return oo({name:l,forceTransaction:!0,attributes:u},a)}function rS(e,t,n,r,i){return nS({type:`notification-incoming`,message:e,transport:t,extra:n,callback:i,options:r})}function iS(e,t,n,r){return nS({type:`notification-outgoing`,message:e,transport:t,options:n,callback:r})}function aS(e,t,n,r){let{method:i}=e,a=e.params;return{name:eS(i,Kx(i,a||{}).target),op:tx,forceTransaction:!0,attributes:$x({...Rx(t,n),[Nb]:i,...Xx(`request`,e,a,r?.recordInputs),...tS(`request`)},!!P()?.getDataCollectionOptions().userInfo)}}function oS(e){if(e.recordInputs!==void 0&&e.recordOutputs!==void 0)return{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs};let t=P()?.getDataCollectionOptions().genAI;return{recordInputs:e.recordInputs??t?.inputs??!1,recordOutputs:e.recordOutputs??t?.outputs??!1}}function sS(e,t){e.onmessage&&qt(e,`onmessage`,n=>function(r,i){let a=sx(r)?r:void 0,o=cx(r)?r:void 0,s=a||o,c;if(s)try{c=a?.method===`initialize`?Ox(a):kx(s),(c.protocolVersion||c.clientInfo)&&yx(e,c)}catch{}if(a){let r=oS(t);return Dr(N().clone(),()=>{let t=z(aS(a,e,i,r));return a.method===`initialize`&&c&&t.setAttributes({...Nx(c.clientInfo),...c.protocolVersion&&{"mcp.protocol.version":c.protocolVersion}}),Hx(e,a.id,t,a.method,r),B(t,()=>n.call(this,a,i))})}return o?rS(o,e,i,oS(t),()=>n.call(this,o,i)):n.call(this,r,i)})}function cS(e,t){e.send&&qt(e,`send`,n=>async function(...r){let[i]=r;return cx(i)?iS(i,e,oS(t),()=>n.call(this,...r)):(lx(i)&&i.id!==null&&i.id!==void 0&&(i.error&&dS(i.error),Ux(e,i.id,i.result,!!i.error)),n.call(this,...r))})}function lS(e){e.onclose&&qt(e,`onclose`,t=>function(...n){return Wx(e),Cx(e),t.call(this,...n)})}function uS(e){e.onerror&&qt(e,`onerror`,e=>function(t){return fS(t),e.call(this,t)})}function dS(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}`,Cb(e,`protocol`)}}}catch{}}function fS(e){try{Cb(e,`transport`)}catch{}}var pS=new WeakSet;function mS(e,t){if(pS.has(e)||!ux(e))return e;let n=e,r={...t};return qt(n,`connect`,e=>async function(t,...n){let i=await e.call(this,t,...n);return sS(t,r),cS(t,r),lS(t),uS(t),i}),jb(n),Mb(n),pS.add(e),e}function hS(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 gS(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?yS(s):void 0;return{filename:l??s,module:l&&e?.(l),function:r,lineno:vS(o[3]),colno:vS(o[4]),in_app:hS(s||``,c)}}if(i.match(t))return{filename:i}}}function _S(e){return[90,gS(e)]}function vS(e){return parseInt(e||``,10)||void 0}function yS(e){try{return decodeURI(e)}catch{return}}var bS=new WeakMap,xS=(e,t)=>{let n=bS.get(e);n?n.push(t):bS.set(e,[t])},SS=e=>{let t=bS.get(e);return t||(t=[],bS.set(e,t)),t},CS=`express.name`,wS=`http.route`,TS=`express.type`,ES=`router`,DS=`middleware`,OS=`request_handler`,kS=e=>e instanceof Error?[e,e.message]:[String(e),String(e)];function AS(e){return e.includes(`:`)||e.includes(`*`)}var jS=(e,t,n)=>{if(t.name===`router`){let r=MS(``,t)||n||e||`/`;return{attributes:{[CS]:r,[TS]:ES},name:`router - ${r}`}}return t.name===`bound dispatch`||t.name===`handle`?{attributes:{[CS]:(e||n)??`request handler`,[TS]:OS},name:`request handler${t.path?` - ${e||n}`:``}`}:{attributes:{[CS]:t.name,[TS]:DS},name:`middleware - ${t.name}`}},MS=(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)?MS(e,n):e},NS=(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 PS(e,t){let n=SS(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)||AS(r))?r:void 0}function FS(e){let t=SS(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}var IS=e=>{let t=e[0];return Array.isArray(t)?t.map(e=>LS(e)||``).join(`,`):LS(t)},LS=e=>typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0,RS=e=>zS(e?.Router?.prototype),zS=e=>(typeof e==`object`||typeof e==`function`)&&!!e&&`route`in e&&typeof e.route==`function`,BS=e=>zS(e.Router)&&!RS(e);function VS(e){let t=e.status||e.statusCode||e.status_code||e.output?.statusCode;return t?parseInt(t,10):500}function HS(e){return VS(e)>=500}function US(e){if(!N()?.getScopeData()?.sdkProcessingMetadata?.normalizedRequest){let t=Lf(e);N().setSDKProcessingMetadata({normalizedRequest:t})}}function WS(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();US(t);let c=R();if(!c)return i.apply(this,[t,a,...o]);n&&xS(t,n);let l=SS(t),u=!!n,d=FS(t),f=PS(t,d);s.onRouteResolved?.(f);let p=jS(d,r,n),m=p.attributes[CS],h=p.attributes[TS],g=Object.assign(p.attributes,{[I]:`auto.http.express`,[F]:`${h}.express`});if(f&&(g[wS]=f),NS(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 so({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]=kS(o);e.setStatus({code:2,message:n})}return n||(n=!0,a.removeListener(`finish`,r),e.end()),!(t.route&&d)&&u&&l.pop(),B(c,()=>s.apply(this,i))};break}}try{return i.apply(this,[t,a,...o])}catch(t){let[n,r]=kS(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 GS(e){return!!e&&typeof e==`object`&&`default`in e&&e.default||e}function KS(e){return!!e.express}var qS=!1;function JS(){qS||(qS=!0,D&&A.warn("[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead."))}function YS(e,t){let n,r;if(!t&&KS(e)){let{express:t,...i}=e;r=t,n=()=>i,JS()}else if(typeof t!=`function`)throw TypeError("`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback");else n=t,r=e;let i=GS(r),a=RS(i)?i.Router.prototype:BS(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 WS(n,r,IS(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&&WS(n,r,IS(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=RS(i)?this.router:this._router;if(r){let t=r.stack[r.stack.length-1];t&&WS(n,t,IS(e))}return t})}catch(e){D&&A.error(`Failed to patch express application.use method:`,e)}return i}function XS(){return P()?.getIntegrationByName(`Express`)?.getShouldHandleError?.()}function ZS(e){return function(t,n,r,i){US(n);let a=e?.shouldHandleError??XS()??HS;if(a===!1){i(t);return}a(t)&&(r.sentry=V(t,{mechanism:{type:`auto.middleware.express`,handled:!1}})),i(t)}}function QS(e,t){e.use($S()),e.use(ZS(t))}function $S(){return function(e,t,n){US(e),n()}}var eC=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,tC=Symbol(`sentryPostgresConnectionContext`),nC=Symbol.for(`sentry.instrumented.postgresjs`),rC=Symbol.for(`sentry.query.from.instrumented.sql`);function iC(e,t){return!e||typeof e!=`function`?(D&&A.warn(`instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance`),e):aC(e,{requireParentSpan:!0,...t})}function aC(e,t,n){if(e[nC])return e;let r=new Proxy(e,{apply(e,n,i){let a=Reflect.apply(e,n,i);return j(a)&&`handle`in a&&cC(a,r,t),a},get(e,n){let i=e[n];return typeof n!=`string`||typeof i!=`function`?i:n===`unsafe`||n===`file`?oC(i,e,r,t):n===`begin`||n===`reserve`?sC(i,e,r,t):i}});return n?r[tC]=n:gC(e,r),e[nC]=!0,r[nC]=!0,r}function oC(e,t,n,r){return function(...i){let a=Reflect.apply(e,t,i);return j(a)&&`handle`in a&&cC(a,n,r),a}}function sC(e,t,n,r){return function(...i){let a=n[tC];if(typeof i[i.length-1]!=`function`){let n=Reflect.apply(e,t,i);return n&&typeof n.then==`function`?n.then(e=>aC(e,r,a)):n}let o=i.length===1?i[0]:i[1],s=function(e){let t=aC(e,r,a);return o(t)},c=i.length===1?[s]:[i[0],s];return Reflect.apply(e,t,c)}}function cC(e,t,n){if(e.handle?.__sentryWrapped)return;e[rC]=!0;let r=e.handle,i=async function(...i){if(this.executed||!lC(n))return r.apply(this,i);let a=fC(uC(e.strings));return so({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[tC]:void 0;if(pC(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{mC(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`),mC(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 lC(e){return R()!==void 0||!e.requireParentSpan}function uC(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((e,t,n)=>n===0?t:`${e}$${n}${t}`,``)}var dC;function fC(e){return e?(dC||=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(dC,`?`).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 pC(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 mC(e,t,n){if(n){e.setAttribute(`db.operation.name`,n);return}let r=t?.match(eC);r?.[1]&&e.setAttribute(`db.operation.name`,r[1].toUpperCase())}function hC(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 gC(e,t){let n=e;n.options&&typeof n.options==`object`&&(t[tC]=hC(n.options))}var _C=`http.client.request.created`,vC=`http.server.request.start`;function yC(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 bC(e){try{return String(xC(e))}catch{return``}}function xC(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 SC(e){return String(bC(yC(e)))}function CC(e,t){let n=yf(SC(e)),r=t?.statusCode,i=mb(r);Kf({category:`http`,data:{status_code:r,url:xf(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 wC(e){let t=SC(e),[n,r]=vf(hf(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 TC(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,...DC(e),...EC(a)})}function EC(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 DC(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 OC(e,t){let n=SC(e),{tracePropagationTargets:r,propagateTraceparent:i}=P()?.getOptions()??{};if(!Af(n,r,t)||e.getHeader(`sentry-trace`))return;let a=Ef({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 kC=e=>typeof e.__unwrap==`function`,AC=`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`,jC=!1,MC=D?e=>{jC||(kC(e.request)||kC(e.get))&&(jC=!0,A.warn(AC))}:()=>{};function NC(e){let t=new gb(100),n=()=>P()?.getOptions(),r=r=>{if(M().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__===!0)return;let i=n(),{errorMonitor:a=`error`,spans:o=!i||sa(i),propagateTrace:s=!1,breadcrumbs:c=!0,http:l,https:u,suppressOtelWarning:d=!1}=e,{request:f}=r;if(e.ignoreOutgoingRequests?.(SC(f),f))return;let p=!1;function m(e,t){p||(p=!0,CC(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&&OC(f,t);return}d||(l&&MC(l),u&&MC(u));let g=z(wC(f));e.outgoingRequestHook?.(g,f),s&&(g.isRecording()?B(g,()=>{OC(f,t)}):OC(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(),TC(t,g),Lo(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{[_C]:r}}var PC;function FC(e,t){let n=e.ClientRequest?.prototype;if(typeof n?._storeHeader!=`function`||(PC=NC({...t,http:e})[_C],Zt(n._storeHeader)))return;let r=n._storeHeader;Xt(n,`_storeHeader`,function(...e){try{PC({request:this},_C)}catch{}return r.apply(this,e)})}function IC(e,t={}){return FC(GS(e),t),e}var LC=(e,t={})=>IC(e,t);function RC(e,t,n,r){let i=0,a=[];D&&A.log(r,`Patching request.on`);let o=new WeakMap,s=Pf(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 zC=new WeakMap;function BC(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=zC.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};zC.set(e,t);let n=()=>{clearTimeout(s),a(),zC.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);xu(s)}}})}var VC=`Http.Server`,HC=`Http.SentryServerSpans`,UC=new WeakMap,WC=Symbol.for(`sentry_http_server_instrumented`);function GC(e){return!e[WC]&&(e[WC]=!0)}function KC(e,t){let n=t.emit;if(n===UC.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||!GC(s))return t.apply(n,r);D&&A.log(VC,`Handling incoming request`);let l=N().clone();l.setClient(o);let u=s.socket?.remoteAddress,d=s.url||`/`,f=Lf(s),{maxRequestBodySize:p=`medium`,ignoreRequestBody:m,sessions:h=!0,sessionFlushingDelayMS:g=6e4}=e;p!==`none`&&!m?.(d,s)&&RC(s,l,p,VC),l.setSDKProcessingMetadata({normalizedRequest:f,ipAddress:u});let _=`${(s.method||`GET`).toUpperCase()} ${bf(d)}`;return l.setTransactionName(_),h&&BC(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 uo({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})})}});UC.set(t,r),t.emit=r}function qC(e){let t=e.wrapServerEmitRequest,n=JC(e),r={...e,wrapServerEmitRequest(r,i,a,o){let s=P()?.getOptions();e.spans??(s?sa(s):!1)?n(r,i,a,o):t?t(r,i,a,o):o()}},i=e=>{let{server:t}=e;KC(r,t)};return{[vC]:i}}function JC(e){let{wrapServerEmitRequest:t,ignoreIncomingRequests:n,ignoreStaticAssets:r=!0,onSpanCreated:i,errorMonitor:a=`error`,onSpanEnd:o}=e;return(e,s,c,l)=>{return typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__?l():t?t(e,s,c,u):u();function u(){let t=N().getClient();if(!t)return l();if(YC(e,{ignoreStaticAssets:r,ignoreIncomingRequests:n}))return D&&A.log(HC,`Skipping span creation for incoming request`,e.url),l();let u=c.url||e.url||`/`,d=hf(u),f=d?d.pathname:bf(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 so({name:m,kind:W.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":ZC(e)||void 0,[_l]:d&&!mf(d)?d.href:void 0,[vl]:d?.pathname??f,[Nc]: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),...zf(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,...zf(If(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 YC(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&XC(r)||n?.(r,e))}function XC(e){let t=bf(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 ZC(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 $C=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;x();var ew=u(`sentry_http_server_instrumented`),tw=`Http.Server`;function nw(e,t){Jt(e,`_startSpanCallback`,new WeakRef(t))}var rw=((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(ew))return r();let a=p.extract(l.active(),n.headers).setValue(ew,!0);l.with(a,()=>{i.emit(`httpServerRequest`,e,t,n);let a=e._startSpanCallback?.deref();a?a(()=>(r(),!0)):r()})}};return{name:tw,setupOnce(){let{[vC]:e}=qC(t);Be(vC,e)},afterAllSetup(e){$C&&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 iw=u(`OpenTelemetry SDK Context Key RPC_METADATA`),aw;(function(e){e.HTTP=`http`})(aw||={});function ow(e,t){return e.setValue(iw,t)}x();var sw=`Http.ServerSpans`,cw=((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:sw,setup(e){typeof __SENTRY_TRACING__<`u`&&!__SENTRY_TRACING__||e.on(`httpServerRequest`,(r,c,u)=>{let d=r,f=c;nw(d,r=>{if(dw(d,{ignoreStaticAssets:t,ignoreIncomingRequests:n}))return $C&&A.log(sw,`Skipping span creation for incoming request`,d.url),r();let c=u.url||d.url||`/`,p=hf(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:bf(c),x=z({name:`${b} ${te}`,kind:W.SERVER,attributes:{[F]:`http.server`,[I]:`auto.http.otel.http`,[ol]:lw(d)||void 0,[_l]:p&&!mf(p)?p.href:void 0,[vl]:p?.pathname??te,[Nc]:c,[Ec]:u.method,[Mc]:p?`${p.pathname}${p.search}`:te,[Tc]:v,[Yc]:y,[Cc]:typeof g==`string`?g.split(`,`)[0]:void 0,[Pc]:h,[Ac]:ee,[wc]:_,[el]:_?.toUpperCase()===`QUIC`?`ip_udp`:`ip_tcp`,...fw(d),...zf(u.headers||{},e.getDataCollectionOptions())}});a?.(x,d),o?.(x,f),s?.(x,d,f),i?.(x,d,f);let ne={type:aw.HTTP,span:x};return B(x,()=>l.with(ow(l.active(),ne),()=>{Lo(d),Lo(f);let e=!1;function t(t){if(e)return;e=!0;let n=hw(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(fe,()=>{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(gw(t,r))return $C&&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){$C&&(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 lw(e){return e.headers[`next-router-prefetch`]===`1`}function uw(e){let t=bf(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 dw(e,{ignoreStaticAssets:t,ignoreIncomingRequests:n}){if(po())return!0;let r=e.url,i=e.method?.toUpperCase();return!!(i===`OPTIONS`||i===`HEAD`||!r||t&&i===`GET`&&uw(r)||n?.(r,e))}function fw(e){let t=pw(e.headers);return t==null?{}:mw(e.headers)?{"http.request_content_length":t}:{"http.request_content_length_uncompressed":t}}function pw(e){let t=e[`content-length`];if(t===void 0)return null;let n=parseInt(t,10);return isNaN(n)?null:n}function mw(e){let t=e[`content-encoding`];return!!t&&t!==`identity`}function hw(e,t,n){let{socket:r}=e,{statusCode:i,statusMessage:a}=t,o={[Oc]:i,[jc]:i,"http.status_text":a?.toUpperCase()};if(r){let{localAddress:e,localPort:t,remoteAddress:n,remotePort:i}=r;o[Jc]=e,o[Xc]=t,o[Zc]=n,o[$c]=i}return o[jc]=i,o[`http.status_text`]=(a||``).toUpperCase(),n?.type===aw.HTTP&&n.route!==void 0&&(o[kc]=n.route),o}function gw(e,t){return t.some(t=>{if(typeof t==`number`)return t===e;let[n,r]=t;return e>=n&&e<=r})}var _w=class{emit(e){}enabled(){return!1}},vw=new _w,yw=Symbol.for(`io.opentelemetry.js.api.logs`),bw=globalThis;function xw(e,t,n){return r=>r===e?t:n}var Sw=new class{getLogger(e,t,n){return new _w}},Cw=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):vw}},ww=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Cw(this,e,t,n)}_getDelegate(){return this._delegate??Sw}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},Tw=class e{constructor(){this._proxyLoggerProvider=new ww}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return bw[yw]?this.getLoggerProvider():(bw[yw]=xw(1,e,Sw),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return bw[yw]?.call(bw,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete bw[yw],this._proxyLoggerProvider=new ww}}.getInstance();function Ew(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 Dw(e){e.forEach(e=>e.disable())}x();function Ow(e){let t=e.tracerProvider||_.getTracerProvider(),n=e.meterProvider||se.getMeterProvider(),r=e.loggerProvider||Tw.getLoggerProvider(),i=e.instrumentations?.flat()??[];return Ew(i,t,n,r),()=>{Dw(i)}}x();var kw=/^(?: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-]+)*))?$/,Aw=/^(?<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-]+)*))?$/,jw={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Mw(e,t,n){if(!Nw(e))return h.error(`Invalid version: ${e}`),!1;if(!t)return!0;t=t.replace(/([<>=~^]+)\s+/g,`$1`);let r=Bw(e);if(!r)return!1;let i=[],a=Pw(r,t,i,n);return a&&!n?.includePrerelease?Lw(r,i):a}function Nw(e){return typeof e==`string`&&kw.test(e)}function Pw(e,t,n,r){if(t.includes(`||`)){let i=t.trim().split(`||`);for(let t of i)if(Fw(e,t,n,r))return!0;return!1}if(t.includes(` - `))t=mT(t,r);else if(t.includes(` `)){let i=t.trim().replace(/\s{2,}/g,` `).split(` `);for(let t of i)if(!Fw(e,t,n,r))return!1;return!0}return Fw(e,t,n,r)}function Fw(e,t,n,r){if(t=Rw(t,r),t.includes(` `))return Pw(e,t,n,r);{let r=Vw(t);return n.push(r),Iw(e,r)}}function Iw(e,t){if(t.invalid)return!1;if(!t.version||Hw(t.version))return!0;let n=Kw(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:Kw(r,i)}return jw[t.op]?.includes(n)}function Lw(e,t){return!e.prerelease||t.some(t=>t.prerelease&&t.version===e.version)}function Rw(e,t){return e=e.trim(),e=fT(e,t),e=dT(e),e=pT(e,t),e=e.trim(),e}function zw(e){return!e||e.toLowerCase()===`x`||e===`*`}function Bw(e){let t=e.match(kw);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 Vw(e){if(!e)return{};let t=e.match(Aw);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 Hw(e){return e===`*`||e===`x`||e===`X`}function Uw(e){let t=parseInt(e,10);return isNaN(t)?e:t}function Ww(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 Gw(e,t){if(Hw(e)||Hw(t))return 0;let[n,r]=Ww(Uw(e),Uw(t));return n>r?1:n<r?-1:0}function Kw(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=Gw(e[n]||`0`,t[n]||`0`);if(r!==0)return r}return 0}var qw=`[a-zA-Z0-9-]`,Jw=`0|[1-9]\\d*`,Yw=`\\d*[a-zA-Z-]${qw}*`,Xw=`((?:<|>)?=?)`,Zw=`(?:${Jw}|${Yw})`,Qw=`(?:-(${Zw}(?:\\.${Zw})*))`,$w=`${qw}+`,eT=`(?:\\+(${$w}(?:\\.${$w})*))`,tT=`${Jw}|x|X|\\*`,nT=`[v=\\s]*(${tT})(?:\\.(${tT})(?:\\.(${tT})(?:${Qw})?${eT}?)?)?`,rT=`^${Xw}\\s*${nT}$`,iT=new RegExp(rT),aT=`^\\s*(${nT})\\s+-\\s+(${nT})\\s*\$`,oT=new RegExp(aT),sT=`^(?:~>?)${nT}$`,cT=new RegExp(sT),lT=`^(?:\\^)${nT}$`,uT=new RegExp(lT);function dT(e){let t=cT;return e.replace(t,(e,t,n,r,i)=>{let a;return a=zw(t)?``:zw(n)?`>=${t}.0.0 <${+t+1}.0.0-0`:zw(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 fT(e,t){let n=uT,r=t?.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>{let o;return o=zw(t)?``:zw(n)?`>=${t}.0.0${r} <${+t+1}.0.0-0`:zw(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 pT(e,t){let n=iT;return e.replace(n,(e,n,r,i,a,o)=>{let s=zw(r),c=s||zw(i),l=c||zw(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 mT(e,t){let n=oT;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>(n=zw(r)?``:zw(i)?`>=${r}.0.0${t?.includePrerelease?`-0`:``}`:zw(a)?`>=${r}.${i}.0${t?.includePrerelease?`-0`:``}`:o?`>=${n}`:`>=${n}${t?.includePrerelease?`-0`:``}`,c=zw(l)?``:zw(u)?`<${+l+1}.0.0-0`:zw(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t?.includePrerelease?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()))}var hT=console.error.bind(console);function gT(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 _T=(e,t,n)=>{if(!e||!e[t]){hT(`no original function `+String(t)+` to wrap`);return}if(!n){hT(`no wrapper function`),hT(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){hT(`original object and wrapper must be functions`);return}let i=n(r,t);return gT(i,`__original`,r),gT(i,`__unwrap`,()=>{e[t]===i&&gT(e,t,r)}),gT(i,`__wrapped`,!0),gT(e,t,i),i},vT=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{hT(`must provide one or more modules to patch`),hT(Error().stack);return}if(!(t&&Array.isArray(t))){hT(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{_T(e,t,n)})})},yT=(e,t)=>{if(!e||!e[t]){hT(`no function to unwrap.`),hT(Error().stack);return}let n=e[t];if(!n.__unwrap)hT(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},bT=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{hT(`must provide one or more modules to patch`),hT(Error().stack);return}if(!(t&&Array.isArray(t))){hT(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{yT(e,t)})})};x();var xT=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=Tw.getLogger(e,t),this._updateMetricInstruments()}_wrap=_T;_unwrap=yT;_massWrap=vT;_massUnwrap=bT;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)}}},ST=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}}}})),CT=d(((e,t)=>{var n=c(`path`),r=c(`module`),i=ce()(`require-in-the-middle`),a=ST();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,``)}})),wT=class{hooks=[];children=new Map},TT=class{_trie=new wT;_counter=0;insert(e){let t=this._trie;for(let n of e.moduleName.split(`/`)){let e=t.children.get(n);e||(e=new wT,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))}},ET=CT(),DT=[`afterEach`,`after`,`beforeEach`,`before`,`describe`,`it`].every(e=>typeof global[e]==`function`),OT=class e{_moduleNameTrie=new TT;static _instance;constructor(){this._initialize()}_initialize(){new ET.Hook(null,{internals:!0},(e,t,n)=>{let r=kT(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 DT?new e:this._instance=this._instance??new e}};function kT(e){return Ne.sep===`/`?e:e.split(Ne.sep).join(`/`)}var AT=d((e=>{var t=[],n=new WeakMap,r=new Map,i=[];function a(e,t){return t===`module.exports`&&!Object.hasOwn(e,t)?e.default:e[t]}function o(e,t,r){return n.get(e).write(t,r)}function s(e,t,n){if(!(`value`in n))throw Error(`Getters/setters are not supported for exports property descriptors.`);return o(e,t,n.value)}var c={defineProperty:s,set:o};function l(e,a,o){let{namespace:s}=a;r.set(e,o),n.set(s,a);let l=new Proxy(s,c);t.forEach(t=>t(e,l,o)),i.push([e,l,o])}var u=[0,10,50],d=class{namespace=Object.create(null,{[Symbol.toStringTag]:{value:`Module`}});#e=Object.create(null);#t;#n;#r;constructor(e,t,n,r){if(this.#t=n,t!==void 0)for(let n=0;n<t.length;n++)this.#i(t[n],n,r?.[n]??e)}#i(e,t,n){let r;try{r=a(n,e),this.#t(t,r),this.namespace[e]=r}catch(e){if(!(e instanceof ReferenceError))throw e}r===void 0&&(this.#r??=[]).push(this.#a(e,t,n)),this.#e[e]=t}write(e,t){let n=this.#e[e];return n!==void 0&&(this.#t(n,t),this.#r!==void 0&&(this.#n??=Object.create(null),this.#n[e]=!0),this.namespace[e]=t),!0}#a(e,t,n){return()=>{if(this.#n?.[e]===!0)return!0;try{let r=a(n,e);return r!==void 0&&(this.#t(t,r),this.namespace[e]=r,!0)}catch(e){if(e instanceof ReferenceError)return!1;throw e}}}#o(){let e=this.#r;if(e===void 0)return;let t;for(let n of e)n()!==!0&&(t??=[]).push(n);this.#r=t}flush(){this.#r!==void 0&&queueMicrotask(()=>{this.#o(),this.#s(0)})}#s(e){if(this.#r===void 0)return;if(e>=u.length){this.#r=void 0;return}let t=setTimeout(()=>{this.#o(),this.#s(e+1)},u[e]);t&&typeof t.unref==`function`&&t.unref()}};e.register=l,e.ModuleBinder=d,e.importHooks=t,e.specifiers=r,e.toHook=i})),jT=d(((e,t)=>{var n=c(`path`),r=ST(),{fileURLToPath:i}=c(`url`),{MessageChannel:a}=c(`worker_threads`),{isBuiltin:o}=c(`module`);o||=()=>!0;var{importHooks:s,specifiers:l,toHook:u}=AT();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 MT(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 G(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var NT=jT();x();var K=class extends xT{_modules;_hooks=[];_requireInTheMiddleSingleton=OT.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(G(e[t])&&this._unwrap(e,t),Ae.isProxy(e)){let r=_T(Object.assign({},e),t,n);return Object.defineProperty(e,t,{value:r}),r}return _T(e,t,n)};_unwrap=(e,t)=>Ae.isProxy(e)?Object.defineProperty(e,t,{value:e[t]}):yT(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=Me(Ne.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 PT(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=Ne.normalize(n);return a.filter(t=>t.name===o&&PT(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&&Ne.isAbsolute(n)){let e=Ne.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=Ne.isAbsolute(e.name)?new ET.Hook([e.name],{internals:!0},n):this._requireInTheMiddleSingleton.register(e.name,n);this._hooks.push(r);let i=new NT.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 PT(e,t,n){return t===void 0?e.includes(`*`):e.some(e=>Mw(t,e,{includePrerelease:n}))}var q=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}},FT=In(process.versions.node),IT=FT.major,LT=FT.minor;x();var RT=FT.major===22&&FT.minor>=12||FT.major===23&&FT.minor>=2||FT.major>=24;function zT(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 po()||!!n.ignoreOutgoingRequests?.(e,yC(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:fe,http:Re};RT?VT(r):HT(r)}var BT;function VT(e){let{[_C]:t}=NC(e);BT&&C(_C,BT),Be(_C,t),BT=t}function HT(e){LC(Re,e)}var UT=`Http`;Object.assign(zT,{id:`${UT}.sentry`});var WT=U((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=rw(i),c=cw(a);return{name:UT,setup(e){r&&c.setup(e)},setupOnce(){s.setupOnce(),zT(o)},processEvent(e){return c.processEvent(e)}}}),GT=`sentry-trace`,KT=`baggage`,qT=`traceparent`;function JT(e,t,n){let r=nE(e.origin,e.path),{tracePropagationTargets:i,propagateTraceparent:a}=P()?.getOptions()||{};if(!Af(r,i,t))return;let o=n&&wo(n)&&R()?void 0:n,s=o?B(o,()=>Ef({propagateTraceparent:a})):Ef({propagateTraceparent:a});if(!s)return;let{"sentry-trace":c,baggage:l,traceparent:u}=s,d=Array.isArray(e.headers)?YT(e.headers):XT(e.headers);if(QT(d,GT),QT(d,KT),a&&QT(d,qT),$T(d,GT)===-1){c&&d.push(GT,c),u&&$T(d,`traceparent`)===-1&&d.push(`traceparent`,u);let e=$T(d,KT);if(l&&e===-1)d.push(KT,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=ZT(d)}function YT(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 XT(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 ZT(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===KT&&i){let t=hi(e[r+1],i);t&&(e[n+1]=t)}e.splice(r,2),r-=2}}function $T(e,t){return e.findIndex((e,n)=>n%2==0&&e===t)}function eE(e,t){let n=tE(e),r=t.statusCode,i=mb(r);Kf({category:`http`,data:{status_code:r,...n},type:`http`,level:i},{event:`response`,request:e,response:t})}function tE(e){try{let t=yf(nE(e.origin,e.path)),n={url:xf(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 nE(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 rE=`http.request.method_original`,iE=[],aE=new WeakMap,oE=new WeakMap,sE=new gb(100);function cE(e={}){iE.length||(uE(`undici:request:create`,t=>fE(e,t)),uE(`undici:client:sendHeaders`,t=>pE(e,t)),uE(`undici:request:headers`,t=>mE(e,t)),uE(`undici:request:trailers`,e=>hE(e)),uE(`undici:request:error`,e=>gE(e)))}function lE(e,t){try{return e()}catch(e){t(e);return}}function uE(e,t){let[n=0,r=0]=process.version.replace(`v`,``).split(`.`).map(e=>Number(e));n>18||n===18&&r>=19?iE.push(Qe.subscribe?.(e,t)):iE.push(Qe.channel(e).subscribe(t))}function dE(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 fE(e,{request:t}){let n=vE(t.origin,t.path),r=lE(()=>!!e.ignoreOutgoingRequests?.(n),e=>e&&$C&&A.error(`caught ignoreOutgoingRequests error: `,e)),i=po()||!!r;if(oE.set(t,i),!e.spans){e.tracePropagation!==!1&&!i&&JT(t,sE);return}if(t.method===`CONNECT`||r)return;let a;try{a=new Je(t.path,t.origin)}catch(e){$C&&A.warn(`could not determine url.full:`,e);return}let o=a.protocol.replace(`:`,``),s=_E(t.method),c={[Dc]:s,[rE]:t.method,[_l]:a.toString(),[vl]:a.pathname,[yl]:a.search,[bl]:o,[I]:`auto.http.otel.node_fetch`};if(n.startsWith(`data:`)){let e=Sf(n);c[`http.url`]=e,c[_l]=e,c[Br]=`${t.method||`GET`} ${e}`}let l={https:`443`,http:`80`},u=a.hostname,d=a.port||l[o];c[pl]=u,d&&!isNaN(Number(d))&&(c[ml]=Number(d));let f=dE(t).get(`user-agent`);f&&(c[xl]=Array.isArray(f)?f[f.length-1]:f);let p=P(),m=z({name:s===`_OTHER`?`HTTP`:s,kind:W.CLIENT,attributes:c,onlyIfParent:!p||!Ya(p)});lE(()=>e.requestHook?.(m,t),e=>e&&$C&&A.error(`caught requestHook error: `,e)),JT(t,sE,m),aE.set(t,m)}function pE(e,{request:t,socket:n}){let r=aE.get(t);if(!r)return;let{remoteAddress:i,remotePort:a}=n,o={[Wc]:i,[Gc]:a};if(e.headersToSpanAttributes?.requestHeaders){let n=new Set(e.headersToSpanAttributes.requestHeaders.map(e=>e.toLowerCase())),r=dE(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 mE(e,{request:t,response:n}){e.breadcrumbs!==!1&&!oE.get(t)&&eE(t,n);let r=aE.get(t);if(!r)return;let i={[Oc]:n.statusCode};if(lE(()=>e.responseHook?.(r,{request:t,response:n}),e=>e&&$C&&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 hE({request:e}){let t=aE.get(e);t&&(t.end(),aE.delete(e))}function gE({request:e,error:t}){let n=aE.get(e);n&&(n.setStatus({code:2,message:t.message}),n.end(),aE.delete(e))}function _E(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 vE(e,t=`/`){let n=`${e}`;return n.endsWith(`/`)&&t.startsWith(`/`)?`${n}${t.slice(1)}`:!n.endsWith(`/`)&&!t.startsWith(`/`)?`${n}/${t}`:`${n}${t}`}var yE=U(((e={})=>({name:`NodeFetch`,setupOnce(){cE(e)}})));x();function bE(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){h.warn(`Unknown value ${Oe(t)} for ${e}, expected a number, using defaults`);return}return n}function xE(e){let t=process.env[e];if(t!=null&&t.trim()!==``)return t}var SE=`[object Object]`,CE=`[object Null]`,wE=`[object Undefined]`,TE=Function.prototype.toString,EE=TE.call(Object),DE=Object.getPrototypeOf,OE=Object.prototype,kE=OE.hasOwnProperty,AE=Symbol?Symbol.toStringTag:void 0,jE=OE.toString;function ME(e){if(!NE(e)||PE(e)!==SE)return!1;let t=DE(e);if(t===null)return!0;let n=kE.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&TE.call(n)===EE}function NE(e){return typeof e==`object`&&!!e}function PE(e){return e==null?e===void 0?wE:CE:AE&&AE in Object(e)?FE(e):IE(e)}function FE(e){let t=kE.call(e,AE),n=e[AE],r=!1;try{e[AE]=void 0,r=!0}catch{}let i=jE.call(e);return r&&(t?e[AE]=n:delete e[AE]),i}function IE(e){return jE.call(e)}var LE=20;function RE(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=BE(t,e.shift(),0,n);return t}function zE(e){return HE(e)?e.slice():e}function BE(e,t,n=0,r){let i;if(!(n>LE)){if(n++,GE(e)||GE(t)||UE(t))i=zE(t);else if(HE(e)){if(i=e.slice(),HE(t))for(let e=0,n=t.length;e<n;e++)i.push(zE(t[e]));else if(WE(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]=zE(t[r]))}}}else if(WE(e)){if(WE(t)){if(!KE(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(GE(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(VE(e,s,r)||VE(t,s,r))delete i[s];else{if(WE(a)&&WE(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]=BE(i[s],c,n,r)}}}}else i=t}return i}}function VE(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 HE(e){return Array.isArray(e)}function UE(e){return typeof e==`function`}function WE(e){return!GE(e)&&!HE(e)&&!UE(e)&&typeof e==`object`}function GE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function KE(e,t){return!(!ME(e)||!ME(t))}x();var qE=u(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function JE(e){return e.getValue(qE)===!0}x();function YE(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!XE(n)){h.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!ZE(r)){h.warn(`Invalid attribute value set for key: ${n}`);continue}t[n]=Array.isArray(r)?r.slice():r}return t}function XE(e){return typeof e==`string`&&e!==``}function ZE(e){return e==null?!0:Array.isArray(e)?QE(e):$E(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($E(e)){t=e;continue}return!1}return!1}}return!0}function $E(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}x();function eD(){return e=>{h.error(tD(e))}}function tD(e){return typeof e==`string`?e:JSON.stringify(nD(e))}function nD(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 rD=eD();function iD(e){try{rD(e)}catch{}}var aD=`2.11.0`,oD=`process.runtime.name`;b();var sD={[g]:`opentelemetry`,[oD]:`node`,[ie]:ae,[ee]:aD},cD=performance,lD=9,uD=10**6,dD=10**lD;function fD(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*uD)]}function pD(e){return _D(fD(cD.timeOrigin),fD(typeof e==`number`?e:cD.now()))}function mD(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=dD),[n,r]}function hD(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function gD(e){return hD(e)||typeof e==`number`||e instanceof Date}function _D(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=dD&&(n[1]-=dD,n[0]+=1),n}var vD;function yD(){if(vD===void 0)try{let e=globalThis.process.argv0;vD=e?`unknown_service:${e}`:`unknown_service`}catch{vD=`unknown_service`}return vD}var bD=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;x(),b();var xD=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=wD(t),r._asyncAttributesPending=t.filter(([e,t])=>bD(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(bD(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=wD(this._rawAttributes),this._schemaUrl=TD(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,bD(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(bD(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=ED(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function SD(e,t){return xD.FromAttributeList(Object.entries(e),t)}function CD(){return SD({[te]:yD(),[ie]:sD[ie],[g]:sD[g],[ee]:sD[ee]})}function wD(e){return e.map(([e,t])=>bD(t)?[e,t.catch(t=>{h.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function TD(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 ED(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 DD=`exception`,OD=Symbol.for(`nodejs.util.inspect.custom`);function kD(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function AD(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 jD=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=cD.now(),this._performanceOffset=t-(this._performanceStartTime+cD.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(!ZE(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++),gD(t)&&(gD(n)||(n=t),t=void 0);let i=YE(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=YE(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=mD(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<=cD.now())return pD(e+this._performanceOffset);if(typeof e==`number`)return fD(e);if(e instanceof Date)return fD(e.getTime());if(hD(e))return e;if(this._startTimeProvided)return fD(Date.now());let t=cD.now()-this._performanceStartTime;return _D(this.startTime,fD(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(DD,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}[OD](e,t,n){return AD(`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:kD(this.resource)}},e,t,n)}},MD;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(MD||={});var ND=`otel.span.parent.origin`,PD=`otel.span.sampling_result`,FD=`otel.sdk.span.live`,ID=`otel.sdk.span.started`,LD=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(ID,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(FD,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=zD(t);if(this.startedSpans.add(1,{[ND]:RD(e),[PD]:n}),t===MD.NOT_RECORD)return()=>{};let r={[PD]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function RD(e){return e?e.isRemote?`remote`:`local`:`none`}function zD(e){switch(e){case MD.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case MD.RECORD:return`RECORD_ONLY`;case MD.NOT_RECORD:return`DROP`}}var BD=`2.11.0`;x();var VD=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`,BD);this._tracerMetrics=new LD(n)}startSpan(e,n={},r=l.active()){n.root&&(r=_.deleteSpan(r));let a=_.getSpan(r);if(JE(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:YE(e.attributes)})),v=YE(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=YE(Object.assign(v,y.attributes));return new jD({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)}[OD](e,t,n){return AD(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:kD(this._resource)},spanLimits:this._spanLimits},e,t,n)}},HD=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=>{iD(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)})}},UD=class{shouldSample(){return{decision:MD.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},WD=class{shouldSample(){return{decision:MD.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};x();var GD=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(iD(Error(`ParentBasedSampler must have a root sampler configured`)),new WD),this._remoteParentSampled=e.remoteParentSampled??new WD,this._remoteParentNotSampled=e.remoteParentNotSampled??new UD,this._localParentSampled=e.localParentSampled??new WD,this._localParentNotSampled=e.localParentNotSampled??new UD}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()}}`}},KD=8,qD=16,JD=class{generateTraceId=XD(qD);generateSpanId=XD(KD)},YD=Buffer.allocUnsafe(qD);function XD(e){return function(){for(let t=0;t<e/4;t++)YD.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(YD[t]>0);t++)t===e-1&&(YD[e-1]=1);return YD.toString(`hex`,0,e)}}x();var ZD;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(ZD||={});var QD=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(t={}){this._forceFlushTimeoutMillis=t.forceFlushTimeoutMillis??3e4,this._resource=t.resource??CD();let n=t.spanProcessors??[];this._activeSpanProcessor=new HD(n),this._tracerOptions={resource:this._resource,sampler:t.sampler??new GD({root:new WD}),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 JD,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 VD({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=ZD.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==ZD.timeout&&(r=ZD.resolved,n(r))}).catch(e=>{clearTimeout(i),r=ZD.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==ZD.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[OD](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return AD(`TracerProvider`,{resource:{attributes:kD(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};x();var $D=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?MD.RECORD_AND_SAMPLED:MD.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 eO;(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`})(eO||={});var tO=1;function nO(){return{sampler:rO(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:bE(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:bE(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:bE(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:bE(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:bE(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:bE(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:bE(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:bE(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function rO(){let e=xE(`OTEL_TRACES_SAMPLER`)??eO.ParentBasedAlwaysOn;switch(e){case eO.AlwaysOn:return new WD;case eO.AlwaysOff:return new UD;case eO.ParentBasedAlwaysOn:return new GD({root:new WD});case eO.ParentBasedAlwaysOff:return new GD({root:new UD});case eO.TraceIdRatio:return new $D(iO());case eO.ParentBasedTraceIdRatio:return new GD({root:new $D(iO())});default:return h.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${eO.ParentBasedAlwaysOn}".`),new GD({root:new WD})}}function iO(){let e=bE(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(h.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${tO}.`),tO):e<0||e>1?(h.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${tO}.`),tO):e}function aO(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??bE(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??bE(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??bE(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??bE(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}var oO=class extends QD{constructor(e={}){let t=RE({},nO(),aO(e));delete t.generalLimits,super(t)}};x();var sO=u(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function cO(e){return e.setValue(sO,!0)}function lO(e){return e.getValue(sO)===!0}var uO=`baggage`,dO=4096;x();function fO(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function pO(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 mO(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 hO(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=mO(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 gO=class{inject(e,t,n){let r=p.getBaggage(e);if(!r||lO(e))return;let i=fO(pO(r).filter(e=>e.length<=dO).slice(0,180));i.length>0&&n.set(t,uO,i)}extract(e,t,n){let r=n.get(t,uO);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=hO(r[e],i,a,o);else[a]=hO(r,i,a,o);return a===0?e:p.setBaggage(e,p.createBaggage(i))}fields(){return[uO]}},_O=`2.11.0`,vO=`process.runtime.name`;b();var yO={[g]:`opentelemetry`,[vO]:`node`,[ie]:ae,[ee]:_O};x();var bO=`sentry.parentIsRemote`,xO=`sentry.graphql.operation`;function SO(e){if(`parentSpanId`in e)return e.parentSpanId;if(`parentSpanContext`in e)return e.parentSpanContext?.spanId}function CO(e){return j(e.attributes)}function wO(e){return typeof e.kind==`number`}function TO(e){return!!e.status}function EO(e){return!!e.name}function DO(e){if(!CO(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=yf(t);n.url=xf(e),e.search&&(n[`http.query`]=e.search),e.hash&&(n[`http.fragment`]=e.hash)}}catch{}return n}function OO(e){return wO(e)?e.kind:t.INTERNAL}var kO=`sentry-trace`,AO=`baggage`,jO=`sentry.dsc`,MO=`sentry.sampled_not_recording`,NO=`sentry.url`,PO=`sentry.sample_rand`,FO=`sentry.sample_rate`,IO=`sentry.ignored`,LO=`sentry.segment_ignored`,RO=u(`sentry_scopes`),zO=u(`sentry_fork_isolation_scope`),BO=u(`sentry_fork_set_scope`),VO=u(`sentry_fork_set_isolation_scope`),HO=`_scopeContext`;function UO(e){return e.getValue(RO)}function WO(e,t){return e.setValue(RO,t)}function GO(e,t){Jt(e,HO,Zn(t))}function KO(e){return Qn(e[HO])}function qO(e){let{traceFlags:t,traceState:n}=e,r=n?n.get(MO)===`1`:!1;if(t===i.SAMPLED)return!0;if(r)return!1;let a=n?n.get(jO):void 0,o=a?ui(a):void 0;if(o?.sampled===`true`)return!0;if(o?.sampled===`false`)return!1}function JO(e,t){let n=e.spanContext(),r=ra(e),i=qO(n);if(i!==void 0)return i;if(wo(r))return!1;if(sa(t?.getOptions())&&!n.isRemote&&Ji(r))return Yi(e)}function YO(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 ZO({attributes:t,name:e});let o=t[`sentry.source`]===`custom`?`custom`:`route`;if(t[`rpc.service`])return{...tk(e,t,`route`),op:`rpc`};if(t[`messaging.system`])return{...tk(e,t,o),op:`message`};let s=t[Xs];return s?{...tk(e,t,o),op:s.toString()}:{op:void 0,description:e,source:`custom`}}function XO(e){let t,n;if(CO(e))t=e.attributes,n=EO(e)?e.name:`<unknown>`;else{let r=typeof e.spanContext==`function`?L(e):void 0;t=r?.data||{},n=EO(e)?e.name:r?.description||`<unknown>`}let r=OO(e);return YO(n,t,r)}function ZO({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[Bs];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}=ek(r,n);if(!o)return{...tk(e,r),op:a.join(`.`)};let d=r[xO],f=`${i} ${o}`,p=d?`${f} (${$O(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}:tk(e,r);return{op:a.join(`.`),description:ee,source:b,data:h}}function $O(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 ek(e,n){let r=e[Mc],i=e[`http.url`]||e[`url.full`],a=e[kc],o=typeof i==`string`?yf(i):void 0,s=o?xf(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:bf(r),url:s,query:c,fragment:l,hasRoute:!1}:o?{urlPath:s,url:s,query:c,fragment:l,hasRoute:!1}:typeof r==`string`?{urlPath:bf(r),url:s,query:c,fragment:l,hasRoute:!1}:{urlPath:void 0,url:s,query:c,fragment:l,hasRoute:!1}}function tk(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 nk(e){e.on(`createDsc`,(t,n)=>{if(!n)return;let r=L(n),i=r.data[kr],a=JO(n,e);if(a===!1)delete t.transaction;else if(r.description){let{description:e}=XO(n);i!==`url`&&e&&(t.transaction=e)}sa()&&(t.sampled=a==null?void 0:String(a))})}function rk(){return _.getActiveSpan()}var ik=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,ak=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 ok({dsc:e,sampled:t}){let n=e?di(e):void 0,r=new ak,i=n?r.set(jO,n):r;return t===!1?i.set(MO,`1`):i}var sk=new Set;function ck(){return Array.from(sk)}function lk(e){sk.add(e)}var uk=class extends gO{constructor(){super(),lk(`SentryPropagator`),this._urlMatchesTargetsMap=new gb(100)}inject(e,t,n){if(lO(e)){ik&&A.log(`[Tracing] Not injecting trace data for url because tracing is suppressed.`);return}let r=_.getSpan(e),i=r&&_k(r),{tracePropagationTargets:a,propagateTraceparent:o}=P()?.getOptions()||{};if(!Af(i,a,this._urlMatchesTargetsMap)){ik&&A.log(`[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:`,i);return}let s=hk(t),c=gk(t),l=p.getBaggage(e)||p.createBaggage({}),{dynamicSamplingContext:u,traceId:d,spanId:f,sampled:m}=dk(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,kO,ji(d,f,m)),o&&n.set(t,`traceparent`,Mi(d,f,m))),super.inject(p.setBaggage(e,l),t,n)}extract(e,t,n){let r=n.get(t,kO),i=n.get(t,AO);return mk(fk(e,{sentryTrace:r?Array.isArray(r)?r[0]:r:void 0,baggage:i}))}fields(){return[kO,AO,`traceparent`]}};function dk(e,t={}){let n=_.getSpan(e);if(n?.spanContext().isRemote){let e=n.spanContext();return{dynamicSamplingContext:xa(n),traceId:e.traceId,spanId:void 0,sampled:qO(e)}}if(n){let e=n.spanContext();return{dynamicSamplingContext:xa(n),traceId:e.traceId,spanId:e.spanId,sampled:JO(n,t.client)}}let r=t.scope||UO(e)?.scope||M(),i=t.client||P(),a=r.getPropagationContext();return{dynamicSamplingContext:i?ba(i,r):void 0,traceId:a.traceId,spanId:a.propagationSpanId,sampled:a.sampled}}function fk(e,{sentryTrace:t,baggage:n}){let{traceId:r,parentSpanId:i,sampled:a,dsc:o}=Ai(t,n),s=P(),c=ui(n);if(!i||s&&!Pi(s,c?.org_id))return e;let l=vk({traceId:r,spanId:i,sampled:a,dsc:o});return _.setSpanContext(e,l)}function pk(e,t,n){let r=mk(fk(e,t));return l.with(r,n)}function mk(e){let t=UO(e);return WO(e,{scope:t?t.scope:M().clone(),isolationScope:t?t.isolationScope:N()})}function hk(e){try{let t=e[AO];return Array.isArray(t)?t.join(`,`):t}catch{return}}function gk(e){try{return e[kO]}catch{return}}function _k(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(NO);if(r)return r}function vk({spanId:e,traceId:t,sampled:n,dsc:r}){let a=ok({dsc:r,sampled:n});return{traceId:t,spanId:e,isRemote:!0,traceFlags:n?i.SAMPLED:i.NONE,traceState:a}}function yk(e,t,n){let r=wk(),{name:i,parentSpan:a}=e;return Nk(a)(()=>{let a=Ok(e.scope,e.forceTransaction),o=e.onlyIfParent&&!_.getSpan(a),s=o?cO(a):a;o&&P()?.recordDroppedEvent(`no_parent_span`,`span`);let c=Tk(e);if(!sa()){let e=lO(s)?s:cO(s);return l.with(e,()=>r.startActiveSpan(i,c,e,e=>(Dk(e),l.with(a,()=>no(()=>t(e),()=>{L(e).status===void 0&&e.setStatus({code:oe.ERROR})},n?()=>e.end():void 0)))))}return r.startActiveSpan(i,c,s,e=>(Dk(e),no(()=>t(e),()=>{L(e).status===void 0&&e.setStatus({code:oe.ERROR})},n?()=>e.end():void 0)))})}function bk(e,t){return yk(e,t,!0)}function xk(e,t){return yk(e,e=>t(e,()=>e.end()),!1)}function Sk(e){let t=wk(),{name:n,parentSpan:r}=e;return Nk(r)(()=>{let r=Ok(e.scope,e.forceTransaction),i=e.onlyIfParent&&!_.getSpan(r),a=i?cO(r):r;i&&P()?.recordDroppedEvent(`no_parent_span`,`span`);let o=Tk(e);sa()||(a=lO(a)?a:cO(a));let s=t.startSpan(n,o,a);return Dk(s),s})}function Ck(e,t){let n=e?_.setSpan(l.active(),e):_.deleteSpan(l.active());return l.with(n,()=>t(M()))}function wk(){return P()?.tracer||_.getTracer(`@sentry/opentelemetry`,`10.74.0`)}function Tk(e){let{startTime:t,attributes:n,kind:r,op:i,links:a}=e,o=typeof t==`number`?Ek(t):t;return{attributes:i?{[F]:i,...n}:n,kind:r,links:a,startTime:o}}function Ek(e){return e<9999999999?e*1e3:e}function Dk(e){let t=e.end.bind(e);e.end=e=>t(typeof e==`number`?Ek(e):e)}function Ok(e,t){let n=kk(e),r=_.getSpan(n);if(!r||!t)return n;let a=_.deleteSpan(n),{spanId:o,traceId:s}=r.spanContext(),c=qO(r.spanContext()),l=ok({dsc:xa(ra(r)),sampled:c}),u={traceId:s,spanId:o,isRemote:!0,traceFlags:c?i.SAMPLED:i.NONE,traceState:l};return _.setSpanContext(a,u)}function kk(e){if(e){let t=KO(e);if(t)return t}return l.active()}function Ak(e,t){return pk(l.active(),e,t)}function jk(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 Mk(e,t){let n=KO(t),r=n&&_.getSpan(n),i=r?Li(r):Or(t);return[r?xa(r):ba(e,t),i]}function Nk(e){return e===void 0?e=>e():t=>Ck(e,t)}function Pk(e){let t=cO(l.active());return l.with(t,e)}function Fk(e){let t=e?KO(e):l.active();return t?lO(t):!1}function Ik(e){e.on(`preprocessEvent`,e=>{let t=rk();return!t||e.type===`transaction`?void 0:(e.contexts={trace:Li(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:xa(ra(t)),...e.sdkProcessingMetadata},e)})}function Lk(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=UO(r),a=i?.scope||M(),o=i?.isolationScope||N(),s=r.getValue(zO)===!0,c=r.getValue(BO),l=r.getValue(VO),u=c||a.clone(),d={scope:u,isolationScope:l||(s?o.clone():o)},f=WO(r,d).deleteValue(zO).deleteValue(BO).deleteValue(VO);return GO(u,f),f}function Rk(e){let t=new Map;for(let n of e)Bk(t,n);return Array.from(t,function([e,t]){return t})}function zk(e){return e.attributes[bO]===!0?void 0:SO(e)}function Bk(e,t){let n=t.spanContext().spanId,r=zk(t);if(!r){Hk(e,{id:n,span:t,children:[]});return}let i=Vk(e,r),a=Hk(e,{id:n,span:t,parentNode:i,children:[]});i.children.push(a)}function Vk(e,t){return e.get(t)||Hk(e,{id:t,children:[]})}function Hk(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 Uk={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`},Wk=e=>Object.values(Uk).includes(e);function Gk(e){let t=CO(e)?e.attributes:{},n=TO(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=Kk(t);if(e)return e}return n.message&&Wk(n.message)?{code:2,message:n.message}:{code:2,message:`internal_error`}}}return Kk(t)||(n?.code===oe.UNSET?{code:1}:{code:2,message:`unknown_error`})}function Kk(e){let t=e[`http.response.status_code`]||e[`http.status_code`],n=e[tl],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:Uk[n]||`unknown_error`}}var qk=1e3,Jk=300,Yk=1e4,Xk=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||Jk,this._finishedSpanBuckets=Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(an()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new gb(Yk),this._debouncedFlush=To(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&&ik&&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=zk(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;ik&&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=Rk(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)$k(t,i,n)&&(a=!0);r.spans=i.length>qk?i.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,qk):i,a&&(r.sdkProcessingMetadata={...r.sdkProcessingMetadata,hasGenAiSpans:!0});let o=Ka(t.events);o&&(r.measurements=o),$l(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 Zk(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}=eA(e),o=ni(e),s=e.attributes[Ar],c={[kr]:a,[Ar]:s,[F]:t,[I]:i,...r,...tA(e.attributes)},{links:l}=e,{traceId:u,spanId:d}=e.spanContext(),f={parent_span_id:SO(e),span_id:d,trace_id:u,data:c,origin:i,op:t,status:Xi(Gk(e)),links:Bi(l)},p=c[Oc],m=typeof p==`number`?{response:{status_code:p}}:void 0;return{contexts:{trace:f,otel:{resource:e.resource.attributes},...m},spans:[],start_timestamp:Hi(e.startTime),timestamp:Hi(e.endTime),transaction:n,type:`transaction`,sdkProcessingMetadata:{capturedSpanScope:o.scope,capturedSpanIsolationScope:o.isolationScope,sampleRate:s,dynamicSamplingContext:xa(e)},...a&&{transaction_info:{source:a}}}}function $k(e,t,n){let r=e.span;if(r&&n.add(r),!r){let r=!1;return e.children.forEach(e=>{$k(e,t,n)&&(r=!0)}),r}let i=r.spanContext().spanId,a=r.spanContext().traceId,o=SO(r),{attributes:s,startTime:c,endTime:l,links:u}=r,{op:d,description:f,data:p,origin:m=`manual`}=eA(r),h={[I]:m,[F]:d,...tA(s),...p},g=Gk(r),_={span_id:i,trace_id:a,data:h,description:f,parent_span_id:o,start_timestamp:Hi(c),timestamp:Hi(l)||void 0,status:Xi(g),op:d,origin:m,measurements:Ka(r.events),links:Bi(u)};t.push(_);let v=!!d?.startsWith(`gen_ai.`);return e.children.forEach(e=>{$k(e,t,n)&&(v=!0)}),v}function eA(e){let{op:t,source:n,origin:r}=Zk(e),{op:i,description:a,source:o,data:s}=XO(e);return{op:t||i,description:a,source:n||o,origin:r,data:{...s,...nA(e)}}}function tA(e){let t={...e};return delete t[Ar],delete t[bO],delete t[Br],t}function nA(e){let n=e.attributes,r={};e.kind!==t.INTERNAL&&(r[`otel.kind`]=t[e.kind]);let i=n[jc];i&&(r[Oc]=i);let a=DO(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 rA(e,t){let n=e.attributes??{},r=t?.spanKind??W.INTERNAL,{op:i,description:a,source:o,data:s}=YO(e.name,n,r);e.name=a,wl(e,{[F]:i,[kr]:o,[sl]:`manual`,...s}),r!==W.INTERNAL&&wl(e,{"otel.kind":Wf(r)})}var iA=class{constructor(e){this._unsubscribePreprocessSpan=void 0,lk(`SentrySpanProcessor`),this._exporter=new Xk(e),this._client=e?.client??P(),this._client&&Ya(this._client)&&(this._unsubscribePreprocessSpan=this._client.on(`preprocessSpan`,rA))}async forceFlush(){this._exporter.flush()}async shutdown(){this._unsubscribePreprocessSpan?.(),this._exporter.clear()}onStart(e,t){let n=_.getSpan(t),i=UO(t);n&&!n.spanContext().isRemote&&ta(n,e),n?.spanContext().isRemote&&e.setAttribute(bO,!0),t===r&&(i={scope:ir(),isolationScope:ar()}),i&&ti(e,i.scope,i.isolationScope),Ua(e),this._client?.emit(`spanStart`,e)}onEnd(e){Wa(e),this._client?.emit(`spanEnd`,e),this._client&&Ya(this._client)?this._client.emit(`afterSpanEnd`,e):this._exporter.export(e)}},aA=class{constructor(e){this._client=e,this._isSpanStreaming=Ya(e),lk(`SentrySampler`)}shouldSample(e,n,r,i,a,o){let s=this._client.getOptions(),{ignoreSpans:c}=s,l=lA(e),u=l?.spanContext();if(!sa(s))return sA({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`),sA({decision:void 0,context:e,spanAttributes:a});let f=l?oA(l,n,r):void 0;if(l&&!u?.isRemote){if(this._isSpanStreaming){if(f&&c?.length){let{description:t,op:n}=YO(r,a,i);if(la({description:t,op:a[`sentry.op`]??n,attributes:a},c))return this._client.recordDroppedEvent(`ignored`,`span`),sA({decision:MD.NOT_RECORD,context:e,spanAttributes:a,ignoredChildSpan:!0})}if(!f){let e=u?.traceState?.get(LO)===`1`;this._client.recordDroppedEvent(e?`ignored`:`sample_rate`,`span`)}}return sA({decision:f?MD.RECORD_AND_SAMPLED:MD.NOT_RECORD,context:e,spanAttributes:a})}let{description:p,data:m,op:h}=YO(r,a,i),g={...m,...a};if(h&&(g[F]=h),this._isSpanStreaming&&c?.length&&la({description:p,op:g[`sentry.op`]??h,attributes:g},c))return this._client.recordDroppedEvent(`ignored`,`span`),sA({decision:MD.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 sA({decision:void 0,context:e,spanAttributes:a});let{isolationScope:v}=UO(e)??{},y=u?.traceState?u.traceState.get(jO):void 0,ee=y?ui(y):void 0,b=Ei(ee?.sample_rand)??rn(),[te,x,ne]=io(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`?(ik&&A.log(`[Tracing] Not sampling span because HTTP method is '${re}' for ${r}`),sA({decision:MD.NOT_RECORD,context:e,spanAttributes:a,sampleRand:b,downstreamTraceSampleRate:0})):(!te&&f===void 0&&(ik&&A.log(`[Tracing] Discarding root span because its trace was not chosen to be sampled.`),this._client.recordDroppedEvent(`sample_rate`,this._isSpanStreaming?`span`:`transaction`)),{...sA({decision:te?MD.RECORD_AND_SAMPLED:MD.NOT_RECORD,context:e,spanAttributes:a,sampleRand:b,downstreamTraceSampleRate:ne?x:void 0}),attributes:{[Ar]:ne?x:void 0}})}toString(){return`SentrySampler`}};function oA(e,t,n){let r=e.spanContext();if(y(r)&&r.traceId===t){if(r.isRemote){let t=qO(e.spanContext());return ik&&A.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${t}`),t}let t=qO(r);return ik&&A.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${t}`),t}}function sA({decision:e,context:t,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:i,ignoredChildSpan:a,ignoredSegmentSpan:o}){let s=cA(t,n);return i!==void 0&&(s=s.set(FO,`${i}`)),r!==void 0&&(s=s.set(PO,`${r}`)),a&&(s=s.set(IO,`1`)),o&&(s=s.set(LO,`1`)),e==null?{decision:MD.NOT_RECORD,traceState:s}:e===MD.NOT_RECORD?{decision:e,traceState:s.set(MO,`1`)}:{decision:e,traceState:s}}function cA(e,t){let n=_.getSpan(e)?.spanContext()?.traceState||new ak,r=t[`http.url`]||t[`url.full`];return r&&typeof r==`string`&&(n=n.set(NO,r)),n}function lA(e){let t=_.getSpan(e);return t&&y(t.spanContext())?t:void 0}function uA(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=YO(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){pA(e,i);let t=P();fA(e,i,r.status,!!t&&Ya(t))}o&&u.description!==r.description&&(i[`sentry.source`]!==`custom`||c)&&e.updateName(u.description)}function dA(e,n){Jt(e,`kind`,n??t.INTERNAL)}function fA(e,t,n,r){if(n===void 0){e.setStatus(Kk(t)||{code:1});return}!r&&n!==`ok`&&!Wk(n)&&e.setStatus({code:2,message:`internal_error`})}function pA(e,t){let n=t[jc];t[`http.response.status_code`]===void 0&&n!==void 0&&(e.setAttribute(Oc,n),t[Oc]=n)}var mA=class{startSpan(e,t={},n){let r=n||l.active(),i=t.root?void 0:_.getSpan(r);if(lO(r))return this._createNonRecordingSpan(i);let a=this._startSentrySpan(e,t,i,n!==void 0);return si(a),dA(a,t.kind),t.attributes?.[`sentry.source`]===void 0&&ri(a),uA(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(VO,c):e;return wo(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?mo(()=>co({...i,parentSpan:null})):n?.spanContext().isRemote?this._startRootSpanWithRemoteParent(i,n):n?co({...i,parentSpan:n}):mo(()=>co({...i,parentSpan:r?null:void 0}))}_startRootSpanWithRemoteParent(e,t){let{spanId:n,traceId:r,traceState:i}=t.spanContext(),a=xa(t),o=typeof a.sample_rand==`string`?Number(a.sample_rand):void 0,s=!!i?.get(jO);return Er(i=>(i.setPropagationContext({traceId:r,parentSpanId:n,sampled:qO(t.spanContext()),dsc:s?a:void 0,sampleRand:typeof o==`number`&&!Number.isNaN(o)?o:rn()}),er(i,void 0),co({...e,parentSpan:null})))}_createNonRecordingSpan(e){let t=new ma({traceId:e?.spanContext().traceId});return e&&ta(e,t),ti(t,M(),N()),t}},hA=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 mA;return this._tracers.set(r,a),a}forceFlush(){return Promise.resolve()}shutdown(){return Promise.resolve()}},gA=`telemetry.sdk.language`,_A=`telemetry.sdk.name`,vA=`telemetry.sdk.version`,yA=`service.namespace`,bA=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 xA(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 SA(e){let t=typeof process<`u`?process.env:{},n=t.OTEL_SERVICE_NAME,r=xA(t.OTEL_RESOURCE_ATTRIBUTES);return new bA({[yA]:`sentry`,[hl]:e,...r,...n?{[hl]:n}:{},[gl]:k,[gA]:yO[gA],[_A]:yO[_A],[vA]:yO[vA]})}function CA({span:e,scope:t,client:n,propagateTraceparent:r}={}){let i=(t&&KO(t))??l.active();if(e){let{scope:t}=ni(e);i=t&&KO(t)||_.setSpan(l.active(),e)}let{traceId:a,spanId:o,sampled:s,dynamicSamplingContext:c}=dk(i,{scope:t,client:n}),u={"sentry-trace":ji(a,o,s),baggage:di(c)};return r&&(u.traceparent=Mi(a,o,s)),u}function wA(e){function t(){return UO(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=KO(e)||l.active();return l.with(n.setValue(BO,e),()=>t(e))}function i(e){let t=l.active();return l.with(t.setValue(zO,!0),()=>{let t=o();return ki(t.getPropagationContext())||t.setPropagationContext({traceId:Yn(),sampleRand:rn()}),e(s())})}function a(e,t){let n=l.active();return l.with(n.setValue(VO,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:bk,startSpanManual:xk,startInactiveSpan:Sk,getActiveSpan:rk,suppressTracing:Pk,isTracingSuppressed:Fk,getTraceData:CA,continueTrace:Ak,startNewTrace:jk,withActiveSpan:Ck,getTracingChannelBinding:e?.getTracingChannelBinding})}x();var TA=[`addListener`,`on`,`once`,`prependListener`,`prependOnceListener`],EA=class{constructor(){this._kOtListeners=Symbol(`OtListeners`),this._wrapped=!1,lk(`SentryContextManager`),this._asyncLocalStorage=_r(it()).getTracingChannelBinding?.()?.asyncLocalStorage??new Ke}active(){return this._asyncLocalStorage.getStore()??r}with(e,t,n,...r){let i=Lk(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 de?this._bindEventEmitter(e,t):typeof t==`function`?this._bindFunction(e,t):t}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:RO}}_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 TA)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 DA(e){wA({getTracingChannelBinding:e?.skipOpenTelemetrySetup?kA():OA()})}function OA(){let e=new Ke;return()=>({asyncLocalStorage:e,getStoreWithActiveSpan:AA})}function kA(){return()=>{try{let e=l._getContextManager()?.getAsyncLocalStorageLookup().asyncLocalStorage;return e?{asyncLocalStorage:e,getStoreWithActiveSpan:AA}:void 0}catch{return}}}function AA(e){let t=l.active();return wo(e)&&ra(e)!==e||e.spanContext().traceState?.get(`sentry.ignored`)===`1`?t:_.setSpan(t,e)}var jA=EA;x();function MA(){h.disable(),h.setLogger({error:A.error,warn:A.warn,info:A.log,debug:A.log,verbose:A.log},ne.DEBUG)}var NA={};function J(e,t,n){return n?FA(e,t,n):PA(e,t)}function PA(e,t){return Object.assign(n=>{let r=NA[e];if(r)return n&&r.setConfig(n),r;let i=t(n);return NA[e]=i,Ow({instrumentations:[i]}),i},{id:e})}function FA(e,t,n){return Object.assign(r=>{let i=n(r),a=NA[e];if(a)return a.setConfig(i),a;let o=new t(i);return NA[e]=o,Ow({instrumentations:[o]}),o},{id:e})}var IA=`ChildProcess`,LA=U((e={})=>({name:IA,setup(){S.channel(`child_process`).subscribe(t=>{j(t)&&`process`in t&&RA(t.process,e)}),S.channel(`worker_threads`).subscribe(t=>{j(t)&&`worker`in t&&zA(t.worker,e)})}}));function RA(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&&Kf({category:`child_process`,message:`Child process exited with code '${e}'`,level:e===0?`info`:`warning`,data:r}))}).on(`error`,e=>{n||(n=!0,Kf({category:`child_process`,message:`Child process errored with '${e.message}'`,level:`error`,data:r}))})}function zA(e,t){let n;e.on(`online`,()=>{n=e.threadId}).on(`error`,e=>{t.captureWorkerErrors===!1?Kf({category:`worker_thread`,message:`Worker thread errored with '${e.message}'`,level:`error`,data:{threadId:n}}):V(e,{mechanism:{type:`auto.child_process.worker_thread`,handled:!1,data:{threadId:String(n)}}})})}var BA=Ee(be),VA=Ee(Se),HA=`Context`,UA=U(((e={})=>{let t={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e},n=t.app?YA():void 0,r=t.device?XA(t.device):void 0,i=t.culture?JA():void 0,a=t.cloudResource?ij():void 0,o=t.os?qA():void 0,s={"process.runtime.engine.name":`v8`,"process.runtime.engine.version":process.versions.v8,...GA({app:n,device:r,culture:i,cloud_resource:a})};o&&o.then(e=>Object.assign(s,GA({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=WA(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:HA,processEvent(e){return l(e)},processSegmentSpan(e){wl(e,s),wl(e,KA(n,r))}}}));function WA(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory==`function`){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=qe.freemem()),e}function GA(e){let t={},{app:n,device:r,os:i,culture:a,cloud_resource:o}=e;if(n&&n.app_start_time&&(t[`app.start_time`]=n.app_start_time),r&&(r.arch&&(t[`device.archs`]=[r.arch]),r.boot_time&&(t[`device.boot_time`]=r.boot_time),r.memory_size!=null&&(t[`device.memory_size`]=r.memory_size),r.processor_count!=null&&(t[`device.processor_count`]=r.processor_count),r.cpu_description&&(t[`device.cpu_description`]=r.cpu_description),r.processor_frequency!=null&&(t[`device.processor_frequency`]=r.processor_frequency)),i&&(i.name&&(t[`os.name`]=i.name),i.version&&(t[`os.version`]=i.version),i.kernel_version&&(t[`os.kernel_version`]=i.kernel_version),i.build&&(t[`os.build`]=i.build)),a&&(a.locale&&(t[`culture.locale`]=a.locale),a.timezone&&(t[`culture.timezone`]=a.timezone)),o)for(let[e,n]of Object.entries(o))n!=null&&(t[e]=n);return t}function KA(e,t){let n={};if(e&&(n[`app.memory`]=process.memoryUsage().rss,typeof process.availableMemory==`function`)){let e=process.availableMemory?.();e!=null&&(n[`app.free_memory`]=e)}return t?.free_memory!=null&&(n[`device.free_memory`]=qe.freemem()),n}async function qA(){let e=qe.platform();switch(e){case`darwin`:return tj();case`linux`:return rj();default:return{name:ZA[e]||e,version:qe.release()}}}function JA(){try{if(typeof process.versions.icu!=`string`)return;let e=new Date(9e8);if(new Intl.DateTimeFormat(`es`,{month:`long`}).format(e)===`enero`){let e=Intl.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone}}}catch{}}function YA(){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 XA(e){let t={},n;try{n=qe.uptime()}catch{}if(typeof n==`number`&&(t.boot_time=new Date(Date.now()-n*1e3).toISOString()),t.arch=qe.arch(),(e===!0||e.memory)&&(t.memory_size=qe.totalmem(),t.free_memory=qe.freemem()),e===!0||e.cpu){let e=qe.cpus(),n=e?.[0];n&&(t.processor_count=e.length,t.cpu_description=n.model,t.processor_frequency=n.speed)}return t}var ZA={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`]}],$A={alpine:e=>e,arch:e=>ej(/distrib_release=(.*)/,e),centos:e=>ej(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>ej(/release (..)/,e),mint:e=>ej(/distrib_release=(.*)/,e),red:e=>ej(/release ([^ ]+)/,e),suse:e=>ej(/VERSION = (.*)\n/,e),ubuntu:e=>ej(/distrib_release=(.*)/,e)};function ej(e,t){let n=e.exec(t);return n?n[1]:void 0}async function tj(){let e={kernel_version:qe.release(),name:`Mac OS X`,version:`10.${Number(qe.release().split(`.`)[0])-4}`};try{let t=await new Promise((e,t)=>{pe(`/usr/bin/sw_vers`,(n,r)=>{if(n){t(n);return}e(r)})});e.name=ej(/^ProductName:\s+(.*)$/m,t),e.version=ej(/^ProductVersion:\s+(.*)$/m,t),e.build=ej(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function nj(e){return e.split(` `)[0].toLowerCase()}async function rj(){let e={kernel_version:qe.release(),name:`Linux`};try{let t=await VA(`/etc`),n=QA.find(e=>t.includes(e.name));if(!n)return e;let r=(await BA(he(`/etc`,n.name),{encoding:`utf-8`})).toLowerCase(),{distros:i}=n;e.name=i.find(e=>r.indexOf(nj(e))>=0)||i[0],e.version=$A[nj(e.name)]?.(r)}catch{}return e}function ij(){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 aj=new gb(10),oj=new gb(20),sj=7,cj=`ContextLines`;function lj(e,t,n){let r=e.get(t);return r===void 0?(e.set(t,n),n):r}function uj(e){return!!(e.startsWith(`node:`)||e.endsWith(`.min.js`)||e.endsWith(`.min.cjs`)||e.endsWith(`.min.mjs`)||e.startsWith(`data:`))}function dj(e){return e.lineno!==void 0&&e.lineno>1e4||e.colno!==void 0&&e.colno>1e3}function fj(e,t){let n=aj.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 pj(e,t){if(!e.length)return[];let n=0,r=e[0];if(typeof r!=`number`)return[];let i=xj(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=xj(r,t)),n++}return a}function mj(e,t,n){return new Promise((r,i)=>{let a=ye(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){oj.set(e,1),$C&&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 hj(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`||uj(i)||dj(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(oj.get(e))continue;let r=n[e];if(!r)continue;r.sort((e,t)=>e-t);let a=pj(r,t);if(a.every(t=>fj(e,t)))continue;let o=lj(aj,e,{});i.push(mj(e,a,o))}if(await Promise.all(i).catch(()=>{$C&&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&&gj(n.stacktrace.frames,t,aj);return e}function gj(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;vj(r.lineno,r,t,e)}}function _j(e){delete e.pre_context,delete e.context_line,delete e.post_context}function vj(e,t,n,r){if(t.lineno===void 0||r===void 0){$C&&A.error(`Cannot resolve context for frame with no lineno or file contents`);return}t.pre_context=[];for(let i=yj(e,n);i<e;i++){let e=r[i];if(e===void 0){_j(t),$C&&A.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(e)}if(r[e]===void 0){_j(t),$C&&A.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=r[e];let i=bj(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 yj(e,t){return Math.max(1,e-t)}function bj(e,t){return e+t}function xj(e,t){return[yj(e,t),bj(e,t)]}var Sj=U(((e={})=>({name:cj,processEvent(t,n,r){return hj(t,e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??sj)}}))),Cj;async function wj(){if(Cj===void 0)try{Cj=!!(await import(`node:inspector`)).url()}catch{Cj=!1}return Cj}function Tj(e,t){return of(e,t)}var Ej=`__SENTRY_ERROR_LOCAL_VARIABLES__`;function Dj(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 Oj(e){return e!==void 0&&(e.length===0||e===`?`||e===`<anonymous>`)}function kj(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Oj(e)&&Oj(t)}var Aj=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc0LjAgKGNlNTAwOWEp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c3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=`;function jj(...e){A.log(`[LocalVariables]`,...e)}var Mj=U(((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||!kj(s.function,o.function)||(s.vars=Tj(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[Ej],r);n.originalException[Ej]=void 0}return e}async function r(){let e=await import(`node:inspector`);e.url()||e.open(0)}function i(e){let t=new w(new URL(`data:application/javascript;base64,${Aj}`),{workerData:e,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on(`exit`,()=>{t.terminate()}),t.once(`error`,e=>{jj(`Worker error`,e)}),t.once(`exit`,e=>{jj(`Worker exit`,e)}),t.unref()}return{name:`LocalVariablesAsync`,async setup(t){if(!t.getOptions().includeLocalVariables)return;if(await wj()){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 Nj(e){if(e!==void 0)return e.slice(-10).reduce((e,t)=>`${e},${t.function},${t.lineno},${t.colno}`,``)}function Pj(e,t){if(t!==void 0)return Nj(e(t,1))}function Fj(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 Ij=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}=Fj(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)}},Lj=`LocalVariables`,Rj=U(((e={},t)=>{let n=new gb(20),r,i=!1;function a(t,r){let i=Nj(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||!kj(s.function,i.function)||(s.vars=Tj(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(IT<18){A.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await wj()){A.warn(`Local variables capture has been disabled because the debugger was already enabled`);return}try{let o=await Ij.create(t),s=(e,{params:{reason:t,data:i,callFrames:a}},s)=>{if(t!==`exception`&&t!==`promiseRejection`){s();return}r?.();let c=Pj(e,i.description);if(c==null){s();return}let{add:l,next:u}=Fj(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=Dj(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:Lj,setupOnce(){s=c()},async processEvent(e){return await s,i?o(e):e},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}})),zj=(e={})=>FT.major<19?Rj(e):Mj(e),Bj,Vj=`Modules`;function Hj(){return typeof __SENTRY_SERVER_MODULES__<`u`?__SENTRY_SERVER_MODULES__:O.__SENTRY_SERVER_MODULES__??{}}var Uj=(()=>({name:Vj,processEvent(e){return e.modules={...e.modules,...Gj()},e},getModules:Gj}));function Wj(){return{...Hj(),...qj()}}function Gj(){return Bj||=Wj(),Bj}function Kj(){try{let e=he(process.cwd(),`package.json`);return JSON.parse(xe(e,`utf8`))}catch{return{}}}function qj(){let e=Kj();return{...e.dependencies,...e.devDependencies}}var Jj=2e3;function Yj(e){ut(()=>{console.error(e)});let t=P();if(t===void 0){$C&&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:Jj;t.close(r).then(e=>{e||$C&&A.warn(`We reached the timeout for emptying the request buffer, still exiting now!`),global.process.exit(1)},e=>{$C&&A.error(e)})}var Xj=`OnUncaughtException`,Zj=U((e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:Xj,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=Yj;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?($C&&A.warn(`uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown`),Yj(s)):r||(r=!0,setTimeout(()=>{i||(i=!0,c(a,s))},2e3))):(a=s,n=!0,P()===e&&V(s,{originalException:s,captureContext:{level:`fatal`},mechanism:{handled:!1,type:`auto.node.onuncaughtexception`}}),!i&&u&&(i=!0,c(s)))},{_errorHandler:!0})}var $j=`OnUnhandledRejection`,eM=[{name:`AI_NoOutputGeneratedError`},{name:`AbortError`}],tM=U(((e={})=>{let t={mode:e.mode??`warn`,ignore:[...eM,...e.ignore??[]]};return{name:$j,setup(e){global.process.on(`unhandledRejection`,aM(e,t))}}}));function nM(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 rM(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 iM(e,t){let n=nM(t);return e.some(e=>rM(e,n))}function aM(e,t){return function(n,r){if(P()!==e||iM(t.ignore??[],n))return;let i=t.mode===`strict`?`fatal`:`error`,a=j(n)?n._sentry_active_span:void 0;(a?e=>B(a,e):e=>e())(()=>{V(n,{originalException:n,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:`auto.node.onunhandledrejection`}})}),oM(n,t.mode)}}function oM(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)}),Yj(e))}var sM=`ProcessSession`,cM=U(()=>({name:sM,setupOnce(){hu(),process.on(`beforeExit`,()=>{N().getSession()?.status===`ok`&&gu()})}})),lM=`Spotlight`,uM=U(((e={})=>{let t={sidecarUrl:e.sidecarUrl||`http://localhost:8969/stream`};return{name:lM,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{}dM(e,t)}}}));function dM(e,t){let n=fM(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=Aa(e);fo(()=>{let e=Re.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 fM(e){try{return new URL(`${e}`)}catch{A.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}var pM=U((e={})=>({name:`Console`,setup(t){process.env.LAMBDA_TASK_ROOT&&Nt(`console`,mM),Gm({...e,filter:[...e.filter||[],`[DEP0205] DeprecationWarning`]}).setup?.(t)}}));function mM(){let e=O?.console;e&&st.forEach(t=>{t in e&&hM(e,t)})}function hM(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 gM=`NodeSystemError`;function _M(e){return!(e instanceof Error)||!(`errno`in e)||typeof e.errno!=`number`||typeof Ce.getSystemErrorMap!=`function`?!1:Ce.getSystemErrorMap().has(e.errno)}var vM=U((e={})=>({name:gM,processEvent:(t,n,r)=>{if(!_M(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}})),yM,bM=Symbol(`AgentBaseInternalState`),xM=class extends (yM=Re.Agent,yM){constructor(e){super(e),this[bM]={}}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 Re.Agent)return i.addRequest(e,r);this[bM].currentSocket=i,super.createSocket(e,t,n)},n)}createConnection(){let e=this[bM].currentSocket;if(this[bM].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[bM].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[bM]&&(this[bM].defaultPort=e)}get protocol(){return this[bM].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[bM]&&(this[bM].protocol=e)}};function SM(...e){A.log(`[https-proxy-agent:parse-proxy-response]`,...e)}function CM(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(),SM(`onend`),n(Error(`Proxy connection ended before receiving CONNECT response`))}function c(e){o(),SM(`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){SM(`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}SM(`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 wM(...e){A.log(`[https-proxy-agent]`,...e)}var TM=class extends xM{constructor(e,t){super(t),this.options={},this.proxy=typeof e==`string`?new URL(e):e,this.proxyHeaders=t?.headers??{},wM(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?DM(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;if(n.protocol===`https:`){wM("Creating `tls.Socket`: %o",this.connectOpts);let e=this.connectOpts.servername||this.connectOpts.host;r=Ve.connect({...this.connectOpts,servername:e&&Le.isIP(e)?void 0:e})}else wM("Creating `net.Socket`: %o",this.connectOpts),r=Le.connect(this.connectOpts);let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=Le.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=CM(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`,EM),t.secureEndpoint){wM(`Upgrading socket connection to TLS`);let e=t.servername||t.host;return Ve.connect({...DM(t,`host`,`path`,`port`),socket:r,servername:Le.isIP(e)?void 0:e})}return r}r.destroy();let u=new Le.Socket({writable:!1});return u.readable=!0,e.once(`socket`,e=>{wM(`Replaying proxy buffer for failed request`),e.push(l),e.push(null)}),u}};TM.protocols=[`http`,`https`];function EM(e){e.resume()}function DM(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}var OM=32768;function kM(e){return new ze({read(){this.push(e),this.push(null)}})}function AM(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.`)}),xd(e,()=>Promise.resolve({}))}let n=t.protocol===`https:`,r=jM(t,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),i=n?et:Re,a=e.keepAlive!==void 0&&e.keepAlive,o=r?new TM(r):new i.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return xd(e,MM(e,e.httpModule??i,o))}function jM(e,t){let{no_proxy:n}=process.env;if(!n?.split(`,`).some(t=>e.host.endsWith(t)||e.hostname.endsWith(t)))return t}function MM(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)=>{fo(()=>{let d=kM(c.body),f={...e.headers};c.body.length>OM&&(f[`content-encoding`]=`gzip`,d=d.pipe(He()));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 NM(e){if(e===!1)return!1;if(typeof e==`string`)return e;let t=uf(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 PM(e){return e.replace(/^[A-Z]:/,``).replace(/\\/g,`/`)}function FM(e=process.argv[1]?dm(process.argv[1]):process.cwd(),t=_e===`\\`){let n=t?PM(e):e;return e=>{if(!e)return;let r=t?PM(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 IM(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 LM=St(_S(FM()));x();var RM=6e4,zM=class extends vb{constructor(e){let t=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||qe.hostname(),n={...e,platform:`node`,runtime:e.runtime||{name:`node`,version:global.process.version},serverName:t};e.openTelemetryInstrumentations&&Ow({instrumentations:e.openTelemetryInstrumentations}),Tf(n,`node`),A.log(`Initializing Sentry: process: ${process.pid}, thread: ${Xe?`main`:`worker-${Ze}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Xu(this)},t&&this.on(`beforeCaptureLog`,e=>{e.attributes={...e.attributes,"server.address":t}}),process.on(`beforeExit`,this._logOnExitFlushListener)),Ao(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(()=>{$C&&A.log(`Flushing client reports based on interval.`),this._flushOutcomes()},e.clientReportFlushInterval??RM).unref(),process.on(`beforeExit`,this._clientReportOnExitFlushListener))}_setupIntegrations(){rf(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?Mk(this,e):[void 0,void 0]}},BM;function VM(){return IT>=21||IT===20&&LT>=6||IT===18&&LT>=19||(BM||(BM=!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 HM(){if(VM()&&!O._sentryEsmLoaderHookRegistered){O._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:e}=(0,NT.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 UM(){return[$f(),Yf(),Dp(),Np(),vM(),rh(),pM(),WT(),yE(),Zj(),tM(),Sj(),zj(),UA(),LA(),cM(),Uj()]}function WM(e={}){return GM(e,UM)}function GM(e={},t){let n=qM(e,t);n.debug===!0&&($C?A.enable():ut(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&HM(),DA(n),M().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:e})=>e===`Spotlight`)&&n.integrations.push(uM({sidecarUrl:typeof n.spotlight==`string`?n.spotlight:void 0})),Tf(n,`node-core`);let r=new zM(n);return M().setClient(r),r.init(),A.log(`SDK initialized from ESM`),r.startClientReportTracking(),XM(),nk(r),Ik(r),process.env.VERCEL&&process.on(`SIGTERM`,async()=>{await r.flush(200)}),r}function KM(){if(!$C)return;let e=ck(),t=[`SentryContextManager`,`SentryPropagator`],n=e.includes(`SentryTracerProvider`);sa()&&!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 qM(e,t){let n=JM(e.release),r=NM(e.spotlight),i=YM(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??AM,stackParser:Ct(e.stackParser||LM),release:n,tracesSampleRate:i,spotlight:r,debug:uf(e.debug??process.env.SENTRY_DEBUG)},o=e.integrations,s=Ou({defaultIntegrations:e.defaultIntegrations??t(a),integrations:o});return{...a,integrations:s}}function JM(e){if(e!==void 0)return e;let t=IM();if(t!==void 0)return t}function YM(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 XM(){if(uf(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,n=Ai(e,t);M().setPropagationContext(n)}}var ZM=e=>({package:e,"javascript.is_cjs":!1});function QM(e,t){let n=P()?.getOptions();!n?.disableInstrumentationWarnings&&!(G(e)||typeof Zt(e)==`function`)&&pu()&&sa(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`,ZM(t)))}var{isPromise:$M}=De,eN=`LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjc0LjAgKGNlNTAwOWEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyB0fWZyb20ibm9kZTppbnNwZWN0b3IiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIG4scGFyZW50UG9ydCBhcyBlfWZyb20ibm9kZTp3b3JrZXJfdGhyZWFkcyI7aW1wb3J0e3Bvc2l4IGFzIHIsc2VwIGFzIG99ZnJvbSJub2RlOnBhdGgiO2ltcG9ydCphcyBpIGZyb20ibm9kZTpodHRwIjtpbXBvcnQqYXMgcyBmcm9tIm5vZGU6aHR0cHMiO2ltcG9ydHtSZWFkYWJsZSBhcyBjfWZyb20ibm9kZTpzdHJlYW0iO2ltcG9ydHtj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4obnVsbCwoKT0+e2RuKCJTZW5kaW5nIEFOUiBldmVudCBmYWlsZWQgb24gd2F0Y2hkb2cgdGltZW91dC4iKX0pKX0pO2U/Lm9uKCJtZXNzYWdlIix0PT57dC5zZXNzaW9uJiYoZm49SCh0LnNlc3Npb24pKSx0LmRlYnVnSW1hZ2VzJiYocG49dC5kZWJ1Z0ltYWdlcyksd24oKX0pOw==`,tN=50,nN=5e3;function rN(e,...t){A.log(`[ANR] ${e}`,...t)}function iN(){return O}function aN(){let e=Jo(N(),M());return e.attachments=[],e.eventProcessors=[],e}async function oN(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 sN=`Anr`,cN=U(((e={})=>{if(FT.major<16||FT.major===16&&FT.minor<17)throw Error(`ANR detection requires Node 16.17.0 or later`);let t,n,r=iN();return r.__SENTRY_GET_SCOPES__=aN,{name:sN,startWorker:()=>{t||n&&(t=lN(n,e))},stopWorker:()=>{t&&t.then(e=>{e(),t=void 0})},async setup(t){n=t,e.captureStackTrace&&await wj()&&(A.warn(`ANR captureStackTrace has been disabled because the debugger was already enabled`),e.captureStackTrace=!1),setImmediate(()=>this.startWorker())}}}));async function lN(e,t){let n=e.getDsn();if(!n)return()=>{};let r=await oN(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||tN,anrThreshold:t.anrThreshold||nN,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 w(new URL(`data:application/javascript;base64,${eN}`),{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:Bl(i.stackParser)})}catch{}},o.pollInterval);return c.unref(),s.on(`message`,e=>{e===`session-ended`&&(rN(`ANR event sent from ANR worker. Clearing session in this thread.`),N().setSession(void 0))}),s.once(`error`,e=>{clearInterval(c),rN(`ANR worker error`,e)}),s.once(`exit`,e=>{clearInterval(c),rN(`ANR worker exit`,e)}),s.unref(),()=>{s.terminate(),clearInterval(c)}}function uN(e){let t=P()?.getIntegrationByName(sN);if(!t)return e();t.stopWorker();let n=e();return $M(n)?n.finally(()=>t.startWorker()):(t.startWorker(),n)}function dN(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}),Yu({level:e,message:Te(n,...r),attributes:t},a?.scope)}else Yu({level:e,message:n,attributes:r},i?.scope??a?.scope)}var fN=f({debug:()=>mN,error:()=>_N,fatal:()=>vN,fmt:()=>wf,info:()=>hN,trace:()=>pN,warn:()=>gN});function pN(...e){dN(`trace`,...e)}function mN(...e){dN(`debug`,...e)}function hN(...e){dN(`info`,...e)}function gN(...e){dN(`warn`,...e)}function _N(...e){dN(`error`,...e)}function vN(...e){dN(`fatal`,...e)}var yN=`NodeRuntimeMetrics`,bN=3e4,xN=1e3,SN=10;function CN(e,t,n){return Number.isFinite(e)?e<xN?(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is below the minimum of ${xN}ms. Using minimum of ${xN}ms.`),xN):e:(console.warn(`[Sentry] ${t}: collectionIntervalMs (${e}) is invalid. Using default of ${n}ms.`),n)}var wN=U((e={})=>{let t=CN(e.collectionIntervalMs??bN,yN,bN),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=SN*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&&(yh(`node.runtime.cpu.user`,e.user/1e6,m),yh(`node.runtime.cpu.system`,e.system/1e6,m)),n.cpuUtilization&&t>0&&yh(`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&&yh(`node.runtime.mem.rss`,e.rss,p),n.memHeapUsed&&yh(`node.runtime.mem.heap_used`,e.heapUsed,p),n.memHeapTotal&&yh(`node.runtime.mem.heap_total`,e.heapTotal,p),n.memExternal&&(yh(`node.runtime.mem.external`,e.external,p),yh(`node.runtime.mem.array_buffers`,e.arrayBuffers,p))}if(r&&l&&(n.eventLoopDelayMin&&yh(`node.runtime.event_loop.delay.min`,d(l.min),m),n.eventLoopDelayMax&&yh(`node.runtime.event_loop.delay.max`,d(l.max),m),n.eventLoopDelayMean&&yh(`node.runtime.event_loop.delay.mean`,d(l.mean),m),n.eventLoopDelayP50&&yh(`node.runtime.event_loop.delay.p50`,d(l.percentile(50)),m),n.eventLoopDelayP90&&yh(`node.runtime.event_loop.delay.p90`,d(l.percentile(90)),m),n.eventLoopDelayP99&&yh(`node.runtime.event_loop.delay.p99`,d(l.percentile(99)),m),l.reset()),n.eventLoopUtilization&&s!==void 0){let e=nt.eventLoopUtilization();yh(`node.runtime.event_loop.utilization`,nt.eventLoopUtilization(e,s).utilization,f),s=e}n.uptime&&t>0&&vh(`node.runtime.process.uptime`,t/1e3,m),c=e}return{name:yN,setup(){if(r){l?.disable();try{l=tt({resolution:SN}),l.enable()}catch{l=void 0}}i&&(o=process.cpuUsage()),n.eventLoopUtilization&&(s=nt.eventLoopUtilization()),c=an(),a&&clearInterval(a),a=xu(setInterval(h,t))}}}),TN=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`],EN=Symbol.for(`level`),DN=Symbol.for(`message`),ON=Symbol.for(`splat`);function kN(e,t){class n extends e{constructor(e){super(e),this._levels=new Set(t?.levels??TN)}log(e,n){try{if(setImmediate(()=>{this.emit(`logged`,e)}),!j(e))return;let n=e[EN],{level:r,message:i,timestamp:a,...o}=e;o[EN]=void 0,o[DN]=void 0,o[ON]=void 0;let s=t?.customLevelMap?.[n],c=AN[n],l=s??c??`info`;this._levels.has(l)?dN(l,i,{...o,"sentry.origin":`auto.log.winston`}):!s&&!c&&$C&&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 AN={silly:`trace`,debug:`debug`,verbose:`debug`,http:`debug`,info:`info`,notice:`info`,warn:`warn`,warning:`warn`,error:`error`,emerg:`fatal`,alert:`fatal`,crit:`fatal`},jN=Symbol(`sentry-track-pino-logger`);function MN(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 NN={error:{levels:[],handled:!0},log:{levels:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]}};function PN(e){let{level:t,time:n,pid:r,hostname:i,...a}=e;return a}var FN=U((e={})=>{let t={autoInstrument:e.autoInstrument!==!1,error:{...NN.error,...e.error},log:{...NN.log,...e.log}};function n(e){let n=e[jN];return n===`track`||n!==`ignore`&&t.autoInstrument}return{name:`Pino`,setup:e=>{let r=!!e.getOptions().enableLogs,i=S.tracingChannel(`pino_asJson`);function a(e,i,a){if(!n(e))return;let o=PN(a),[s,c,l]=i,u=e?.levels?.labels?.[l]||`info`,d=MN(e,`pino.messageKey`,`msg`),f=c||o?.[d]||``;if(r&&t.log.levels.includes(u)&&Yu({level:u,message:f,attributes:{...o,"sentry.origin":`auto.log.pino`,"pino.logger.level":l}}),t.error.levels.includes(u)){let n=MN(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:Up(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){V(r,i);return}Ql(f,i)})}}i.end.subscribe(e=>{let{instance:t,arguments:n,result:r}=e;a(t,n,JSON.parse(r))})}}}),IN=Object.assign(FN,{trackLogger(e){j(e)&&`levels`in e&&(e[jN]=`track`)},untrackLogger(e){j(e)&&`levels`in e&&(e[jN]=`ignore`)}});function LN(e,t){e.setAttribute(I,t)}var RN=[[`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 zN(e){return RN.reduce((e,[t,n])=>e.replace(new RegExp(t,`gi`),n),e)}var BN=`Automatic instrumentation of CronJob only supports crontab string`;function VN(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(BN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let u=zN(i);async function d(e,n){return yu(t,async()=>{try{await a(e,n)}catch(e){throw V(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(BN);if(n)throw Error(`A job named '${t}' has already been scheduled`);n=!0;let s=zN(i);return r.onTick=async(e,n)=>yu(t,async()=>{try{await a(e,n)}catch(e){throw V(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 HN(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)=>yu(s,async()=>{try{return await a(...e)}catch(e){throw V(e,{mechanism:{handled:!1,type:`auto.function.node-cron.instrumentNodeCron`}}),e}},{schedule:{type:`crontab`,value:zN(i)},timezone:c,...t}),o])}}):e[n]}})}function UN(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 yu(o,async()=>{await a?.()},{schedule:{type:`crontab`,value:zN(s)}})}return e.apply(t,[o,s,c])}}):e[t]}})}var WN={instrumentCron:VN,instrumentNodeCron:HN,instrumentNodeSchedule:UN},GN=`Http`,KN=Object.assign(zT,{id:`${GN}.sentry`}),qN=U((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=rw(i),s=cw(a);return{name:GN,setup(e){let t=e.getOptions();r&&sa(t)&&s.setup(e)},setupOnce(){o.setupOnce(),zT({breadcrumbs:e.breadcrumbs,spans:t,propagateTraceInOutgoingRequests:e.tracePropagation??!0,createSpansForOutgoingRequests:t,ignoreOutgoingRequests:e.ignoreOutgoingRequests,outgoingRequestHook:(t,n)=>{let r=SC(n);if(r.startsWith(`data:`)){let e=Sf(r);t.setAttribute(`http.url`,e),t.setAttribute(_l,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)}}}),JN=U(((e={})=>({name:`NodeFetch`,setupOnce(){let t=P()?.getOptions();cE({...e,spans:YN(e,t)})}})));function YN(e,t={}){return e.spans??(!t.skipOpenTelemetrySetup&&sa(t))}var XN=`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(`.`),ZN=`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 $N(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 eP(e,t){if(!t)throw Error(JSON.stringify({member:t}));let[n,r]=$N(t);return r?{objectToPatch:e[n],functionNameToPatch:r}:{objectToPatch:e,functionNameToPatch:n}}var tP=`auto.file.fs`,nP=`file`,rP=[`rename`,`renameSync`],iP=[`copyFile`,`cp`,`copyFileSync`,`cpSync`],aP=[`link`,`linkSync`],oP=[`mkdtemp`,`mkdtempSync`],sP=[`symlink`,`symlinkSync`],cP=`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 lP(e,t,n){let r={[F]:nP,[I]:tP};return n.recordFilePaths&&(typeof t[0]==`string`&&cP.includes(e)?r.path_argument=t[0]:typeof t[0]==`string`&&typeof t[1]==`string`?sP.includes(e)?(r.target_argument=t[0],r.path_argument=t[1]):aP.includes(e)?(r.existing_path_argument=t[0],r.new_path_argument=t[1]):iP.includes(e)?(r.src_argument=t[0],r.dest_argument=t[1]):rP.includes(e)&&(r.old_path_argument=t[0],r.new_path_argument=t[1]):typeof t[0]==`string`&&oP.includes(e)&&(r.prefix_argument=t[0])),r}function uP(e,t){return Object.assign(e,t)}var dP=new WeakMap;function fP(e,t,n){let r=e[t];if(typeof r!=`function`)return;let i=dP.get(e);i||(i=new Set,dP.set(e,i)),!i.has(t)&&(i.add(t),e[t]=n(r))}function pP(e,t,n){return uP(function(...r){let i=lP(e,r,n);return oo({name:`fs.${e}`,onlyIfParent:!0,attributes:i},e=>{try{return fo(()=>t.apply(this,r))}catch(t){throw vP(e,t,n),t}})},t)}function mP(e,t,n){return uP(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return t.apply(this,r);let o=lP(e,r,n),s=z({name:`fs.${e}`,onlyIfParent:!0,attributes:o}),c=R();r[i]=function(...e){let t=e[0];return t&&vP(s,t,n),s.end(),c?B(c,()=>a.apply(this,e)):a.apply(this,e)};try{return fo(()=>t.apply(this,r))}catch(e){throw vP(s,e,n),s.end(),e}},t)}function hP(e,t){let n=`exists`,r=uP(function(...r){let i=r.length-1,a=r[i];if(typeof a!=`function`)return e.apply(this,r);let o=lP(n,r,t),s=z({name:`fs.${n}`,onlyIfParent:!0,attributes:o}),c=R();r[i]=function(...e){return s.end(),c?B(c,()=>a.apply(this,e)):a.apply(this,e)};try{return fo(()=>e.apply(this,r))}catch(e){throw vP(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,ke.custom,{value:i}),r}function gP(e,t,n){return uP(async function(...r){let i=lP(e,r,n);return oo({name:`fs.${e}`,onlyIfParent:!0,attributes:i},async e=>{try{return await fo(()=>t.apply(this,r))}catch(t){throw vP(e,t,n),t}})},t)}function _P(e={}){for(let t of QN){let{objectToPatch:n,functionNameToPatch:r}=eP(je,t);fP(n,r,n=>pP(t,n,e))}for(let t of ZN){let{objectToPatch:n,functionNameToPatch:r}=eP(je,t);t===`exists`?fP(n,r,t=>hP(t,e)):fP(n,r,n=>mP(t,n,e))}let t=je.promises;for(let n of XN)fP(t,n,t=>gP(n,t,e))}function vP(e,t,n){e.setStatus({code:2,message:`internal_error`}),n.recordErrorMessagesAsSpanAttributes&&t instanceof Error&&e.setAttribute(`fs_error`,t.message)}var yP=`FileSystem`,bP=U((e={})=>({name:yP,setupOnce(){_P(e)}})),xP=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;function SP(e){let t=R();if(!t)return;let n=ra(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(`http.route`,e)}var CP=`Express`,wP=[`>=4.0.0 <6`];function TP(e,t){QS(e,t),QM(e.use,`express`)}var EP=J(CP,e=>new DP(e)),DP=class extends K{constructor(e={}){super(`sentry-express`,k,e)}init(){return new q(`express`,wP,e=>{try{YS(e,()=>({...this.getConfig(),onRouteResolved(e){e&&SP(e)}}))}catch(e){xP&&A.error(`Failed to patch express module:`,e)}return e},e=>e)}},OP=U((e=>({name:CP,setupOnce(){EP(e)},getShouldHandleError(){return e?.shouldHandleError}}))),kP=(e=>(e.FASTIFY_NAME=`fastify.name`,e.FASTIFY_TYPE=`fastify.type`,e.HOOK_NAME=`hook.name`,e.PLUGIN_NAME=`plugin.name`,e))(kP||{}),AP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(AP||{}),jP=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request handler`,e))(jP||{}),MP=Symbol(`opentelemetry.instrumentation.fastify.request_active_span`);x();function NP(e,t,n,r={}){let i=t.startSpan(n,{attributes:r}),a=e[MP]||[];return a.push(i),Object.defineProperty(e,MP,{enumerable:!1,configurable:!0,value:a}),i}function PP(e,t){let n=e[MP]||[];n.length&&(n.forEach(e=>{t&&(e.setStatus({code:oe.ERROR,message:t.message}),e.recordException(t)),e.end()}),delete e[MP])}function FP(e,t,n){let r,i;try{i=e(),IP(i)&&i.then(e=>t(void 0,e),e=>t(e))}catch(e){r=e}finally{if(!IP(i)&&(t(r,i),r))throw r;return i}}function IP(e){return typeof e==`object`&&e&&typeof Object.getOwnPropertyDescriptor(e,`then`)?.value==`function`||!1}x();var LP=`@sentry/instrumentation-fastify-v3`,RP=`anonymous`,zP=new Set([`onTimeout`,`onRequest`,`preParsing`,`preValidation`,`preSerialization`,`preHandler`,`onSend`,`onResponse`,`onError`]),BP=class extends K{constructor(e={}){super(LP,k,e)}init(){return[new q(`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&&SP(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||RP,s=`${jP.MIDDLEWARE} - ${o}`,c=a[1],u=NP(c,i.tracer,s,{[kP.FASTIFY_TYPE]:AP.MIDDLEWARE,[kP.PLUGIN_NAME]:e,[kP.HOOK_NAME]:t}),d=r&&a[a.length-1];return d&&(a[a.length-1]=function(...e){PP(c),d.apply(this,e)}),l.with(_.setSpan(l.active(),u),()=>FP(()=>n.apply(this,a),e=>{e instanceof Error&&(u.setStatus({code:oe.ERROR,message:e.message}),u.recordException(e)),r||PP(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(!zP.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()),VP(),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()?MT(()=>t.apply(this,n),e=>{!e&&r instanceof Error&&(e=r),PP(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=`${jP.REQUEST_HANDLER} - ${o||this.pluginName||RP}`,c={[kP.PLUGIN_NAME]:this.pluginName,[kP.FASTIFY_TYPE]:AP.REQUEST_HANDLER,[kc]:i.routeOptions?i.routeOptions.url:t.routerPath};o&&(c[kP.FASTIFY_NAME]=o);let u=NP(n,e.tracer,s,c);HP(u);let{requestHook:d}=e.getConfig();return d&&MT(()=>d(u,{request:t}),t=>{t&&e._diag.error(`request hook failed`,t)},!0),l.with(_.setSpan(l.active(),u),()=>{r()})}}};function VP(){let e=P();e&&e.on(`spanStart`,e=>{HP(e)})}function HP(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 UP=`execute_tool`,WP=`invoke_agent`,GP=`graphql`,Y=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,KP=()=>{};function X(e,t,n){let r=qP(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&&V(t,o(t));let{message:r,attributes:i}=YP(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),JP(t,i))}},l={start:KP,asyncStart:KP,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;JP(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)})||JP(e,i)}};return r.channel.subscribe(l),{channel:r.channel,unbind:()=>{r.channel.unsubscribe(l),r.unbind()}}}function qP(e,t,n){let r=_r(it()).getTracingChannelBinding?.();if(!r)return Y&&A.log(`[TracingChannel] Could not access async context binding.`),{channel:e,unbind:KP};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 JP(e,t){let n=e._sentrySpan;n&&(t?.(n,e),n.end())}function YP(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:{[Ws]:i}}}var XP=`original-description`,ZP=new Set([`Int`,`Float`,`String`,`BlockString`]);function QP(e,t,n){let r=ra(e);if(r===e)return;let i=L(r),a=n?`${t} ${n}`:t,o=i.data[al],s;s=Array.isArray(o)?[...o,a]:typeof o==`string`?[o,a]:a,r.setAttribute(al,s);let c=i.data[XP]??i.description;i.data[XP]||r.setAttribute(XP,c),r.updateName(`${c} (${$P(s)})`)}function $P(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 eF(e,t,n){return e&&t?`${e} ${t}`:e||n}function tF(e){if(j(e)&&`errors`in e){let t=e.errors;return Array.isArray(t)&&t.length>0}return!1}function nF(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)ZP.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 rF(e){if(P()?.getDataCollectionOptions().graphQL.document===!0)return nF(e)}var iF=`graphql:parse`,aF=`graphql:validate`,oF=`graphql:execute`,sF=`graphql:subscribe`,cF=`graphql:resolve`,lF=`auto.graphql.diagnostic_channel`,uF=`graphql.parse`,dF=`graphql.validate`,fF=`graphql.execute`,pF=`graphql.subscribe`,mF=`graphql.resolve`,hF=`graphql.field.name`,gF=`graphql.field.path`,_F=`graphql.field.type`,vF=`graphql.parent.name`;function yF(e,t={}){let n=t.ignoreResolveSpans!==!1,r=t.ignoreTrivialResolveSpans!==!1,i=t.useOperationNameForRootSpan!==!1;bF(e),xF(e),SF(e,oF,fF,i),SF(e,sF,pF,i),n||CF(e,r)}function bF(e){X(e(iF),()=>z({name:uF,attributes:{[I]:lF,[F]:GP}}))}function xF(e){X(e(aF),e=>z({name:dF,attributes:{[I]:lF,[F]:GP,[bc]:rF(e.document)}}),{beforeSpanEnd:(e,t)=>{Array.isArray(t.result)&&t.result.length>0&&e.setStatus({code:2,message:`invalid_argument`})}})}function SF(e,t,n,r){X(e(t),e=>{let t=z({name:eF(e.operationType,e.operationName,n),attributes:{[I]:lF,[F]:GP,[Sc]:e.operationType,[xc]:e.operationName||void 0,[bc]:rF(e.document)}});return r&&e.operationType&&QP(t,e.operationType,e.operationName),t},{beforeSpanEnd:(e,t)=>{tF(t.result)&&e.setStatus({code:2,message:`internal_error`})}})}function CF(e,t){X(e(cF),e=>{if(!(t&&e.isDefaultResolver))return z({name:`${mF} ${e.fieldPath}`,attributes:{[I]:lF,[F]:GP,[hF]:e.fieldName,[gF]:e.fieldPath,[_F]:e.fieldType,[vF]:e.parentType}})})}var wF=U(((e={})=>({name:`Graphql`,setupOnce(){S.tracingChannel&&H(()=>{yF(S.tracingChannel,e)})}}))),TF=`mongoose:query`,EF=`mongoose:aggregate`,DF=`mongoose:model:save`,OF=`mongoose:model:insertMany`,kF=`mongoose:model:bulkWrite`,AF=`mongoose:cursor:next`,jF=`auto.db.mongoose.diagnostic_channel`,MF=`mongodb`,NF=10,PF=!1;function FF(e){if(!PF){PF=!0;try{IF(e,TF),IF(e,EF),IF(e,DF),IF(e,OF),IF(e,kF),IF(e,AF)}catch{Y&&A.log(`Mongoose node:diagnostics_channel subscription failed.`)}}}function IF(e,t){X(e(t),e=>{let t=e.collection,n=RF(e.args?.pipeline??e.args?.filter),r=LF(e);return z({name:t?`mongoose.${t}.${e.operation}`:`mongoose.${e.operation}`,attributes:{[I]:jF,[F]:`db`,[Hs]:MF,[Rs]:e.operation,[Ns]:t??void 0,[Fs]:e.database??void 0,[zs]:n??void 0,[Ls]:r??void 0,[pl]:e.serverAddress??void 0,[ml]:e.serverPort??void 0}})})}function LF(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 RF(e){if(e!=null)try{let t=zF(e,0),n=JSON.stringify(t);return n==null||n===`{}`||n===`[]`?void 0:n}catch{return}}function zF(e,t){if(t>NF)return`?`;if(Array.isArray(e))return e.map(e=>zF(e,t+1));if(j(e)){let n={};for(let r of Object.keys(e))n[r]=zF(e[r],t+1);return n}return`?`}var BF=U((()=>({name:`Mongoose`,setupOnce(){S.tracingChannel&&H(()=>{FF(S.tracingChannel)})}}))),VF=`db.system`,HF=`db.name`,UF=`db.operation`,WF=`db.statement`,GF=`db.mongodb.collection`,KF=`db.connection_string`,qF=`net.peer.name`,JF=`net.peer.port`,YF=`mongodb`;function XF(e){return JSON.stringify(ZF(e))}function ZF(e){return Array.isArray(e)?e.map(e=>ZF(e)):QF(e)?Object.entries(e).map(([e,t])=>[e,ZF(t)]).reduce((e,t)=>(eI(t)&&(e[t[0]]=t[1]),e),{}):`?`}function QF(e){return j(e)&&!$F(e)}function $F(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}function eI(e){return Array.isArray(e)}function tI(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,nI(t.db,t.collection,a,o,s,r,i)}function nI(e,t,n,r,i,a,o){let s={[I]:o,[VF]:YF,[HF]:e,[GF]:t,[UF]:a,[KF]:`mongodb://${n}:${r}/${e}`};if(n&&r){s[qF]=n;let e=parseInt(r,10);isNaN(e)||(s[JF]=e)}if(i)try{s[WF]=XF(i)}catch{}return s}function rI(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 iI(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 nI(s,c,a,o,l,r,i)}function aI(e){return z({name:`mongodb.${e[UF]||`command`}`,op:`db`,kind:W.CLIENT,attributes:e})}var oI=`mysql2:query`,sI=`mysql2:execute`,cI=`mysql2:connect`,lI=`mysql2:pool:connect`,uI=`auto.db.mysql2.diagnostic_channel`,dI=`mysql`,fI=/^\s*(\w+)/;function pI(e){mI(e,oI),mI(e,sI),hI(e,cI,`mysql2.connect`),hI(e,lI,`mysql2.pool.connect`)}function mI(e,t){X(e(t),e=>{let t=e.query?fC(e.query):void 0,n=t?.match(fI)?.[1]?.toUpperCase();return z({name:t||`mysql2.query`,attributes:{[I]:uI,[F]:`db`,[Hs]:dI,[zs]:t,[Rs]:n,[Fs]:e.database||void 0,[pl]:e.serverAddress,[ml]:e.serverPort}})},{requiresParentSpan:!0})}function hI(e,t,n){X(e(t),e=>z({name:n,attributes:{[I]:uI,[F]:`db`,[Hs]:dI,[Fs]:e.database||void 0,[pl]:e.serverAddress,[ml]:e.serverPort}}),{requiresParentSpan:!0})}var gI=U((()=>({name:`Mysql2`,setupOnce(){S.tracingChannel&&H(()=>{pI(S.tracingChannel)})}}))),_I=`7`,vI=`PRISMA_INSTRUMENTATION`,yI=`V${_I}_PRISMA_INSTRUMENTATION`,bI=globalThis;function xI(e){let t={helper:e};bI[yI]=t,bI[vI]=t}var SI=(()=>{try{return process.env.PRISMA_SHOW_ALL_TRACES===`true`}catch{return!1}})(),CI=`00-10-10-00`,wI=`auto.db.otel.prisma`,TI=1e3,EI=new gb(TI),DI=[];function OI(e,t){EI.set(e,t)}function kI(e,t){let n={...t,[I]:wI};return e===`prisma:engine:db_query`&&n[`db.system`]==null&&(n[Vs]=`prisma`),n}function AI(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 jI(){let e=!0;for(;e;){e=!1;for(let t=DI.length-1;t>=0;t--){let n=DI[t],r=EI.get(n.parent_span_id);if(!r)continue;let i=kI(n.name,n.attributes),a=z({name:AI(n.name,i),attributes:i,kind:n.kind===`client`?W.CLIENT:W.INTERNAL,startTime:n.start_time,parentSpan:r});OI(n.span_id,a),n.links&&a.addLinks(n.links.flatMap(e=>{let t=EI.get(e.span_id);return t?[{context:t.spanContext()}]:[]})),a.end(n.end_time),DI.splice(t,1),e=!0}}}var MI=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}`:CI}dispatchEngineSpans(e){let t=new Map,n=e.filter(e=>e.parentId===null);for(let r of n)NI(r,e,t,this.ignoreSpanTypes)}createEngineSpan(e){DI.push(...e.spans),jI();let t=DI.length-TI;t>0&&(Y&&A.log(`[Prisma] Dropping ${t} unresolved v5 engine span(s) whose parent was never registered.`),DI.splice(0,t))}getActiveContext(){return R()}runInChildSpan(e,t){let n=typeof e==`string`?{name:e}:e;if(n.internal&&!SI)return t();let r=`prisma:client:${n.name}`;if(II(r,this.ignoreSpanTypes))return t();let i=R(),a=kI(r,n.attributes),o={name:AI(r,a),attributes:a,kind:n.kind,links:n.links,startTime:n.startTime,parentSpan:i};if(n.active===!1){let e=z(o);return OI(e.spanContext().spanId,e),PI(e,()=>t(e,i))}return so(o,e=>(OI(e.spanContext().spanId,e),PI(e,()=>t(e,i))))}};function NI(e,t,n,r){if(II(e.name,r))return;let i=kI(e.name,e.attributes);so({name:AI(e.name,i),attributes:i,kind:e.kind===`client`?W.CLIENT:W.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)NI(e,t,n,r);i.end(e.endTime)})}function PI(e,t){let n;try{n=t()}catch(t){throw e.end(),t}return FI(n)?n.then(t=>(e.end(),t),t=>{throw e.end(),t}):(e.end(),n)}function FI(e){return e!=null&&typeof e.then==`function`}function II(e,t){return t.some(t=>typeof t==`string`?t===e:t.test(e))}var LI=`Prisma`;function RI(e){xI(new MI({ignoreSpanTypes:e?.instrumentationConfig?.ignoreSpanTypes??[]}))}var zI=U((e=>({name:LI,setupOnce(){RI(e)}}))),BI=`node-redis:command`,VI=`node-redis:batch`,HI=`node-redis:connect`,UI=`ioredis:command`,WI=`ioredis:connect`,GI=`auto.db.redis.diagnostic_channel`,KI=`redis`;function qI(e,t){JI(e,BI,e=>e.args.slice(1),t),YI(e,VI,e=>e.batchMode===`PIPELINE`?`PIPELINE`:`MULTI`),XI(e,HI),JI(e,UI,e=>e.args,t),XI(e,WI)}function JI(e,t,n,r){X(e(t),e=>{let t=n(e),r=t.length?`${e.command} ${t.join(` `)}`:e.command;return z({name:`redis-${e.command}`,attributes:{[I]:GI,[F]:`db.redis`,[Hs]:KI,[zs]:r,...e.serverAddress==null?{}:{[pl]:e.serverAddress},...e.serverPort==null?{}:{[ml]:e.serverPort}}})},{beforeSpanEnd(e,t){`error`in t||ZI(r,e,t.command,n(t),t.result)}})}function YI(e,t,n){X(e(t),e=>z({name:n(e),attributes:{[I]:GI,[F]:`db.redis`,[Hs]:KI,...Number(e.batchSize)>1?{[Ls]:e.batchSize}:{},...e.serverAddress==null?{}:{[pl]:e.serverAddress},...e.serverPort==null?{}:{[ml]:e.serverPort}}}))}function XI(e,t){X(e(t),e=>z({name:`redis-connect`,attributes:{[I]:GI,[F]:`db.redis.connect`,[Hs]:KI,...e.serverAddress==null?{}:{[pl]:e.serverAddress},...e.serverPort==null?{}:{[ml]:e.serverPort}}}))}function ZI(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}var QI=U(((e={})=>({name:`Redis`,setupOnce(){S.tracingChannel&&H(()=>{qI(S.tracingChannel,e.responseHook)})}}))),$I=[{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}],eL=(e,t)=>{if(Array.isArray(t)&&t.length){let n=$I.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 Z(e){return typeof e==`string`?e:void 0}function tL(e){return typeof e==`number`&&!isNaN(e)?e:void 0}function nL(e,t){return e===void 0&&t===void 0?void 0:(e??0)+(t??0)}function rL(e){return j(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`}function iL(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+=aL(i,n)??``,e.enqueue(n)}catch(t){c(t),e.error(t)}},cancel(e){return s(),r.cancel(e)}})}function aL(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 oL=`ai:telemetry`,sL=`auto.vercelai.channel`,cL=`gen_ai.tool.call.id`,lL=`gen_ai.tool.description`,uL=`embeddings`,dL=`rerank`,fL=`generate_content`,pL=`WorkersAI`,mL=`vercel.ai.operationId`,hL=`vercel.ai.model.provider`,gL=`vercel.ai.settings.maxRetries`,_L=new Map,vL=new Map,yL=new Map,bL=new Set([`generateText`,`streamText`,`generateObject`,`embed`,`embedMany`,`rerank`]);function xL(e){if(!bL.has(e.type))return;let t=Z(e.event.callId);t&&SL(t)}function SL(e){_L.delete(e),vL.delete(e),yL.delete(e)}function CL(e,t){if(bL.has(t))for(let t of rv)delete e[t]}function wL(e,t){if(!e||!Array.isArray(t))return;let n=vL.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&&vL.set(e,n)}function TL(e,t,n){let r=e?vL.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)?Z(e.description):void 0}if(j(n)){let e=n[t];return j(e)?Z(e.description):void 0}}function EL(e,t={}){X(e(oL),e=>jL(e,t),{beforeSpanEnd:(e,n)=>{IL(e,n,t),xL(n)},deferSpanEnd:({data:e,end:n})=>DL(e,t,n)})}function DL(e,t,n){if(e.type!==`languageModelCall`||!j(e.result))return!1;let r=e.result,i=r.stream;if(!rL(i))return!1;let a=Z(e.event.callId),{recordOutputs:o}=GL(e.event,t);return r.stream=iL(i,t=>{e.result={...r,...OL(t)},n(),kL(a,t,o)},e=>n(e)),!0}function OL(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 kL(e,t,n){let r=e?yL.get(e):void 0;if(!r)return;let i=j(t.usage)?t.usage:void 0;if(i){let e=zL(i.inputTokens)??zL(i.promptTokens)??zL(i.tokens),t=zL(i.outputTokens)??zL(i.completionTokens);AL(r,_c,e),AL(r,vc,t),AL(r,yc,zL(i.totalTokens)??nL(e,t))}if(n){let e=BL(UL(t.text,t.toolCalls),RL({finishReason:t.finishReason}));e&&r.setAttribute(tc,e)}}function AL(e,t,n){if(n===void 0)return;let r=L(e).data[t];e.setAttribute(t,(typeof r==`number`?r:0)+n)}function jL(e,t){let{type:n,event:r}=e;if(n===`step`||!r||typeof r!=`object`)return;let{recordInputs:i,enableTruncation:a}=GL(r,t),o=Z(r.provider),s=Z(r.modelId),c=Z(r.callId),l=tL(r.maxRetries);i&&wL(c,r.tools);let u={[I]:sL,...o?{[fc]:o,[hL]:o}:{},...s?{[ic]:s}:{},...l===void 0?{}:{[gL]:l}};switch(n){case`generateText`:case`streamText`:case`generateObject`:return NL(r,u,i,a,c,n===`streamText`);case`languageModelCall`:return tf([pL]),PL(r,u,i,a,c,s);case`executeTool`:return FL(r,i);case`embed`:case`embedMany`:{let e=n===`embedMany`?r.values:r.value;return ML(uL,s,{...u,...i&&e!==void 0?{[Zs]:bn(e)}:{}})}case`rerank`:return ML(dL,s,u);default:return}}function ML(e,t,n){return z({name:t?`${e} ${t}`:e,op:`gen_ai.${e}`,attributes:{[ec]:e,...n}})}function NL(e,t,n,r,i,a){let o=Z(e.functionId),s=Z(e.operationId)??(a?`ai.streamText`:`ai.generateText`);i&&_L.set(i,{operationId:s,isStream:a});let c=ML(WP,o,{...t,[mL]:s,[dc]:a,...o?{[Qs]:o}:{},...n?qL(e,r):{}});return a&&i&&yL.set(i,c),c}function PL(e,t,n,r,i,a){let o=i?_L.get(i):void 0,s=o?`${o.operationId}.${o.isStream?`doStream`:`doGenerate`}`:`ai.generateText.doGenerate`;return ML(fL,a,{...t,[mL]:s,...n?qL(e,r):{},...n&&Array.isArray(e.tools)?{[nc]:bn(e.tools)}:{}})}function FL(e,t){let n=j(e.toolCall)?e.toolCall:{},r=Z(n.toolName),i=Z(e.toolCallId)??Z(n.toolCallId),a=n.input??n.args,o=t&&r?TL(Z(e.callId),r,e.tools):void 0;return ML(UP,r,{[I]:sL,[gc]:`function`,...r?{[mc]:r}:{},...i?{[cL]:i}:{},...o?{[lL]:o}:{},...t&&a!==void 0?{[pc]:bn(a)}:{}})}function IL(e,t,n){let{type:r,result:i}=t;if(!j(i))return;let{recordOutputs:a}=GL(t.event,n);if(r===`executeTool`){a&&e.setAttribute(hc,bn(i.output??i));let n=j(i.output)?i.output:void 0;n?.type===`tool-error`&&WL(e,t,n.error);return}let o=j(i.usage)?i.usage:void 0;if(o){let t=zL(o.inputTokens)??zL(o.promptTokens)??zL(o.tokens),n=zL(o.outputTokens)??zL(o.completionTokens),r=zL(o.totalTokens)??nL(t,n);t!==void 0&&e.setAttribute(_c,t),n!==void 0&&e.setAttribute(vc,n),r!==void 0&&e.setAttribute(yc,r)}let s=RL(i);s&&r===`languageModelCall`&&e.setAttribute(cc,bn([s]));let c=j(i.response)?i.response:void 0,l=Z(c?.id)??Z(i.responseId);l&&e.setAttribute(lc,l);let u=Z(c?.modelId)??Z(t.event.modelId);u&&e.setAttribute(uc,u);let d=i.providerMetadata,f=nv(d);if(`gen_ai.conversation.id`in f&&L(e).data[`gen_ai.conversation.id`]&&delete f[qr],CL(f,r),e.setAttributes(f),a){let t=BL(r===`languageModelCall`&&Array.isArray(i.content)?HL(i.content):UL(i.text,i.toolCalls),s);t&&e.setAttribute(tc,t)}}function LL(e){return e===`tool-calls`?`tool_call`:e??`stop`}function RL(e){let t=e.finishReason;return typeof t==`string`?t:j(t)?Z(t.unified):void 0}function zL(e){return tL(e)??(j(e)?tL(e.total):void 0)}function BL(e,t){if(e.length)return bn([{role:`assistant`,parts:e,finish_reason:LL(t)}])}function VL(e){let t=e.input??e.args;return{type:`tool_call`,id:Z(e.toolCallId),name:Z(e.toolName),arguments:typeof t==`string`?t:bn(t??{})}}function HL(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(VL(n)));return t}function UL(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(VL(e));return n}function WL(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=Z(r.toolName),a=Z(t.event.toolCallId)??Z(r.toolCallId);Er(t=>{t.setContext(`trace`,Li(e)),i&&t.setTag(`vercel.ai.tool.name`,i),a&&t.setTag(`vercel.ai.tool.callId`,a),t.setLevel(`error`),V(n instanceof Error?n:Error(typeof n==`string`?n:`Tool execution failed`),{mechanism:{type:`auto.vercelai.channel`,handled:!1}})})}function GL(e,t){let n=P()?.getDataCollectionOptions().genAI;return{recordInputs:KL(t.recordInputs,e.recordInputs,n?.inputs),recordOutputs:KL(t.recordOutputs,e.recordOutputs,n?.outputs),enableTruncation:e_(t.enableTruncation)}}function KL(e,t,n){return typeof e==`boolean`?e:typeof t==`boolean`?t:n===!0}function qL(e,t){let n={},r=Z(e.instructions);r&&(n[Zh]=bn([{type:`text`,content:r}]));let i=e.messages??e.prompt;return i!==void 0&&(n[$s]=t?i_(i):bn(i),n[Jh]=Array.isArray(i)?i.length:1),n}var JL=U(((e={})=>({name:`VercelAI`,setupOnce(){S.tracingChannel&&H(()=>{EL(S.tracingChannel,e)})}}))),YL=`@sentry/instrumentation-fastify`,XL=`>=3.21.0 <6`,ZL=`auto.http.otel.fastify`,QL=`hook.fastify`,$L=`request_handler.fastify`,eR=[`onRequest`,`preParsing`,`preValidation`,`preHandler`,`preSerialization`,`onSend`,`onResponse`,`onError`],tR=`hook.name`,nR=`fastify.type`,rR=`hook.callback.name`,iR=`fastify.root`,aR=`route-hook`,oR=`hook`,sR=`request-handler`,cR=`anonymous`,lR=Symbol(`sentry fastify request span`),uR=Symbol(`sentry fastify addHook original`),dR=Symbol(`sentry fastify setNotFoundHandler original`);function fR(e){return e.routeOptions?.url??e.routerPath}function pR(e){return e.routeOptions?.config??e.routeConfig}function mR(e){return j(e)&&!!e.method&&!!e.url&&(!!e.routeOptions||`routerPath`in e)}function hR(e,t,n){e.decorate(uR,e.addHook),e.decorate(dR,e.setNotFoundHandler),e.decorateRequest(`opentelemetry`,function(){return{span:this[lR]}}),e.decorateRequest(lR,null),e.addHook(`onRoute`,_R),e.addHook(`onRequest`,bR),e.addHook(`onResponse`,xR),e.addHook=wR,e.setNotFoundHandler=TR,n()}var gR=hR;gR[Symbol.for(`skip-override`)]=!0,gR[Symbol.for(`fastify.display-name`)]=YL,gR[Symbol.for(`plugin-meta`)]={fastify:XL,name:YL};function _R(e){if(e.config?.otel!==!1){for(let t of eR){let n=e[t];typeof n==`function`?e[t]=DR(n,t,vR(this.pluginName,t,n,e.url)):Array.isArray(n)&&(e[t]=n.map(n=>DR(n,t,vR(this.pluginName,t,n,e.url))))}e.onSend=yR(e.onSend,SR),e.onError=yR(e.onError,CR),e.handler=DR(e.handler,`handler`,{[tR]:`${this.pluginName} - route-handler`,[nR]:sR,[kc]:e.url,[rR]:e.handler.name.length>0?e.handler.name:cR})}}function vR(e,t,n,r){return{[tR]:`${e} - route -> ${t}`,[nR]:aR,[kc]:r,[rR]:n.name?.length>0?n.name:cR}}function yR(e,t){return e==null?t:Array.isArray(e)?[...e,t]:[e,t]}function bR(e,t,n){if(pR(e)?.otel===!1)return n();let r={[I]:ZL,[iR]:YL,[Dc]:e.method,[vl]:e.url},i=fR(e);if(i!=null){r[kc]=i;let e=R(),t=e&&ra(e);t&&L(t).data[`sentry.op`]===`http.server`&&t.setAttribute(kc,i)}let a=z({name:`request`,op:$L,attributes:r});e[lR]=a,B(a,()=>{n()})}function xR(e,t,n){let r=e[lR];r!=null&&(r.setAttributes({[Oc]:t.statusCode}),r.end()),e[lR]=null,n()}function SR(e,t,n,r){let i=e[lR];i!=null&&(t.statusCode>=500&&i.setStatus({code:2}),i.setAttributes({[Oc]:t.statusCode}),i.end()),e[lR]=null,r(null,n)}function CR(e,t,n,r){e[lR]?.setStatus({code:2,message:n.message}),r()}function wR(e,t){let n=this[uR];return eR.includes(e)?n.call(this,e,DR(t,e,{[tR]:`${this.pluginName} - ${e}`,[nR]:oR,[rR]:t.name?.length>0?t.name:cR})):n.call(this,e,t)}function TR(e,t){let n=this[dR];if(typeof e==`function`){n.call(this,DR(e,`notFoundHandler`,{[tR]:`${this.pluginName} - not-found-handler`,[nR]:oR,[rR]:e.name?.length>0?e.name:cR}));return}if(e.preValidation!=null&&(e.preValidation=DR(e.preValidation,`notFoundHandler - preValidation`,{[tR]:`${this.pluginName} - not-found-handler - preValidation`,[nR]:oR,[rR]:e.preValidation.name?.length>0?e.preValidation.name:cR})),e.preHandler!=null&&(e.preHandler=DR(e.preHandler,`notFoundHandler - preHandler`,{[tR]:`${this.pluginName} - not-found-handler - preHandler`,[nR]:oR,[rR]:e.preHandler.name?.length>0?e.preHandler.name:cR})),t==null){n.call(this,e);return}n.call(this,e,DR(t,`notFoundHandler`,{[tR]:`${this.pluginName} - not-found-handler`,[nR]:oR,[rR]:t.name?.length>0?t.name:cR}))}function ER(e){for(let t of e)if(mR(t))return t;return null}function DR(e,t,n={}){return function(...r){let i=ER(r);if(i===null||pR(i)?.otel===!1)return e.call(this,...r);let a=i[lR]??void 0,o=e.name?.length>0?e.name:this.pluginName??cR,s=n[nR],c=s===oR?QL:s===sR?$L:void 0;return oo({name:c?OR(n[tR]):`${t} - ${o}`,op:c,attributes:{...n,[I]:ZL},parentSpan:a},()=>e.call(this,...r))}}function OR(e=``){return e.replace(/^fastify -> /,``).replace(/^@fastify\/otel -> /,``).replace(/^@sentry\/instrumentation-fastify -> /,``)}function kR(e){e.addHook(`onRequest`,async(e,t)=>{let n=fR(e),r=e.method||`GET`;N().setTransactionName(`${r} ${n}`)})}var AR=!1,jR=Object.assign(function(){AR||(AR=!0,S.subscribe(`fastify.initialization`,e=>{let t=e.fastify;t?.register(hR).after(e=>{e?Y&&A.error(`Failed to setup Fastify instrumentation`,e):t&&kR(t)})}))},{id:`Fastify.v5`}),MR=`Fastify`;function NR(e,t,n){let r=n.statusCode;return r>=500||r<=299}function PR(){return P()?.getIntegrationByName(MR)}function FR(){S.subscribe(`tracing:fastify.request.handler:error`,e=>{let{error:t,request:n,reply:r}=e;IR.call(IR,t,n,r,`diagnostics-channel`)})}function IR(e,t,n,r){let i=PR()?.getShouldHandleError()||NR;if(r===`diagnostics-channel`&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r===`onError-hook`){Y&&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)&&V(e,{mechanism:{handled:!1,type:`auto.function.fastify`}})}var LR=U((({shouldHandleError:e}={})=>{let t;return{name:MR,setupOnce(){t=e||NR,FR(),jR()},getShouldHandleError(){return t},setShouldHandleError(e){t=e}}})),RR=IR,zR=`db.mongodb.collection`,BR=`db.name`,VR=`db.user`,HR=`net.peer.name`,UR=`net.peer.port`,WR=`db.operation`,GR=`db.system`;function KR({collection:e,modelName:t,operation:n,origin:r,parentSpan:i}){let a={[zR]:e?.name,[BR]:e?.conn?.name,[VR]:e?.conn?.user,[HR]:e?.conn?.host,[UR]:e?.conn?.port,[WR]:n,[GR]:`mongoose`,[I]:r};return z({name:`mongoose.${t}.${n}`,op:`db`,kind:W.CLIENT,attributes:a,parentSpan:i})}var qR=`Fastify`,JR=J(`${qR}.v3`,()=>new BP);function YR(){let e=P();if(e)return e.getIntegrationByName(qR)}var XR=(e=>Nu(LR(e),{setupOnce(){JR()}})),ZR=U((e={})=>XR(e));function QR(e,t){t?.shouldHandleError&&YR()?.setShouldHandleError(t.shouldHandleError);let n=Object.assign(function(e,t,n){e.addHook(`onError`,async(e,t,n)=>{RR.call(RR,n,e,t,`onError-hook`)}),n()},{[Symbol.for(`skip-override`)]:!0,[Symbol.for(`fastify.display-name`)]:`sentry-fastify-error-handler`});e.register(n)}var $R=class{constructor(e,t,n,r){this.name=Pe(e),this.supportedVersions=t,this.patch=n,this.unpatch=r}},ez=(e=>(e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`,e))(ez||{}),tz=(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))(tz||{}),nz=(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))(nz||{}),rz=(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))(rz||{}),iz=Symbol.for(`opentelemetry.patched`),az=Symbol.for(`opentelemetry.graphql_data`),oz=`Operation$operationName$not supported`,sz=Object.values(ez),cz=e=>typeof e?.then==`function`;function lz(e,t,n,r){if(P()?.getDataCollectionOptions().graphQL.document===!0){let i=Cz(t,n,r);e.setAttribute(rz.SOURCE,i)}}function uz(e,t,n){let r=hz(e,n);return r?{field:r,spanAdded:!1}:(r={span:dz(e,t,n,gz(e,n))},mz(e,n,r),{field:r,spanAdded:!0})}function dz(e,t,n,r){let i={[rz.FIELD_NAME]:t.fieldName,[rz.FIELD_PATH]:n.join(`.`),[rz.FIELD_TYPE]:t.returnType.toString(),[rz.PARENT_NAME]:t.parentType.name},a=z({name:`${nz.RESOLVE} ${i[rz.FIELD_PATH]}`,attributes:i,parentSpan:r}),o=e[az].source,s=t.fieldNodes.find(e=>e.kind===`Field`);return s&&lz(a,o.loc,s.loc?.start,s.loc?.end),a}function fz(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function pz(e,t){if(e&&Array.isArray(e.definitions))return t?e.definitions.filter(e=>sz.indexOf(e?.operation)!==-1).find(e=>t===e?.name?.value):e.definitions.find(e=>sz.indexOf(e?.operation)!==-1)}function mz(e,t,n){return e[az].fields[t.join(`.`)]=n}function hz(e,t){return e[az].fields[t.join(`.`)]}function gz(e,t){for(let n=t.length-1;n>0;n--){let r=hz(e,t.slice(0,n));if(r)return r.span}return _z(e)}function _z(e){return e[az].span}function vz(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function yz(e){return xz(`
30
+ `,e)}function bz(e){return xz(` `,e)}function xz(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}var Sz=[tz.FLOAT,tz.STRING,tz.INT,tz.BLOCK_STRING];function Cz(e,t,n){let r=``;if(e?.startToken){let i=typeof t==`number`?t:e.start,a=typeof n==`number`?n:e.end,o=e.startToken.next,s=1;for(;o;){if(o.start<i){o=o.next,s=o?.line;continue}if(o.end>a){o=o.next,s=o?.line;continue}let e=o.value||o.kind,t=``;Sz.indexOf(o.kind)>=0&&(e=`*`),o.kind===tz.STRING&&(e=`"${e}"`),o.kind===tz.EOF&&(e=``),o.line>s?(r+=yz(o.line-s),s=o.line,t=bz(o.column-1)):o.line===o.prev?.line&&(t=bz(o.start-(o.prev?.end||0))),r+=t+e,o&&=o.next}}return r}function wz(e,t){if(!e||e[iz])return;let n=e.getFields();e[iz]=!0,Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=Az(t,r.resolve),r.type)){let e=Tz(r.type);for(let n of e)wz(n,t)}})}function Tz(e){return`ofType`in e?Tz(e.ofType):Ez(e)?e.getTypes():Dz(e)?[e]:[]}function Ez(e){return`getTypes`in e&&typeof e.getTypes==`function`}function Dz(e){return`getFields`in e&&typeof e.getFields==`function`}var Oz=(e,t,n)=>{n&&(e.setStatus({code:2,message:t.message}),e.end())},kz=(e,t)=>{t&&e.end()};function Az(e,t,n=!1){if(r[iz]||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[az])return t.call(this,r,i,a,o);let{field:s,spanAdded:c}=uz(a,o,vz(o?.path)),l=s.span,u=c;return B(l,()=>{try{let e=t.call(this,r,i,a,o);return cz(e)?e.then(e=>(kz(l,u),e),e=>{throw Oz(l,e,u),e}):(kz(l,u),e)}catch(e){throw Oz(l,e,u),e}})}return r[iz]=!0,r}var jz=`@sentry/instrumentation-graphql`,Mz=`auto.graphql.otel.graphql`,Nz={ignoreResolveSpans:!1},Pz=[`>=14.0.0 <17`],Fz=class extends K{constructor(e={}){super(jz,k,{...Nz,...e})}setConfig(e={}){super.setConfig({...Nz,...e})}init(){let e=new q(`graphql`,Pz);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new $R(`graphql/execution/execute.js`,Pz,e=>(G(e.execute)&&this._unwrap(e,`execute`),this._wrap(e,`execute`,this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,`execute`)})}_addPatchingParser(){return new $R(`graphql/language/parser.js`,Pz,e=>(G(e.parse)&&this._unwrap(e,`parse`),this._wrap(e,`parse`,this._patchParse()),e),e=>{e&&this._unwrap(e,`parse`)})}_addPatchingValidate(){return new $R(`graphql/validation/validate.js`,Pz,e=>(G(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=pz(r.document,r.operationName),a=t._createExecuteSpan(i,r);return r.contextValue[az]={source:r.document?r.document||r.document[az]:void 0,span:a,fields:{}},B(a,()=>MT(()=>n.apply(this,[r]),(e,n)=>{t._handleExecutionResult(a,e,n)}))}}}_handleExecutionResult(e,t,n){if(n===void 0||t){fz(e,t);return}cz(n)?n.then(t=>{this._updateSpanFromResult(e,t),fz(e)},t=>{fz(e,t)}):(this._updateSpanFromResult(e,n),fz(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[rz.OPERATION_TYPE],i=n[rz.OPERATION_NAME];if(!r)return;let a=ra(e),o=L(a).data[`sentry.graphql.operation`]||[],s=i?`${r} ${i}`:`${r}`;Array.isArray(o)?(o.push(s),a.setAttribute(xO,o)):typeof o==`string`?a.setAttribute(xO,[o,s]):a.setAttribute(xO,s),L(a).data[`original-description`]||a.setAttribute(`original-description`,L(a).description),a.updateName(`${L(a).data[`original-description`]} (${Iz(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=z({name:nz.PARSE});return B(i,()=>MT(()=>t.call(e,n,r),(e,t)=>{t&&(pz(t)?t.loc&&lz(i,t.loc):i.updateName(nz.SCHEMA_PARSE)),fz(i,e)}))}_validate(e,t,n,r,i,a,o){let s=z({name:nz.VALIDATE});return B(s,()=>MT(()=>t.call(e,n,r,i,o,a),(e,t)=>{r.loc||s.updateName(nz.SCHEMA_VALIDATE),fz(s,e)}))}_createExecuteSpan(e,t){let n=z({name:nz.EXECUTE,attributes:{[I]:Mz}});if(e){let{operation:t,name:r}=e;n.setAttribute(rz.OPERATION_TYPE,t);let i=r?.value;i?(n.setAttribute(rz.OPERATION_NAME,i),n.updateName(`${t} ${i}`)):n.updateName(t)}else{let e=` `;t.operationName&&(e=` "${t.operationName}" `),e=oz.replace(`$operationName$`,e),n.setAttribute(rz.OPERATION_NAME,e)}return t.document?.loc&&lz(n,t.document.loc),n}_wrapExecuteArgs(e,t,n,r,i,a,o,s,c){return r||={},r[az]||this.getConfig().ignoreResolveSpans?{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s}:(o=Az(()=>this.getConfig(),o??c,o==null),e&&(wz(e.getQueryType(),()=>this.getConfig()),wz(e.getMutationType(),()=>this.getConfig())),{schema:e,document:t,rootValue:n,contextValue:r,variableValues:i,operationName:a,fieldResolver:o,typeResolver:s})}};function Iz(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 Lz=`Graphql`,Rz=J(Lz,Fz,e=>Bz(e)),zz=U(((e={})=>Nu(wF(Bz(e)),{name:Lz,setupOnce(){Rz(Bz(e))}})));function Bz(e){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...e}}var Vz=`messaging.destination.partition.id`,Hz=`messaging.kafka.message.key`,Uz=`messaging.kafka.message.tombstone`,Wz=`messaging.kafka.offset`,Gz=`process`,Kz=`receive`,qz=`send`,Jz=`kafka`,Yz=`_OTHER`;x();var Xz=`auto.kafkajs.otel.producer`,Zz=`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 $z(e){let t=Qz(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:a}=Ai(t,Qz(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:a?i.SAMPLED:i.NONE}}]}function eB({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return z({name:`${a} ${e}`,kind:n===`receive`?W.CLIENT:W.CONSUMER,links:r,attributes:{...i,[Uc]:Jz,[zc]:e,[Hc]:n,[Vc]:a,[Hz]:t?.key?String(t.key):void 0,[Uz]:t?.key&&t.value===null?!0:void 0,[Wz]:t?.offset,...t?{[I]:Zz}:{}}})}function tB(e,t){let n=z({name:`send ${e}`,kind:W.PRODUCER,attributes:{[Uc]:Jz,[zc]:e,[Hz]:t.key?String(t.key):void 0,[Uz]:t.key&&t.value===null?!0:void 0,[Vz]:t.partition===void 0?void 0:String(t.partition),[Vc]:`send`,[Hc]:qz,[I]:Xz}});t.headers=t.headers??{};let r=Ef({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function nB(e,t){return Promise.resolve(t).catch(t=>{let n,r=Yz;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(Ws,r),e.setStatus({code:2,message:n})}),t}).finally(()=>{e.forEach(e=>e.end())})}var rB=`@sentry/instrumentation-kafkajs`,iB=class extends K{constructor(e={}){super(rB,k,e)}init(){let e=e=>{G(e?.Kafka?.prototype.producer)&&this._unwrap(e.Kafka.prototype,`producer`),G(e?.Kafka?.prototype.consumer)&&this._unwrap(e.Kafka.prototype,`consumer`)};return new q(`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 G(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 G(r.sendBatch)&&e._unwrap(r,`sendBatch`),e._wrap(r,`sendBatch`,e._getSendBatchPatch()),G(r.send)&&e._unwrap(r,`send`),e._wrap(r,`send`,e._getSendPatch()),G(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&&(G(r.eachMessage)&&e._unwrap(r,`eachMessage`),e._wrap(r,`eachMessage`,e._getConsumerEachMessagePatch())),r?.eachBatch&&(G(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 uo({sentryTrace:Qz(n.message.headers,`sentry-trace`),baggage:Qz(n.message.headers,`baggage`)},()=>{let r=eB({topic:n.topic,message:n.message,operationType:Gz,attributes:{[Vz]:String(n.partition)}}),i=B(r,()=>e.apply(this,t));return nB([r],i)})}}_getConsumerEachBatchPatch(){return e=>function(...t){let n=t[0],r=mo(()=>eB({topic:n.batch.topic,message:void 0,operationType:Kz,attributes:{[Lc]:n.batch.messages.length,[Vz]:String(n.batch.partition)}}));return B(r,()=>{let i=[r];return n.batch.messages.forEach(e=>{i.push(eB({topic:n.batch.topic,message:e,operationType:Gz,links:$z(e.headers),attributes:{[Vz]:String(n.batch.partition)}}))}),nB(i,e.apply(this,t))})}}_getProducerTransactionPatch(){let e=this;return t=>function(...n){let r=z({name:`transaction`}),i=t.apply(this,n);return i.then(t=>{let n=t.send;t.send=function(...t){return B(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 B(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 nB([r],t)};let o=t.abort;t.abort=function(...e){let t=o.apply(this,e);return nB([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(tB(e.topic,t))})}),nB(r,e.apply(this,t))}}_getSendPatch(){return e=>function(...t){let n=t[0];return nB(n.messages.map(e=>tB(n.topic,e)),e.apply(this,t))}}},aB=`Kafka`,oB=J(aB,()=>new iB),sB=U((()=>({name:aB,setupOnce(){oB()}}))),cB=`@sentry/instrumentation-lru-memoizer`,lB=class extends K{constructor(){super(cB,k,{})}init(){return[new q(`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)]}},uB=`LruMemoizer`,dB=J(uB,()=>new lB),fB=U((()=>({name:uB,setupOnce(){dB()}}))),pB=`auto.db.otel.mongo`;function mB(e,t,n,r){return tI(e,t,n,r,pB)}function hB(e,t,n,r){return iI(e,t,n,r,pB)}function gB(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 B(n??null,()=>t.apply(this,i))}}function _B(){return!R()}function vB(e){return t=>function(n,r,i,a,o){let s=typeof a==`function`?a:o;if(_B()||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=gB(aI(hB(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 yB(){return e=>function(t,n,r,i,a){let o=typeof i==`function`?i:a;if(_B()||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=gB(aI(hB(n,t,r,rI(r))),o);return typeof i==`function`?e.call(this,t,n,r,s):e.call(this,t,n,r,i,s)}}function bB(){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;_B()||(s=aI(mB(this,t,n,o)));let c=gB(s,a);return e.call(this,t,n,r,c)}}function xB(){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;_B()||(o=aI(mB(this,n,r,i)));let s=gB(o,a),c=e.apply(this,t);return c.then(e=>s(null,e),e=>s(e)),c}}function SB(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(_B()||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=gB(aI(hB(n,t,r,`find`)),s);return typeof a==`function`?e.call(this,t,n,r,i,c):e.call(this,t,n,r,i,a,c)}}function CB(){return e=>function(t,n,r,i,a,o){let s=typeof a==`function`?a:o;if(_B()||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=gB(aI(hB(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 wB(){return e=>function(t){let n=R();return e.call(this,function(...e){return B(n??null,()=>t.apply(this,e))})}}var TB=`@sentry/instrumentation-mongodb`,EB=class extends K{constructor(e={}){super(TB,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 q(`mongodb`,[`>=3.3.0 <4`],void 0,void 0,[new $R(`mongodb/lib/core/wireprotocol/index.js`,[`>=3.3.0 <4`],e,t)]),new q(`mongodb`,[`>=4.0.0 <8`],void 0,void 0,[new $R(`mongodb/lib/cmap/connection.js`,[`>=4.0.0 <6.4`],n,i),new $R(`mongodb/lib/cmap/connection.js`,[`>=6.4.0 <8`],r,i),new $R(`mongodb/lib/cmap/connection_pool.js`,[`>=4.0.0 <6.4`],a,o)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>(G(e.insert)&&this._unwrap(e,`insert`),this._wrap(e,`insert`,vB(`insert`)),G(e.remove)&&this._unwrap(e,`remove`),this._wrap(e,`remove`,vB(`remove`)),G(e.update)&&this._unwrap(e,`update`),this._wrap(e,`update`,vB(`update`)),G(e.command)&&this._unwrap(e,`command`),this._wrap(e,`command`,yB()),G(e.query)&&this._unwrap(e,`query`),this._wrap(e,`query`,SB()),G(e.getMore)&&this._unwrap(e,`getMore`),this._wrap(e,`getMore`,CB()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,`insert`),this._unwrap(e,`remove`),this._unwrap(e,`update`),this._unwrap(e,`command`),this._unwrap(e,`query`),this._unwrap(e,`getMore`))}}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let t=e.ConnectionPool.prototype;return G(t.checkOut)&&this._unwrap(t,`checkOut`),this._wrap(t,`checkOut`,wB()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,`checkOut`)}}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>(G(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,bB()),e),v4PatchConnectionPromise:e=>(G(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,`command`),this._wrap(e.Connection.prototype,`command`,xB()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,`command`)}}}},DB=`Mongo`,OB=J(DB,()=>new EB),kB=U((()=>({name:DB,setupOnce(){OB()}})));function AB(e,t){e.setStatus({code:2,message:`${t.message} ${t.code?`
31
+ Mongoose Error Code: ${t.code}`:``}`})}function jB(e,t){return e instanceof Promise?e.catch(e=>{throw AB(t,e),e}).finally(()=>t.end()):(t.end(),e)}function MB(e,t,n,r,i){let a=0;return i.length===2?a=1:i.length===3&&(a=2),i[a]=(t,n)=>(t&&AB(r,t),r.end(),e(t,n)),t.apply(n,i)}var NB=`@sentry/instrumentation-mongoose`,PB=`auto.db.otel.mongoose`,FB=[`deleteOne`,`deleteMany`,`find`,`findOne`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`],IB=[`remove`,`count`,`findOneAndRemove`,...FB],LB=[`count`,`findOneAndRemove`,...FB],RB=[...FB];function zB(e){return e?e.startsWith(`6.`)||e.startsWith(`5.`)?IB:e.startsWith(`7.`)?LB:RB:FB}function BB(e){return e&&(e.startsWith(`5.`)||e.startsWith(`6.`))||!1}function VB(e){return!e||!e.startsWith(`8.`)?!1:parseInt(e.split(`.`)[1],10)>=21}var HB=Symbol(`stored-parent-span`),UB=Symbol(`already-instrumented`),WB=class extends K{constructor(e={}){super(NB,k,e)}init(){return new q(`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,BB(t)&&this._wrap(n.Model.prototype,`remove`,this.patchOnModelMethods(`remove`)),VB(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()),zB(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=zB(t);this._unwrap(n.Model.prototype,`save`),n.Model.prototype.$save=n.Model.prototype.save,BB(t)&&this._unwrap(n.Model.prototype,`remove`),VB(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[HB],i=KR({collection:this._model.collection,modelName:this._model?.modelName,operation:`aggregate`,origin:PB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchQueryExec(){let e=this;return t=>function(n){if(this[UB])return t.apply(this,arguments);let r=this[HB],i=KR({collection:this.mongooseCollection,modelName:this.model.modelName,operation:this.op,origin:PB,parentSpan:r});return e._handleResponse(i,t,this,arguments,n)}}patchOnModelMethods(e){let t=this;return n=>function(r,i){let a=KR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:PB});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=KR({collection:this.constructor.collection,modelName:this.constructor.modelName,operation:e,origin:PB}),c=t._handleResponse(s,n,this,arguments,o);return c&&typeof c==`object`&&(c[UB]=!0),c}}patchModelStatic(e){let t=this;return n=>function(r,i,a){typeof i==`function`&&(a=i);let o=KR({collection:this.collection,modelName:this.modelName,operation:e,origin:PB});return t._handleResponse(o,n,this,arguments,a)}}patchModelAggregate(){return e=>function(){let t=R(),n=e.apply(this,arguments);return n&&(n[HB]=t),n}}patchAndCaptureSpanContext(e){return e=>function(){return this[HB]=R(),e.apply(this,arguments)}}_handleResponse(e,t,n,r,i){return B(e,()=>i instanceof Function?MB(i,t,n,e,r):jB(t.apply(n,r),e))}},GB=`Mongoose`,KB=J(GB,()=>new WB),qB=U((()=>Nu(BF(),{name:GB,setupOnce(){KB()}}))),JB=`db.connection_string`,YB=`mysql`;function XB(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function ZB(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 $B(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var eV=`@sentry/instrumentation-mysql`,tV=`auto.db.otel.mysql`,nV=class extends K{constructor(e={}){super(eV,k,e)}init(){return[new q(`mysql`,[`>=2.0.0 <3`],e=>(G(e.createConnection)&&this._unwrap(e,`createConnection`),this._wrap(e,`createConnection`,this._patchCreateConnection()),G(e.createPool)&&this._unwrap(e,`createPool`),this._wrap(e,`createPool`,this._patchCreatePool()),G(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&&(G(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}=XB(e.config),u=parseInt(String(s),10),d={[I]:tV,[Vs]:YB,[JB]:ZB(o,s,c),[Ps]:c,[Us]:l,[Bs]:QB(r),[Qc]:o};isNaN(u)||(d[$c]=u);let f=z({name:$B(r),kind:W.CLIENT,attributes:d}),p=Array.from(arguments).findIndex(e=>typeof e==`function`),m=M();if(p===-1){let n=B(f,()=>t.apply(e,arguments));return Lo(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)),B(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))}}},rV=`Mysql`,iV=J(rV,()=>new nV({})),aV=U((()=>({name:rV,setupOnce(){iV()}}))),oV=`db.connection_string`,sV=`mysql`;function cV(e){let{host:t,port:n,database:r,user:i}=lV(e),a={[oV]:uV(t,n,r),[Ps]:r,[Us]:i,[Qc]:t},o=parseInt(n,10);return isNaN(o)||(a[$c]=o),a}function lV(e){let{host:t,port:n,database:r,user:i}=e?.connectionConfig||e||{};return{host:t,port:n,database:r,user:i}}function uV(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),typeof n==`string`&&(r+=`/${n}`),r}function dV(e,t,n){let[r,i]=typeof e==`string`?[e,n]:[e.sql,fV(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 fV(e){return`values`in e}function pV(e){let t=typeof e==`object`?e.sql:e,n=t?.indexOf(` `);return typeof n==`number`&&n!==-1?t?.substring(0,n):t}var mV=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}};function hV(e){let t=e.prototype,n=Object.getPrototypeOf(t);return typeof n?.query==`function`&&typeof n?.execute==`function`?n:t}var gV=`@sentry/instrumentation-mysql2`,_V=`auto.db.otel.mysql2`,vV=[`>=1.4.2 <3.20.0`],yV=class extends K{constructor(e={}){super(gV,k,e)}init(){let e;function t(t){!e&&t.format&&(e=t.format)}let n=t=>{G(t.query)&&this._unwrap(t,`query`),this._wrap(t,`query`,this._patchQuery(e)),G(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 q(`mysql2`,vV,e=>(t(e),e),()=>{},[new $R(`mysql2/promise.js`,vV,e=>(t(e),e),()=>{}),new $R(`mysql2/lib/connection.js`,vV,e=>{let t=hV(e);return n(t),e},e=>{if(e===void 0)return;let t=hV(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={...cV(this.config),[Vs]:sV,[Bs]:dV(r,e,o),[I]:_V},c=z({name:pV(r),kind:W.CLIENT,attributes:s}),l=mV(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)}}},bV=`Mysql2`,xV=J(bV,()=>new yV),SV=U((()=>Nu(gI(),{name:bV,setupOnce(){xV()}}))),CV,wV;function TV(e){CV=e}function EV(){return!!CV}function DV(){if(CV)return wV??=CV()}var OV=[`get`,`set`,`setex`],kV=[`get`,`mget`],AV=[`set`,`setex`],jV=[`del`,`unlink`];function MV(e,t){return e.includes(t.toLowerCase())}function NV(e){if(MV(kV,e))return`cache.get`;if(MV(AV,e))return`cache.put`;if(MV(jV,e))return`cache.remove`}function PV(e,t){return t.some(t=>e.startsWith(t))}function FV(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)?RV(e.map(e=>n(e))):[`<unknown>`],r=t[0];return MV(OV,e)&&r!=null?n(r):RV(t.map(e=>n(e)))}catch{return}}function IV(e,t,n){if(!NV(e))return!1;for(let e of t)if(PV(e,n))return!0;return!1}function LV(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 RV(e){let t=[],n=e=>{e.forEach(e=>{Array.isArray(e)?n(e):t.push(e)})};return n(e),t}var zV={};function BV(e){zV=e}var VV=(e,t,n,r)=>{let i=FV(t,n),a=NV(t);if(!i||!a||!zV.cachePrefixes||!IV(t,i,zV.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=MV(jV,t)?void 0:LV(r);l&&e.setAttribute(Gr,l),MV(kV,t)&&l!==void 0&&e.setAttribute(Ur,l>0),e.setAttributes({[F]:a,[Wr]:i});let u=i.join(`, `);e.updateName(zV.maxCacheKeyLength?xn(u,zV.maxCacheKeyLength):u)},HV=`db.connection_string`,UV=`redis`,WV=`@sentry/instrumentation-ioredis`,GV=`auto.db.otel.redis`,KV=[`>=2.0.0 <5.11.0`];function qV(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}var JV=class extends K{constructor(e={}){super(WV,k,e)}init(){return[new q(`ioredis`,KV,e=>{let t=e[Symbol.toStringTag]===`Module`&&e.default?e.default:e;return G(t.prototype.sendCommand)&&this._unwrap(t.prototype,`sendCommand`),this._wrap(t.prototype,`sendCommand`,this._patchSendCommand()),G(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={[Vs]:UV,[Bs]:eL(r.name,r.args),[HV]:`redis://${i}:${a}`,[Qc]:i,[$c]:a,[I]:GV},s=z({name:r.name,kind:W.CLIENT,attributes:o});try{let i=t.apply(this,n),a=r.resolve;r.resolve=function(t){e._callResponseHook(s,r,t),qV(s,null),a(t)};let o=r.reject;return r.reject=function(e){qV(s,e),o(e)},i}catch(e){throw qV(s,e),e}}}_patchConnection(){return e=>function(...t){if(!R())return e.apply(this,t);let{host:n,port:r}=this.options,i={[Vs]:UV,[Bs]:`connect`,[HV]:`redis://${n}:${r}`,[Qc]:n,[$c]:r,[I]:GV},a=z({name:`connect`,kind:W.CLIENT,attributes:i});try{let n=e.apply(this,t);return n instanceof Promise?n.then(e=>(qV(a,null),e),e=>(qV(a,e),Promise.reject(e))):(qV(a,null),n)}catch(e){throw qV(a,e),e}}}_callResponseHook(e,t,n){let{responseHook:r}=this.getConfig();if(r)try{r(e,t.name,t.args,n)}catch{}}},YV=`@sentry/instrumentation-redis`,XV=`auto.db.otel.redis`,ZV=Symbol(`opentelemetry.instrumentation.redis.open_spans`),QV=Symbol(`opentelemetry.instrumentation.redis.multi_command_options`);function $V(e,t){t&&e.setStatus({code:2,message:t.message}),e.end()}function eH(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function tH(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){xP&&A.error(`failed to sanitize redis connection url`,e)}}function nH(e){return{[Vs]:UV,[Qc]:e?.socket?.host,[$c]:e?.socket?.port,[HV]:tH(e?.url),[I]:XV}}var rH=class e extends K{constructor(e={}){super(YV,k,e)}init(){return[new q(`redis`,[`>=2.6.0 <4`],e=>(G(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={[Vs]:UV,[Bs]:eL(r.command,r.args),[I]:XV};this.connection_options&&(i[Qc]=this.connection_options.host,i[$c]=this.connection_options.port),this.address&&(i[HV]=`redis://${this.address}`);let a=z({name:`${e.COMPONENT}-${r.command}`,kind:W.CLIENT,attributes:i}),o=arguments[0].callback;if(o){let e=R();arguments[0].callback=function(n,i){return eH(t.getConfig().responseHook,a,r.command,r.args,i),$V(a,n),B(e??null,()=>o.apply(this,arguments))}}try{return n.apply(this,arguments)}catch(e){throw $V(a,e),e}}}}};rH.COMPONENT=`redis`;var iH=rH,aH=class e extends K{constructor(e={}){super(YV,k,e)}init(){return[this._getInstrumentationNodeModuleDefinition(`@redis/client`),this._getInstrumentationNodeModuleDefinition(`@node-redis/client`)]}_getInstrumentationNodeModuleDefinition(e){return new q(e,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>e,()=>{},[new $R(`${e}/dist/lib/commander.js`,[`^1.0.0`],(e,t)=>{let n=e.transformCommandArguments;if(!n)return xP&&A.error(`internal instrumentation error, missing transformCommandArguments function`),e;let r=t?.startsWith(`1.0.`)?`extendWithCommands`:`attachCommands`;return G(e?.[r])&&this._unwrap(e,r),this._wrap(e,r,this._getPatchExtendWithCommands(n)),e},e=>{G(e?.extendWithCommands)&&this._unwrap(e,`extendWithCommands`),G(e?.attachCommands)&&this._unwrap(e,`attachCommands`)}),new $R(`${e}/dist/lib/client/multi-command.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return G(t?.exec)&&this._unwrap(t,`exec`),this._wrap(t,`exec`,this._getPatchMultiCommandsExec()),G(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),this._wrap(t,`execAsPipeline`,this._getPatchMultiCommandsExec()),G(t?.addCommand)&&this._unwrap(t,`addCommand`),this._wrap(t,`addCommand`,this._getPatchMultiCommandsAddCommand()),e},e=>{let t=e?.default?.prototype;G(t?.exec)&&this._unwrap(t,`exec`),G(t?.execAsPipeline)&&this._unwrap(t,`execAsPipeline`),G(t?.addCommand)&&this._unwrap(t,`addCommand`)}),new $R(`${e}/dist/lib/client/index.js`,[`^1.0.0`,`>=5.0.0 <5.12.0`],e=>{let t=e?.default?.prototype;return t?.multi&&(G(t?.multi)&&this._unwrap(t,`multi`),this._wrap(t,`multi`,this._getPatchRedisClientMulti())),t?.MULTI&&(G(t?.MULTI)&&this._unwrap(t,`MULTI`),this._wrap(t,`MULTI`,this._getPatchRedisClientMulti())),G(t?.sendCommand)&&this._unwrap(t,`sendCommand`),this._wrap(t,`sendCommand`,this._getPatchRedisClientSendCommand()),G(t?.connect)&&this._unwrap(t,`connect`),this._wrap(t,`connect`,this._getPatchedClientConnect()),e},e=>{let t=e?.default?.prototype;G(t?.multi)&&this._unwrap(t,`multi`),G(t?.MULTI)&&this._unwrap(t,`MULTI`),G(t?.sendCommand)&&this._unwrap(t,`sendCommand`),G(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[ZV];return e._endSpansWithRedisReplies(n,t),t}).catch(t=>{let n=this[ZV];if(!n)xP&&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)}):(xP&&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=nH(this.options),r=z({name:`${e.COMPONENT}-connect`,kind:W.CLIENT,attributes:n});return B(r,()=>t.apply(this)).then(e=>(r.end(),e),e=>($V(r,e),Promise.reject(e)))}}}_traceClientCommand(t,n,r,i){let a=n.options||n[QV],o=i[0],s=i.slice(1),c=nH(a),l=eL(o,s);l!=null&&(c[Bs]=l);let u=z({name:`${e.COMPONENT}-${o}`,kind:W.CLIENT,attributes:c}),d=B(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[ZV]=e[ZV]||[],e[ZV].push({span:u,commandName:o,commandArgs:s})}return d}_endSpansWithRedisReplies(e,t){if(!e){xP&&A.error(`cannot find open spans to end for redis multi/pipeline`);return}if(t.length!==e.length){xP&&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||eH(this.getConfig().responseHook,e,t,n,r),$V(e,i)}};aH.COMPONENT=`redis`;var oH=aH,sH=class extends K{constructor(e={}){super(YV,k,e),this.initialized=!1,this.instrumentationV2_V3=new iH(this.getConfig()),this.instrumentationV4_V5=new oH(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())}},cH=`Redis`,lH=J(`${cH}.IORedis`,()=>new JV({responseHook:VV})),uH=J(`${cH}.Redis`,()=>new sH({responseHook:VV})),dH=Object.assign(()=>{(!EV()||!S.tracingChannel)&&(lH(),uH())},{id:cH}),fH=U(((e={})=>Nu(QI({responseHook:VV}),{name:cH,setupOnce(){BV(e),dH()}}))),pH=(e=>(e.QUERY_PREFIX=`pg.query`,e.CONNECT=`pg.connect`,e.POOL_CONNECT=`pg-pool.connect`,e))(pH||{}),mH=(e=>(e.PG_PLAN=`db.postgresql.plan`,e.IDLE_TIMEOUT_MILLIS=`db.postgresql.idle.timeout.millis`,e.MAX_CLIENT=`db.postgresql.max.client`,e))(mH||{}),hH=`db.connection_string`,gH=`postgresql`,_H=`auto.db.otel.postgres`;function vH(e,t){if(!t)return pH.QUERY_PREFIX;let n=typeof t.name==`string`&&t.name?t.name:yH(t.text);return`${pH.QUERY_PREFIX}:${n}${e?` ${e}`:``}`}function yH(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 bH(e){try{let t=new URL(e);return t.username=``,t.password=``,t.toString()}catch{return`postgresql://localhost:5432/`}}function xH(e){return`connectionString`in e&&e.connectionString?bH(e.connectionString):`postgresql://${e.host||`localhost`}:${e.port||5432}/${e.database||``}`}function SH(e){if(Number.isInteger(e))return e}function CH(e){return{[Vs]:gH,[Ps]:e.database,[hH]:xH(e),[Us]:e.user,[Qc]:e.host,[$c]:SH(e.port)}}function wH(e){let t;try{t=e.connectionString?new URL(e.connectionString):void 0}catch{t=void 0}return{[mH.IDLE_TIMEOUT_MILLIS]:e.idleTimeoutMillis,[mH.MAX_CLIENT]:e.maxClient,[Vs]:gH,[Ps]:t?.pathname.slice(1)??e.database,[hH]:xH(e),[Qc]:t?.hostname??e.host,[$c]:Number(t?.port)||SH(e.port),[Us]:t?.username??e.user}}function TH(){return R()===void 0}function EH(e){let{connectionParameters:t}=this,n=t.database,r=z({name:vH(n,e),kind:W.CLIENT,attributes:{...CH(t),[I]:_H}});return e?(e.text&&r.setAttribute(Bs,e.text),typeof e.name==`string`&&r.setAttribute(mH.PG_PLAN,e.name),r):r}function DH(e,t){return function(n,r){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r)}}function OH(e,t){return function(n,r,i){n&&e.setStatus({code:2,message:n.message}),e.end(),t.call(this,n,r,i)}}function kH(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 AH(e){return typeof e==`object`&&e&&`message`in e?String(e.message):void 0}function jH(e){return typeof e==`object`&&typeof e?.text==`string`}var MH=`@sentry/instrumentation-pg`;function NH(e){return e[Symbol.toStringTag]===`Module`?e.default:e}function PH(e,t){return function(...n){return B(e,()=>t.apply(this,n))}}var FH=class extends K{constructor(e={}){super(MH,k,e)}init(){let e=[`>=8.0.3 <9`],t=[`>=2.0.0 <4`],n=new $R(`pg/lib/native/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this));return[new q(`pg`,e,e=>{let t=NH(e);return this._patchPgClient(t.Client),e},e=>{let t=NH(e);return this._unpatchPgClient(t.Client),e},[new $R(`pg/lib/client.js`,e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),n]),new q(`pg-pool`,t,e=>{let t=NH(e);return G(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),this._wrap(t.prototype,`connect`,this._getPoolConnectPatch()),t},e=>{let t=NH(e);G(t.prototype.connect)&&this._unwrap(t.prototype,`connect`)})]}_patchPgClient(e){if(!e)return;let t=NH(e);return G(t.prototype.query)&&this._unwrap(t.prototype,`query`),G(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=NH(e);return G(t.prototype.query)&&this._unwrap(t.prototype,`query`),G(t.prototype.connect)&&this._unwrap(t.prototype,`connect`),e}_getClientConnectPatch(){let e=this;return t=>function(n){if(TH()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=z({name:pH.CONNECT,kind:W.CLIENT,attributes:CH(this)}),i=n;if(i){let e=R();i=kH(r,i),e&&(i=PH(e,i))}return IH(r,B(r,()=>t.call(this,i)))}}_getClientQueryPatch(){return e=>(this._diag.debug(`Patching pg.Client.prototype.query`),function(...t){if(TH())return e.apply(this,t);let n=t[0],r=typeof n==`string`,i=jH(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=EH.call(this,a);if(t.length>0){let e=R();if(typeof t[t.length-1]==`function`)t[t.length-1]=DH(o,t[t.length-1]),e&&(t[t.length-1]=PH(e,t[t.length-1]));else if(typeof a?.callback==`function`){let n=DH(o,a.callback);e&&(n=PH(e,n)),t[0].callback=n}}let s;try{s=e.apply(this,t)}catch(e){throw o.setStatus({code:2,message:AH(e)}),o.end(),e}return s instanceof Promise?s.then(e=>(o.end(),e)).catch(e=>(o.setStatus({code:2,message:AH(e)}),o.end(),Promise.reject(e))):s})}_getPoolConnectPatch(){let e=this;return t=>function(n){if(TH()||e.getConfig().ignoreConnectSpans)return t.call(this,n);let r=z({name:pH.POOL_CONNECT,kind:W.CLIENT,attributes:wH(this.options)}),i=n;if(i){let e=R();i=OH(r,i),e&&(i=PH(e,i))}return IH(r,B(r,()=>t.call(this,i)))}}};function IH(e,t){return t instanceof Promise?t.then(t=>(e.end(),t)).catch(t=>(e.setStatus({code:2,message:AH(t)}),e.end(),Promise.reject(t))):t}var LH=`Postgres`,RH=J(LH,FH,e=>({ignoreConnectSpans:e?.ignoreConnectSpans??!1})),zH=U((e=>({name:LH,setupOnce(){RH(e)}})));x();var BH=`PostgresJs`,VH=[`>=3.0.0 <4`],HH=`db.response.status_code`,UH=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,WH=Symbol.for(`sentry.query.from.instrumented.sql`),GH=J(BH,e=>new KH({requireParentSpan:e?.requireParentSpan??!0,requestHook:e?.requestHook})),KH=class extends K{constructor(e){super(`sentry-postgres-js`,k,e)}init(){let e=new q(`postgres`,VH,e=>{try{return this._patchPostgres(e)}catch(t){return xP&&A.error(`Failed to patch postgres module:`,t),e}},e=>e);return[`src`,`cf/src`,`cjs/src`].forEach(t=>{e.files.push(new $R(`postgres/${t}/query.js`,VH,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 xP&&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 xP&&A.warn(`postgres() did not return a valid instance`),t;let i=r.getConfig();return iC(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:(hb(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(Rs,n);return}let r=t?.match(UH);r?.[1]&&e.setAttribute(Rs,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[WH]||!t._shouldCreateSpans())return n.apply(this,e);let r=t._reconstructQuery(this.strings),i=t._sanitizeSqlQuery(r);return so({name:i||`postgresjs.query`,op:`db`},r=>{LN(r,`auto.db.postgresjs`),r.setAttributes({[Hs]:`postgres`,[zs]:i});let{requestHook:a}=t.getConfig();a&&MT(()=>a(r,i,void 0),e=>{e&&(r.setAttribute(`sentry.hook.error`,`requestHook failed`),xP&&A.error(`Error in requestHook for ${BH} 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){xP&&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(HH,a?.[0]?.code||`unknown`),r.setAttribute(Ws,a?.[0]?.name||`unknown`),t._setOperationName(r,i),r.end()}catch(e){xP&&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}},qH=U((e=>({name:BH,setupOnce(){GH(e)}}))),JH=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(JH||{}),YH=`@hapi/hapi`,XH=Symbol(`hapi-handler-patched`),ZH={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},QH=new Set([`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`]);function $H(e){return e.name?e.name:e.pkg.name}var eU=e=>typeof e==`string`&&QH.has(e),tU=e=>{let t=e?.type;return t!==void 0&&eU(t)},nU=e=>Array.isArray(e)&&e.length<=3&&eU(e[0])&&typeof e[1]==`function`,rU=e=>!Array.isArray(e),iU=(e,t)=>{let n={[kc]:e.path,[Ec]:e.method},r;return t?(n[JH.HAPI_TYPE]=ZH.PLUGIN,n[JH.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[JH.HAPI_TYPE]=ZH.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},aU=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[JH.EXT_TYPE]:e,[JH.HAPI_TYPE]:ZH.EXT,[JH.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[JH.EXT_TYPE]:e,[JH.HAPI_TYPE]:ZH.EXT},name:r}},oU=e=>`plugin`in e?`plugin`in e.plugin?e.plugin.plugin:e.plugin:e;x();var sU=`@sentry/instrumentation-hapi`,cU=class extends K{constructor(e={}){super(sU,k,e)}init(){return new q(YH,[`>=17.0.0 <22`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return G(t.server)||this._wrap(t,`server`,this._getServerPatch.bind(this)),G(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=oU(e);t._wrapRegisterHandler(n)}else{let e=oU(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(eU(r.type)){let a=r;a.method=n._wrapExtMethods(a.method,r.type,t),i[e]=a}}return e.apply(this,r)}if(nU(r)){let i=r,a=i[1],o=n._wrapExtMethods(a,i[0],t);return e.apply(this,[i[0],o,i[2]])}if(tU(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=$H(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 rU(e)?e[XH]===!0?e:(e[XH]=!0,function(...r){if(_.getSpan(l.active())===void 0)return e.apply(this,r);let i=aU(t,n,e.name);return oo({name:i.name,op:`${i.attributes[JH.HAPI_TYPE]}.hapi`,attributes:{...i.attributes,[I]:`auto.http.otel.hapi`}},()=>e.apply(void 0,r))}):e}_wrapRouteHandler(e,t){if(e[XH]===!0)return e;e[XH]=!0;let n=n=>function(...r){if(_.getSpan(l.active())===void 0)return n.call(this,...r);SP(e.path);let i=iU(e,t);return oo({name:i.name,op:`${i.attributes[JH.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}},lU=`Hapi`,uU=J(lU,()=>new cU),dU=U((()=>({name:lU,setupOnce(){uU()}})));function fU(e){return!!(e&&typeof e==`object`&&`error`in e&&e.error)}function pU(e){V(e,{mechanism:{type:`auto.function.hapi`,handled:!1}})}var mU={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 xP&&A.warn(`Isolation scope is still the default isolation scope - skipping setting transactionName`);fU(t)&&pU(t.error)})}};async function hU(e){await e.register(mU),QM(e.register,`hapi`)}var gU={HONO_TYPE:`hono.type`,HONO_NAME:`hono.name`},_U={MIDDLEWARE:`middleware`,REQUEST_HANDLER:`request_handler`};x();var vU=`@sentry/instrumentation-hono`,yU=`0.0.1`,bU=class extends K{constructor(e={}){super(vU,yU,e)}init(){return[new q(`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({[gU.HONO_TYPE]:r,[gU.HONO_NAME]:r===_U.REQUEST_HANDLER?i:e.name||`anonymous`}),t.getConfig().responseHook?.(a),n});{let n=t._determineHandlerType(o);return a.setAttributes({[gU.HONO_TYPE]:n,[gU.HONO_NAME]:n===_U.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?_U.MIDDLEWARE:_U.REQUEST_HANDLER}_handleError(e,t){t instanceof Error&&(e.setStatus({code:oe.ERROR,message:t.message}),e.recordException(t))}},xU=`Hono`;function SU(e){let t=L(e).data,n=t[gU.HONO_TYPE];if(t[`sentry.op`]||!n)return;e.setAttributes({[I]:`auto.http.otel.hono`,[F]:`${n}.hono`});let r=t[gU.HONO_NAME];if(typeof r==`string`&&e.updateName(r),N()===ar()){xP&&A.warn(`Isolation scope is default isolation scope - skipping setting transactionName`);return}let i=t[kc],a=t[Dc];typeof i==`string`&&typeof a==`string`&&N().setTransactionName(`${a} ${i}`)}var CU=J(xU,()=>new bU({responseHook:e=>{SU(e)}})),wU=U((()=>({name:xU,setupOnce(){CU()}})));function TU(){return async function(e,t){let n=Lf(e.req);N().setSDKProcessingMetadata({normalizedRequest:n}),await t()}}function EU(e){return e.res.status>=500}function DU(e){return async function(t,n){await n(),(e?.shouldHandleError||EU)(t)&&(t.res.sentry=V(t.error,{mechanism:{type:`auto.middleware.hono`,handled:!1}}))}}function OU(e,t){e.use(TU()),e.use(DU(t)),QM(e.use,`hono`)}var kU=(e=>(e.ROUTER=`router`,e.MIDDLEWARE=`middleware`,e))(kU||{}),AU=(e=>(e.KOA_TYPE=`koa.type`,e.KOA_NAME=`koa.name`,e))(AU||{}),jU=(e,t,n,r)=>n?{attributes:{[AU.KOA_NAME]:r?.toString(),[AU.KOA_TYPE]:kU.ROUTER,[kc]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[AU.KOA_NAME]:t.name??`middleware`,[AU.KOA_TYPE]:kU.MIDDLEWARE,[Ms]:t.name??`middleware`},name:`middleware - ${t.name}`},MU=(e,t)=>!!(Array.isArray(t?.ignoreLayersType)&&t?.ignoreLayersType?.includes(e)),NU=Symbol(`koa-layer-patched`);x();var PU=`@sentry/instrumentation-koa`,FU=class extends K{constructor(e={}){super(PU,k,e)}init(){return new q(`koa`,[`>=2.0.0 <4`],e=>{let t=e[Symbol.toStringTag]===`Module`?e.default:e;return t==null?t:(G(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&&G(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?kU.ROUTER:kU.MIDDLEWARE;return e[NU]===!0||MU(r,this.getConfig())||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[NU]=!0,(i,a)=>{if(_.getSpan(l.active())===void 0)return e(i,a);let o=jU(i,e,t,n);i._matchedRoute&&SP(i._matchedRoute.toString());let s=o.attributes[AU.KOA_NAME];return oo({name:typeof s==`string`?s||`< unknown >`:o.name,op:`${r}.koa`,attributes:{...o.attributes,[I]:`auto.http.otel.koa`}},()=>{let t=o.attributes[kc];if(N()===ar())xP&&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)})})}},IU=`Koa`,LU=J(IU,FU,(e={})=>({ignoreLayersType:e.ignoreLayersType})),RU=U(((e={})=>({name:IU,setupOnce(){LU(e)}}))),zU=e=>{e.use(async(e,t)=>{try{await t()}catch(e){throw V(e,{mechanism:{handled:!1,type:`auto.middleware.koa`}}),e}}),QM(e.use,`koa`)},BU=(e=>(e.CONNECT_TYPE=`connect.type`,e.CONNECT_NAME=`connect.name`,e))(BU||{}),VU=(e=>(e.MIDDLEWARE=`middleware`,e.REQUEST_HANDLER=`request_handler`,e))(VU||{}),HU=Symbol(`opentelemetry.instrumentation-connect.request-route-stack`),UU=e=>{Array.isArray(e[HU])===!1&&Object.defineProperty(e,HU,{enumerable:!1,value:[]}),e[HU].push(`/`);let t=e[HU].length;return()=>{t===e[HU].length?e[HU].pop():xP&&A.warn(`Connect: Trying to pop the stack multiple time`)}},WU=(e,t)=>{t&&e[HU].splice(-1,1,t)},GU=e=>e[HU].reduce((e,t)=>e.replace(/\/+$/,``)+t),KU=`@sentry/instrumentation-connect`,qU=`anonymous`,JU=class extends K{constructor(e={}){super(KU,k,e)}init(){return[new q(`connect`,[`>=3.0.0 <4`],e=>this._patchConstructor(e))]}_patchApp(e){G(e.use)||this._wrap(e,`use`,this._patchUse.bind(this)),G(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?VU.REQUEST_HANDLER:VU.MIDDLEWARE,r=e||t.name||qU;return z({name:r,op:`${n}.connect`,attributes:{[I]:`auto.http.otel.connect`,[kc]:e.length>0?e:`/`,[BU.CONNECT_TYPE]:n,[BU.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];WU(l,e),e&&SP(GU(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=UU(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)}}},YU=`Connect`,XU=J(YU,()=>new JU),ZU=U((()=>({name:YU,setupOnce(){XU()}})));function QU(e,t,n,r){V(e,{mechanism:{handled:!1,type:`auto.middleware.connect`}}),r(e)}var $U=e=>{e.use(QU),QM(e.use,`connect`)},eW=`db.sql.table`,tW=`sqlite`,nW=`postgresql`,rW=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>`},iW=new Map([[`sqlite3`,tW],[`pg`,nW]]),aW=e=>iW.get(e)||e,oW=(e,t,n)=>t?n?`${t} ${e}.${n}`:`${t} ${e}`:e,sW=(e,t)=>typeof e==`string`&&typeof t==`number`&&0<t&&t<e.length?`${e.substring(0,t)}..`:e,cW=e=>{if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}},lW=e=>{if(e)try{return new URL(e).hostname||void 0}catch{return}},uW=e=>{if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}},dW=e=>{let t=e?._single?.table;return typeof t==`object`?dW(t):t},fW=`@sentry/instrumentation-knex`,pW=`auto.db.otel.knex`,mW=`knex`,hW=[`>=0.22.0 <4`,`>=0.10.0 <0.18.0`,`>=0.19.0 <0.22.0`,`>=0.18.0 <0.19.0`],gW=1022,_W=Symbol(`sentry.instrumentation-knex.parent-span`),vW=class extends K{constructor(e={}){super(fW,k,e)}init(){let e=new q(mW,hW);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 $R(`knex/${e}/runner.js`,hW,(e,t)=>(this._ensureWrapped(e.prototype,`query`,this._createQueryWrapper(t)),e),e=>(this._unwrap(e.prototype,`query`),e))}_getClientNodeModuleFileInstrumentation(e){return new $R(`knex/${e}/client.js`,hW,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=dW(this.builder),a=n?.method,o=r?.connection?.connectionString,s=r?.connection?.filename||r?.connection?.database||cW(o),c={[I]:pW,"knex.version":e,[Vs]:aW(this.client.driverName),[eW]:i,[Is]:a,[Us]:r?.connection?.user,[Ps]:s,[Qc]:r?.connection?.host??lW(o),[$c]:r?.connection?.port??uW(o),[el]:r?.connection?.filename===`:memory:`?`inproc`:void 0,[Bs]:sW(n?.sql,gW)},l=this.builder[_W]||R(),u=arguments;return oo({name:oW(s,a,i),kind:W.CLIENT,attributes:c,parentSpan:l,onlyIfParent:!0},e=>t.apply(this,u).catch(t=>{let r=rW(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,_W,{value:R()}),t}}_ensureWrapped(e,t,n){G(e[t])&&this._unwrap(e,t),this._wrap(e,t,n)}},yW=`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:yW}))}return n}var bW={name:`amqplib`,versionRange:`>=0.5.5 <2`},xW=[{channelName:`publish`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`publish`,kind:`Sync`}},{channelName:`confirmPublish`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`ConfirmChannel`,methodName:`publish`,kind:`Callback`}},{channelName:`consume`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`consume`,kind:`Async`}},{channelName:`dispatch`,module:{...bW,filePath:`lib/channel.js`},functionQuery:{className:`BaseChannel`,methodName:`dispatchMessage`,kind:`Sync`}},{channelName:`ack`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ack`,kind:`Sync`}},{channelName:`nack`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nack`,kind:`Sync`}},{channelName:`reject`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`reject`,kind:`Sync`}},{channelName:`ackAll`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`ackAll`,kind:`Sync`}},{channelName:`nackAll`,module:{...bW,filePath:`lib/channel_model.js`},functionQuery:{className:`Channel`,methodName:`nackAll`,kind:`Sync`}},{channelName:`connect`,module:{...bW,filePath:`lib/connect.js`},functionQuery:{functionName:`connect`,kind:`Callback`}}],SW={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`},CW=Q(xW),wW=[...[`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`}}))],TW={ANTHROPIC_CHAT:`orchestrion:@anthropic-ai/sdk:chat`,ANTHROPIC_MODELS:`orchestrion:@anthropic-ai/sdk:models`,ANTHROPIC_MESSAGES_STREAM:`orchestrion:@anthropic-ai/sdk:messages-stream`},EW=Q(wW),DW=[{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`}}],OW={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`},kW=Q(DW),AW={name:`dataloader`,versionRange:`>=2.0.0 <3`,filePath:`index.js`},jW=[{channelName:`construct`,module:AW,functionQuery:{functionName:`DataLoader`,kind:`Sync`}},{channelName:`load`,module:AW,functionQuery:{expressionName:`load`,kind:`Async`}},{channelName:`loadMany`,module:AW,functionQuery:{expressionName:`loadMany`,kind:`Async`}},{channelName:`prime`,module:AW,functionQuery:{expressionName:`prime`,kind:`Sync`}},{channelName:`clear`,module:AW,functionQuery:{expressionName:`clear`,kind:`Sync`}},{channelName:`clearAll`,module:AW,functionQuery:{expressionName:`clearAll`,kind:`Sync`}}],MW={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`},NW=Q(jW),PW=[{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`}}],FW={EXPRESS_HANDLE:`orchestrion:express:handle`,ROUTER_HANDLE:`orchestrion:router:handle`,EXPRESS_REGISTER:`orchestrion:express:register`,ROUTER_REGISTER:`orchestrion:router:register`},IW=Q(PW),LW=`>=3.0.0 <5`,RW=/dist\/lite\/(index|common-[^/]+)\.node\.(cjs\.js|mjs)$/,zW=[{functionName:`addDoc`,channelName:`add-doc`},{functionName:`getDocs`,channelName:`get-docs`},{functionName:`setDoc`,channelName:`set-doc`},{functionName:`deleteDoc`,channelName:`delete-doc`}],BW=`>=6.0.0 <7`,VW=[{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`}],HW=[...zW.map(({functionName:e,channelName:t})=>({channelName:t,module:{name:`@firebase/firestore`,versionRange:LW,filePath:RW},functionQuery:{functionName:e,kind:`Auto`}})),...VW.map(({file:e,functionName:t,channelName:n})=>({channelName:n,module:{name:`firebase-functions`,versionRange:BW,filePath:e},functionQuery:{functionName:t,kind:`Sync`}}))],UW={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`},WW=Q(HW),GW=[{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`}}],KW={GENERIC_POOL_ACQUIRE:`orchestrion:generic-pool:acquire`},qW=Q(GW),JW=[`dist/node/index.js`,`dist/node/index.mjs`,`dist/node/index.cjs`],YW=[...JW.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`}}))),...JW.map(e=>({channelName:`embed-content`,module:{name:`@google/genai`,versionRange:`>=0.10.0 <2`,filePath:e},functionQuery:{className:`Models`,methodName:`embedContent`,kind:`Auto`}})),...JW.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`}})))],XW={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`},ZW=Q(YW),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`}}],$W={GRAPHQL_PARSE:`orchestrion:graphql:parse`,GRAPHQL_VALIDATE:`orchestrion:graphql:validate`,GRAPHQL_EXECUTE:`orchestrion:graphql:execute`},eG=Q(QW),tG=[{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`}}],nG={HAPI_ROUTE:`orchestrion:@hapi/hapi:route`,HAPI_EXT:`orchestrion:@hapi/hapi:ext`},rG=Q(tG),iG=[...[`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`}}],aG={IOREDIS_COMMAND:`orchestrion:ioredis:command`,IOREDIS_CONNECT:`orchestrion:ioredis:connect`},oG=Q(iG),sG=[{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`}}],cG={KAFKAJS_SEND_BATCH:`orchestrion:kafkajs:send_batch`,KAFKAJS_CONSUMER_RUN:`orchestrion:kafkajs:consumer_run`},lG=Q(sG),uG=`knex`,dG=[{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`}],fG=[{filePath:`lib/client.js`,versionRange:`>=0.10.0 <4`},{filePath:`src/client.js`,versionRange:`>=0.18.0 <0.19.0`}],pG=[`queryBuilder`,`schemaBuilder`,`raw`];function mG(e,t){return{channelName:`query`,module:{name:uG,versionRange:t,filePath:e},functionQuery:{className:`Runner`,methodName:`query`,kind:`Async`}}}function hG(e,t,n){return{channelName:e,module:{name:uG,versionRange:n,filePath:t},functionQuery:{className:`Client`,methodName:e,kind:`Sync`}}}var gG=[...dG.map(({filePath:e,versionRange:t})=>mG(e,t)),...fG.flatMap(({filePath:e,versionRange:t})=>pG.map(n=>hG(n,e,t)))],_G={KNEX_QUERY:`orchestrion:knex:query`,KNEX_QUERY_BUILDER:`orchestrion:knex:queryBuilder`,KNEX_SCHEMA_BUILDER:`orchestrion:knex:schemaBuilder`,KNEX_RAW:`orchestrion:knex:raw`},vG=Q(gG),yG=[{channelName:`use`,module:{name:`koa`,versionRange:`>=2.0.0 <4`,filePath:`lib/application.js`},functionQuery:{className:`Application`,methodName:`use`,kind:`Sync`}}],bG={KOA_USE:`orchestrion:koa:use`},xG=Q(yG),SG=[`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`}}]}),CG=`embedQuery`,wG=`embedDocuments`,TG=[{name:`@langchain/openai`,versionRange:`>=0.1.0 <2.0.0`,methods:[CG,wG]},{name:`@langchain/google-genai`,versionRange:`>=0.1.0 <3.0.0`,methods:[CG,wG]},{name:`@langchain/mistralai`,versionRange:`>=0.1.0 <2.0.0`,methods:[CG,wG]},{name:`@langchain/google-common`,versionRange:`>=0.1.0 <3.0.0`,methods:[wG]}],EG=TG.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`}})))),DG=[...SG,...EG],OG=TG.flatMap(({name:e,methods:t})=>t.map(t=>`orchestrion:${e}:${t}`)),kG={LANGCHAIN_CHAT_MODEL_INVOKE:`orchestrion:@langchain/core:chatModelInvoke`,LANGCHAIN_CHAT_MODEL_STREAM:`orchestrion:@langchain/core:chatModelStream`},AG=Q(DG),jG=e=>({name:`@langchain/langgraph`,versionRange:`>=0.0.0 <2.0.0`,filePath:e}),MG=[`dist/graph/state.cjs`,`dist/graph/state.js`].map(e=>({channelName:`stateGraphCompile`,module:jG(e),functionQuery:{className:`StateGraph`,methodName:`compile`,kind:`Sync`}})),NG=[`dist/prebuilt/react_agent_executor.cjs`,`dist/prebuilt/react_agent_executor.js`].map(e=>({channelName:`createReactAgent`,module:jG(e),functionQuery:{functionName:`createReactAgent`,kind:`Sync`}})),PG=[...MG,...NG],FG={LANGGRAPH_STATE_GRAPH_COMPILE:`orchestrion:@langchain/langgraph:stateGraphCompile`,LANGGRAPH_CREATE_REACT_AGENT:`orchestrion:@langchain/langgraph:createReactAgent`},IG=Q(PG),LG=[{channelName:`load`,module:{name:`lru-memoizer`,versionRange:`>=2.1.0 <4`,filePath:`lib/async.js`},functionQuery:{functionName:`memoizedFunction`,kind:`Callback`}}],RG={LRU_MEMOIZER_LOAD:`orchestrion:lru-memoizer:load`},zG=Q(LG),BG={name:`mongodb`},VG=[{channelName:`command`,module:{...BG,versionRange:`>=6.4.0 <8`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Async`}},{channelName:`command`,module:{...BG,versionRange:`>=4.0.0 <6.4`,filePath:`lib/cmap/connection.js`},functionQuery:{methodName:`command`,kind:`Callback`}},{channelName:`checkout`,module:{...BG,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:{...BG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/index.js`},functionQuery:{expressionName:e,kind:`Callback`}})),{channelName:`v3_command`,module:{...BG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/command.js`},functionQuery:{functionName:`command`,kind:`Callback`}},{channelName:`v3_query`,module:{...BG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/query.js`},functionQuery:{functionName:`query`,kind:`Callback`}},{channelName:`v3_get_more`,module:{...BG,versionRange:`>=3.3.0 <4`,filePath:`lib/core/wireprotocol/get_more.js`},functionQuery:{functionName:`getMore`,kind:`Callback`}}],HG={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`},UG=Q(VG),WG={name:`mongoose`,versionRange:`>=5.9.7 <9.7.0`},GG=[`find`,`findOne`,`deleteOne`,`deleteMany`,`estimatedDocumentCount`,`countDocuments`,`distinct`,`where`,`$where`,`findOneAndUpdate`,`findOneAndDelete`,`findOneAndReplace`,`remove`,`count`,`findOneAndRemove`],KG=[{channelName:`query_exec`,module:{...WG,filePath:`lib/query.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`aggregate_exec`,module:{...WG,filePath:`lib/aggregate.js`},functionQuery:{expressionName:`exec`,kind:`Auto`}},{channelName:`model_save`,module:{...WG,filePath:`lib/model.js`},functionQuery:{expressionName:`save`,kind:`Auto`}},{channelName:`model_insert_many`,module:{...WG,filePath:`lib/model.js`},functionQuery:{expressionName:`insertMany`,kind:`Auto`}},{channelName:`model_bulk_write`,module:{...WG,filePath:`lib/model.js`},functionQuery:{expressionName:`bulkWrite`,kind:`Auto`}},{channelName:`model_remove`,module:{...WG,filePath:`lib/model.js`},functionQuery:{expressionName:`remove`,kind:`Auto`}},{channelName:`model_aggregate`,module:{...WG,filePath:`lib/model.js`},functionQuery:{expressionName:`aggregate`,kind:`Sync`}},...GG.map(e=>({channelName:`ctx_${e}`,module:{...WG,filePath:`lib/query.js`},functionQuery:{expressionName:e,kind:`Sync`}}))],qG={MONGOOSE_QUERY_EXEC:`orchestrion:mongoose:query_exec`,MONGOOSE_AGGREGATE_EXEC:`orchestrion:mongoose:aggregate_exec`,MONGOOSE_MODEL_SAVE:`orchestrion:mongoose:model_save`,MONGOOSE_MODEL_INSERT_MANY:`orchestrion:mongoose:model_insert_many`,MONGOOSE_MODEL_BULK_WRITE:`orchestrion:mongoose:model_bulk_write`,MONGOOSE_MODEL_REMOVE:`orchestrion:mongoose:model_remove`,MONGOOSE_MODEL_AGGREGATE:`orchestrion:mongoose:model_aggregate`},JG=GG.map(e=>`orchestrion:mongoose:ctx_${e}`),YG=Q(KG),XG=[{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`}}],ZG={MYSQL2_QUERY:`orchestrion:mysql2:query`,MYSQL2_EXECUTE:`orchestrion:mysql2:execute`},QG=Q(XG),$G=[{channelName:`query`,module:{name:`mysql`,versionRange:`>=2.0.0 <3`,filePath:`lib/Connection.js`},functionQuery:{expressionName:`query`,kind:`Auto`}}],eK={MYSQL_QUERY:`orchestrion:mysql:query`},tK=Q($G);function nK(e){return e}var rK=[{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`}},nK({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`}}),nK({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`}}],iK={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`},aK=Q(rK),oK=[...[`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`}}))],sK={OPENAI_CHAT:`orchestrion:openai:chat`,OPENAI_EMBEDDINGS:`orchestrion:openai:embeddings`},cK=Q(oK),lK=[{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`}}],uK={PG_QUERY:`orchestrion:pg:query`,PG_CONNECT:`orchestrion:pg:connect`,PGPOOL_CONNECT:`orchestrion:pg-pool:connect`},dK=Q(lK),fK=[`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`}}]),pK={POSTGRESJS_HANDLE:`orchestrion:postgres:handle`,POSTGRESJS_CONNECTION:`orchestrion:postgres:connection`,POSTGRESJS_EXECUTE:`orchestrion:postgres:execute`,POSTGRESJS_CONNECT:`orchestrion:postgres:connect`},mK=Q(fK),hK=[{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`}}],gK={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`},_K=Q(hK),vK=[`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`}}]),yK={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`},bK=Q(vK),xK=`tedious`,SK=`lib/connection.js`,CK=`>=1.11.0 <20`,wK=[`connect`,`execSql`,`execSqlBatch`,`callProcedure`,`execBulkLoad`,`prepare`,`execute`].map(e=>({channelName:e,module:{name:xK,versionRange:CK,filePath:SK},functionQuery:{className:`Connection`,methodName:e,kind:`Sync`}})),TK={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`},EK=Q(wK),DK=[...kK(`>=4.0.0 <7.0.0`,`generateText`,`generateText`,`Async`),...kK(`>=4.0.0 <7.0.0`,`streamText`,`streamText`,`Sync`),...kK(`>=4.0.0 <7.0.0`,`generateObject`,`generateObject`,`Async`),...kK(`>=4.0.0 <7.0.0`,`embed`,`embed`,`Async`),...kK(`>=4.0.0 <7.0.0`,`embedMany`,`embedMany`,`Async`),...kK(`>=5.0.0 <7.0.0`,`resolveLanguageModel`,`resolveLanguageModel`,`Sync`),...kK(`>=6.0.0 <7.0.0`,`executeToolCall`,`executeToolCall`,`Async`)],OK={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 kK(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 AK=Q(DK),$={...SW,...TW,...OW,...MW,...FW,...UW,...KW,...XW,...$W,...nG,...aG,...cG,..._G,...bG,...kG,...FG,...RG,...HG,...qG,...ZG,...eK,...iK,...sK,...uK,...pK,...gK,...yK,...TK,...OK},jK=`Amqplib`,MK=`auto.amqplib.orchestrion.publisher`,NK=`auto.amqplib.orchestrion.consumer`,PK=`messaging.operation`,FK=`messaging.destination`,IK=`messaging.destination_kind`,LK=`messaging.rabbitmq.routing_key`,RK=`messaging.protocol`,zK=`messaging.protocol_version`,BK=`messaging.url`,VK=`messaging.message_id`,HK=`messaging.conversation_id`,UK=`messaging.rabbitmq.destination.routing_key`,WK=`messaging.message.conversation_id`,GK=`topic`,KK=`process`,qK=`send`,JK=6e4,YK={Ack:`ack`,AckAll:`ackAll`,Reject:`reject`,Nack:`nack`,NackAll:`nackAll`,ChannelClosed:`channel closed`,ChannelError:`channel error`,InstrumentationTimeout:`instrumentation timeout`},XK=Symbol(`sentry.amqplib.message.stored-span`),ZK=Symbol(`sentry.amqplib.channel.spans-not-ended`),QK=Symbol(`sentry.amqplib.channel.consume-timeout-timer`),$K=Symbol(`sentry.amqplib.channel.consumer-info`),eq=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),tq=Symbol(`sentry.amqplib.connection.attributes`),nq=()=>{},rq=!1,iq=(()=>({name:jK,setupOnce(){S.tracingChannel&&!rq&&(rq=!0,Y&&A.log(`[orchestrion:amqplib] subscribing to amqplib tracing channels`),H(()=>{uq(),aq(),oq(),sq(),cq(),lq()}))}}));function aq(){X(S.tracingChannel($.AMQPLIB_PUBLISH),e=>{if(!e.self?.[eq])return _q(e)})}function oq(){let e=S.tracingChannel($.AMQPLIB_CONFIRM_PUBLISH);X(e,e=>(e.self&&(e.self[eq]=!0),_q(e))),e.end.subscribe(e=>{let t=e.self;t&&(t[eq]=!1)})}function sq(){let e=S.tracingChannel($.AMQPLIB_CONSUME);e.start.subscribe(nq),e.asyncEnd.subscribe(e=>{let t=e,n=t.self,r=t.result?.consumerTag;if(!n||!r)return;fq(n);let i=t.arguments[0],a=typeof i==`string`?i:`<unknown>`,o=t.arguments[2];n[$K]?.set(r,{noAck:!!o?.noAck,queue:a})})}function cq(){X(S.tracingChannel($.AMQPLIB_DISPATCH),e=>{let t=e.self,n=e.arguments[0],r=e.arguments[1];if(!t||!r)return;fq(t);let i=n?.consumerTag?t[$K]?.get(n.consumerTag):void 0,a=i?.queue??r.fields?.routingKey??`<unknown>`,o=i?.noAck??!1,s=r.properties?.headers,c=uo({sentryTrace:Dq(s,`sentry-trace`),baggage:Dq(s,`baggage`)},()=>vq(a,r,t));return o||(t[ZK]?.push({msg:r,timeOfConsume:Un()}),r[XK]=c),e._sentryNoAck=o,c},{deferSpanEnd({data:e}){return!e._sentryNoAck}})}function lq(){S.tracingChannel($.AMQPLIB_ACK).start.subscribe(e=>dq(e,!1,YK.Ack)),S.tracingChannel($.AMQPLIB_NACK).start.subscribe(e=>dq(e,!0,YK.Nack)),S.tracingChannel($.AMQPLIB_REJECT).start.subscribe(e=>dq(e,!0,YK.Reject)),S.tracingChannel($.AMQPLIB_ACK_ALL).start.subscribe(e=>{let t=e;t.self&&hq(t.self,!1,YK.AckAll,void 0)}),S.tracingChannel($.AMQPLIB_NACK_ALL).start.subscribe(e=>{let t=e;t.self&&hq(t.self,!0,YK.NackAll,t.arguments[0])})}function uq(){let e=S.tracingChannel($.AMQPLIB_CONNECT);e.start.subscribe(nq),e.asyncEnd.subscribe(e=>{let t=e,n=t.result;n&&typeof n==`object`&&(n[tq]={...xq(t.arguments?.[0]),...bq(n)})})}function dq(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===YK.Reject?a:o,c=r[ZK]??[],l=c.findIndex(e=>e.msg===i);if(l<0)gq(i,t,n,s);else if(n!==YK.Reject&&a){for(let e=0;e<=l;e++)gq(c[e].msg,t,n,s);c.splice(0,l+1)}else gq(i,t,n,s),c.splice(l,1)}function fq(e){if(Object.prototype.hasOwnProperty.call(e,ZK))return;e[ZK]=[],e[$K]=new Map;let t=setInterval(()=>mq(e),JK);t.unref?.(),e[QK]=t,typeof e.on==`function`&&(e.on(`close`,()=>{hq(e,!0,YK.ChannelClosed,void 0),pq(e)}),e.on(`error`,()=>{hq(e,!0,YK.ChannelError,void 0),pq(e)}))}function pq(e){let t=e[QK];t&&(clearInterval(t),e[QK]=void 0)}function mq(e){let t=Un(),n=e[ZK]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<JK)break;gq(e.msg,null,YK.InstrumentationTimeout,!0)}n.splice(0,r)}function hq(e,t,n,r){(e[ZK]??[]).forEach(e=>{gq(e.msg,t,n,r)}),e[ZK]=[]}function gq(e,t,n,r){let i=e[XK];i&&(t!==!1&&i.setStatus({code:2,message:n!==YK.ChannelClosed&&n!==YK.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[XK]=void 0)}function _q(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=z({name:`publish ${Sq(r)}`,op:`message`,kind:W.PRODUCER,attributes:{...yq(e.self),[FK]:r,[zc]:r,[IK]:GK,[LK]:i,[UK]:i,[Hc]:qK,[VK]:a?.messageId,[Bc]:a?.messageId,[HK]:a?.correlationId,[WK]:a?.correlationId,[I]:MK}});(!a||typeof a!=`object`)&&(a={},e.arguments[3]=a);let s=a.headers&&typeof a.headers==`object`?a.headers:a.headers={},c=Ef({span:o});return c[`sentry-trace`]&&(s[`sentry-trace`]=c[`sentry-trace`]),c.baggage&&(s.baggage=c.baggage),o}function vq(e,t,n){return z({name:`${e} process`,op:`message`,kind:W.CONSUMER,attributes:{...yq(n),[FK]:t.fields?.exchange,[zc]:t.fields?.exchange,[IK]:GK,[LK]:t.fields?.routingKey,[UK]:t.fields?.routingKey,[PK]:KK,[Hc]:KK,[VK]:t.properties?.messageId,[Bc]:t.properties?.messageId,[HK]:t.properties?.correlationId,[WK]:t.properties?.correlationId,[I]:NK}})}function yq(e){let t=e?.connection,n=t?.[tq];if(n)return n;let r=t?.serverProperties?.product??t?.connection?.serverProperties?.product;return typeof r==`string`&&r?{[Uc]:r.toLowerCase()}:{}}function bq(e){let t=e.serverProperties?.product??e.connection?.serverProperties?.product;return typeof t==`string`&&t?{[Uc]:t.toLowerCase()}:{}}function xq(e){let t={[zK]:`0.9.1`,[qc]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=Tq(e.protocol),i=Eq(e.hostname),a=wq(e.port,r);t[RK]=r,t[Kc]=r,t[pl]=i,t[ml]=a,t[Qc]=i,t[$c]=a}else if(typeof n==`string`){let e=Cq(n);t[BK]=e,t[_l]=e;try{let n=new URL(e),r=Tq(n.protocol),i=Eq(n.hostname),a=wq(n.port?parseInt(n.port,10):void 0,r);t[RK]=r,t[Kc]=r,t[pl]=i,t[ml]=a,t[Qc]=i,t[$c]=a}catch{}}return t}function Sq(e){return e===``?`<default>`:e}function Cq(e){return e.replace(/:[^:@/]*@/,`:***@`)}function wq(e,t){return e||(t===`AMQP`?5672:5671)}function Tq(e){let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()}function Eq(e){return e||`localhost`}function Dq(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}var Oq=U(iq),kq=`Anthropic_AI`,Aq=`auto.ai.orchestrion.anthropic`,jq=[{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`}],Mq=!1,Nq=((e={})=>({name:kq,setupOnce(){S.tracingChannel&&!Mq&&(Mq=!0,H(()=>{for(let{channel:t,operation:n,methodPath:r,stream:i}of jq)Y&&A.log(`[orchestrion:anthropic] subscribing to channel "${t}"`),X(S.tracingChannel(t),t=>Pq(t,n,r,e),{beforeSpanEnd:(t,n)=>{Gv(t,n.result,$g(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>Lq(t,n,i,e)})}))}}));function Pq(e,t,n,r){let i=e.arguments??[];if(nf(kq)||i[1]?.headers?.[`X-Stainless-Helper-Method`]===`stream`)return;let a=typeof i[0]==`object`&&i[0]!==null?i[0]:void 0,{recordInputs:o}=$g(r),s=e_(r.enableTruncation),c=Vv(i,n,t),l=c[`gen_ai.request.model`]||`unknown`;c[I]=Aq;let u=z({name:`${t} ${l}`,op:`gen_ai.${t}`,attributes:c});return o&&a&&Hv(u,a,s),u}function Fq(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function Iq(e){return!!e&&typeof e.on==`function`}function Lq(e,t,n,r){let{recordOutputs:i}=$g(r),a=t.result;if(n===`async-iterable`&&Fq(a)){let t=a[Symbol.asyncIterator].bind(a),n=Lv({[Symbol.asyncIterator]:t},e,i);return a[Symbol.asyncIterator]=()=>n,!0}return n===`message-stream`&&Iq(a)?(Rv(a,e,i),!0):!1}var Rq=U(Nq),zq=`auto.aws.orchestrion.aws_sdk`,Bq=`dynamodb`,Vq=`messaging.destination_kind`,Hq=`topic`,Uq=`chat`,Wq=`aws.bedrock`,Gq=new TextDecoder,Kq=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=Uq,r={[fc]:Wq,[ec]:Uq},i=e.commandInput.modelId;i&&(r[ic]=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[rc]=e),t!==void 0&&(r[oc]=t),n!==void 0&&(r[sc]=n),i!==void 0&&(r[ac]=i)}return{spanName:n,isStream:t,spanAttributes:r}}_requestPreSpanHookInvokeModel(e,t){let n={[fc]:Wq},r=e.commandInput?.modelId;if(r&&(n[ic]=r),e.commandInput?.body){let t=JSON.parse(e.commandInput.body);r.includes(`amazon.titan`)?(t.textGenerationConfig?.temperature!==void 0&&(n[oc]=t.textGenerationConfig.temperature),t.textGenerationConfig?.topP!==void 0&&(n[sc]=t.textGenerationConfig.topP),t.textGenerationConfig?.maxTokenCount!==void 0&&(n[rc]=t.textGenerationConfig.maxTokenCount),t.textGenerationConfig?.stopSequences!==void 0&&(n[ac]=t.textGenerationConfig.stopSequences)):r.includes(`amazon.nova`)?(t.inferenceConfig?.temperature!==void 0&&(n[oc]=t.inferenceConfig.temperature),t.inferenceConfig?.top_p!==void 0&&(n[sc]=t.inferenceConfig.top_p),t.inferenceConfig?.max_new_tokens!==void 0&&(n[rc]=t.inferenceConfig.max_new_tokens),t.inferenceConfig?.stopSequences!==void 0&&(n[ac]=t.inferenceConfig.stopSequences)):r.includes(`anthropic.claude`)?(t.max_tokens!==void 0&&(n[rc]=t.max_tokens),t.temperature!==void 0&&(n[oc]=t.temperature),t.top_p!==void 0&&(n[sc]=t.top_p),t.stop_sequences!==void 0&&(n[ac]=t.stop_sequences)):r.includes(`meta.llama`)?(t.max_gen_len!==void 0&&(n[rc]=t.max_gen_len),t.temperature!==void 0&&(n[oc]=t.temperature),t.top_p!==void 0&&(n[sc]=t.top_p)):r.includes(`cohere.command-r`)?(t.max_tokens!==void 0&&(n[rc]=t.max_tokens),t.temperature!==void 0&&(n[oc]=t.temperature),t.p!==void 0&&(n[sc]=t.p),t.message!==void 0&&(n[_c]=Math.ceil(t.message.length/6)),t.stop_sequences!==void 0&&(n[ac]=t.stop_sequences)):r.includes(`cohere.command`)?(t.max_tokens!==void 0&&(n[rc]=t.max_tokens),t.temperature!==void 0&&(n[oc]=t.temperature),t.p!==void 0&&(n[sc]=t.p),t.prompt!==void 0&&(n[_c]=Math.ceil(t.prompt.length/6)),t.stop_sequences!==void 0&&(n[ac]=t.stop_sequences)):r.includes(`mistral`)&&(t.prompt!==void 0&&(n[_c]=Math.ceil(t.prompt.length/6)),t.max_tokens!==void 0&&(n[rc]=t.max_tokens),t.temperature!==void 0&&(n[oc]=t.temperature),t.top_p!==void 0&&(n[sc]=t.top_p),t.stop!==void 0&&(n[ac]=t.stop))}return{isStream:t,spanAttributes:n}}_responseHookConverse(e,t){let{stopReason:n,usage:r}=e.data;Yq(t,n),Xq(t,r)}_responseHookConverseStream(e,t){e.data.stream=Jq(e.data.stream,t)}_responseHookInvokeModel(e,t){let n=e.request.commandInput?.modelId;if(e.data?.body){let r=Gq.decode(e.data.body),i=JSON.parse(r);n.includes(`amazon.titan`)?(i.inputTextTokenCount!==void 0&&t.setAttribute(_c,i.inputTextTokenCount),i.results?.[0]?.tokenCount!==void 0&&t.setAttribute(vc,i.results[0].tokenCount),i.results?.[0]?.completionReason!==void 0&&t.setAttribute(cc,[i.results[0].completionReason])):n.includes(`amazon.nova`)?(i.usage!==void 0&&(i.usage.inputTokens!==void 0&&t.setAttribute(_c,i.usage.inputTokens),i.usage.outputTokens!==void 0&&t.setAttribute(vc,i.usage.outputTokens)),i.stopReason!==void 0&&t.setAttribute(cc,[i.stopReason])):n.includes(`anthropic.claude`)?(i.usage?.input_tokens!==void 0&&t.setAttribute(_c,i.usage.input_tokens),i.usage?.output_tokens!==void 0&&t.setAttribute(vc,i.usage.output_tokens),i.stop_reason!==void 0&&t.setAttribute(cc,[i.stop_reason])):n.includes(`meta.llama`)?(i.prompt_token_count!==void 0&&t.setAttribute(_c,i.prompt_token_count),i.generation_token_count!==void 0&&t.setAttribute(vc,i.generation_token_count),i.stop_reason!==void 0&&t.setAttribute(cc,[i.stop_reason])):n.includes(`cohere.command-r`)?(i.text!==void 0&&t.setAttribute(vc,Math.ceil(i.text.length/6)),i.finish_reason!==void 0&&t.setAttribute(cc,[i.finish_reason])):n.includes(`cohere.command`)?(i.generations?.[0]?.text!==void 0&&t.setAttribute(vc,Math.ceil(i.generations[0].text.length/6)),i.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(cc,[i.generations[0].finish_reason])):n.includes(`mistral`)&&(i.outputs?.[0]?.text!==void 0&&t.setAttribute(vc,Math.ceil(i.outputs[0].text.length/6)),i.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(cc,[i.outputs[0].stop_reason]))}}_responseHookInvokeModelWithResponseStream(e,t){let n=e.data?.body,r=e.request.commandInput?.modelId;if(!n||!r)return;let i=qq(r);e.data.body=(async function*(){try{for await(let e of n){if(i){let n=Zq(e?.chunk?.bytes);n&&i(n,t)}yield e}}finally{t.end()}})()}};function qq(e){if(e.includes(`amazon.titan`))return eJ;if(e.includes(`anthropic.claude`))return $q;if(e.includes(`amazon.nova`))return Qq;if(e.includes(`meta.llama`))return tJ;if(e.includes(`cohere.command-r`))return iJ;if(e.includes(`cohere.command`))return rJ;if(e.includes(`mistral`))return nJ}async function*Jq(e,t){try{let n;for await(let r of e)Yq(t,r.messageStop?.stopReason),n=r.metadata?.usage,yield r;Xq(t,n)}finally{t.end()}}function Yq(e,t){t!==void 0&&e.setAttribute(cc,[t])}function Xq(e,t){if(t){let{inputTokens:n,outputTokens:r}=t;n!==void 0&&e.setAttribute(_c,n),r!==void 0&&e.setAttribute(vc,r)}}function Zq(e){if(!e||!(e instanceof Uint8Array))return null;try{let t=Buffer.from(e).toString(`utf-8`);return JSON.parse(t)}catch(e){return Y&&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(_c,e.metadata.usage.inputTokens),e.metadata?.usage.outputTokens!==void 0&&t.setAttribute(vc,e.metadata.usage.outputTokens)),e.messageStop?.stopReason!==void 0&&t.setAttribute(cc,[e.messageStop.stopReason])}function $q(e,t){e.message?.usage?.input_tokens!==void 0&&t.setAttribute(_c,e.message.usage.input_tokens),e.message?.usage?.output_tokens!==void 0&&t.setAttribute(vc,e.message.usage.output_tokens),e.delta?.stop_reason!==void 0&&t.setAttribute(cc,[e.delta.stop_reason])}function eJ(e,t){e.inputTextTokenCount!==void 0&&t.setAttribute(_c,e.inputTextTokenCount),e.totalOutputTextTokenCount!==void 0&&t.setAttribute(vc,e.totalOutputTextTokenCount),e.completionReason!==void 0&&t.setAttribute(cc,[e.completionReason])}function tJ(e,t){e.prompt_token_count!==void 0&&t.setAttribute(_c,e.prompt_token_count),e.generation_token_count!==void 0&&t.setAttribute(vc,e.generation_token_count),e.stop_reason!==void 0&&t.setAttribute(cc,[e.stop_reason])}function nJ(e,t){e.outputs?.[0]?.text!==void 0&&t.setAttribute(vc,Math.ceil(e.outputs[0].text.length/6)),e.outputs?.[0]?.stop_reason!==void 0&&t.setAttribute(cc,[e.outputs[0].stop_reason])}function rJ(e,t){e.generations?.[0]?.text!==void 0&&t.setAttribute(vc,Math.ceil(e.generations[0].text.length/6)),e.generations?.[0]?.finish_reason!==void 0&&t.setAttribute(cc,[e.generations[0].finish_reason])}function iJ(e,t){e.text!==void 0&&t.setAttribute(vc,Math.ceil(e.text.length/6)),e.finish_reason!==void 0&&t.setAttribute(cc,[e.finish_reason])}function aJ(e){return Array.isArray(e)?e:[e]}var oJ=class{requestPreSpanHook(e){let t=e.commandName,n=e.commandInput?.TableName,r={};return r[Vs]=Bq,r[Ps]=n,r[Is]=t,e.commandInput?.TableName?r[bs]=[e.commandInput.TableName]:e.commandInput?.RequestItems&&(r[bs]=Object.keys(e.commandInput.RequestItems)),(t===`CreateTable`||t===`UpdateTable`)&&e.commandInput?.ProvisionedThroughput&&(r[ps]=e.commandInput.ProvisionedThroughput.ReadCapacityUnits,r[ms]=e.commandInput.ProvisionedThroughput.WriteCapacityUnits),(t===`GetItem`||t===`Scan`||t===`Query`)&&e.commandInput?.ConsistentRead&&(r[ns]=e.commandInput.ConsistentRead),(t===`Query`||t===`Scan`)&&e.commandInput?.ProjectionExpression&&(r[fs]=e.commandInput.ProjectionExpression),t===`CreateTable`&&(e.commandInput?.GlobalSecondaryIndexes&&(r[os]=aJ(e.commandInput.GlobalSecondaryIndexes).map(e=>JSON.stringify(e))),e.commandInput?.LocalSecondaryIndexes&&(r[ds]=aJ(e.commandInput.LocalSecondaryIndexes).map(e=>JSON.stringify(e)))),(t===`ListTables`||t===`Query`||t===`Scan`)&&e.commandInput?.Limit&&(r[us]=e.commandInput.Limit),t===`ListTables`&&e.commandInput?.ExclusiveStartTableName&&(r[as]=e.commandInput.ExclusiveStartTableName),t===`Query`&&(e.commandInput?.ScanIndexForward&&(r[gs]=e.commandInput.ScanIndexForward),e.commandInput?.IndexName&&(r[cs]=e.commandInput.IndexName),e.commandInput?.Select&&(r[vs]=e.commandInput.Select)),t===`Scan`&&(e.commandInput?.Segment&&(r[_s]=e.commandInput?.Segment),e.commandInput?.TotalSegments&&(r[xs]=e.commandInput?.TotalSegments),e.commandInput?.IndexName&&(r[cs]=e.commandInput.IndexName),e.commandInput?.Select&&(r[vs]=e.commandInput.Select)),t===`UpdateTable`&&(e.commandInput?.AttributeDefinitions&&(r[ts]=aJ(e.commandInput.AttributeDefinitions).map(e=>JSON.stringify(e))),e.commandInput?.GlobalSecondaryIndexUpdates&&(r[ss]=aJ(e.commandInput.GlobalSecondaryIndexUpdates).map(e=>JSON.stringify(e)))),{spanAttributes:r,spanKind:W.CLIENT,spanOp:`db`}}responseHook(e,t){e.data?.ConsumedCapacity&&t.setAttribute(rs,aJ(e.data.ConsumedCapacity).map(e=>JSON.stringify(e))),e.data?.ItemCollectionMetrics&&t.setAttribute(ls,aJ(e.data.ItemCollectionMetrics).map(e=>JSON.stringify(e))),e.data?.TableNames&&t.setAttribute(ys,e.data?.TableNames.length),e.data?.Count&&t.setAttribute(is,e.data?.Count),e.data?.ScannedCount&&t.setAttribute(hs,e.data?.ScannedCount)}},sJ=class{requestPreSpanHook(e){let t=e.commandInput?.StreamName,n={};return t&&(n[Ss]=t),{spanAttributes:n,spanKind:W.CLIENT}}},cJ=`Invoke`,lJ=class{requestPreSpanHook(e){let t=e.commandInput?.FunctionName,n={},r;return e.commandName===cJ&&(n[Ks]=t,n[qs]=`aws`,r=`${t} ${cJ}`),{spanAttributes:n,spanKind:W.CLIENT,spanName:r}}requestPostSpanHook(e,t){e.commandName===cJ&&e.commandInput&&(e.commandInput.ClientContext=uJ(e.commandInput.ClientContext,t))}responseHook(e,t){e.request.commandName===cJ&&(t.setAttribute(Gs,e.requestId),e.request.region&&t.setAttribute(Js,e.request.region))}};function uJ(e,t){try{let n=Ef({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?(Y&&A.warn(`[orchestrion:aws-sdk] cannot set trace propagation on lambda invoke parameters due to ClientContext length limitations.`),e):a}catch(t){return Y&&A.log(`[orchestrion:aws-sdk] failed to set trace propagation on lambda ClientContext`,t),e}}var dJ=class{requestPreSpanHook(e){let t=e.commandInput?.Bucket,n={};return t&&(n[Ts]=t),{spanAttributes:n,spanKind:W.CLIENT}}},fJ=class{requestPreSpanHook(e){let t=e.commandInput?.SecretId,n={};return typeof t==`string`&&t.startsWith(`arn:aws:secretsmanager:`)&&(n[Es]=t),{spanAttributes:n,spanKind:W.CLIENT}}responseHook(e,t){let n=e.data?.ARN;n&&t.setAttribute(Es,n)}},pJ=`sentry-trace`,mJ=`baggage`,hJ=[pJ,mJ];function gJ(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 Y&&A.warn(`[orchestrion:aws-sdk] cannot set trace propagation on SQS/SNS message due to maximum amount of MessageAttributes`);return n}function _J(e){let t=e.MessageAttributes??{},n=t[pJ]?.StringValue??t[pJ]?.Value;if(n)return{sentryTrace:n,baggage:t[mJ]?.StringValue??t[mJ]?.Value}}function vJ(e=[]){return Mf([...e,...hJ])}var yJ=class{requestPreSpanHook(e){let t=W.CLIENT,n=`SNS ${e.commandName}`,r={[Uc]:`aws.sns`};if(e.commandName===`Publish`){t=W.PRODUCER,r[Vq]=Hq;let{TopicArn:i,TargetArn:a,PhoneNumber:o}=e.commandInput,s=bJ(i,a,o);r[Rc]=s,r[zc]=i||a||o||`unknown`,n=`${o?`phone_number`:s} send`}let i=e.commandInput?.TopicArn;return i&&(r[Ds]=i),{spanAttributes:r,spanKind:t,spanName:n}}requestPostSpanHook(e,t){if(e.commandName===`Publish`){let n=e.commandInput.MessageAttributes??{};e.commandInput.MessageAttributes=gJ(n,Ef({span:t}))}}responseHook(e,t){let n=e.data?.TopicArn;n&&t.setAttribute(Ds,n)}};function bJ(e,t,n){if(e||t){let n=e??t;try{return n.substring(n.lastIndexOf(`:`)+1)}catch{return n}}return n||`unknown`}var xJ=class{requestPreSpanHook(e){let t=CJ(e.commandInput),n=wJ(t),r=W.CLIENT,i,a={[Uc]:`aws_sqs`,[zc]:n,[_l]:t};switch(e.commandName){case`ReceiveMessage`:r=W.CONSUMER,i=`${n} receive`,a[Hc]=`receive`,e.commandInput.MessageAttributeNames=vJ(e.commandInput.MessageAttributeNames);break;case`SendMessage`:case`SendMessageBatch`:r=W.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=gJ(n,Ef({span:t}))}break;case`SendMessageBatch`:{let n=e.commandInput?.Entries;if(Array.isArray(n)){let e=Ef({span:t});n.forEach(t=>{t.MessageAttributes=gJ(t.MessageAttributes??{},e)})}}}}responseHook(e,t){switch(e.request.commandName){case`SendMessage`:t.setAttribute(Bc,e?.data?.MessageId);break;case`SendMessageBatch`:break;case`ReceiveMessage`:{let n=e?.data?.Messages||[];t.setAttribute(Lc,n.length);for(let e of n)SJ(t,e);break}}}};function SJ(e,t){let n=_J(t);if(!n)return;let{parentSpanId:r,traceId:i,sampled:a}=Ai(n.sentryTrace,n.baggage);i&&r&&e.addLink({context:{traceId:i,spanId:r,traceFlags:+!!a},attributes:{[Bc]:t.MessageId}})}function CJ(e){return e?.QueueUrl}function wJ(e){if(!e)return;let t=e.split(`/`);if(t.length!==0)return t[t.length-1]}var TJ=class{requestPreSpanHook(e){let t=e.commandInput?.stateMachineArn,n=e.commandInput?.activityArn,r={};return t&&(r[ks]=t),n&&(r[Os]=n),{spanAttributes:r,spanKind:W.CLIENT}}},EJ=class{constructor(){this._services=new Map([[`SecretsManager`,new fJ],[`SFN`,new TJ],[`SQS`,new xJ],[`SNS`,new yJ],[`DynamoDB`,new oJ],[`Lambda`,new lJ],[`S3`,new dJ],[`Kinesis`,new sJ],[`BedrockRuntime`,new Kq]])}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 DJ(e,t){let n=t.length;return e?.slice(-n)===t?e.slice(0,-n):e}function OJ(e,t,n,r){return{serviceName:e?.replace(/\s+/g,``),commandName:DJ(t,`Command`),commandInput:n,region:r}}function kJ(e){return{[il]:`aws-api`,[nl]:e.commandName,[rl]:e.serviceName,[js]:e.region}}var AJ=`Aws`;function jJ(e){try{return e()}catch(e){Y&&A.warn(`[orchestrion:aws-sdk] error building span`,e);return}}function MJ(e,t){t&&(t.requestId&&e.setAttribute(ws,t.requestId),t.httpStatusCode&&e.setAttribute(jc,t.httpStatusCode),t.extendedRequestId&&e.setAttribute(Cs,t.extendedRequestId))}var NJ=U((()=>{let e=new EJ;return{name:AJ,setupOnce(){if(!S.tracingChannel)return;let t=t=>jJ(()=>{let n=t.arguments[0],r=n?.constructor?.name;if(!n||!r)return;let i=t.self?.config,a=i?.serviceId??DJ(t.self?.constructor?.name||`AWS`,`Client`);n.input||={};let o=OJ(a,r,n.input,void 0),s=e.requestPreSpanHook(o),c=z({name:s.spanName??`${o.serviceName}.${o.commandName}`,kind:s.spanKind??W.CLIENT,op:s.spanOp||`rpc`,attributes:{[I]:zq,...kJ(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(js,e))}).catch(()=>{}).finally(()=>{u.settled=!0})};return t._sentryRegion=u,jJ(()=>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(jJ(()=>{if(o){let e=n.error,r=e?.$metadata;MJ(t,{requestId:e?.RequestId??r?.requestId,httpStatusCode:r?.httpStatusCode,extendedRequestId:e?.extendedRequestId??r?.extendedRequestId});return}let r=n.result;MJ(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];Y&&A.log(`[orchestrion:aws-sdk] subscribing to channels "${r.join(`", "`)}"`),H(()=>{for(let e of r)X(S.tracingChannel(e),t,n)})}}})),PJ=`Dataloader`,FJ=`dataloader`,IJ=`auto.db.orchestrion.dataloader`,LJ=`cache.get`,RJ=Symbol(`sentry.dataloader.wrapped`);function zJ(e,t){let n=e?.name;return n?`${FJ}.${t} ${n}`:`${FJ}.${t}`}function BJ(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}function VJ(e,t,n){let r=t===`load`||t===`loadMany`||t===`batch`;return{name:zJ(e,t),kind:t===`batch`?void 0:W.CLIENT,op:r?LJ:void 0,onlyIfParent:!0,attributes:{[I]:IJ,[As]:r?BJ(n):void 0}}}var HJ=(()=>({name:PJ,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:dataloader] subscribing to dataloader tracing channels`),H(()=>{UJ(),WJ(),GJ($.DATALOADER_LOAD_MANY,`loadMany`),GJ($.DATALOADER_PRIME,`prime`),GJ($.DATALOADER_CLEAR,`clear`),GJ($.DATALOADER_CLEAR_ALL,`clearAll`)}))}}));function UJ(){S.tracingChannel($.DATALOADER_CONSTRUCT).start.subscribe(e=>{let t=e,n=t.arguments[0];if(typeof n!=`function`||n[RJ])return;let r=n,i=function(...e){return oo({...VJ(this,`batch`,e[0]),links:this._batch?.spanLinks},()=>r.apply(this,e))};i[RJ]=!0,t.arguments[0]=i})}function WJ(){let e=S.tracingChannel($.DATALOADER_LOAD);X(e,e=>KJ(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 GJ(e,t){X(S.tracingChannel(e),e=>KJ(e.self,t,e.arguments[0]),{requiresParentSpan:!0})}function KJ(e,t,n){return z(VJ(e,t,n))}var qJ=U(HJ),JJ=`GenericPool`,YJ=U((()=>({name:JJ,setupOnce(){S.tracingChannel&&H(()=>XJ())}})));function XJ(){X(S.tracingChannel($.GENERIC_POOL_ACQUIRE),()=>z({name:`generic-pool.acquire`,attributes:{[I]:`auto.db.orchestrion.generic_pool`}}))}var ZJ=`Google_GenAI`,QJ=`auto.ai.orchestrion.google_genai`,$J=[{channel:$.GOOGLE_GENAI_GENERATE_CONTENT,operation:`generate_content`},{channel:$.GOOGLE_GENAI_EMBED_CONTENT,operation:`embeddings`},{channel:$.GOOGLE_GENAI_CHAT,operation:`chat`}],eY=!1,tY=((e={})=>({name:ZJ,setupOnce(){S.tracingChannel&&!eY&&(eY=!0,H(()=>{for(let{channel:t,operation:n}of $J)Y&&A.log(`[orchestrion:google-genai] subscribing to channel "${t}"`),X(S.tracingChannel(t),t=>nY(t,n,e),{beforeSpanEnd:(t,r)=>{n!==`embeddings`&&uy(t,r.result,$g(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>iY(t,n,e)})}))}}));function nY(e,t,n){if(nf(ZJ))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}=$g(n),a=e_(n.enableTruncation),o=cy(t,r,e.self),s=o[`gen_ai.request.model`]||`unknown`;o[I]=QJ;let c=z({name:`${t} ${s}`,op:`gen_ai.${t}`,attributes:o});return i&&r&&ly(c,r,t,a),c}function rY(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function iY(e,t,n){let r=t.result;if(!rY(r))return!1;let{recordOutputs:i}=$g(n),a=r[Symbol.asyncIterator].bind(r),o=iy({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var aY=U(tY),oY=`auto.graphql.diagnostic_channel`,sY=`graphql.parse`,cY=`graphql.validate`,lY=`graphql.execute`,uY=`graphql.resolve`,dY=`graphql.field.name`,fY=`graphql.field.path`,pY=`graphql.field.type`,mY=`graphql.parent.name`,hY=Symbol.for(`opentelemetry.graphql_data`),gY=Symbol.for(`opentelemetry.patched`);function _Y(e){return typeof e?.then==`function`}function vY(e,t){if(!e||e[gY])return;e[gY]=!0;let n=e.getFields();Object.keys(n).forEach(e=>{let r=n[e];if(r&&(r.resolve&&=yY(t,r.resolve),r.type))for(let e of DY(r.type))vY(e,t)})}function yY(e,t,n=!1){if(typeof t!=`function`||t[gY])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[hY])return t.call(this,r,i,s,o);let{field:c,spanAdded:l}=xY(s,o,EY(o.path)),u=c.span;return B(u,()=>{try{let e=t.call(this,r,i,s,o);return _Y(e)?e.then(e=>(bY(u,l),e),e=>{throw bY(u,l,e),e}):(bY(u,l),e)}catch(e){throw bY(u,l,e),e}})}return r[gY]=!0,r}function bY(e,t,n){t&&(n&&e.setStatus({code:2,message:n.message}),e.end())}function xY(e,t,n){let r=wY(e,n);if(r)return{field:r,spanAdded:!1};let i={span:SY(t,n,TY(e,n))};return CY(e,n,i),{field:i,spanAdded:!0}}function SY(e,t,n){let r={[I]:oY,[F]:GP,[dY]:e.fieldName,[fY]:t.join(`.`),[pY]:e.returnType.toString(),[mY]:e.parentType.name};return z({name:`${uY} ${t.join(`.`)}`,attributes:r,parentSpan:n})}function CY(e,t,n){let r=e[hY];r&&(r.fields[t.join(`.`)]=n)}function wY(e,t){return e[hY]?.fields[t.join(`.`)]}function TY(e,t){for(let n=t.length-1;n>0;n--){let r=wY(e,t.slice(0,n));if(r)return r.span}return e[hY]?.span}function EY(e){let t=[],n=e;for(;n;)t.push(String(n.key)),n=n.prev;return t.reverse()}function DY(e){return`ofType`in e&&e.ofType?DY(e.ofType):OY(e)?e.getTypes():kY(e)?[e]:[]}function OY(e){return`getTypes`in e&&typeof e.getTypes==`function`}function kY(e){return`getFields`in e&&typeof e.getFields==`function`}function AY(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 jY={[I]:oY,[F]:GP};function MY(){return z({name:sY,attributes:{...jY}})}function NY(e){return z({name:cY,attributes:{...jY,[bc]:rF(e)}})}function PY(e,t){Array.isArray(t)&&t.length>0&&e.setStatus({code:2,message:`invalid_argument`})}function FY(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 IY(e,t,n,r){let i=FY(e),{schema:a,document:o}=i,{contextValue:s,fieldResolver:c}=i,l=!!s[hY];if(!n.ignoreResolveSpans&&!l){let e=c==null,n=t?.defaultFieldResolver,i=c??n;i&&(c=yY(r,i,e)),a&&(vY(a.getQueryType(),r),vY(a.getMutationType(),r))}let u=AY(o,i.operationName),d=u?.operation,f=u?.name?.value??i.operationName??void 0,p=z({name:eF(d,f||void 0,lY),attributes:{...jY,[Sc]:d,[xc]:f||void 0,[bc]:rF(o)}});return n.useOperationNameForRootSpan&&d&&QP(p,d,f||void 0),s[hY]={source:o,span:p,fields:{}},i.writeBack(s,c),p}function LY(e,t){tF(t)&&e.setStatus({code:2,message:`internal_error`})}var RY=`Graphql`;function zY(e){return{ignoreResolveSpans:e.ignoreResolveSpans!==!1,ignoreTrivialResolveSpans:e.ignoreTrivialResolveSpans!==!1,useOperationNameForRootSpan:e.useOperationNameForRootSpan!==!1}}function BY(e){try{return e()}catch(e){Y&&A.warn(`[orchestrion:graphql] error building span`,e);return}}var VY=U(((e={})=>{let t=zY(e),n=()=>t;return{name:RY,setupOnce(){S.tracingChannel&&H(()=>{X(S.tracingChannel($.GRAPHQL_PARSE),()=>BY(()=>MY())),X(S.tracingChannel($.GRAPHQL_VALIDATE),e=>BY(()=>NY(e.arguments[1])),{beforeSpanEnd:(e,t)=>void BY(()=>PY(e,t.result))}),X(S.tracingChannel($.GRAPHQL_EXECUTE),e=>BY(()=>IY(e.arguments,e.self,t,n)),{beforeSpanEnd:(e,t)=>void BY(()=>LY(e,t.result))})})}}})),HY=e=>{let t=VY(e);return Nu(wF(e),{name:RY,setupOnce:()=>t.setupOnce?.()})},UY=[`onPreAuth`,`onCredentials`,`onPostAuth`,`onPreHandler`,`onPostHandler`,`onPreResponse`,`onRequest`],WY=Symbol(`hapi-handler-patched`),GY={ROUTER:`router`,PLUGIN:`plugin`,EXT:`server.ext`},KY=new Set(UY),qY=(e=>(e.HAPI_TYPE=`hapi.type`,e.PLUGIN_NAME=`hapi.plugin.name`,e.EXT_TYPE=`server.ext.type`,e))(qY||{});function JY(e){let t=R();if(!t)return;let n=ra(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(kc,e)}var YY=e=>typeof e==`string`&&KY.has(e),XY=e=>{let t=e?.type;return t!==void 0&&YY(t)},ZY=e=>Array.isArray(e)&&e.length<=3&&YY(e[0])&&typeof e[1]==`function`,QY=e=>!Array.isArray(e),$Y=(e,t)=>{let n={[kc]:e.path,[Ec]:e.method},r;return t?(n[qY.HAPI_TYPE]=GY.PLUGIN,n[qY.PLUGIN_NAME]=t,r=`${t}: route - ${e.path}`):(n[qY.HAPI_TYPE]=GY.ROUTER,r=`route - ${e.path}`),{attributes:n,name:r}},eX=(e,t,n)=>{let r=`ext - ${e}`;return n&&n!==`method`&&(r=`ext - ${e} - ${n}`),t?{attributes:{[qY.EXT_TYPE]:e,[qY.HAPI_TYPE]:GY.EXT,[qY.PLUGIN_NAME]:t},name:`${t}: ${r}`}:{attributes:{[qY.EXT_TYPE]:e,[qY.HAPI_TYPE]:GY.EXT},name:r}};function tX(e,t){return oo({name:e.name,op:`${e.attributes[qY.HAPI_TYPE]}.hapi`,attributes:{...e.attributes,[I]:`auto.http.orchestrion.hapi`}},t)}function nX(e,t){if(e[WY]===!0)return e;e[WY]=!0;let n=n=>function(...r){return R()?(JY(e.path),tX($Y(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 rX(e,t,n){if(Array.isArray(e)){for(let n=0;n<e.length;n++)e[n]=rX(e[n],t);return e}if(QY(e)){if(e[WY]===!0)return e;e[WY]=!0;let r=function(...r){return R()?tX(eX(t,n,e.name),()=>e.apply(void 0,r)):e.apply(this,r)};return r[WY]=!0,r}return e}function iX(e,t){let n=e[0];if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=nX(n[e],t);else e[0]=nX(n,t)}function aX(e,t){if(Array.isArray(e[0])){let n=e[0];for(let e=0;e<n.length;e++){let r=n[e];if(YY(r.type)){let i=r;i.method=rX(i.method,r.type,t),n[e]=i}}return}if(ZY(e)){let n=e,r=n[1];e[1]=rX(r,n[0],t);return}if(XY(e[0])){let n=e[0];n.method=rX(n.method,n.type,t)}}var oX=`Hapi`,sX=U((()=>({name:oX,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:hapi] subscribing to channels "${$.HAPI_ROUTE}" / "${$.HAPI_EXT}"`),S.tracingChannel($.HAPI_ROUTE).subscribe({start(e){let t=e;iX(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}),S.tracingChannel($.HAPI_EXT).subscribe({start(e){let t=e;aX(t.arguments,t.self?.realm?.plugin)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}))),cX=`Koa`,lX=`auto.http.orchestrion.koa`,uX={ROUTER:`router`,MIDDLEWARE:`middleware`},dX=Symbol(`sentry.koa.layer-patched`),fX=!1,pX=((e={})=>{let t=e.ignoreLayersType??[];return{name:cX,setupOnce(){S.tracingChannel&&!fX&&(fX=!0,Y&&A.log(`[orchestrion:koa] subscribing to channel "${$.KOA_USE}"`),S.tracingChannel($.KOA_USE).subscribe({start(e){mX(e,t)},end(){},asyncStart(){},asyncEnd(){},error(){}}))}}});function mX(e,t){let n=e.arguments[0];typeof n==`function`&&(e.arguments[0]=hX(n,t))}function hX(e,t){return e.router?gX(e,t):_X(e,!1,t)}function gX(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]=_X(e,!0,t,n)})}return e}function _X(e,t,n,r){let i=t?uX.ROUTER:uX.MIDDLEWARE;return e[dX]===!0||n.includes(i)||e.constructor.name===`GeneratorFunction`||e.constructor.name===`AsyncGeneratorFunction`?e:(e[dX]=!0,(n,a)=>{if(!R())return e(n,a);let o=vX(n,e,t,r);n._matchedRoute&&yX(n._matchedRoute.toString());let s=o.attributes[Fc];return oo({name:typeof s==`string`?s||`< unknown >`:o.name,op:`${i}.koa`,attributes:{...o.attributes,[I]:lX}},()=>{let t=o.attributes[kc];if(N()===ar())Y&&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 vX(e,t,n,r){return n?{attributes:{[Fc]:r?.toString(),[Ic]:uX.ROUTER,[kc]:r?.toString()},name:e._matchedRouteName||`router - ${r}`}:{attributes:{[Fc]:t.name||`middleware`,[Ic]:uX.MIDDLEWARE,[Ms]:t.name||`middleware`},name:`middleware - ${t.name}`}}function yX(e){let t=R();if(!t)return;let n=ra(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(kc,e)}var bX=U(pX),xX=`IORedis`,SX=`auto.db.orchestrion.redis`,CX=`db.connection_string`;function wX(e){return{host:e?.options?.host,port:e?.options?.port}}function TX(e,t){return{[Vs]:`redis`,[CX]:`redis://${e}:${t}`,[Qc]:e,[$c]:t,[I]:SX}}var EX=new WeakSet;function DX(e){let t=e.arguments?.[0];if(!t||typeof t!=`object`||EX.has(t))return;EX.add(t);let{host:n,port:r}=wX(e.self),i=eL(t.name,t.args??[]);return z({name:i,op:`db`,attributes:{...TX(n,r),[Bs]:i}})}var OX=((e={})=>{let t=e.responseHook;return{name:xX,setupOnce(){if(!S.tracingChannel)return;Y&&A.log(`[orchestrion:ioredis] subscribing to "${$.IOREDIS_COMMAND}"/"${$.IOREDIS_CONNECT}"`);let e=S.tracingChannel($.IOREDIS_COMMAND),n=S.tracingChannel($.IOREDIS_CONNECT);H(()=>{X(e,DX,{requiresParentSpan:!0,beforeSpanEnd(e,n){if(`error`in n||!t)return;let r=n.arguments?.[0];r&&kX(t,e,r,n.result)}}),X(n,e=>{let{host:t,port:n}=wX(e.self);return z({name:`connect`,op:`db`,attributes:{...TX(t,n),[Bs]:`connect`}})},{requiresParentSpan:!0})})}}});function kX(e,t,n,r){try{e(t,n.name,n.args,r)}catch{}}var AX=U(OX),jX=`messaging.destination.partition.id`,MX=`messaging.kafka.message.key`,NX=`messaging.kafka.message.tombstone`,PX=`messaging.kafka.offset`,FX=`process`,IX=`receive`,LX=`send`,RX=`kafka`,zX=`_OTHER`,BX=`auto.kafkajs.orchestrion.producer`,VX=`auto.kafkajs.orchestrion.consumer`,HX=1,UX=0;function WX(e,t){let n=e?.[t];if(n!=null)return Array.isArray(n)?n[0]?.toString():n.toString()}function GX(e){let t=WX(e,`sentry-trace`);if(!t)return;let{traceId:n,parentSpanId:r,sampled:i}=Ai(t,WX(e,`baggage`));if(r)return[{context:{traceId:n,spanId:r,isRemote:!0,traceFlags:i?HX:UX}}]}function KX({topic:e,message:t,operationType:n,links:r,attributes:i}){let a=n===`receive`?`poll`:n;return z({name:`${a} ${e}`,op:`message`,kind:n===`receive`?W.CLIENT:W.CONSUMER,links:r,attributes:{...i,[Uc]:RX,[zc]:e,[Hc]:n,[Vc]:a,[MX]:t?.key?String(t.key):void 0,[NX]:t?.key&&t.value===null?!0:void 0,[PX]:t?.offset,...t?{[I]:VX}:{}}})}function qX(e,t){let n=z({name:`send ${e}`,op:`message`,kind:W.PRODUCER,attributes:{[Uc]:RX,[zc]:e,[MX]:t.key?String(t.key):void 0,[NX]:t.key&&t.value===null?!0:void 0,[jX]:t.partition===void 0?void 0:String(t.partition),[Vc]:`send`,[Hc]:LX,[I]:BX}});t.headers=t.headers??{};let r=Ef({span:n});return r[`sentry-trace`]&&(t.headers[`sentry-trace`]=r[`sentry-trace`]),r.baggage&&(t.headers.baggage=r.baggage),n}function JX(e,t){let n,r=zX;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(Ws,r),e.setStatus({code:2,message:n})})}function YX(e,t){return Promise.resolve(t).catch(t=>{throw JX(e,t),t}).finally(()=>{e.forEach(e=>e.end())})}var XX=Symbol(`sentry-kafkajs-consumer-callback-wrapped`);function ZX(e){return typeof e==`function`&&e[XX]===!0}function QX(e){let t=function(t){return uo({sentryTrace:WX(t.message.headers,`sentry-trace`),baggage:WX(t.message.headers,`baggage`)},()=>{let n=KX({topic:t.topic,message:t.message,operationType:FX,attributes:{[jX]:String(t.partition)}}),r=B(n,()=>e.call(this,t));return YX([n],r)})};return t[XX]=!0,t}function $X(e){let t=function(t){let n=mo(()=>KX({topic:t.batch.topic,message:void 0,operationType:IX,attributes:{[Lc]:t.batch.messages.length,[jX]:String(t.batch.partition)}}));return B(n,()=>{let r=[n];return t.batch.messages.forEach(e=>{r.push(KX({topic:t.batch.topic,message:e,operationType:FX,links:GX(e.headers),attributes:{[jX]:String(t.batch.partition)}}))}),YX(r,e.call(this,t))})};return t[XX]=!0,t}var eZ=`Kafka`;function tZ(){S.tracingChannel($.KAFKAJS_SEND_BATCH).subscribe({start(e){let t=[];(e.arguments[0]?.topicMessages??[]).forEach(e=>{e.messages.forEach(n=>{t.push(qX(e.topic,n))})}),e._sentrySpans=t},error(e){e._sentrySpans&&JX(e._sentrySpans,e.error)},asyncEnd(e){e._sentrySpans?.forEach(e=>e.end())}})}function nZ(){S.tracingChannel($.KAFKAJS_CONSUMER_RUN).subscribe({start(e){let t=e.arguments[0];t&&typeof t==`object`&&(typeof t.eachMessage==`function`&&!ZX(t.eachMessage)&&(t.eachMessage=QX(t.eachMessage)),typeof t.eachBatch==`function`&&!ZX(t.eachBatch)&&(t.eachBatch=$X(t.eachBatch)))}})}var rZ=U((()=>({name:eZ,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:kafkajs] subscribing to channels "${$.KAFKAJS_SEND_BATCH}", "${$.KAFKAJS_CONSUMER_RUN}"`),tZ(),nZ())}}))),iZ=`Knex`,aZ=`auto.db.orchestrion.knex`,oZ=1021,sZ=`db.sql.table`,cZ=`sqlite`,lZ=`postgresql`,uZ=Symbol(`sentry.orchestrion.knex.parent-span`),dZ=(()=>({name:iZ,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:knex] subscribing to channel "${$.KNEX_QUERY}"`),H(()=>{fZ($.KNEX_QUERY_BUILDER),fZ($.KNEX_SCHEMA_BUILDER),fZ($.KNEX_RAW),pZ()}))}}));function fZ(e){S.tracingChannel(e).end.subscribe(e=>{let t=e.result;if(!t||typeof t!=`object`||uZ in t)return;let n=R();n&&Object.defineProperty(t,uZ,{value:n})})}function pZ(){X(S.tracingChannel($.KNEX_QUERY),e=>{let t=e.self,n=t?.builder,r=n?.[uZ]??R();if(!r)return;let i=e.arguments[0],a=t?.client,o=a?.config?.connection,s=o?.connectionString,c=vZ(n),l=i?.method,u=o?.filename||o?.database||yZ(s),d={[I]:aZ,"knex.version":e.moduleVersion,[Vs]:gZ(a?.driverName),[sZ]:c,[Is]:l,[Us]:o?.user,[Ps]:u,[Qc]:o?.host??bZ(s),[$c]:o?.port??xZ(s),[el]:o?.filename===`:memory:`?`inproc`:void 0,[Bs]:i?.sql==null?void 0:xn(i.sql,oZ)};return z({name:_Z(u,l,c)??`knex.query`,kind:W.CLIENT,op:`db`,parentSpan:r,attributes:d})},{beforeSpanEnd(e,t){if(`error`in t){let n=mZ(t);n!==void 0&&e.setStatus({code:2,message:n})}}})}function mZ(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=hZ(e.self)(r.sql,r.bindings||[]);return n.replace(`${t} - `,``)}catch{return n}}function hZ(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 gZ(e){return e===`sqlite3`?cZ:e===`pg`?lZ:e}function _Z(e,t,n){return t&&e?n?`${t} ${e}.${n}`:`${t} ${e}`:e}function vZ(e){let t=e?._single?.table;return t&&typeof t==`object`?vZ(t):typeof t==`string`?t:void 0}function yZ(e){if(e)try{return new URL(e).pathname?.replace(/^\//,``)||void 0}catch{return}}function bZ(e){if(e)try{return new URL(e).hostname||void 0}catch{return}}function xZ(e){if(e)try{let t=new URL(e).port;return t?parseInt(t,10):void 0}catch{return}}var SZ=U(dZ),CZ=my,wZ=[ov,wv,Zv],TZ=!1;function EZ(){tf(wZ)}var DZ=((e={})=>({name:CZ,setupOnce(){if(!S.tracingChannel||TZ)return;TZ=!0;let t=Ly(e),n=e=>{EZ();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=Iy(r.callbacks,t)};for(let e of[$.LANGCHAIN_CHAT_MODEL_INVOKE,$.LANGCHAIN_CHAT_MODEL_STREAM])Y&&A.log(`[orchestrion:langchain] subscribing to channel "${e}"`),S.tracingChannel(e).start.subscribe(n);H(()=>{for(let t of OG)Y&&A.log(`[orchestrion:langchain] subscribing to channel "${t}"`),X(S.tracingChannel(t),t=>OZ(t,e))})}}));function OZ(e,t){EZ();let n=(e.arguments??[])[0];return z(By(e.self,n,t))}var kZ=U(DZ),AZ=Uy,jZ=!1,MZ=!1,NZ=((e={})=>({name:AZ,setupOnce(){if(!S.tracingChannel||jZ)return;jZ=!0;let t=$g(e),n=Ly(t);H(()=>{Y&&A.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_STATE_GRAPH_COMPILE}"`),X(S.tracingChannel($.LANGGRAPH_STATE_GRAPH_COMPILE),e=>{if(MZ)return;let t=PZ(e.arguments);return z(tb(typeof t?.name==`string`?t.name:void 0))},{beforeSpanEnd:(e,r)=>{FZ(r.result,PZ(r.arguments)??{},t,null,n)}}),Y&&A.log(`[orchestrion:langgraph] subscribing to channel "${$.LANGGRAPH_CREATE_REACT_AGENT}"`);let e=S.tracingChannel($.LANGGRAPH_CREATE_REACT_AGENT);e.start.subscribe(e=>{MZ=!0;try{let{arguments:n}=e,r=PZ(n);r&&Array.isArray(r.tools)&&r.tools.length>0&&qy(r.tools,t,Ky(n)??void 0)}catch(e){Y&&A.error(`[orchestrion:langgraph] failed to wrap createReactAgent tools`,e)}}),e.end.subscribe(e=>{MZ=!1;let{arguments:r,result:i}=e,a=Ky(r)??void 0;FZ(i,a?{name:a}:{},t,Gy(r),n)}),e.error.subscribe(()=>{MZ=!1})})}}));function PZ(e){let t=(e??[])[0];return typeof t==`object`&&t?t:void 0}function FZ(e,t,n,r,i){if(!e||typeof e!=`object`)return;let a=e,o=a.invoke;typeof o==`function`&&(a.invoke=rb(o.bind(a),a,t,n,r,i))}var IZ=U(NZ),LZ=`LruMemoizer`,RZ=U((()=>({name:LZ,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:lru-memoizer] subscribing to channel "${$.LRU_MEMOIZER_LOAD}"`),H(()=>{X(S.tracingChannel($.LRU_MEMOIZER_LOAD),()=>void 0)}))}}))),zZ=`Mongo`,BZ=`auto.db.orchestrion.mongo`,VZ=new Set([`insert`,`update`,`delete`,`find`,`getMore`,`killCursors`]),HZ=(()=>({name:zZ,setupOnce(){S.tracingChannel&&H(()=>{UZ(),WZ(),GZ()})}}));function UZ(){X(S.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 aI(tI(e.self,n,r,i,BZ))},{requiresParentSpan:!0})}function WZ(){X(S.tracingChannel($.MONGODB_CHECKOUT),()=>void 0)}function GZ(){for(let e of[`insert`,`update`,`remove`])KZ(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}));KZ($.MONGODB_V3_COMMAND,e=>{let t=e[2],n=t?Object.keys(t)[0]:void 0;if(!(n&&VZ.has(n)))return{topology:e[0],ns:e[1],command:t,operation:t?rI(t):void 0}}),KZ($.MONGODB_V3_QUERY,e=>({topology:e[0],ns:e[1],command:e[2],operation:`find`})),KZ($.MONGODB_V3_GET_MORE,e=>({topology:e[0],ns:e[1],command:e[2]?.cmd,operation:`getMore`}))}function KZ(e,t){X(S.tracingChannel(e),e=>{let n=e.arguments;if(!n)return;let r=t(n);if(r&&typeof r.ns==`string`)return aI(iI(r.ns,r.topology,r.command,r.operation,BZ))},{requiresParentSpan:!0})}var qZ=U(HZ),JZ=`Mongoose`,YZ=`auto.db.orchestrion.mongoose`,XZ=new WeakMap,ZZ=!1,QZ=(()=>({name:JZ,setupOnce(){S.tracingChannel&&H(()=>{FF(S.tracingChannel),$Z()})}}));function $Z(){if(!ZZ){ZZ=!0,Y&&A.log(`[orchestrion:mongoose] subscribing to injected channels`);for(let e of JG)tQ(e).subscribe({start(e){rQ(e.self)}});tQ($.MONGOOSE_MODEL_AGGREGATE).subscribe({end(e){let t=e.result;t&&typeof t==`object`&&rQ(t)}}),nQ($.MONGOOSE_QUERY_EXEC,e=>{let t=e;return eQ(t.mongooseCollection,t.model?.modelName,t.op??`exec`,XZ.get(e))}),nQ($.MONGOOSE_AGGREGATE_EXEC,e=>{let t=e._model;return eQ(t?.collection,t?.modelName,`aggregate`,XZ.get(e))}),nQ($.MONGOOSE_MODEL_SAVE,e=>{let t=e.constructor;return eQ(t.collection,t.modelName,`save`)}),nQ($.MONGOOSE_MODEL_REMOVE,e=>{let t=e.constructor;return eQ(t.collection,t.modelName,`remove`)}),nQ($.MONGOOSE_MODEL_INSERT_MANY,e=>{let t=e;return eQ(t.collection,t.modelName,`insertMany`)}),nQ($.MONGOOSE_MODEL_BULK_WRITE,e=>{let t=e;return eQ(t.collection,t.modelName,`bulkWrite`)})}}function eQ(e,t,n,r){return KR({collection:e,modelName:t,operation:n,origin:YZ,parentSpan:r})}function tQ(e){return S.tracingChannel(e)}function nQ(e,t){X(S.tracingChannel(e),e=>{let n=e.self;if(n)return t(n)})}function rQ(e){let t=R();e&&t&&XZ.set(e,t)}var iQ=U(QZ),aQ=`Mysql`,oQ=`db.system`,sQ=`db.connection_string`,cQ=`db.name`,lQ=`db.user`,uQ=`db.statement`,dQ=`net.peer.name`,fQ=`net.peer.port`,pQ=(()=>({name:aQ,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:mysql] subscribing to channel "${$.MYSQL_QUERY}"`),H(()=>{X(S.tracingChannel($.MYSQL_QUERY),e=>{let t=hQ(e.arguments[0]),{host:n,port:r,database:i,user:a}=gQ(e.self),o=typeof r==`string`?parseInt(r,10):r,s=typeof o==`number`&&!isNaN(o);return e._sentryCallerScope=M(),z({name:t??`mysql.query`,kind:W.CLIENT,op:`db`,attributes:{[oQ]:`mysql`,[I]:`auto.db.orchestrion.mysql`,[sQ]:_Q(n,s?o:void 0,i),...i?{[cQ]:i}:{},...a?{[lQ]:a}:{},...t?{[uQ]:t}:{},...n?{[dQ]:n}:{},...s?{[fQ]:o}:{}}})},{deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!mQ(n))return!1;let r=e._sentryCallerScope;return r&&Lo(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}})}))}}));function mQ(e){return`on`in e&&typeof e.on==`function`}function hQ(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 gQ(e){let t=e?.config?.connectionConfig??e?.config??{};return{host:t.host,port:t.port,database:t.database,user:t.user}}function _Q(e,t,n){let r=`jdbc:mysql://${e||`localhost`}`;return typeof t==`number`&&(r+=`:${t}`),n&&(r+=`/${n}`),r}var vQ=U(pQ),yQ=`Mysql2`,bQ=`auto.db.orchestrion.mysql2`,xQ=`mysql`;function SQ(){pI(S.tracingChannel),CQ($.MYSQL2_QUERY),CQ($.MYSQL2_EXECUTE)}function CQ(e){X(S.tracingChannel(e),e=>{let t=wQ(e.arguments);return z({name:t??`mysql2.query`,kind:W.CLIENT,attributes:{[I]:bQ,[F]:`db`,[Vs]:xQ,...EQ(e.self?.config),[Bs]:t||void 0}})},{requiresParentSpan:!0})}function wQ(e){return TQ(e[0])}function TQ(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 EQ(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{[Ps]:r||void 0,[Us]:i||void 0,[Qc]:t||void 0,[$c]:o?a:void 0}}var DQ=U((()=>({name:yQ,setupOnce(){S.tracingChannel&&H(()=>{SQ()})}}))),OQ=`OpenAI`,kQ=`auto.ai.orchestrion.openai`,AQ=[{channel:$.OPENAI_CHAT,operation:`chat`},{channel:$.OPENAI_EMBEDDINGS,operation:`embeddings`}],jQ=!1,MQ=((e={})=>({name:OQ,setupOnce(){S.tracingChannel&&!jQ&&(jQ=!0,H(()=>{for(let{channel:t,operation:n}of AQ)Y&&A.log(`[orchestrion:openai] subscribing to channel "${t}"`),X(S.tracingChannel(t),t=>NQ(t,n,e),{beforeSpanEnd:(t,n)=>{dv(t,n.result,$g(e).recordOutputs)},deferSpanEnd:({span:t,data:n})=>FQ(t,n,e)})}))}}));function NQ(e,t,n){if(nf(OQ))return;let r=e.arguments??[],i=r[0],{recordInputs:a}=$g(n),o=e_(n.enableTruncation),s=yv(r,t);s[I]=kQ;let c=z({name:`${t} ${i?.model||`unknown`}`,op:`gen_ai.${t}`,attributes:s});return a&&i&&bv(c,i,t,o),c}function PQ(e){return!!e&&typeof e[Symbol.asyncIterator]==`function`}function FQ(e,t,n){let r=t.result;if(!PQ(r))return!1;let{recordOutputs:i}=$g(n),a=r[Symbol.asyncIterator].bind(r),o=_v({[Symbol.asyncIterator]:a},e,i??!1);return r[Symbol.asyncIterator]=()=>o,!0}var IQ=U(MQ),LQ=`Postgres`,RQ=`auto.db.orchestrion.postgres`,zQ=`db.system`,BQ=`db.name`,VQ=`db.connection_string`,HQ=`db.user`,UQ=`db.statement`,WQ=`net.peer.name`,GQ=`net.peer.port`,KQ=`db.postgresql.plan`,qQ=`db.postgresql.idle.timeout.millis`,JQ=`db.postgresql.max.client`,YQ=`postgresql`,XQ=`pg.query`,ZQ=`pg.connect`,QQ=`pg-pool.connect`,$Q=((e={})=>({name:LQ,setupOnce(){S.tracingChannel&&H(()=>{e$($.PG_QUERY,t$,{deferStreamedResult:!0}),e.ignoreConnectSpans||(e$($.PG_CONNECT,n$),e$($.PGPOOL_CONNECT,r$))})}}));function e$(e,t,{deferStreamedResult:n=!1}={}){Y&&A.log(`[orchestrion:pg] subscribing to channel "${e}"`),X(S.tracingChannel(e),e=>(e._sentryCallerScope=M(),z({...t(e),kind:W.CLIENT})),n?{requiresParentSpan:!0,deferSpanEnd({data:e,end:t}){let n=e.result;if(!n||typeof n!=`object`||!i$(n))return!1;let r=e._sentryCallerScope;return r&&Lo(n,r),n.on(`error`,e=>t(e)),n.on(`end`,()=>t()),!0}}:{requiresParentSpan:!0})}function t$(e){let t=e.self?.connectionParameters??{},n=a$(e.arguments);return{name:n?.text??XQ,op:`db`,attributes:{...o$(t),[I]:RQ,[UQ]:n?.text||void 0,[KQ]:typeof n?.name==`string`?n.name:void 0}}}function n$(e){return{name:ZQ,op:`db`,attributes:o$(e.self?.connectionParameters??{})}}function r$(e){return{name:QQ,op:`db`,attributes:s$(e.self?.options??{})}}function i$(e){return`on`in e&&typeof e.on==`function`}function a$(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 o$(e){return{[zQ]:YQ,[VQ]:c$(e),[BQ]:e.database,[HQ]:e.user,[WQ]:e.host,[GQ]:Number.isInteger(e.port)?e.port:void 0}}function s$(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{[zQ]:YQ,[VQ]:c$(e),[qQ]:e.idleTimeoutMillis,[JQ]:e.max,[BQ]:n,[GQ]:i,[WQ]:r||void 0,[HQ]:a||void 0}}function c$(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 l$=U($Q),u$=`PostgresJs`,d$=`auto.db.orchestrion.postgresjs`,f$=`db.response.status_code`,p$=()=>{},m$=Symbol.for(`sentry.query.from.instrumented.sql`),h$=Symbol(`sentryPostgresJsSpan`),g$=Symbol(`sentryPostgresJsConnectionAttrsSet`),_$=Symbol(`sentryPostgresJsSpanEnded`),v$=new WeakMap,y$=[];function b$(e){y$.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)||y$.push(e)}function x$(){return y$.length===1?y$[0]:void 0}function S$(e){let t=e.result,n=e.arguments?.[0];if(!t||typeof t!=`object`||!n)return;let r=hC(n);v$.set(t,r),b$(r)}function C$(e,t,n){let r=t;r[g$]||(r[g$]=!0,pC(e,n))}function w$(e){let t=e.self,n=e.arguments?.[0];if(!t||!n)return;let r=n[h$],i=v$.get(t);r&&i&&C$(r,n,i)}function T$(e,t,n){let r=e.self;if(!r)return;let i=()=>{e[_$]=!0},a=r.resolve;typeof a==`function`&&(r.resolve=function(...e){i();try{let r=e[0]?.command;mC(t,n,r),t.end()}catch(e){Y&&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(f$,r?.code||`unknown`),t.setAttribute(Ws,r?.name||`unknown`),mC(t,n),t.end()}catch(e){Y&&A.error(`[orchestrion:postgresjs] error ending span in reject:`,e)}return o.apply(this,e)})}var E$=U(((e={})=>{let{requireParentSpan:t,requestHook:n}=e;return{name:u$,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:postgresjs] subscribing to "${$.POSTGRESJS_HANDLE}"`),S.tracingChannel($.POSTGRESJS_CONNECTION).subscribe({start:p$,asyncStart:p$,asyncEnd:p$,error:p$,end:S$}),S.tracingChannel($.POSTGRESJS_EXECUTE).subscribe({end:p$,asyncStart:p$,asyncEnd:p$,error:p$,start:w$}),S.tracingChannel($.POSTGRESJS_CONNECT).subscribe({end:p$,asyncStart:p$,asyncEnd:p$,error:p$,start:w$}),H(()=>{X(S.tracingChannel($.POSTGRESJS_HANDLE),e=>{let t=e.self;if(!t||t.executed===!0||t[m$])return;let r=fC(uC(t.strings)),i=z({name:r||`postgresjs.query`,op:`db`,kind:W.CLIENT,attributes:{[I]:d$,[Hs]:`postgres`,[zs]:r}});t[h$]=i;let a=x$();if(a&&C$(i,t,a),n)try{n(i,r,a)}catch(e){i.setAttribute(`sentry.hook.error`,`requestHook failed`),Y&&A.error(`[orchestrion:postgresjs] error in requestHook:`,e)}return T$(e,i,r),i},{requiresParentSpan:t!==!1,deferSpanEnd({data:e}){return e[_$]?!0:!(`error`in e)}})}))}}})),D$=`Tedious`,O$=`auto.db.orchestrion.tedious`,k$=`mssql`,A$=`db.sql.table`,j$=Symbol(`sentry.orchestrion.tedious.current-database`);function M$(e){Object.defineProperty(this,j$,{value:e,writable:!0,configurable:!0})}function N$(){this.removeListener(`databaseChange`,M$)}function P$(){S.tracingChannel($.TEDIOUS_CONNECT).start.subscribe(e=>{let t=e.self;t&&(M$.call(t,t.config?.options?.database),t.removeListener(`databaseChange`,M$),t.on(`databaseChange`,M$),t.removeListener(`end`,N$),t.once(`end`,N$))})}function F$(e,t){S.tracingChannel(e).start.subscribe(e=>{let n=e,r=n.self,i=n.arguments[0];if(!r||!(i instanceof de))return;let a=0,o=0,s=()=>{o++},c=()=>{a++},l=r[j$],u=I$(i),d={[I]:O$,[Vs]:k$,[Ps]:l,[Us]:r.config?.userName??r.config?.authentication?.options?.userName,[Bs]:u,[A$]:i.table,[Qc]:r.config?.server,[$c]:r.config?.options?.port},f=z({name:L$(t,l,u,i.table),kind:W.CLIENT,op:`db`,attributes:d}),p=R$(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 I$(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 L$(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 R$(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}var z$=U((()=>({name:D$,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:tedious] subscribing to channel "${$.TEDIOUS_EXEC_SQL}"`),H(()=>{P$(),F$($.TEDIOUS_EXEC_SQL,`execSql`),F$($.TEDIOUS_EXEC_SQL_BATCH,`execSqlBatch`),F$($.TEDIOUS_CALL_PROCEDURE,`callProcedure`),F$($.TEDIOUS_EXEC_BULK_LOAD,`execBulkLoad`),F$($.TEDIOUS_PREPARE,`prepare`),F$($.TEDIOUS_EXECUTE,`execute`)}))}}))),B$=Symbol(`SentryVercelAiModelPatched`),V$=Symbol(`SentryVercelAiToolPatched`),H$=0;function U$(){return`v6-${++H$}`}var W$=new WeakMap,G$=new WeakSet,K$=new WeakSet,q$=new WeakMap,J$=new WeakMap,Y$=new WeakMap,X$=new WeakSet,Z$=!1;function Q$(e,t={}){if(!Z$){Z$=!0;try{$$(e,$.VERCEL_AI_GENERATE_TEXT,u1(`generateText`),t),$$(e,$.VERCEL_AI_STREAM_TEXT,u1(`streamText`),t),$$(e,$.VERCEL_AI_GENERATE_OBJECT,u1(`generateObject`),t),$$(e,$.VERCEL_AI_EMBED,(e,t)=>({type:`embed`,event:{callId:U$(),...p1(e.model),maxRetries:e.maxRetries,value:e.value,...f1(t)}}),t),$$(e,$.VERCEL_AI_EMBED_MANY,(e,t)=>({type:`embedMany`,event:{callId:U$(),...p1(e.model),maxRetries:e.maxRetries,values:e.values,...f1(t)}}),t),$$(e,$.VERCEL_AI_EXECUTE_TOOL_CALL,(e,t)=>({type:`executeTool`,event:{callId:U$(),toolCall:e.toolCall,tools:e.tools,...f1(t)}}),t),i1(e,$.VERCEL_AI_RESOLVE_LANGUAGE_MODEL,t)}catch{Y&&A.log(`Vercel AI orchestrion channel subscription failed.`)}}}function $$(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&&!X$.has(i))return;let a=n(t,i);r1(t,i);let o=R(),s=jL(a,r);if(s){W$.set(e,a),G$.add(s);let n=j(t.model)&&t.model.specificationVersion===`v1`;Y$.set(s,{callSiteSpan:o,toolErrorsBubbleToCaller:n}),a.type===`executeTool`&&K$.add(s);let c=Z(a.event.callId);c&&q$.set(s,c),J$.set(s,f1(i)),j(t.tools)&&c1(t.tools,r),n&&o1(t.model,r)}return s};X(i,e=>a(e),{beforeSpanEnd:(e,t)=>{let n=W$.get(t);if(n){if(`error`in t){let n=Y$.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,IL(e,n,r);n.type!==`streamText`&&xL(n),W$.delete(t)}},deferSpanEnd:({data:e,end:t})=>e1(e,t)})}function e1(e,t){if(W$.get(e)?.type!==`streamText`||`error`in e||!t1(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 t1(e){return j(e)&&(n1(e.totalUsage)||n1(e.usage))}function n1(e){return j(e)&&typeof e.then==`function`}function r1(e,t){if(t.isEnabled!==!0)return;let n={...t,isEnabled:!1};X$.add(n),e.experimental_telemetry=n}function i1(e,t,n){e(t).subscribe({end(e){let t=e;j(t.result)&&o1(t.result,n)},start(){},asyncStart(){},asyncEnd(){},error(){}})}function a1(){let e=R();return e&&G$.has(e)?e:void 0}function o1(e,t){e[B$]||(e[B$]=!0,s1(e,`doGenerate`,t),s1(e,`doStream`,t))}function s1(e,t,n){let r=e[t];typeof r==`function`&&(e[t]=function(...i){let a=a1();if(!a)return Promise.resolve(r.apply(this,i));let o=j(i[0])?i[0]:{},s=q$.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,...J$.get(a)}},l=B(a,()=>jL(c,n));if(!l)return Promise.resolve(r.apply(this,i));let u=()=>{t===`doStream`&&s&&SL(s)},d=e=>{throw l.setStatus({code:2,message:e instanceof Error?e.message:`unknown_error`}),l.end(),u(),e};try{return Promise.resolve(r.apply(this,i)).then(e=>t===`doStream`&&j(e)&&rL(e.stream)?(e.stream=iL(e.stream,t=>{c.result={...e,...OL(t)},IL(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,IL(l,c,n),l.end(),u(),e),d)}catch(e){return d(e)}})}function c1(e,t){try{for(let[n,r]of Object.entries(e))j(r)&&l1(n,r,e,t)}catch{Y&&A.log(`Vercel AI orchestrion tool patching failed.`)}}function l1(e,t,n,r){let i=t.execute;typeof i!=`function`||t[V$]||(t[V$]=!0,t.execute=function(t,...a){let o=a1();if(!o||K$.has(o))return i.apply(this,[t,...a]);let s=j(a[0])?a[0]:{},c={type:`executeTool`,event:{callId:q$.get(o),toolCall:{toolName:e,toolCallId:Z(s.toolCallId),input:t},tools:n,...J$.get(o)}},l=B(o,()=>jL(c,r));if(!l)return i.apply(this,[t,...a]);let u=e=>{throw Y$.get(o)?.toolErrorsBubbleToCaller?l.setStatus({code:2,message:e instanceof Error?e.message:`tool_error`}):WL(l,c,e),l.end(),e};try{return Promise.resolve(i.apply(this,[t,...a])).then(e=>(c.result={output:e},IL(l,c,r),l.end(),e),u)}catch(e){return u(e)}})}function u1(e){return(t,n)=>({type:e,event:{callId:U$(),operationId:`ai.${e}`,functionId:Z(n.functionId),...p1(t.model),maxRetries:t.maxRetries,instructions:Z(t.system),messages:d1(t),...f1(n)}})}function d1(e){return Array.isArray(e.messages)?e.messages:typeof e.prompt==`string`?[{role:`user`,content:e.prompt}]:e.messages??e.prompt}function f1(e){let t=e.isEnabled===!0||void 0;return{recordInputs:e.recordInputs??t,recordOutputs:e.recordOutputs??t}}function p1(e){return{provider:m1(e,`provider`),modelId:m1(e,`modelId`)}}function m1(e,t){return j(e)?Z(e[t]):void 0}var h1=U(((e={})=>Nu(JL(e),{options:e,setupOnce(){S.tracingChannel&&H(()=>{Q$(S.tracingChannel,e)})}}))),g1=new WeakMap;function _1(e,t){g1.set(e,t)}function v1(e){return g1.get(e)}var y1=new WeakMap;function b1(e){let t=y1.get(e);return t||(t=[],y1.set(e,t)),t}function x1(e,t){b1(e).push(t)}function S1(e){b1(e).pop()}function C1(e){let t=e[0];return Array.isArray(t)?t.map(e=>w1(e)??``).join(`,`):w1(t)}function w1(e){return typeof e==`string`?e:e instanceof RegExp||typeof e==`number`?String(e):void 0}function T1(e){let t=b1(e),n=``;for(let e of t)e!==`/`&&e!==`/*`&&(n+=!n||n.endsWith(`/`)?e:`/${e}`);return n.replace(/\/{2,}/g,`/`)}function E1(e,t){let n=b1(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)||D1(i))?i:void 0}function D1(e){return e.includes(`:`)||e.includes(`*`)}var O1=`auto.http.express`,k1=`express.name`,A1=`express.type`,j1=()=>{},M1=!1;function N1(e,t){if(!M1){M1=!0;for(let e of[$.EXPRESS_REGISTER,$.ROUTER_REGISTER])t(e).subscribe({start:j1,asyncStart:j1,asyncEnd:j1,error:j1,end:P1});for(let n of[$.EXPRESS_HANDLE,$.ROUTER_HANDLE]){Y&&A.log(`[orchestrion:express] subscribing to channel "${n}"`);let r=t(n);X(r,t=>I1(t,e),{beforeSpanEnd(e,t){t._sentryCleanup?.()}}),r.subscribe({start:j1,asyncEnd:j1,end:j1,error:j1,asyncStart:F1})}}}function P1(e){let t=e.self?.stack;if(!Array.isArray(t))return;let n=t[t.length-1];n&&_1(n,C1(e.arguments??[]))}function F1(e){if(!e._sentryStoredLayer)return;e._sentryStoredLayer=!1;let t=e.arguments?.[0];t&&S1(t)}function I1(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=L1(n),s=v1(n);s!=null&&(x1(i,s),e._sentryStoredLayer=!0);let c=o===`request_handler`?T1(i):void 0,l=o===`request_handler`&&c!=null?E1(i,c):void 0,u=o===`request_handler`?c||`request handler`:o===`router`?n.path??`/`:n.name??`<anonymous>`;if(l&&R1(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 Y&&A.warn(`[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name`)}if(z1(u,o,t))return;let d=z({name:u,attributes:{[I]:O1,[F]:`${o}.express`,[k1]:u,[A1]:o,...l?{[kc]:l}:{}}});if(a&&typeof a.once==`function`){let t=()=>{d.end()};a.once(`finish`,t),e._sentryCleanup=()=>a.removeListener(`finish`,t)}return d}function L1(e){return e.name===`router`?`router`:e.name===`bound dispatch`||e.name===`handle`?`request_handler`:`middleware`}function R1(e){let t=R(),n=t&&ra(t);n&&L(n).data[`sentry.op`]===`http.server`&&n.setAttribute(kc,e)}function z1(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 B1=`Express`,V1=U(((e={})=>({name:B1,setupOnce(){S.tracingChannel&&H(()=>{N1(e,S.tracingChannel)})},getShouldHandleError(){return e.shouldHandleError}})));function H1(e,t){return z({name:`${e} ${t.path}`,op:`db.query`,kind:W.CLIENT,attributes:{[I]:`auto.firebase.orchestrion.firestore`,[Rs]:e,...W1(t)}})}function U1(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(Le.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 W1(e){let t=e.firestore.app,n=t.options,r=e.firestore.toJSON()?.settings||{},i={[Ns]:e.path,[Fs]:t.name,[Hs]:`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}=U1(r);return a&&(i[pl]=a),o&&(i[ml]=o),i}var G1=`auto.firebase.orchestrion.functions`,K1=`__sentryFirebaseWrapped`;function q1(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[K1]||(n[r]=J1(i,t))}function J1(e,t){let n=async function(...n){let r=process.env.FUNCTION_TARGET||process.env.K_SERVICE||`unknown`,i={[I]:G1,[Ys]:r,[Xs]: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),so({name:`firebase.function.${t}`,op:`function.firebase`,kind:W.SERVER,attributes:i},async t=>{try{let r=await e.apply(this,n);return t.end(),r}catch(e){throw t.setStatus({code:2}),V(e,{mechanism:{type:G1,handled:!1}}),t.end(),await uu(2e3),e}})};return n[K1]=!0,n}var Y1=[{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}],X1=[{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`}],Z1=()=>{};function Q1(e){try{return e()}catch(e){Y&&A.warn(`[orchestrion:firebase] error handling channel event`,e);return}}function $1(){for(let{channel:e,spanName:t,useParent:n}of Y1)X(S.tracingChannel(e),e=>Q1(()=>{let r=e.arguments[0];if(!r)return;let i=n&&r.parent||r;return H1(t,i)}));for(let{channel:e,triggerType:t}of X1)S.tracingChannel(e).subscribe({start:e=>void Q1(()=>q1(e,t)),end:Z1,asyncStart:Z1,asyncEnd:Z1,error:Z1})}var e0=`Firebase`,t0=U((()=>({name:e0,setupOnce(){S.tracingChannel&&H(()=>{$1()})}})));function n0(){return!!O.__SENTRY_ORCHESTRION__}function r0(){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 i0=`RedisChannel`,a0=`auto.db.orchestrion.redis`,o0=`db.connection_string`,s0=`redis`;function c0(e,t){t&&e.setStatus({code:2,message:t instanceof Error?t.message:String(t)}),e.end()}function l0(e,t,n,r,i){if(e)try{e(t,n,r,i)}catch{}}function u0(e){let t=e[0];return j(t)&&Object.getOwnPropertySymbols(t).length>0?e.slice(1):e}function d0(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 f0(e){return{[Vs]:s0,[Qc]:e?.socket?.host,[$c]:e?.socket?.port,[o0]:d0(e?.url),[I]:a0}}function p0(e,t,n){return z({name:`redis-${e}`,kind:W.CLIENT,attributes:{...n,[F]:`db`,[Bs]:eL(e,t)}})}function m0(e){let t=S.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={[Vs]:s0,[I]:a0};a[Qc]=i?.connection_options?.host,a[$c]=i?.connection_options?.port,i?.address&&(a[o0]=`redis://${i.address}`);let o=p0(n.command,n.args??[],a);t._sentrySpan=o;let s=R();n.callback=function(t,i){t||l0(e,o,n.command,n.args??[],i),c0(o,t);let a=arguments;return B(s??null,()=>r.apply(this,a))}},error(e){let t=e._sentrySpan;t&&c0(t,e.error)}})}function h0(e,t,n){X(S.tracingChannel(e),e=>{let n=t(e);if(!n?.length)return;let r=String(n[0]),i=e.self?.options;return p0(r,n.slice(1),f0(i))},{beforeSpanEnd(e,r){if(`error`in r||!n)return;let i=t(r);i?.length&&l0(n,e,String(i[0]),i.slice(1),r.result)}})}function g0(e){let t=e.arguments?.[0];return Array.isArray(t)?t:void 0}function _0(e){let t=e.arguments?.[0],n=e.arguments?.[1];if(typeof t?.transformArguments==`function`&&Array.isArray(n))try{return t.transformArguments(...u0(n))}catch{return}}function v0(){X(S.tracingChannel($.NODE_REDIS_CONNECT),e=>{let t=e.self?.options;return z({name:`redis-connect`,kind:W.CLIENT,attributes:{...f0(t),[F]:`db`}})})}function y0(e,t){X(S.tracingChannel(e),e=>{let n=e.arguments?.[0],r=Array.isArray(n)?n.length:void 0,i=e.self?.options?.socket;return z({name:t(e),kind:W.CLIENT,attributes:{[I]:a0,[F]:`db.redis`,[Hs]:s0,...r&&r>1?{[Ls]:r}:{},...i?.host==null?{}:{[pl]:i.host},...i?.port==null?{}:{[ml]:i.port}}})})}var b0=U(((e={})=>{let t=e.responseHook;return{name:i0,setupOnce(){S.tracingChannel&&(Y&&A.log(`[orchestrion:redis] subscribing to "${$.REDIS_COMMAND}" and node-redis channels`),m0(t),H(()=>{h0($.NODE_REDIS_COMMAND,g0,t),h0($.NODE_REDIS_EXECUTOR,_0,t),v0(),y0($.NODE_REDIS_MULTI,()=>`MULTI`),y0($.NODE_REDIS_PIPELINE,()=>`PIPELINE`),y0($.NODE_REDIS_BATCH,e=>e.arguments?.[2]===void 0?`PIPELINE`:`MULTI`)}))}}})),x0={postgresIntegration:l$,postgresJsIntegration:E$,mongoIntegration:qZ,mysqlIntegration:vQ,mysql2Integration:DQ,genericPoolIntegration:YJ,mongooseIntegration:iQ,lruMemoizerIntegration:RZ,openaiIntegration:IQ,anthropicIntegration:Rq,googleGenAIIntegration:aY,langChainIntegration:kZ,langGraphIntegration:IZ,vercelAiIntegration:h1,amqplibIntegration:Oq,hapiIntegration:sX,koaIntegration:bX,expressIntegration:V1,graphqlIntegration:HY,kafkajsIntegration:rZ,tediousIntegration:z$,awsIntegration:NJ,firebaseIntegration:t0},S0=`Knex`,C0=J(S0,()=>new vW),w0=U((()=>({name:S0,setupOnce(){n0()?SZ().setupOnce?.():C0()}}))),T0=`db.sql.table`,E0=`mssql`;function D0(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 O0=e=>{let t=!1;return(...n)=>{if(!t)return t=!0,e(...n)}},k0=`@sentry/instrumentation-tedious`,A0=Symbol(`opentelemetry.instrumentation-tedious.current-database`),j0=[`callProcedure`,`execSql`,`execSqlBatch`,`execBulkLoad`,`prepare`,`execute`];function M0(e){Object.defineProperty(this,A0,{value:e,writable:!0})}var N0=class e extends K{constructor(e={}){super(k0,k,e)}init(){return[new q(e.COMPONENT,[`>=1.11.0 <20`],e=>{let t=e.Connection.prototype;for(let e of j0)G(t[e])&&this._unwrap(t,e),this._wrap(t,e,this._patchQuery(e));return G(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 j0)this._unwrap(t,e);this._unwrap(t,`connect`)})]}_patchConnect(e){return function(){return M0.call(this,this.config?.options?.database),this.removeListener(`databaseChange`,M0),this.on(`databaseChange`,M0),this.once(`end`,()=>{this.removeListener(`databaseChange`,M0)}),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[A0],l=(e=>e.sqlTextOrProcedure===`sp_prepare`&&e.parametersByName?.stmt?.value?e.parametersByName.stmt.value:e.sqlTextOrProcedure)(r),u={[I]:`auto.db.otel.tedious`,[Vs]:E0,[Ps]:c,[Us]:this.config?.userName??this.config?.authentication?.options?.userName,[Bs]:l,[T0]:r.table,[Qc]:this.config?.server,[$c]:this.config?.options?.port},d=z({name:D0(e,c,l,r.table),kind:W.CLIENT,attributes:u}),f=O0(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`),B(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)}}};N0.COMPONENT=`tedious`;var P0=N0,F0=`Tedious`,I0=J(F0,()=>new P0({})),L0=U((()=>({name:F0,setupOnce(){I0()}}))),R0=`generic-pool`,z0=`@sentry/instrumentation-generic-pool`,B0=class extends K{constructor(e={}){super(z0,k,e),this._isDisabled=!1}init(){return[new q(R0,[`>=3.0.0 <4`],e=>{let t=e.Pool;return G(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 q(R0,[`>=2.4.0 <3`],e=>{let t=e.Pool;return G(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 q(R0,[`>=2.0.0 <2.4`],e=>(this._isDisabled=!1,G(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 oo({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):so({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)})}}},V0=`GenericPool`,H0=J(V0,()=>new B0({})),U0=U((()=>({name:V0,setupOnce(){H0()}}))),W0=`dataloader`,G0=`@sentry/instrumentation-dataloader`,K0=`auto.db.otel.dataloader`;function q0(e){return e[Symbol.toStringTag]===`Module`}function J0(e){return q0(e)?e.default:e}function Y0(e,t){let n=e.name;return n?`${W0}.${t} ${n}`:`${W0}.${t}`}function X0(e){if(e===`load`||e===`loadMany`||e===`batch`)return`cache.get`}function Z0(e){return Array.isArray(e)?e.map(e=>String(e)):e==null?void 0:[String(e)]}var Q0=class extends K{constructor(e={}){super(G0,k,e)}init(){return[new q(W0,[`>=2.0.0 <3`],e=>{let t=J0(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=J0(e);[`load`,`loadMany`,`prime`,`clear`,`clearAll`].forEach(e=>{G(t.prototype[e])&&this._unwrap(t.prototype,e)})})]}_wrapBatchLoadFn(e){let t=this;return function(...n){return t.isEnabled()?oo({name:Y0(this,`batch`),links:this._batch?.spanLinks,attributes:{[I]:K0,[F]:X0(`batch`),[As]:Z0(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`&&(G(n[0])&&t._unwrap(n,0),n[0]=t._wrapBatchLoadFn(n[0])),e.apply(this,n)}return r.prototype=n,r}_patchLoad(e){G(e.load)&&this._unwrap(e,`load`),this._wrap(e,`load`,this._getPatchedLoad.bind(this))}_getPatchedLoad(e){return function(...t){return oo({name:Y0(this,`load`),kind:W.CLIENT,attributes:{[I]:K0,[F]:X0(`load`),[As]:Z0(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){G(e.loadMany)&&this._unwrap(e,`loadMany`),this._wrap(e,`loadMany`,this._getPatchedLoadMany.bind(this))}_getPatchedLoadMany(e){return function(...t){return oo({name:Y0(this,`loadMany`),kind:W.CLIENT,attributes:{[I]:K0,[F]:X0(`loadMany`),[As]:Z0(t[0])},onlyIfParent:!0},()=>e.call(this,...t))}}_patchPrime(e){G(e.prime)&&this._unwrap(e,`prime`),this._wrap(e,`prime`,this._getPatchedPrime.bind(this))}_getPatchedPrime(e){return function(...t){return oo({name:Y0(this,`prime`),kind:W.CLIENT,attributes:{[I]:K0,[F]:X0(`prime`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClear(e){G(e.clear)&&this._unwrap(e,`clear`),this._wrap(e,`clear`,this._getPatchedClear.bind(this))}_getPatchedClear(e){return function(...t){return oo({name:Y0(this,`clear`),kind:W.CLIENT,attributes:{[I]:K0,[F]:X0(`clear`)},onlyIfParent:!0},()=>e.call(this,...t))}}_patchClearAll(e){G(e.clearAll)&&this._unwrap(e,`clearAll`),this._wrap(e,`clearAll`,this._getPatchedClearAll.bind(this))}_getPatchedClearAll(e){return function(...t){return oo({name:Y0(this,`clearAll`),kind:W.CLIENT,attributes:{[I]:K0,[F]:X0(`clearAll`)},onlyIfParent:!0},()=>e.call(this,...t))}}},$0=`Dataloader`,e2=J($0,()=>new Q0),t2=U((()=>({name:$0,setupOnce(){n0()?qJ().setupOnce?.():e2()}}))),n2=(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))(n2||{}),r2=`messaging.operation`,i2=`messaging.destination`,a2=`messaging.destination_kind`,o2=`messaging.rabbitmq.routing_key`,s2=`messaging.protocol`,c2=`messaging.protocol_version`,l2=`messaging.url`,u2=`messaging.message_id`,d2=`messaging.conversation_id`,f2=`topic`,p2=`process`;x();var m2=`auto.amqplib.otel.publisher`,h2=`auto.amqplib.otel.consumer`,g2=Symbol(`opentelemetry.amqplib.message.stored-span`),_2=Symbol(`opentelemetry.amqplib.channel.spans-not-ended`),v2=Symbol(`opentelemetry.amqplib.channel.consumer-timeout-timer`),y2=Symbol(`opentelemetry.amqplib.connection.attributes`),b2=Symbol(`sentry.amqplib.channel.is-confirm-publishing`),x2=e=>e===``?`<default>`:e,S2=e=>e.replace(/:[^:@/]*@/,`:***@`),C2=(e,t)=>e||(t===`AMQP`?5672:5671),w2=e=>{let t=e||`amqp`;return(t.endsWith(`:`)?t.substring(0,t.length-1):t).toUpperCase()},T2=e=>e||`localhost`,E2=e=>{let t=e.serverProperties.product?.toLowerCase?.();return t?{[Uc]:t}:{}},D2=e=>{let t={[c2]:`0.9.1`},n=e||`amqp://localhost`;if(typeof n==`object`){let e=n,r=w2(e?.protocol);t[s2]=r,t[Qc]=T2(e?.hostname),t[$c]=C2(e.port,r)}else{let e=S2(n);t[l2]=e;try{let n=new URL(e),r=w2(n.protocol);t[s2]=r,t[Qc]=T2(n.hostname),t[$c]=C2(n.port?parseInt(n.port):void 0,r)}catch{}}return t};function O2(e,t){let n=e?.[t];if(n!=null)return String(Array.isArray(n)?n[0]:n)}function k2(e,n,r,i){let a=z({name:`publish ${x2(e)}`,kind:t.PRODUCER,attributes:{...r.connection[y2],[i2]:e,[a2]:f2,[o2]:n,[u2]:i?.messageId,[d2]:i?.correlationId,[I]:m2}}),o=i??{};o.headers=o.headers??{};let s=Ef({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 A2(e,n,r){return z({name:`${e} process`,kind:t.CONSUMER,attributes:{...r?.connection?.[y2],[i2]:n.fields?.exchange,[a2]:f2,[o2]:n.fields?.routingKey,[r2]:p2,[u2]:n?.properties.messageId,[d2]:n?.properties.correlationId,[I]:h2}})}var j2=6e4;function M2(e,t,n,r){let i=e[g2];i&&(t!==!1&&i.setStatus({code:2,message:n!==n2.ChannelClosed&&n!==n2.ChannelError?`${n} called on message${r===!0?` with requeue`:r===!1?` without requeue`:``}`:n}),i.end(),e[g2]=void 0)}function N2(e,t,n,r){(e[_2]??[]).forEach(e=>{M2(e.msg,t,n,r)}),e[_2]=[]}function P2(e){let t=Un(),n=e[_2]??[],r=0;for(;r<n.length;r++){let e=n[r];if((t-e.timeOfConsume)*1e3<j2)break;M2(e.msg,null,n2.InstrumentationTimeout,!0)}n.splice(0,r)}function F2(e){return function(t,n,r){return e.call(this,t,n,function(e,n){if(e==null){let e=D2(t),r=E2(n);n[y2]={...e,...r}}r.apply(this,arguments)})}}function I2(e){return function(t){if(t===`close`){N2(this,!0,n2.ChannelClosed,void 0);let e=this[v2];e&&clearInterval(e),this[v2]=void 0}else t===`error`&&N2(this,!0,n2.ChannelError,void 0);return e.apply(this,arguments)}}function L2(e,t){return n=>function(r){return N2(this,e,t,r),n.apply(this,arguments)}}function R2(e,t){return n=>function(r,i,a){let o=this,s=t===n2.Reject?i:a,c=o[_2]??[],l=c.findIndex(e=>e.msg===r);if(l<0)M2(r,e,t,s);else if(t!==n2.Reject&&i){for(let n=0;n<=l;n++)M2(c[n].msg,e,t,s);c.splice(0,l+1)}else M2(r,e,t,s),c.splice(l,1);return n.apply(this,arguments)}}function z2(e){return function(t,n,r){let i=this;if(!Object.prototype.hasOwnProperty.call(i,_2)){let e=setInterval(()=>{P2(i)},j2);e.unref(),i[v2]=e,i[_2]=[]}let a=function(e){if(!e)return n.call(this,e);let a=e.properties.headers??{};uo({sentryTrace:O2(a,`sentry-trace`),baggage:O2(a,`baggage`)},()=>{let a=A2(t,e,i);r?.noAck||(i[_2].push({msg:e,timeOfConsume:Un()}),e[g2]=a),B(a,()=>{n.call(this,e)}),r?.noAck&&a.end()})},o=Array.prototype.slice.call(arguments);return o[1]=a,e.apply(this,o)}}function B2(e){return function(t,n,r,i,a){let o=this,{span:s,modifiedOptions:c}=k2(t,n,o,i),l=function(e,t){try{B(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[b2]=!0;try{return e.apply(this,u)}finally{o[b2]=!1}}}function V2(e){return function(t,n,r,i){if(this[b2])return e.apply(this,arguments);let{span:a,modifiedOptions:o}=k2(t,n,this,i),s=[...arguments];s[3]=o;let c=e.apply(this,s);return a.end(),c}}var H2=`@sentry/instrumentation-amqplib`,U2=[`>=0.5.5 <2`],W2=class extends K{constructor(e={}){super(H2,k,e)}init(){let e=new $R(`amqplib/lib/channel_model.js`,U2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),t=new $R(`amqplib/lib/callback_model.js`,U2,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this));return new q(`amqplib`,U2,void 0,void 0,[e,new $R(`amqplib/lib/connect.js`,U2,this.patchConnect.bind(this),this.unpatchConnect.bind(this)),t])}patchConnect(e){let t=this.unpatchConnect(e);return G(t.connect)||this._wrap(t,`connect`,F2),t}unpatchConnect(e){return G(e.connect)&&this._unwrap(e,`connect`),e}patchChannelModel(e){return G(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,`publish`,V2),G(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,`consume`,z2),G(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,`ack`,R2(!1,n2.Ack)),G(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,`nack`,R2(!0,n2.Nack)),G(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,`reject`,R2(!0,n2.Reject)),G(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,`ackAll`,L2(!1,n2.AckAll)),G(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,`nackAll`,L2(!0,n2.NackAll)),G(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,`emit`,I2),G(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,`publish`,B2),e}unpatchChannelModel(e){return G(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,`publish`),G(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,`consume`),G(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,`ack`),G(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,`nack`),G(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,`reject`),G(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,`ackAll`),G(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,`nackAll`),G(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,`emit`),G(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,`publish`),e}},G2=`Amqplib`,K2=J(G2,()=>new W2),q2=U((()=>({name:G2,setupOnce(){K2()}}))),J2=`VercelAI`,Y2=[`>=3.0.0 <7`],X2=[`generateText`,`streamText`,`generateObject`,`streamObject`,`embed`,`embedMany`,`rerank`];function Z2(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)&&($2(t.content),e4(t.content))}function $2(e){for(let t of e){if(!Z2(t))continue;let e=R_(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`),V(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`),V(t.error,{mechanism:{type:`auto.vercelai.otel`,handled:!1}})})}}function e4(e){for(let t of e)typeof t==`object`&&t&&`toolCallId`in t&&typeof t.toolCallId==`string`&&z_(t.toolCallId)}function t4(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 n4=class extends K{constructor(e={}){super(`@sentry/instrumentation-vercel-ai`,k,e),this._isPatched=!1,this._callbacks=[]}init(){return new q(`ai`,Y2,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(J2),s=o?.options,c=o?a?.getDataCollectionOptions().genAI:void 0,{recordInputs:l,recordOutputs:u}=t4(s,r,i,!!c?.inputs,!!c?.outputs);return n[0].experimental_telemetry={...r,isEnabled:i===void 0||i,recordInputs:l,recordOutputs:u},no(()=>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 X2)e[n]!=null&&(e[n]=t(e[n]));return e}{let n=X2.reduce((n,r)=>(e[r]!=null&&(n[r]=t(e[r])),n),{});return{...e,...n}}}},r4=J(J2,()=>new n4({}));function i4(e){return!!e.getIntegrationByName(`Modules`)?.getModules?.()?.ai}var a4=U(((e={})=>{let t;return Nu(JL(e),{options:e,setupOnce(){t=r4()},afterAllSetup(n){e.force??i4(n)?tv(n):t?.callWhenPatched(()=>tv(n))}})})),o4=[`>=4.0.0 <8`],s4=class extends K{constructor(e={}){super(`@sentry/instrumentation-openai`,k,e)}init(){return new q(`openai`,o4,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 nf(`OpenAI`)?Reflect.construct(n,e):Cv(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}},c4=J(ov,e=>new s4(e)),l4=U(((e={})=>({name:ov,setupOnce(){c4(e)}}))),u4=[`>=0.19.2 <1.0.0`],d4=class extends K{constructor(e={}){super(`@sentry/instrumentation-anthropic-ai`,k,e)}init(){return new q(`@anthropic-ai/sdk`,u4,this._patch.bind(this))}_patch(e){let t=e.Anthropic,n=this.getConfig(),r=function(...e){return nf(`Anthropic_AI`)?Reflect.construct(t,e):Xv(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}},f4=J(wv,e=>new d4(e)),p4=U(((e={})=>({name:wv,options:e,setupOnce(){f4(e)}}))),m4=[`>=0.10.0 <2`],h4=class extends K{constructor(e={}){super(`@sentry/instrumentation-google-genai`,k,e)}init(){return new q(`@google/genai`,m4,e=>this._patch(e),e=>e,[new $R(`@google/genai/dist/node/index.cjs`,m4,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 nf(`Google_GenAI`)?Reflect.construct(t,e):py(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 hb(e,`GoogleGenAI`,r),e}},g4=J(Zv,e=>new h4(e)),_4=U(((e={})=>({name:Zv,setupOnce(){g4(e)}}))),v4=[`>=0.1.0 <2.0.0`];function y4(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=Iy(i.callbacks,t),Reflect.apply(e,n,r)}})}var b4=class extends K{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 q(t,v4,this._patch.bind(this),e=>e,[new $R(`${t}/dist/index.cjs`,v4,this._patch.bind(this),e=>e)]));return e.push(new q(`langchain`,v4,this._patch.bind(this),e=>e,[new $R(`langchain/dist/chat_models/universal.cjs`,v4,this._patch.bind(this),e=>e)])),e}_patch(e){tf([ov,wv,Zv]);let t=this.getConfig(),n=Ly(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]=y4(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,Hy(n,t)))}}},x4=J(my,e=>new b4(e)),S4=U(((e={})=>({name:my,setupOnce(){x4(e)}}))),C4=[`>=0.0.0 <2.0.0`],w4=class extends K{constructor(e={}){super(`@sentry/instrumentation-langgraph`,k,e)}init(){return[new q(`@langchain/langgraph`,C4,this._patch.bind(this),e=>e,[new $R(`@langchain/langgraph/dist/index.cjs`,C4,this._patch.bind(this),e=>e),new $R(`@langchain/langgraph/dist/prebuilt/index.cjs`,C4,this._patch.bind(this),e=>e)]),new q(`@langchain/langgraph/prebuilt`,C4,this._patch.bind(this),e=>e,[new $R(`@langchain/langgraph/dist/prebuilt/index.cjs`,C4,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`&&ab(e.StateGraph.prototype,n),e.createReactAgent&&typeof e.createReactAgent==`function`){let t=e.createReactAgent;Object.defineProperty(e,"createReactAgent",{value:ib(t,n),writable:!0,enumerable:!0,configurable:!0})}return e}},T4=J(Uy,e=>new w4(e)),E4=U(((e={})=>({name:Uy,setupOnce(){T4(e)}}))),D4=U(e=>(Hu()||ut(()=>{console.warn(`The launchDarklyIntegration() can only be used in the browser.`)}),{name:`LaunchDarkly`}));function O4(){return Hu()||ut(()=>{console.warn(`The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.`)}),{name:`sentry-flag-auditor`,type:`flag-used`,synchronous:!0,method:()=>null}}var k4=U(e=>(Hu()||ut(()=>{console.warn(`The openFeatureIntegration() can only be used in the browser.`)}),{name:`OpenFeature`})),A4=class{constructor(){Hu()||ut(()=>{console.warn(`The OpenFeatureIntegrationHook can only be used in the browser.`)})}after(){}error(){}},j4=U(e=>(Hu()||ut(()=>{console.warn(`The statsigIntegration() can only be used in the browser.`)}),{name:`Statsig`})),M4=U(e=>(Hu()||ut(()=>{console.warn(`The unleashIntegration() can only be used in the browser.`)}),{name:`Unleash`})),N4=eh;function P4(e,t,n){let r=new q(`@firebase/firestore`,e,e=>F4(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 $R(i,e,e=>F4(e,t,n),e=>I4(e,n)));return r}function F4(e,t,n){return I4(e,n),t(e,`addDoc`,L4()),t(e,`getDocs`,z4()),t(e,`setDoc`,B4()),t(e,`deleteDoc`,R4()),e}function I4(e,t){for(let n of[`addDoc`,`getDocs`,`setDoc`,`deleteDoc`])G(e[n])&&t(e,n);return e}function L4(){return function(e){return function(t,n){return V4(`addDoc`,t,()=>e(t,n))}}}function R4(){return function(e){return function(t){return V4(`deleteDoc`,t.parent||t,()=>e(t))}}}function z4(){return function(e){return function(t){return V4(`getDocs`,t,()=>e(t))}}}function B4(){return function(e){return function(t,n,r){return V4(`setDoc`,t.parent||t,()=>r===void 0?e(t,n):e(t,n,r))}}}function V4(e,t,n){return oo({name:`${e} ${t.path}`,op:`db.query`,kind:W.CLIENT,attributes:{[I]:`auto.firebase.otel.firestore`,[Rs]:e,...U4(t)}},n)}function H4(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(Le.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 U4(e){let t=e.firestore.app,n=t.options,r=(e.firestore.toJSON()||{}).settings||{},i={[Ns]:e.path,[Fs]:t.name,[Hs]:`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}=H4(r);return a&&(i[pl]=a),o&&(i[ml]=o),i}function W4(e,t,n){let r=new q(`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 $R(i,e,e=>K4(e,t,n,a),e=>q4(e,n)))}),r}function G4(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),so({name:`firebase.function.${e}`,op:`http.request`,kind:W.SERVER,attributes:i},async e=>{try{let n=await r.apply(this,t);return e.end(),n}catch(t){throw e.setStatus({code:2}),V(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 K4(e,t,n,r){switch(q4(e,n),r){case`function`:t(e,`onRequest`,G4(`http.request`)),t(e,`onCall`,G4(`http.call`));break;case`firestore`:t(e,`onDocumentCreated`,G4(`firestore.document.created`)),t(e,`onDocumentUpdated`,G4(`firestore.document.updated`)),t(e,`onDocumentDeleted`,G4(`firestore.document.deleted`)),t(e,`onDocumentWritten`,G4(`firestore.document.written`)),t(e,`onDocumentCreatedWithAuthContext`,G4(`firestore.document.created`)),t(e,`onDocumentUpdatedWithAuthContext`,G4(`firestore.document.updated`)),t(e,`onDocumentDeletedWithAuthContext`,G4(`firestore.document.deleted`)),t(e,`onDocumentWrittenWithAuthContext`,G4(`firestore.document.written`));break;case`scheduler`:t(e,`onSchedule`,G4(`scheduler.scheduled`));break;case`storage`:t(e,`onObjectFinalized`,G4(`storage.object.finalized`)),t(e,`onObjectArchived`,G4(`storage.object.archived`)),t(e,`onObjectDeleted`,G4(`storage.object.deleted`)),t(e,`onObjectMetadataUpdated`,G4(`storage.object.metadataUpdated`))}return e}function q4(e,t){for(let n of[`onSchedule`,`onRequest`,`onCall`,`onObjectFinalized`,`onObjectArchived`,`onObjectDeleted`,`onObjectMetadataUpdated`,`onDocumentCreated`,`onDocumentUpdated`,`onDocumentDeleted`,`onDocumentWritten`,`onDocumentCreatedWithAuthContext`,`onDocumentUpdatedWithAuthContext`,`onDocumentDeletedWithAuthContext`,`onDocumentWrittenWithAuthContext`])G(e[n])&&t(e,n);return e}var J4=[`>=3.0.0 <5`],Y4=[`>=6.0.0 <7`],X4=class extends K{constructor(e={}){super(`@sentry/instrumentation-firebase`,k,e)}init(){let e=[];return e.push(P4(J4,this._wrap,this._unwrap)),e.push(W4(Y4,this._wrap,this._unwrap)),e}},Z4=`Firebase`,Q4=J(Z4,()=>new X4),$4=U((()=>({name:Z4,setupOnce(){Q4()}})));function e3(){return[OP(),ZR(),zz(),wU(),kB(),qB(),aV(),SV(),fH(),zH(),zI(),dU(),RU(),ZU(),L0(),U0(),sB(),q2(),fB(),S4(),E4(),a4(),l4(),p4(),_4(),qH(),$4()]}function t3(){return[KN,EP,XU,JR,uU,CU,oB,LU,dB,OB,KB,iV,xV,RH,uU,Rz,dH,I0,H0,K2,x4,r4,c4,GH,Q4,f4,g4,T4]}x();var n3=1e6,r3=Symbol.for(`opentelemetry.js.api.1`);function i3(e){if(_.setGlobalTracerProvider(e))return!0;let t=globalThis,n=t[r3];if(n&&!n.trace){if(xP&&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[r3]=void 0,!_.setGlobalTracerProvider(e))return!1;let r=t[r3];if(r){let{propagation:e,context:i,...a}=n;t[r3]={...a,...r}}return!0}return!1}function a3(e,t={}){e.getOptions().debug&&MA();let[n,r]=c3(e,t);e.traceProvider=n,e.asyncLocalStorageLookup=r}function o3(e={}){let{debug:t}=e;t&&A.enable(),HM(),s3(e.integrations).forEach(e=>{e(),t&&A.log(`[Sentry] Preloaded ${e.id} instrumentation`)})}function s3(e){let t=t3();return e?t.filter(t=>{let n=t.id;return e.some(e=>n===e||n.startsWith(`${e}.`))}):t}function c3(e,t={}){if(!(e.getOptions().openTelemetryBasicTracerProvider||t.spanProcessors?.length))return l3(e);let n=new oO({sampler:new aA(e),resource:SA(`node`),forceFlushTimeoutMillis:500,spanProcessors:[new iA({timeout:u3(e.getOptions().maxSpanWaitDuration),client:e}),...t.spanProcessors||[]]});i3(n),p.setGlobalPropagator(new uk);let r=new jA;return l.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function l3(e){let t=new hA({resource:SA(`node`)});if(!i3(t))return xP&&A.warn(`Could not register SentryTracerProvider because another OpenTelemetry tracer provider is already registered.`),[void 0,void 0];lk(`SentryTracerProvider`),p.setGlobalPropagator(new uk);let n=new jA;return l.setGlobalContextManager(n),e.on(`spanEnd`,e=>{uA(e,{finalizeStatus:!0})}),Ya(e)&&e.on(`preprocessSpan`,rA),e.on(`preprocessEvent`,e=>{e.type===`transaction`&&(e.contexts={...e.contexts,otel:{resource:t.resource?.attributes,...e.contexts?.otel}})}),[t,n.getAsyncLocalStorageLookup()]}function u3(e){if(e!=null){if(e>n3)return xP&&A.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${n3}`),n3;if(e<=0||Number.isNaN(e)){xP&&A.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return e}}function d3(){return UM().filter(e=>e.name!==`Http`&&e.name!==`NodeFetch`).concat(qN(),JN())}function f3(e){return[...d3(),...sa(e)?e3():[]]}function p3(e,t){if(EV()&&sa(t)){let t=DV();if(t){let n=new Set(t.replacedOtelIntegrationNames);return[...e.filter(e=>!n.has(e.name)),...t.integrations]}}return e}function m3(e={}){return h3(e,f3)}function h3(e={},t){Tf(e,`node`);let n=EV()&&sa(e)?DV():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=WM({...e,defaultIntegrations:r});return i&&!e.skipOpenTelemetrySetup&&(a3(i,{spanProcessors:e.openTelemetrySpanProcessors}),KM()),n&&n.detect(),i}function g3(e={}){return h3(e,()=>[])}var _3=[...xW,...wW,...DW,...jW,...PW,...HW,...GW,...YW,...QW,...tG,...iG,...sG,...gG,...yG,...DG,...PG,...LG,...VG,...KG,...XG,...$G,...rK,...oK,...lK,...fK,...hK,...vK,...wK,...DK];[...CW,...EW,...kW,...NW,...IW,...WW,...qW,...ZW,...eG,...rG,...oG,...lG,...vG,...xG,...AG,...IG,...zG,...UG,...YG,...QG,...tK,...aK,...cK,...dK,...mK,..._K,...bK,...EK,...AK];function v3(e=[]){return[...Mf([..._3,...e].map(e=>e.module.name)),`@remix-run/node`]}v3();function y3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var b3=x3;function x3(e,t){let[n]=k3(e,``);for(let e of w3(t))if(S3(e,n))return!0;return!1}function S3(e,t){for(let[n,r]of e)if(!A3(t,r,n))return!1;return!0}function C3(e){return e===`latest`&&(e=`>=0`),e.match(/^([^\d+]*)(\d.*)$/)||[null,``,`*.*.*`]}function w3(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=C3(i),o=a[1]||`=`;o.endsWith(`v`)&&(o=o.slice(0,-1));let[s,c]=k3(a[2],o);if(e+2<r.length&&r[e+1]===`-`){let t=C3(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?T3(s,0):T3(s,1)])}else if(c[0]===`^`){let e=s[0]===0?s[1]===0?2:1:0;n.push([`>=`,s]),n.push([`<`,e===0?T3(s,0):e===1?T3(s,1):T3(s,2)])}else n.push([c.replace(`~`,``).replace(`^`,``),s])}return n.length&&t.push(n),t}function T3(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 E3(e){return e===`x`||e===`X`||e===`*`||e===`latest`?-1:Number(e)}function D3(e){return/^\d+$/.test(e)?Number(e):e}function O3(e,t,n){return n===-1?e!==`<`:e===`=`?t===n:e===`>`?t>n:e===`>=`?t>=n:e===`<`?t<n:e===`<=`&&t<=n}function k3(e,t){e=e.split(`+`)[0];let[n,r]=e.split(`-`),i=n.split(`.`).map(E3).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(D3)),t]:[i.slice(0,3),t]}function A3(e,t,n){if(!O3(`=`,e[0],t[0]))return O3(n,e[0],t[0]);if(!O3(`=`,e[1],t[1]))return O3(n,e[1],t[1]);if(!O3(`=`,e[2],t[2])||e.length===3&&t.length===3)return O3(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(O3(n,e[r]||``,t[r]||``))return!0;return!1}function j3(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 M3(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)||F3(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 N3(e){return(function(e){if(Array.isArray(e))return j3(e)})(e)||(function(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)})(e)||F3(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 P3(e){return(P3=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 F3(e,t){if(e){if(typeof e==`string`)return j3(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)?j3(e,t):void 0}}function I3(e,t){return e(t={exports:{}},t.exports),t.exports}var L3=I3((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)})),R3=I3((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),S=We(`:nth-last-child(`,!1),Be=We(`:`,!1),C=0,Ve=[{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=Ve[e];if(r)return r;for(n=e-1;!Ve[n];)n--;for(r={line:(r=Ve[n]).line,column:r.column};n<e;)t.charCodeAt(n)===10?(r.line++,r.column=1):r.column++,n++;return Ve[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){C<He||(C>He&&(He=C,Ue=[]),Ue.push(e))}function Je(){var e,t,n,r,i=36*C+0,a=w[i];return a?(C=a.nextPos,a.result):(e=C,(t=E())!==s&&(n=Ze())!==s&&E()!==s?e=t=(r=n).length===1?r[0]:{type:`matches`,selectors:r}:(C=e,e=s),e===s&&(e=C,(t=E())!==s&&(t=void 0),e=t),w[i]={nextPos:C,result:e},e)}function E(){var e,n,r=36*C+1,i=w[r];if(i)return C=i.nextPos,i.result;for(e=[],t.charCodeAt(C)===32?(n=` `,C++):(n=s,T(u));n!==s;)e.push(n),t.charCodeAt(C)===32?(n=` `,C++):(n=s,T(u));return w[r]={nextPos:C,result:e},e}function Ye(){var e,n,r,i=36*C+2,a=w[i];if(a)return C=a.nextPos,a.result;if(n=[],d.test(t.charAt(C))?(r=t.charAt(C),C++):(r=s,T(f)),r!==s)for(;r!==s;)n.push(r),d.test(t.charAt(C))?(r=t.charAt(C),C++):(r=s,T(f));else n=s;return n!==s&&(n=n.join(``)),e=n,w[i]={nextPos:C,result:e},e}function Xe(){var e,n,r,i=36*C+3,a=w[i];return a?(C=a.nextPos,a.result):(e=C,(n=E())===s?(C=e,e=s):(t.charCodeAt(C)===62?(r=`>`,C++):(r=s,T(p)),r!==s&&E()!==s?e=n=`child`:(C=e,e=s)),e===s&&(e=C,(n=E())===s?(C=e,e=s):(t.charCodeAt(C)===126?(r=`~`,C++):(r=s,T(m)),r!==s&&E()!==s?e=n=`sibling`:(C=e,e=s)),e===s&&(e=C,(n=E())===s?(C=e,e=s):(t.charCodeAt(C)===43?(r=`+`,C++):(r=s,T(h)),r!==s&&E()!==s?e=n=`adjacent`:(C=e,e=s)),e===s&&(e=C,t.charCodeAt(C)===32?(n=` `,C++):(n=s,T(u)),n!==s&&(r=E())!==s?e=n=`descendant`:(C=e,e=s)))),w[i]={nextPos:C,result:e},e)}function Ze(){var e,n,r,i,a,o,c,l,u=36*C+5,d=w[u];if(d)return C=d.nextPos,d.result;if(e=C,(n=$e())!==s){for(r=[],i=C,(a=E())===s?(C=i,i=s):(t.charCodeAt(C)===44?(o=`,`,C++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=$e())!==s?i=a=[a,o,c,l]:(C=i,i=s));i!==s;)r.push(i),i=C,(a=E())===s?(C=i,i=s):(t.charCodeAt(C)===44?(o=`,`,C++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=$e())!==s?i=a=[a,o,c,l]:(C=i,i=s));r===s?(C=e,e=s):e=n=_(n,r)}else C=e,e=s;return w[u]={nextPos:C,result:e},e}function Qe(){var e,t,n,r,i,a=36*C+6,o=w[a];return o?(C=o.nextPos,o.result):(e=C,(t=Xe())===s&&(t=null),t!==s&&(n=$e())!==s?(i=n,e=t=(r=t)?{type:r,left:{type:`exactNode`},right:i}:i):(C=e,e=s),w[a]={nextPos:C,result:e},e)}function $e(){var e,t,n,r,i,a,o,c=36*C+7,l=w[c];if(l)return C=l.nextPos,l.result;if(e=C,(t=et())!==s){for(n=[],r=C,(i=Xe())!==s&&(a=et())!==s?r=i=[i,a]:(C=r,r=s);r!==s;)n.push(r),r=C,(i=Xe())!==s&&(a=et())!==s?r=i=[i,a]:(C=r,r=s);n===s?(C=e,e=s):(o=t,e=t=n.reduce((function(e,t){return{type:t[0],left:e,right:t[1]}}),o))}else C=e,e=s;return w[c]={nextPos:C,result:e},e}function et(){var e,n,r,i,a,o,c,l=36*C+8,u=w[l];if(u)return C=u.nextPos,u.result;if(e=C,t.charCodeAt(C)===33?(n=`!`,C++):(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?(C=e,e=s):(a=n,c=(o=r).length===1?o[0]:{type:`compound`,selectors:o},a&&(c.subject=!0),e=n=c)}else C=e,e=s;return w[l]={nextPos:C,result:e},e}function tt(){var e,n=36*C+9,r=w[n];return r?(C=r.nextPos,r.result):((e=(function(){var e,n,r=36*C+10,i=w[r];return i?(C=i.nextPos,i.result):(t.charCodeAt(C)===42?(n=`*`,C++):(n=s,T(y)),n!==s&&(n={type:`wildcard`,value:n}),e=n,w[r]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r,i=36*C+11,a=w[i];return a?(C=a.nextPos,a.result):(e=C,t.charCodeAt(C)===35?(n=`#`,C++):(n=s,T(ee)),n===s&&(n=null),n!==s&&(r=Ye())!==s?e=n={type:`identifier`,value:r}:(C=e,e=s),w[i]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*C+12,o=w[a];return o?(C=o.nextPos,o.result):(e=C,t.charCodeAt(C)===91?(n=`[`,C++):(n=s,T(b)),n!==s&&E()!==s&&(r=(function(){var e,n,r,i,a=36*C+16,o=w[a];return o?(C=o.nextPos,o.result):(e=C,(n=nt())!==s&&E()!==s&&(r=(function(){var e,n,r,i=36*C+14,a=w[i];return a?(C=a.nextPos,a.result):(e=C,t.charCodeAt(C)===33?(n=`!`,C++):(n=s,T(v)),n===s&&(n=null),n===s?(C=e,e=s):(t.charCodeAt(C)===61?(r=`=`,C++):(r=s,T(re)),r===s?(C=e,e=s):(n=ie(n),e=n)),w[i]={nextPos:C,result:e},e)})())!==s&&E()!==s?((i=(function(){var e,n,r,i,a,o=36*C+20,c=w[o];if(c)return C=c.nextPos,c.result;if(e=C,t.substr(C,5)===`type(`?(n=`type(`,C+=5):(n=s,T(xe)),n!==s){if(E()!==s){if(r=[],Se.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(Ce)),i!==s)for(;i!==s;)r.push(i),Se.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(Ce));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(C)===41?(a=`)`,C++):(a=s,T(we)),a===s?(C=e,e=s):(n={type:`type`,value:r.join(``)},e=n)):(C=e,e=s)}else C=e,e=s}else C=e,e=s;return w[o]={nextPos:C,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c=36*C+22,l=w[c];if(l)return C=l.nextPos,l.result;if(e=C,t.charCodeAt(C)===47?(n=`/`,C++):(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?(C=e,e=s):(t.charCodeAt(C)===47?(i=`/`,C++):(i=s,T(De)),i===s?(C=e,e=s):((a=(function(){var e,n,r=36*C+21,i=w[r];if(i)return C=i.nextPos,i.result;if(e=[],Te.test(t.charAt(C))?(n=t.charAt(C),C++):(n=s,T(Ee)),n!==s)for(;n!==s;)e.push(n),Te.test(t.charAt(C))?(n=t.charAt(C),C++):(n=s,T(Ee));else e=s;return w[r]={nextPos:C,result:e},e})())===s&&(a=null),a===s?(C=e,e=s):(o=a,n={type:`regexp`,value:new RegExp(r.join(``),o?o.join(``):``)},e=n)))}else C=e,e=s;return w[c]={nextPos:C,result:e},e})()),i===s?(C=e,e=s):(n=ce(n,r,i),e=n)):(C=e,e=s),e===s&&(e=C,(n=nt())!==s&&E()!==s&&(r=(function(){var e,n,r,i=36*C+13,a=w[i];return a?(C=a.nextPos,a.result):(e=C,x.test(t.charAt(C))?(n=t.charAt(C),C++):(n=s,T(ne)),n===s&&(n=null),n===s?(C=e,e=s):(t.charCodeAt(C)===61?(r=`=`,C++):(r=s,T(re)),r===s?(C=e,e=s):(n=ie(n),e=n)),e===s&&(ae.test(t.charAt(C))?(e=t.charAt(C),C++):(e=s,T(oe))),w[i]={nextPos:C,result:e},e)})())!==s&&E()!==s?((i=(function(){var e,n,r,i,a,o,c=36*C+17,l=w[c];if(l)return C=l.nextPos,l.result;if(e=C,t.charCodeAt(C)===34?(n=`"`,C++):(n=s,T(le)),n!==s){for(r=[],ue.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(de)),i===s&&(i=C,t.charCodeAt(C)===92?(a=`\\`,C++):(a=s,T(fe)),a===s?(C=i,i=s):(t.length>C?(o=t.charAt(C),C++):(o=s,T(pe)),o===s?(C=i,i=s):(a=me(a,o),i=a)));i!==s;)r.push(i),ue.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(de)),i===s&&(i=C,t.charCodeAt(C)===92?(a=`\\`,C++):(a=s,T(fe)),a===s?(C=i,i=s):(t.length>C?(o=t.charAt(C),C++):(o=s,T(pe)),o===s?(C=i,i=s):(a=me(a,o),i=a)));r===s?(C=e,e=s):(t.charCodeAt(C)===34?(i=`"`,C++):(i=s,T(le)),i===s?(C=e,e=s):(n=he(r),e=n))}else C=e,e=s;if(e===s){if(e=C,t.charCodeAt(C)===39?(n=`'`,C++):(n=s,T(ge)),n!==s){for(r=[],_e.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(ve)),i===s&&(i=C,t.charCodeAt(C)===92?(a=`\\`,C++):(a=s,T(fe)),a===s?(C=i,i=s):(t.length>C?(o=t.charAt(C),C++):(o=s,T(pe)),o===s?(C=i,i=s):(a=me(a,o),i=a)));i!==s;)r.push(i),_e.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(ve)),i===s&&(i=C,t.charCodeAt(C)===92?(a=`\\`,C++):(a=s,T(fe)),a===s?(C=i,i=s):(t.length>C?(o=t.charAt(C),C++):(o=s,T(pe)),o===s?(C=i,i=s):(a=me(a,o),i=a)));r===s?(C=e,e=s):(t.charCodeAt(C)===39?(i=`'`,C++):(i=s,T(ge)),i===s?(C=e,e=s):(n=he(r),e=n))}else C=e,e=s}return w[c]={nextPos:C,result:e},e})())===s&&(i=(function(){var e,n,r,i,a,o,c,l=36*C+18,u=w[l];if(u)return C=u.nextPos,u.result;for(e=C,n=C,r=[],ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be));i!==s;)r.push(i),ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be));if(r===s?(C=n,n=s):(t.charCodeAt(C)===46?(i=`.`,C++):(i=s,T(se)),i===s?(C=n,n=s):n=r=[r,i]),n===s&&(n=null),n!==s){if(r=[],ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be));else r=s;r===s?(C=e,e=s):(o=r,c=(a=n)?[].concat.apply([],a).join(``):``,n={type:`literal`,value:parseFloat(c+o.join(``))},e=n)}else C=e,e=s;return w[l]={nextPos:C,result:e},e})())===s&&(i=(function(){var e,t,n=36*C+19,r=w[n];return r?(C=r.nextPos,r.result):((t=Ye())!==s&&(t={type:`literal`,value:t}),e=t,w[n]={nextPos:C,result:e},e)})()),i===s?(C=e,e=s):(n=ce(n,r,i),e=n)):(C=e,e=s),e===s&&(e=C,(n=nt())!==s&&(n={type:`attribute`,name:n}),e=n)),w[a]={nextPos:C,result:e},e)})())!==s&&E()!==s?(t.charCodeAt(C)===93?(i=`]`,C++):(i=s,T(te)),i===s?(C=e,e=s):e=n=r):(C=e,e=s),w[a]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o,c,l,u=36*C+26,d=w[u];if(d)return C=d.nextPos,d.result;if(e=C,t.charCodeAt(C)===46?(n=`.`,C++):(n=s,T(se)),n!==s){if((r=Ye())!==s){for(i=[],a=C,t.charCodeAt(C)===46?(o=`.`,C++):(o=s,T(se)),o!==s&&(c=Ye())!==s?a=o=[o,c]:(C=a,a=s);a!==s;)i.push(a),a=C,t.charCodeAt(C)===46?(o=`.`,C++):(o=s,T(se)),o!==s&&(c=Ye())!==s?a=o=[o,c]:(C=a,a=s);i===s?(C=e,e=s):(l=r,n={type:`field`,name:i.reduce((function(e,t){return e+t[0]+t[1]}),l)},e=n)}else C=e,e=s}else C=e,e=s;return w[u]={nextPos:C,result:e},e})())===s&&(e=(function(){var e,n,r,i,a=36*C+27,o=w[a];return o?(C=o.nextPos,o.result):(e=C,t.substr(C,5)===`:not(`?(n=`:not(`,C+=5):(n=s,T(Me)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(C)===41?(i=`)`,C++):(i=s,T(we)),i===s?(C=e,e=s):e=n={type:`not`,selectors:r}):(C=e,e=s),w[a]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*C+28,o=w[a];return o?(C=o.nextPos,o.result):(e=C,t.substr(C,9)===`:matches(`?(n=`:matches(`,C+=9):(n=s,T(Ne)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(C)===41?(i=`)`,C++):(i=s,T(we)),i===s?(C=e,e=s):(n=Pe(r),e=n)):(C=e,e=s),w[a]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*C+29,o=w[a];return o?(C=o.nextPos,o.result):(e=C,t.substr(C,4)===`:is(`?(n=`:is(`,C+=4):(n=s,T(Fe)),n!==s&&E()!==s&&(r=Ze())!==s&&E()!==s?(t.charCodeAt(C)===41?(i=`)`,C++):(i=s,T(we)),i===s?(C=e,e=s):(n=Pe(r),e=n)):(C=e,e=s),w[a]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a=36*C+30,o=w[a];return o?(C=o.nextPos,o.result):(e=C,t.substr(C,5)===`:has(`?(n=`:has(`,C+=5):(n=s,T(Ie)),n!==s&&E()!==s&&(r=(function(){var e,n,r,i,a,o,c,l,u=36*C+4,d=w[u];if(d)return C=d.nextPos,d.result;if(e=C,(n=Qe())!==s){for(r=[],i=C,(a=E())===s?(C=i,i=s):(t.charCodeAt(C)===44?(o=`,`,C++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=Qe())!==s?i=a=[a,o,c,l]:(C=i,i=s));i!==s;)r.push(i),i=C,(a=E())===s?(C=i,i=s):(t.charCodeAt(C)===44?(o=`,`,C++):(o=s,T(g)),o!==s&&(c=E())!==s&&(l=Qe())!==s?i=a=[a,o,c,l]:(C=i,i=s));r===s?(C=e,e=s):e=n=_(n,r)}else C=e,e=s;return w[u]={nextPos:C,result:e},e})())!==s&&E()!==s?(t.charCodeAt(C)===41?(i=`)`,C++):(i=s,T(we)),i===s?(C=e,e=s):e=n={type:`has`,selectors:r}):(C=e,e=s),w[a]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r=36*C+31,i=w[r];return i?(C=i.nextPos,i.result):(t.substr(C,12)===`:first-child`?(n=`:first-child`,C+=12):(n=s,T(Le)),n!==s&&(n=k(1)),e=n,w[r]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r=36*C+32,i=w[r];return i?(C=i.nextPos,i.result):(t.substr(C,11)===`:last-child`?(n=`:last-child`,C+=11):(n=s,T(Re)),n!==s&&(n=it(1)),e=n,w[r]={nextPos:C,result:e},e)})())===s&&(e=(function(){var e,n,r,i,a,o=36*C+33,c=w[o];if(c)return C=c.nextPos,c.result;if(e=C,t.substr(C,11)===`:nth-child(`?(n=`:nth-child(`,C+=11):(n=s,T(ze)),n!==s){if(E()!==s){if(r=[],ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(C)===41?(a=`)`,C++):(a=s,T(we)),a===s?(C=e,e=s):(n=k(parseInt(r.join(``),10)),e=n)):(C=e,e=s)}else C=e,e=s}else C=e,e=s;return w[o]={nextPos:C,result:e},e})())===s&&(e=(function(){var e,n,r,i,a,o=36*C+34,c=w[o];if(c)return C=c.nextPos,c.result;if(e=C,t.substr(C,16)===`:nth-last-child(`?(n=`:nth-last-child(`,C+=16):(n=s,T(S)),n!==s){if(E()!==s){if(r=[],ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be)),i!==s)for(;i!==s;)r.push(i),ye.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(be));else r=s;r!==s&&(i=E())!==s?(t.charCodeAt(C)===41?(a=`)`,C++):(a=s,T(we)),a===s?(C=e,e=s):(n=it(parseInt(r.join(``),10)),e=n)):(C=e,e=s)}else C=e,e=s}else C=e,e=s;return w[o]={nextPos:C,result:e},e})())===s&&(e=(function(){var e,n,r,i=36*C+35,a=w[i];return a?(C=a.nextPos,a.result):(e=C,t.charCodeAt(C)===58?(n=`:`,C++):(n=s,T(Be)),n!==s&&(r=Ye())!==s?e=n={type:`class`,name:r}:(C=e,e=s),w[i]={nextPos:C,result:e},e)})()),w[n]={nextPos:C,result:e},e)}function nt(){var e,n,r,i,a,o,c,l,u=36*C+15,d=w[u];if(d)return C=d.nextPos,d.result;if(e=C,(n=Ye())!==s){for(r=[],i=C,t.charCodeAt(C)===46?(a=`.`,C++):(a=s,T(se)),a!==s&&(o=Ye())!==s?i=a=[a,o]:(C=i,i=s);i!==s;)r.push(i),i=C,t.charCodeAt(C)===46?(a=`.`,C++):(a=s,T(se)),a!==s&&(o=Ye())!==s?i=a=[a,o]:(C=i,i=s);r===s?(C=e,e=s):(c=n,l=r,e=n=[].concat.apply([c],l).join(``))}else C=e,e=s;return w[u]={nextPos:C,result:e},e}function rt(){var e,n,r,i,a=36*C+23,o=w[a];if(o)return C=o.nextPos,o.result;if(e=C,t.charCodeAt(C)===91?(n=`[`,C++):(n=s,T(b)),n!==s){if(r=[],Oe.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(ke)),i===s&&(i=D()),i!==s)for(;i!==s;)r.push(i),Oe.test(t.charAt(C))?(i=t.charAt(C),C++):(i=s,T(ke)),i===s&&(i=D());else r=s;r===s?(C=e,e=s):(t.charCodeAt(C)===93?(i=`]`,C++):(i=s,T(te)),i===s?(C=e,e=s):e=n=`[`+r.join(``)+`]`)}else C=e,e=s;return w[a]={nextPos:C,result:e},e}function D(){var e,n,r,i=36*C+24,a=w[i];return a?(C=a.nextPos,a.result):(e=C,t.charCodeAt(C)===92?(n=`\\`,C++):(n=s,T(fe)),n===s?(C=e,e=s):(t.length>C?(r=t.charAt(C),C++):(r=s,T(pe)),r===s?(C=e,e=s):e=n=`\\`+r),w[i]={nextPos:C,result:e},e)}function O(){var e,n,r,i=36*C+25,a=w[i];if(a)return C=a.nextPos,a.result;if(n=[],Ae.test(t.charAt(C))?(r=t.charAt(C),C++):(r=s,T(je)),r!==s)for(;r!==s;)n.push(r),Ae.test(t.charAt(C))?(r=t.charAt(C),C++):(r=s,T(je));else n=s;return n!==s&&(n=n.join(``)),e=n,w[i]={nextPos:C,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&&C===t.length)return r;throw r!==s&&C<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 z3(e,t){for(var n=0;n<t.length;++n){if(e==null)return e;e=e[t[n]]}return e}var B3=typeof WeakMap==`function`?new WeakMap:null;function V3(e){if(e==null)return function(){return!0};if(B3!=null){var t=B3.get(e);return t??(t=H3(e),B3.set(e,t)),t}return H3(e)}function H3(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(V3);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(V3);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(V3);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(V3);return function(e,t,n){var r=!1,i=[];return L3.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=V3(e.left),c=V3(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=V3(e.left),u=V3(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 z3(e,d)!=null};case`=`:switch(e.value.type){case`regexp`:return function(t){var n=z3(t,d);return typeof n==`string`&&e.value.value.test(n)};case`literal`:var f=`${e.value.value}`;return function(e){return f===`${z3(e,d)}`};case`type`:return function(t){return e.value.value===P3(z3(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(z3(t,d))};case`literal`:var p=`${e.value.value}`;return function(e){return p!==`${z3(e,d)}`};case`type`:return function(t){return e.value.value!==P3(z3(t,d))}}throw Error(`Unknown selector value type: ${e.value.type}`);case`<=`:return function(t){return z3(t,d)<=e.value.value};case`<`:return function(t){return z3(t,d)<e.value.value};case`>`:return function(t){return z3(t,d)>e.value.value};case`>=`:return function(t){return z3(t,d)>=e.value.value}}throw Error(`Unknown operator: ${e.operator}`);case`sibling`:var m=V3(e.left),h=V3(e.right);return function(t,n,r){return h(t,n,r)&&G3(t,m,n,`LEFT_SIDE`,r)||e.left.subject&&m(t,n,r)&&G3(t,h,n,`RIGHT_SIDE`,r)};case`adjacent`:var g=V3(e.left),_=V3(e.right);return function(t,n,r){return _(t,n,r)&&K3(t,g,n,`LEFT_SIDE`,r)||e.right.subject&&g(t,n,r)&&K3(t,_,n,`RIGHT_SIDE`,r)};case`nth-child`:var v=e.index.value,y=V3(e.right);return function(e,t,n){return y(e,t,n)&&q3(e,t,v,n)};case`nth-last-child`:var ee=-e.index.value,b=V3(e.right);return function(e,t,n){return b(e,t,n)&&q3(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 U3(e,t){var n=t&&t.nodeTypeKey||`type`,r=e[n];return t&&t.visitorKeys&&t.visitorKeys[r]?t.visitorKeys[r]:L3.VisitorKeys[r]?L3.VisitorKeys[r]:t&&typeof t.fallback==`function`?t.fallback(e):Object.keys(e).filter((function(e){return e!==n}))}function W3(e,t){var n=t&&t.nodeTypeKey||`type`;return e!==null&&P3(e)===`object`&&typeof e[n]==`string`}function G3(e,t,n,r,i){var a=M3(n,1)[0];if(!a)return!1;for(var o=U3(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(W3(c[f],i)&&t(c[f],n,i))return!0}}return!1}function K3(e,t,n,r,i){var a=M3(n,1)[0];if(!a)return!1;for(var o=U3(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&&W3(c[l-1],i)&&t(c[l-1],n,i)||r===`RIGHT_SIDE`&&l<c.length-1&&W3(c[l+1],i)&&t(c[l+1],n,i))return!0}}return!1}function q3(e,t,n,r){if(n===0)return!1;var i=M3(t,1)[0];if(!i)return!1;for(var a=U3(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 J3(e,t,n,r){if(t){var i=[],a=V3(t),o=(function e(t,n){if(t==null||P3(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,N3(e(s,o===`left`?s:n)))}return r})(t).map(V3);L3.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 Y3(e,t,n){var r=[];return J3(e,t,(function(e){r.push(e)}),n),r}function X3(e){return R3.parse(e)}function Z3(e,t,n){return Y3(e,X3(t),n)}Z3.parse=X3,Z3.match=Y3,Z3.traverse=J3,Z3.matches=function(e,t,n,r){return!t||!!e&&(n||=[],V3(t)(e,n,r))},Z3.query=Z3;var Q3={},$3={},e6={exports:{}},t6=Z3,{parse:n6}=Q3,r6=e=>e.declarations?.[0]?.id?.properties?.[0]?.value?.name===`tr_ch_apm_tracingChannel`,i6=/[^\w]/g,a6=e=>`tr_ch_apm$${e.replace(i6,`_`)}`,o6=e6.exports={tracingChannelImport({dcModule:e,moduleType:t},n){if(n.body.some(r6))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,n6(a,r).body[0],n6(`const { tracingChannel: tr_ch_apm_tracingChannel } = tr_ch_apm_dc`,r).body[0],n6(`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=a6(n);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;o6.tracingChannelImport(e,t);let a=t.body.findIndex(r6),o=`
39
+ const ${i} = tr_ch_apm_tracingChannel("orchestrion:${r}:${n}")
40
+ `;t.body.splice(a+1,0,n6(o).body[0])},traceCallback:c6,tracePromise:c6,traceSync:c6,traceAuto:c6};function s6(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 c6(e,t,n,r){let i=r[r.length-1];t.type===`ClassDeclaration`||t.type===`ClassExpression`?u6(e,t,i):l6(e,t,i)}function l6(e,t,n){o6.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=d6(e,{type:c,params:l,body:t.body,async:t.async,expression:!1,generator:t.generator},n),t.params=s6(l),t.generator=!1,t.async=!1,f6(e,t)}function u6(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`);o6.tracingChannelDeclaration(e,n),s||(s=n6(t.superClass?`class A extends Object { constructor (...args) { super(...args) } }`:`class A { constructor () {} }`).body[0].body.body[0],o.body.unshift(s));let c=n6(`
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=d6(e,{type:`Identifier`,name:`__apm$${a}`},n),f6(e,l),s.value.body.body.push(...c)}function d6(e,t,n){let{operator:r,moduleVersion:i}=e,{returnKind:a}=e.functionQuery,o=a?v6(e,a,n):``,s;r===`traceCallback`&&(s=m6(e,t,o)),r===`tracePromise`&&(s=h6(e,t,o)),r===`traceSync`&&(s=g6(e,t,o)),r===`traceAuto`&&(s=p6(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=n6(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),t6.query(l,`[id.name=__apm$wrapped]`)[0].init=t,l}function f6(e,t){let n=new Set;t6.traverse(t.body,t6.parse(`[object.type=Super]`),(e,t)=>{let{name:r}=e.property,i;if(t.callee){let{expression:e}=n6(`__apm$super['${r}'].call(this)`).body[0];t.callee=i=e.callee,t.arguments.unshift(...e.arguments)}else t.expression=i=n6(`__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=n6(`
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(n6(`const __apm$super = {}`).body[0])}function p6(e,t,n=``){let r=m6(e,t,n),i=h6(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 m6(e,t,n=``){let{channelName:r,functionQuery:{callbackIndex:i=-1}}=e,a=a6(r);return n6(`
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 h6(e,t,n=``){let{channelName:r}=e,i=a6(r);return n6(`
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 g6(e,t,n=``){let{channelName:r}=e,i=a6(r);return n6(`
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 _6(e,t){let{channelName:n,module:{name:r}}=e,i=a6(n+`:next`);if(t.body.some(e=>e.declarations?.[0]?.id?.name===i))return;let a=a6(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,n6(s).body[0])}function v6(e,t,n){let{channelName:r}=e,i=t===`Iterator`?`traceSync`:`tracePromise`,a=a6(r+`:next`);return _6(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 y6=e6.exports,b6={},x6=e=>{throw TypeError(e)},S6=(e,t,n)=>t.has(e)||x6(`Cannot `+n),C6=(e,t,n)=>(S6(e,t,`read from private field`),n?n.call(e):t.get(e)),w6=(e,t,n)=>t.has(e)?x6(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),T6=(e,t,n,r)=>(S6(e,t,`write to private field`),t.set(e,n),n),E6=(e,t,n)=>(S6(e,t,`access private method`),n),D6,O6,k6,A6,j6,M6,N6,P6,F6,I6,L6,R6,z6=Z3,{parse:B6}=Q3,{generate:V6}=$3,H6=y6,U6,W6,G6=class{constructor(e,t,n,r,i,a={}){w6(this,N6),w6(this,D6,null),w6(this,O6,null),w6(this,k6,null),w6(this,A6,[]),w6(this,j6,null),w6(this,M6,{}),T6(this,D6,e),T6(this,O6,t),T6(this,k6,n),T6(this,A6,r),T6(this,j6,i),T6(this,M6,a)}free(){}get moduleName(){return C6(this,D6)}get filePath(){return C6(this,k6)}transform(e,t,n){if(Buffer.isBuffer(e)&&(e=e.toString()),!e)return{code:e};let r,i={},a=0;for(let n of C6(this,A6)){let{astQuery:o,functionQuery:s={}}=n;if(!r){let n={loc:!0,ranges:!0,raw:!0,module:t===`esm`};try{r=B6(e,n)}catch{r=B6(e,{...n,module:!n.module})}t===`esm`&&(i=E6(this,N6,I6).call(this,r))}let c=E6(this,N6,L6).call(this,s,i),l=o||E6(this,N6,R6).call(this,c),u={...n,dcModule:C6(this,j6),moduleType:t,moduleVersion:C6(this,O6),functionQuery:c};u.operator=E6(this,N6,F6).call(this,u),z6.traverse(r,z6.parse(l),(...e)=>{a++,E6(this,N6,P6).call(this,u,...e)})}if(a===0&&C6(this,A6).length>0){let e=C6(this,A6).map(({astQuery:e,functionQuery:t={}})=>{if(e)return e;let n=E6(this,N6,L6).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){U6??=b6.SourceMapConsumer,W6??=b6.SourceMapGenerator;let e=`${C6(this,D6)}/${C6(this,k6)}`,t;if(n){let r=new U6(n);r.file=e,t=W6.fromSourceMap(r)}else t=new W6({file:e});return{code:V6(r,{sourceMap:t}),map:t.toString()}}return{code:e}}};D6=new WeakMap,O6=new WeakMap,k6=new WeakMap,A6=new WeakMap,j6=new WeakMap,M6=new WeakMap,N6=new WeakSet,P6=function(e,...t){let n=C6(this,M6)[e.operator]??H6[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)},F6=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`}},I6=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},L6=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},R6=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 K6={Transformer:G6},q6=e=>{throw TypeError(e)},J6=(e,t,n)=>t.has(e)||q6(`Cannot `+n),Y6=(e,t,n)=>(J6(e,t,`read from private field`),n?n.call(e):t.get(e)),X6=(e,t,n)=>t.has(e)?q6(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Z6=(e,t,n,r)=>(J6(e,t,`write to private field`),t.set(e,n),n),Q6,$6,e8,t8,n8=b3,{Transformer:r8}=K6,i8=class{constructor(e,t){X6(this,Q6,[]),X6(this,$6,null),X6(this,e8,{}),X6(this,t8,{}),Z6(this,Q6,e),Z6(this,$6,t||`diagnostics_channel`)}free(){Z6(this,e8,{})}addTransform(e,t){Y6(this,t8)[e]=t}getTransformer(e,t,n){n=n.replace(/\\/g,`/`);let r=`${e}/${n}@${t}`;if(Y6(this,e8)[r])return Y6(this,e8)[r];let i=Y6(this,Q6).filter(({module:r})=>r.name===e&&(typeof r.filePath==`string`?r.filePath===n:r.filePath.test(n))&&n8(t,r.versionRange));if(i.length!==0)return Y6(this,e8)[r]=new r8(e,t,n,i,Y6(this,$6),Y6(this,t8)),Y6(this,e8)[r]}};Q6=new WeakMap,$6=new WeakMap,e8=new WeakMap,t8=new WeakMap;var{InstrumentationMatcher:a8}={InstrumentationMatcher:i8};function o8(e,t){return new a8(e,t)}var s8={create:o8},c8=me.sep,l8=function(e){var t=e.split(c8),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]+c8;for(var l=``,u=t.length-1,d=n+a;d<=u;d++)l+=d===u?t[d]:t[d]+c8;return{name:i,basedir:o,path:l}}},u8=y3(l8),{readFileSync:d8}=ve,{join:f8}=me,p8=new Map;function m8(e){if(p8.has(e))return p8.get(e);try{let t=d8(f8(e,`package.json`)),{version:n}=JSON.parse(t);return p8.set(e,n),n}catch{return process.version.slice(1)}}var h8=m8,g8=y3(h8),_8;function v8(e){_8=e}function y8(e){_8&&_8(e)}var b8={setDiagnosticsHook:v8,emitDiagnostics:y8},x8={exports:{}},S8=(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)},C8=T,w8=E,T8=S8,{env:E8}=process,D8;T8(`no-color`)||T8(`no-colors`)||T8(`color=false`)||T8(`color=never`)?D8=0:(T8(`color`)||T8(`colors`)||T8(`color=true`)||T8(`color=always`))&&(D8=1),`FORCE_COLOR`in E8&&(D8=E8.FORCE_COLOR===`true`?1:E8.FORCE_COLOR===`false`?0:E8.FORCE_COLOR.length===0?1:Math.min(parseInt(E8.FORCE_COLOR,10),3));function O8(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function k8(e,t){if(D8===0)return 0;if(T8(`color=16m`)||T8(`color=full`)||T8(`color=truecolor`))return 3;if(T8(`color=256`))return 2;if(e&&!t&&D8===void 0)return 0;let n=D8||0;if(E8.TERM===`dumb`)return n;if(process.platform===`win32`){let e=C8.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in E8)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in E8)||E8.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in E8)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(E8.TEAMCITY_VERSION);if(E8.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in E8){let e=parseInt((E8.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(E8.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(E8.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(E8.TERM)||`COLORTERM`in E8?1:n}function A8(e){return O8(k8(e,e&&e.isTTY))}var j8={supportsColor:A8,stdout:O8(k8(!0,w8.isatty(1))),stderr:O8(k8(!0,w8.isatty(2)))},M8=1e3,N8=M8*60,P8=N8*60,F8=P8*24,I8=F8*7,L8=F8*365.25,R8=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return z8(e);if(n===`number`&&isFinite(e))return t.long?V8(e):B8(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function z8(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*L8;case`weeks`:case`week`:case`w`:return n*I8;case`days`:case`day`:case`d`:return n*F8;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return n*P8;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return n*N8;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return n*M8;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return n;default:return}}}}function B8(e){var t=Math.abs(e);return t>=F8?Math.round(e/F8)+`d`:t>=P8?Math.round(e/P8)+`h`:t>=N8?Math.round(e/N8)+`m`:t>=M8?Math.round(e/M8)+`s`:e+`ms`}function V8(e){var t=Math.abs(e);return t>=F8?H8(e,t,F8,`day`):t>=P8?H8(e,t,P8,`hour`):t>=N8?H8(e,t,N8,`minute`):t>=M8?H8(e,t,M8,`second`):e+` ms`}function H8(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}function U8(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=R8,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 W8=U8;(function(e,t){let n=E,r=we;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=j8;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=W8(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)}})(x8,x8.exports);var G8=x8.exports,K8=y3(G8),{create:q8}=s8,J8=ue,Y8=l8,{pathToFileURL:X8}=Fe,Z8=h8,{emitDiagnostics:Q8}=b8,$8=G8(`@apm-js-collab/tracing-hooks:module-patch`),e5=class{constructor({instrumentations:e=[]}={}){this.packages=new Set(e.map(e=>e.module.name)),this.instrumentator=q8(e),this.compile=J8.prototype._compile}patch(){let e=this;J8.prototype._compile=function(...t){let[n,r]=t,i=Y8(r);if(i&&e.packages.has(i.name)){$8(`found resolved module, checking if there is a transformer %s`,r);let a=Z8(i.basedir,i.name),o=e.instrumentator.getTransformer(i.name,a,i.path);if(o){$8(`transforming file %s`,r);try{t[0]=o.transform(n,`cjs`)?.code,Q8({url:X8(r).href,moduleName:o.moduleName}),process.env.TRACING_DUMP&&t5(t[0],r)}catch(e){$8(`Error transforming module %s: %o`,r,e),Q8({url:X8(r).href,moduleName:o.moduleName,error:e})}finally{o.free()}}}return e.compile.apply(this,t)}}unpatch(){J8.prototype._compile=this.compile}};function t5(e,t){let n=T,r=me,i=ve,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);$8(`Dumping patched code to: %s`,l),i.mkdirSync(c,{recursive:!0}),i.writeFileSync(l,e)}var n5=y3(e5),r5=K8(`@apm-js-collab/tracing-hooks:esm-hook`),i5=null,a5=null,o5=null,s5=b8.emitDiagnostics;function c5(){let{port1:e,port2:t}=new Ue;return e.on(`message`,b8.emitDiagnostics),e.unref(),t}function l5(e={}){let t=e?.instrumentations||[];o5=s8.create(t),a5=new Set(t.map(e=>e.module.name)),i5=new Map,s5=e?.diagnosticsPort?u5(e.diagnosticsPort):b8.emitDiagnostics}function u5(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){r5(`failed to post diagnostics for %s: %o`,t.url,e)}}}function d5(e){let t=u8(e.url);if(t&&a5.has(t.name)){let n=g8(Ie(t.basedir)),r=o5.getTransformer(t.name,n,t.path);r&&i5.set(e.url,r)}return e}function f5(e,t,n){return d5(n(e,t))}function p5(e,t,n){let r=n(e,t);if(i5.has(e)===!1)return r;if(r.format===`commonjs`){let t=new URL(r.responseURL??e);r.source??=xe(t)}return m5(e,r)}function m5(e,t){let n=t.source;if(n){let r=i5.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,s5({url:e,moduleName:r.moduleName})}catch(t){r5(`Error transforming module %s: %o`,e,t),s5({url:e,moduleName:r.moduleName,error:t})}finally{r.free()}}return t}b8.setDiagnosticsHook;function h5(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 g5(e){if(!We&&!Ge||O?.__SENTRY_ORCHESTRION__?.runtime)return;let t=globalThis,n=h5(t.Deno?.version?.deno),r=le;b8.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)l5({instrumentations:_3}),r.registerHooks({resolve:f5,load:p5}),A.log(`Registered diagnostics-channel injection via Module.registerHooks()`);else if(typeof r.register==`function`&&!t.Bun&&!t.Deno){let e=c5(),t;t=import.meta.url,r.register(`@sentry/server-utils/orchestrion/hook`,{parentURL:t,data:{instrumentations:_3,diagnosticsPort:e},transferList:[e]}),new n5({instrumentations:_3}).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 _5(){return x0}function v5(e){TV(()=>{let e=Object.values(x0).map(e=>e()),t=e.map(e=>e.name);return{integrations:[...e,AX({responseHook:VV}),b0({responseHook:VV})],replacedOtelIntegrationNames:t,register:()=>g5(),detect:r0}})}export{FT as NODE_VERSION,zM as NodeClient,A4 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,jA as SentryContextManager,CN as _INTERNAL_normalizeCollectionInterval,Kf as addBreadcrumb,mu as addEventProcessor,Mu as addIntegration,q2 as amqplibIntegration,cN as anrIntegration,p4 as anthropicAIIntegration,p3 as applyDiagnosticsChannelInjectionIntegrations,Lo as bindScopeToEmitter,O4 as buildLaunchDarklyFlagUsedHandler,bu as captureCheckIn,Gp as captureConsoleIntegration,$l as captureEvent,V as captureException,ch as captureFeedback,Ql as captureMessage,vu as captureSession,LA as childProcessIntegration,du as close,ZU as connectIntegration,pM as consoleIntegration,hh as consoleLoggingIntegration,Sj as contextLinesIntegration,uo as continueTrace,Sh as createConsolaReporter,FM as createGetModuleFromFilename,Ly as createLangChainCallbackHandler,kN as createSentryWinstonTransport,xd as createTransport,WN as cron,t2 as dataloaderIntegration,Jp as dedupeIntegration,LM as defaultStackParser,_5 as diagnosticsChannelInjectionIntegrations,uN as disableAnrDetectionForCallback,gu as endSession,Qf as eventFiltersIntegration,v5 as experimentalUseDiagnosticsChannelInjection,ZS as expressErrorHandler,OP as expressIntegration,nm as extraErrorDataIntegration,ZR as fastifyIntegration,$m as featureFlagsIntegration,$4 as firebaseIntegration,uu as flush,bP as fsIntegration,Yf as functionToStringIntegration,J as generateInstrumentOnce,U0 as genericPoolIntegration,R as getActiveSpan,e3 as getAutoPerformanceIntegrations,P as getClient,M as getCurrentScope,f3 as getDefaultIntegrations,d3 as getDefaultIntegrationsWithoutPerformance,Tr as getGlobalScope,N as getIsolationScope,ra as getRootSpan,IM as getSentryRelease,na as getSpanDescendants,Jr as getSpanStatusFromHttpCode,Ef as getTraceData,jf as getTraceMetaTags,_4 as googleGenAIIntegration,zz as graphqlIntegration,N4 as growthbookIntegration,dU as hapiIntegration,wU as honoIntegration,zf as httpHeadersToSpanAttributes,qN as httpIntegration,rw as httpServerIntegration,cw as httpServerSpansIntegration,$f as inboundFiltersIntegration,m3 as init,a3 as initOpenTelemetry,g3 as initWithoutDefaultIntegrations,Xv as instrumentAnthropicAiClient,py as instrumentGoogleGenAIClient,Hy as instrumentLangChainEmbeddings,ob as instrumentLangGraph,Cv as instrumentOpenAiClient,ab as instrumentStateGraph,nb as instrumentStateGraphCompile,Mm as instrumentSupabaseClient,EV as isDiagnosticsChannelInjectionEnabled,pu as isEnabled,fu as isInitialized,sB as kafkaIntegration,w0 as knexIntegration,RU as koaIntegration,S4 as langChainIntegration,E4 as langGraphIntegration,lu as lastEventId,D4 as launchDarklyIntegration,Dp as linkedErrorsIntegration,zj as localVariablesIntegration,fN as logger,fB as lruMemoizerIntegration,AM as makeNodeTransport,gh as metrics,Uj as modulesIntegration,kB as mongoIntegration,qB as mongooseIntegration,SV as mysql2Integration,aV as mysqlIntegration,JN as nativeNodeFetchIntegration,UA as nodeContextIntegration,wN as nodeRuntimeMetricsIntegration,Zj as onUncaughtExceptionIntegration,tM as onUnhandledRejectionIntegration,l4 as openAIIntegration,k4 as openFeatureIntegration,Cf as parameterize,IN as pinoIntegration,zH as postgresIntegration,qH as postgresJsIntegration,o3 as preloadOpenTelemetry,zI as prismaIntegration,cM as processSessionIntegration,sh as profiler,fH as redisIntegration,Np as requestDataIntegration,mm as rewriteFramesIntegration,ou as setAttribute,au as setAttributes,eu as setContext,cu as setConversationId,$d as setCurrentClient,nu as setExtra,tu as setExtras,Yr as setHttpStatus,Ga as setMeasurement,DA as setNodeAsyncContextStrategy,iu as setTag,ru as setTags,su as setUser,$U as setupConnectErrorHandler,TP as setupExpressErrorHandler,QR as setupFastifyErrorHandler,hU as setupHapiErrorHandler,OU as setupHonoErrorHandler,zU as setupKoaErrorHandler,pb as spanStreamingIntegration,Sa as spanToBaggageHeader,L as spanToJSON,Ri as spanToTraceHeader,uM as spotlightIntegration,z as startInactiveSpan,mo as startNewTrace,hu as startSession,oo as startSpan,so as startSpanManual,j4 as statsigIntegration,Fm as supabaseIntegration,fo as suppressTracing,vM as systemErrorIntegration,L0 as tediousIntegration,Sb as trpcMiddleware,M4 as unleashIntegration,oa as updateSpanName,KM as validateOpenTelemetrySetup,a4 as vercelAIIntegration,Ff as winterCGHeadersToDict,B as withActiveSpan,Dr as withIsolationScope,yu as withMonitor,Er as withScope,Ca as withStreamedSpan,mS as wrapMcpServerWithSentry,Um as zodErrorsIntegration};