sentry 0.3.2 → 0.3.3

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.
Files changed (2) hide show
  1. package/dist/bin.cjs +5 -4
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -1,4 +1,5 @@
1
- var w8=Object.create;var B_=Object.defineProperty;var U8=Object.getOwnPropertyDescriptor;var k8=Object.getOwnPropertyNames;var B8=Object.getPrototypeOf,G8=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(t&&(e=t(t=0)),e);var A=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zc=(t,e)=>{for(var n in e)B_(t,n,{get:e[n],enumerable:!0})},_M=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k8(e))!G8.call(t,o)&&o!==n&&B_(t,o,{get:()=>e[o],enumerable:!(r=U8(e,o))||r.enumerable});return t};var B=(t,e,n)=>(n=t!=null?w8(B8(t)):{},_M(e||!t||!t.__esModule?B_(n,"default",{value:t,enumerable:!0}):n,t)),v=t=>_M(B_({},"__esModule",{value:!0}),t);var h,u=k(()=>{"use strict";h=require("node:url").pathToFileURL(__filename).href});var j8,l=k(()=>{j8=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};j8.SENTRY_RELEASE={id:"0.3.2"}});function F8(t){let e=(0,Cn.normalize)(t);return e.length>1&&e[e.length-1]===Cn.sep&&(e=e.substring(0,e.length-1)),e}function gM(t,e){return t.replace($8,e)}function q8(t){return t==="/"||V8.test(t)}function $A(t,e){let{resolvePaths:n,normalizePath:r,pathSeparator:o}=e,s=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(n&&(t=(0,Cn.resolve)(t)),(r||s)&&(t=F8(t)),t===".")return"";let i=t[t.length-1]!==o;return gM(i?t+o:t,o)}function TM(t,e){return e+t}function Y8(t,e){return function(n,r){return r.startsWith(t)?r.slice(t.length)+n:gM((0,Cn.relative)(t,r),e.pathSeparator)+e.pathSeparator+n}}function W8(t){return t}function K8(t,e,n){return e+t+n}function z8(t,e){let{relativePaths:n,includeBasePath:r}=e;return n&&t?Y8(t,e):r?TM:W8}function X8(t){return function(e,n){n.push(e.substring(t.length)||".")}}function Q8(t){return function(e,n,r){let o=e.substring(t.length)||".";r.every(s=>s(o,!0))&&n.push(o)}}function tJ(t,e){let{includeDirs:n,filters:r,relativePaths:o}=e;return n?o?r&&r.length?Q8(t):X8(t):r&&r.length?Z8:J8:eJ}function aJ(t){let{excludeFiles:e,filters:n,onlyCounts:r}=t;return e?iJ:n&&n.length?r?nJ:rJ:r?oJ:sJ}function lJ(t){return t.group?uJ:cJ}function fJ(t){return t.group?pJ:dJ}function hJ(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?mJ:_J}function SM(t,e,n){if(n.options.useRealPaths)return EJ(e,n);let r=(0,Cn.dirname)(t),o=1;for(;r!==n.root&&o<2;){let s=n.symlinks.get(r);!!s&&(s===e||s.startsWith(e)||e.startsWith(s))?o++:r=(0,Cn.dirname)(r)}return n.symlinks.set(t,e),o>1}function EJ(t,e){return e.visited.includes(t+e.options.pathSeparator)}function G_(t,e,n,r){e(t&&!r?t:null,n)}function OJ(t,e){let{onlyCounts:n,group:r,maxFiles:o}=t;return n?e?gJ:RJ:r?e?TJ:NJ:o?e?AJ:IJ:e?SJ:yJ}function PJ(t){return t?CJ:bJ}function LJ(t,e){return new Promise((n,r)=>{yM(t,e,(o,s)=>{if(o)return r(o);n(s)})})}function yM(t,e,n){new RM(t,e,n).start()}function DJ(t,e){return new RM(t,e).start()}var EM,Cn,H8,mM,$8,V8,J8,Z8,eJ,nJ,rJ,oJ,sJ,iJ,cJ,uJ,pJ,dJ,_J,mJ,gJ,TJ,SJ,AJ,RJ,yJ,IJ,NJ,AM,bJ,CJ,MJ,vJ,xJ,RM,hM,IM,NM,OM=k(()=>{p();u();l();EM=require("module"),Cn=require("path"),H8=B(require("fs"),1),mM=(0,EM.createRequire)(h);$8=/[\\/]/g;V8=/^[a-z]:[\\/]$/i;J8=(t,e)=>{e.push(t||".")},Z8=(t,e,n)=>{let r=t||".";n.every(o=>o(r,!0))&&e.push(r)},eJ=()=>{};nJ=(t,e,n,r)=>{r.every(o=>o(t,!1))&&n.files++},rJ=(t,e,n,r)=>{r.every(o=>o(t,!1))&&e.push(t)},oJ=(t,e,n,r)=>{n.files++},sJ=(t,e)=>{e.push(t)},iJ=()=>{};cJ=t=>t,uJ=()=>[""].slice(0,0);pJ=(t,e,n)=>{t.push({directory:e,files:n,dir:e})},dJ=()=>{};_J=function(t,e,n){let{queue:r,fs:o,options:{suppressErrors:s}}=e;r.enqueue(),o.realpath(t,(i,a)=>{if(i)return r.dequeue(s?null:i,e);o.stat(a,(c,d)=>{if(c)return r.dequeue(s?null:c,e);if(d.isDirectory()&&SM(t,a,e))return r.dequeue(null,e);n(d,a),r.dequeue(null,e)})})},mJ=function(t,e,n){let{queue:r,fs:o,options:{suppressErrors:s}}=e;r.enqueue();try{let i=o.realpathSync(t),a=o.statSync(i);if(a.isDirectory()&&SM(t,i,e))return;n(a,i)}catch(i){if(!s)throw i}};gJ=t=>t.counts,TJ=t=>t.groups,SJ=t=>t.paths,AJ=t=>t.paths.slice(0,t.options.maxFiles),RJ=(t,e,n)=>(G_(e,n,t.counts,t.options.suppressErrors),null),yJ=(t,e,n)=>(G_(e,n,t.paths,t.options.suppressErrors),null),IJ=(t,e,n)=>(G_(e,n,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),NJ=(t,e,n)=>(G_(e,n,t.groups,t.options.suppressErrors),null);AM={withFileTypes:!0},bJ=(t,e,n,r,o)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);let{fs:s}=t;t.visited.push(e),t.counts.directories++,s.readdir(e||".",AM,(i,a=[])=>{o(a,n,r),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},CJ=(t,e,n,r,o)=>{let{fs:s}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let i=[];try{i=s.readdirSync(e||".",AM)}catch(a){if(!t.options.suppressErrors)throw a}o(i,n,r)};MJ=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},vJ=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},xJ=class{aborted=!1;abort(){this.aborted=!0}},RM=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,n){this.isSynchronous=!n,this.callbackInvoker=OJ(e,this.isSynchronous),this.root=$A(t,e),this.state={root:q8(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new vJ,options:e,queue:new MJ((r,o)=>this.callbackInvoker(o,r,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new xJ,fs:e.fs||H8},this.joinPath=z8(this.root,e),this.pushDirectory=tJ(this.root,e),this.pushFile=aJ(e),this.getArray=lJ(e),this.groupFiles=fJ(e),this.resolveSymlink=hJ(e,this.isSynchronous),this.walkDirectory=PJ(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,n)=>{let{paths:r,options:{filters:o,resolveSymlinks:s,excludeSymlinks:i,exclude:a,maxFiles:c,signal:d,useRealPaths:f,pathSeparator:_},controller:m}=this.state;if(m.aborted||d&&d.aborted||c&&r.length>c)return;let E=this.getArray(this.state.paths);for(let T=0;T<t.length;++T){let S=t[T];if(S.isFile()||S.isSymbolicLink()&&!s&&!i){let R=this.joinPath(S.name,e);this.pushFile(R,E,this.state.counts,o)}else if(S.isDirectory()){let R=K8(S.name,e,this.state.options.pathSeparator);if(a&&a(S.name,R))continue;this.pushDirectory(R,r,o),this.walkDirectory(this.state,R,R,n-1,this.walk)}else if(this.resolveSymlink&&S.isSymbolicLink()){let R=TM(S.name,e);this.resolveSymlink(R,this.state,(N,y)=>{if(N.isDirectory()){if(y=$A(y,this.state.options),a&&a(S.name,f?y:R+_))return;this.walkDirectory(this.state,y,f?y:R+_,n-1,this.walk)}else{y=f?y:R;let P=(0,Cn.basename)(y),M=$A((0,Cn.dirname)(y),this.state.options);y=this.joinPath(P,M),this.pushFile(y,E,this.state.counts,o)}})}}this.groupFiles(this.state.groups,e,E)}};hM=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return LJ(this.root,this.options)}withCallback(t){yM(this.root,this.options,t)}sync(){return DJ(this.root,this.options)}},IM=null;try{mM.resolve("picomatch"),IM=mM("picomatch")}catch{}NM=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Cn.sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new hM(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new hM(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let n=this.globFunction||IM;if(!n)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=n(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(o=>r(o)),this}}});var bp=A((Wwe,vM)=>{"use strict";p();u();l();var bM="[^\\\\/]",wJ="(?=.)",CM="[^/]",VA="(?:\\/|$)",PM="(?:^|\\/)",qA=`\\.{1,2}${VA}`,UJ="(?!\\.)",kJ=`(?!${PM}${qA})`,BJ=`(?!\\.{0,1}${VA})`,GJ=`(?!${qA})`,jJ="[^.\\/]",HJ=`${CM}*?`,FJ="/",MM={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:wJ,QMARK:CM,END_ANCHOR:VA,DOTS_SLASH:qA,NO_DOT:UJ,NO_DOTS:kJ,NO_DOT_SLASH:BJ,NO_DOTS_SLASH:GJ,QMARK_NO_DOT:jJ,STAR:HJ,START_ANCHOR:PM,SEP:FJ},$J={...MM,SLASH_LITERAL:"[\\\\/]",QMARK:bM,STAR:`${bM}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},VJ={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};vM.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:VJ,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?$J:MM}}});var Cp=A(Wn=>{"use strict";p();u();l();var{REGEX_BACKSLASH:qJ,REGEX_REMOVE_BACKSLASH:YJ,REGEX_SPECIAL_CHARS:WJ,REGEX_SPECIAL_CHARS_GLOBAL:KJ}=bp();Wn.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Wn.hasRegexChars=t=>WJ.test(t);Wn.isRegexChar=t=>t.length===1&&Wn.hasRegexChars(t);Wn.escapeRegex=t=>t.replace(KJ,"\\$1");Wn.toPosixSlashes=t=>t.replace(qJ,"/");Wn.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Wn.removeBackslashes=t=>t.replace(YJ,e=>e==="\\"?"":e);Wn.escapeLast=(t,e,n)=>{let r=t.lastIndexOf(e,n);return r===-1?t:t[r-1]==="\\"?Wn.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};Wn.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n};Wn.wrapOutput=(t,e={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${t})${o}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s};Wn.basename=(t,{windows:e}={})=>{let n=t.split(e?/[\\/]/:"/"),r=n[n.length-1];return r===""?n[n.length-2]:r}});var GM=A((tUe,BM)=>{"use strict";p();u();l();var xM=Cp(),{CHAR_ASTERISK:YA,CHAR_AT:zJ,CHAR_BACKWARD_SLASH:Pp,CHAR_COMMA:XJ,CHAR_DOT:WA,CHAR_EXCLAMATION_MARK:KA,CHAR_FORWARD_SLASH:kM,CHAR_LEFT_CURLY_BRACE:zA,CHAR_LEFT_PARENTHESES:XA,CHAR_LEFT_SQUARE_BRACKET:QJ,CHAR_PLUS:JJ,CHAR_QUESTION_MARK:LM,CHAR_RIGHT_CURLY_BRACE:ZJ,CHAR_RIGHT_PARENTHESES:DM,CHAR_RIGHT_SQUARE_BRACKET:eZ}=bp(),wM=t=>t===kM||t===Pp,UM=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},tZ=(t,e)=>{let n=e||{},r=t.length-1,o=n.parts===!0||n.scanToEnd===!0,s=[],i=[],a=[],c=t,d=-1,f=0,_=0,m=!1,E=!1,T=!1,S=!1,R=!1,N=!1,y=!1,P=!1,M=!1,G=!1,U=0,Q,K,ee={value:"",depth:0,isGlob:!1},O=()=>d>=r,at=()=>c.charCodeAt(d+1),je=()=>(Q=K,c.charCodeAt(++d));for(;d<r;){K=je();let Pe;if(K===Pp){y=ee.backslashes=!0,K=je(),K===zA&&(N=!0);continue}if(N===!0||K===zA){for(U++;O()!==!0&&(K=je());){if(K===Pp){y=ee.backslashes=!0,je();continue}if(K===zA){U++;continue}if(N!==!0&&K===WA&&(K=je())===WA){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(N!==!0&&K===XJ){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===ZJ&&(U--,U===0)){N=!1,m=ee.isBrace=!0,G=!0;break}}if(o===!0)continue;break}if(K===kM){if(s.push(d),i.push(ee),ee={value:"",depth:0,isGlob:!1},G===!0)continue;if(Q===WA&&d===f+1){f+=2;continue}_=d+1;continue}if(n.noext!==!0&&(K===JJ||K===zJ||K===YA||K===LM||K===KA)===!0&&at()===XA){if(T=ee.isGlob=!0,S=ee.isExtglob=!0,G=!0,K===KA&&d===f&&(M=!0),o===!0){for(;O()!==!0&&(K=je());){if(K===Pp){y=ee.backslashes=!0,K=je();continue}if(K===DM){T=ee.isGlob=!0,G=!0;break}}continue}break}if(K===YA){if(Q===YA&&(R=ee.isGlobstar=!0),T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===LM){if(T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===QJ){for(;O()!==!0&&(Pe=je());){if(Pe===Pp){y=ee.backslashes=!0,je();continue}if(Pe===eZ){E=ee.isBracket=!0,T=ee.isGlob=!0,G=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&K===KA&&d===f){P=ee.negated=!0,f++;continue}if(n.noparen!==!0&&K===XA){if(T=ee.isGlob=!0,o===!0){for(;O()!==!0&&(K=je());){if(K===XA){y=ee.backslashes=!0,K=je();continue}if(K===DM){G=!0;break}}continue}break}if(T===!0){if(G=!0,o===!0)continue;break}}n.noext===!0&&(S=!1,T=!1);let Te=c,b="",C="";f>0&&(b=c.slice(0,f),c=c.slice(f),_-=f),Te&&T===!0&&_>0?(Te=c.slice(0,_),C=c.slice(_)):T===!0?(Te="",C=c):Te=c,Te&&Te!==""&&Te!=="/"&&Te!==c&&wM(Te.charCodeAt(Te.length-1))&&(Te=Te.slice(0,-1)),n.unescape===!0&&(C&&(C=xM.removeBackslashes(C)),Te&&y===!0&&(Te=xM.removeBackslashes(Te)));let On={prefix:b,input:t,start:f,base:Te,glob:C,isBrace:m,isBracket:E,isGlob:T,isExtglob:S,isGlobstar:R,negated:P,negatedExtglob:M};if(n.tokens===!0&&(On.maxDepth=0,wM(K)||i.push(ee),On.tokens=i),n.parts===!0||n.tokens===!0){let Pe;for(let Fe=0;Fe<s.length;Fe++){let Or=Pe?Pe+1:f,br=s[Fe],Js=t.slice(Or,br);n.tokens&&(Fe===0&&f!==0?(i[Fe].isPrefix=!0,i[Fe].value=b):i[Fe].value=Js,UM(i[Fe]),On.maxDepth+=i[Fe].depth),(Fe!==0||Js!=="")&&a.push(Js),Pe=br}if(Pe&&Pe+1<t.length){let Fe=t.slice(Pe+1);a.push(Fe),n.tokens&&(i[i.length-1].value=Fe,UM(i[i.length-1]),On.maxDepth+=i[i.length-1].depth)}On.slashes=s,On.parts=a}return On};BM.exports=tZ});var FM=A((sUe,HM)=>{"use strict";p();u();l();var j_=bp(),Do=Cp(),{MAX_LENGTH:H_,POSIX_REGEX_SOURCE:nZ,REGEX_NON_SPECIAL_CHARS:rZ,REGEX_SPECIAL_CHARS_BACKREF:oZ,REPLACEMENTS:jM}=j_,sZ=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let n=`[${t.join("-")}]`;try{new RegExp(n)}catch{return t.map(o=>Do.escapeRegex(o)).join("..")}return n},Xc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,QA=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=jM[t]||t;let n={...e},r=typeof n.maxLength=="number"?Math.min(H_,n.maxLength):H_,o=t.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);let s={type:"bos",value:"",output:n.prepend||""},i=[s],a=n.capture?"":"?:",c=j_.globChars(n.windows),d=j_.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:_,SLASH_LITERAL:m,ONE_CHAR:E,DOTS_SLASH:T,NO_DOT:S,NO_DOT_SLASH:R,NO_DOTS_SLASH:N,QMARK:y,QMARK_NO_DOT:P,STAR:M,START_ANCHOR:G}=c,U=z=>`(${a}(?:(?!${G}${z.dot?T:f}).)*?)`,Q=n.dot?"":S,K=n.dot?y:P,ee=n.bash===!0?U(n):M;n.capture&&(ee=`(${ee})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let O={input:t,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=Do.removePrefix(t,O),o=t.length;let at=[],je=[],Te=[],b=s,C,On=()=>O.index===o-1,Pe=O.peek=(z=1)=>t[O.index+z],Fe=O.advance=()=>t[++O.index]||"",Or=()=>t.slice(O.index+1),br=(z="",We=0)=>{O.consumed+=z,O.index+=We},Js=z=>{O.output+=z.output!=null?z.output:z.value,br(z.value)},L8=()=>{let z=1;for(;Pe()==="!"&&(Pe(2)!=="("||Pe(3)==="?");)Fe(),O.start++,z++;return z%2===0?!1:(O.negated=!0,O.start++,!0)},w_=z=>{O[z]++,Te.push(z)},Ia=z=>{O[z]--,Te.pop()},Ne=z=>{if(b.type==="globstar"){let We=O.braces>0&&(z.type==="comma"||z.type==="brace"),H=z.extglob===!0||at.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!We&&!H&&(O.output=O.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=ee,O.output+=b.output)}if(at.length&&z.type!=="paren"&&(at[at.length-1].inner+=z.value),(z.value||z.output)&&Js(z),b&&b.type==="text"&&z.type==="text"){b.output=(b.output||b.value)+z.value,b.value+=z.value;return}z.prev=b,i.push(z),b=z},U_=(z,We)=>{let H={...d[We],conditions:1,inner:""};H.prev=b,H.parens=O.parens,H.output=O.output;let Se=(n.capture?"(":"")+H.open;w_("parens"),Ne({type:z,value:We,output:O.output?"":E}),Ne({type:"paren",extglob:!0,value:Fe(),output:Se}),at.push(H)},D8=z=>{let We=z.close+(n.capture?")":""),H;if(z.type==="negate"){let Se=ee;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(Se=U(n)),(Se!==ee||On()||/^\)+$/.test(Or()))&&(We=z.close=`)$))${Se}`),z.inner.includes("*")&&(H=Or())&&/^\.[^\\/.]+$/.test(H)){let nt=QA(H,{...e,fastpaths:!1}).output;We=z.close=`)${nt})${Se})`}z.prev.type==="bos"&&(O.negatedExtglob=!0)}Ne({type:"paren",extglob:!0,value:C,output:We}),Ia("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,We=t.replace(oZ,(H,Se,nt,bn,Ut,FA)=>bn==="\\"?(z=!0,H):bn==="?"?Se?Se+bn+(Ut?y.repeat(Ut.length):""):FA===0?K+(Ut?y.repeat(Ut.length):""):y.repeat(nt.length):bn==="."?f.repeat(nt.length):bn==="*"?Se?Se+bn+(Ut?ee:""):ee:Se?H:`\\${H}`);return z===!0&&(n.unescape===!0?We=We.replace(/\\/g,""):We=We.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),We===t&&n.contains===!0?(O.output=t,O):(O.output=Do.wrapOutput(We,O,e),O)}for(;!On();){if(C=Fe(),C==="\0")continue;if(C==="\\"){let H=Pe();if(H==="/"&&n.bash!==!0||H==="."||H===";")continue;if(!H){C+="\\",Ne({type:"text",value:C});continue}let Se=/^\\+/.exec(Or()),nt=0;if(Se&&Se[0].length>2&&(nt=Se[0].length,O.index+=nt,nt%2!==0&&(C+="\\")),n.unescape===!0?C=Fe():C+=Fe(),O.brackets===0){Ne({type:"text",value:C});continue}}if(O.brackets>0&&(C!=="]"||b.value==="["||b.value==="[^")){if(n.posix!==!1&&C===":"){let H=b.value.slice(1);if(H.includes("[")&&(b.posix=!0,H.includes(":"))){let Se=b.value.lastIndexOf("["),nt=b.value.slice(0,Se),bn=b.value.slice(Se+2),Ut=nZ[bn];if(Ut){b.value=nt+Ut,O.backtrack=!0,Fe(),!s.output&&i.indexOf(b)===1&&(s.output=E);continue}}}(C==="["&&Pe()!==":"||C==="-"&&Pe()==="]")&&(C=`\\${C}`),C==="]"&&(b.value==="["||b.value==="[^")&&(C=`\\${C}`),n.posix===!0&&C==="!"&&b.value==="["&&(C="^"),b.value+=C,Js({value:C});continue}if(O.quotes===1&&C!=='"'){C=Do.escapeRegex(C),b.value+=C,Js({value:C});continue}if(C==='"'){O.quotes=O.quotes===1?0:1,n.keepQuotes===!0&&Ne({type:"text",value:C});continue}if(C==="("){w_("parens"),Ne({type:"paren",value:C});continue}if(C===")"){if(O.parens===0&&n.strictBrackets===!0)throw new SyntaxError(Xc("opening","("));let H=at[at.length-1];if(H&&O.parens===H.parens+1){D8(at.pop());continue}Ne({type:"paren",value:C,output:O.parens?")":"\\)"}),Ia("parens");continue}if(C==="["){if(n.nobracket===!0||!Or().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(Xc("closing","]"));C=`\\${C}`}else w_("brackets");Ne({type:"bracket",value:C});continue}if(C==="]"){if(n.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){Ne({type:"text",value:C,output:`\\${C}`});continue}if(O.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(Xc("opening","["));Ne({type:"text",value:C,output:`\\${C}`});continue}Ia("brackets");let H=b.value.slice(1);if(b.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(C=`/${C}`),b.value+=C,Js({value:C}),n.literalBrackets===!1||Do.hasRegexChars(H))continue;let Se=Do.escapeRegex(b.value);if(O.output=O.output.slice(0,-b.value.length),n.literalBrackets===!0){O.output+=Se,b.value=Se;continue}b.value=`(${a}${Se}|${b.value})`,O.output+=b.value;continue}if(C==="{"&&n.nobrace!==!0){w_("braces");let H={type:"brace",value:C,output:"(",outputIndex:O.output.length,tokensIndex:O.tokens.length};je.push(H),Ne(H);continue}if(C==="}"){let H=je[je.length-1];if(n.nobrace===!0||!H){Ne({type:"text",value:C,output:C});continue}let Se=")";if(H.dots===!0){let nt=i.slice(),bn=[];for(let Ut=nt.length-1;Ut>=0&&(i.pop(),nt[Ut].type!=="brace");Ut--)nt[Ut].type!=="dots"&&bn.unshift(nt[Ut].value);Se=sZ(bn,n),O.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let nt=O.output.slice(0,H.outputIndex),bn=O.tokens.slice(H.tokensIndex);H.value=H.output="\\{",C=Se="\\}",O.output=nt;for(let Ut of bn)O.output+=Ut.output||Ut.value}Ne({type:"brace",value:C,output:Se}),Ia("braces"),je.pop();continue}if(C==="|"){at.length>0&&at[at.length-1].conditions++,Ne({type:"text",value:C});continue}if(C===","){let H=C,Se=je[je.length-1];Se&&Te[Te.length-1]==="braces"&&(Se.comma=!0,H="|"),Ne({type:"comma",value:C,output:H});continue}if(C==="/"){if(b.type==="dot"&&O.index===O.start+1){O.start=O.index+1,O.consumed="",O.output="",i.pop(),b=s;continue}Ne({type:"slash",value:C,output:m});continue}if(C==="."){if(O.braces>0&&b.type==="dot"){b.value==="."&&(b.output=f);let H=je[je.length-1];b.type="dots",b.output+=C,b.value+=C,H.dots=!0;continue}if(O.braces+O.parens===0&&b.type!=="bos"&&b.type!=="slash"){Ne({type:"text",value:C,output:f});continue}Ne({type:"dot",value:C,output:f});continue}if(C==="?"){if(!(b&&b.value==="(")&&n.noextglob!==!0&&Pe()==="("&&Pe(2)!=="?"){U_("qmark",C);continue}if(b&&b.type==="paren"){let Se=Pe(),nt=C;(b.value==="("&&!/[!=<:]/.test(Se)||Se==="<"&&!/<([!=]|\w+>)/.test(Or()))&&(nt=`\\${C}`),Ne({type:"text",value:C,output:nt});continue}if(n.dot!==!0&&(b.type==="slash"||b.type==="bos")){Ne({type:"qmark",value:C,output:P});continue}Ne({type:"qmark",value:C,output:y});continue}if(C==="!"){if(n.noextglob!==!0&&Pe()==="("&&(Pe(2)!=="?"||!/[!=<:]/.test(Pe(3)))){U_("negate",C);continue}if(n.nonegate!==!0&&O.index===0){L8();continue}}if(C==="+"){if(n.noextglob!==!0&&Pe()==="("&&Pe(2)!=="?"){U_("plus",C);continue}if(b&&b.value==="("||n.regex===!1){Ne({type:"plus",value:C,output:_});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||O.parens>0){Ne({type:"plus",value:C});continue}Ne({type:"plus",value:_});continue}if(C==="@"){if(n.noextglob!==!0&&Pe()==="("&&Pe(2)!=="?"){Ne({type:"at",extglob:!0,value:C,output:""});continue}Ne({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let H=rZ.exec(Or());H&&(C+=H[0],O.index+=H[0].length),Ne({type:"text",value:C});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=C,b.output=ee,O.backtrack=!0,O.globstar=!0,br(C);continue}let z=Or();if(n.noextglob!==!0&&/^\([^?]/.test(z)){U_("star",C);continue}if(b.type==="star"){if(n.noglobstar===!0){br(C);continue}let H=b.prev,Se=H.prev,nt=H.type==="slash"||H.type==="bos",bn=Se&&(Se.type==="star"||Se.type==="globstar");if(n.bash===!0&&(!nt||z[0]&&z[0]!=="/")){Ne({type:"star",value:C,output:""});continue}let Ut=O.braces>0&&(H.type==="comma"||H.type==="brace"),FA=at.length&&(H.type==="pipe"||H.type==="paren");if(!nt&&H.type!=="paren"&&!Ut&&!FA){Ne({type:"star",value:C,output:""});continue}for(;z.slice(0,3)==="/**";){let k_=t[O.index+4];if(k_&&k_!=="/")break;z=z.slice(3),br("/**",3)}if(H.type==="bos"&&On()){b.type="globstar",b.value+=C,b.output=U(n),O.output=b.output,O.globstar=!0,br(C);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!bn&&On()){O.output=O.output.slice(0,-(H.output+b.output).length),H.output=`(?:${H.output}`,b.type="globstar",b.output=U(n)+(n.strictSlashes?")":"|$)"),b.value+=C,O.globstar=!0,O.output+=H.output+b.output,br(C);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&z[0]==="/"){let k_=z[1]!==void 0?"|$":"";O.output=O.output.slice(0,-(H.output+b.output).length),H.output=`(?:${H.output}`,b.type="globstar",b.output=`${U(n)}${m}|${m}${k_})`,b.value+=C,O.output+=H.output+b.output,O.globstar=!0,br(C+Fe()),Ne({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&z[0]==="/"){b.type="globstar",b.value+=C,b.output=`(?:^|${m}|${U(n)}${m})`,O.output=b.output,O.globstar=!0,br(C+Fe()),Ne({type:"slash",value:"/",output:""});continue}O.output=O.output.slice(0,-b.output.length),b.type="globstar",b.output=U(n),b.value+=C,O.output+=b.output,O.globstar=!0,br(C);continue}let We={type:"star",value:C,output:ee};if(n.bash===!0){We.output=".*?",(b.type==="bos"||b.type==="slash")&&(We.output=Q+We.output),Ne(We);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&n.regex===!0){We.output=C,Ne(We);continue}(O.index===O.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(O.output+=R,b.output+=R):n.dot===!0?(O.output+=N,b.output+=N):(O.output+=Q,b.output+=Q),Pe()!=="*"&&(O.output+=E,b.output+=E)),Ne(We)}for(;O.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(Xc("closing","]"));O.output=Do.escapeLast(O.output,"["),Ia("brackets")}for(;O.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(Xc("closing",")"));O.output=Do.escapeLast(O.output,"("),Ia("parens")}for(;O.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(Xc("closing","}"));O.output=Do.escapeLast(O.output,"{"),Ia("braces")}if(n.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&Ne({type:"maybe_slash",value:"",output:`${m}?`}),O.backtrack===!0){O.output="";for(let z of O.tokens)O.output+=z.output!=null?z.output:z.value,z.suffix&&(O.output+=z.suffix)}return O};QA.fastpaths=(t,e)=>{let n={...e},r=typeof n.maxLength=="number"?Math.min(H_,n.maxLength):H_,o=t.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);t=jM[t]||t;let{DOT_LITERAL:s,SLASH_LITERAL:i,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:d,NO_DOTS:f,NO_DOTS_SLASH:_,STAR:m,START_ANCHOR:E}=j_.globChars(n.windows),T=n.dot?f:d,S=n.dot?_:d,R=n.capture?"":"?:",N={negated:!1,prefix:""},y=n.bash===!0?".*?":m;n.capture&&(y=`(${y})`);let P=Q=>Q.noglobstar===!0?y:`(${R}(?:(?!${E}${Q.dot?c:s}).)*?)`,M=Q=>{switch(Q){case"*":return`${T}${a}${y}`;case".*":return`${s}${a}${y}`;case"*.*":return`${T}${y}${s}${a}${y}`;case"*/*":return`${T}${y}${i}${a}${S}${y}`;case"**":return T+P(n);case"**/*":return`(?:${T}${P(n)}${i})?${S}${a}${y}`;case"**/*.*":return`(?:${T}${P(n)}${i})?${S}${y}${s}${a}${y}`;case"**/.*":return`(?:${T}${P(n)}${i})?${s}${a}${y}`;default:{let K=/^(.*?)\.(\w+)$/.exec(Q);if(!K)return;let ee=M(K[1]);return ee?ee+s+K[2]:void 0}}},G=Do.removePrefix(t,N),U=M(G);return U&&n.strictSlashes!==!0&&(U+=`${i}?`),U};HM.exports=QA});var qM=A((uUe,VM)=>{"use strict";p();u();l();var iZ=GM(),JA=FM(),$M=Cp(),aZ=bp(),cZ=t=>t&&typeof t=="object"&&!Array.isArray(t),Et=(t,e,n=!1)=>{if(Array.isArray(t)){let f=t.map(m=>Et(m,e,n));return m=>{for(let E of f){let T=E(m);if(T)return T}return!1}}let r=cZ(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},s=o.windows,i=r?Et.compileRe(t,e):Et.makeRe(t,e,!1,!0),a=i.state;delete i.state;let c=()=>!1;if(o.ignore){let f={...e,ignore:null,onMatch:null,onResult:null};c=Et(o.ignore,f,n)}let d=(f,_=!1)=>{let{isMatch:m,match:E,output:T}=Et.test(f,i,e,{glob:t,posix:s}),S={glob:t,state:a,regex:i,posix:s,input:f,output:T,match:E,isMatch:m};return typeof o.onResult=="function"&&o.onResult(S),m===!1?(S.isMatch=!1,_?S:!1):c(f)?(typeof o.onIgnore=="function"&&o.onIgnore(S),S.isMatch=!1,_?S:!1):(typeof o.onMatch=="function"&&o.onMatch(S),_?S:!0)};return n&&(d.state=a),d};Et.test=(t,e,n,{glob:r,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=n||{},i=s.format||(o?$M.toPosixSlashes:null),a=t===r,c=a&&i?i(t):t;return a===!1&&(c=i?i(t):t,a=c===r),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Et.matchBase(t,e,n,o):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Et.matchBase=(t,e,n)=>(e instanceof RegExp?e:Et.makeRe(e,n)).test($M.basename(t));Et.isMatch=(t,e,n)=>Et(e,n)(t);Et.parse=(t,e)=>Array.isArray(t)?t.map(n=>Et.parse(n,e)):JA(t,{...e,fastpaths:!1});Et.scan=(t,e)=>iZ(t,e);Et.compileRe=(t,e,n=!1,r=!1)=>{if(n===!0)return t.output;let o=e||{},s=o.contains?"":"^",i=o.contains?"":"$",a=`${s}(?:${t.output})${i}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Et.toRegex(a,e);return r===!0&&(c.state=t),c};Et.makeRe=(t,e={},n=!1,r=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=JA.fastpaths(t,e)),o.output||(o=JA(t,e)),Et.compileRe(o,e,n,r)};Et.toRegex=(t,e)=>{try{let n=e||{};return new RegExp(t,n.flags||(n.nocase?"i":""))}catch(n){if(e&&e.debug===!0)throw n;return/$^/}};Et.constants=aZ;VM.exports=Et});var zM=A((fUe,KM)=>{"use strict";p();u();l();var YM=qM(),uZ=Cp();function WM(t,e,n=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:uZ.isWindows()}),YM(t,e,n)}Object.assign(WM,YM);KM.exports=WM});function dZ(t,e={}){let n=t.length,r=Array(n),o=Array(n),s=!e.noglobstar;for(let i=0;i<n;i++){let a=ZM(t[i]);r[i]=a;let c=a.length,d=Array(c);for(let f=0;f<c;f++)d[f]=(0,Jc.default)(a[f],e);o[i]=d}return i=>{let a=i.split("/");if(a[0]===".."&&pZ.test(i))return!0;for(let c=0;c<t.length;c++){let d=r[c],f=o[c],_=a.length,m=Math.min(_,d.length),E=0;for(;E<m;){let T=d[E];if(T.includes("/"))return!0;if(!f[E](a[E]))break;if(s&&T==="**")return!0;E++}if(E===_)return!0}return!1}}function XM(t,e,n){if(t===e||e.startsWith(`${t}/`)){if(n){let o=_Z(t)?t.length:t.length+1;return(s,i)=>s.slice(o,i?-1:void 0)||"."}let r=e.slice(t.length+1);return r?(o,s)=>{if(o===".")return r;let i=`${r}/${o}`;return s?i.slice(0,-1):i}:(o,s)=>s&&o!=="."?o.slice(0,-1):o}return n?r=>ao.posix.relative(t,r)||".":r=>ao.posix.relative(t,`${e}/${r}`)||"."}function mZ(t,e){if(e.startsWith(`${t}/`)){let n=e.slice(t.length+1);return r=>`${n}/${r}`}return n=>{let r=ao.posix.relative(t,`${e}/${n}`);return n.endsWith("/")&&r!==""?`${r}/`:r||"."}}function ZM(t){var e;let n=Jc.default.scan(t,hZ);return!((e=n.parts)===null||e===void 0)&&e.length?n.parts:[t]}function RZ(t,e){if(e?.caseSensitiveMatch===!1)return!0;let n=Jc.default.scan(t);return n.isGlob||n.negated}function Qc(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function ZA(t,e,n,r,o){let s=t;t.endsWith("/")&&(s=t.slice(0,-1)),!s.endsWith("*")&&e&&(s+="/**");let i=AZ(n);ao.default.isAbsolute(s.replace(IZ,""))?s=ao.posix.relative(i,s):s=ao.posix.normalize(s);let a=yZ.exec(s),c=ZM(s);if(a?.[0]){let f=(a[0].length+1)/3,_=0,m=i.split("/");for(;_<f&&c[_+f]===m[m.length+_-f];)s=s.slice(0,(f-_-1)*3)+s.slice((f-_)*3+c[_+f].length+1)||".",_++;let E=ao.posix.join(n,a[0].slice(_*3));!E.startsWith(".")&&r.root.length>E.length&&(r.root=E,r.depthOffset=-f+_)}if(!o&&r.depthOffset>=0){var d;(d=r.commonPath)!==null&&d!==void 0||(r.commonPath=c);let f=[],_=Math.min(r.commonPath.length,c.length);for(let m=0;m<_;m++){let E=c[m];if(E==="**"&&!c[m+1]){f.pop();break}if(E!==r.commonPath[m]||RZ(E)||m===c.length-1)break;f.push(E)}r.depthOffset=f.length,r.commonPath=f,r.root=f.length>0?ao.posix.join(n,...f):n}return s}function NZ({patterns:t=["**/*"],ignore:e=[],expandDirectories:n=!0},r,o){typeof t=="string"&&(t=[t]),typeof e=="string"&&(e=[e]);let s=[],i=[];for(let a of e)a&&(a[0]!=="!"||a[1]==="(")&&i.push(ZA(a,n,r,o,!0));for(let a of t)a&&(a[0]!=="!"||a[1]==="("?s.push(ZA(a,n,r,o,!1)):(a[1]!=="!"||a[2]==="(")&&i.push(ZA(a.slice(1),n,r,o,!0)));return{match:s,ignore:i}}function OZ(t,e){for(let n=t.length-1;n>=0;n--){let r=t[n];t[n]=e(r)}return t}function bZ(t){return t?t instanceof URL?(0,QM.fileURLToPath)(t).replace(F_,"/"):ao.default.resolve(t).replace(F_,"/"):process.cwd().replace(F_,"/")}function CZ(t,e={}){let n=process.env.TINYGLOBBY_DEBUG?{...e,debug:!0}:e,r=bZ(n.cwd);if(n.debug&&Qc("globbing with:",{patterns:t,options:n,cwd:r}),Array.isArray(t)&&t.length===0)return[{sync:()=>[],withPromise:async()=>[]},!1];let o={root:r,commonPath:null,depthOffset:0},s=NZ({...n,patterns:t},r,o);n.debug&&Qc("internal processing patterns:",s);let i={dot:n.dot,nobrace:n.braceExpansion===!1,nocase:n.caseSensitiveMatch===!1,noextglob:n.extglob===!1,noglobstar:n.globstar===!1,posix:!0},a=(0,Jc.default)(s.match,{...i,ignore:s.ignore}),c=(0,Jc.default)(s.ignore,i),d=dZ(s.match,i),f=XM(r,o.root,n.absolute),_=n.absolute?f:XM(r,o.root,!0),m={filters:[n.debug?(S,R)=>{let N=f(S,R),y=a(N);return y&&Qc(`matched ${N}`),y}:(S,R)=>a(f(S,R))],exclude:n.debug?(S,R)=>{let N=_(R,!0),y=N!=="."&&!d(N)||c(N);return Qc(y?`skipped ${R}`:`crawling ${R}`),y}:(S,R)=>{let N=_(R,!0);return N!=="."&&!d(N)||c(N)},fs:n.fs?{readdir:n.fs.readdir||Na.default.readdir,readdirSync:n.fs.readdirSync||Na.default.readdirSync,realpath:n.fs.realpath||Na.default.realpath,realpathSync:n.fs.realpathSync||Na.default.realpathSync,stat:n.fs.stat||Na.default.stat,statSync:n.fs.statSync||Na.default.statSync}:void 0,pathSeparator:"/",relativePaths:!0,resolveSymlinks:!0,signal:n.signal};n.deep!==void 0&&(m.maxDepth=Math.round(n.deep-o.depthOffset)),n.absolute&&(m.relativePaths=!1,m.resolvePaths=!0,m.includeBasePath=!0),n.followSymbolicLinks===!1&&(m.resolveSymlinks=!1,m.excludeSymlinks=!0),n.onlyDirectories?(m.excludeFiles=!0,m.includeDirs=!0):n.onlyFiles===!1&&(m.includeDirs=!0),o.root=o.root.replace(F_,"");let E=o.root;n.debug&&Qc("internal properties:",o);let T=r!==E&&!n.absolute&&mZ(r,o.root);return[new NM(m).crawl(E),T]}async function ev(t,e){if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=lZ(t)||typeof t=="string",r=n?e:t,o=n?t:t.patterns,[s,i]=CZ(o,r);return i?OZ(await s.withPromise(),i):s.withPromise()}var Na,ao,QM,Jc,lZ,JM,pZ,fZ,_Z,hZ,EZ,gZ,TZ,SZ,AZ,yZ,IZ,F_,tv=k(()=>{p();u();l();Na=B(require("fs"),1),ao=B(require("path"),1),QM=require("url");OM();Jc=B(zM(),1),lZ=Array.isArray,JM=process.platform==="win32",pZ=/^(\/?\.\.)+$/;fZ=/^[A-Z]:\/$/i,_Z=JM?t=>fZ.test(t):t=>t==="/";hZ={parts:!0};EZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,gZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,TZ=t=>t.replace(EZ,"\\$&"),SZ=t=>t.replace(gZ,"\\$&"),AZ=JM?SZ:TZ;yZ=/^(\/?\.\.)+/,IZ=/\\(?=[()[\]{}!*+?@|])/g,F_=/\\/g});var $_,Oa,nv,eR,tR,PZ,MZ,p=k(()=>{"use strict";$_=require("node:child_process"),Oa=require("node:fs/promises"),nv=require("node:sqlite");tv();eR=class{stmt;constructor(e){this.stmt=e}get(...e){return this.stmt.get(...e)}all(...e){return this.stmt.all(...e)}run(...e){this.stmt.run(...e)}},tR=class{db;constructor(e){this.db=new nv.DatabaseSync(e)}exec(e){this.db.exec(e)}query(e){return new eR(this.db.prepare(e))}close(){this.db.close()}},PZ={Database:tR};globalThis.__bun_sqlite_polyfill=PZ;MZ={file(t){return{async exists(){try{return await(0,Oa.access)(t),!0}catch{return!1}},text(){return(0,Oa.readFile)(t,"utf-8")},async json(){let e=await(0,Oa.readFile)(t,"utf-8");return JSON.parse(e)}}},async write(t,e){await(0,Oa.writeFile)(t,e,"utf-8")},which(t){try{let n=process.platform==="win32"?`where ${t}`:`which ${t}`;return(0,$_.execSync)(n,{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).trim().split(`
1
+ #!/usr/bin/env node
2
+ var w8=Object.create;var B_=Object.defineProperty;var U8=Object.getOwnPropertyDescriptor;var k8=Object.getOwnPropertyNames;var B8=Object.getPrototypeOf,G8=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(t&&(e=t(t=0)),e);var A=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zc=(t,e)=>{for(var n in e)B_(t,n,{get:e[n],enumerable:!0})},_M=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k8(e))!G8.call(t,o)&&o!==n&&B_(t,o,{get:()=>e[o],enumerable:!(r=U8(e,o))||r.enumerable});return t};var B=(t,e,n)=>(n=t!=null?w8(B8(t)):{},_M(e||!t||!t.__esModule?B_(n,"default",{value:t,enumerable:!0}):n,t)),v=t=>_M(B_({},"__esModule",{value:!0}),t);var h,u=k(()=>{"use strict";h=require("node:url").pathToFileURL(__filename).href});var j8,l=k(()=>{j8=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};j8.SENTRY_RELEASE={id:"0.3.3"}});function F8(t){let e=(0,Cn.normalize)(t);return e.length>1&&e[e.length-1]===Cn.sep&&(e=e.substring(0,e.length-1)),e}function gM(t,e){return t.replace($8,e)}function q8(t){return t==="/"||V8.test(t)}function $A(t,e){let{resolvePaths:n,normalizePath:r,pathSeparator:o}=e,s=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(n&&(t=(0,Cn.resolve)(t)),(r||s)&&(t=F8(t)),t===".")return"";let i=t[t.length-1]!==o;return gM(i?t+o:t,o)}function TM(t,e){return e+t}function Y8(t,e){return function(n,r){return r.startsWith(t)?r.slice(t.length)+n:gM((0,Cn.relative)(t,r),e.pathSeparator)+e.pathSeparator+n}}function W8(t){return t}function K8(t,e,n){return e+t+n}function z8(t,e){let{relativePaths:n,includeBasePath:r}=e;return n&&t?Y8(t,e):r?TM:W8}function X8(t){return function(e,n){n.push(e.substring(t.length)||".")}}function Q8(t){return function(e,n,r){let o=e.substring(t.length)||".";r.every(s=>s(o,!0))&&n.push(o)}}function tJ(t,e){let{includeDirs:n,filters:r,relativePaths:o}=e;return n?o?r&&r.length?Q8(t):X8(t):r&&r.length?Z8:J8:eJ}function aJ(t){let{excludeFiles:e,filters:n,onlyCounts:r}=t;return e?iJ:n&&n.length?r?nJ:rJ:r?oJ:sJ}function lJ(t){return t.group?uJ:cJ}function fJ(t){return t.group?pJ:dJ}function hJ(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?mJ:_J}function SM(t,e,n){if(n.options.useRealPaths)return EJ(e,n);let r=(0,Cn.dirname)(t),o=1;for(;r!==n.root&&o<2;){let s=n.symlinks.get(r);!!s&&(s===e||s.startsWith(e)||e.startsWith(s))?o++:r=(0,Cn.dirname)(r)}return n.symlinks.set(t,e),o>1}function EJ(t,e){return e.visited.includes(t+e.options.pathSeparator)}function G_(t,e,n,r){e(t&&!r?t:null,n)}function OJ(t,e){let{onlyCounts:n,group:r,maxFiles:o}=t;return n?e?gJ:RJ:r?e?TJ:NJ:o?e?AJ:IJ:e?SJ:yJ}function PJ(t){return t?CJ:bJ}function LJ(t,e){return new Promise((n,r)=>{yM(t,e,(o,s)=>{if(o)return r(o);n(s)})})}function yM(t,e,n){new RM(t,e,n).start()}function DJ(t,e){return new RM(t,e).start()}var EM,Cn,H8,mM,$8,V8,J8,Z8,eJ,nJ,rJ,oJ,sJ,iJ,cJ,uJ,pJ,dJ,_J,mJ,gJ,TJ,SJ,AJ,RJ,yJ,IJ,NJ,AM,bJ,CJ,MJ,vJ,xJ,RM,hM,IM,NM,OM=k(()=>{p();u();l();EM=require("module"),Cn=require("path"),H8=B(require("fs"),1),mM=(0,EM.createRequire)(h);$8=/[\\/]/g;V8=/^[a-z]:[\\/]$/i;J8=(t,e)=>{e.push(t||".")},Z8=(t,e,n)=>{let r=t||".";n.every(o=>o(r,!0))&&e.push(r)},eJ=()=>{};nJ=(t,e,n,r)=>{r.every(o=>o(t,!1))&&n.files++},rJ=(t,e,n,r)=>{r.every(o=>o(t,!1))&&e.push(t)},oJ=(t,e,n,r)=>{n.files++},sJ=(t,e)=>{e.push(t)},iJ=()=>{};cJ=t=>t,uJ=()=>[""].slice(0,0);pJ=(t,e,n)=>{t.push({directory:e,files:n,dir:e})},dJ=()=>{};_J=function(t,e,n){let{queue:r,fs:o,options:{suppressErrors:s}}=e;r.enqueue(),o.realpath(t,(i,a)=>{if(i)return r.dequeue(s?null:i,e);o.stat(a,(c,d)=>{if(c)return r.dequeue(s?null:c,e);if(d.isDirectory()&&SM(t,a,e))return r.dequeue(null,e);n(d,a),r.dequeue(null,e)})})},mJ=function(t,e,n){let{queue:r,fs:o,options:{suppressErrors:s}}=e;r.enqueue();try{let i=o.realpathSync(t),a=o.statSync(i);if(a.isDirectory()&&SM(t,i,e))return;n(a,i)}catch(i){if(!s)throw i}};gJ=t=>t.counts,TJ=t=>t.groups,SJ=t=>t.paths,AJ=t=>t.paths.slice(0,t.options.maxFiles),RJ=(t,e,n)=>(G_(e,n,t.counts,t.options.suppressErrors),null),yJ=(t,e,n)=>(G_(e,n,t.paths,t.options.suppressErrors),null),IJ=(t,e,n)=>(G_(e,n,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),NJ=(t,e,n)=>(G_(e,n,t.groups,t.options.suppressErrors),null);AM={withFileTypes:!0},bJ=(t,e,n,r,o)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);let{fs:s}=t;t.visited.push(e),t.counts.directories++,s.readdir(e||".",AM,(i,a=[])=>{o(a,n,r),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},CJ=(t,e,n,r,o)=>{let{fs:s}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let i=[];try{i=s.readdirSync(e||".",AM)}catch(a){if(!t.options.suppressErrors)throw a}o(i,n,r)};MJ=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},vJ=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},xJ=class{aborted=!1;abort(){this.aborted=!0}},RM=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,n){this.isSynchronous=!n,this.callbackInvoker=OJ(e,this.isSynchronous),this.root=$A(t,e),this.state={root:q8(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new vJ,options:e,queue:new MJ((r,o)=>this.callbackInvoker(o,r,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new xJ,fs:e.fs||H8},this.joinPath=z8(this.root,e),this.pushDirectory=tJ(this.root,e),this.pushFile=aJ(e),this.getArray=lJ(e),this.groupFiles=fJ(e),this.resolveSymlink=hJ(e,this.isSynchronous),this.walkDirectory=PJ(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,n)=>{let{paths:r,options:{filters:o,resolveSymlinks:s,excludeSymlinks:i,exclude:a,maxFiles:c,signal:d,useRealPaths:f,pathSeparator:_},controller:m}=this.state;if(m.aborted||d&&d.aborted||c&&r.length>c)return;let E=this.getArray(this.state.paths);for(let T=0;T<t.length;++T){let S=t[T];if(S.isFile()||S.isSymbolicLink()&&!s&&!i){let R=this.joinPath(S.name,e);this.pushFile(R,E,this.state.counts,o)}else if(S.isDirectory()){let R=K8(S.name,e,this.state.options.pathSeparator);if(a&&a(S.name,R))continue;this.pushDirectory(R,r,o),this.walkDirectory(this.state,R,R,n-1,this.walk)}else if(this.resolveSymlink&&S.isSymbolicLink()){let R=TM(S.name,e);this.resolveSymlink(R,this.state,(N,y)=>{if(N.isDirectory()){if(y=$A(y,this.state.options),a&&a(S.name,f?y:R+_))return;this.walkDirectory(this.state,y,f?y:R+_,n-1,this.walk)}else{y=f?y:R;let P=(0,Cn.basename)(y),M=$A((0,Cn.dirname)(y),this.state.options);y=this.joinPath(P,M),this.pushFile(y,E,this.state.counts,o)}})}}this.groupFiles(this.state.groups,e,E)}};hM=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return LJ(this.root,this.options)}withCallback(t){yM(this.root,this.options,t)}sync(){return DJ(this.root,this.options)}},IM=null;try{mM.resolve("picomatch"),IM=mM("picomatch")}catch{}NM=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Cn.sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new hM(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new hM(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let n=this.globFunction||IM;if(!n)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=n(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(o=>r(o)),this}}});var bp=A((Wwe,vM)=>{"use strict";p();u();l();var bM="[^\\\\/]",wJ="(?=.)",CM="[^/]",VA="(?:\\/|$)",PM="(?:^|\\/)",qA=`\\.{1,2}${VA}`,UJ="(?!\\.)",kJ=`(?!${PM}${qA})`,BJ=`(?!\\.{0,1}${VA})`,GJ=`(?!${qA})`,jJ="[^.\\/]",HJ=`${CM}*?`,FJ="/",MM={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:wJ,QMARK:CM,END_ANCHOR:VA,DOTS_SLASH:qA,NO_DOT:UJ,NO_DOTS:kJ,NO_DOT_SLASH:BJ,NO_DOTS_SLASH:GJ,QMARK_NO_DOT:jJ,STAR:HJ,START_ANCHOR:PM,SEP:FJ},$J={...MM,SLASH_LITERAL:"[\\\\/]",QMARK:bM,STAR:`${bM}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},VJ={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};vM.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:VJ,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?$J:MM}}});var Cp=A(Wn=>{"use strict";p();u();l();var{REGEX_BACKSLASH:qJ,REGEX_REMOVE_BACKSLASH:YJ,REGEX_SPECIAL_CHARS:WJ,REGEX_SPECIAL_CHARS_GLOBAL:KJ}=bp();Wn.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Wn.hasRegexChars=t=>WJ.test(t);Wn.isRegexChar=t=>t.length===1&&Wn.hasRegexChars(t);Wn.escapeRegex=t=>t.replace(KJ,"\\$1");Wn.toPosixSlashes=t=>t.replace(qJ,"/");Wn.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Wn.removeBackslashes=t=>t.replace(YJ,e=>e==="\\"?"":e);Wn.escapeLast=(t,e,n)=>{let r=t.lastIndexOf(e,n);return r===-1?t:t[r-1]==="\\"?Wn.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};Wn.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n};Wn.wrapOutput=(t,e={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${t})${o}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s};Wn.basename=(t,{windows:e}={})=>{let n=t.split(e?/[\\/]/:"/"),r=n[n.length-1];return r===""?n[n.length-2]:r}});var GM=A((tUe,BM)=>{"use strict";p();u();l();var xM=Cp(),{CHAR_ASTERISK:YA,CHAR_AT:zJ,CHAR_BACKWARD_SLASH:Pp,CHAR_COMMA:XJ,CHAR_DOT:WA,CHAR_EXCLAMATION_MARK:KA,CHAR_FORWARD_SLASH:kM,CHAR_LEFT_CURLY_BRACE:zA,CHAR_LEFT_PARENTHESES:XA,CHAR_LEFT_SQUARE_BRACKET:QJ,CHAR_PLUS:JJ,CHAR_QUESTION_MARK:LM,CHAR_RIGHT_CURLY_BRACE:ZJ,CHAR_RIGHT_PARENTHESES:DM,CHAR_RIGHT_SQUARE_BRACKET:eZ}=bp(),wM=t=>t===kM||t===Pp,UM=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},tZ=(t,e)=>{let n=e||{},r=t.length-1,o=n.parts===!0||n.scanToEnd===!0,s=[],i=[],a=[],c=t,d=-1,f=0,_=0,m=!1,E=!1,T=!1,S=!1,R=!1,N=!1,y=!1,P=!1,M=!1,G=!1,U=0,Q,K,ee={value:"",depth:0,isGlob:!1},O=()=>d>=r,at=()=>c.charCodeAt(d+1),je=()=>(Q=K,c.charCodeAt(++d));for(;d<r;){K=je();let Pe;if(K===Pp){y=ee.backslashes=!0,K=je(),K===zA&&(N=!0);continue}if(N===!0||K===zA){for(U++;O()!==!0&&(K=je());){if(K===Pp){y=ee.backslashes=!0,je();continue}if(K===zA){U++;continue}if(N!==!0&&K===WA&&(K=je())===WA){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(N!==!0&&K===XJ){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===ZJ&&(U--,U===0)){N=!1,m=ee.isBrace=!0,G=!0;break}}if(o===!0)continue;break}if(K===kM){if(s.push(d),i.push(ee),ee={value:"",depth:0,isGlob:!1},G===!0)continue;if(Q===WA&&d===f+1){f+=2;continue}_=d+1;continue}if(n.noext!==!0&&(K===JJ||K===zJ||K===YA||K===LM||K===KA)===!0&&at()===XA){if(T=ee.isGlob=!0,S=ee.isExtglob=!0,G=!0,K===KA&&d===f&&(M=!0),o===!0){for(;O()!==!0&&(K=je());){if(K===Pp){y=ee.backslashes=!0,K=je();continue}if(K===DM){T=ee.isGlob=!0,G=!0;break}}continue}break}if(K===YA){if(Q===YA&&(R=ee.isGlobstar=!0),T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===LM){if(T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===QJ){for(;O()!==!0&&(Pe=je());){if(Pe===Pp){y=ee.backslashes=!0,je();continue}if(Pe===eZ){E=ee.isBracket=!0,T=ee.isGlob=!0,G=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&K===KA&&d===f){P=ee.negated=!0,f++;continue}if(n.noparen!==!0&&K===XA){if(T=ee.isGlob=!0,o===!0){for(;O()!==!0&&(K=je());){if(K===XA){y=ee.backslashes=!0,K=je();continue}if(K===DM){G=!0;break}}continue}break}if(T===!0){if(G=!0,o===!0)continue;break}}n.noext===!0&&(S=!1,T=!1);let Te=c,b="",C="";f>0&&(b=c.slice(0,f),c=c.slice(f),_-=f),Te&&T===!0&&_>0?(Te=c.slice(0,_),C=c.slice(_)):T===!0?(Te="",C=c):Te=c,Te&&Te!==""&&Te!=="/"&&Te!==c&&wM(Te.charCodeAt(Te.length-1))&&(Te=Te.slice(0,-1)),n.unescape===!0&&(C&&(C=xM.removeBackslashes(C)),Te&&y===!0&&(Te=xM.removeBackslashes(Te)));let On={prefix:b,input:t,start:f,base:Te,glob:C,isBrace:m,isBracket:E,isGlob:T,isExtglob:S,isGlobstar:R,negated:P,negatedExtglob:M};if(n.tokens===!0&&(On.maxDepth=0,wM(K)||i.push(ee),On.tokens=i),n.parts===!0||n.tokens===!0){let Pe;for(let Fe=0;Fe<s.length;Fe++){let Or=Pe?Pe+1:f,br=s[Fe],Js=t.slice(Or,br);n.tokens&&(Fe===0&&f!==0?(i[Fe].isPrefix=!0,i[Fe].value=b):i[Fe].value=Js,UM(i[Fe]),On.maxDepth+=i[Fe].depth),(Fe!==0||Js!=="")&&a.push(Js),Pe=br}if(Pe&&Pe+1<t.length){let Fe=t.slice(Pe+1);a.push(Fe),n.tokens&&(i[i.length-1].value=Fe,UM(i[i.length-1]),On.maxDepth+=i[i.length-1].depth)}On.slashes=s,On.parts=a}return On};BM.exports=tZ});var FM=A((sUe,HM)=>{"use strict";p();u();l();var j_=bp(),Do=Cp(),{MAX_LENGTH:H_,POSIX_REGEX_SOURCE:nZ,REGEX_NON_SPECIAL_CHARS:rZ,REGEX_SPECIAL_CHARS_BACKREF:oZ,REPLACEMENTS:jM}=j_,sZ=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let n=`[${t.join("-")}]`;try{new RegExp(n)}catch{return t.map(o=>Do.escapeRegex(o)).join("..")}return n},Xc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,QA=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=jM[t]||t;let n={...e},r=typeof n.maxLength=="number"?Math.min(H_,n.maxLength):H_,o=t.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);let s={type:"bos",value:"",output:n.prepend||""},i=[s],a=n.capture?"":"?:",c=j_.globChars(n.windows),d=j_.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:_,SLASH_LITERAL:m,ONE_CHAR:E,DOTS_SLASH:T,NO_DOT:S,NO_DOT_SLASH:R,NO_DOTS_SLASH:N,QMARK:y,QMARK_NO_DOT:P,STAR:M,START_ANCHOR:G}=c,U=z=>`(${a}(?:(?!${G}${z.dot?T:f}).)*?)`,Q=n.dot?"":S,K=n.dot?y:P,ee=n.bash===!0?U(n):M;n.capture&&(ee=`(${ee})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let O={input:t,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=Do.removePrefix(t,O),o=t.length;let at=[],je=[],Te=[],b=s,C,On=()=>O.index===o-1,Pe=O.peek=(z=1)=>t[O.index+z],Fe=O.advance=()=>t[++O.index]||"",Or=()=>t.slice(O.index+1),br=(z="",We=0)=>{O.consumed+=z,O.index+=We},Js=z=>{O.output+=z.output!=null?z.output:z.value,br(z.value)},L8=()=>{let z=1;for(;Pe()==="!"&&(Pe(2)!=="("||Pe(3)==="?");)Fe(),O.start++,z++;return z%2===0?!1:(O.negated=!0,O.start++,!0)},w_=z=>{O[z]++,Te.push(z)},Ia=z=>{O[z]--,Te.pop()},Ne=z=>{if(b.type==="globstar"){let We=O.braces>0&&(z.type==="comma"||z.type==="brace"),H=z.extglob===!0||at.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!We&&!H&&(O.output=O.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=ee,O.output+=b.output)}if(at.length&&z.type!=="paren"&&(at[at.length-1].inner+=z.value),(z.value||z.output)&&Js(z),b&&b.type==="text"&&z.type==="text"){b.output=(b.output||b.value)+z.value,b.value+=z.value;return}z.prev=b,i.push(z),b=z},U_=(z,We)=>{let H={...d[We],conditions:1,inner:""};H.prev=b,H.parens=O.parens,H.output=O.output;let Se=(n.capture?"(":"")+H.open;w_("parens"),Ne({type:z,value:We,output:O.output?"":E}),Ne({type:"paren",extglob:!0,value:Fe(),output:Se}),at.push(H)},D8=z=>{let We=z.close+(n.capture?")":""),H;if(z.type==="negate"){let Se=ee;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(Se=U(n)),(Se!==ee||On()||/^\)+$/.test(Or()))&&(We=z.close=`)$))${Se}`),z.inner.includes("*")&&(H=Or())&&/^\.[^\\/.]+$/.test(H)){let nt=QA(H,{...e,fastpaths:!1}).output;We=z.close=`)${nt})${Se})`}z.prev.type==="bos"&&(O.negatedExtglob=!0)}Ne({type:"paren",extglob:!0,value:C,output:We}),Ia("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,We=t.replace(oZ,(H,Se,nt,bn,Ut,FA)=>bn==="\\"?(z=!0,H):bn==="?"?Se?Se+bn+(Ut?y.repeat(Ut.length):""):FA===0?K+(Ut?y.repeat(Ut.length):""):y.repeat(nt.length):bn==="."?f.repeat(nt.length):bn==="*"?Se?Se+bn+(Ut?ee:""):ee:Se?H:`\\${H}`);return z===!0&&(n.unescape===!0?We=We.replace(/\\/g,""):We=We.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),We===t&&n.contains===!0?(O.output=t,O):(O.output=Do.wrapOutput(We,O,e),O)}for(;!On();){if(C=Fe(),C==="\0")continue;if(C==="\\"){let H=Pe();if(H==="/"&&n.bash!==!0||H==="."||H===";")continue;if(!H){C+="\\",Ne({type:"text",value:C});continue}let Se=/^\\+/.exec(Or()),nt=0;if(Se&&Se[0].length>2&&(nt=Se[0].length,O.index+=nt,nt%2!==0&&(C+="\\")),n.unescape===!0?C=Fe():C+=Fe(),O.brackets===0){Ne({type:"text",value:C});continue}}if(O.brackets>0&&(C!=="]"||b.value==="["||b.value==="[^")){if(n.posix!==!1&&C===":"){let H=b.value.slice(1);if(H.includes("[")&&(b.posix=!0,H.includes(":"))){let Se=b.value.lastIndexOf("["),nt=b.value.slice(0,Se),bn=b.value.slice(Se+2),Ut=nZ[bn];if(Ut){b.value=nt+Ut,O.backtrack=!0,Fe(),!s.output&&i.indexOf(b)===1&&(s.output=E);continue}}}(C==="["&&Pe()!==":"||C==="-"&&Pe()==="]")&&(C=`\\${C}`),C==="]"&&(b.value==="["||b.value==="[^")&&(C=`\\${C}`),n.posix===!0&&C==="!"&&b.value==="["&&(C="^"),b.value+=C,Js({value:C});continue}if(O.quotes===1&&C!=='"'){C=Do.escapeRegex(C),b.value+=C,Js({value:C});continue}if(C==='"'){O.quotes=O.quotes===1?0:1,n.keepQuotes===!0&&Ne({type:"text",value:C});continue}if(C==="("){w_("parens"),Ne({type:"paren",value:C});continue}if(C===")"){if(O.parens===0&&n.strictBrackets===!0)throw new SyntaxError(Xc("opening","("));let H=at[at.length-1];if(H&&O.parens===H.parens+1){D8(at.pop());continue}Ne({type:"paren",value:C,output:O.parens?")":"\\)"}),Ia("parens");continue}if(C==="["){if(n.nobracket===!0||!Or().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(Xc("closing","]"));C=`\\${C}`}else w_("brackets");Ne({type:"bracket",value:C});continue}if(C==="]"){if(n.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){Ne({type:"text",value:C,output:`\\${C}`});continue}if(O.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(Xc("opening","["));Ne({type:"text",value:C,output:`\\${C}`});continue}Ia("brackets");let H=b.value.slice(1);if(b.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(C=`/${C}`),b.value+=C,Js({value:C}),n.literalBrackets===!1||Do.hasRegexChars(H))continue;let Se=Do.escapeRegex(b.value);if(O.output=O.output.slice(0,-b.value.length),n.literalBrackets===!0){O.output+=Se,b.value=Se;continue}b.value=`(${a}${Se}|${b.value})`,O.output+=b.value;continue}if(C==="{"&&n.nobrace!==!0){w_("braces");let H={type:"brace",value:C,output:"(",outputIndex:O.output.length,tokensIndex:O.tokens.length};je.push(H),Ne(H);continue}if(C==="}"){let H=je[je.length-1];if(n.nobrace===!0||!H){Ne({type:"text",value:C,output:C});continue}let Se=")";if(H.dots===!0){let nt=i.slice(),bn=[];for(let Ut=nt.length-1;Ut>=0&&(i.pop(),nt[Ut].type!=="brace");Ut--)nt[Ut].type!=="dots"&&bn.unshift(nt[Ut].value);Se=sZ(bn,n),O.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let nt=O.output.slice(0,H.outputIndex),bn=O.tokens.slice(H.tokensIndex);H.value=H.output="\\{",C=Se="\\}",O.output=nt;for(let Ut of bn)O.output+=Ut.output||Ut.value}Ne({type:"brace",value:C,output:Se}),Ia("braces"),je.pop();continue}if(C==="|"){at.length>0&&at[at.length-1].conditions++,Ne({type:"text",value:C});continue}if(C===","){let H=C,Se=je[je.length-1];Se&&Te[Te.length-1]==="braces"&&(Se.comma=!0,H="|"),Ne({type:"comma",value:C,output:H});continue}if(C==="/"){if(b.type==="dot"&&O.index===O.start+1){O.start=O.index+1,O.consumed="",O.output="",i.pop(),b=s;continue}Ne({type:"slash",value:C,output:m});continue}if(C==="."){if(O.braces>0&&b.type==="dot"){b.value==="."&&(b.output=f);let H=je[je.length-1];b.type="dots",b.output+=C,b.value+=C,H.dots=!0;continue}if(O.braces+O.parens===0&&b.type!=="bos"&&b.type!=="slash"){Ne({type:"text",value:C,output:f});continue}Ne({type:"dot",value:C,output:f});continue}if(C==="?"){if(!(b&&b.value==="(")&&n.noextglob!==!0&&Pe()==="("&&Pe(2)!=="?"){U_("qmark",C);continue}if(b&&b.type==="paren"){let Se=Pe(),nt=C;(b.value==="("&&!/[!=<:]/.test(Se)||Se==="<"&&!/<([!=]|\w+>)/.test(Or()))&&(nt=`\\${C}`),Ne({type:"text",value:C,output:nt});continue}if(n.dot!==!0&&(b.type==="slash"||b.type==="bos")){Ne({type:"qmark",value:C,output:P});continue}Ne({type:"qmark",value:C,output:y});continue}if(C==="!"){if(n.noextglob!==!0&&Pe()==="("&&(Pe(2)!=="?"||!/[!=<:]/.test(Pe(3)))){U_("negate",C);continue}if(n.nonegate!==!0&&O.index===0){L8();continue}}if(C==="+"){if(n.noextglob!==!0&&Pe()==="("&&Pe(2)!=="?"){U_("plus",C);continue}if(b&&b.value==="("||n.regex===!1){Ne({type:"plus",value:C,output:_});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||O.parens>0){Ne({type:"plus",value:C});continue}Ne({type:"plus",value:_});continue}if(C==="@"){if(n.noextglob!==!0&&Pe()==="("&&Pe(2)!=="?"){Ne({type:"at",extglob:!0,value:C,output:""});continue}Ne({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let H=rZ.exec(Or());H&&(C+=H[0],O.index+=H[0].length),Ne({type:"text",value:C});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=C,b.output=ee,O.backtrack=!0,O.globstar=!0,br(C);continue}let z=Or();if(n.noextglob!==!0&&/^\([^?]/.test(z)){U_("star",C);continue}if(b.type==="star"){if(n.noglobstar===!0){br(C);continue}let H=b.prev,Se=H.prev,nt=H.type==="slash"||H.type==="bos",bn=Se&&(Se.type==="star"||Se.type==="globstar");if(n.bash===!0&&(!nt||z[0]&&z[0]!=="/")){Ne({type:"star",value:C,output:""});continue}let Ut=O.braces>0&&(H.type==="comma"||H.type==="brace"),FA=at.length&&(H.type==="pipe"||H.type==="paren");if(!nt&&H.type!=="paren"&&!Ut&&!FA){Ne({type:"star",value:C,output:""});continue}for(;z.slice(0,3)==="/**";){let k_=t[O.index+4];if(k_&&k_!=="/")break;z=z.slice(3),br("/**",3)}if(H.type==="bos"&&On()){b.type="globstar",b.value+=C,b.output=U(n),O.output=b.output,O.globstar=!0,br(C);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!bn&&On()){O.output=O.output.slice(0,-(H.output+b.output).length),H.output=`(?:${H.output}`,b.type="globstar",b.output=U(n)+(n.strictSlashes?")":"|$)"),b.value+=C,O.globstar=!0,O.output+=H.output+b.output,br(C);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&z[0]==="/"){let k_=z[1]!==void 0?"|$":"";O.output=O.output.slice(0,-(H.output+b.output).length),H.output=`(?:${H.output}`,b.type="globstar",b.output=`${U(n)}${m}|${m}${k_})`,b.value+=C,O.output+=H.output+b.output,O.globstar=!0,br(C+Fe()),Ne({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&z[0]==="/"){b.type="globstar",b.value+=C,b.output=`(?:^|${m}|${U(n)}${m})`,O.output=b.output,O.globstar=!0,br(C+Fe()),Ne({type:"slash",value:"/",output:""});continue}O.output=O.output.slice(0,-b.output.length),b.type="globstar",b.output=U(n),b.value+=C,O.output+=b.output,O.globstar=!0,br(C);continue}let We={type:"star",value:C,output:ee};if(n.bash===!0){We.output=".*?",(b.type==="bos"||b.type==="slash")&&(We.output=Q+We.output),Ne(We);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&n.regex===!0){We.output=C,Ne(We);continue}(O.index===O.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(O.output+=R,b.output+=R):n.dot===!0?(O.output+=N,b.output+=N):(O.output+=Q,b.output+=Q),Pe()!=="*"&&(O.output+=E,b.output+=E)),Ne(We)}for(;O.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(Xc("closing","]"));O.output=Do.escapeLast(O.output,"["),Ia("brackets")}for(;O.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(Xc("closing",")"));O.output=Do.escapeLast(O.output,"("),Ia("parens")}for(;O.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(Xc("closing","}"));O.output=Do.escapeLast(O.output,"{"),Ia("braces")}if(n.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&Ne({type:"maybe_slash",value:"",output:`${m}?`}),O.backtrack===!0){O.output="";for(let z of O.tokens)O.output+=z.output!=null?z.output:z.value,z.suffix&&(O.output+=z.suffix)}return O};QA.fastpaths=(t,e)=>{let n={...e},r=typeof n.maxLength=="number"?Math.min(H_,n.maxLength):H_,o=t.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);t=jM[t]||t;let{DOT_LITERAL:s,SLASH_LITERAL:i,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:d,NO_DOTS:f,NO_DOTS_SLASH:_,STAR:m,START_ANCHOR:E}=j_.globChars(n.windows),T=n.dot?f:d,S=n.dot?_:d,R=n.capture?"":"?:",N={negated:!1,prefix:""},y=n.bash===!0?".*?":m;n.capture&&(y=`(${y})`);let P=Q=>Q.noglobstar===!0?y:`(${R}(?:(?!${E}${Q.dot?c:s}).)*?)`,M=Q=>{switch(Q){case"*":return`${T}${a}${y}`;case".*":return`${s}${a}${y}`;case"*.*":return`${T}${y}${s}${a}${y}`;case"*/*":return`${T}${y}${i}${a}${S}${y}`;case"**":return T+P(n);case"**/*":return`(?:${T}${P(n)}${i})?${S}${a}${y}`;case"**/*.*":return`(?:${T}${P(n)}${i})?${S}${y}${s}${a}${y}`;case"**/.*":return`(?:${T}${P(n)}${i})?${s}${a}${y}`;default:{let K=/^(.*?)\.(\w+)$/.exec(Q);if(!K)return;let ee=M(K[1]);return ee?ee+s+K[2]:void 0}}},G=Do.removePrefix(t,N),U=M(G);return U&&n.strictSlashes!==!0&&(U+=`${i}?`),U};HM.exports=QA});var qM=A((uUe,VM)=>{"use strict";p();u();l();var iZ=GM(),JA=FM(),$M=Cp(),aZ=bp(),cZ=t=>t&&typeof t=="object"&&!Array.isArray(t),Et=(t,e,n=!1)=>{if(Array.isArray(t)){let f=t.map(m=>Et(m,e,n));return m=>{for(let E of f){let T=E(m);if(T)return T}return!1}}let r=cZ(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},s=o.windows,i=r?Et.compileRe(t,e):Et.makeRe(t,e,!1,!0),a=i.state;delete i.state;let c=()=>!1;if(o.ignore){let f={...e,ignore:null,onMatch:null,onResult:null};c=Et(o.ignore,f,n)}let d=(f,_=!1)=>{let{isMatch:m,match:E,output:T}=Et.test(f,i,e,{glob:t,posix:s}),S={glob:t,state:a,regex:i,posix:s,input:f,output:T,match:E,isMatch:m};return typeof o.onResult=="function"&&o.onResult(S),m===!1?(S.isMatch=!1,_?S:!1):c(f)?(typeof o.onIgnore=="function"&&o.onIgnore(S),S.isMatch=!1,_?S:!1):(typeof o.onMatch=="function"&&o.onMatch(S),_?S:!0)};return n&&(d.state=a),d};Et.test=(t,e,n,{glob:r,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=n||{},i=s.format||(o?$M.toPosixSlashes:null),a=t===r,c=a&&i?i(t):t;return a===!1&&(c=i?i(t):t,a=c===r),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Et.matchBase(t,e,n,o):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Et.matchBase=(t,e,n)=>(e instanceof RegExp?e:Et.makeRe(e,n)).test($M.basename(t));Et.isMatch=(t,e,n)=>Et(e,n)(t);Et.parse=(t,e)=>Array.isArray(t)?t.map(n=>Et.parse(n,e)):JA(t,{...e,fastpaths:!1});Et.scan=(t,e)=>iZ(t,e);Et.compileRe=(t,e,n=!1,r=!1)=>{if(n===!0)return t.output;let o=e||{},s=o.contains?"":"^",i=o.contains?"":"$",a=`${s}(?:${t.output})${i}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Et.toRegex(a,e);return r===!0&&(c.state=t),c};Et.makeRe=(t,e={},n=!1,r=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=JA.fastpaths(t,e)),o.output||(o=JA(t,e)),Et.compileRe(o,e,n,r)};Et.toRegex=(t,e)=>{try{let n=e||{};return new RegExp(t,n.flags||(n.nocase?"i":""))}catch(n){if(e&&e.debug===!0)throw n;return/$^/}};Et.constants=aZ;VM.exports=Et});var zM=A((fUe,KM)=>{"use strict";p();u();l();var YM=qM(),uZ=Cp();function WM(t,e,n=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:uZ.isWindows()}),YM(t,e,n)}Object.assign(WM,YM);KM.exports=WM});function dZ(t,e={}){let n=t.length,r=Array(n),o=Array(n),s=!e.noglobstar;for(let i=0;i<n;i++){let a=ZM(t[i]);r[i]=a;let c=a.length,d=Array(c);for(let f=0;f<c;f++)d[f]=(0,Jc.default)(a[f],e);o[i]=d}return i=>{let a=i.split("/");if(a[0]===".."&&pZ.test(i))return!0;for(let c=0;c<t.length;c++){let d=r[c],f=o[c],_=a.length,m=Math.min(_,d.length),E=0;for(;E<m;){let T=d[E];if(T.includes("/"))return!0;if(!f[E](a[E]))break;if(s&&T==="**")return!0;E++}if(E===_)return!0}return!1}}function XM(t,e,n){if(t===e||e.startsWith(`${t}/`)){if(n){let o=_Z(t)?t.length:t.length+1;return(s,i)=>s.slice(o,i?-1:void 0)||"."}let r=e.slice(t.length+1);return r?(o,s)=>{if(o===".")return r;let i=`${r}/${o}`;return s?i.slice(0,-1):i}:(o,s)=>s&&o!=="."?o.slice(0,-1):o}return n?r=>ao.posix.relative(t,r)||".":r=>ao.posix.relative(t,`${e}/${r}`)||"."}function mZ(t,e){if(e.startsWith(`${t}/`)){let n=e.slice(t.length+1);return r=>`${n}/${r}`}return n=>{let r=ao.posix.relative(t,`${e}/${n}`);return n.endsWith("/")&&r!==""?`${r}/`:r||"."}}function ZM(t){var e;let n=Jc.default.scan(t,hZ);return!((e=n.parts)===null||e===void 0)&&e.length?n.parts:[t]}function RZ(t,e){if(e?.caseSensitiveMatch===!1)return!0;let n=Jc.default.scan(t);return n.isGlob||n.negated}function Qc(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function ZA(t,e,n,r,o){let s=t;t.endsWith("/")&&(s=t.slice(0,-1)),!s.endsWith("*")&&e&&(s+="/**");let i=AZ(n);ao.default.isAbsolute(s.replace(IZ,""))?s=ao.posix.relative(i,s):s=ao.posix.normalize(s);let a=yZ.exec(s),c=ZM(s);if(a?.[0]){let f=(a[0].length+1)/3,_=0,m=i.split("/");for(;_<f&&c[_+f]===m[m.length+_-f];)s=s.slice(0,(f-_-1)*3)+s.slice((f-_)*3+c[_+f].length+1)||".",_++;let E=ao.posix.join(n,a[0].slice(_*3));!E.startsWith(".")&&r.root.length>E.length&&(r.root=E,r.depthOffset=-f+_)}if(!o&&r.depthOffset>=0){var d;(d=r.commonPath)!==null&&d!==void 0||(r.commonPath=c);let f=[],_=Math.min(r.commonPath.length,c.length);for(let m=0;m<_;m++){let E=c[m];if(E==="**"&&!c[m+1]){f.pop();break}if(E!==r.commonPath[m]||RZ(E)||m===c.length-1)break;f.push(E)}r.depthOffset=f.length,r.commonPath=f,r.root=f.length>0?ao.posix.join(n,...f):n}return s}function NZ({patterns:t=["**/*"],ignore:e=[],expandDirectories:n=!0},r,o){typeof t=="string"&&(t=[t]),typeof e=="string"&&(e=[e]);let s=[],i=[];for(let a of e)a&&(a[0]!=="!"||a[1]==="(")&&i.push(ZA(a,n,r,o,!0));for(let a of t)a&&(a[0]!=="!"||a[1]==="("?s.push(ZA(a,n,r,o,!1)):(a[1]!=="!"||a[2]==="(")&&i.push(ZA(a.slice(1),n,r,o,!0)));return{match:s,ignore:i}}function OZ(t,e){for(let n=t.length-1;n>=0;n--){let r=t[n];t[n]=e(r)}return t}function bZ(t){return t?t instanceof URL?(0,QM.fileURLToPath)(t).replace(F_,"/"):ao.default.resolve(t).replace(F_,"/"):process.cwd().replace(F_,"/")}function CZ(t,e={}){let n=process.env.TINYGLOBBY_DEBUG?{...e,debug:!0}:e,r=bZ(n.cwd);if(n.debug&&Qc("globbing with:",{patterns:t,options:n,cwd:r}),Array.isArray(t)&&t.length===0)return[{sync:()=>[],withPromise:async()=>[]},!1];let o={root:r,commonPath:null,depthOffset:0},s=NZ({...n,patterns:t},r,o);n.debug&&Qc("internal processing patterns:",s);let i={dot:n.dot,nobrace:n.braceExpansion===!1,nocase:n.caseSensitiveMatch===!1,noextglob:n.extglob===!1,noglobstar:n.globstar===!1,posix:!0},a=(0,Jc.default)(s.match,{...i,ignore:s.ignore}),c=(0,Jc.default)(s.ignore,i),d=dZ(s.match,i),f=XM(r,o.root,n.absolute),_=n.absolute?f:XM(r,o.root,!0),m={filters:[n.debug?(S,R)=>{let N=f(S,R),y=a(N);return y&&Qc(`matched ${N}`),y}:(S,R)=>a(f(S,R))],exclude:n.debug?(S,R)=>{let N=_(R,!0),y=N!=="."&&!d(N)||c(N);return Qc(y?`skipped ${R}`:`crawling ${R}`),y}:(S,R)=>{let N=_(R,!0);return N!=="."&&!d(N)||c(N)},fs:n.fs?{readdir:n.fs.readdir||Na.default.readdir,readdirSync:n.fs.readdirSync||Na.default.readdirSync,realpath:n.fs.realpath||Na.default.realpath,realpathSync:n.fs.realpathSync||Na.default.realpathSync,stat:n.fs.stat||Na.default.stat,statSync:n.fs.statSync||Na.default.statSync}:void 0,pathSeparator:"/",relativePaths:!0,resolveSymlinks:!0,signal:n.signal};n.deep!==void 0&&(m.maxDepth=Math.round(n.deep-o.depthOffset)),n.absolute&&(m.relativePaths=!1,m.resolvePaths=!0,m.includeBasePath=!0),n.followSymbolicLinks===!1&&(m.resolveSymlinks=!1,m.excludeSymlinks=!0),n.onlyDirectories?(m.excludeFiles=!0,m.includeDirs=!0):n.onlyFiles===!1&&(m.includeDirs=!0),o.root=o.root.replace(F_,"");let E=o.root;n.debug&&Qc("internal properties:",o);let T=r!==E&&!n.absolute&&mZ(r,o.root);return[new NM(m).crawl(E),T]}async function ev(t,e){if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=lZ(t)||typeof t=="string",r=n?e:t,o=n?t:t.patterns,[s,i]=CZ(o,r);return i?OZ(await s.withPromise(),i):s.withPromise()}var Na,ao,QM,Jc,lZ,JM,pZ,fZ,_Z,hZ,EZ,gZ,TZ,SZ,AZ,yZ,IZ,F_,tv=k(()=>{p();u();l();Na=B(require("fs"),1),ao=B(require("path"),1),QM=require("url");OM();Jc=B(zM(),1),lZ=Array.isArray,JM=process.platform==="win32",pZ=/^(\/?\.\.)+$/;fZ=/^[A-Z]:\/$/i,_Z=JM?t=>fZ.test(t):t=>t==="/";hZ={parts:!0};EZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,gZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,TZ=t=>t.replace(EZ,"\\$&"),SZ=t=>t.replace(gZ,"\\$&"),AZ=JM?SZ:TZ;yZ=/^(\/?\.\.)+/,IZ=/\\(?=[()[\]{}!*+?@|])/g,F_=/\\/g});var $_,Oa,nv,eR,tR,PZ,MZ,p=k(()=>{"use strict";$_=require("node:child_process"),Oa=require("node:fs/promises"),nv=require("node:sqlite");tv();eR=class{stmt;constructor(e){this.stmt=e}get(...e){return this.stmt.get(...e)}all(...e){return this.stmt.all(...e)}run(...e){this.stmt.run(...e)}},tR=class{db;constructor(e){this.db=new nv.DatabaseSync(e)}exec(e){this.db.exec(e)}query(e){return new eR(this.db.prepare(e))}close(){this.db.close()}},PZ={Database:tR};globalThis.__bun_sqlite_polyfill=PZ;MZ={file(t){return{async exists(){try{return await(0,Oa.access)(t),!0}catch{return!1}},text(){return(0,Oa.readFile)(t,"utf-8")},async json(){let e=await(0,Oa.readFile)(t,"utf-8");return JSON.parse(e)}}},async write(t,e){await(0,Oa.writeFile)(t,e,"utf-8")},which(t){try{let n=process.platform==="win32"?`where ${t}`:`which ${t}`;return(0,$_.execSync)(n,{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).trim().split(`
2
3
  `)[0]||null}catch{return null}},spawn(t,e){let[n,...r]=t,o=["ignore",e?.stdout??"ignore",e?.stderr??"ignore"],s=(0,$_.spawn)(n,r,{detached:!0,stdio:o});return{unref(){s.unref()}}},sleep(t){return new Promise(e=>setTimeout(e,t))},Glob:class{pattern;constructor(e){this.pattern=e}async*scan(e){let n=await ev(this.pattern,{cwd:e?.cwd||process.cwd()});for(let r of n)yield r}}};globalThis.Bun=MZ});var Ae,TR,W,Bo,Up=k(()=>{p();u();l();(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Ae||(Ae={}));(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(TR||(TR={}));W=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bo=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}}});var w,y7,Kn,Z_=k(()=>{p();u();l();Up();w=Ae.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),y7=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Kn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){let d=i.path[c];c===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(i))):a[d]=a[d]||{_errors:[]},a=a[d],c++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Kn.create=t=>new Kn(t)});var I7,Ts,SR=k(()=>{p();u();l();Z_();Up();I7=(t,e)=>{let n;switch(t.code){case w.invalid_type:t.received===W.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case w.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ae.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(t.keys,", ")}`;break;case w.invalid_union:n="Invalid input";break;case w.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(t.options)}`;break;case w.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(t.options)}, received '${t.received}'`;break;case w.invalid_arguments:n="Invalid function arguments";break;case w.invalid_return_type:n="Invalid function return type";break;case w.invalid_date:n="Invalid date";break;case w.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ae.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case w.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case w.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case w.custom:n="Invalid input";break;case w.invalid_intersection_types:n="Intersection results could not be merged";break;case w.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case w.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ae.assertNever(t)}return{message:n}},Ts=I7});function N7(t){jv=t}function nu(){return jv}var jv,em=k(()=>{p();u();l();SR();jv=Ts});function F(t,e){let n=nu(),r=kp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ts?void 0:Ts].filter(o=>!!o)});t.common.issues.push(r)}var kp,O7,Jt,se,Ma,cn,tm,nm,ei,ru,AR=k(()=>{p();u();l();em();SR();kp=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter(d=>!!d).slice().reverse();for(let d of c)a=d(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},O7=[];Jt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return se;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return se;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},se=Object.freeze({status:"aborted"}),Ma=t=>({status:"dirty",value:t}),cn=t=>({status:"valid",value:t}),tm=t=>t.status==="aborted",nm=t=>t.status==="dirty",ei=t=>t.status==="valid",ru=t=>typeof Promise<"u"&&t instanceof Promise});var Hv=k(()=>{p();u();l()});var Z,Fv=k(()=>{p();u();l();(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Z||(Z={}))});function he(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:o}}function Yv(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function $7(t){return new RegExp(`^${Yv(t)}$`)}function Wv(t){let e=`${qv}T${Yv(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function V7(t,e){return!!((e==="v4"||!e)&&U7.test(t)||(e==="v6"||!e)&&B7.test(t))}function q7(t,e){if(!x7.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Y7(t,e){return!!((e==="v4"||!e)&&k7.test(t)||(e==="v6"||!e)&&G7.test(t))}function W7(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function ou(t){if(t instanceof zn){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Pr.create(ou(r))}return new zn({...t._def,shape:()=>e})}else return t instanceof Rs?new Rs({...t._def,type:ou(t.element)}):t instanceof Pr?Pr.create(ou(t.unwrap())):t instanceof jo?jo.create(ou(t.unwrap())):t instanceof Go?Go.create(t.items.map(e=>ou(e))):t}function yR(t,e){let n=Bo(t),r=Bo(e);if(t===e)return{valid:!0,data:t};if(n===W.object&&r===W.object){let o=Ae.objectKeys(e),s=Ae.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=yR(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===W.array&&r===W.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=yR(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===W.date&&r===W.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Kv(t,e){return new Ha({values:t,typeName:ue.ZodEnum,...he(e)})}function Vv(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function zv(t,e={},n){return t?ni.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=Vv(e,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=Vv(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):ni.create()}var Mr,$v,ge,b7,C7,P7,M7,v7,x7,L7,D7,w7,RR,U7,k7,B7,G7,j7,H7,qv,F7,ti,va,xa,La,Da,su,wa,Ua,ni,As,lo,iu,Rs,zn,ka,Ss,rm,Ba,Go,om,au,cu,sm,Ga,ja,Ha,Fa,ri,vr,Pr,jo,$a,Va,uu,K7,Bp,Gp,qa,z7,ue,X7,Xv,Qv,Q7,J7,Jv,Z7,eee,tee,nee,ree,oee,see,iee,aee,cee,uee,lee,pee,dee,fee,_ee,mee,hee,Eee,gee,Tee,See,Aee,Ree,yee,Iee,Nee,Oee,bee,Cee,Pee,Mee,vee,xee,Zv=k(()=>{p();u();l();Z_();em();Fv();AR();Up();Mr=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$v=(t,e)=>{if(ei(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Kn(t.common.issues);return this._error=n,this._error}}};ge=class{get description(){return this._def.description}_getType(e){return Bo(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jt,ctx:{common:e.parent.common,data:e.data,parsedType:Bo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ru(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bo(e)},o=this._parseSync({data:e,path:r.path,parent:r});return $v(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bo(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return ei(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>ei(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bo(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(ru(o)?o:Promise.resolve(o));return $v(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:w.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new vr({schema:this,typeName:ue.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Pr.create(this,this._def)}nullable(){return jo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rs.create(this)}promise(){return ri.create(this,this._def)}or(e){return ka.create([this,e],this._def)}and(e){return Ba.create(this,e,this._def)}transform(e){return new vr({...he(this._def),schema:this,typeName:ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new $a({...he(this._def),innerType:this,defaultValue:n,typeName:ue.ZodDefault})}brand(){return new Bp({typeName:ue.ZodBranded,type:this,...he(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Va({...he(this._def),innerType:this,catchValue:n,typeName:ue.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Gp.create(this,e)}readonly(){return qa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},b7=/^c[^\s-]{8,}$/i,C7=/^[0-9a-z]+$/,P7=/^[0-9A-HJKMNP-TV-Z]{26}$/i,M7=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,v7=/^[a-z0-9_-]{21}$/i,x7=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,L7=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,D7=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,w7="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",U7=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,k7=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,B7=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,G7=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,j7=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,H7=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",F7=new RegExp(`^${qv}$`);ti=class t extends ge{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return F(s,{code:w.invalid_type,expected:W.string,received:s.parsedType}),se}let r=new Jt,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),F(o,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),F(o,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?F(o,{code:w.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&F(o,{code:w.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")D7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"email",code:w.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")RR||(RR=new RegExp(w7,"u")),RR.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"emoji",code:w.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")M7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"uuid",code:w.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")v7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"nanoid",code:w.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")b7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"cuid",code:w.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")C7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"cuid2",code:w.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")P7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"ulid",code:w.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),F(o,{validation:"url",code:w.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"regex",code:w.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),F(o,{code:w.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),F(o,{code:w.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),F(o,{code:w.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Wv(s).test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{code:w.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?F7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{code:w.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?$7(s).test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{code:w.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?L7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"duration",code:w.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?V7(e.data,s.version)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"ip",code:w.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?q7(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"jwt",code:w.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Y7(e.data,s.version)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"cidr",code:w.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?j7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"base64",code:w.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?H7.test(e.data)||(o=this._getOrReturnCtx(e,o),F(o,{validation:"base64url",code:w.invalid_string,message:s.message}),r.dirty()):Ae.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:w.invalid_string,...Z.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Z.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Z.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Z.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Z.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Z.errToObj(n)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ti.create=t=>new ti({checks:[],typeName:ue.ZodString,coerce:t?.coerce??!1,...he(t)});va=class t extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==W.number){let s=this._getOrReturnCtx(e);return F(s,{code:w.invalid_type,expected:W.number,received:s.parsedType}),se}let r,o=new Jt;for(let s of this._def.checks)s.kind==="int"?Ae.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),F(r,{code:w.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),F(r,{code:w.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),F(r,{code:w.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?W7(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),F(r,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),F(r,{code:w.not_finite,message:s.message}),o.dirty()):Ae.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Z.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Z.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ae.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};va.create=t=>new va({checks:[],typeName:ue.ZodNumber,coerce:t?.coerce||!1,...he(t)});xa=class t extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let r,o=new Jt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),F(r,{code:w.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),F(r,{code:w.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),F(r,{code:w.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):Ae.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return F(n,{code:w.invalid_type,expected:W.bigint,received:n.parsedType}),se}gte(e,n){return this.setLimit("min",e,!0,Z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Z.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Z.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};xa.create=t=>new xa({checks:[],typeName:ue.ZodBigInt,coerce:t?.coerce??!1,...he(t)});La=class extends ge{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let r=this._getOrReturnCtx(e);return F(r,{code:w.invalid_type,expected:W.boolean,received:r.parsedType}),se}return cn(e.data)}};La.create=t=>new La({typeName:ue.ZodBoolean,coerce:t?.coerce||!1,...he(t)});Da=class t extends ge{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let s=this._getOrReturnCtx(e);return F(s,{code:w.invalid_type,expected:W.date,received:s.parsedType}),se}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return F(s,{code:w.invalid_date}),se}let r=new Jt,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),F(o,{code:w.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),F(o,{code:w.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ae.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Z.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Da.create=t=>new Da({checks:[],coerce:t?.coerce||!1,typeName:ue.ZodDate,...he(t)});su=class extends ge{_parse(e){if(this._getType(e)!==W.symbol){let r=this._getOrReturnCtx(e);return F(r,{code:w.invalid_type,expected:W.symbol,received:r.parsedType}),se}return cn(e.data)}};su.create=t=>new su({typeName:ue.ZodSymbol,...he(t)});wa=class extends ge{_parse(e){if(this._getType(e)!==W.undefined){let r=this._getOrReturnCtx(e);return F(r,{code:w.invalid_type,expected:W.undefined,received:r.parsedType}),se}return cn(e.data)}};wa.create=t=>new wa({typeName:ue.ZodUndefined,...he(t)});Ua=class extends ge{_parse(e){if(this._getType(e)!==W.null){let r=this._getOrReturnCtx(e);return F(r,{code:w.invalid_type,expected:W.null,received:r.parsedType}),se}return cn(e.data)}};Ua.create=t=>new Ua({typeName:ue.ZodNull,...he(t)});ni=class extends ge{constructor(){super(...arguments),this._any=!0}_parse(e){return cn(e.data)}};ni.create=t=>new ni({typeName:ue.ZodAny,...he(t)});As=class extends ge{constructor(){super(...arguments),this._unknown=!0}_parse(e){return cn(e.data)}};As.create=t=>new As({typeName:ue.ZodUnknown,...he(t)});lo=class extends ge{_parse(e){let n=this._getOrReturnCtx(e);return F(n,{code:w.invalid_type,expected:W.never,received:n.parsedType}),se}};lo.create=t=>new lo({typeName:ue.ZodNever,...he(t)});iu=class extends ge{_parse(e){if(this._getType(e)!==W.undefined){let r=this._getOrReturnCtx(e);return F(r,{code:w.invalid_type,expected:W.void,received:r.parsedType}),se}return cn(e.data)}};iu.create=t=>new iu({typeName:ue.ZodVoid,...he(t)});Rs=class t extends ge{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==W.array)return F(n,{code:w.invalid_type,expected:W.array,received:n.parsedType}),se;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(F(n,{code:i?w.too_big:w.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(F(n,{code:w.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(F(n,{code:w.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Mr(n,i,n.path,a)))).then(i=>Jt.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Mr(n,i,n.path,a)));return Jt.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Z.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Z.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};Rs.create=(t,e)=>new Rs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ue.ZodArray,...he(e)});zn=class t extends ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=Ae.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==W.object){let d=this._getOrReturnCtx(e);return F(d,{code:w.invalid_type,expected:W.object,received:d.parsedType}),se}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof lo&&this._def.unknownKeys==="strip"))for(let d in o.data)i.includes(d)||a.push(d);let c=[];for(let d of i){let f=s[d],_=o.data[d];c.push({key:{status:"valid",value:d},value:f._parse(new Mr(o,_,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof lo){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")a.length>0&&(F(o,{code:w.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of a){let _=o.data[f];c.push({key:{status:"valid",value:f},value:d._parse(new Mr(o,_,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of c){let _=await f.key,m=await f.value;d.push({key:_,value:m,alwaysSet:f.alwaysSet})}return d}).then(d=>Jt.mergeObjectSync(r,d)):Jt.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Z.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ue.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of Ae.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of Ae.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return ou(this)}partial(e){let n={};for(let r of Ae.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of Ae.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Pr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return Kv(Ae.objectKeys(this.shape))}};zn.create=(t,e)=>new zn({shape:()=>t,unknownKeys:"strip",catchall:lo.create(),typeName:ue.ZodObject,...he(e)});zn.strictCreate=(t,e)=>new zn({shape:()=>t,unknownKeys:"strict",catchall:lo.create(),typeName:ue.ZodObject,...he(e)});zn.lazycreate=(t,e)=>new zn({shape:t,unknownKeys:"strip",catchall:lo.create(),typeName:ue.ZodObject,...he(e)});ka=class extends ge{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Kn(a.ctx.common.issues));return F(n,{code:w.invalid_union,unionErrors:i}),se}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of r){let d={...n,common:{...n.common,issues:[]},parent:null},f=c._parseSync({data:n.data,path:n.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new Kn(c));return F(n,{code:w.invalid_union,unionErrors:a}),se}}get options(){return this._def.options}};ka.create=(t,e)=>new ka({options:t,typeName:ue.ZodUnion,...he(e)});Ss=t=>t instanceof Ga?Ss(t.schema):t instanceof vr?Ss(t.innerType()):t instanceof ja?[t.value]:t instanceof Ha?t.options:t instanceof Fa?Ae.objectValues(t.enum):t instanceof $a?Ss(t._def.innerType):t instanceof wa?[void 0]:t instanceof Ua?[null]:t instanceof Pr?[void 0,...Ss(t.unwrap())]:t instanceof jo?[null,...Ss(t.unwrap())]:t instanceof Bp||t instanceof qa?Ss(t.unwrap()):t instanceof Va?Ss(t._def.innerType):[],rm=class t extends ge{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return F(n,{code:w.invalid_type,expected:W.object,received:n.parsedType}),se;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(F(n,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),se)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=Ss(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:ue.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...he(r)})}};Ba=class extends ge{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(tm(s)||tm(i))return se;let a=yR(s.value,i.value);return a.valid?((nm(s)||nm(i))&&n.dirty(),{status:n.value,value:a.data}):(F(r,{code:w.invalid_intersection_types}),se)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ba.create=(t,e,n)=>new Ba({left:t,right:e,typeName:ue.ZodIntersection,...he(n)});Go=class t extends ge{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==W.array)return F(r,{code:w.invalid_type,expected:W.array,received:r.parsedType}),se;if(r.data.length<this._def.items.length)return F(r,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&r.data.length>this._def.items.length&&(F(r,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Mr(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Jt.mergeArray(n,i)):Jt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Go.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Go({items:t,typeName:ue.ZodTuple,rest:null,...he(e)})};om=class t extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return F(r,{code:w.invalid_type,expected:W.object,received:r.parsedType}),se;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Mr(r,a,r.path,a)),value:i._parse(new Mr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Jt.mergeObjectAsync(n,o):Jt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ge?new t({keyType:e,valueType:n,typeName:ue.ZodRecord,...he(r)}):new t({keyType:ti.create(),valueType:e,typeName:ue.ZodRecord,...he(n)})}},au=class extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==W.map)return F(r,{code:w.invalid_type,expected:W.map,received:r.parsedType}),se;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],d)=>({key:o._parse(new Mr(r,a,r.path,[d,"key"])),value:s._parse(new Mr(r,c,r.path,[d,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let d=await c.key,f=await c.value;if(d.status==="aborted"||f.status==="aborted")return se;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of i){let d=c.key,f=c.value;if(d.status==="aborted"||f.status==="aborted")return se;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}}}};au.create=(t,e,n)=>new au({valueType:e,keyType:t,typeName:ue.ZodMap,...he(n)});cu=class t extends ge{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==W.set)return F(r,{code:w.invalid_type,expected:W.set,received:r.parsedType}),se;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(F(r,{code:w.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(F(r,{code:w.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(c){let d=new Set;for(let f of c){if(f.status==="aborted")return se;f.status==="dirty"&&n.dirty(),d.add(f.value)}return{status:n.value,value:d}}let a=[...r.data.values()].map((c,d)=>s._parse(new Mr(r,c,r.path,d)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:Z.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Z.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};cu.create=(t,e)=>new cu({valueType:t,minSize:null,maxSize:null,typeName:ue.ZodSet,...he(e)});sm=class t extends ge{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==W.function)return F(n,{code:w.invalid_type,expected:W.function,received:n.parsedType}),se;function r(a,c){return kp({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nu(),Ts].filter(d=>!!d),issueData:{code:w.invalid_arguments,argumentsError:c}})}function o(a,c){return kp({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nu(),Ts].filter(d=>!!d),issueData:{code:w.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof ri){let a=this;return cn(async function(...c){let d=new Kn([]),f=await a._def.args.parseAsync(c,s).catch(E=>{throw d.addIssue(r(c,E)),d}),_=await Reflect.apply(i,this,f);return await a._def.returns._def.type.parseAsync(_,s).catch(E=>{throw d.addIssue(o(_,E)),d})})}else{let a=this;return cn(function(...c){let d=a._def.args.safeParse(c,s);if(!d.success)throw new Kn([r(c,d.error)]);let f=Reflect.apply(i,this,d.data),_=a._def.returns.safeParse(f,s);if(!_.success)throw new Kn([o(f,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Go.create(e).rest(As.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Go.create([]).rest(As.create()),returns:n||As.create(),typeName:ue.ZodFunction,...he(r)})}},Ga=class extends ge{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Ga.create=(t,e)=>new Ga({getter:t,typeName:ue.ZodLazy,...he(e)});ja=class extends ge{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return F(n,{received:n.data,code:w.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:e.data}}get value(){return this._def.value}};ja.create=(t,e)=>new ja({value:t,typeName:ue.ZodLiteral,...he(e)});Ha=class t extends ge{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return F(n,{expected:Ae.joinValues(r),received:n.parsedType,code:w.invalid_type}),se}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return F(n,{received:n.data,code:w.invalid_enum_value,options:r}),se}return cn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ha.create=Kv;Fa=class extends ge{_parse(e){let n=Ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==W.string&&r.parsedType!==W.number){let o=Ae.objectValues(n);return F(r,{expected:Ae.joinValues(o),received:r.parsedType,code:w.invalid_type}),se}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=Ae.objectValues(n);return F(r,{received:r.data,code:w.invalid_enum_value,options:o}),se}return cn(e.data)}get enum(){return this._def.values}};Fa.create=(t,e)=>new Fa({values:t,typeName:ue.ZodNativeEnum,...he(e)});ri=class extends ge{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==W.promise&&n.common.async===!1)return F(n,{code:w.invalid_type,expected:W.promise,received:n.parsedType}),se;let r=n.parsedType===W.promise?n.data:Promise.resolve(n.data);return cn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ri.create=(t,e)=>new ri({type:t,typeName:ue.ZodPromise,...he(e)});vr=class extends ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{F(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return se;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?se:c.status==="dirty"?Ma(c.value):n.value==="dirty"?Ma(c.value):c});{if(n.value==="aborted")return se;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?se:a.status==="dirty"?Ma(a.value):n.value==="dirty"?Ma(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?se:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?se:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ei(i))return se;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>ei(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):se);Ae.assertNever(o)}};vr.create=(t,e,n)=>new vr({schema:t,typeName:ue.ZodEffects,effect:e,...he(n)});vr.createWithPreprocess=(t,e,n)=>new vr({schema:e,effect:{type:"preprocess",transform:t},typeName:ue.ZodEffects,...he(n)});Pr=class extends ge{_parse(e){return this._getType(e)===W.undefined?cn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pr.create=(t,e)=>new Pr({innerType:t,typeName:ue.ZodOptional,...he(e)});jo=class extends ge{_parse(e){return this._getType(e)===W.null?cn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jo.create=(t,e)=>new jo({innerType:t,typeName:ue.ZodNullable,...he(e)});$a=class extends ge{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===W.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};$a.create=(t,e)=>new $a({innerType:t,typeName:ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...he(e)});Va=class extends ge{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ru(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Kn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Va.create=(t,e)=>new Va({innerType:t,typeName:ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...he(e)});uu=class extends ge{_parse(e){if(this._getType(e)!==W.nan){let r=this._getOrReturnCtx(e);return F(r,{code:w.invalid_type,expected:W.nan,received:r.parsedType}),se}return{status:"valid",value:e.data}}};uu.create=t=>new uu({typeName:ue.ZodNaN,...he(t)});K7=Symbol("zod_brand"),Bp=class extends ge{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Gp=class t extends ge{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?se:s.status==="dirty"?(n.dirty(),Ma(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?se:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:ue.ZodPipeline})}},qa=class extends ge{_parse(e){let n=this._def.innerType._parse(e),r=o=>(ei(o)&&(o.value=Object.freeze(o.value)),o);return ru(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};qa.create=(t,e)=>new qa({innerType:t,typeName:ue.ZodReadonly,...he(e)});z7={object:zn.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ue||(ue={}));X7=(t,e={message:`Input not instance of ${t.name}`})=>zv(n=>n instanceof t,e),Xv=ti.create,Qv=va.create,Q7=uu.create,J7=xa.create,Jv=La.create,Z7=Da.create,eee=su.create,tee=wa.create,nee=Ua.create,ree=ni.create,oee=As.create,see=lo.create,iee=iu.create,aee=Rs.create,cee=zn.create,uee=zn.strictCreate,lee=ka.create,pee=rm.create,dee=Ba.create,fee=Go.create,_ee=om.create,mee=au.create,hee=cu.create,Eee=sm.create,gee=Ga.create,Tee=ja.create,See=Ha.create,Aee=Fa.create,Ree=ri.create,yee=vr.create,Iee=Pr.create,Nee=jo.create,Oee=vr.createWithPreprocess,bee=Gp.create,Cee=()=>Xv().optional(),Pee=()=>Qv().optional(),Mee=()=>Jv().optional(),vee={string:(t=>ti.create({...t,coerce:!0})),number:(t=>va.create({...t,coerce:!0})),boolean:(t=>La.create({...t,coerce:!0})),bigint:(t=>xa.create({...t,coerce:!0})),date:(t=>Da.create({...t,coerce:!0}))},xee=se});var g={};zc(g,{BRAND:()=>K7,DIRTY:()=>Ma,EMPTY_PATH:()=>O7,INVALID:()=>se,NEVER:()=>xee,OK:()=>cn,ParseStatus:()=>Jt,Schema:()=>ge,ZodAny:()=>ni,ZodArray:()=>Rs,ZodBigInt:()=>xa,ZodBoolean:()=>La,ZodBranded:()=>Bp,ZodCatch:()=>Va,ZodDate:()=>Da,ZodDefault:()=>$a,ZodDiscriminatedUnion:()=>rm,ZodEffects:()=>vr,ZodEnum:()=>Ha,ZodError:()=>Kn,ZodFirstPartyTypeKind:()=>ue,ZodFunction:()=>sm,ZodIntersection:()=>Ba,ZodIssueCode:()=>w,ZodLazy:()=>Ga,ZodLiteral:()=>ja,ZodMap:()=>au,ZodNaN:()=>uu,ZodNativeEnum:()=>Fa,ZodNever:()=>lo,ZodNull:()=>Ua,ZodNullable:()=>jo,ZodNumber:()=>va,ZodObject:()=>zn,ZodOptional:()=>Pr,ZodParsedType:()=>W,ZodPipeline:()=>Gp,ZodPromise:()=>ri,ZodReadonly:()=>qa,ZodRecord:()=>om,ZodSchema:()=>ge,ZodSet:()=>cu,ZodString:()=>ti,ZodSymbol:()=>su,ZodTransformer:()=>vr,ZodTuple:()=>Go,ZodType:()=>ge,ZodUndefined:()=>wa,ZodUnion:()=>ka,ZodUnknown:()=>As,ZodVoid:()=>iu,addIssueToContext:()=>F,any:()=>ree,array:()=>aee,bigint:()=>J7,boolean:()=>Jv,coerce:()=>vee,custom:()=>zv,date:()=>Z7,datetimeRegex:()=>Wv,defaultErrorMap:()=>Ts,discriminatedUnion:()=>pee,effect:()=>yee,enum:()=>See,function:()=>Eee,getErrorMap:()=>nu,getParsedType:()=>Bo,instanceof:()=>X7,intersection:()=>dee,isAborted:()=>tm,isAsync:()=>ru,isDirty:()=>nm,isValid:()=>ei,late:()=>z7,lazy:()=>gee,literal:()=>Tee,makeIssue:()=>kp,map:()=>mee,nan:()=>Q7,nativeEnum:()=>Aee,never:()=>see,null:()=>nee,nullable:()=>Nee,number:()=>Qv,object:()=>cee,objectUtil:()=>TR,oboolean:()=>Mee,onumber:()=>Pee,optional:()=>Iee,ostring:()=>Cee,pipeline:()=>bee,preprocess:()=>Oee,promise:()=>Ree,quotelessJson:()=>y7,record:()=>_ee,set:()=>hee,setErrorMap:()=>N7,strictObject:()=>uee,string:()=>Xv,symbol:()=>eee,transformer:()=>yee,tuple:()=>fee,undefined:()=>tee,union:()=>lee,unknown:()=>oee,util:()=>Ae,void:()=>iee});var IR=k(()=>{p();u();l();em();AR();Hv();Up();Zv();Z_()});var oi=k(()=>{p();u();l();IR();IR()});var Lee,ex,im,am=k(()=>{"use strict";p();u();l();oi();Lee=g.object({orgSlug:g.string(),orgName:g.string(),projectSlug:g.string(),projectName:g.string()}),ex=g.object({dsn:g.string(),projectId:g.string(),orgId:g.string().optional(),source:g.enum(["env","env_file","config","code"]),sourcePath:g.string().optional(),resolved:Lee.optional(),cachedAt:g.number()}),im=["packages","apps","libs","services","modules"]});var Dee,tx,nx,wee,Uee,kee,rx=k(()=>{"use strict";p();u();l();oi();am();Dee=g.object({orgSlug:g.string(),orgName:g.string(),projectSlug:g.string(),projectName:g.string(),cachedAt:g.number()}),tx=g.object({orgSlug:g.string(),projectSlug:g.string()}),nx=g.object({aliases:g.record(tx),cachedAt:g.number(),dsnFingerprint:g.string().optional()}),wee=g.object({token:g.string().optional(),refreshToken:g.string().optional(),expiresAt:g.number().optional(),issuedAt:g.number().optional()}),Uee=g.object({organization:g.string().optional(),project:g.string().optional()}),kee=g.object({auth:wee.optional(),defaults:Uee.optional(),projectCache:g.record(Dee).optional(),dsnCache:g.record(ex).optional(),projectAliases:nx.optional()})});var NR,cm,um,ox=k(()=>{"use strict";p();u();l();oi();NR=g.object({device_code:g.string(),user_code:g.string(),verification_uri:g.string(),verification_uri_complete:g.string().optional(),expires_in:g.number(),interval:g.number()}).passthrough(),cm=g.object({access_token:g.string(),token_type:g.string(),expires_in:g.number(),expires_at:g.string().optional(),refresh_token:g.string().optional(),scope:g.string().optional(),user:g.object({id:g.string(),name:g.string(),email:g.string()}).passthrough().optional()}).passthrough(),um=g.object({error:g.string(),error_description:g.string().optional()}).passthrough()});function OR(t){return ix.includes(t)}function jp(t){if(!t.steps)return[];for(let e of t.steps)if(e.key==="root_cause_analysis"&&e.causes)return e.causes;return[]}function zee(t){for(let e of t)if(e.key==="solution"){let n=ax.safeParse(e);if(n.success)return n.data}return null}function sx(t){for(let e of t)if(e.artifacts){let n=zee(e.artifacts);if(n)return n}return null}function bR(t){let e=t;if(e.blocks){let n=sx(e.blocks);if(n)return n}if(e.steps){let n=sx(e.steps);if(n)return n}return null}var ix,Bee,Gee,jee,Hee,Fee,$ee,Vee,qee,UBe,Yee,Wee,ax,Kee,kBe,BBe,GBe,jBe,Hp=k(()=>{"use strict";p();u();l();oi();ix=["COMPLETED","ERROR","CANCELLED"],Bee=g.object({message:g.string(),timestamp:g.string(),type:g.string().optional()}),Gee=g.object({file_path:g.string(),repo_name:g.string()}),jee=g.object({title:g.string(),code_snippet_and_analysis:g.string(),is_most_important_event:g.boolean().optional(),relevant_code_file:Gee.optional(),timeline_item_type:g.string().optional()}),Hee=g.object({id:g.number(),description:g.string(),relevant_repos:g.array(g.string()).optional(),reproduction_urls:g.array(g.string()).optional(),root_cause_reproduction:g.array(jee).optional()}),Fee=g.object({cause_id:g.number(),instruction:g.string().nullable().optional()}),$ee=g.object({id:g.string(),key:g.string(),status:g.string(),title:g.string(),progress:g.array(Bee).optional(),causes:g.array(Hee).optional(),selection:Fee.optional()}).passthrough(),Vee=g.object({integration_id:g.number().optional(),url:g.string().optional(),external_id:g.string(),name:g.string(),provider:g.string().optional(),default_branch:g.string().optional(),is_readable:g.boolean().optional(),is_writeable:g.boolean().optional()}),qee=g.object({repo_external_id:g.string(),file_changes:g.array(g.unknown()).optional(),is_readable:g.boolean().optional(),is_writeable:g.boolean().optional()}),UBe=g.object({pr_number:g.number().optional(),pr_url:g.string().optional(),repo_name:g.string().optional()}),Yee=g.object({title:g.string(),description:g.string()}),Wee=g.object({one_line_summary:g.string(),steps:g.array(Yee)}),ax=g.object({key:g.literal("solution"),data:Wee,reason:g.string().optional()}),Kee=g.object({run_id:g.number(),status:g.string(),updated_at:g.string().optional(),request:g.object({organization_id:g.number().optional(),project_id:g.number().optional(),repos:g.array(g.unknown()).optional()}).optional(),codebases:g.record(g.string(),qee).optional(),steps:g.array($ee).optional(),repositories:g.array(Vee).optional(),coding_agents:g.record(g.string(),g.unknown()).optional(),created_at:g.string().optional(),completed_at:g.string().optional()}).passthrough(),kBe=g.object({autofix:Kee.nullable()}),BBe=g.object({type:g.literal("select_root_cause"),cause_id:g.number(),stopping_point:g.enum(["solution","code_changes","open_pr"]).optional()}),GBe=g.object({type:g.literal("select_solution")}),jBe=g.object({type:g.literal("create_pr")})});var pm,Fp,cx,lm,$p,ux,lx,px,Xee,dx,CR,fx,_x,Qee,mx,Jee,Zee,hx,Ex,gx,Tx,PR,Sx=k(()=>{"use strict";p();u();l();oi();pm=g.object({id:g.string(),slug:g.string(),name:g.string(),dateCreated:g.string().optional(),isEarlyAdopter:g.boolean().optional(),require2FA:g.boolean().optional(),avatar:g.object({avatarType:g.string(),avatarUuid:g.string().nullable()}).passthrough().optional(),features:g.array(g.string()).optional()}).passthrough(),Fp=g.object({id:g.string(),slug:g.string(),name:g.string(),platform:g.string().nullable().optional(),dateCreated:g.string().optional(),isBookmarked:g.boolean().optional(),isMember:g.boolean().optional(),features:g.array(g.string()).optional(),firstEvent:g.string().nullable().optional(),firstTransactionEvent:g.boolean().optional(),access:g.array(g.string()).optional(),hasAccess:g.boolean().optional(),hasMinifiedStackTrace:g.boolean().optional(),hasMonitors:g.boolean().optional(),hasProfiles:g.boolean().optional(),hasReplays:g.boolean().optional(),hasSessions:g.boolean().optional(),isInternal:g.boolean().optional(),isPublic:g.boolean().optional(),avatar:g.object({avatarType:g.string(),avatarUuid:g.string().nullable()}).passthrough().optional(),color:g.string().optional(),status:g.string().optional(),organization:g.object({id:g.string(),slug:g.string(),name:g.string()}).passthrough().optional()}).passthrough(),cx=["resolved","unresolved","ignored"],lm=g.object({id:g.number().optional(),version:g.string(),shortVersion:g.string().optional(),status:g.string().optional(),dateCreated:g.string().optional(),dateReleased:g.string().nullable().optional(),ref:g.string().nullable().optional(),url:g.string().nullable().optional(),commitCount:g.number().optional(),deployCount:g.number().optional(),authors:g.array(g.unknown()).optional(),projects:g.array(g.object({id:g.union([g.string(),g.number()]),slug:g.string(),name:g.string()}).passthrough()).optional()}).passthrough(),$p=g.object({id:g.string(),shortId:g.string(),title:g.string(),culprit:g.string().optional(),permalink:g.string().optional(),logger:g.string().nullable().optional(),level:g.string().optional(),status:g.enum(cx).optional(),statusDetails:g.record(g.unknown()).optional(),substatus:g.string().optional(),priority:g.string().optional(),isPublic:g.boolean().optional(),platform:g.string().optional(),project:g.object({id:g.string(),name:g.string(),slug:g.string(),platform:g.string().nullable().optional()}).passthrough().optional(),type:g.string().optional(),metadata:g.object({value:g.string().optional(),type:g.string().optional(),filename:g.string().optional(),function:g.string().optional(),display_title_with_tree_label:g.boolean().optional()}).passthrough().optional(),numComments:g.number().optional(),assignedTo:g.object({id:g.string(),name:g.string(),type:g.string()}).passthrough().nullable().optional(),isBookmarked:g.boolean().optional(),isSubscribed:g.boolean().optional(),subscriptionDetails:g.object({reason:g.string().optional()}).passthrough().nullable().optional(),hasSeen:g.boolean().optional(),annotations:g.array(g.string()).optional(),isUnhandled:g.boolean().optional(),count:g.string().optional(),userCount:g.number().optional(),firstSeen:g.string().datetime({offset:!0}).optional(),lastSeen:g.string().datetime({offset:!0}).optional(),firstRelease:lm.nullable().optional(),lastRelease:lm.nullable().optional()}).passthrough(),ux=g.object({trace_id:g.string().optional(),span_id:g.string().optional(),parent_span_id:g.string().nullable().optional(),op:g.string().optional(),status:g.string().optional(),description:g.string().nullable().optional()}).passthrough(),lx=g.object({span_id:g.string(),parent_span_id:g.string().nullable().optional(),trace_id:g.string().optional(),op:g.string().optional(),description:g.string().nullable().optional(),start_timestamp:g.number(),timestamp:g.number(),status:g.string().optional(),data:g.record(g.unknown()).optional(),tags:g.record(g.string()).optional()}).passthrough(),px=g.object({event_id:g.string(),span_id:g.string().optional(),transaction:g.string().optional(),"transaction.duration":g.number().optional(),"transaction.op":g.string().optional(),project_slug:g.string().optional(),project_id:g.union([g.string(),g.number()]).optional(),spans:g.array(lx).optional(),start_timestamp:g.number().optional(),timestamp:g.number().optional(),errors:g.array(g.unknown()).optional(),performance_issues:g.array(g.unknown()).optional()}).passthrough(),Xee=g.object({transactions:g.array(px),orphan_errors:g.array(g.unknown()).optional()}),dx=g.object({filename:g.string().nullable().optional(),absPath:g.string().nullable().optional(),module:g.string().nullable().optional(),package:g.string().nullable().optional(),platform:g.string().nullable().optional(),function:g.string().nullable().optional(),rawFunction:g.string().nullable().optional(),symbol:g.string().nullable().optional(),lineNo:g.number().nullable().optional(),colNo:g.number().nullable().optional(),inApp:g.boolean().nullable().optional(),context:g.array(g.tuple([g.number(),g.string()])).nullable().optional(),vars:g.record(g.unknown()).nullable().optional(),instructionAddr:g.string().nullable().optional(),symbolAddr:g.string().nullable().optional(),trust:g.string().nullable().optional(),errors:g.array(g.unknown()).nullable().optional()}).passthrough(),CR=g.object({frames:g.array(dx).optional(),framesOmitted:g.array(g.number()).nullable().optional(),registers:g.record(g.string()).nullable().optional(),hasSystemFrames:g.boolean().optional()}).passthrough(),fx=g.object({type:g.string().optional(),handled:g.boolean().optional(),synthetic:g.boolean().optional(),description:g.string().nullable().optional(),data:g.record(g.unknown()).optional()}).passthrough(),_x=g.object({type:g.string().nullable().optional(),value:g.string().nullable().optional(),module:g.string().nullable().optional(),threadId:g.union([g.string(),g.number()]).nullable().optional(),mechanism:fx.nullable().optional(),stacktrace:CR.nullable().optional(),rawStacktrace:CR.nullable().optional()}).passthrough(),Qee=g.object({type:g.literal("exception"),data:g.object({values:g.array(_x).optional(),excOmitted:g.array(g.number()).nullable().optional(),hasSystemFrames:g.boolean().optional()}).passthrough()}),mx=g.object({type:g.string().optional(),category:g.string().nullable().optional(),level:g.string().optional(),message:g.string().nullable().optional(),timestamp:g.string().optional(),event_id:g.string().nullable().optional(),data:g.record(g.unknown()).nullable().optional()}).passthrough(),Jee=g.object({type:g.literal("breadcrumbs"),data:g.object({values:g.array(mx).optional()}).passthrough()}),Zee=g.object({type:g.literal("request"),data:g.object({url:g.string().nullable().optional(),method:g.string().nullable().optional(),fragment:g.string().nullable().optional(),query:g.union([g.array(g.tuple([g.string(),g.string()])),g.string(),g.record(g.string())]).nullable().optional(),data:g.unknown().nullable().optional(),headers:g.array(g.tuple([g.string(),g.string()])).nullable().optional(),cookies:g.union([g.array(g.tuple([g.string(),g.string()])),g.record(g.string())]).nullable().optional(),env:g.record(g.string()).nullable().optional(),inferredContentType:g.string().nullable().optional(),apiTarget:g.string().nullable().optional()}).passthrough()}),hx=g.object({name:g.string().optional(),version:g.string().optional(),type:g.literal("browser").optional()}).passthrough(),Ex=g.object({name:g.string().optional(),version:g.string().optional(),type:g.literal("os").optional()}).passthrough(),gx=g.object({family:g.string().optional(),model:g.string().optional(),brand:g.string().optional(),type:g.literal("device").optional()}).passthrough(),Tx=g.object({country_code:g.string().optional(),city:g.string().optional(),region:g.string().optional()}).passthrough(),PR=g.object({eventID:g.string(),id:g.string().optional(),projectID:g.string().optional(),context:g.record(g.unknown()).optional(),contexts:g.object({trace:ux.optional(),browser:hx.optional(),os:Ex.optional(),device:gx.optional()}).passthrough().optional(),dateCreated:g.string().optional(),dateReceived:g.string().optional(),entries:g.array(g.unknown()).optional(),errors:g.array(g.unknown()).optional(),fingerprints:g.array(g.string()).optional(),groupID:g.string().optional(),message:g.string().optional(),metadata:g.record(g.unknown()).optional(),platform:g.string().optional(),location:g.string().nullable().optional(),culprit:g.string().nullable().optional(),sdk:g.object({name:g.string(),version:g.string()}).passthrough().nullable().optional(),tags:g.array(g.object({key:g.string(),value:g.string()})).optional(),title:g.string().optional(),type:g.string().optional(),user:g.object({id:g.string().nullable().optional(),email:g.string().nullable().optional(),username:g.string().nullable().optional(),ip_address:g.string().nullable().optional(),name:g.string().nullable().optional(),geo:Tx.nullable().optional(),data:g.record(g.unknown()).nullable().optional()}).passthrough().nullable().optional(),release:lm.nullable().optional(),sdkUpdates:g.array(g.object({type:g.string().optional(),sdkName:g.string().optional(),newSdkVersion:g.string().optional(),sdkUrl:g.string().optional()}).passthrough()).optional()}).passthrough()});var MR=k(()=>{"use strict";p();u();l();rx();ox();Hp();Sx()});var ete,Ax,Rx=k(()=>{p();u();l();ete=globalThis.__bun_sqlite_polyfill,Ax=ete.Database});function tte(t){return t.query("SELECT value FROM metadata WHERE key = ?").get(Ix)?.value==="true"}function vR(t){t.query("INSERT OR REPLACE INTO metadata (key, value) VALUES (?, ?)").run(Ix,"true")}function nte(){let t=(0,dm.join)(si(),xR),{existsSync:e}=require("node:fs");return e(t)}function rte(){let t=(0,dm.join)(si(),xR);try{let{readFileSync:e}=require("node:fs"),n=e(t,"utf-8");return JSON.parse(n)}catch{return null}}function ote(){let t=(0,dm.join)(si(),xR);try{return(0,yx.rmSync)(t),!0}catch(e){return e instanceof Error&&"code"in e&&e.code==="ENOENT"?!0:(console.error("Warning: Could not delete old config.json:",e),!1)}}function Nx(t){if(tte(t))return;if(!nte()){vR(t);return}let e=rte();if(!e){vR(t);return}console.error("Migrating config to SQLite..."),t.exec("BEGIN TRANSACTION");try{if(e.auth?.token&&t.query(`
3
4
  INSERT OR REPLACE INTO auth (id, token, refresh_token, expires_at, issued_at, updated_at)
4
5
  VALUES (1, ?, ?, ?, ?, ?)
@@ -112,7 +113,7 @@ Suggestion: ${this.suggestion}`),e}},mte=["Run from a directory with a Sentry-co
112
113
  `);for(let o of r){if(!o)continue;let s=o.indexOf(":");if(s===-1)continue;let i=o.substring(0,s).toLowerCase(),a=o.substring(s+1).trim(),c=n.get(i);c&&Array.isArray(c)?c.push(a):c?n.set(i,[c,a]):n.set(i,a)}}return n}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0,qf.safeExecuteInTheMiddle)(()=>!r||e.method==="CONNECT"||n.ignoreRequestHook?.(e),U=>U&&this._diag.error("caught ignoreRequestHook error: ",U),!0))return;let s=(0,DT.hrTime)(),i;try{i=new LPe.URL(e.path,e.origin)}catch(U){this._diag.warn("could not determine url.full:",U);return}let a=i.protocol.replace(":",""),c=this.getRequestMethod(e.method),d={[Mt.ATTR_HTTP_REQUEST_METHOD]:c,[Mt.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]:e.method,[Mt.ATTR_URL_FULL]:i.toString(),[Mt.ATTR_URL_PATH]:i.pathname,[Mt.ATTR_URL_QUERY]:i.search,[Mt.ATTR_URL_SCHEME]:a},f={https:"443",http:"80"},_=i.hostname,m=i.port||f[a];d[Mt.ATTR_SERVER_ADDRESS]=_,m&&!isNaN(Number(m))&&(d[Mt.ATTR_SERVER_PORT]=Number(m));let T=this.parseRequestHeaders(e).get("user-agent");if(T){let U=Array.isArray(T)?T[T.length-1]:T;d[Mt.ATTR_USER_AGENT_ORIGINAL]=U}let S=(0,qf.safeExecuteInTheMiddle)(()=>n.startSpanHook?.(e),U=>U&&this._diag.error("caught startSpanHook error: ",U),!0);S&&Object.entries(S).forEach(([U,Q])=>{d[U]=Q});let R=Ar.context.active(),N=Ar.trace.getSpan(R),y;n.requireParentforSpans&&(!N||!Ar.trace.isSpanContextValid(N.spanContext()))?y=Ar.trace.wrapSpanContext(Ar.INVALID_SPAN_CONTEXT):y=this.tracer.startSpan(c==="_OTHER"?"HTTP":c,{kind:Ar.SpanKind.CLIENT,attributes:d},R),(0,qf.safeExecuteInTheMiddle)(()=>n.requestHook?.(y,e),U=>U&&this._diag.error("caught requestHook error: ",U),!0);let P=Ar.trace.setSpan(Ar.context.active(),y),M={};Ar.propagation.inject(P,M);let G=Object.entries(M);for(let U=0;U<G.length;U++){let[Q,K]=G[U];typeof e.addHeader=="function"?e.addHeader(Q,K):typeof e.headers=="string"?e.headers+=`${Q}: ${K}\r
113
114
  `:Array.isArray(e.headers)&&e.headers.push(Q,K)}this._recordFromReq.set(e,{span:y,attributes:d,startTime:s})}onRequestHeaders({request:e,socket:n}){let r=this._recordFromReq.get(e);if(!r)return;let o=this.getConfig(),{span:s}=r,{remoteAddress:i,remotePort:a}=n,c={[Mt.ATTR_NETWORK_PEER_ADDRESS]:i,[Mt.ATTR_NETWORK_PEER_PORT]:a};if(o.headersToSpanAttributes?.requestHeaders){let d=new Set(o.headersToSpanAttributes.requestHeaders.map(_=>_.toLowerCase())),f=this.parseRequestHeaders(e);for(let[_,m]of f.entries())if(d.has(_)){let E=Array.isArray(m)?m.join(", "):m;c[`http.request.header.${_}`]=E}}s.setAttributes(c)}onResponseHeaders({request:e,response:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s}=r,i={[Mt.ATTR_HTTP_RESPONSE_STATUS_CODE]:n.statusCode},a=this.getConfig();(0,qf.safeExecuteInTheMiddle)(()=>a.responseHook?.(o,{request:e,response:n}),d=>d&&this._diag.error("caught responseHook error: ",d),!0);let c=new Set;a.headersToSpanAttributes?.responseHeaders&&a.headersToSpanAttributes?.responseHeaders.forEach(d=>c.add(d.toLowerCase()));for(let d=0;d<n.headers.length;d=d+2){let f=n.headers[d].toString().toLowerCase(),_=n.headers[d+1];if(c.has(f)&&(i[`http.response.header.${f}`]=_.toString()),f==="content-length"){let m=Number(_.toString());isNaN(m)||(i["http.response.header.content-length"]=m)}}o.setAttributes(i),o.setStatus({code:n.statusCode>=400?Ar.SpanStatusCode.ERROR:Ar.SpanStatusCode.UNSET}),r.attributes=Object.assign(s,i)}onDone({request:e}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:o,startTime:s}=n;r.end(),this._recordFromReq.delete(e),this.recordRequestDuration(o,s)}onError({request:e,error:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s,startTime:i}=r;o.recordException(n),o.setStatus({code:Ar.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[Mt.ATTR_ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[Mt.ATTR_HTTP_RESPONSE_STATUS_CODE,Mt.ATTR_HTTP_REQUEST_METHOD,Mt.ATTR_SERVER_ADDRESS,Mt.ATTR_SERVER_PORT,Mt.ATTR_URL_SCHEME,Mt.ATTR_ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,DT.hrTimeToMilliseconds)((0,DT.hrTimeDuration)(n,(0,DT.hrTime)()))/1e3;this._httpClientDurationHistogram.record(s,r)}getRequestMethod(e){let n={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};wT.UndiciInstrumentation=bC});var G3=A(UT=>{"use strict";p();u();l();Object.defineProperty(UT,"__esModule",{value:!0});UT.UndiciInstrumentation=void 0;var DPe=B3();Object.defineProperty(UT,"UndiciInstrumentation",{enumerable:!0,get:function(){return DPe.UndiciInstrumentation}})});var kT=A(Yf=>{"use strict";p();u();l();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.ExpressLayerType=void 0;var jPe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(jPe=Yf.ExpressLayerType||(Yf.ExpressLayerType={}))});var BT=A(Wf=>{"use strict";p();u();l();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.AttributeNames=void 0;var HPe;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(HPe=Wf.AttributeNames||(Wf.AttributeNames={}))});var CC=A(wl=>{"use strict";p();u();l();Object.defineProperty(wl,"__esModule",{value:!0});wl._LAYERS_STORE_PROPERTY=wl.kLayerPatched=void 0;wl.kLayerPatched=Symbol("express-layer-patched");wl._LAYERS_STORE_PROPERTY="__ot_middlewares"});var Y3=A(vt=>{"use strict";p();u();l();Object.defineProperty(vt,"__esModule",{value:!0});vt.getActualMatchedRoute=vt.getConstructedRoute=vt.getLayerPath=vt.asErrorAndMessage=vt.isLayerIgnored=vt.getLayerMetadata=vt.getRouterPath=vt.storeLayerPath=void 0;var PC=kT(),Ul=BT(),Bc=CC(),FPe=(t,e)=>(Array.isArray(t[Bc._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,Bc._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e===void 0?{isLayerPathStored:!1}:(t[Bc._LAYERS_STORE_PROPERTY].push(e),{isLayerPathStored:!0}));vt.storeLayerPath=FPe;var $Pe=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?(0,vt.getRouterPath)(t,n):t};vt.getRouterPath=$Pe;var VPe=(t,e,n)=>{if(e.name==="router"){let r=(0,vt.getRouterPath)("",e),o=r||n||t||"/";return{attributes:{[Ul.AttributeNames.EXPRESS_NAME]:o,[Ul.AttributeNames.EXPRESS_TYPE]:PC.ExpressLayerType.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[Ul.AttributeNames.EXPRESS_NAME]:(t||n)??"request handler",[Ul.AttributeNames.EXPRESS_TYPE]:PC.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[Ul.AttributeNames.EXPRESS_NAME]:e.name,[Ul.AttributeNames.EXPRESS_TYPE]:PC.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};vt.getLayerMetadata=VPe;var qPe=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")},YPe=(t,e,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(e))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let r of n.ignoreLayers)if(qPe(t,r))return!0}catch{}return!1};vt.isLayerIgnored=YPe;var WPe=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];vt.asErrorAndMessage=WPe;var KPe=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>V3(n)||"").join(","):V3(e)};vt.getLayerPath=KPe;var V3=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};function q3(t){let n=(Array.isArray(t[Bc._LAYERS_STORE_PROPERTY])?t[Bc._LAYERS_STORE_PROPERTY]:[]).filter(r=>r!=="/"&&r!=="/*");return n.length===1&&n[0]==="*"?"*":n.join("").replace(/\/{2,}/g,"/")}vt.getConstructedRoute=q3;function zPe(t){let e=Array.isArray(t[Bc._LAYERS_STORE_PROPERTY])?t[Bc._LAYERS_STORE_PROPERTY]:[];if(e.length===0)return;if(e.every(s=>s==="/"))return t.originalUrl==="/"?"/":void 0;let n=q3(t);if(n==="*"||n.includes("/")&&(n.includes(",")||n.includes("\\")||n.includes("*")||n.includes("[")))return n;let r=n.startsWith("/")?n:`/${n}`;return r.length>0&&(t.originalUrl===r||t.originalUrl.startsWith(r)||XPe(r))?r:void 0}vt.getActualMatchedRoute=zPe;function XPe(t){return t.includes(":")||t.includes("*")}});var W3=A(kl=>{"use strict";p();u();l();Object.defineProperty(kl,"__esModule",{value:!0});kl.PACKAGE_NAME=kl.PACKAGE_VERSION=void 0;kl.PACKAGE_VERSION="0.58.0";kl.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var J3=A(jT=>{"use strict";p();u();l();Object.defineProperty(jT,"__esModule",{value:!0});jT.ExpressInstrumentation=void 0;var K3=De(),Po=(D(),v(j)),z3=kT(),X3=BT(),ls=Y3(),Q3=W3(),Bl=pe(),QPe=(Re(),v(ke)),GT=CC(),MC=class extends Bl.InstrumentationBase{constructor(e={}){super(Q3.PACKAGE_NAME,Q3.PACKAGE_VERSION,e)}init(){return[new Bl.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <6"],e=>{let n=typeof e?.Router?.prototype?.route=="function",r=n?e.Router.prototype:e.Router;return(0,Bl.isWrapped)(r.route)&&this._unwrap(r,"route"),this._wrap(r,"route",this._getRoutePatch()),(0,Bl.isWrapped)(r.use)&&this._unwrap(r,"use"),this._wrap(r,"use",this._getRouterUsePatch()),(0,Bl.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch(n)),e},e=>{if(e===void 0)return;let r=typeof e?.Router?.prototype?.route=="function"?e.Router.prototype:e.Router;this._unwrap(r,"route"),this._unwrap(r,"use"),this._unwrap(e.application,"use")})]}_getRoutePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,ls.getLayerPath)(o)),s}}}_getRouterUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,ls.getLayerPath)(o)),s}}}_getAppUsePatch(e){let n=this;return function(r){return function(...s){let i=e?this.router:this._router,a=r.apply(this,s);if(i){let c=i.stack[i.stack.length-1];n._applyPatch(c,(0,ls.getLayerPath)(s))}return a}}}_applyPatch(e,n){let r=this;e[GT.kLayerPatched]!==!0&&(e[GT.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){let{isLayerPathStored:c}=(0,ls.storeLayerPath)(i,n),d=(0,ls.getConstructedRoute)(i),f=(0,ls.getActualMatchedRoute)(i),_={[QPe.ATTR_HTTP_ROUTE]:f},m=(0,ls.getLayerMetadata)(d,e,n),E=m.attributes[X3.AttributeNames.EXPRESS_TYPE],T=(0,K3.getRPCMetadata)(Po.context.active());if(T?.type===K3.RPCType.HTTP&&(T.route=f),(0,ls.isLayerIgnored)(m.name,E,r.getConfig()))return E===z3.ExpressLayerType.MIDDLEWARE&&i[GT._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(Po.trace.getSpan(Po.context.active())===void 0)return o.apply(this,arguments);let S=r._getSpanName({request:i,layerType:E,route:d},m.name),R=r.tracer.startSpan(S,{attributes:Object.assign(_,m.attributes)}),N=Po.context.active(),y=Po.trace.setSpan(N,R),{requestHook:P}=r.getConfig();P&&(0,Bl.safeExecuteInTheMiddle)(()=>P(R,{request:i,layerType:E,route:d}),K=>{K&&Po.diag.error("express instrumentation: request hook failed",K)},!0);let M=!1;m.attributes[X3.AttributeNames.EXPRESS_TYPE]===z3.ExpressLayerType.ROUTER&&(R.end(),M=!0,y=N);let G=()=>{M===!1&&(M=!0,R.end())},U=Array.from(arguments),Q=U.findIndex(K=>typeof K=="function");Q>=0&&(arguments[Q]=function(){let K=arguments[0],ee=![void 0,null,"route","router"].includes(K);if(!M&&ee){let[at,je]=(0,ls.asErrorAndMessage)(K);R.recordException(at),R.setStatus({code:Po.SpanStatusCode.ERROR,message:je})}M===!1&&(M=!0,i.res?.removeListener("finish",G),R.end()),!(i.route&&ee)&&c&&i[GT._LAYERS_STORE_PROPERTY].pop();let O=U[Q];return Po.context.bind(N,O).apply(this,arguments)});try{return Po.context.bind(y,o).apply(this,arguments)}catch(K){let[ee,O]=(0,ls.asErrorAndMessage)(K);throw R.recordException(ee),R.setStatus({code:Po.SpanStatusCode.ERROR,message:O}),K}finally{M||a.once("finish",G)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){let{spanNameHook:r}=this.getConfig();if(!(r instanceof Function))return n;try{return r(e,n)??n}catch(o){return Po.diag.error("express instrumentation: error calling span name rewrite hook",o),n}}};jT.ExpressInstrumentation=MC});var Z3=A(ea=>{"use strict";p();u();l();Object.defineProperty(ea,"__esModule",{value:!0});ea.AttributeNames=ea.ExpressLayerType=ea.ExpressInstrumentation=void 0;var JPe=J3();Object.defineProperty(ea,"ExpressInstrumentation",{enumerable:!0,get:function(){return JPe.ExpressInstrumentation}});var ZPe=kT();Object.defineProperty(ea,"ExpressLayerType",{enumerable:!0,get:function(){return ZPe.ExpressLayerType}});var eMe=BT();Object.defineProperty(ea,"AttributeNames",{enumerable:!0,get:function(){return eMe.AttributeNames}})});var cz=A((vbt,az)=>{"use strict";p();u();l();az.exports=sz;function sz(t,e,n){t instanceof RegExp&&(t=oz(t,n)),e instanceof RegExp&&(e=oz(e,n));var r=iz(t,e,n);return r&&{start:r[0],end:r[1],pre:n.slice(0,r[0]),body:n.slice(r[0]+t.length,r[1]),post:n.slice(r[1]+e.length)}}function oz(t,e){var n=e.match(t);return n?n[0]:null}sz.range=iz;function iz(t,e,n){var r,o,s,i,a,c=n.indexOf(t),d=n.indexOf(e,c+1),f=c;if(c>=0&&d>0){if(t===e)return[c,d];for(r=[],s=n.length;f>=0&&!a;)f==c?(r.push(f),c=n.indexOf(t,f+1)):r.length==1?a=[r.pop(),d]:(o=r.pop(),o<s&&(s=o,i=d),d=n.indexOf(e,f+1)),f=c<d&&c>=0?c:d;r.length&&(a=[s,i])}return a}});var hz=A((wbt,mz)=>{p();u();l();var uz=cz();mz.exports=iMe;var lz="\0SLASH"+Math.random()+"\0",pz="\0OPEN"+Math.random()+"\0",xC="\0CLOSE"+Math.random()+"\0",dz="\0COMMA"+Math.random()+"\0",fz="\0PERIOD"+Math.random()+"\0";function vC(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function oMe(t){return t.split("\\\\").join(lz).split("\\{").join(pz).split("\\}").join(xC).split("\\,").join(dz).split("\\.").join(fz)}function sMe(t){return t.split(lz).join("\\").split(pz).join("{").split(xC).join("}").split(dz).join(",").split(fz).join(".")}function _z(t){if(!t)return[""];var e=[],n=uz("{","}",t);if(!n)return t.split(",");var r=n.pre,o=n.body,s=n.post,i=r.split(",");i[i.length-1]+="{"+o+"}";var a=_z(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function iMe(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Kf(oMe(t),!0).map(sMe)):[]}function aMe(t){return"{"+t+"}"}function cMe(t){return/^-?0\d/.test(t)}function uMe(t,e){return t<=e}function lMe(t,e){return t>=e}function Kf(t,e){var n=[],r=uz("{","}",t);if(!r)return[t];var o=r.pre,s=r.post.length?Kf(r.post,!1):[""];if(/\$$/.test(r.pre))for(var i=0;i<s.length;i++){var a=o+"{"+r.body+"}"+s[i];n.push(a)}else{var c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),f=c||d,_=r.body.indexOf(",")>=0;if(!f&&!_)return r.post.match(/,(?!,).*\}/)?(t=r.pre+"{"+r.body+xC+r.post,Kf(t)):[t];var m;if(f)m=r.body.split(/\.\./);else if(m=_z(r.body),m.length===1&&(m=Kf(m[0],!1).map(aMe),m.length===1))return s.map(function(O){return r.pre+m[0]+O});var E;if(f){var T=vC(m[0]),S=vC(m[1]),R=Math.max(m[0].length,m[1].length),N=m.length==3?Math.abs(vC(m[2])):1,y=uMe,P=S<T;P&&(N*=-1,y=lMe);var M=m.some(cMe);E=[];for(var G=T;y(G,S);G+=N){var U;if(d)U=String.fromCharCode(G),U==="\\"&&(U="");else if(U=String(G),M){var Q=R-U.length;if(Q>0){var K=new Array(Q+1).join("0");G<0?U="-"+K+U.slice(1):U=K+U}}E.push(U)}}else{E=[];for(var ee=0;ee<m.length;ee++)E.push.apply(E,Kf(m[ee],!1))}for(var ee=0;ee<E.length;ee++)for(var i=0;i<s.length;i++){var a=o+E[ee]+s[i];(!e||f||a)&&n.push(a)}}return n}});var BC=A(Mo=>{"use strict";p();u();l();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.SpanNames=Mo.TokenKind=Mo.AllowedOperationTypes=void 0;var ove;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(ove=Mo.AllowedOperationTypes||(Mo.AllowedOperationTypes={}));var sve;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(sve=Mo.TokenKind||(Mo.TokenKind={}));var ive;(function(t){t.EXECUTE="graphql.execute",t.PARSE="graphql.parse",t.RESOLVE="graphql.resolve",t.VALIDATE="graphql.validate",t.SCHEMA_VALIDATE="graphql.validateSchema",t.SCHEMA_PARSE="graphql.parseSchema"})(ive=Mo.SpanNames||(Mo.SpanNames={}))});var GC=A(t_=>{"use strict";p();u();l();Object.defineProperty(t_,"__esModule",{value:!0});t_.AttributeNames=void 0;var ave;(function(t){t.SOURCE="graphql.source",t.FIELD_NAME="graphql.field.name",t.FIELD_PATH="graphql.field.path",t.FIELD_TYPE="graphql.field.type",t.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(ave=t_.AttributeNames||(t_.AttributeNames={}))});var XT=A(Hl=>{"use strict";p();u();l();Object.defineProperty(Hl,"__esModule",{value:!0});Hl.OTEL_GRAPHQL_DATA_SYMBOL=Hl.OTEL_PATCHED_SYMBOL=void 0;Hl.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");Hl.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var Vz=A(QT=>{"use strict";p();u();l();Object.defineProperty(QT,"__esModule",{value:!0});QT.OPERATION_NOT_SUPPORTED=void 0;var mPt=XT();QT.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var o5=A(Ht=>{"use strict";p();u();l();Object.defineProperty(Ht,"__esModule",{value:!0});Ht.wrapFieldResolver=Ht.wrapFields=Ht.getSourceFromLocation=Ht.getOperation=Ht.endSpan=Ht.addSpanSource=Ht.addInputVariableAttributes=Ht.isPromise=void 0;var $l=(D(),v(j)),oa=BC(),Fl=GC(),Vs=XT(),qz=Object.values(oa.AllowedOperationTypes),cve=t=>typeof t?.then=="function";Ht.isPromise=cve;var uve=t=>typeof t=="object"&&t!==null;function jC(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{jC(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{jC(t,`${e}.${r}`,o)}):t.setAttribute(`${Fl.AttributeNames.VARIABLES}${String(e)}`,n)}function lve(t,e){Object.entries(e).forEach(([n,r])=>{jC(t,n,r)})}Ht.addInputVariableAttributes=lve;function zz(t,e,n,r,o){let s=e5(e,n,r,o);t.setAttribute(Fl.AttributeNames.SOURCE,s)}Ht.addSpanSource=zz;function pve(t,e,n,r,o){let s=Xz(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?Jz(n):Qz(n,o);return s={span:dve(t,e,n,r,o,a)},mve(n,o,s),{field:s,spanAdded:!0}}function dve(t,e,n,r,o,s){let i={[Fl.AttributeNames.FIELD_NAME]:r.fieldName,[Fl.AttributeNames.FIELD_PATH]:o.join("."),[Fl.AttributeNames.FIELD_TYPE]:r.returnType.toString()},a=t.startSpan(`${oa.SpanNames.RESOLVE} ${i[Fl.AttributeNames.FIELD_PATH]}`,{attributes:i},s?$l.trace.setSpan($l.context.active(),s):void 0),c=n[Vs.OTEL_GRAPHQL_DATA_SYMBOL].source,d=r.fieldNodes.find(f=>f.kind==="Field");return d&&zz(a,c.loc,e().allowValues,d.loc?.start,d.loc?.end),a}function fve(t,e){e&&t.recordException(e),t.end()}Ht.endSpan=fve;function _ve(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>qz.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>qz.indexOf(n?.operation)!==-1)}Ht.getOperation=_ve;function mve(t,e,n){return t[Vs.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function Xz(t,e){return t[Vs.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function Qz(t,e){for(let n=e.length-1;n>0;n--){let r=Xz(t,e.slice(0,n));if(r)return r.span}return Jz(t)}function Jz(t){return t[Vs.OTEL_GRAPHQL_DATA_SYMBOL].span}function hve(t,e){let n=[],r=e;for(;r;){let o=r.key;t&&typeof o=="number"&&(o="*"),n.push(String(o)),r=r.prev}return n.reverse()}function Eve(t){return Zz(`
114
115
  `,t)}function Yz(t){return Zz(" ",t)}function Zz(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var gve=[oa.TokenKind.FLOAT,oa.TokenKind.STRING,oa.TokenKind.INT,oa.TokenKind.BLOCK_STRING];function e5(t,e=!1,n,r){let o="";if(t?.startToken){let s=typeof n=="number"?n:t.start,i=typeof r=="number"?r:t.end,a=t.startToken.next,c=1;for(;a;){if(a.start<s){a=a.next,c=a?.line;continue}if(a.end>i){a=a.next,c=a?.line;continue}let d=a.value||a.kind,f="";!e&&gve.indexOf(a.kind)>=0&&(d="*"),a.kind===oa.TokenKind.STRING&&(d=`"${d}"`),a.kind===oa.TokenKind.EOF&&(d=""),a.line>c?(o+=Eve(a.line-c),c=a.line,f=Yz(a.column-1)):a.line===a.prev?.line&&(f=Yz(a.start-(a.prev?.end||0))),o+=f+d,a&&(a=a.next)}}return o}Ht.getSourceFromLocation=e5;function t5(t,e,n){if(!t||t[Vs.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[Vs.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=r5(e,n,s.resolve)),s.type)){let i=n5(s.type);for(let a of i)t5(a,e,n)}})}Ht.wrapFields=t5;function n5(t){return"ofType"in t?n5(t.ofType):Tve(t)?t.getTypes():Sve(t)?[t]:[]}function Tve(t){return"getTypes"in t&&typeof t.getTypes=="function"}function Sve(t){return"getFields"in t&&typeof t.getFields=="function"}var Wz=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:$l.SpanStatusCode.ERROR,message:e.message}),t.end())},Kz=(t,e)=>{e&&t.end()};function r5(t,e,n,r=!1){if(o[Vs.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let d=e();if(d.ignoreTrivialResolveSpans&&r&&(uve(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[Vs.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let f=hve(d.mergeItems,c&&c.path),_=f.filter(T=>typeof T=="string").length,m,E=!1;if(d.depth>=0&&d.depth<_)m=Qz(a,f);else{let{field:T,spanAdded:S}=pve(t,e,a,c,f);m=T.span,E=S}return $l.context.with($l.trace.setSpan($l.context.active(),m),()=>{try{let T=n.call(this,s,i,a,c);return(0,Ht.isPromise)(T)?T.then(S=>(Kz(m,E),S),S=>{throw Wz(m,S,E),S}):(Kz(m,E),T)}catch(T){throw Wz(m,T,E),T}})}return o[Vs.OTEL_PATCHED_SYMBOL]=!0,o}Ht.wrapFieldResolver=r5});var s5=A(Vl=>{"use strict";p();u();l();Object.defineProperty(Vl,"__esModule",{value:!0});Vl.PACKAGE_NAME=Vl.PACKAGE_VERSION=void 0;Vl.PACKAGE_VERSION="0.57.0";Vl.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var c5=A(eS=>{"use strict";p();u();l();Object.defineProperty(eS,"__esModule",{value:!0});eS.GraphQLInstrumentation=void 0;var qs=(D(),v(j)),Zr=pe(),n_=BC(),JT=GC(),HC=XT(),Ave=Vz(),Rn=o5(),i5=s5(),a5={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},ZT=[">=14.0.0 <17"],FC=class extends Zr.InstrumentationBase{constructor(e={}){super(i5.PACKAGE_NAME,i5.PACKAGE_VERSION,{...a5,...e})}setConfig(e={}){super.setConfig({...a5,...e})}init(){let e=new Zr.InstrumentationNodeModuleDefinition("graphql",ZT);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new Zr.InstrumentationNodeModuleFile("graphql/execution/execute.js",ZT,e=>((0,Zr.isWrapped)(e.execute)&&this._unwrap(e,"execute"),this._wrap(e,"execute",this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,"execute")})}_addPatchingParser(){return new Zr.InstrumentationNodeModuleFile("graphql/language/parser.js",ZT,e=>((0,Zr.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new Zr.InstrumentationNodeModuleFile("graphql/validation/validate.js",ZT,e=>((0,Zr.isWrapped)(e.validate)&&this._unwrap(e,"validate"),this._wrap(e,"validate",this._patchValidate()),e),e=>{e&&this._unwrap(e,"validate")})}_patchExecute(e){let n=this;return function(o){return function(){let i;if(arguments.length>=2){let d=arguments;i=n._wrapExecuteArgs(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],e)}else{let d=arguments[0];i=n._wrapExecuteArgs(d.schema,d.document,d.rootValue,d.contextValue,d.variableValues,d.operationName,d.fieldResolver,d.typeResolver,e)}let a=(0,Rn.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[HC.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[HC.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},qs.context.with(qs.trace.setSpan(qs.context.active(),c),()=>(0,Zr.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(d,f)=>{n._handleExecutionResult(c,d,f)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,Rn.endSpan)(e,n);return}if((0,Rn.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,Rn.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,Rn.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,Rn.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,Zr.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,Rn.endSpan)(e,void 0)},!0)}_patchParse(){let e=this;return function(r){return function(s,i){return e._parse(this,r,s,i)}}}_patchValidate(){let e=this;return function(r){return function(s,i,a,c,d){return e._validate(this,r,s,i,a,d,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(n_.SpanNames.PARSE);return qs.context.with(qs.trace.setSpan(qs.context.active(),i),()=>(0,Zr.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,Rn.getOperation)(c)?c.loc&&(0,Rn.addSpanSource)(i,c.loc,s.allowValues):i.updateName(n_.SpanNames.SCHEMA_PARSE)),(0,Rn.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(n_.SpanNames.VALIDATE,{});return qs.context.with(qs.trace.setSpan(qs.context.active(),c),()=>(0,Zr.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(d,f)=>{o.loc||c.updateName(n_.SpanNames.SCHEMA_VALIDATE),f&&f.length&&c.recordException({name:JT.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(f)}),(0,Rn.endSpan)(c,d)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(n_.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(JT.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(JT.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=Ave.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(JT.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,Rn.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,Rn.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,d){if(o||(o={}),o[HC.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c};let f=a==null,_=a??d;return a=(0,Rn.wrapFieldResolver)(this.tracer,()=>this.getConfig(),_,f),e&&((0,Rn.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,Rn.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};eS.GraphQLInstrumentation=FC});var u5=A(tS=>{"use strict";p();u();l();Object.defineProperty(tS,"__esModule",{value:!0});tS.GraphQLInstrumentation=void 0;var Rve=c5();Object.defineProperty(tS,"GraphQLInstrumentation",{enumerable:!0,get:function(){return Rve.GraphQLInstrumentation}})});var m5=A(nS=>{"use strict";p();u();l();Object.defineProperty(nS,"__esModule",{value:!0});nS.EVENT_LISTENERS_SET=void 0;nS.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var h5=A(rS=>{"use strict";p();u();l();Object.defineProperty(rS,"__esModule",{value:!0});rS.bufferTextMapGetter=void 0;rS.bufferTextMapGetter={get(t,e){if(!t)return;let n=Object.keys(t);for(let r of n)if(r===e||r.toLowerCase()===e)return t[r]?.toString()},keys(t){return t?Object.keys(t):[]}}});var E5=A(Oe=>{"use strict";p();u();l();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.METRIC_MESSAGING_PROCESS_DURATION=Oe.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=Oe.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=Oe.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=Oe.MESSAGING_SYSTEM_VALUE_KAFKA=Oe.MESSAGING_OPERATION_TYPE_VALUE_SEND=Oe.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=Oe.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=Oe.ATTR_MESSAGING_SYSTEM=Oe.ATTR_MESSAGING_OPERATION_TYPE=Oe.ATTR_MESSAGING_OPERATION_NAME=Oe.ATTR_MESSAGING_KAFKA_OFFSET=Oe.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=Oe.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=Oe.ATTR_MESSAGING_DESTINATION_PARTITION_ID=Oe.ATTR_MESSAGING_DESTINATION_NAME=Oe.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;Oe.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";Oe.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";Oe.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";Oe.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";Oe.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";Oe.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";Oe.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";Oe.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";Oe.ATTR_MESSAGING_SYSTEM="messaging.system";Oe.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";Oe.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";Oe.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";Oe.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";Oe.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";Oe.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";Oe.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";Oe.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var g5=A(ql=>{"use strict";p();u();l();Object.defineProperty(ql,"__esModule",{value:!0});ql.PACKAGE_NAME=ql.PACKAGE_VERSION=void 0;ql.PACKAGE_VERSION="0.19.0";ql.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var I5=A(sS=>{"use strict";p();u();l();Object.defineProperty(sS,"__esModule",{value:!0});sS.KafkaJsInstrumentation=void 0;var Be=(D(),v(j)),eo=pe(),Yl=(Re(),v(ke)),T5=m5(),S5=h5(),J=E5(),A5=g5();function oS(t,e,n){return r=>{t.add(e,{...n,...r?{[Yl.ATTR_ERROR_TYPE]:r}:{}})}}function R5(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[Yl.ATTR_ERROR_TYPE]:r}:{}})}}var y5=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],$C=class extends eo.InstrumentationBase{constructor(e={}){super(A5.PACKAGE_NAME,A5.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(J.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:y5}}),this._sentMessages=this.meter.createCounter(J.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(J.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(J.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:y5}})}init(){let e=r=>{(0,eo.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,eo.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new eo.InstrumentationNodeModuleDefinition("kafkajs",[">=0.3.0 <3"],r=>(e(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),e)}_getConsumerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,eo.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[T5.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[T5.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[n,r]=e.payload.broker.split(":");this._clientDuration.record(e.payload.duration/1e3,{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[Yl.ATTR_SERVER_ADDRESS]:n,[Yl.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,eo.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,eo.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,eo.isWrapped)(s.transaction)&&e._unwrap(s,"transaction"),e._wrap(s,"transaction",e._getProducerTransactionPatch()),e._setKafkaEventListeners(s),s}}_getConsumerRunPatch(){let e=this;return n=>function(...o){let s=o[0];return s?.eachMessage&&((0,eo.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,eo.isWrapped)(s.eachBatch)&&e._unwrap(s,"eachBatch"),e._wrap(s,"eachBatch",e._getConsumerEachBatchPatch())),n.call(this,s)}}_getConsumerEachMessagePatch(){let e=this;return n=>function(...o){let s=o[0],i=Be.propagation.extract(Be.ROOT_CONTEXT,s.message.headers,S5.bufferTextMapGetter),a=e._startConsumerSpan({topic:s.topic,message:s.message,operationType:J.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:i,attributes:{[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}}),c=[R5(e._processDuration,Date.now(),{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_OPERATION_NAME]:"process",[J.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}),oS(e._consumedMessages,1,{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_OPERATION_NAME]:"process",[J.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)})],d=Be.context.with(Be.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c,d)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan({topic:s.batch.topic,message:void 0,operationType:J.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:Be.ROOT_CONTEXT,attributes:{[J.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return Be.context.with(Be.trace.setSpan(Be.context.active(),i),()=>{let a=Date.now(),c=[],d=[oS(n._consumedMessages,s.batch.messages.length,{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_OPERATION_NAME]:"process",[J.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)})];s.batch.messages.forEach(_=>{let m=Be.propagation.extract(Be.ROOT_CONTEXT,_.headers,S5.bufferTextMapGetter),E=Be.trace.getSpan(m)?.spanContext(),T;E&&(T={context:E}),c.push(n._startConsumerSpan({topic:s.batch.topic,message:_,operationType:J.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:T,attributes:{[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}})),d.push(R5(n._processDuration,a,{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_OPERATION_NAME]:"process",[J.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}))});let f=e.apply(this,o);return c.unshift(i),n._endSpansOnPromise(c,d,f)})}}}_getProducerTransactionPatch(){let e=this;return n=>function(...o){let s=e.tracer.startSpan("transaction"),i=n.apply(this,o);return i.then(a=>{let c=a.send;a.send=function(...E){return Be.context.with(Be.trace.setSpan(Be.context.active(),s),()=>e._getSendPatch()(c).apply(this,E).catch(S=>{throw s.setStatus({code:Be.SpanStatusCode.ERROR,message:S?.message}),s.recordException(S),S}))};let d=a.sendBatch;a.sendBatch=function(...E){return Be.context.with(Be.trace.setSpan(Be.context.active(),s),()=>e._getSendBatchPatch()(d).apply(this,E).catch(S=>{throw s.setStatus({code:Be.SpanStatusCode.ERROR,message:S?.message}),s.recordException(S),S}))};let f=a.commit;a.commit=function(...E){let T=f.apply(this,E).then(()=>{s.setStatus({code:Be.SpanStatusCode.OK})});return e._endSpansOnPromise([s],[],T)};let _=a.abort;a.abort=function(...E){let T=_.apply(this,E);return e._endSpansOnPromise([s],[],T)}}).catch(a=>{s.setStatus({code:Be.SpanStatusCode.ERROR,message:a?.message}),s.recordException(a),s.end()}),i}}_getSendBatchPatch(){let e=this;return n=>function(...o){let i=o[0].topicMessages||[],a=[],c=[];i.forEach(f=>{f.messages.forEach(_=>{a.push(e._startProducerSpan(f.topic,_)),c.push(oS(e._sentMessages,1,{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_OPERATION_NAME]:"send",[J.ATTR_MESSAGING_DESTINATION_NAME]:f.topic,..._.partition!==void 0?{[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(_.partition)}:{}}))})});let d=n.apply(this,o);return e._endSpansOnPromise(a,c,d)}}_getSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(d=>e._startProducerSpan(s.topic,d)),a=s.messages.map(d=>oS(e._sentMessages,1,{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_OPERATION_NAME]:"send",[J.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,...d.partition!==void 0?{[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(d.partition)}:{}})),c=n.apply(this,o);return e._endSpansOnPromise(i,a,c)}}_endSpansOnPromise(e,n,r){return Promise.resolve(r).then(o=>(n.forEach(s=>s()),o)).catch(o=>{let s,i=Yl.ERROR_TYPE_VALUE_OTHER;throw typeof o=="string"||o===void 0?s=o:typeof o=="object"&&Object.prototype.hasOwnProperty.call(o,"message")&&(s=o.message,i=o.constructor.name),n.forEach(a=>a(i)),e.forEach(a=>{a.setAttribute(Yl.ATTR_ERROR_TYPE,i),a.setStatus({code:Be.SpanStatusCode.ERROR,message:s})}),o}).finally(()=>{e.forEach(o=>o.end())})}_startConsumerSpan({topic:e,message:n,operationType:r,ctx:o,link:s,attributes:i}){let a=r===J.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?"poll":r,c=this.tracer.startSpan(`${a} ${e}`,{kind:r===J.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?Be.SpanKind.CLIENT:Be.SpanKind.CONSUMER,attributes:{...i,[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_DESTINATION_NAME]:e,[J.ATTR_MESSAGING_OPERATION_TYPE]:r,[J.ATTR_MESSAGING_OPERATION_NAME]:a,[J.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n?.key?String(n.key):void 0,[J.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n?.key&&n.value===null?!0:void 0,[J.ATTR_MESSAGING_KAFKA_OFFSET]:n?.offset},links:s?[s]:[]},o),{consumerHook:d}=this.getConfig();return d&&n&&(0,eo.safeExecuteInTheMiddle)(()=>d(c,{topic:e,message:n}),f=>{f&&this._diag.error("consumerHook error",f)},!0),c}_startProducerSpan(e,n){let r=this.tracer.startSpan(`send ${e}`,{kind:Be.SpanKind.PRODUCER,attributes:{[J.ATTR_MESSAGING_SYSTEM]:J.MESSAGING_SYSTEM_VALUE_KAFKA,[J.ATTR_MESSAGING_DESTINATION_NAME]:e,[J.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n.key?String(n.key):void 0,[J.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n.key&&n.value===null?!0:void 0,[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:n.partition!==void 0?String(n.partition):void 0,[J.ATTR_MESSAGING_OPERATION_NAME]:"send",[J.ATTR_MESSAGING_OPERATION_TYPE]:J.MESSAGING_OPERATION_TYPE_VALUE_SEND}});n.headers=n.headers??{},Be.propagation.inject(Be.trace.setSpan(Be.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,eo.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};sS.KafkaJsInstrumentation=$C});var N5=A(iS=>{"use strict";p();u();l();Object.defineProperty(iS,"__esModule",{value:!0});iS.KafkaJsInstrumentation=void 0;var Nve=I5();Object.defineProperty(iS,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return Nve.KafkaJsInstrumentation}})});var M5=A(Wl=>{"use strict";p();u();l();Object.defineProperty(Wl,"__esModule",{value:!0});Wl.PACKAGE_NAME=Wl.PACKAGE_VERSION=void 0;Wl.PACKAGE_VERSION="0.54.0";Wl.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var D5=A(aS=>{"use strict";p();u();l();Object.defineProperty(aS,"__esModule",{value:!0});aS.LruMemoizerInstrumentation=void 0;var v5=(D(),v(j)),x5=pe(),L5=M5(),VC=class extends x5.InstrumentationBase{constructor(e={}){super(L5.PACKAGE_NAME,L5.PACKAGE_VERSION,e)}init(){return[new x5.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <3"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?v5.context.bind(v5.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};aS.LruMemoizerInstrumentation=VC});var w5=A(cS=>{"use strict";p();u();l();Object.defineProperty(cS,"__esModule",{value:!0});cS.LruMemoizerInstrumentation=void 0;var bve=D5();Object.defineProperty(cS,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return bve.LruMemoizerInstrumentation}})});var j5=A(tt=>{"use strict";p();u();l();Object.defineProperty(tt,"__esModule",{value:!0});tt.METRIC_DB_CLIENT_CONNECTIONS_USAGE=tt.DB_SYSTEM_VALUE_MONGODB=tt.DB_SYSTEM_NAME_VALUE_MONGODB=tt.ATTR_NET_PEER_PORT=tt.ATTR_NET_PEER_NAME=tt.ATTR_DB_SYSTEM=tt.ATTR_DB_STATEMENT=tt.ATTR_DB_OPERATION=tt.ATTR_DB_NAME=tt.ATTR_DB_MONGODB_COLLECTION=tt.ATTR_DB_CONNECTION_STRING=void 0;tt.ATTR_DB_CONNECTION_STRING="db.connection_string";tt.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";tt.ATTR_DB_NAME="db.name";tt.ATTR_DB_OPERATION="db.operation";tt.ATTR_DB_STATEMENT="db.statement";tt.ATTR_DB_SYSTEM="db.system";tt.ATTR_NET_PEER_NAME="net.peer.name";tt.ATTR_NET_PEER_PORT="net.peer.port";tt.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";tt.DB_SYSTEM_VALUE_MONGODB="mongodb";tt.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var H5=A(r_=>{"use strict";p();u();l();Object.defineProperty(r_,"__esModule",{value:!0});r_.MongodbCommandType=void 0;var Pve;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(Pve=r_.MongodbCommandType||(r_.MongodbCommandType={}))});var F5=A(Kl=>{"use strict";p();u();l();Object.defineProperty(Kl,"__esModule",{value:!0});Kl.PACKAGE_NAME=Kl.PACKAGE_VERSION=void 0;Kl.PACKAGE_VERSION="0.63.0";Kl.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var q5=A(uS=>{"use strict";p();u();l();Object.defineProperty(uS,"__esModule",{value:!0});uS.MongoDBInstrumentation=void 0;var ot=(D(),v(j)),be=pe(),Ys=(Re(),v(ke)),Rr=j5(),jc=H5(),$5=F5(),V5={requireParentSpan:!0},qC=class t extends be.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super($5.PACKAGE_NAME,$5.PACKAGE_VERSION,{...V5,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,be.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,be.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...V5,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter(Rr.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsage?.add(e,{"pool.name":n,state:r})}init(){let{v3PatchConnection:e,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnect:r,v4UnpatchConnect:o}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:s,v4PatchConnectionPromise:i,v4UnpatchConnection:a}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:c,v4UnpatchConnectionPool:d}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:f,v4UnpatchSessions:_}=this._getV4SessionsPatches();return[new be.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new be.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new be.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new be.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new be.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new be.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,d),new be.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new be.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],f,_)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,be.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,be.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,be.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,be.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,be.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,be.isWrapped)(e.getMore)&&this._unwrap(e,"getMore"),this._wrap(e,"getMore",this._getV3PatchCursor()),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"))}}}_getV4SessionsPatches(){return{v4PatchSessions:e=>((0,be.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,be.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,be.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,be.isWrapped)(e.release)&&this._unwrap(e,"release"))}}}_getV4AcquireCommand(){let e=this;return n=>function(){let o=this.sessions.length,s=n.call(this),i=this.sessions.length;return o===i?e._connCountAdd(1,e._poolName,"used"):o-1===i&&(e._connCountAdd(-1,e._poolName,"idle"),e._connCountAdd(1,e._poolName,"used")),s}}_getV4ReleaseCommand(){let e=this;return n=>function(o){let s=n.call(this,o);return e._connCountAdd(-1,e._poolName,"used"),e._connCountAdd(1,e._poolName,"idle"),s}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let n=e.ConnectionPool.prototype;return(0,be.isWrapped)(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",this._getV4ConnectionPoolCheckOut()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectPatches(){return{v4PatchConnect:e=>((0,be.isWrapped)(e.connect)&&this._unwrap(e,"connect"),this._wrap(e,"connect",this._getV4ConnectCommand()),e),v4UnpatchConnect:e=>{e!==void 0&&this._unwrap(e,"connect")}}}_getV4ConnectionPoolCheckOut(){return e=>function(r){let o=ot.context.bind(ot.context.active(),r);return e.call(this,o)}}_getV4ConnectCommand(){let e=this;return n=>function(o,s){if(n.length===1){let a=n.call(this,o);return a&&typeof a.then=="function"&&a.then(()=>e.setPoolName(o),()=>{}),a}let i=function(a,c){if(a||!c){s(a,c);return}e.setPoolName(o),s(a,c)};return n.call(this,o,i)}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>((0,be.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,be.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandPromise()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,"command")}}}_getV3PatchOperation(e){let n=this;return r=>function(s,i,a,c,d){let f=ot.trace.getSpan(ot.context.active()),_=n._checkSkipInstrumentation(f),m=typeof c=="function"?c:d;if(_||typeof m!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,d);let E=n._getV3SpanAttributes(i,s,a[0],e),T=n._spanNameFromAttrs(E),S=n.tracer.startSpan(T,{kind:ot.SpanKind.CLIENT,attributes:E}),R=n._patchEnd(S,m);return typeof c=="function"?r.call(this,s,i,a,R):r.call(this,s,i,a,c,R)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let d=ot.trace.getSpan(ot.context.active()),f=e._checkSkipInstrumentation(d),_=typeof a=="function"?a:c;if(f||typeof _!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let m=t._getCommandType(i),E=m===jc.MongodbCommandType.UNKNOWN?void 0:m,T=e._getV3SpanAttributes(s,o,i,E),S=e._spanNameFromAttrs(T),R=e.tracer.startSpan(S,{kind:ot.SpanKind.CLIENT,attributes:T}),N=e._patchEnd(R,_);return typeof a=="function"?n.call(this,o,s,i,N):n.call(this,o,s,i,a,N)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=ot.trace.getSpan(ot.context.active()),d=e._checkSkipInstrumentation(c),f=a,_=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let m;if(!d){let T=e._getV4SpanAttributes(this,o,s,_),S=e._spanNameFromAttrs(T);m=e.tracer.startSpan(S,{kind:ot.SpanKind.CLIENT,attributes:T})}let E=e._patchEnd(m,f,this.id,_);return n.call(this,o,s,i,E)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=ot.trace.getSpan(ot.context.active()),c=e._checkSkipInstrumentation(a),d=Object.keys(i)[0],f=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let _;if(!c){let T=e._getV4SpanAttributes(this,s,i,d),S=e._spanNameFromAttrs(T);_=e.tracer.startSpan(S,{kind:ot.SpanKind.CLIENT,attributes:T})}let m=e._patchEnd(_,f,this.id,d),E=n.apply(this,o);return E.then(T=>m(null,T),T=>m(T)),E}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,d){let f=ot.trace.getSpan(ot.context.active()),_=e._checkSkipInstrumentation(f),m=typeof c=="function"?c:d;if(_||typeof m!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,d);let E=e._getV3SpanAttributes(s,o,i,"find"),T=e._spanNameFromAttrs(E),S=e.tracer.startSpan(T,{kind:ot.SpanKind.CLIENT,attributes:E}),R=e._patchEnd(S,m);return typeof c=="function"?n.call(this,o,s,i,a,R):n.call(this,o,s,i,a,c,R)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,d){let f=ot.trace.getSpan(ot.context.active()),_=e._checkSkipInstrumentation(f),m=typeof c=="function"?c:d;if(_||typeof m!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,d);let E=e._getV3SpanAttributes(s,o,i.cmd,"getMore"),T=e._spanNameFromAttrs(E),S=e.tracer.startSpan(T,{kind:ot.SpanKind.CLIENT,attributes:E}),R=e._patchEnd(S,m);return typeof c=="function"?n.call(this,o,s,i,a,R):n.call(this,o,s,i,a,c,R)}}static _getCommandType(e){return e.createIndexes!==void 0?jc.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?jc.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?jc.MongodbCommandType.IS_MASTER:e.count!==void 0?jc.MongodbCommandType.COUNT:e.aggregate!==void 0?jc.MongodbCommandType.AGGREGATE:jc.MongodbCommandType.UNKNOWN}_getV4SpanAttributes(e,n,r,o){let s,i;if(e){let c=typeof e.address=="string"?e.address.split(":"):"";c.length===2&&(s=c[0],i=c[1])}let a;return r?.documents&&r.documents[0]?a=r.documents[0]:r?.cursors?a=r.cursors:a=r,this._getSpanAttributes(n.db,n.collection,s,i,a,o)}_getV3SpanAttributes(e,n,r,o){let s,i;if(n&&n.s&&(s=n.s.options?.host??n.s.host,i=(n.s.options?.port??n.s.port)?.toString(),s==null||i==null)){let f=n.description?.address;if(f){let _=f.split(":");s=_[0],i=_[1]}}let[a,c]=e.toString().split("."),d=r?.query??r?.q??r;return this._getSpanAttributes(a,c,s,i,d,o)}_getSpanAttributes(e,n,r,o,s,i){let a={};if(this._dbSemconvStability&be.SemconvStability.OLD&&(a[Rr.ATTR_DB_SYSTEM]=Rr.DB_SYSTEM_VALUE_MONGODB,a[Rr.ATTR_DB_NAME]=e,a[Rr.ATTR_DB_MONGODB_COLLECTION]=n,a[Rr.ATTR_DB_OPERATION]=i,a[Rr.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&be.SemconvStability.STABLE&&(a[Ys.ATTR_DB_SYSTEM_NAME]=Rr.DB_SYSTEM_NAME_VALUE_MONGODB,a[Ys.ATTR_DB_NAMESPACE]=e,a[Ys.ATTR_DB_OPERATION_NAME]=i,a[Ys.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&be.SemconvStability.OLD&&(a[Rr.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&be.SemconvStability.STABLE&&(a[Ys.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&be.SemconvStability.OLD&&(a[Rr.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&be.SemconvStability.STABLE&&(a[Ys.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),d=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,be.safeExecuteInTheMiddle)(()=>{let f=d(s);this._dbSemconvStability&be.SemconvStability.OLD&&(a[Rr.ATTR_DB_STATEMENT]=f),this._dbSemconvStability&be.SemconvStability.STABLE&&(a[Ys.ATTR_DB_QUERY_TEXT]=f)},f=>{f&&this._diag.error("Error running dbStatementSerializer hook",f)},!0)}return a}_spanNameFromAttrs(e){let n;return this._dbSemconvStability&be.SemconvStability.STABLE?n=[e[Ys.ATTR_DB_OPERATION_NAME],e[Ys.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||Rr.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[Rr.ATTR_DB_OPERATION]||"command"}`,n}_getDefaultDbStatementReplacer(){let e=new WeakSet;return(n,r)=>typeof r!="object"||!r?"?":e.has(r)?"[Circular]":(e.add(r),r)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:n}=this.getConfig();return n?JSON.stringify(e):JSON.stringify(e,this._getDefaultDbStatementReplacer())}_handleExecutionResult(e,n){let{responseHook:r}=this.getConfig();typeof r=="function"&&(0,be.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=ot.context.active(),i=this,a=!1;return function(...d){if(!a){a=!0;let f=d[0];if(e){if(f instanceof Error)e.setStatus({code:ot.SpanStatusCode.ERROR,message:f.message});else{let _=d[1];i._handleExecutionResult(e,_)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return ot.context.with(s,()=>n.apply(this,d))}}setPoolName(e){let n=e.hostAddress?.host,r=e.hostAddress?.port,o=e.dbName,s=`mongodb://${n}:${r}/${o}`;this._poolName=s}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}};uS.MongoDBInstrumentation=qC});var Y5=A(o_=>{"use strict";p();u();l();Object.defineProperty(o_,"__esModule",{value:!0});o_.MongodbCommandType=void 0;var Mve;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(Mve=o_.MongodbCommandType||(o_.MongodbCommandType={}))});var W5=A(zl=>{"use strict";p();u();l();Object.defineProperty(zl,"__esModule",{value:!0});zl.MongodbCommandType=zl.MongoDBInstrumentation=void 0;var vve=q5();Object.defineProperty(zl,"MongoDBInstrumentation",{enumerable:!0,get:function(){return vve.MongoDBInstrumentation}});var xve=Y5();Object.defineProperty(zl,"MongodbCommandType",{enumerable:!0,get:function(){return xve.MongodbCommandType}})});var WC=A(xt=>{"use strict";p();u();l();Object.defineProperty(xt,"__esModule",{value:!0});xt.DB_SYSTEM_NAME_VALUE_MONGODB=xt.ATTR_NET_PEER_PORT=xt.ATTR_NET_PEER_NAME=xt.ATTR_DB_USER=xt.ATTR_DB_SYSTEM=xt.ATTR_DB_STATEMENT=xt.ATTR_DB_OPERATION=xt.ATTR_DB_NAME=xt.ATTR_DB_MONGODB_COLLECTION=void 0;xt.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";xt.ATTR_DB_NAME="db.name";xt.ATTR_DB_OPERATION="db.operation";xt.ATTR_DB_STATEMENT="db.statement";xt.ATTR_DB_SYSTEM="db.system";xt.ATTR_DB_USER="db.user";xt.ATTR_NET_PEER_NAME="net.peer.name";xt.ATTR_NET_PEER_PORT="net.peer.port";xt.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var e9=A(sa=>{"use strict";p();u();l();Object.defineProperty(sa,"__esModule",{value:!0});sa.handleCallbackResponse=sa.handlePromiseResponse=sa.getAttributesFromCollection=void 0;var J5=(D(),v(j)),i_=pe(),s_=WC(),lS=(Re(),v(ke));function Bve(t,e,n){let r={};return e&i_.SemconvStability.OLD&&(r[s_.ATTR_DB_MONGODB_COLLECTION]=t.name,r[s_.ATTR_DB_NAME]=t.conn.name,r[s_.ATTR_DB_USER]=t.conn.user),e&i_.SemconvStability.STABLE&&(r[lS.ATTR_DB_COLLECTION_NAME]=t.name,r[lS.ATTR_DB_NAMESPACE]=t.conn.name),n&i_.SemconvStability.OLD&&(r[s_.ATTR_NET_PEER_NAME]=t.conn.host,r[s_.ATTR_NET_PEER_PORT]=t.conn.port),n&i_.SemconvStability.STABLE&&(r[lS.ATTR_SERVER_ADDRESS]=t.conn.host,r[lS.ATTR_SERVER_PORT]=t.conn.port),r}sa.getAttributesFromCollection=Bve;function Z5(t,e={}){t.recordException(e),t.setStatus({code:J5.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
115
- Mongoose Error Code: ${e.code}`:""}`})}function KC(t,e,n,r=void 0){n&&(0,i_.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&J5.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function Gve(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(KC(e,o,n,r),o)).catch(o=>{throw Z5(e,o),o}).finally(()=>e.end()):(KC(e,t,n,r),e.end(),t)}sa.handlePromiseResponse=Gve;function jve(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2?a=1:o.length===3&&(a=2),o[a]=(c,d)=>(c?Z5(r,c):KC(r,d,s,i),r.end(),t(c,d)),e.apply(n,o)}sa.handleCallbackResponse=jve});var t9=A(Xl=>{"use strict";p();u();l();Object.defineProperty(Xl,"__esModule",{value:!0});Xl.PACKAGE_NAME=Xl.PACKAGE_VERSION=void 0;Xl.PACKAGE_VERSION="0.56.0";Xl.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var i9=A(ar=>{"use strict";p();u();l();Object.defineProperty(ar,"__esModule",{value:!0});ar.MongooseInstrumentation=ar._ALREADY_INSTRUMENTED=ar._STORED_PARENT_SPAN=void 0;var Ft=(D(),v(j)),Hve=De(),zC=e9(),sn=pe(),n9=t9(),ia=WC(),Hc=(Re(),v(ke)),pS=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],Fve=["remove","count","findOneAndRemove",...pS],$ve=["count","findOneAndRemove",...pS],Vve=[...pS];function r9(t){return t?t.startsWith("6.")||t.startsWith("5.")?Fve:t.startsWith("7.")?$ve:Vve:pS}function o9(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function s9(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}ar._STORED_PARENT_SPAN=Symbol("stored-parent-span");ar._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var XC=class extends sn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(n9.PACKAGE_NAME,n9.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,sn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,sn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new sn.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <9"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save",n)),r.Model.prototype.$save=r.Model.prototype.save,o9(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),s9(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne",n)),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne",n))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec(n)),r9(n).forEach(s=>{this._wrap(r.Query.prototype,s,this.patchAndCaptureSpanContext(s))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany",n)),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite",n)),r}unpatch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e,o=r9(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,o9(n)&&this._unwrap(r.Model.prototype,"remove"),s9(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(s=>{this._unwrap(r.Query.prototype,s)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return r.apply(this,arguments);let i=this[ar._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let f=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&sn.SemconvStability.OLD&&(a[ia.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&sn.SemconvStability.STABLE&&(a[Hc.ATTR_DB_QUERY_TEXT]=f)}let d=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(d,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[ar._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return r.apply(this,arguments);let i=this[ar._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let f=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&sn.SemconvStability.OLD&&(a[ia.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&sn.SemconvStability.STABLE&&(a[Hc.ATTR_DB_QUERY_TEXT]=f)}let d=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(d,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let d={},{dbStatementSerializer:f}=r.getConfig();if(f){let m=f(e,c);r._dbSemconvStability&sn.SemconvStability.OLD&&(d[ia.ATTR_DB_STATEMENT]=m),r._dbSemconvStability&sn.SemconvStability.STABLE&&(d[Hc.ATTR_DB_QUERY_TEXT]=m)}let _=r._startSpan(this.constructor.collection,this.constructor.modelName,e,d);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(_,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return o.apply(this,arguments);let d=c,f=i,_=a;typeof i=="function"?(d=i,f=void 0,_=void 0):typeof a=="function"&&(d=a,_=void 0);let m={},E=r.getConfig().dbStatementSerializer;if(E){let R=E(e,{condition:{_id:this._id},updates:f,options:_});r._dbSemconvStability&sn.SemconvStability.OLD&&(m[ia.ATTR_DB_STATEMENT]=R),r._dbSemconvStability&sn.SemconvStability.STABLE&&(m[Hc.ATTR_DB_QUERY_TEXT]=R)}let T=r._startSpan(this.constructor.collection,this.constructor.modelName,e,m),S=r._handleResponse(T,o,this,arguments,d,n);return S&&typeof S=="object"&&(S[ar._ALREADY_INSTRUMENTED]=!0),S}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let d={};switch(e){case"insertMany":d.documents=i;break;case"bulkWrite":d.operations=i;break;default:d.document=i;break}a!==void 0&&(d.options=a);let f={},{dbStatementSerializer:_}=r.getConfig();if(_){let E=_(e,d);r._dbSemconvStability&sn.SemconvStability.OLD&&(f[ia.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&sn.SemconvStability.STABLE&&(f[Hc.ATTR_DB_QUERY_TEXT]=E)}let m=r._startSpan(this.collection,this.modelName,e,f);return r._handleResponse(m,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=Ft.trace.getSpan(Ft.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[ar._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[ar._STORED_PARENT_SPAN]=Ft.trace.getSpan(Ft.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,zC.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&sn.SemconvStability.OLD&&(i[ia.ATTR_DB_OPERATION]=r,i[ia.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&sn.SemconvStability.STABLE&&(i[Hc.ATTR_DB_OPERATION_NAME]=r,i[Hc.ATTR_DB_SYSTEM_NAME]=ia.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&sn.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Ft.SpanKind.CLIENT,attributes:i},s?Ft.trace.setSpan(Ft.context.active(),s):void 0)}_handleResponse(e,n,r,o,s,i=void 0){let a=this;if(s instanceof Function)return a._callOriginalFunction(()=>(0,zC.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,zC.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Ft.context.with((0,Hve.suppressTracing)(Ft.context.active()),e):e()}};ar.MongooseInstrumentation=XC});var a9=A(dS=>{"use strict";p();u();l();Object.defineProperty(dS,"__esModule",{value:!0});dS.MongooseInstrumentation=void 0;var qve=i9();Object.defineProperty(dS,"MongooseInstrumentation",{enumerable:!0,get:function(){return qve.MongooseInstrumentation}})});var d9=A(Lt=>{"use strict";p();u();l();Object.defineProperty(Lt,"__esModule",{value:!0});Lt.METRIC_DB_CLIENT_CONNECTIONS_USAGE=Lt.DB_SYSTEM_VALUE_MYSQL=Lt.ATTR_NET_PEER_PORT=Lt.ATTR_NET_PEER_NAME=Lt.ATTR_DB_USER=Lt.ATTR_DB_SYSTEM=Lt.ATTR_DB_STATEMENT=Lt.ATTR_DB_NAME=Lt.ATTR_DB_CONNECTION_STRING=void 0;Lt.ATTR_DB_CONNECTION_STRING="db.connection_string";Lt.ATTR_DB_NAME="db.name";Lt.ATTR_DB_STATEMENT="db.statement";Lt.ATTR_DB_SYSTEM="db.system";Lt.ATTR_DB_USER="db.user";Lt.ATTR_NET_PEER_NAME="net.peer.name";Lt.ATTR_NET_PEER_PORT="net.peer.port";Lt.DB_SYSTEM_VALUE_MYSQL="mysql";Lt.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var f9=A(a_=>{"use strict";p();u();l();Object.defineProperty(a_,"__esModule",{value:!0});a_.AttributeNames=void 0;var Wve;(function(t){t.MYSQL_VALUES="db.mysql.values"})(Wve=a_.AttributeNames||(a_.AttributeNames={}))});var _9=A(yn=>{"use strict";p();u();l();Object.defineProperty(yn,"__esModule",{value:!0});yn.getPoolNameOld=yn.arrayStringifyHelper=yn.getSpanName=yn.getDbValues=yn.getDbQueryText=yn.getJDBCString=yn.getConfig=void 0;function Kve(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}yn.getConfig=Kve;function zve(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}yn.getJDBCString=zve;function Xve(t){return typeof t=="string"?t:t.sql}yn.getDbQueryText=Xve;function Qve(t,e){return QC(typeof t=="string"?e:e||t.values)}yn.getDbValues=Qve;function Jve(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}yn.getSpanName=Jve;function QC(t){return t?`[${t.toString()}]`:""}yn.arrayStringifyHelper=QC;function Zve(t){let e=t.config.connectionConfig,n="";return n+=e.host?`host: '${e.host}', `:"",n+=e.port?`port: ${e.port}, `:"",n+=e.database?`database: '${e.database}', `:"",n+=e.user?`user: '${e.user}'`:"",e.user||(n=n.substring(0,n.length-2)),n.trim()}yn.getPoolNameOld=Zve});var m9=A(Ql=>{"use strict";p();u();l();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.PACKAGE_NAME=Ql.PACKAGE_VERSION=void 0;Ql.PACKAGE_VERSION="0.56.0";Ql.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var E9=A(fS=>{"use strict";p();u();l();Object.defineProperty(fS,"__esModule",{value:!0});fS.MySQLInstrumentation=void 0;var cr=(D(),v(j)),to=pe(),Jl=(Re(),v(ke)),Ws=d9(),exe=f9(),Fc=_9(),h9=m9(),JC=class extends to.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(h9.PACKAGE_NAME,h9.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,to.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,to.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Ws.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsageOld?.add(e,{state:r,name:n})}init(){return[new to.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,to.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,to.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,to.isWrapped)(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 n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),s}}}_patchCreatePool(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"end",n._patchPoolEnd(s)),n._setPoolCallbacks(s,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,d=(0,Fc.getPoolNameOld)(e);r._connCountAdd(-c,d,"used"),r._connCountAdd(-a,d,"idle"),n.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"add",n._patchAdd(s)),s}}}_patchAdd(e){return n=>{let r=this;return function(s,i){if(!r._enabled)return r._unwrap(e,"add"),n.apply(e,arguments);n.apply(e,arguments);let a=e._nodes;if(a){let c=typeof s=="object"?"CLUSTER::"+e._lastId:String(s),d=a[c].pool;r._setPoolCallbacks(d,s)}}}}_patchGetConnection(e){return n=>{let r=this;return function(s,i,a){if(!r._enabled)return r._unwrap(e,"getConnection"),n.apply(e,arguments);if(arguments.length===1&&typeof s=="function"){let c=r._getConnectionCallbackPatchFn(s);return n.call(e,c)}if(arguments.length===2&&typeof i=="function"){let c=r._getConnectionCallbackPatchFn(i);return n.call(e,s,c)}if(arguments.length===3&&typeof a=="function"){let c=r._getConnectionCallbackPatchFn(a);return n.call(e,s,i,c)}return n.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let n=this,r=cr.context.active();return function(o,s){s&&((0,to.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&cr.context.with(r,e,this,o,s)}}_patchQuery(e){return n=>{let r=this;return function(o,s,i){if(!r._enabled)return r._unwrap(e,"query"),n.apply(e,arguments);let a={},{host:c,port:d,database:f,user:_}=(0,Fc.getConfig)(e.config),m=parseInt(d,10),E=(0,Fc.getDbQueryText)(o);r._dbSemconvStability&to.SemconvStability.OLD&&(a[Ws.ATTR_DB_SYSTEM]=Ws.DB_SYSTEM_VALUE_MYSQL,a[Ws.ATTR_DB_CONNECTION_STRING]=(0,Fc.getJDBCString)(c,d,f),a[Ws.ATTR_DB_NAME]=f,a[Ws.ATTR_DB_USER]=_,a[Ws.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&to.SemconvStability.STABLE&&(a[Jl.ATTR_DB_SYSTEM_NAME]=Jl.DB_SYSTEM_NAME_VALUE_MYSQL,a[Jl.ATTR_DB_NAMESPACE]=f,a[Jl.ATTR_DB_QUERY_TEXT]=E),r._netSemconvStability&to.SemconvStability.OLD&&(a[Ws.ATTR_NET_PEER_NAME]=c,isNaN(m)||(a[Ws.ATTR_NET_PEER_PORT]=m)),r._netSemconvStability&to.SemconvStability.STABLE&&(a[Jl.ATTR_SERVER_ADDRESS]=c,isNaN(m)||(a[Jl.ATTR_SERVER_PORT]=m));let T=r.tracer.startSpan((0,Fc.getSpanName)(o),{kind:cr.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let N;Array.isArray(s)?N=s:arguments[2]&&(N=[s]),T.setAttribute(exe.AttributeNames.MYSQL_VALUES,(0,Fc.getDbValues)(o,N))}let S=Array.from(arguments).findIndex(N=>typeof N=="function"),R=cr.context.active();if(S===-1){let N=cr.context.with(cr.trace.setSpan(cr.context.active(),T),()=>n.apply(e,arguments));return cr.context.bind(R,N),N.on("error",y=>T.setStatus({code:cr.SpanStatusCode.ERROR,message:y.message})).on("end",()=>{T.end()})}else return r._wrap(arguments,S,r._patchCallbackQuery(T,R)),cr.context.with(cr.trace.setSpan(cr.context.active(),T),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:cr.SpanStatusCode.ERROR,message:o.message}),e.end(),cr.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Fc.getPoolNameOld)(e);e.on("connection",o=>{this._connCountAdd(1,r,"idle")}),e.on("acquire",o=>{this._connCountAdd(-1,r,"idle"),this._connCountAdd(1,r,"used")}),e.on("release",o=>{this._connCountAdd(1,r,"idle"),this._connCountAdd(-1,r,"used")})}};fS.MySQLInstrumentation=JC});var g9=A(_S=>{"use strict";p();u();l();Object.defineProperty(_S,"__esModule",{value:!0});_S.MySQLInstrumentation=void 0;var txe=E9();Object.defineProperty(_S,"MySQLInstrumentation",{enumerable:!0,get:function(){return txe.MySQLInstrumentation}})});var ZC=A(zt=>{"use strict";p();u();l();Object.defineProperty(zt,"__esModule",{value:!0});zt.DB_SYSTEM_VALUE_MYSQL=zt.ATTR_NET_PEER_PORT=zt.ATTR_NET_PEER_NAME=zt.ATTR_DB_USER=zt.ATTR_DB_SYSTEM=zt.ATTR_DB_STATEMENT=zt.ATTR_DB_NAME=zt.ATTR_DB_CONNECTION_STRING=void 0;zt.ATTR_DB_CONNECTION_STRING="db.connection_string";zt.ATTR_DB_NAME="db.name";zt.ATTR_DB_STATEMENT="db.statement";zt.ATTR_DB_SYSTEM="db.system";zt.ATTR_DB_USER="db.user";zt.ATTR_NET_PEER_NAME="net.peer.name";zt.ATTR_NET_PEER_PORT="net.peer.port";zt.DB_SYSTEM_VALUE_MYSQL="mysql"});var tP=A(mS=>{"use strict";p();u();l();Object.defineProperty(mS,"__esModule",{value:!0});mS.addSqlCommenterComment=void 0;var eP=(D(),v(j)),rxe=De();function oxe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function sxe(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function ixe(t,e){if(typeof e!="string"||e.length===0||oxe(e))return e;let n=new rxe.W3CTraceContextPropagator,r={};n.inject(eP.trace.setSpan(eP.ROOT_CONTEXT,t),r,eP.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=sxe(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}mS.addSqlCommenterComment=ixe});var y9=A(no=>{"use strict";p();u();l();Object.defineProperty(no,"__esModule",{value:!0});no.getConnectionPrototypeToInstrument=no.once=no.getSpanName=no.getQueryText=no.getConnectionAttributes=void 0;var c_=ZC(),hS=pe(),nP=(Re(),v(ke));function axe(t,e,n){let{host:r,port:o,database:s,user:i}=cxe(t),a={};e&hS.SemconvStability.OLD&&(a[c_.ATTR_DB_CONNECTION_STRING]=uxe(r,o,s),a[c_.ATTR_DB_NAME]=s,a[c_.ATTR_DB_USER]=i),e&hS.SemconvStability.STABLE&&(a[nP.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&hS.SemconvStability.OLD&&(a[c_.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[c_.ATTR_NET_PEER_PORT]=c)),n&hS.SemconvStability.STABLE&&(a[nP.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[nP.ATTR_SERVER_PORT]=c)),a}no.getConnectionAttributes=axe;function cxe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function uxe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function lxe(t,e,n,r=!1,o=pxe){let[s,i]=typeof t=="string"?[t,n]:[t.sql,dxe(t)?n||t.values:n];try{return r?o(s):e&&i?e(s,i):s}catch{return"Could not determine the query due to an error in masking or formatting"}}no.getQueryText=lxe;function pxe(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function dxe(t){return"values"in t}function fxe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}no.getSpanName=fxe;var _xe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};no.once=_xe;function mxe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}no.getConnectionPrototypeToInstrument=mxe});var I9=A(Zl=>{"use strict";p();u();l();Object.defineProperty(Zl,"__esModule",{value:!0});Zl.PACKAGE_NAME=Zl.PACKAGE_VERSION=void 0;Zl.PACKAGE_VERSION="0.56.0";Zl.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var C9=A(ES=>{"use strict";p();u();l();Object.defineProperty(ES,"__esModule",{value:!0});ES.MySQL2Instrumentation=void 0;var N9=(D(),v(j)),vo=pe(),rP=ZC(),O9=tP(),ep=y9(),b9=I9(),oP=(Re(),v(ke)),sP=[">=1.4.2 <4"],iP=class extends vo.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(b9.PACKAGE_NAME,b9.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,vo.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,vo.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,vo.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,vo.isWrapped)(s.execute)&&this._unwrap(s,"execute"),this._wrap(s,"execute",this._patchQuery(e,!0))},o=s=>{this._unwrap(s,"query"),this._unwrap(s,"execute")};return[new vo.InstrumentationNodeModuleDefinition("mysql2",sP,s=>(n(s),s),()=>{},[new vo.InstrumentationNodeModuleFile("mysql2/promise.js",sP,s=>(n(s),s),()=>{}),new vo.InstrumentationNodeModuleFile("mysql2/lib/connection.js",sP,s=>{let i=(0,ep.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,ep.getConnectionPrototypeToInstrument)(s);o(i)})])]}_patchQuery(e,n){return r=>{let o=this;return function(s,i,a){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let{maskStatement:d,maskStatementHook:f,responseHook:_}=o.getConfig(),m=(0,ep.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),E=(0,ep.getQueryText)(s,e,c,d,f);o._dbSemconvStability&vo.SemconvStability.OLD&&(m[rP.ATTR_DB_SYSTEM]=rP.DB_SYSTEM_VALUE_MYSQL,m[rP.ATTR_DB_STATEMENT]=E),o._dbSemconvStability&vo.SemconvStability.STABLE&&(m[oP.ATTR_DB_SYSTEM_NAME]=oP.DB_SYSTEM_NAME_VALUE_MYSQL,m[oP.ATTR_DB_QUERY_TEXT]=E);let T=o.tracer.startSpan((0,ep.getSpanName)(s),{kind:N9.SpanKind.CLIENT,attributes:m});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,O9.addSqlCommenterComment)(T,s):Object.assign(s,{sql:(0,O9.addSqlCommenterComment)(T,s.sql)}));let S=(0,ep.once)((R,N)=>{R?T.setStatus({code:N9.SpanStatusCode.ERROR,message:R.message}):typeof _=="function"&&(0,vo.safeExecuteInTheMiddle)(()=>{_(T,{queryResults:N})},y=>{y&&o._diag.warn("Failed executing responseHook",y)},!0),T.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(S));let R=r.apply(this,arguments);return R.once("error",N=>{S(N)}).once("result",N=>{S(void 0,N)}),R}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(S)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(S)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};ES.MySQL2Instrumentation=iP});var P9=A(gS=>{"use strict";p();u();l();Object.defineProperty(gS,"__esModule",{value:!0});gS.MySQL2Instrumentation=void 0;var hxe=C9();Object.defineProperty(gS,"MySQL2Instrumentation",{enumerable:!0,get:function(){return hxe.MySQL2Instrumentation}})});var D9=A(In=>{"use strict";p();u();l();Object.defineProperty(In,"__esModule",{value:!0});In.DB_SYSTEM_VALUE_REDIS=In.DB_SYSTEM_NAME_VALUE_REDIS=In.ATTR_NET_PEER_PORT=In.ATTR_NET_PEER_NAME=In.ATTR_DB_SYSTEM=In.ATTR_DB_STATEMENT=In.ATTR_DB_CONNECTION_STRING=void 0;In.ATTR_DB_CONNECTION_STRING="db.connection_string";In.ATTR_DB_STATEMENT="db.statement";In.ATTR_DB_SYSTEM="db.system";In.ATTR_NET_PEER_NAME="net.peer.name";In.ATTR_NET_PEER_PORT="net.peer.port";In.DB_SYSTEM_NAME_VALUE_REDIS="redis";In.DB_SYSTEM_VALUE_REDIS="redis"});var w9=A(TS=>{"use strict";p();u();l();Object.defineProperty(TS,"__esModule",{value:!0});TS.endSpan=void 0;var gxe=(D(),v(j)),Txe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:gxe.SpanStatusCode.ERROR,message:e.message})),t.end()};TS.endSpan=Txe});var AS=A(SS=>{"use strict";p();u();l();Object.defineProperty(SS,"__esModule",{value:!0});SS.defaultDbStatementSerializer=void 0;var Sxe=[{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}],Axe=(t,e)=>{if(Array.isArray(e)&&e.length){let n=Sxe.find(({regex:o})=>o.test(t))?.args??0,r=n>=0?e.slice(0,n):e;return e.length>r.length&&r.push(`[${e.length-n} other arguments]`),`${t} ${r.join(" ")}`}return t};SS.defaultDbStatementSerializer=Axe});var U9=A(tp=>{"use strict";p();u();l();Object.defineProperty(tp,"__esModule",{value:!0});tp.PACKAGE_NAME=tp.PACKAGE_VERSION=void 0;tp.PACKAGE_VERSION="0.58.0";tp.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var j9=A(RS=>{"use strict";p();u();l();Object.defineProperty(RS,"__esModule",{value:!0});RS.IORedisInstrumentation=void 0;var aa=(D(),v(j)),ur=pe(),ca=(Re(),v(ke)),lr=D9(),k9=pe(),u_=w9(),Rxe=AS(),B9=U9(),G9={requireParentSpan:!0},aP=class extends ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(B9.PACKAGE_NAME,B9.PACKAGE_VERSION,{...G9,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...G9,...e})}init(){return[new ur.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,ur.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,ur.isWrapped)(r.prototype.connect)&&this._unwrap(r.prototype,"connect"),this._wrap(r.prototype,"connect",this._patchConnection()),e},e=>{if(e===void 0)return;let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(e){return n=>this._traceSendCommand(n,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,n){let r=this;return function(o){if(arguments.length<1||typeof o!="object")return e.apply(this,arguments);let s=r.getConfig(),i=s.dbStatementSerializer||Rxe.defaultDbStatementSerializer,a=aa.trace.getSpan(aa.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:d,port:f}=this.options,_=i(o.name,o.args);r._dbSemconvStability&ur.SemconvStability.OLD&&(c[lr.ATTR_DB_SYSTEM]=lr.DB_SYSTEM_VALUE_REDIS,c[lr.ATTR_DB_STATEMENT]=_,c[lr.ATTR_DB_CONNECTION_STRING]=`redis://${d}:${f}`),r._dbSemconvStability&ur.SemconvStability.STABLE&&(c[ca.ATTR_DB_SYSTEM_NAME]=lr.DB_SYSTEM_NAME_VALUE_REDIS,c[ca.ATTR_DB_QUERY_TEXT]=_),r._netSemconvStability&ur.SemconvStability.OLD&&(c[lr.ATTR_NET_PEER_NAME]=d,c[lr.ATTR_NET_PEER_PORT]=f),r._netSemconvStability&ur.SemconvStability.STABLE&&(c[ca.ATTR_SERVER_ADDRESS]=d,c[ca.ATTR_SERVER_PORT]=f);let m=r.tracer.startSpan(o.name,{kind:aa.SpanKind.CLIENT,attributes:c}),{requestHook:E}=s;E&&(0,k9.safeExecuteInTheMiddle)(()=>E(m,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),T=>{T&&aa.diag.error("ioredis instrumentation: request hook failed",T)},!0);try{let T=e.apply(this,arguments),S=o.resolve;o.resolve=function(N){(0,k9.safeExecuteInTheMiddle)(()=>s.responseHook?.(m,o.name,o.args,N),y=>{y&&aa.diag.error("ioredis instrumentation: response hook failed",y)},!0),(0,u_.endSpan)(m,null),S(N)};let R=o.reject;return o.reject=function(N){(0,u_.endSpan)(m,N),R(N)},T}catch(T){throw(0,u_.endSpan)(m,T),T}}}_traceConnection(e){let n=this;return function(){let r=aa.trace.getSpan(aa.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o={},{host:s,port:i}=this.options;n._dbSemconvStability&ur.SemconvStability.OLD&&(o[lr.ATTR_DB_SYSTEM]=lr.DB_SYSTEM_VALUE_REDIS,o[lr.ATTR_DB_STATEMENT]="connect",o[lr.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&ur.SemconvStability.STABLE&&(o[ca.ATTR_DB_SYSTEM_NAME]=lr.DB_SYSTEM_NAME_VALUE_REDIS,o[ca.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&ur.SemconvStability.OLD&&(o[lr.ATTR_NET_PEER_NAME]=s,o[lr.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&ur.SemconvStability.STABLE&&(o[ca.ATTR_SERVER_ADDRESS]=s,o[ca.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:aa.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,u_.endSpan)(a,null),c}catch(c){throw(0,u_.endSpan)(a,c),c}}}};RS.IORedisInstrumentation=aP});var H9=A(yS=>{"use strict";p();u();l();Object.defineProperty(yS,"__esModule",{value:!0});yS.IORedisInstrumentation=void 0;var yxe=j9();Object.defineProperty(yS,"IORedisInstrumentation",{enumerable:!0,get:function(){return yxe.IORedisInstrumentation}})});var IS=A(np=>{"use strict";p();u();l();Object.defineProperty(np,"__esModule",{value:!0});np.PACKAGE_NAME=np.PACKAGE_VERSION=void 0;np.PACKAGE_VERSION="0.58.0";np.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var F9=A(ua=>{"use strict";p();u();l();Object.defineProperty(ua,"__esModule",{value:!0});ua.getTracedCreateStreamTrace=ua.getTracedCreateClient=ua.endSpan=void 0;var l_=(D(),v(j)),Ixe=(t,e)=>{e&&t.setStatus({code:l_.SpanStatusCode.ERROR,message:e.message}),t.end()};ua.endSpan=Ixe;var Nxe=t=>function(){let n=t.apply(this,arguments);return l_.context.bind(l_.context.active(),n)};ua.getTracedCreateClient=Nxe;var Oxe=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){l_.context.bind(l_.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};ua.getTracedCreateStreamTrace=Oxe});var NS=A(Nn=>{"use strict";p();u();l();Object.defineProperty(Nn,"__esModule",{value:!0});Nn.DB_SYSTEM_VALUE_REDIS=Nn.DB_SYSTEM_NAME_VALUE_REDIS=Nn.ATTR_NET_PEER_PORT=Nn.ATTR_NET_PEER_NAME=Nn.ATTR_DB_SYSTEM=Nn.ATTR_DB_STATEMENT=Nn.ATTR_DB_CONNECTION_STRING=void 0;Nn.ATTR_DB_CONNECTION_STRING="db.connection_string";Nn.ATTR_DB_STATEMENT="db.statement";Nn.ATTR_DB_SYSTEM="db.system";Nn.ATTR_NET_PEER_NAME="net.peer.name";Nn.ATTR_NET_PEER_PORT="net.peer.port";Nn.DB_SYSTEM_NAME_VALUE_REDIS="redis";Nn.DB_SYSTEM_VALUE_REDIS="redis"});var V9=A(bS=>{"use strict";p();u();l();Object.defineProperty(bS,"__esModule",{value:!0});bS.RedisInstrumentationV2_V3=void 0;var yr=pe(),OS=F9(),$9=IS(),p_=(D(),v(j)),d_=(Re(),v(ke)),$c=NS(),bxe=AS(),cP=class t extends yr.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super($9.PACKAGE_NAME,$9.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,yr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,yr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new yr.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,yr.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._wrap(e.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),(0,yr.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,yr.isWrapped)(e.createClient)&&this._unwrap(e,"createClient"),this._wrap(e,"createClient",this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._unwrap(e.RedisClient.prototype,"create_stream"),this._unwrap(e,"createClient"))})]}_getPatchInternalSendCommand(){let e=this;return function(r){return function(s){if(arguments.length!==1||typeof s!="object")return r.apply(this,arguments);let i=e.getConfig(),a=p_.trace.getSpan(p_.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||bxe.defaultDbStatementSerializer,d={};e._semconvStability&yr.SemconvStability.OLD&&Object.assign(d,{[$c.ATTR_DB_SYSTEM]:$c.DB_SYSTEM_VALUE_REDIS,[$c.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&yr.SemconvStability.STABLE&&Object.assign(d,{[d_.ATTR_DB_SYSTEM_NAME]:$c.DB_SYSTEM_NAME_VALUE_REDIS,[d_.ATTR_DB_OPERATION_NAME]:s.command,[d_.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let f=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:p_.SpanKind.CLIENT,attributes:d});if(this.connection_options){let m={};e._semconvStability&yr.SemconvStability.OLD&&Object.assign(m,{[$c.ATTR_NET_PEER_NAME]:this.connection_options.host,[$c.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&yr.SemconvStability.STABLE&&Object.assign(m,{[d_.ATTR_SERVER_ADDRESS]:this.connection_options.host,[d_.ATTR_SERVER_PORT]:this.connection_options.port}),f.setAttributes(m)}this.address&&e._semconvStability&yr.SemconvStability.OLD&&f.setAttribute($c.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let _=arguments[0].callback;if(_){let m=p_.context.active();arguments[0].callback=function(T,S){if(i?.responseHook){let R=i.responseHook;(0,yr.safeExecuteInTheMiddle)(()=>{R(f,s.command,s.args,S)},N=>{N&&e._diag.error("Error executing responseHook",N)},!0)}return(0,OS.endSpan)(f,T),p_.context.with(m,_,this,...arguments)}}try{return r.apply(this,arguments)}catch(m){throw(0,OS.endSpan)(f,m),m}}}}_getPatchCreateClient(){return function(n){return(0,OS.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,OS.getTracedCreateStreamTrace)(n)}}};bS.RedisInstrumentationV2_V3=cP});var Y9=A(CS=>{"use strict";p();u();l();Object.defineProperty(CS,"__esModule",{value:!0});CS.getClientAttributes=void 0;var uP=(Re(),v(ke)),rp=NS(),q9=pe();function Cxe(t,e,n){let r={};return n&q9.SemconvStability.OLD&&Object.assign(r,{[rp.ATTR_DB_SYSTEM]:rp.DB_SYSTEM_VALUE_REDIS,[rp.ATTR_NET_PEER_NAME]:e?.socket?.host,[rp.ATTR_NET_PEER_PORT]:e?.socket?.port,[rp.ATTR_DB_CONNECTION_STRING]:Pxe(t,e?.url)}),n&q9.SemconvStability.STABLE&&Object.assign(r,{[uP.ATTR_DB_SYSTEM_NAME]:rp.DB_SYSTEM_NAME_VALUE_REDIS,[uP.ATTR_SERVER_ADDRESS]:e?.socket?.host,[uP.ATTR_SERVER_PORT]:e?.socket?.port}),r}CS.getClientAttributes=Cxe;function Pxe(t,e){if(!(typeof e!="string"||!e))try{let n=new URL(e);return n.searchParams.delete("user_pwd"),n.username="",n.password="",n.href}catch(n){t.error("failed to sanitize redis connection url",n)}}});var X9=A(PS=>{"use strict";p();u();l();Object.defineProperty(PS,"__esModule",{value:!0});PS.RedisInstrumentationV4_V5=void 0;var ro=(D(),v(j)),ze=pe(),W9=Y9(),Mxe=AS(),K9=IS(),lP=(Re(),v(ke)),vxe=NS(),f_=Symbol("opentelemetry.instrumentation.redis.open_spans"),z9=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),pP=class t extends ze.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(K9.PACKAGE_NAME,K9.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,ze.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,ze.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new ze.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,["^1.0.0"],(s,i)=>{let a=s.transformCommandArguments;if(!a)return this._diag.error("internal instrumentation error, missing transformCommandArguments function"),s;let c=i?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return(0,ze.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,ze.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,ze.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new ze.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,ze.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,ze.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,ze.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,ze.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,ze.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new ze.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,ze.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,ze.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,ze.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand"),this._wrap(i,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(i,"connect",this._getPatchedClientConnect()),s},s=>{let i=s?.default?.prototype;(0,ze.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,ze.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,ze.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new ze.InstrumentationNodeModuleDefinition(e,["^1.0.0","^5.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){if(i?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let a=i.executor;return i.executor=function(c,d){let f=e(c,d).args;return n._traceClientCommand(a,this,arguments,f)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let n=this;return function(o){return function(){let i=o.apply(this,arguments);return typeof i?.then!="function"?(n._diag.error("non-promise result when patching exec/execAsPipeline"),i):i.then(a=>{let c=this[f_];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[f_];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let d=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,d,e)}return Promise.reject(a)})}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[z9]=this.options,o}}}_getPatchRedisClientSendCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchedClientConnect(){let e=this;return function(r){return function(){let s=this.options,i=(0,W9.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:ro.SpanKind.CLIENT,attributes:i});return ro.context.with(ro.trace.setSpan(ro.context.active(),a),()=>r.apply(this)).then(d=>(a.end(),d)).catch(d=>(a.recordException(d),a.setStatus({code:ro.SpanStatusCode.ERROR,message:d.message}),a.end(),Promise.reject(d)))}}}_traceClientCommand(e,n,r,o){if(ro.trace.getSpan(ro.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[z9],a=o[0],c=o.slice(1),d=this.getConfig().dbStatementSerializer||Mxe.defaultDbStatementSerializer,f=(0,W9.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&ze.SemconvStability.STABLE&&(f[lP.ATTR_DB_OPERATION_NAME]=a);try{let E=d(a,c);E!=null&&(this._semconvStability&ze.SemconvStability.OLD&&(f[vxe.ATTR_DB_STATEMENT]=E),this._semconvStability&ze.SemconvStability.STABLE&&(f[lP.ATTR_DB_QUERY_TEXT]=E))}catch(E){this._diag.error("dbStatementSerializer throw an exception",E,{commandName:a})}let _=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:ro.SpanKind.CLIENT,attributes:f}),m=ro.context.with(ro.trace.setSpan(ro.context.active(),_),()=>e.apply(n,r));if(typeof m?.then=="function")m.then(E=>{this._endSpanWithResponse(_,a,c,E,void 0)},E=>{this._endSpanWithResponse(_,a,c,null,E)});else{let E=m;E[f_]=E[f_]||[],E[f_].push({span:_,commandName:a,commandArgs:c})}return m}_endSpansWithRedisReplies(e,n,r=!1){if(!e)return this._diag.error("cannot find open spans to end for redis multi/pipeline");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");let o=e.map(a=>a.commandName),i=o.every(a=>a===o[0])?(r?"PIPELINE ":"MULTI ")+o[0]:r?"PIPELINE":"MULTI";for(let a=0;a<e.length;a++){let{span:c,commandArgs:d}=e[a],f=n[a],[_,m]=f instanceof Error?[null,f]:[f,void 0];this._semconvStability&ze.SemconvStability.STABLE&&c.setAttribute(lP.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],d,_,m)}}_endSpanWithResponse(e,n,r,o,s){let{responseHook:i}=this.getConfig();if(!s&&i)try{i(e,n,r,o)}catch(a){this._diag.error("responseHook throw an exception",a)}s&&(e.recordException(s),e.setStatus({code:ro.SpanStatusCode.ERROR,message:s?.message})),e.end()}};PS.RedisInstrumentationV4_V5=pP});var Z9=A(MS=>{"use strict";p();u();l();Object.defineProperty(MS,"__esModule",{value:!0});MS.RedisInstrumentation=void 0;var xxe=pe(),Q9=IS(),Lxe=V9(),Dxe=X9(),J9={requireParentSpan:!1},dP=class extends xxe.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...J9,...e};super(Q9.PACKAGE_NAME,Q9.PACKAGE_VERSION,n),this.instrumentationV2_V3=new Lxe.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new Dxe.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...J9,...e};super.setConfig(n),this.initialized&&(this.instrumentationV2_V3.setConfig(n),this.instrumentationV4_V5.setConfig(n))}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())}};MS.RedisInstrumentation=dP});var e6=A(vS=>{"use strict";p();u();l();Object.defineProperty(vS,"__esModule",{value:!0});vS.RedisInstrumentation=void 0;var wxe=Z9();Object.defineProperty(vS,"RedisInstrumentation",{enumerable:!0,get:function(){return wxe.RedisInstrumentation}})});var l6=A(LS=>{"use strict";p();u();l();Object.defineProperty(LS,"__esModule",{value:!0});LS.EVENT_LISTENERS_SET=void 0;LS.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var mP=A(h_=>{"use strict";p();u();l();Object.defineProperty(h_,"__esModule",{value:!0});h_.AttributeNames=void 0;var Fxe;(function(t){t.PG_VALUES="db.postgresql.values",t.PG_PLAN="db.postgresql.plan",t.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",t.MAX_CLIENT="db.postgresql.max.client"})(Fxe=h_.AttributeNames||(h_.AttributeNames={}))});var hP=A(xe=>{"use strict";p();u();l();Object.defineProperty(xe,"__esModule",{value:!0});xe.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=xe.METRIC_DB_CLIENT_CONNECTION_COUNT=xe.DB_SYSTEM_VALUE_POSTGRESQL=xe.DB_CLIENT_CONNECTION_STATE_VALUE_USED=xe.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=xe.ATTR_NET_PEER_PORT=xe.ATTR_NET_PEER_NAME=xe.ATTR_DB_USER=xe.ATTR_DB_SYSTEM=xe.ATTR_DB_STATEMENT=xe.ATTR_DB_NAME=xe.ATTR_DB_CONNECTION_STRING=xe.ATTR_DB_CLIENT_CONNECTION_STATE=xe.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;xe.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";xe.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";xe.ATTR_DB_CONNECTION_STRING="db.connection_string";xe.ATTR_DB_NAME="db.name";xe.ATTR_DB_STATEMENT="db.statement";xe.ATTR_DB_SYSTEM="db.system";xe.ATTR_DB_USER="db.user";xe.ATTR_NET_PEER_NAME="net.peer.name";xe.ATTR_NET_PEER_PORT="net.peer.port";xe.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";xe.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";xe.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";xe.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";xe.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var EP=A(E_=>{"use strict";p();u();l();Object.defineProperty(E_,"__esModule",{value:!0});E_.SpanNames=void 0;var $xe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})($xe=E_.SpanNames||(E_.SpanNames={}))});var E6=A(Ce=>{"use strict";p();u();l();Object.defineProperty(Ce,"__esModule",{value:!0});Ce.sanitizedErrorMessage=Ce.isObjectWithTextString=Ce.getErrorMessage=Ce.patchClientConnectCallback=Ce.patchCallbackPGPool=Ce.updateCounter=Ce.getPoolName=Ce.patchCallback=Ce.handleExecutionResult=Ce.handleConfigQuery=Ce.shouldSkipInstrumentation=Ce.getSemanticAttributesFromPoolConnection=Ce.getSemanticAttributesFromConnection=Ce.getConnectionString=Ce.parseAndMaskConnectionString=Ce.parseNormalizedOperationName=Ce.getQuerySpanName=void 0;var la=(D(),v(j)),DS=mP(),oo=(Re(),v(ke)),ft=hP(),Vc=pe(),p6=EP();function d6(t,e){if(!e)return p6.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:f6(e.text);return`${p6.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}Ce.getQuerySpanName=d6;function f6(t){let e=t.trim(),n=e.indexOf(" "),r=n===-1?e:e.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}Ce.parseNormalizedOperationName=f6;function _6(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}Ce.parseAndMaskConnectionString=_6;function gP(t){if("connectionString"in t&&t.connectionString)return _6(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}Ce.getConnectionString=gP;function wS(t){if(Number.isInteger(t))return t}function m6(t,e){let n={};return e&Vc.SemconvStability.OLD&&(n={...n,[ft.ATTR_DB_SYSTEM]:ft.DB_SYSTEM_VALUE_POSTGRESQL,[ft.ATTR_DB_NAME]:t.database,[ft.ATTR_DB_CONNECTION_STRING]:gP(t),[ft.ATTR_DB_USER]:t.user,[ft.ATTR_NET_PEER_NAME]:t.host,[ft.ATTR_NET_PEER_PORT]:wS(t.port)}),e&Vc.SemconvStability.STABLE&&(n={...n,[oo.ATTR_DB_SYSTEM_NAME]:oo.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[oo.ATTR_DB_NAMESPACE]:t.namespace,[oo.ATTR_SERVER_ADDRESS]:t.host,[oo.ATTR_SERVER_PORT]:wS(t.port)}),n}Ce.getSemanticAttributesFromConnection=m6;function Vxe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[DS.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[DS.AttributeNames.MAX_CLIENT]:t.maxClient};return e&Vc.SemconvStability.OLD&&(r={...r,[ft.ATTR_DB_SYSTEM]:ft.DB_SYSTEM_VALUE_POSTGRESQL,[ft.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[ft.ATTR_DB_CONNECTION_STRING]:gP(t),[ft.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[ft.ATTR_NET_PEER_PORT]:Number(n?.port)||wS(t.port),[ft.ATTR_DB_USER]:n?.username??t.user}),e&Vc.SemconvStability.STABLE&&(r={...r,[oo.ATTR_DB_SYSTEM_NAME]:oo.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[oo.ATTR_DB_NAMESPACE]:t.namespace,[oo.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[oo.ATTR_SERVER_PORT]:Number(n?.port)||wS(t.port)}),r}Ce.getSemanticAttributesFromPoolConnection=Vxe;function qxe(t){return t.requireParentSpan===!0&&la.trace.getSpan(la.context.active())===void 0}Ce.shouldSkipInstrumentation=qxe;function Yxe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=d6(s,r),a=t.startSpan(i,{kind:la.SpanKind.CLIENT,attributes:m6(o,n)});if(!r)return a;if(r.text&&(n&Vc.SemconvStability.OLD&&a.setAttribute(ft.ATTR_DB_STATEMENT,r.text),n&Vc.SemconvStability.STABLE&&a.setAttribute(oo.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(d=>d==null?"null":d instanceof Buffer?d.toString():typeof d=="object"?typeof d.toPostgres=="function"?d.toPostgres():JSON.stringify(d):d.toString());a.setAttribute(DS.AttributeNames.PG_VALUES,c)}catch(c){la.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(DS.AttributeNames.PG_PLAN,r.name),a}Ce.handleConfigQuery=Yxe;function h6(t,e,n){typeof t.responseHook=="function"&&(0,Vc.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&la.diag.error("Error running response hook",r)},!0)}Ce.handleExecutionResult=h6;function Wxe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[oo.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(US(i)),e.setStatus({code:la.SpanStatusCode.ERROR,message:i.message})):h6(t,e,a),o(),e.end(),n.call(this,i,a)}}Ce.patchCallback=Wxe;function Kxe(t){let e="";return e+=(t?.host?`${t.host}`:"unknown_host")+":",e+=(t?.port?`${t.port}`:"unknown_port")+"/",e+=t?.database?`${t.database}`:"unknown_database",e.trim()}Ce.getPoolName=Kxe;function zxe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[ft.ATTR_DB_CLIENT_CONNECTION_STATE]:ft.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[ft.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[ft.ATTR_DB_CLIENT_CONNECTION_STATE]:ft.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[ft.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[ft.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}Ce.updateCounter=zxe;function Xxe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(US(r)),t.setStatus({code:la.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}Ce.patchCallbackPGPool=Xxe;function Qxe(t,e){return function(r){r&&(r instanceof Error&&t.recordException(US(r)),t.setStatus({code:la.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}Ce.patchClientConnectCallback=Qxe;function Jxe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}Ce.getErrorMessage=Jxe;function Zxe(t){return typeof t=="object"&&typeof t?.text=="string"}Ce.isObjectWithTextString=Zxe;function US(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}Ce.sanitizedErrorMessage=US});var g6=A(op=>{"use strict";p();u();l();Object.defineProperty(op,"__esModule",{value:!0});op.PACKAGE_NAME=op.PACKAGE_VERSION=void 0;op.PACKAGE_VERSION="0.62.0";op.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var I6=A(BS=>{"use strict";p();u();l();Object.defineProperty(BS,"__esModule",{value:!0});BS.PgInstrumentation=void 0;var Fn=pe(),Ge=(D(),v(j)),T6=l6(),st=E6(),S6=tP(),A6=g6(),R6=EP(),kS=De(),xo=(Re(),v(ke)),g_=hP();function sp(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var TP=class extends Fn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(A6.PACKAGE_NAME,A6.PACKAGE_VERSION,e),this._semconvStability=(0,Fn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(xo.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ge.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(g_.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"}),this._connectionPendingRequests=this.meter.createUpDownCounter(g_.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:"The number of current pending requests for an open connection.",unit:"{connection}"})}init(){let e=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new Fn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new Fn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new Fn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=sp(a);return this._patchPgClient(c.Client),a},a=>{let c=sp(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new Fn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=sp(a);return(0,Fn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=sp(a);(0,Fn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=sp(e);return(0,Fn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Fn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),e}_unpatchPgClient(e){let n=sp(e);return(0,Fn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Fn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(st.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(R6.SpanNames.CONNECT,{kind:Ge.SpanKind.CLIENT,attributes:st.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ge.trace.getSpan(Ge.context.active());o=st.patchClientConnectCallback(i,o),c&&(o=Ge.context.bind(Ge.context.active(),o))}let a=Ge.context.with(Ge.trace.setSpan(Ge.context.active(),i),()=>n.call(this,o));return y6(i,a)}}recordOperationDuration(e,n){let r={},o=[xo.ATTR_DB_NAMESPACE,xo.ATTR_ERROR_TYPE,xo.ATTR_SERVER_PORT,xo.ATTR_SERVER_ADDRESS,xo.ATTR_DB_OPERATION_NAME];this._semconvStability&Fn.SemconvStability.OLD&&o.push(g_.ATTR_DB_SYSTEM),this._semconvStability&Fn.SemconvStability.STABLE&&o.push(xo.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,kS.hrTimeToMilliseconds)((0,kS.hrTimeDuration)(n,(0,kS.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(st.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,kS.hrTime)(),i=o[0],a=typeof i=="string",c=st.isObjectWithTextString(i),d=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(o[1])?o[1]:void 0)}:void 0,f={[g_.ATTR_DB_SYSTEM]:g_.DB_SYSTEM_VALUE_POSTGRESQL,[xo.ATTR_DB_NAMESPACE]:this.database,[xo.ATTR_SERVER_PORT]:this.connectionParameters.port,[xo.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};d?.text&&(f[xo.ATTR_DB_OPERATION_NAME]=st.parseNormalizedOperationName(d?.text));let _=()=>{e.recordOperationDuration(f,s)},m=e.getConfig(),E=st.handleConfigQuery.call(this,e.tracer,m,e._semconvStability,d);if(m.addSqlCommenterCommentToQueries&&(a?o[0]=(0,S6.addSqlCommenterComment)(E,i):c&&!("name"in i)&&(o[0]={...i,text:(0,S6.addSqlCommenterComment)(E,i.text)})),o.length>0){let R=Ge.trace.getSpan(Ge.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=st.patchCallback(m,E,o[o.length-1],f,_),R&&(o[o.length-1]=Ge.context.bind(Ge.context.active(),o[o.length-1]));else if(typeof d?.callback=="function"){let N=st.patchCallback(e.getConfig(),E,d.callback,f,_);R&&(N=Ge.context.bind(Ge.context.active(),N)),o[0].callback=N}}let{requestHook:T}=m;typeof T=="function"&&d&&(0,Fn.safeExecuteInTheMiddle)(()=>{let{database:R,host:N,port:y,user:P}=this.connectionParameters;T(E,{connection:{database:R,host:N,port:y,user:P},query:{text:d.text,values:d.values,name:d.name}})},R=>{R&&e._diag.error("Error running query hook",R)},!0);let S;try{S=n.apply(this,o)}catch(R){throw R instanceof Error&&E.recordException(st.sanitizedErrorMessage(R)),E.setStatus({code:Ge.SpanStatusCode.ERROR,message:st.getErrorMessage(R)}),E.end(),R}return S instanceof Promise?S.then(R=>new Promise(N=>{st.handleExecutionResult(e.getConfig(),E,R),_(),E.end(),N(R)})).catch(R=>new Promise((N,y)=>{R instanceof Error&&E.recordException(st.sanitizedErrorMessage(R)),E.setStatus({code:Ge.SpanStatusCode.ERROR,message:R.message}),_(),E.end(),y(R)})):S})}_setPoolConnectEventListeners(e){if(e[T6.EVENT_LISTENERS_SET])return;let n=st.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[T6.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(st.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(R6.SpanNames.POOL_CONNECT,{kind:Ge.SpanKind.CLIENT,attributes:st.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ge.trace.getSpan(Ge.context.active());o=st.patchCallbackPGPool(i,o),c&&(o=Ge.context.bind(Ge.context.active(),o))}let a=Ge.context.with(Ge.trace.setSpan(Ge.context.active(),i),()=>n.call(this,o));return y6(i,a)}}};BS.PgInstrumentation=TP;function y6(t,e){if(!(e instanceof Promise))return e;let n=e;return Ge.context.bind(Ge.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(st.sanitizedErrorMessage(r)),t.setStatus({code:Ge.SpanStatusCode.ERROR,message:st.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var N6=A(ip=>{"use strict";p();u();l();Object.defineProperty(ip,"__esModule",{value:!0});ip.AttributeNames=ip.PgInstrumentation=void 0;var eLe=I6();Object.defineProperty(ip,"PgInstrumentation",{enumerable:!0,get:function(){return eLe.PgInstrumentation}});var tLe=mP();Object.defineProperty(ip,"AttributeNames",{enumerable:!0,get:function(){return tLe.AttributeNames}})});var D6=A(T_=>{"use strict";p();u();l();Object.defineProperty(T_,"__esModule",{value:!0});T_.SeverityNumber=void 0;var sLe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(sLe=T_.SeverityNumber||(T_.SeverityNumber={}))});var FS=A(ap=>{"use strict";p();u();l();Object.defineProperty(ap,"__esModule",{value:!0});ap.NOOP_LOGGER=ap.NoopLogger=void 0;var HS=class{emit(e){}};ap.NoopLogger=HS;ap.NOOP_LOGGER=new HS});var VS=A(cp=>{"use strict";p();u();l();Object.defineProperty(cp,"__esModule",{value:!0});cp.NOOP_LOGGER_PROVIDER=cp.NoopLoggerProvider=void 0;var iLe=FS(),$S=class{getLogger(e,n,r){return new iLe.NoopLogger}};cp.NoopLoggerProvider=$S;cp.NOOP_LOGGER_PROVIDER=new $S});var yP=A(qS=>{"use strict";p();u();l();Object.defineProperty(qS,"__esModule",{value:!0});qS.ProxyLogger=void 0;var aLe=FS(),RP=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(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):aLe.NOOP_LOGGER}};qS.ProxyLogger=RP});var NP=A(YS=>{"use strict";p();u();l();Object.defineProperty(YS,"__esModule",{value:!0});YS.ProxyLoggerProvider=void 0;var cLe=VS(),uLe=yP(),IP=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new uLe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:cLe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};YS.ProxyLoggerProvider=IP});var w6=A(WS=>{"use strict";p();u();l();Object.defineProperty(WS,"__esModule",{value:!0});WS._globalThis=void 0;WS._globalThis=typeof globalThis=="object"?globalThis:global});var U6=A(KS=>{"use strict";p();u();l();Object.defineProperty(KS,"__esModule",{value:!0});KS._globalThis=void 0;var lLe=w6();Object.defineProperty(KS,"_globalThis",{enumerable:!0,get:function(){return lLe._globalThis}})});var k6=A(zS=>{"use strict";p();u();l();Object.defineProperty(zS,"__esModule",{value:!0});zS._globalThis=void 0;var pLe=U6();Object.defineProperty(zS,"_globalThis",{enumerable:!0,get:function(){return pLe._globalThis}})});var B6=A(ps=>{"use strict";p();u();l();Object.defineProperty(ps,"__esModule",{value:!0});ps.API_BACKWARDS_COMPATIBILITY_VERSION=ps.makeGetter=ps._global=ps.GLOBAL_LOGS_API_KEY=void 0;var dLe=k6();ps.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");ps._global=dLe._globalThis;function fLe(t,e,n){return r=>r===t?e:n}ps.makeGetter=fLe;ps.API_BACKWARDS_COMPATIBILITY_VERSION=1});var j6=A(XS=>{"use strict";p();u();l();Object.defineProperty(XS,"__esModule",{value:!0});XS.LogsAPI=void 0;var so=B6(),_Le=VS(),G6=NP(),OP=class t{constructor(){this._proxyLoggerProvider=new G6.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return so._global[so.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(so._global[so.GLOBAL_LOGS_API_KEY]=(0,so.makeGetter)(so.API_BACKWARDS_COMPATIBILITY_VERSION,e,_Le.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=so._global[so.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(so._global,so.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete so._global[so.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new G6.ProxyLoggerProvider}};XS.LogsAPI=OP});var bP=A(Xt=>{"use strict";p();u();l();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.logs=Xt.ProxyLoggerProvider=Xt.ProxyLogger=Xt.NoopLoggerProvider=Xt.NOOP_LOGGER_PROVIDER=Xt.NoopLogger=Xt.NOOP_LOGGER=Xt.SeverityNumber=void 0;var mLe=D6();Object.defineProperty(Xt,"SeverityNumber",{enumerable:!0,get:function(){return mLe.SeverityNumber}});var H6=FS();Object.defineProperty(Xt,"NOOP_LOGGER",{enumerable:!0,get:function(){return H6.NOOP_LOGGER}});Object.defineProperty(Xt,"NoopLogger",{enumerable:!0,get:function(){return H6.NoopLogger}});var F6=VS();Object.defineProperty(Xt,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return F6.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Xt,"NoopLoggerProvider",{enumerable:!0,get:function(){return F6.NoopLoggerProvider}});var hLe=yP();Object.defineProperty(Xt,"ProxyLogger",{enumerable:!0,get:function(){return hLe.ProxyLogger}});var ELe=NP();Object.defineProperty(Xt,"ProxyLoggerProvider",{enumerable:!0,get:function(){return ELe.ProxyLoggerProvider}});var gLe=j6();Xt.logs=gLe.LogsAPI.getInstance()});var $6=A(up=>{"use strict";p();u();l();Object.defineProperty(up,"__esModule",{value:!0});up.disableInstrumentations=up.enableInstrumentations=void 0;function TLe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}up.enableInstrumentations=TLe;function SLe(t){t.forEach(e=>e.disable())}up.disableInstrumentations=SLe});var Y6=A(QS=>{"use strict";p();u();l();Object.defineProperty(QS,"__esModule",{value:!0});QS.registerInstrumentations=void 0;var V6=(D(),v(j)),ALe=bP(),q6=$6();function RLe(t){let e=t.tracerProvider||V6.trace.getTracerProvider(),n=t.meterProvider||V6.metrics.getMeterProvider(),r=t.loggerProvider||ALe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,q6.enableInstrumentations)(o,e,n,r),()=>{(0,q6.disableInstrumentations)(o)}}QS.registerInstrumentations=RLe});var tX=A(JS=>{"use strict";p();u();l();Object.defineProperty(JS,"__esModule",{value:!0});JS.satisfies=void 0;var vP=(D(),v(j)),Q6=/^(?: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-]+)*))?$/,yLe=/^(?<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-]+)*))?$/,ILe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function NLe(t,e,n){if(!OLe(t))return vP.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=MLe(t);if(!r)return!1;let o=[],s=J6(r,e,o,n);return s&&!n?.includePrerelease?CLe(r,o):s}JS.satisfies=NLe;function OLe(t){return typeof t=="string"&&Q6.test(t)}function J6(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(CP(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=QLe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!CP(t,s,n,r))return!1;return!0}return CP(t,e,n,r)}function CP(t,e,n,r){if(e=PLe(e,r),e.includes(" "))return J6(t,e,n,r);{let o=vLe(e);return n.push(o),bLe(t,o)}}function bLe(t,e){if(e.invalid)return!1;if(!e.version||MP(e.version))return!0;let n=K6(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=K6(r,o)}return ILe[e.op]?.includes(n)}function CLe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function PLe(t,e){return t=t.trim(),t=zLe(t,e),t=KLe(t),t=XLe(t,e),t=t.trim(),t}function $n(t){return!t||t.toLowerCase()==="x"||t==="*"}function MLe(t){let e=t.match(Q6);if(!e){vP.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function vLe(t){if(!t)return{};let e=t.match(yLe);if(!e)return vP.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function MP(t){return t==="*"||t==="x"||t==="X"}function W6(t){let e=parseInt(t,10);return isNaN(e)?t:e}function xLe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function LLe(t,e){if(MP(t)||MP(e))return 0;let[n,r]=xLe(W6(t),W6(e));return n>r?1:n<r?-1:0}function K6(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=LLe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var Z6="[a-zA-Z0-9-]",eX="0|[1-9]\\d*",DLe=`\\d*[a-zA-Z-]${Z6}*`,wLe="((?:<|>)?=?)",z6=`(?:${eX}|${DLe})`,ULe=`(?:-(${z6}(?:\\.${z6})*))`,X6=`${Z6}+`,kLe=`(?:\\+(${X6}(?:\\.${X6})*))`,PP=`${eX}|x|X|\\*`,S_=`[v=\\s]*(${PP})(?:\\.(${PP})(?:\\.(${PP})(?:${ULe})?${kLe}?)?)?`,BLe=`^${wLe}\\s*${S_}$`,GLe=new RegExp(BLe),jLe=`^\\s*(${S_})\\s+-\\s+(${S_})\\s*$`,HLe=new RegExp(jLe),FLe="(?:~>?)",$Le=`^${FLe}${S_}$`,VLe=new RegExp($Le),qLe="(?:\\^)",YLe=`^${qLe}${S_}$`,WLe=new RegExp(YLe);function KLe(t){let e=VLe;return t.replace(e,(n,r,o,s,i)=>{let a;return $n(r)?a="":$n(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:$n(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function zLe(t,e){let n=WLe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let d;return $n(s)?d="":$n(i)?d=`>=${s}.0.0${r} <${+s+1}.0.0-0`:$n(a)?s==="0"?d=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:d=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?d=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:d=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:d=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?d=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:d=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:d=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,d})}function XLe(t,e){let n=GLe;return t.replace(n,(r,o,s,i,a,c)=>{let d=$n(s),f=d||$n(i),_=f||$n(a),m=_;return o==="="&&m&&(o=""),c=e?.includePrerelease?"-0":"",d?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&m?(f&&(i=0),a=0,o===">"?(o=">=",f?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",f?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):f?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:_&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function QLe(t,e){let n=HLe;return t.replace(n,(r,o,s,i,a,c,d,f,_,m,E,T)=>($n(s)?o="":$n(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:$n(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,$n(_)?f="":$n(m)?f=`<${+_+1}.0.0-0`:$n(E)?f=`<${_}.${+m+1}.0-0`:T?f=`<=${_}.${m}.${E}-${T}`:e?.includePrerelease?f=`<${_}.${m}.${+E+1}-0`:f=`<=${f}`,`${o} ${f}`.trim()))}});var xP=A(an=>{"use strict";p();u();l();Object.defineProperty(an,"__esModule",{value:!0});an.massUnwrap=an.unwrap=an.massWrap=an.wrap=void 0;var Vn=console.error.bind(console);function A_(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var JLe=(t,e,n)=>{if(!t||!t[e]){Vn("no original function "+String(e)+" to wrap");return}if(!n){Vn("no wrapper function"),Vn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){Vn("original object and wrapper must be functions");return}let o=n(r,e);return A_(o,"__original",r),A_(o,"__unwrap",()=>{t[e]===o&&A_(t,e,r)}),A_(o,"__wrapped",!0),A_(t,e,o),o};an.wrap=JLe;var ZLe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Vn("must provide one or more modules to patch"),Vn(new Error().stack);return}if(!(e&&Array.isArray(e))){Vn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,an.wrap)(r,o,n)})})};an.massWrap=ZLe;var eDe=(t,e)=>{if(!t||!t[e]){Vn("no function to unwrap."),Vn(new Error().stack);return}let n=t[e];if(!n.__unwrap)Vn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};an.unwrap=eDe;var tDe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Vn("must provide one or more modules to patch"),Vn(new Error().stack);return}if(!(e&&Array.isArray(e))){Vn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,an.unwrap)(n,r)})})};an.massUnwrap=tDe;function R_(t){t&&t.logger&&(typeof t.logger!="function"?Vn("new logger isn't a function, not replacing"):Vn=t.logger)}an.default=R_;R_.wrap=an.wrap;R_.massWrap=an.massWrap;R_.unwrap=an.unwrap;R_.massUnwrap=an.massUnwrap});var nX=A(eA=>{"use strict";p();u();l();Object.defineProperty(eA,"__esModule",{value:!0});eA.InstrumentationAbstract=void 0;var LP=(D(),v(j)),nDe=bP(),ZS=xP(),DP=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=LP.diag.createComponentLogger({namespace:e}),this._tracer=LP.trace.getTracer(e,n),this._meter=LP.metrics.getMeter(e,n),this._logger=nDe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=ZS.wrap;_unwrap=ZS.unwrap;_massWrap=ZS.massWrap;_massUnwrap=ZS.massUnwrap;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,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};eA.InstrumentationAbstract=DP});var rX=A(pa=>{"use strict";p();u();l();Object.defineProperty(pa,"__esModule",{value:!0});pa.ModuleNameTrie=pa.ModuleNameSeparator=void 0;pa.ModuleNameSeparator="/";var tA=class{hooks=[];children=new Map},wP=class{_trie=new tA;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(pa.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new tA,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(pa.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};pa.ModuleNameTrie=wP});var sX=A(nA=>{"use strict";p();u();l();Object.defineProperty(nA,"__esModule",{value:!0});nA.RequireInTheMiddleSingleton=void 0;var rDe=Od(),oX=require("path"),UP=rX(),oDe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),kP=class t{_moduleNameTrie=new UP.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new rDe.Hook(null,{internals:!0},(e,n,r)=>{let o=sDe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return oDe?new t:this._instance=this._instance??new t}};nA.RequireInTheMiddleSingleton=kP;function sDe(t){return oX.sep!==UP.ModuleNameSeparator?t.split(oX.sep).join(UP.ModuleNameSeparator):t}});var BP=A(da=>{"use strict";p();u();l();Object.defineProperty(da,"__esModule",{value:!0});da.isWrapped=da.safeExecuteInTheMiddleAsync=da.safeExecuteInTheMiddle=void 0;function iDe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}da.safeExecuteInTheMiddle=iDe;async function aDe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}da.safeExecuteInTheMiddleAsync=aDe;function cDe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}da.isWrapped=cDe});var cX=A(rA=>{"use strict";p();u();l();Object.defineProperty(rA,"__esModule",{value:!0});rA.InstrumentationBase=void 0;var y_=require("path"),iX=require("util"),uDe=tX(),GP=xP(),lDe=nX(),pDe=sX(),dDe=Yh(),I_=(D(),v(j)),fDe=Od(),_De=require("fs"),mDe=BP(),jP=class extends lDe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=pDe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,mDe.isWrapped)(e[n])&&this._unwrap(e,n),iX.types.isProxy(e)){let o=(0,GP.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,GP.wrap)(e,n,r)};_unwrap=(e,n)=>iX.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,GP.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{I_.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){I_.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{I_.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){I_.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=require.resolve(n);require.cache[r]&&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 n=(0,_De.readFileSync)(y_.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{I_.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return aX(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=y_.normalize(r);return i.filter(d=>d.name===a).filter(d=>aX(d.supportedVersions,s,e.includePrerelease)).reduce((d,f)=>(f.moduleExports=d,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:f.name,baseDir:o}),f.patch(d,e.moduleVersion)):d),n)}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 n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&y_.isAbsolute(a)){let d=y_.parse(a);a=d.name,c=d.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=y_.isAbsolute(e.name)?new fDe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new dDe.Hook([e.name],{internals:!1},n);this._hooks.push(s)}}}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 n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};rA.InstrumentationBase=jP;function aX(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,uDe.satisfies)(e,r,{includePrerelease:n}))}});var uX=A(oA=>{"use strict";p();u();l();Object.defineProperty(oA,"__esModule",{value:!0});oA.normalize=void 0;var hDe=require("path");Object.defineProperty(oA,"normalize",{enumerable:!0,get:function(){return hDe.normalize}})});var lX=A(lp=>{"use strict";p();u();l();Object.defineProperty(lp,"__esModule",{value:!0});lp.normalize=lp.InstrumentationBase=void 0;var EDe=cX();Object.defineProperty(lp,"InstrumentationBase",{enumerable:!0,get:function(){return EDe.InstrumentationBase}});var gDe=uX();Object.defineProperty(lp,"normalize",{enumerable:!0,get:function(){return gDe.normalize}})});var HP=A(pp=>{"use strict";p();u();l();Object.defineProperty(pp,"__esModule",{value:!0});pp.normalize=pp.InstrumentationBase=void 0;var pX=lX();Object.defineProperty(pp,"InstrumentationBase",{enumerable:!0,get:function(){return pX.InstrumentationBase}});Object.defineProperty(pp,"normalize",{enumerable:!0,get:function(){return pX.normalize}})});var dX=A(sA=>{"use strict";p();u();l();Object.defineProperty(sA,"__esModule",{value:!0});sA.InstrumentationNodeModuleDefinition=void 0;var FP=class{name;supportedVersions;patch;unpatch;files;constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};sA.InstrumentationNodeModuleDefinition=FP});var fX=A(iA=>{"use strict";p();u();l();Object.defineProperty(iA,"__esModule",{value:!0});iA.InstrumentationNodeModuleFile=void 0;var TDe=HP(),$P=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,TDe.normalize)(e)}};iA.InstrumentationNodeModuleFile=$P});var _X=A(qc=>{"use strict";p();u();l();Object.defineProperty(qc,"__esModule",{value:!0});qc.semconvStabilityFromStr=qc.SemconvStability=void 0;var aA;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(aA=qc.SemconvStability||(qc.SemconvStability={}));function SDe(t,e){let n=aA.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=aA.DUPLICATE;break}else o.toLowerCase()===t&&(n=aA.STABLE);return n}qc.semconvStabilityFromStr=SDe});var hX=A(Dt=>{"use strict";p();u();l();Object.defineProperty(Dt,"__esModule",{value:!0});Dt.semconvStabilityFromStr=Dt.SemconvStability=Dt.safeExecuteInTheMiddleAsync=Dt.safeExecuteInTheMiddle=Dt.isWrapped=Dt.InstrumentationNodeModuleFile=Dt.InstrumentationNodeModuleDefinition=Dt.InstrumentationBase=Dt.registerInstrumentations=void 0;var ADe=Y6();Object.defineProperty(Dt,"registerInstrumentations",{enumerable:!0,get:function(){return ADe.registerInstrumentations}});var RDe=HP();Object.defineProperty(Dt,"InstrumentationBase",{enumerable:!0,get:function(){return RDe.InstrumentationBase}});var yDe=dX();Object.defineProperty(Dt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return yDe.InstrumentationNodeModuleDefinition}});var IDe=fX();Object.defineProperty(Dt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return IDe.InstrumentationNodeModuleFile}});var VP=BP();Object.defineProperty(Dt,"isWrapped",{enumerable:!0,get:function(){return VP.isWrapped}});Object.defineProperty(Dt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return VP.safeExecuteInTheMiddle}});Object.defineProperty(Dt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return VP.safeExecuteInTheMiddleAsync}});var mX=_X();Object.defineProperty(Dt,"SemconvStability",{enumerable:!0,get:function(){return mX.SemconvStability}});Object.defineProperty(Dt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return mX.semconvStabilityFromStr}})});var OX=A(fp=>{"use strict";p();u();l();Object.defineProperty(fp,"__esModule",{value:!0});fp.PACKAGE_NAME=fp.PACKAGE_VERSION=void 0;fp.PACKAGE_VERSION="0.56.0";fp.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var KP=A(ds=>{"use strict";p();u();l();Object.defineProperty(ds,"__esModule",{value:!0});ds.HapiLifecycleMethodNames=ds.HapiLayerType=ds.handlerPatched=ds.HapiComponentName=void 0;ds.HapiComponentName="@hapi/hapi";ds.handlerPatched=Symbol("hapi-handler-patched");ds.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};ds.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var bX=A(uA=>{"use strict";p();u();l();Object.defineProperty(uA,"__esModule",{value:!0});uA.ATTR_HTTP_METHOD=void 0;uA.ATTR_HTTP_METHOD="http.method"});var zP=A(N_=>{"use strict";p();u();l();Object.defineProperty(N_,"__esModule",{value:!0});N_.AttributeNames=void 0;var jDe;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(jDe=N_.AttributeNames||(N_.AttributeNames={}))});var MX=A(wt=>{"use strict";p();u();l();Object.defineProperty(wt,"__esModule",{value:!0});wt.getPluginFromInput=wt.getExtMetadata=wt.getRouteMetadata=wt.isPatchableExtMethod=wt.isDirectExtInput=wt.isLifecycleExtEventObj=wt.isLifecycleExtType=wt.getPluginName=void 0;var CX=(Re(),v(ke)),HDe=bX(),O_=KP(),fa=zP(),PX=pe();function FDe(t){return t.name?t.name:t.pkg.name}wt.getPluginName=FDe;var $De=t=>typeof t=="string"&&O_.HapiLifecycleMethodNames.has(t);wt.isLifecycleExtType=$De;var VDe=t=>{let e=t?.type;return e!==void 0&&(0,wt.isLifecycleExtType)(e)};wt.isLifecycleExtEventObj=VDe;var qDe=t=>Array.isArray(t)&&t.length<=3&&(0,wt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";wt.isDirectExtInput=qDe;var YDe=t=>!Array.isArray(t);wt.isPatchableExtMethod=YDe;var WDe=(t,e,n)=>{let r={[CX.ATTR_HTTP_ROUTE]:t.path};e&PX.SemconvStability.OLD&&(r[HDe.ATTR_HTTP_METHOD]=t.method),e&PX.SemconvStability.STABLE&&(r[CX.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[fa.AttributeNames.HAPI_TYPE]=O_.HapiLayerType.PLUGIN,r[fa.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[fa.AttributeNames.HAPI_TYPE]=O_.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};wt.getRouteMetadata=WDe;var KDe=(t,e)=>e?{attributes:{[fa.AttributeNames.EXT_TYPE]:t,[fa.AttributeNames.HAPI_TYPE]:O_.HapiLayerType.EXT,[fa.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ext - ${t}`}:{attributes:{[fa.AttributeNames.EXT_TYPE]:t,[fa.AttributeNames.HAPI_TYPE]:O_.HapiLayerType.EXT},name:`ext - ${t}`};wt.getExtMetadata=KDe;var zDe=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;wt.getPluginFromInput=zDe});var LX=A(lA=>{"use strict";p();u();l();Object.defineProperty(lA,"__esModule",{value:!0});lA.HapiInstrumentation=void 0;var Ir=(D(),v(j)),vX=De(),b_=pe(),xX=OX(),C_=KP(),zs=MX(),XP=class extends b_.InstrumentationBase{_semconvStability;constructor(e={}){super(xX.PACKAGE_NAME,xX.PACKAGE_VERSION,e),this._semconvStability=(0,b_.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new b_.InstrumentationNodeModuleDefinition(C_.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,b_.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,b_.isWrapped)(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._massUnwrap([n],["server","Server"])})}_getServerPatch(e){let n=this,r=this;return function(s){let i=e.apply(this,[s]);return r._wrap(i,"route",a=>n._getServerRoutePatch.bind(n)(a)),r._wrap(i,"ext",a=>n._getServerExtPatch.bind(n)(a)),r._wrap(i,"register",n._getServerRegisterPatch.bind(n)),i}}_getServerRegisterPatch(e){let n=this;return function(o,s){if(Array.isArray(o))for(let i of o){let a=(0,zs.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,zs.getPluginFromInput)(o);n._wrapRegisterHandler(i)}return e.apply(this,[o,s])}}_getServerExtPatch(e,n){let r=this;return function(...s){if(Array.isArray(s[0])){let i=s[0];for(let a=0;a<i.length;a++){let c=i[a];if((0,zs.isLifecycleExtType)(c.type)){let d=c,f=r._wrapExtMethods(d.method,c.type,n);d.method=f,i[a]=d}}return e.apply(this,s)}else if((0,zs.isDirectExtInput)(s)){let i=s,a=i[1],c=r._wrapExtMethods(a,i[0],n);return e.apply(this,[i[0],c,i[2]])}else if((0,zs.isLifecycleExtEventObj)(s[0])){let i=s[0],a=r._wrapExtMethods(i.method,i.type,n);return i.method=a,e.call(this,i)}return e.apply(this,s)}}_getServerRoutePatch(e,n){let r=this;return function(o){if(Array.isArray(o))for(let s=0;s<o.length;s++){let i=r._wrapRouteHandler.call(r,o[s],n);o[s]=i}else o=r._wrapRouteHandler.call(r,o,n);return e.apply(this,[o])}}_wrapRegisterHandler(e){let n=this,r=(0,zs.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",d=>n._getServerRoutePatch.bind(n)(d,r)),s._wrap(a,"ext",d=>n._getServerExtPatch.bind(n)(d,r)),o.call(this,a,c)};e.register=i}_wrapExtMethods(e,n,r){let o=this;if(e instanceof Array){for(let s=0;s<e.length;s++)e[s]=o._wrapExtMethods(e[s],n);return e}else if((0,zs.isPatchableExtMethod)(e))return e[C_.handlerPatched]===!0?e:(e[C_.handlerPatched]=!0,async function(...i){if(Ir.trace.getSpan(Ir.context.active())===void 0)return await e.apply(this,i);let a=(0,zs.getExtMetadata)(n,r),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await Ir.context.with(Ir.trace.setSpan(Ir.context.active(),c),e,void 0,...i)}catch(d){throw c.recordException(d),c.setStatus({code:Ir.SpanStatusCode.ERROR,message:d.message}),d}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[C_.handlerPatched]===!0)return e;e[C_.handlerPatched]=!0;let o=s=>async function(...i){if(Ir.trace.getSpan(Ir.context.active())===void 0)return await s.call(this,...i);let a=(0,vX.getRPCMetadata)(Ir.context.active());a?.type===vX.RPCType.HTTP&&(a.route=e.path);let c=(0,zs.getRouteMetadata)(e,r._semconvStability,n),d=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await Ir.context.with(Ir.trace.setSpan(Ir.context.active(),d),()=>s.call(this,...i))}catch(f){throw d.recordException(f),d.setStatus({code:Ir.SpanStatusCode.ERROR,message:f.message}),f}finally{d.end()}};if(typeof e.handler=="function")e.handler=o(e.handler);else if(typeof e.options=="function"){let s=e.options;e.options=function(i){let a=s(i);return typeof a.handler=="function"&&(a.handler=o(a.handler)),a}}else typeof e.options?.handler=="function"&&(e.options.handler=o(e.options.handler));return e}};lA.HapiInstrumentation=XP});var DX=A(_p=>{"use strict";p();u();l();Object.defineProperty(_p,"__esModule",{value:!0});_p.AttributeNames=_p.HapiInstrumentation=void 0;var XDe=LX();Object.defineProperty(_p,"HapiInstrumentation",{enumerable:!0,get:function(){return XDe.HapiInstrumentation}});var QDe=zP();Object.defineProperty(_p,"AttributeNames",{enumerable:!0,get:function(){return QDe.AttributeNames}})});var fA=A(M_=>{"use strict";p();u();l();Object.defineProperty(M_,"__esModule",{value:!0});M_.KoaLayerType=void 0;var r0e;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(r0e=M_.KoaLayerType||(M_.KoaLayerType={}))});var FX=A(mp=>{"use strict";p();u();l();Object.defineProperty(mp,"__esModule",{value:!0});mp.PACKAGE_NAME=mp.PACKAGE_VERSION=void 0;mp.PACKAGE_VERSION="0.58.0";mp.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var QP=A(v_=>{"use strict";p();u();l();Object.defineProperty(v_,"__esModule",{value:!0});v_.AttributeNames=void 0;var o0e;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(o0e=v_.AttributeNames||(v_.AttributeNames={}))});var VX=A(hp=>{"use strict";p();u();l();Object.defineProperty(hp,"__esModule",{value:!0});hp.isLayerIgnored=hp.getMiddlewareMetadata=void 0;var $X=fA(),_A=QP(),s0e=(Re(),v(ke)),i0e=(t,e,n,r)=>n?{attributes:{[_A.AttributeNames.KOA_NAME]:r?.toString(),[_A.AttributeNames.KOA_TYPE]:$X.KoaLayerType.ROUTER,[s0e.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[_A.AttributeNames.KOA_NAME]:e.name??"middleware",[_A.AttributeNames.KOA_TYPE]:$X.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};hp.getMiddlewareMetadata=i0e;var a0e=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));hp.isLayerIgnored=a0e});var qX=A(mA=>{"use strict";p();u();l();Object.defineProperty(mA,"__esModule",{value:!0});mA.kLayerPatched=void 0;mA.kLayerPatched=Symbol("koa-layer-patched")});var QX=A(hA=>{"use strict";p();u();l();Object.defineProperty(hA,"__esModule",{value:!0});hA.KoaInstrumentation=void 0;var fs=(D(),v(j)),x_=pe(),YX=fA(),WX=FX(),KX=VX(),zX=De(),XX=qX(),JP=class extends x_.InstrumentationBase{constructor(e={}){super(WX.PACKAGE_NAME,WX.PACKAGE_VERSION,e)}init(){return new x_.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,x_.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),e)},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;(0,x_.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(e){let n=this;return function(o){let s;return o.router?s=n._patchRouterDispatch(o):s=n._patchLayer(o,!1),e.apply(this,[s])}}_patchRouterDispatch(e){fs.diag.debug("Patching @koa/router dispatch");let r=e.router?.stack??[];for(let o of r){let s=o.path,i=o.stack;for(let a=0;a<i.length;a++){let c=i[a];i[a]=this._patchLayer(c,!0,s)}}return e}_patchLayer(e,n,r){let o=n?YX.KoaLayerType.ROUTER:YX.KoaLayerType.MIDDLEWARE;return e[XX.kLayerPatched]===!0||(0,KX.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(fs.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[XX.kLayerPatched]=!0,fs.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(fs.trace.getSpan(fs.context.active())===void 0)return e(s,i);let c=(0,KX.getMiddlewareMetadata)(s,e,n,r),d=this.tracer.startSpan(c.name,{attributes:c.attributes}),f=(0,zX.getRPCMetadata)(fs.context.active());f?.type===zX.RPCType.HTTP&&s._matchedRoute&&(f.route=s._matchedRoute.toString());let{requestHook:_}=this.getConfig();_&&(0,x_.safeExecuteInTheMiddle)(()=>_(d,{context:s,middlewareLayer:e,layerType:o}),E=>{E&&fs.diag.error("koa instrumentation: request hook failed",E)},!0);let m=fs.trace.setSpan(fs.context.active(),d);return fs.context.with(m,async()=>{try{return await e(s,i)}catch(E){throw d.recordException(E),E}finally{d.end()}})})}};hA.KoaInstrumentation=JP});var JX=A(ma=>{"use strict";p();u();l();Object.defineProperty(ma,"__esModule",{value:!0});ma.KoaLayerType=ma.AttributeNames=ma.KoaInstrumentation=void 0;var c0e=QX();Object.defineProperty(ma,"KoaInstrumentation",{enumerable:!0,get:function(){return c0e.KoaInstrumentation}});var u0e=QP();Object.defineProperty(ma,"AttributeNames",{enumerable:!0,get:function(){return u0e.AttributeNames}});var l0e=fA();Object.defineProperty(ma,"KoaLayerType",{enumerable:!0,get:function(){return l0e.KoaLayerType}})});var ZP=A(Lo=>{"use strict";p();u();l();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.ConnectNames=Lo.ConnectTypes=Lo.AttributeNames=void 0;var d0e;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(d0e=Lo.AttributeNames||(Lo.AttributeNames={}));var f0e;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(f0e=Lo.ConnectTypes||(Lo.ConnectTypes={}));var _0e;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(_0e=Lo.ConnectNames||(Lo.ConnectNames={}))});var rQ=A(Ep=>{"use strict";p();u();l();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.PACKAGE_NAME=Ep.PACKAGE_VERSION=void 0;Ep.PACKAGE_VERSION="0.53.0";Ep.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var oQ=A(EA=>{"use strict";p();u();l();Object.defineProperty(EA,"__esModule",{value:!0});EA._LAYERS_STORE_PROPERTY=void 0;EA._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var sQ=A(Ea=>{"use strict";p();u();l();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.generateRoute=Ea.replaceCurrentStackRoute=Ea.addNewStackLayer=void 0;var m0e=(D(),v(j)),ha=oQ(),h0e=t=>{Array.isArray(t[ha._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ha._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ha._LAYERS_STORE_PROPERTY].push("/");let e=t[ha._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ha._LAYERS_STORE_PROPERTY].length?t[ha._LAYERS_STORE_PROPERTY].pop():m0e.diag.warn("Connect: Trying to pop the stack multiple time")}};Ea.addNewStackLayer=h0e;var E0e=(t,e)=>{e&&t[ha._LAYERS_STORE_PROPERTY].splice(-1,1,e)};Ea.replaceCurrentStackRoute=E0e;var g0e=t=>t[ha._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);Ea.generateRoute=g0e});var cQ=A(ga=>{"use strict";p();u();l();Object.defineProperty(ga,"__esModule",{value:!0});ga.ConnectInstrumentation=ga.ANONYMOUS_NAME=void 0;var T0e=(D(),v(j)),iQ=De(),gp=ZP(),aQ=rQ(),gA=pe(),S0e=(Re(),v(ke)),eM=sQ();ga.ANONYMOUS_NAME="anonymous";var tM=class extends gA.InstrumentationBase{constructor(e={}){super(aQ.PACKAGE_NAME,aQ.PACKAGE_VERSION,e)}init(){return[new gA.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,gA.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,gA.isWrapped)(e.handle)||this._wrap(e,"handle",this._patchHandle.bind(this))}_patchConstructor(e){let n=this;return function(...r){let o=e.apply(this,r);return n._patchApp(o),o}}_patchNext(e,n){return function(o){let s=e.apply(this,[o]);return n(),s}}_startSpan(e,n){let r,o,s;e?(r=gp.ConnectTypes.REQUEST_HANDLER,s=gp.ConnectNames.REQUEST_HANDLER,o=e):(r=gp.ConnectTypes.MIDDLEWARE,s=gp.ConnectNames.MIDDLEWARE,o=n.name||ga.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[S0e.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[gp.AttributeNames.CONNECT_TYPE]:r,[gp.AttributeNames.CONNECT_NAME]:o}};return this.tracer.startSpan(i,a)}_patchMiddleware(e,n){let r=this,o=n.length===4;function s(){if(!r.isEnabled())return n.apply(this,arguments);let[i,a,c]=o?[1,2,3]:[0,1,2],d=arguments[i],f=arguments[a],_=arguments[c];(0,eM.replaceCurrentStackRoute)(d,e);let m=(0,iQ.getRPCMetadata)(T0e.context.active());e&&m?.type===iQ.RPCType.HTTP&&(m.route=(0,eM.generateRoute)(d));let E="";e?E=`request handler - ${e}`:E=`middleware - ${n.name||ga.ANONYMOUS_NAME}`;let T=r._startSpan(e,n);r._diag.debug("start span",E);let S=!1;function R(){S?r._diag.debug(`span ${T.name} - already finished`):(S=!0,r._diag.debug(`finishing span ${T.name}`),T.end()),f.removeListener("close",R)}return f.addListener("close",R),arguments[c]=r._patchNext(_,R),n.apply(this,arguments)}return Object.defineProperty(s,"length",{value:n.length,writable:!1,configurable:!0}),s}_patchUse(e){let n=this;return function(...r){let o=r[r.length-1],s=r[r.length-2]||"";return r[r.length-1]=n._patchMiddleware(s,o),e.apply(this,r)}}_patchHandle(e){let n=this;return function(){let[r,o]=[0,2],s=arguments[r],i=arguments[o],a=(0,eM.addNewStackLayer)(s);return typeof i=="function"&&(arguments[o]=n._patchOut(i,a)),e.apply(this,arguments)}}_patchOut(e,n){return function(...o){return n(),Reflect.apply(e,this,o)}}};ga.ConnectInstrumentation=tM});var lQ=A(io=>{"use strict";p();u();l();Object.defineProperty(io,"__esModule",{value:!0});io.ConnectTypes=io.ConnectNames=io.AttributeNames=io.ANONYMOUS_NAME=io.ConnectInstrumentation=void 0;var uQ=cQ();Object.defineProperty(io,"ConnectInstrumentation",{enumerable:!0,get:function(){return uQ.ConnectInstrumentation}});Object.defineProperty(io,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return uQ.ANONYMOUS_NAME}});var nM=ZP();Object.defineProperty(io,"AttributeNames",{enumerable:!0,get:function(){return nM.AttributeNames}});Object.defineProperty(io,"ConnectNames",{enumerable:!0,get:function(){return nM.ConnectNames}});Object.defineProperty(io,"ConnectTypes",{enumerable:!0,get:function(){return nM.ConnectTypes}})});var mQ=A(Qt=>{"use strict";p();u();l();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.DB_SYSTEM_VALUE_MSSQL=Qt.ATTR_NET_PEER_PORT=Qt.ATTR_NET_PEER_NAME=Qt.ATTR_DB_USER=Qt.ATTR_DB_SYSTEM=Qt.ATTR_DB_STATEMENT=Qt.ATTR_DB_SQL_TABLE=Qt.ATTR_DB_NAME=void 0;Qt.ATTR_DB_NAME="db.name";Qt.ATTR_DB_SQL_TABLE="db.sql.table";Qt.ATTR_DB_STATEMENT="db.statement";Qt.ATTR_DB_SYSTEM="db.system";Qt.ATTR_DB_USER="db.user";Qt.ATTR_NET_PEER_NAME="net.peer.name";Qt.ATTR_NET_PEER_PORT="net.peer.port";Qt.DB_SYSTEM_VALUE_MSSQL="mssql"});var hQ=A(Tp=>{"use strict";p();u();l();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.once=Tp.getSpanName=void 0;function R0e(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}Tp.getSpanName=R0e;var y0e=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};Tp.once=y0e});var EQ=A(Sp=>{"use strict";p();u();l();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.PACKAGE_NAME=Sp.PACKAGE_VERSION=void 0;Sp.PACKAGE_VERSION="0.29.0";Sp.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var RQ=A(Sa=>{"use strict";p();u();l();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.TediousInstrumentation=Sa.INJECTED_CTX=void 0;var Ap=(D(),v(j)),I0e=require("events"),_s=pe(),Yc=(Re(),v(ke)),Ta=mQ(),gQ=hQ(),TQ=EQ(),AQ=Symbol("opentelemetry.instrumentation-tedious.current-database");Sa.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var SQ=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function TA(t){Object.defineProperty(this,AQ,{value:t,writable:!0})}var rM=class t extends _s.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(TQ.PACKAGE_NAME,TQ.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,_s.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,_s.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new _s.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of SQ)(0,_s.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,_s.isWrapped)(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),e},e=>{if(e===void 0)return;let n=e.Connection.prototype;for(let r of SQ)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return TA.call(this,this.config?.options?.database),this.removeListener("databaseChange",TA),this.on("databaseChange",TA),this.once("end",()=>{this.removeListener("databaseChange",TA)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||Ap.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,n,r){return new Promise(o=>{try{let s="set context_info @opentelemetry_traceparent",i=new n.Request(s,c=>{o()});Object.defineProperty(i,Sa.INJECTED_CTX,{value:!0});let a=Buffer.from(r,"utf8");i.addParameter("opentelemetry_traceparent",n.TYPES.VarBinary,a,{length:a.length}),e.execSql(i)}catch{o()}})}_shouldInjectFor(e){return e==="execSql"||e==="execSqlBatch"||e==="callProcedure"||e==="execute"}_patchQuery(e,n){return r=>{let o=this;function s(i){if(i?.[Sa.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof I0e.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,d=()=>c++,f=()=>a++,_=this[AQ],m=(M=>M.sqlTextOrProcedure==="sp_prepare"&&M.parametersByName?.stmt?.value?M.parametersByName.stmt.value:M.sqlTextOrProcedure)(i),E={};o._dbSemconvStability&_s.SemconvStability.OLD&&(E[Ta.ATTR_DB_SYSTEM]=Ta.DB_SYSTEM_VALUE_MSSQL,E[Ta.ATTR_DB_NAME]=_,E[Ta.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,E[Ta.ATTR_DB_STATEMENT]=m,E[Ta.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&_s.SemconvStability.STABLE&&(E[Yc.ATTR_DB_NAMESPACE]=_,E[Yc.ATTR_DB_SYSTEM_NAME]=Yc.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,E[Yc.ATTR_DB_QUERY_TEXT]=m,E[Yc.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&_s.SemconvStability.OLD&&(E[Ta.ATTR_NET_PEER_NAME]=this.config?.server,E[Ta.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&_s.SemconvStability.STABLE&&(E[Yc.ATTR_SERVER_ADDRESS]=this.config?.server,E[Yc.ATTR_SERVER_PORT]=this.config?.options?.port);let T=o.tracer.startSpan((0,gQ.getSpanName)(e,_,m,i.table),{kind:Ap.SpanKind.CLIENT,attributes:E}),S=(0,gQ.once)(M=>{i.removeListener("done",d),i.removeListener("doneInProc",d),i.removeListener("doneProc",f),i.removeListener("error",S),this.removeListener("end",S),T.setAttribute("tedious.procedure_count",a),T.setAttribute("tedious.statement_count",c),M&&T.setStatus({code:Ap.SpanStatusCode.ERROR,message:M.message}),T.end()});i.on("done",d),i.on("doneInProc",d),i.on("doneProc",f),i.once("error",S),this.on("end",S),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(S)):o._diag.error("Expected request.callback to be a function");let R=()=>Ap.context.with(Ap.trace.setSpan(Ap.context.active(),T),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return R();let P=o._buildTraceparent(T);o._injectContextInfo(this,n,P).finally(R)}return Object.defineProperty(s,"length",{value:r.length,writable:!1}),s}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};Sa.TediousInstrumentation=rM});var yQ=A(SA=>{"use strict";p();u();l();Object.defineProperty(SA,"__esModule",{value:!0});SA.TediousInstrumentation=void 0;var N0e=RQ();Object.defineProperty(SA,"TediousInstrumentation",{enumerable:!0,get:function(){return N0e.TediousInstrumentation}})});var CQ=A(Rp=>{"use strict";p();u();l();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.PACKAGE_NAME=Rp.PACKAGE_VERSION=void 0;Rp.PACKAGE_VERSION="0.53.0";Rp.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var MQ=A(AA=>{"use strict";p();u();l();Object.defineProperty(AA,"__esModule",{value:!0});AA.GenericPoolInstrumentation=void 0;var yp=(D(),v(j)),Wc=pe(),PQ=CQ(),oM="generic-pool",sM=class extends Wc.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(PQ.PACKAGE_NAME,PQ.PACKAGE_VERSION,e)}init(){return[new Wc.InstrumentationNodeModuleDefinition(oM,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,Wc.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Wc.InstrumentationNodeModuleDefinition(oM,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,Wc.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Wc.InstrumentationNodeModuleDefinition(oM,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,Wc.isWrapped)(e.Pool)&&this._unwrap(e,"Pool"),this._wrap(e,"Pool",this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let n=this;return function(...o){let s=yp.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return yp.context.with(yp.trace.setSpan(s,i),()=>e.call(this,...o).then(a=>(i.end(),a),a=>{throw i.recordException(a),i.end(),a}))}}_poolWrapper(e){let n=this;return function(){let o=e.apply(this,arguments);return n._wrap(o,"acquire",n._acquireWithCallbacksPatcher.bind(n)),o}}_acquireWithCallbacksPatcher(e){let n=this;return function(o,s){if(n._isDisabled)return e.call(this,o,s);let i=yp.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return yp.context.with(yp.trace.setSpan(i,a),()=>{e.call(this,(c,d)=>{if(a.end(),o)return o(c,d)},s)})}}};AA.GenericPoolInstrumentation=sM});var vQ=A(RA=>{"use strict";p();u();l();Object.defineProperty(RA,"__esModule",{value:!0});RA.GenericPoolInstrumentation=void 0;var C0e=MQ();Object.defineProperty(RA,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return C0e.GenericPoolInstrumentation}})});var iM=A(ms=>{"use strict";p();u();l();Object.defineProperty(ms,"__esModule",{value:!0});ms.ATTR_NET_PEER_PORT=ms.ATTR_NET_PEER_NAME=ms.ATTR_MESSAGING_SYSTEM=ms.ATTR_MESSAGING_OPERATION=void 0;ms.ATTR_MESSAGING_OPERATION="messaging.operation";ms.ATTR_MESSAGING_SYSTEM="messaging.system";ms.ATTR_NET_PEER_NAME="net.peer.name";ms.ATTR_NET_PEER_PORT="net.peer.port"});var aM=A(_t=>{"use strict";p();u();l();Object.defineProperty(_t,"__esModule",{value:!0});_t.ATTR_MESSAGING_CONVERSATION_ID=_t.OLD_ATTR_MESSAGING_MESSAGE_ID=_t.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=_t.ATTR_MESSAGING_URL=_t.ATTR_MESSAGING_PROTOCOL_VERSION=_t.ATTR_MESSAGING_PROTOCOL=_t.MESSAGING_OPERATION_VALUE_PROCESS=_t.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=_t.ATTR_MESSAGING_DESTINATION_KIND=_t.ATTR_MESSAGING_DESTINATION=void 0;_t.ATTR_MESSAGING_DESTINATION="messaging.destination";_t.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";_t.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";_t.MESSAGING_OPERATION_VALUE_PROCESS="process";_t.ATTR_MESSAGING_PROTOCOL="messaging.protocol";_t.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";_t.ATTR_MESSAGING_URL="messaging.url";_t.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";_t.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";_t.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var cM=A(Kc=>{"use strict";p();u();l();Object.defineProperty(Kc,"__esModule",{value:!0});Kc.DEFAULT_CONFIG=Kc.EndOperation=void 0;var M0e;(function(t){t.AutoAck="auto ack",t.Ack="ack",t.AckAll="ackAll",t.Reject="reject",t.Nack="nack",t.NackAll="nackAll",t.ChannelClosed="channel closed",t.ChannelError="channel error",t.InstrumentationTimeout="instrumentation timeout"})(M0e=Kc.EndOperation||(Kc.EndOperation={}));Kc.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var GQ=A(mt=>{"use strict";p();u();l();Object.defineProperty(mt,"__esModule",{value:!0});mt.isConfirmChannelTracing=mt.unmarkConfirmChannelTracing=mt.markConfirmChannelTracing=mt.getConnectionAttributesFromUrl=mt.getConnectionAttributesFromServer=mt.normalizeExchange=mt.CONNECTION_ATTRIBUTES=mt.CHANNEL_CONSUME_TIMEOUT_TIMER=mt.CHANNEL_SPANS_NOT_ENDED=mt.MESSAGE_STORED_SPAN=void 0;var uM=(D(),v(j)),Aa=pe(),yA=(Re(),v(ke)),L_=iM(),IA=aM();mt.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");mt.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");mt.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");mt.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var lM=(0,uM.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),v0e=t=>t!==""?t:"<default>";mt.normalizeExchange=v0e;var x0e=t=>t.replace(/:[^:@/]*@/,":***@"),UQ=(t,e)=>t||(e==="AMQP"?5672:5671),kQ=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},BQ=t=>t||"localhost",hs=(t,e,n,r)=>n?{[e]:n}:(uM.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),L0e=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[L_.ATTR_MESSAGING_SYSTEM]:e}:{}};mt.getConnectionAttributesFromServer=L0e;var D0e=(t,e)=>{let n={[IA.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=kQ(r?.protocol);Object.assign(n,{...hs(t,IA.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=BQ(r?.hostname);e&Aa.SemconvStability.OLD&&Object.assign(n,{...hs(t,L_.ATTR_NET_PEER_NAME,s,"hostname")}),e&Aa.SemconvStability.STABLE&&Object.assign(n,{...hs(t,yA.ATTR_SERVER_ADDRESS,s,"hostname")});let i=UQ(r.port,o);e&Aa.SemconvStability.OLD&&Object.assign(n,hs(t,L_.ATTR_NET_PEER_PORT,i,"port")),e&Aa.SemconvStability.STABLE&&Object.assign(n,hs(t,yA.ATTR_SERVER_PORT,i,"port"))}else{let r=x0e(t);n[IA.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=kQ(o.protocol);Object.assign(n,{...hs(r,IA.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=BQ(o.hostname);e&Aa.SemconvStability.OLD&&Object.assign(n,{...hs(r,L_.ATTR_NET_PEER_NAME,i,"hostname")}),e&Aa.SemconvStability.STABLE&&Object.assign(n,{...hs(r,yA.ATTR_SERVER_ADDRESS,i,"hostname")});let a=UQ(o.port?parseInt(o.port):void 0,s);e&Aa.SemconvStability.OLD&&Object.assign(n,hs(r,L_.ATTR_NET_PEER_PORT,a,"port")),e&Aa.SemconvStability.STABLE&&Object.assign(n,hs(r,yA.ATTR_SERVER_PORT,a,"port"))}catch(o){uM.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};mt.getConnectionAttributesFromUrl=D0e;var w0e=t=>t.setValue(lM,!0);mt.markConfirmChannelTracing=w0e;var U0e=t=>t.deleteValue(lM);mt.unmarkConfirmChannelTracing=U0e;var k0e=t=>t.getValue(lM)===!0;mt.isConfirmChannelTracing=k0e});var jQ=A(Ip=>{"use strict";p();u();l();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.PACKAGE_NAME=Ip.PACKAGE_VERSION=void 0;Ip.PACKAGE_VERSION="0.57.0";Ip.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var FQ=A(bA=>{"use strict";p();u();l();Object.defineProperty(bA,"__esModule",{value:!0});bA.AmqplibInstrumentation=void 0;var it=(D(),v(j)),NA=De(),ve=pe(),B0e=iM(),Nr=aM(),qn=cM(),ht=GQ(),HQ=jQ(),OA=[">=0.5.5 <1"],pM=class extends ve.InstrumentationBase{_netSemconvStability;constructor(e={}){super(HQ.PACKAGE_NAME,HQ.PACKAGE_VERSION,{...qn.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ve.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...qn.DEFAULT_CONFIG,...e})}init(){let e=new ve.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",OA,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new ve.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",OA,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new ve.InstrumentationNodeModuleFile("amqplib/lib/connect.js",OA,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new ve.InstrumentationNodeModuleDefinition("amqplib",OA,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,ve.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,ve.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,ve.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,ve.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,ve.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,qn.EndOperation.Ack)),(0,ve.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,qn.EndOperation.Nack)),(0,ve.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,qn.EndOperation.Reject)),(0,ve.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,qn.EndOperation.AckAll)),(0,ve.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,qn.EndOperation.NackAll)),(0,ve.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,ve.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,ve.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,ve.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,ve.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,ve.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,ve.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,ve.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,ve.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,ve.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,ve.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){let n=this;return function(o,s,i){return e.call(this,o,s,function(a,c){if(a==null){let d=(0,ht.getConnectionAttributesFromUrl)(o,n._netSemconvStability),f=(0,ht.getConnectionAttributesFromServer)(c);c[ht.CONNECTION_ATTRIBUTES]={...d,...f}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,qn.EndOperation.ChannelClosed,void 0);let s=this[ht.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[ht.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,qn.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,n,r){let o=this;return function(i){return o.endAllSpansOnChannel(this,e,n,i),r.apply(this,arguments)}}getAckPatch(e,n,r){let o=this;return function(i,a,c){let d=this,f=n===qn.EndOperation.Reject?a:c,_=d[ht.CHANNEL_SPANS_NOT_ENDED]??[],m=_.findIndex(E=>E.msg===i);if(m<0)o.endConsumerSpan(i,e,n,f);else if(n!==qn.EndOperation.Reject&&a){for(let E=0;E<=m;E++)o.endConsumerSpan(_[E].msg,e,n,f);_.splice(0,m+1)}else o.endConsumerSpan(i,e,n,f),_.splice(m,1);return r.apply(this,arguments)}}getConsumePatch(e,n){let r=this;return function(s,i,a){let c=this;if(!Object.prototype.hasOwnProperty.call(c,ht.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:f}=r.getConfig();if(f){let _=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},f);_.unref(),c[ht.CHANNEL_CONSUME_TIMEOUT_TIMER]=_}c[ht.CHANNEL_SPANS_NOT_ENDED]=[]}let d=function(f){if(!f)return i.call(this,f);let _=f.properties.headers??{},m=it.propagation.extract(it.ROOT_CONTEXT,_),E=f.fields?.exchange,T;if(r._config.useLinksForConsume){let y=m?it.trace.getSpan(m)?.spanContext():void 0;m=void 0,y&&(T=[{context:y}])}let S=r.tracer.startSpan(`${s} process`,{kind:it.SpanKind.CONSUMER,attributes:{...c?.connection?.[ht.CONNECTION_ATTRIBUTES],[Nr.ATTR_MESSAGING_DESTINATION]:E,[Nr.ATTR_MESSAGING_DESTINATION_KIND]:Nr.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Nr.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:f.fields?.routingKey,[B0e.ATTR_MESSAGING_OPERATION]:Nr.MESSAGING_OPERATION_VALUE_PROCESS,[Nr.OLD_ATTR_MESSAGING_MESSAGE_ID]:f?.properties.messageId,[Nr.ATTR_MESSAGING_CONVERSATION_ID]:f?.properties.correlationId},links:T},m),{consumeHook:R}=r.getConfig();R&&(0,ve.safeExecuteInTheMiddle)(()=>R(S,{moduleVersion:e,msg:f}),y=>{y&&it.diag.error("amqplib instrumentation: consumerHook error",y)},!0),a?.noAck||(c[ht.CHANNEL_SPANS_NOT_ENDED].push({msg:f,timeOfConsume:(0,NA.hrTime)()}),f[ht.MESSAGE_STORED_SPAN]=S);let N=m||it.ROOT_CONTEXT;it.context.with(it.trace.setSpan(N,S),()=>{i.call(this,f)}),a?.noAck&&(r.callConsumeEndHook(S,f,!1,qn.EndOperation.AutoAck),S.end())};return arguments[1]=d,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,d){let f=this,{span:_,modifiedOptions:m}=r.createPublishSpan(r,s,i,f,c),{publishHook:E}=r.getConfig();E&&(0,ve.safeExecuteInTheMiddle)(()=>E(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:m,isConfirmChannel:!0}),N=>{N&&it.diag.error("amqplib instrumentation: publishHook error",N)},!0);let T=function(N,y){try{d?.call(this,N,y)}finally{let{publishConfirmHook:P}=r.getConfig();P&&(0,ve.safeExecuteInTheMiddle)(()=>P(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:N}),M=>{M&&it.diag.error("amqplib instrumentation: publishConfirmHook error",M)},!0),N&&_.setStatus({code:it.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),_.end()}},S=(0,ht.markConfirmChannelTracing)(it.context.active()),R=[...arguments];return R[3]=m,R[4]=it.context.bind((0,ht.unmarkConfirmChannelTracing)(it.trace.setSpan(S,_)),T),it.context.with(S,n.bind(this,...R))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,ht.isConfirmChannelTracing)(it.context.active()))return n.apply(this,arguments);{let d=this,{span:f,modifiedOptions:_}=r.createPublishSpan(r,s,i,d,c),{publishHook:m}=r.getConfig();m&&(0,ve.safeExecuteInTheMiddle)(()=>m(f,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!1}),S=>{S&&it.diag.error("amqplib instrumentation: publishHook error",S)},!0);let E=[...arguments];E[3]=_;let T=n.apply(this,E);return f.end(),T}}}createPublishSpan(e,n,r,o,s){let i=(0,ht.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:it.SpanKind.PRODUCER,attributes:{...o.connection[ht.CONNECTION_ATTRIBUTES],[Nr.ATTR_MESSAGING_DESTINATION]:n,[Nr.ATTR_MESSAGING_DESTINATION_KIND]:Nr.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Nr.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[Nr.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[Nr.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},it.propagation.inject(it.trace.setSpan(it.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[ht.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:it.SpanStatusCode.ERROR,message:r!==qn.EndOperation.ChannelClosed&&r!==qn.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[ht.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[ht.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[ht.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,ve.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&it.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,NA.hrTime)(),r=e[ht.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,NA.hrTimeDuration)(i.timeOfConsume,n);if((0,NA.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,qn.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};bA.AmqplibInstrumentation=pM});var VQ=A(Ra=>{"use strict";p();u();l();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.EndOperation=Ra.DEFAULT_CONFIG=Ra.AmqplibInstrumentation=void 0;var G0e=FQ();Object.defineProperty(Ra,"AmqplibInstrumentation",{enumerable:!0,get:function(){return G0e.AmqplibInstrumentation}});var $Q=cM();Object.defineProperty(Ra,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return $Q.DEFAULT_CONFIG}});Object.defineProperty(Ra,"EndOperation",{enumerable:!0,get:function(){return $Q.EndOperation}})});var Dwe={};zc(Dwe,{default:()=>Lwe});module.exports=v(Dwe);p();u();l();p();u();l();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="937c2b04-6fa1-43b8-8c43-0c25abb9f3e1",t._sentryDebugIdIdentifier="sentry-dbid-937c2b04-6fa1-43b8-8c43-0c25abb9f3e1")}catch{}})();p();u();l();p();u();l();function lv(t,e){let n=t.env?.[e];return typeof n=="string"&&n!=="0"}var wo={UnknownCommand:-5,InvalidArgument:-4,ContextLoadError:-3,CommandLoadError:-2,InternalError:-1,Success:0,CommandRunError:1};function aR(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function co(t){return Array.from(t).map((e,n)=>{let r=e.toUpperCase(),o=e.toLowerCase();return n===0||r!==e||r===o?e:`-${o}`}).join("")}function vZ(t){let e=new Map;return{get:(...n)=>e.get(n.join(","))??t,set:(n,...r)=>{e.set(r.join(","),n)}}}function xZ(t,e,n){let{threshold:r,weights:o}=n;if(t===e)return 0;let s=Math.abs(t.length-e.length);if(typeof r=="number"&&s>r)return 1/0;let i=vZ(1/0);i.set(0,-1,-1);for(let d=0;d<e.length;++d)i.set((d+1)*o.insertion,-1,d);for(let d=0;d<t.length;++d)i.set((d+1)*o.deletion,d,-1);let a=-1/0;for(let d=0;d<t.length;++d){let f=1/0;for(let _=0;_<=e.length-1;++_){let m=t[d]===e[_]?0:1,E=[i.get(d-1,_)+o.deletion,i.get(d,_-1)+o.insertion,i.get(d-1,_-1)+m*o.substitution];t[d]===e[_-1]&&t[d-1]===e[_]&&E.push(i.get(d-2,_-2)+m*o.transposition);let T=Math.min(...E);i.set(T,d,_),T<f&&(f=T)}if(f>r){if(a>r)return 1/0;a=f}else a=-1/0}let c=i.get(t.length-1,e.length-1);return c>r?1/0:c}function LZ(t,e,n){let r=t[1]-e[1];if(r!==0)return r;let o=t[0].startsWith(n),s=e[0].startsWith(n);return o&&!s?-1:!o&&s?1:t[0].localeCompare(e[0])}function vp(t,e,n){let r=e.map(s=>[s,xZ(t,s,n)]).filter(([,s])=>s<=n.threshold),o=Math.min(...r.map(([,s])=>s));return r.filter(([,s])=>s===o).sort((s,i)=>LZ(s,i,t)).map(([s])=>s)}var Pn=class extends Error{};function V_(t){return t instanceof Error?t.stack??String(t):String(t)}function DZ(t,e){let n=[],r=Math.max(t.length,e.length);for(let o=0;o<r;++o)n[o]=Math.max(t[o],e[o]);return n}function q_(t,e){if(t.length===0)return[];let n=Array(Math.max(...t.map(o=>o.length))).fill(0,0),r=t.reduce((o,s)=>{let i=s.map(a=>a.length);return DZ(o,i)},n);return t.map(o=>{let s=(o[0]??"").padEnd(r[0]);return o.slice(1).reduce((i,a,c,d)=>{let f=d.length===c+1?a:a.padEnd(r[c+1]);return[...i,e?.[c]??" ",f]},[s]).join("").trimEnd()})}function cR(t,e){if(t.length<=1)return t[0]??"";if(t.length===2)return t.join(` ${e.conjunction} `);let n=t.slice(0,t.length-1).join(", ");return e.serialComma&&(n+=","),[n,e.conjunction,t[t.length-1]].join(" ")}function wZ(t,e){return t.reduce((n,r)=>{let o=e(r),s=n[o]??[];return s.push(r),n[o]=s,n},{})}function UZ(t,e){return wZ(t,n=>n[e])}async function nR(t){let e=await Promise.allSettled(t),n=UZ(e,"status");return n.rejected&&n.rejected.length>0?{status:"rejected",reasons:n.rejected.map(r=>r.reason)}:{status:"fulfilled",value:n.fulfilled?.map(r=>r.value)??[]}}var kZ=new Set(["true","t","yes","y","on","1"]),BZ=new Set(["false","f","no","n","off","0"]),GZ=t=>{let e=t.toLowerCase();if(kZ.has(e))return!0;if(BZ.has(e))return!1;throw new SyntaxError(`Cannot convert ${t} to a boolean`)},uo=t=>{let e=Number(t);if(Number.isNaN(e))throw new SyntaxError(`Cannot convert ${t} to a number`);return e},ko=class extends Pn{_brand};function jZ(t,e){let n=t.constructor.name,r=e[n];return r?r(t):t.message}function HZ(t,e,n){return Object.fromEntries(Object.entries(e).map(([r,o])=>{let s=o,i=t[s];if(!i){let a=gs(s,n);throw new Mp(a,[],r)}return[r,[s,i]]}))}var Mp=class extends ko{input;corrections;aliasName;constructor(t,e,n){let r=`No flag registered for --${t}`;if(n)r+=` (aliased from -${n})`;else if(e.length>0){let o=cR(e.map(s=>`--${s}`),{kind:"conjunctive",conjunction:"or",serialComma:!0});r+=`, did you mean ${o}?`}super(r),this.input=t,this.corrections=e,this.aliasName=n}},uR=class extends ko{input;constructor(t){super(`No alias registered for -${t}`),this.input=t}};function rR(t,e){return t.placeholder?t.placeholder:typeof e=="number"?`arg${e}`:"args"}function gs(t,e){return e==="allow-kebab-for-camel"?co(t):t}var iR=class extends ko{externalFlagNameOrPlaceholder;input;exception;constructor(t,e,n){super(`Failed to parse "${e}" for ${t}: ${n instanceof Error?n.message:String(n)}`),this.externalFlagNameOrPlaceholder=t,this.input=e,this.exception=n}};function ba(t,e,n,r){try{return e.parse.call(r,n)}catch(o){throw new iR(t,n,o)}}var oR=class extends ko{externalFlagName;input;values;constructor(t,e,n,r){let o=`Expected "${e}" to be one of (${n.join("|")})`;if(r.length>0){let s=cR(r.map(i=>`"${i}"`),{kind:"conjunctive",conjunction:"or",serialComma:!0});o+=`, did you mean ${s}?`}super(o),this.externalFlagName=t,this.input=e,this.values=n}},Zc=class extends ko{externalFlagName;nextFlagName;constructor(t,e){let n=`Expected input for flag --${t}`;e&&(n+=` but encountered --${e} instead`),super(n),this.externalFlagName=t,this.nextFlagName=e}},rv=class extends ko{expectedCount;input;constructor(t,e){super(`Too many arguments, expected ${t} but encountered "${e}"`),this.expectedCount=t,this.input=e}},ov=class extends ko{placeholder;limit;constructor(t,e){let n;e?(n=`Expected at least ${e[0]} argument(s) for ${t}`,e[1]===0?n+=" but found none":n+=` but only found ${e[1]}`):n=`Expected argument for ${t}`,super(n),this.placeholder=t,this.limit=e}};function sv(t){if(t.startsWith("no")&&t.length>2){if(t[2]==="-")return t.slice(4);let e=t[2],n=e.toUpperCase();return e!==n?void 0:e.toLowerCase()+t.slice(3)}}function pv(t,e,n){let r=t,o=e[r],s,i=!1;if(!o){let c=sv(r);if(c&&(o=e[c],o&&o.kind=="boolean")){if(o.withNegated!==!1)return{namedFlag:[c,o],negated:!0};s=c,o=void 0}}let a=aR(t);if(n.caseStyle==="allow-kebab-for-camel"&&!o){if(o=e[a],o)return{namedFlag:[a,o]};let c=sv(a);if(c&&(o=e[c],o&&o.kind=="boolean")){if(o.withNegated!==!1)return{namedFlag:[c,o],negated:!0};s=c,i=!0,o=void 0}}if(!o){if(s){let f=s;throw i&&t.includes("-")&&(f=co(s)),new Mp(t,[f])}if(a in e)throw new Mp(t,[a]);let c=co(t);if(c in e)throw new Mp(t,[c]);let d=vp(r,Object.keys(e),n.distanceOptions);throw new Mp(t,d)}return{namedFlag:[r,o]}}function iv(t){return t.namedFlag[1].kind==="boolean"||t.namedFlag[1].kind==="counter"}var dv=/^-([a-z]+)$/i,FZ=/^--([a-z][a-z-.\d_]+)$/i;function $Z(t,e,n,r){let o=dv.exec(t);if(o){let i=o[1];return Array.from(i).map(a=>{let c=a,d=n[c];if(!d)throw new uR(c);return{namedFlag:d}})}let s=FZ.exec(t);if(s){let i=s[1];return[pv(i,e,r)]}return[]}var VZ=/^--([a-z][a-z-.\d_]+)=(.+)$/i,qZ=/^-([a-z])=(.+)$/i,YZ=class extends ko{externalFlagName;valueText;constructor(t,e){super(`Cannot negate flag --${t} and pass "${e}" as value`),this.externalFlagName=t,this.valueText=e}};function WZ(t,e,n,r){let o=VZ.exec(t);if(o){let i=o[1],{namedFlag:a,negated:c}=pv(i,e,r),d=o[2];if(c)throw new YZ(i,d);return[a,d]}let s=qZ.exec(t);if(s){let i=s[1],a=n[i];if(!a)throw new uR(i);let c=s[2];return[a,c]}}async function KZ(t,e,n,r,o){if(!n){if("default"in e&&typeof e.default<"u"){if(e.kind==="boolean")return e.default;if(e.kind==="enum"){if("variadic"in e&&e.variadic&&Array.isArray(e.default)){let i=e.default;for(let a of i)if(!e.values.includes(a)){let c=vp(a,e.values,r.distanceOptions);throw new oR(t,a,e.values,c)}return e.default}return e.default}if("variadic"in e&&e.variadic&&Array.isArray(e.default)){let i=e.default;return Promise.all(i.map(a=>ba(t,e,a,o)))}return ba(t,e,e.default,o)}if(e.optional)return;if(e.kind==="boolean")return!1;if(e.kind==="counter")return 0;throw new Zc(t)}if(e.kind==="counter")return n.reduce((i,a)=>{try{return i+uo.call(o,a)}catch(c){throw new iR(t,a,c)}},0);if("variadic"in e&&e.variadic){if(e.kind==="enum"){for(let i of n)if(!e.values.includes(i)){let a=vp(i,e.values,r.distanceOptions);throw new oR(t,i,e.values,a)}return n}return Promise.all(n.map(i=>ba(t,e,i,o)))}let s=n[0];if(e.kind==="boolean")try{return GZ.call(o,s)}catch(i){throw new iR(t,s,i)}if(e.kind==="enum"){if(!e.values.includes(s)){let i=vp(s,e.values,r.distanceOptions);throw new oR(t,s,e.values,i)}return s}return ba(t,e,s,o)}var zZ=class extends ko{externalFlagName;previousInput;input;constructor(t,e,n){super(`Too many arguments for --${t}, encountered "${n}" after "${e}"`),this.externalFlagName=t,this.previousInput=e,this.input=n}};function fv(t){return t.kind==="counter"?!0:"variadic"in t?!!t.variadic:!1}function Es(t,e,[n,r],o){let s=t.get(n)??[];if(s.length>0&&!fv(r)){let i=gs(n,e);throw new zZ(i,s[0],o)}if("variadic"in r&&typeof r.variadic=="string"){let i=o.split(r.variadic);t.set(n,[...s,...i])}else t.set(n,[...s,o])}function sR(t,e,n){if(e.get(n)){let o=t[n];return!fv(o)}return!1}function XZ(t,e){let{flags:n={},aliases:r={},positional:o={kind:"tuple",parameters:[]}}=t,s=HZ(n,r,e.caseStyle),i=[],a=new Map,c=0,d,f=!1;return{next:_=>{if(!f&&e.allowArgumentEscapeSequence&&_==="--"){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Es(a,e.caseStyle,d,""),d=void 0;else{let m=gs(d[0],e.caseStyle);throw new Zc(m)}f=!0;return}if(!f){let m=WZ(_,n,s,e);if(m){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Es(a,e.caseStyle,d,""),d=void 0;else{let T=gs(d[0],e.caseStyle),S=gs(m[0][0],e.caseStyle);throw new Zc(T,S)}Es(a,e.caseStyle,...m);return}let E=$Z(_,n,s,e);if(E.length>0){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Es(a,e.caseStyle,d,""),d=void 0;else{let T=gs(d[0],e.caseStyle),S=gs(E[0].namedFlag[0],e.caseStyle);throw new Zc(T,S)}if(E.every(iv))for(let T of E)T.namedFlag[1].kind==="boolean"?Es(a,e.caseStyle,T.namedFlag,T.negated?"false":"true"):Es(a,e.caseStyle,T.namedFlag,"1");else if(E.length>1){let T=E.find(R=>!iv(R)),S=gs(T.namedFlag[0],e.caseStyle);throw new Zc(S)}else d=E[0].namedFlag;return}}if(d)Es(a,e.caseStyle,d,_),d=void 0;else{if(o.kind==="tuple"){if(c>=o.parameters.length)throw new rv(o.parameters.length,_)}else if(typeof o.maximum=="number"&&c>=o.maximum)throw new rv(o.maximum,_);i[c]=_,++c}},parseArguments:async _=>{let m=[],E;o.kind==="array"?(typeof o.minimum=="number"&&c<o.minimum&&m.push(new ov(rR(o.parameter),[o.minimum,c])),E=nR(i.map(async(y,P)=>{let M=rR(o.parameter,P+1);return ba(M,o.parameter,y,_)}))):E=nR(o.parameters.map(async(y,P)=>{let M=rR(y,P+1),G=i[P];if(typeof G!="string"){if(typeof y.default=="string")return ba(M,y,y.default,_);if(y.optional)return;throw new ov(M)}return ba(M,y,G,_)})),d&&d[1].kind==="parsed"&&d[1].inferEmpty&&(Es(a,e.caseStyle,d,""),d=void 0);let T=nR(Object.entries(n).map(async y=>{let[P,M]=y,G=gs(P,e.caseStyle);if(d&&d[0]===P)throw new Zc(G);let U=a.get(P),Q=await KZ(G,M,U,e,_);return[P,Q]})),[S,R]=await Promise.all([E,T]);if(S.status==="rejected")for(let y of S.reasons)m.push(y);if(R.status==="rejected")for(let y of R.reasons)m.push(y);if(m.length>0)return{success:!1,errors:m};if(S.status==="rejected")throw new Pn("Unknown failure while scanning positional arguments");if(R.status==="rejected")throw new Pn("Unknown failure while scanning flag arguments");return{success:!0,arguments:[Object.fromEntries(R.value),...S.value]}},proposeCompletions:async({partial:_,completionConfig:m,text:E,context:T,includeVersionFlag:S})=>{if(d)return _v(d[1],T,_);let R=[];if(!f){let N=dv.exec(_);if(m.includeAliases){if(_===""||_==="-"){let y=Object.entries(r).filter(P=>!sR(n,a,P[1]));for(let[P]of y){let M=s[P];M&&R.push({kind:"argument:flag",completion:`-${P}`,brief:M[1].brief})}}else if(N){let y=Array.from(N[1]);if(y.includes("h"))return[];if(S&&y.includes("v"))return[];let P=new Map(a);for(let U of y){let Q=s[U];if(!Q)throw new uR(U);Es(P,e.caseStyle,Q,Q[1].kind==="boolean"?"true":"1")}let M=y[y.length-1];if(M){let U=s[M];U&&R.push({kind:"argument:flag",completion:_,brief:U[1].brief})}let G=Object.entries(r).filter(U=>!sR(n,P,U[1]));for(let[U]of G){let Q=s[U];Q&&R.push({kind:"argument:flag",completion:`${_}${U}`,brief:Q[1].brief})}}}if(_===""||_==="-"||_.startsWith("--")){e.allowArgumentEscapeSequence&&R.push({kind:"argument:flag",completion:"--",brief:E.briefs.argumentEscapeSequence});let y=Object.entries(n).filter(([M])=>!sR(n,a,M));e.caseStyle==="allow-kebab-for-camel"&&(y=y.map(([M,G])=>[co(M),G]));let P=y.map(([M,G])=>[`--${M}`,G]).filter(([M])=>M.startsWith(_));R.push(...P.map(([M,G])=>({kind:"argument:flag",completion:M,brief:G.brief})))}}if(o.kind==="array"){if(o.parameter.proposeCompletions&&(typeof o.maximum!="number"||c<o.maximum)){let N=await o.parameter.proposeCompletions.call(T,_);R.push(...N.map(y=>({kind:"argument:value",completion:y,brief:o.parameter.brief})))}}else{let N=o.parameters[c];if(N?.proposeCompletions){let y=await N.proposeCompletions.call(T,_);R.push(...y.map(P=>({kind:"argument:value",completion:P,brief:N.brief})))}}return R.filter(({completion:N})=>N.startsWith(_))}}}async function _v(t,e,n){if(typeof t.variadic=="string"&&n.endsWith(t.variadic))return _v(t,e,"");let r;return t.kind==="enum"?r=t.values:t.proposeCompletions?r=await t.proposeCompletions.call(e,n):r=[],r.map(o=>({kind:"argument:value",completion:o,brief:t.brief})).filter(({completion:o})=>o.startsWith(n))}function QZ(t,e,n){let r=e==="allow-kebab-for-camel"?"convert-camel-to-kebab":e,o=t.getAllEntries();return n.includeHiddenRoutes||(o=o.filter(s=>!s.hidden)),o.flatMap(s=>{let i=s.name[r];return n.includeAliases?[i,...s.aliases]:[i]})}var JZ={headers:{usage:"USAGE",aliases:"ALIASES",commands:"COMMANDS",flags:"FLAGS",arguments:"ARGUMENTS"},keywords:{default:"default =",separator:"separator ="},briefs:{help:"Print help information and exit",helpAll:"Print help information (including hidden commands/flags) and exit",version:"Print version information and exit",argumentEscapeSequence:"All subsequent inputs should be interpreted as arguments"},noCommandRegisteredForInput:({input:t,corrections:e})=>{let n=`No command registered for \`${t}\``;if(e.length>0){let r=cR(e,{kind:"conjunctive",conjunction:"or",serialComma:!0});return`${n}, did you mean ${r}?`}else return n},noTextAvailableForLocale:({requestedLocale:t,defaultLocale:e})=>`Application does not support "${t}" locale, defaulting to "${e}"`,exceptionWhileParsingArguments:t=>t instanceof ko?jZ(t,{}):`Unable to parse arguments, ${V_(t)}`,exceptionWhileLoadingCommandFunction:t=>`Unable to load command function, ${V_(t)}`,exceptionWhileLoadingCommandContext:t=>`Unable to load command context, ${V_(t)}`,exceptionWhileRunningCommand:t=>`Command failed, ${V_(t)}`,commandErrorResult:t=>t.message,currentVersionIsNotLatest:({currentVersion:t,latestVersion:e,upgradeCommand:n})=>n?`Latest available version is ${e} (currently running ${t}), upgrade with "${n}"`:`Latest available version is ${e} (currently running ${t})`};function ZZ(t){if(t.startsWith("en"))return JZ}function Uo(t,e,n){return!n.disableAnsiColor&&!lv(t,"STRICLI_NO_COLOR")&&(e.getColorDepth?.(t.env)??1)>=4}async function e7({loader:t,parameters:e},{context:n,inputs:r,scannerConfig:o,errorFormatting:s,documentationConfig:i,determineExitCode:a}){let c;try{let f=XZ(e,o);for(let m of r)f.next(m);let _=await f.parseArguments(n);if(_.success)c=_.arguments;else{let m=Uo(n.process,n.process.stderr,i);for(let E of _.errors){let T=s.exceptionWhileParsingArguments(E,m);n.process.stderr.write(m?`\x1B[1m\x1B[31m${T}\x1B[39m\x1B[22m
116
+ Mongoose Error Code: ${e.code}`:""}`})}function KC(t,e,n,r=void 0){n&&(0,i_.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&J5.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function Gve(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(KC(e,o,n,r),o)).catch(o=>{throw Z5(e,o),o}).finally(()=>e.end()):(KC(e,t,n,r),e.end(),t)}sa.handlePromiseResponse=Gve;function jve(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2?a=1:o.length===3&&(a=2),o[a]=(c,d)=>(c?Z5(r,c):KC(r,d,s,i),r.end(),t(c,d)),e.apply(n,o)}sa.handleCallbackResponse=jve});var t9=A(Xl=>{"use strict";p();u();l();Object.defineProperty(Xl,"__esModule",{value:!0});Xl.PACKAGE_NAME=Xl.PACKAGE_VERSION=void 0;Xl.PACKAGE_VERSION="0.56.0";Xl.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var i9=A(ar=>{"use strict";p();u();l();Object.defineProperty(ar,"__esModule",{value:!0});ar.MongooseInstrumentation=ar._ALREADY_INSTRUMENTED=ar._STORED_PARENT_SPAN=void 0;var Ft=(D(),v(j)),Hve=De(),zC=e9(),sn=pe(),n9=t9(),ia=WC(),Hc=(Re(),v(ke)),pS=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],Fve=["remove","count","findOneAndRemove",...pS],$ve=["count","findOneAndRemove",...pS],Vve=[...pS];function r9(t){return t?t.startsWith("6.")||t.startsWith("5.")?Fve:t.startsWith("7.")?$ve:Vve:pS}function o9(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function s9(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}ar._STORED_PARENT_SPAN=Symbol("stored-parent-span");ar._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var XC=class extends sn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(n9.PACKAGE_NAME,n9.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,sn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,sn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new sn.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <9"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save",n)),r.Model.prototype.$save=r.Model.prototype.save,o9(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),s9(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne",n)),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne",n))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec(n)),r9(n).forEach(s=>{this._wrap(r.Query.prototype,s,this.patchAndCaptureSpanContext(s))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany",n)),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite",n)),r}unpatch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e,o=r9(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,o9(n)&&this._unwrap(r.Model.prototype,"remove"),s9(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(s=>{this._unwrap(r.Query.prototype,s)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return r.apply(this,arguments);let i=this[ar._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let f=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&sn.SemconvStability.OLD&&(a[ia.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&sn.SemconvStability.STABLE&&(a[Hc.ATTR_DB_QUERY_TEXT]=f)}let d=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(d,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[ar._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return r.apply(this,arguments);let i=this[ar._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let f=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&sn.SemconvStability.OLD&&(a[ia.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&sn.SemconvStability.STABLE&&(a[Hc.ATTR_DB_QUERY_TEXT]=f)}let d=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(d,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let d={},{dbStatementSerializer:f}=r.getConfig();if(f){let m=f(e,c);r._dbSemconvStability&sn.SemconvStability.OLD&&(d[ia.ATTR_DB_STATEMENT]=m),r._dbSemconvStability&sn.SemconvStability.STABLE&&(d[Hc.ATTR_DB_QUERY_TEXT]=m)}let _=r._startSpan(this.constructor.collection,this.constructor.modelName,e,d);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(_,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return o.apply(this,arguments);let d=c,f=i,_=a;typeof i=="function"?(d=i,f=void 0,_=void 0):typeof a=="function"&&(d=a,_=void 0);let m={},E=r.getConfig().dbStatementSerializer;if(E){let R=E(e,{condition:{_id:this._id},updates:f,options:_});r._dbSemconvStability&sn.SemconvStability.OLD&&(m[ia.ATTR_DB_STATEMENT]=R),r._dbSemconvStability&sn.SemconvStability.STABLE&&(m[Hc.ATTR_DB_QUERY_TEXT]=R)}let T=r._startSpan(this.constructor.collection,this.constructor.modelName,e,m),S=r._handleResponse(T,o,this,arguments,d,n);return S&&typeof S=="object"&&(S[ar._ALREADY_INSTRUMENTED]=!0),S}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Ft.trace.getSpan(Ft.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let d={};switch(e){case"insertMany":d.documents=i;break;case"bulkWrite":d.operations=i;break;default:d.document=i;break}a!==void 0&&(d.options=a);let f={},{dbStatementSerializer:_}=r.getConfig();if(_){let E=_(e,d);r._dbSemconvStability&sn.SemconvStability.OLD&&(f[ia.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&sn.SemconvStability.STABLE&&(f[Hc.ATTR_DB_QUERY_TEXT]=E)}let m=r._startSpan(this.collection,this.modelName,e,f);return r._handleResponse(m,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=Ft.trace.getSpan(Ft.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[ar._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[ar._STORED_PARENT_SPAN]=Ft.trace.getSpan(Ft.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,zC.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&sn.SemconvStability.OLD&&(i[ia.ATTR_DB_OPERATION]=r,i[ia.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&sn.SemconvStability.STABLE&&(i[Hc.ATTR_DB_OPERATION_NAME]=r,i[Hc.ATTR_DB_SYSTEM_NAME]=ia.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&sn.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Ft.SpanKind.CLIENT,attributes:i},s?Ft.trace.setSpan(Ft.context.active(),s):void 0)}_handleResponse(e,n,r,o,s,i=void 0){let a=this;if(s instanceof Function)return a._callOriginalFunction(()=>(0,zC.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,zC.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Ft.context.with((0,Hve.suppressTracing)(Ft.context.active()),e):e()}};ar.MongooseInstrumentation=XC});var a9=A(dS=>{"use strict";p();u();l();Object.defineProperty(dS,"__esModule",{value:!0});dS.MongooseInstrumentation=void 0;var qve=i9();Object.defineProperty(dS,"MongooseInstrumentation",{enumerable:!0,get:function(){return qve.MongooseInstrumentation}})});var d9=A(Lt=>{"use strict";p();u();l();Object.defineProperty(Lt,"__esModule",{value:!0});Lt.METRIC_DB_CLIENT_CONNECTIONS_USAGE=Lt.DB_SYSTEM_VALUE_MYSQL=Lt.ATTR_NET_PEER_PORT=Lt.ATTR_NET_PEER_NAME=Lt.ATTR_DB_USER=Lt.ATTR_DB_SYSTEM=Lt.ATTR_DB_STATEMENT=Lt.ATTR_DB_NAME=Lt.ATTR_DB_CONNECTION_STRING=void 0;Lt.ATTR_DB_CONNECTION_STRING="db.connection_string";Lt.ATTR_DB_NAME="db.name";Lt.ATTR_DB_STATEMENT="db.statement";Lt.ATTR_DB_SYSTEM="db.system";Lt.ATTR_DB_USER="db.user";Lt.ATTR_NET_PEER_NAME="net.peer.name";Lt.ATTR_NET_PEER_PORT="net.peer.port";Lt.DB_SYSTEM_VALUE_MYSQL="mysql";Lt.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var f9=A(a_=>{"use strict";p();u();l();Object.defineProperty(a_,"__esModule",{value:!0});a_.AttributeNames=void 0;var Wve;(function(t){t.MYSQL_VALUES="db.mysql.values"})(Wve=a_.AttributeNames||(a_.AttributeNames={}))});var _9=A(yn=>{"use strict";p();u();l();Object.defineProperty(yn,"__esModule",{value:!0});yn.getPoolNameOld=yn.arrayStringifyHelper=yn.getSpanName=yn.getDbValues=yn.getDbQueryText=yn.getJDBCString=yn.getConfig=void 0;function Kve(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}yn.getConfig=Kve;function zve(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}yn.getJDBCString=zve;function Xve(t){return typeof t=="string"?t:t.sql}yn.getDbQueryText=Xve;function Qve(t,e){return QC(typeof t=="string"?e:e||t.values)}yn.getDbValues=Qve;function Jve(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}yn.getSpanName=Jve;function QC(t){return t?`[${t.toString()}]`:""}yn.arrayStringifyHelper=QC;function Zve(t){let e=t.config.connectionConfig,n="";return n+=e.host?`host: '${e.host}', `:"",n+=e.port?`port: ${e.port}, `:"",n+=e.database?`database: '${e.database}', `:"",n+=e.user?`user: '${e.user}'`:"",e.user||(n=n.substring(0,n.length-2)),n.trim()}yn.getPoolNameOld=Zve});var m9=A(Ql=>{"use strict";p();u();l();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.PACKAGE_NAME=Ql.PACKAGE_VERSION=void 0;Ql.PACKAGE_VERSION="0.56.0";Ql.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var E9=A(fS=>{"use strict";p();u();l();Object.defineProperty(fS,"__esModule",{value:!0});fS.MySQLInstrumentation=void 0;var cr=(D(),v(j)),to=pe(),Jl=(Re(),v(ke)),Ws=d9(),exe=f9(),Fc=_9(),h9=m9(),JC=class extends to.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(h9.PACKAGE_NAME,h9.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,to.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,to.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Ws.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsageOld?.add(e,{state:r,name:n})}init(){return[new to.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,to.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,to.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,to.isWrapped)(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 n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),s}}}_patchCreatePool(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"end",n._patchPoolEnd(s)),n._setPoolCallbacks(s,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,d=(0,Fc.getPoolNameOld)(e);r._connCountAdd(-c,d,"used"),r._connCountAdd(-a,d,"idle"),n.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"add",n._patchAdd(s)),s}}}_patchAdd(e){return n=>{let r=this;return function(s,i){if(!r._enabled)return r._unwrap(e,"add"),n.apply(e,arguments);n.apply(e,arguments);let a=e._nodes;if(a){let c=typeof s=="object"?"CLUSTER::"+e._lastId:String(s),d=a[c].pool;r._setPoolCallbacks(d,s)}}}}_patchGetConnection(e){return n=>{let r=this;return function(s,i,a){if(!r._enabled)return r._unwrap(e,"getConnection"),n.apply(e,arguments);if(arguments.length===1&&typeof s=="function"){let c=r._getConnectionCallbackPatchFn(s);return n.call(e,c)}if(arguments.length===2&&typeof i=="function"){let c=r._getConnectionCallbackPatchFn(i);return n.call(e,s,c)}if(arguments.length===3&&typeof a=="function"){let c=r._getConnectionCallbackPatchFn(a);return n.call(e,s,i,c)}return n.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let n=this,r=cr.context.active();return function(o,s){s&&((0,to.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&cr.context.with(r,e,this,o,s)}}_patchQuery(e){return n=>{let r=this;return function(o,s,i){if(!r._enabled)return r._unwrap(e,"query"),n.apply(e,arguments);let a={},{host:c,port:d,database:f,user:_}=(0,Fc.getConfig)(e.config),m=parseInt(d,10),E=(0,Fc.getDbQueryText)(o);r._dbSemconvStability&to.SemconvStability.OLD&&(a[Ws.ATTR_DB_SYSTEM]=Ws.DB_SYSTEM_VALUE_MYSQL,a[Ws.ATTR_DB_CONNECTION_STRING]=(0,Fc.getJDBCString)(c,d,f),a[Ws.ATTR_DB_NAME]=f,a[Ws.ATTR_DB_USER]=_,a[Ws.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&to.SemconvStability.STABLE&&(a[Jl.ATTR_DB_SYSTEM_NAME]=Jl.DB_SYSTEM_NAME_VALUE_MYSQL,a[Jl.ATTR_DB_NAMESPACE]=f,a[Jl.ATTR_DB_QUERY_TEXT]=E),r._netSemconvStability&to.SemconvStability.OLD&&(a[Ws.ATTR_NET_PEER_NAME]=c,isNaN(m)||(a[Ws.ATTR_NET_PEER_PORT]=m)),r._netSemconvStability&to.SemconvStability.STABLE&&(a[Jl.ATTR_SERVER_ADDRESS]=c,isNaN(m)||(a[Jl.ATTR_SERVER_PORT]=m));let T=r.tracer.startSpan((0,Fc.getSpanName)(o),{kind:cr.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let N;Array.isArray(s)?N=s:arguments[2]&&(N=[s]),T.setAttribute(exe.AttributeNames.MYSQL_VALUES,(0,Fc.getDbValues)(o,N))}let S=Array.from(arguments).findIndex(N=>typeof N=="function"),R=cr.context.active();if(S===-1){let N=cr.context.with(cr.trace.setSpan(cr.context.active(),T),()=>n.apply(e,arguments));return cr.context.bind(R,N),N.on("error",y=>T.setStatus({code:cr.SpanStatusCode.ERROR,message:y.message})).on("end",()=>{T.end()})}else return r._wrap(arguments,S,r._patchCallbackQuery(T,R)),cr.context.with(cr.trace.setSpan(cr.context.active(),T),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:cr.SpanStatusCode.ERROR,message:o.message}),e.end(),cr.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Fc.getPoolNameOld)(e);e.on("connection",o=>{this._connCountAdd(1,r,"idle")}),e.on("acquire",o=>{this._connCountAdd(-1,r,"idle"),this._connCountAdd(1,r,"used")}),e.on("release",o=>{this._connCountAdd(1,r,"idle"),this._connCountAdd(-1,r,"used")})}};fS.MySQLInstrumentation=JC});var g9=A(_S=>{"use strict";p();u();l();Object.defineProperty(_S,"__esModule",{value:!0});_S.MySQLInstrumentation=void 0;var txe=E9();Object.defineProperty(_S,"MySQLInstrumentation",{enumerable:!0,get:function(){return txe.MySQLInstrumentation}})});var ZC=A(zt=>{"use strict";p();u();l();Object.defineProperty(zt,"__esModule",{value:!0});zt.DB_SYSTEM_VALUE_MYSQL=zt.ATTR_NET_PEER_PORT=zt.ATTR_NET_PEER_NAME=zt.ATTR_DB_USER=zt.ATTR_DB_SYSTEM=zt.ATTR_DB_STATEMENT=zt.ATTR_DB_NAME=zt.ATTR_DB_CONNECTION_STRING=void 0;zt.ATTR_DB_CONNECTION_STRING="db.connection_string";zt.ATTR_DB_NAME="db.name";zt.ATTR_DB_STATEMENT="db.statement";zt.ATTR_DB_SYSTEM="db.system";zt.ATTR_DB_USER="db.user";zt.ATTR_NET_PEER_NAME="net.peer.name";zt.ATTR_NET_PEER_PORT="net.peer.port";zt.DB_SYSTEM_VALUE_MYSQL="mysql"});var tP=A(mS=>{"use strict";p();u();l();Object.defineProperty(mS,"__esModule",{value:!0});mS.addSqlCommenterComment=void 0;var eP=(D(),v(j)),rxe=De();function oxe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function sxe(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function ixe(t,e){if(typeof e!="string"||e.length===0||oxe(e))return e;let n=new rxe.W3CTraceContextPropagator,r={};n.inject(eP.trace.setSpan(eP.ROOT_CONTEXT,t),r,eP.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=sxe(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}mS.addSqlCommenterComment=ixe});var y9=A(no=>{"use strict";p();u();l();Object.defineProperty(no,"__esModule",{value:!0});no.getConnectionPrototypeToInstrument=no.once=no.getSpanName=no.getQueryText=no.getConnectionAttributes=void 0;var c_=ZC(),hS=pe(),nP=(Re(),v(ke));function axe(t,e,n){let{host:r,port:o,database:s,user:i}=cxe(t),a={};e&hS.SemconvStability.OLD&&(a[c_.ATTR_DB_CONNECTION_STRING]=uxe(r,o,s),a[c_.ATTR_DB_NAME]=s,a[c_.ATTR_DB_USER]=i),e&hS.SemconvStability.STABLE&&(a[nP.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&hS.SemconvStability.OLD&&(a[c_.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[c_.ATTR_NET_PEER_PORT]=c)),n&hS.SemconvStability.STABLE&&(a[nP.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[nP.ATTR_SERVER_PORT]=c)),a}no.getConnectionAttributes=axe;function cxe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function uxe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function lxe(t,e,n,r=!1,o=pxe){let[s,i]=typeof t=="string"?[t,n]:[t.sql,dxe(t)?n||t.values:n];try{return r?o(s):e&&i?e(s,i):s}catch{return"Could not determine the query due to an error in masking or formatting"}}no.getQueryText=lxe;function pxe(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function dxe(t){return"values"in t}function fxe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}no.getSpanName=fxe;var _xe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};no.once=_xe;function mxe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}no.getConnectionPrototypeToInstrument=mxe});var I9=A(Zl=>{"use strict";p();u();l();Object.defineProperty(Zl,"__esModule",{value:!0});Zl.PACKAGE_NAME=Zl.PACKAGE_VERSION=void 0;Zl.PACKAGE_VERSION="0.56.0";Zl.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var C9=A(ES=>{"use strict";p();u();l();Object.defineProperty(ES,"__esModule",{value:!0});ES.MySQL2Instrumentation=void 0;var N9=(D(),v(j)),vo=pe(),rP=ZC(),O9=tP(),ep=y9(),b9=I9(),oP=(Re(),v(ke)),sP=[">=1.4.2 <4"],iP=class extends vo.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(b9.PACKAGE_NAME,b9.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,vo.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,vo.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,vo.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,vo.isWrapped)(s.execute)&&this._unwrap(s,"execute"),this._wrap(s,"execute",this._patchQuery(e,!0))},o=s=>{this._unwrap(s,"query"),this._unwrap(s,"execute")};return[new vo.InstrumentationNodeModuleDefinition("mysql2",sP,s=>(n(s),s),()=>{},[new vo.InstrumentationNodeModuleFile("mysql2/promise.js",sP,s=>(n(s),s),()=>{}),new vo.InstrumentationNodeModuleFile("mysql2/lib/connection.js",sP,s=>{let i=(0,ep.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,ep.getConnectionPrototypeToInstrument)(s);o(i)})])]}_patchQuery(e,n){return r=>{let o=this;return function(s,i,a){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let{maskStatement:d,maskStatementHook:f,responseHook:_}=o.getConfig(),m=(0,ep.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),E=(0,ep.getQueryText)(s,e,c,d,f);o._dbSemconvStability&vo.SemconvStability.OLD&&(m[rP.ATTR_DB_SYSTEM]=rP.DB_SYSTEM_VALUE_MYSQL,m[rP.ATTR_DB_STATEMENT]=E),o._dbSemconvStability&vo.SemconvStability.STABLE&&(m[oP.ATTR_DB_SYSTEM_NAME]=oP.DB_SYSTEM_NAME_VALUE_MYSQL,m[oP.ATTR_DB_QUERY_TEXT]=E);let T=o.tracer.startSpan((0,ep.getSpanName)(s),{kind:N9.SpanKind.CLIENT,attributes:m});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,O9.addSqlCommenterComment)(T,s):Object.assign(s,{sql:(0,O9.addSqlCommenterComment)(T,s.sql)}));let S=(0,ep.once)((R,N)=>{R?T.setStatus({code:N9.SpanStatusCode.ERROR,message:R.message}):typeof _=="function"&&(0,vo.safeExecuteInTheMiddle)(()=>{_(T,{queryResults:N})},y=>{y&&o._diag.warn("Failed executing responseHook",y)},!0),T.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(S));let R=r.apply(this,arguments);return R.once("error",N=>{S(N)}).once("result",N=>{S(void 0,N)}),R}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(S)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(S)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};ES.MySQL2Instrumentation=iP});var P9=A(gS=>{"use strict";p();u();l();Object.defineProperty(gS,"__esModule",{value:!0});gS.MySQL2Instrumentation=void 0;var hxe=C9();Object.defineProperty(gS,"MySQL2Instrumentation",{enumerable:!0,get:function(){return hxe.MySQL2Instrumentation}})});var D9=A(In=>{"use strict";p();u();l();Object.defineProperty(In,"__esModule",{value:!0});In.DB_SYSTEM_VALUE_REDIS=In.DB_SYSTEM_NAME_VALUE_REDIS=In.ATTR_NET_PEER_PORT=In.ATTR_NET_PEER_NAME=In.ATTR_DB_SYSTEM=In.ATTR_DB_STATEMENT=In.ATTR_DB_CONNECTION_STRING=void 0;In.ATTR_DB_CONNECTION_STRING="db.connection_string";In.ATTR_DB_STATEMENT="db.statement";In.ATTR_DB_SYSTEM="db.system";In.ATTR_NET_PEER_NAME="net.peer.name";In.ATTR_NET_PEER_PORT="net.peer.port";In.DB_SYSTEM_NAME_VALUE_REDIS="redis";In.DB_SYSTEM_VALUE_REDIS="redis"});var w9=A(TS=>{"use strict";p();u();l();Object.defineProperty(TS,"__esModule",{value:!0});TS.endSpan=void 0;var gxe=(D(),v(j)),Txe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:gxe.SpanStatusCode.ERROR,message:e.message})),t.end()};TS.endSpan=Txe});var AS=A(SS=>{"use strict";p();u();l();Object.defineProperty(SS,"__esModule",{value:!0});SS.defaultDbStatementSerializer=void 0;var Sxe=[{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}],Axe=(t,e)=>{if(Array.isArray(e)&&e.length){let n=Sxe.find(({regex:o})=>o.test(t))?.args??0,r=n>=0?e.slice(0,n):e;return e.length>r.length&&r.push(`[${e.length-n} other arguments]`),`${t} ${r.join(" ")}`}return t};SS.defaultDbStatementSerializer=Axe});var U9=A(tp=>{"use strict";p();u();l();Object.defineProperty(tp,"__esModule",{value:!0});tp.PACKAGE_NAME=tp.PACKAGE_VERSION=void 0;tp.PACKAGE_VERSION="0.58.0";tp.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var j9=A(RS=>{"use strict";p();u();l();Object.defineProperty(RS,"__esModule",{value:!0});RS.IORedisInstrumentation=void 0;var aa=(D(),v(j)),ur=pe(),ca=(Re(),v(ke)),lr=D9(),k9=pe(),u_=w9(),Rxe=AS(),B9=U9(),G9={requireParentSpan:!0},aP=class extends ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(B9.PACKAGE_NAME,B9.PACKAGE_VERSION,{...G9,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...G9,...e})}init(){return[new ur.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,ur.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,ur.isWrapped)(r.prototype.connect)&&this._unwrap(r.prototype,"connect"),this._wrap(r.prototype,"connect",this._patchConnection()),e},e=>{if(e===void 0)return;let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(e){return n=>this._traceSendCommand(n,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,n){let r=this;return function(o){if(arguments.length<1||typeof o!="object")return e.apply(this,arguments);let s=r.getConfig(),i=s.dbStatementSerializer||Rxe.defaultDbStatementSerializer,a=aa.trace.getSpan(aa.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:d,port:f}=this.options,_=i(o.name,o.args);r._dbSemconvStability&ur.SemconvStability.OLD&&(c[lr.ATTR_DB_SYSTEM]=lr.DB_SYSTEM_VALUE_REDIS,c[lr.ATTR_DB_STATEMENT]=_,c[lr.ATTR_DB_CONNECTION_STRING]=`redis://${d}:${f}`),r._dbSemconvStability&ur.SemconvStability.STABLE&&(c[ca.ATTR_DB_SYSTEM_NAME]=lr.DB_SYSTEM_NAME_VALUE_REDIS,c[ca.ATTR_DB_QUERY_TEXT]=_),r._netSemconvStability&ur.SemconvStability.OLD&&(c[lr.ATTR_NET_PEER_NAME]=d,c[lr.ATTR_NET_PEER_PORT]=f),r._netSemconvStability&ur.SemconvStability.STABLE&&(c[ca.ATTR_SERVER_ADDRESS]=d,c[ca.ATTR_SERVER_PORT]=f);let m=r.tracer.startSpan(o.name,{kind:aa.SpanKind.CLIENT,attributes:c}),{requestHook:E}=s;E&&(0,k9.safeExecuteInTheMiddle)(()=>E(m,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),T=>{T&&aa.diag.error("ioredis instrumentation: request hook failed",T)},!0);try{let T=e.apply(this,arguments),S=o.resolve;o.resolve=function(N){(0,k9.safeExecuteInTheMiddle)(()=>s.responseHook?.(m,o.name,o.args,N),y=>{y&&aa.diag.error("ioredis instrumentation: response hook failed",y)},!0),(0,u_.endSpan)(m,null),S(N)};let R=o.reject;return o.reject=function(N){(0,u_.endSpan)(m,N),R(N)},T}catch(T){throw(0,u_.endSpan)(m,T),T}}}_traceConnection(e){let n=this;return function(){let r=aa.trace.getSpan(aa.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o={},{host:s,port:i}=this.options;n._dbSemconvStability&ur.SemconvStability.OLD&&(o[lr.ATTR_DB_SYSTEM]=lr.DB_SYSTEM_VALUE_REDIS,o[lr.ATTR_DB_STATEMENT]="connect",o[lr.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&ur.SemconvStability.STABLE&&(o[ca.ATTR_DB_SYSTEM_NAME]=lr.DB_SYSTEM_NAME_VALUE_REDIS,o[ca.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&ur.SemconvStability.OLD&&(o[lr.ATTR_NET_PEER_NAME]=s,o[lr.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&ur.SemconvStability.STABLE&&(o[ca.ATTR_SERVER_ADDRESS]=s,o[ca.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:aa.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,u_.endSpan)(a,null),c}catch(c){throw(0,u_.endSpan)(a,c),c}}}};RS.IORedisInstrumentation=aP});var H9=A(yS=>{"use strict";p();u();l();Object.defineProperty(yS,"__esModule",{value:!0});yS.IORedisInstrumentation=void 0;var yxe=j9();Object.defineProperty(yS,"IORedisInstrumentation",{enumerable:!0,get:function(){return yxe.IORedisInstrumentation}})});var IS=A(np=>{"use strict";p();u();l();Object.defineProperty(np,"__esModule",{value:!0});np.PACKAGE_NAME=np.PACKAGE_VERSION=void 0;np.PACKAGE_VERSION="0.58.0";np.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var F9=A(ua=>{"use strict";p();u();l();Object.defineProperty(ua,"__esModule",{value:!0});ua.getTracedCreateStreamTrace=ua.getTracedCreateClient=ua.endSpan=void 0;var l_=(D(),v(j)),Ixe=(t,e)=>{e&&t.setStatus({code:l_.SpanStatusCode.ERROR,message:e.message}),t.end()};ua.endSpan=Ixe;var Nxe=t=>function(){let n=t.apply(this,arguments);return l_.context.bind(l_.context.active(),n)};ua.getTracedCreateClient=Nxe;var Oxe=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){l_.context.bind(l_.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};ua.getTracedCreateStreamTrace=Oxe});var NS=A(Nn=>{"use strict";p();u();l();Object.defineProperty(Nn,"__esModule",{value:!0});Nn.DB_SYSTEM_VALUE_REDIS=Nn.DB_SYSTEM_NAME_VALUE_REDIS=Nn.ATTR_NET_PEER_PORT=Nn.ATTR_NET_PEER_NAME=Nn.ATTR_DB_SYSTEM=Nn.ATTR_DB_STATEMENT=Nn.ATTR_DB_CONNECTION_STRING=void 0;Nn.ATTR_DB_CONNECTION_STRING="db.connection_string";Nn.ATTR_DB_STATEMENT="db.statement";Nn.ATTR_DB_SYSTEM="db.system";Nn.ATTR_NET_PEER_NAME="net.peer.name";Nn.ATTR_NET_PEER_PORT="net.peer.port";Nn.DB_SYSTEM_NAME_VALUE_REDIS="redis";Nn.DB_SYSTEM_VALUE_REDIS="redis"});var V9=A(bS=>{"use strict";p();u();l();Object.defineProperty(bS,"__esModule",{value:!0});bS.RedisInstrumentationV2_V3=void 0;var yr=pe(),OS=F9(),$9=IS(),p_=(D(),v(j)),d_=(Re(),v(ke)),$c=NS(),bxe=AS(),cP=class t extends yr.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super($9.PACKAGE_NAME,$9.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,yr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,yr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new yr.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,yr.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._wrap(e.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),(0,yr.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,yr.isWrapped)(e.createClient)&&this._unwrap(e,"createClient"),this._wrap(e,"createClient",this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._unwrap(e.RedisClient.prototype,"create_stream"),this._unwrap(e,"createClient"))})]}_getPatchInternalSendCommand(){let e=this;return function(r){return function(s){if(arguments.length!==1||typeof s!="object")return r.apply(this,arguments);let i=e.getConfig(),a=p_.trace.getSpan(p_.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||bxe.defaultDbStatementSerializer,d={};e._semconvStability&yr.SemconvStability.OLD&&Object.assign(d,{[$c.ATTR_DB_SYSTEM]:$c.DB_SYSTEM_VALUE_REDIS,[$c.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&yr.SemconvStability.STABLE&&Object.assign(d,{[d_.ATTR_DB_SYSTEM_NAME]:$c.DB_SYSTEM_NAME_VALUE_REDIS,[d_.ATTR_DB_OPERATION_NAME]:s.command,[d_.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let f=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:p_.SpanKind.CLIENT,attributes:d});if(this.connection_options){let m={};e._semconvStability&yr.SemconvStability.OLD&&Object.assign(m,{[$c.ATTR_NET_PEER_NAME]:this.connection_options.host,[$c.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&yr.SemconvStability.STABLE&&Object.assign(m,{[d_.ATTR_SERVER_ADDRESS]:this.connection_options.host,[d_.ATTR_SERVER_PORT]:this.connection_options.port}),f.setAttributes(m)}this.address&&e._semconvStability&yr.SemconvStability.OLD&&f.setAttribute($c.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let _=arguments[0].callback;if(_){let m=p_.context.active();arguments[0].callback=function(T,S){if(i?.responseHook){let R=i.responseHook;(0,yr.safeExecuteInTheMiddle)(()=>{R(f,s.command,s.args,S)},N=>{N&&e._diag.error("Error executing responseHook",N)},!0)}return(0,OS.endSpan)(f,T),p_.context.with(m,_,this,...arguments)}}try{return r.apply(this,arguments)}catch(m){throw(0,OS.endSpan)(f,m),m}}}}_getPatchCreateClient(){return function(n){return(0,OS.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,OS.getTracedCreateStreamTrace)(n)}}};bS.RedisInstrumentationV2_V3=cP});var Y9=A(CS=>{"use strict";p();u();l();Object.defineProperty(CS,"__esModule",{value:!0});CS.getClientAttributes=void 0;var uP=(Re(),v(ke)),rp=NS(),q9=pe();function Cxe(t,e,n){let r={};return n&q9.SemconvStability.OLD&&Object.assign(r,{[rp.ATTR_DB_SYSTEM]:rp.DB_SYSTEM_VALUE_REDIS,[rp.ATTR_NET_PEER_NAME]:e?.socket?.host,[rp.ATTR_NET_PEER_PORT]:e?.socket?.port,[rp.ATTR_DB_CONNECTION_STRING]:Pxe(t,e?.url)}),n&q9.SemconvStability.STABLE&&Object.assign(r,{[uP.ATTR_DB_SYSTEM_NAME]:rp.DB_SYSTEM_NAME_VALUE_REDIS,[uP.ATTR_SERVER_ADDRESS]:e?.socket?.host,[uP.ATTR_SERVER_PORT]:e?.socket?.port}),r}CS.getClientAttributes=Cxe;function Pxe(t,e){if(!(typeof e!="string"||!e))try{let n=new URL(e);return n.searchParams.delete("user_pwd"),n.username="",n.password="",n.href}catch(n){t.error("failed to sanitize redis connection url",n)}}});var X9=A(PS=>{"use strict";p();u();l();Object.defineProperty(PS,"__esModule",{value:!0});PS.RedisInstrumentationV4_V5=void 0;var ro=(D(),v(j)),ze=pe(),W9=Y9(),Mxe=AS(),K9=IS(),lP=(Re(),v(ke)),vxe=NS(),f_=Symbol("opentelemetry.instrumentation.redis.open_spans"),z9=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),pP=class t extends ze.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(K9.PACKAGE_NAME,K9.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,ze.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,ze.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new ze.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,["^1.0.0"],(s,i)=>{let a=s.transformCommandArguments;if(!a)return this._diag.error("internal instrumentation error, missing transformCommandArguments function"),s;let c=i?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return(0,ze.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,ze.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,ze.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new ze.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,ze.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,ze.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,ze.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,ze.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,ze.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new ze.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,ze.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,ze.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,ze.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand"),this._wrap(i,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(i,"connect",this._getPatchedClientConnect()),s},s=>{let i=s?.default?.prototype;(0,ze.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,ze.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,ze.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new ze.InstrumentationNodeModuleDefinition(e,["^1.0.0","^5.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){if(i?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let a=i.executor;return i.executor=function(c,d){let f=e(c,d).args;return n._traceClientCommand(a,this,arguments,f)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let n=this;return function(o){return function(){let i=o.apply(this,arguments);return typeof i?.then!="function"?(n._diag.error("non-promise result when patching exec/execAsPipeline"),i):i.then(a=>{let c=this[f_];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[f_];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let d=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,d,e)}return Promise.reject(a)})}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[z9]=this.options,o}}}_getPatchRedisClientSendCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchedClientConnect(){let e=this;return function(r){return function(){let s=this.options,i=(0,W9.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:ro.SpanKind.CLIENT,attributes:i});return ro.context.with(ro.trace.setSpan(ro.context.active(),a),()=>r.apply(this)).then(d=>(a.end(),d)).catch(d=>(a.recordException(d),a.setStatus({code:ro.SpanStatusCode.ERROR,message:d.message}),a.end(),Promise.reject(d)))}}}_traceClientCommand(e,n,r,o){if(ro.trace.getSpan(ro.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[z9],a=o[0],c=o.slice(1),d=this.getConfig().dbStatementSerializer||Mxe.defaultDbStatementSerializer,f=(0,W9.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&ze.SemconvStability.STABLE&&(f[lP.ATTR_DB_OPERATION_NAME]=a);try{let E=d(a,c);E!=null&&(this._semconvStability&ze.SemconvStability.OLD&&(f[vxe.ATTR_DB_STATEMENT]=E),this._semconvStability&ze.SemconvStability.STABLE&&(f[lP.ATTR_DB_QUERY_TEXT]=E))}catch(E){this._diag.error("dbStatementSerializer throw an exception",E,{commandName:a})}let _=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:ro.SpanKind.CLIENT,attributes:f}),m=ro.context.with(ro.trace.setSpan(ro.context.active(),_),()=>e.apply(n,r));if(typeof m?.then=="function")m.then(E=>{this._endSpanWithResponse(_,a,c,E,void 0)},E=>{this._endSpanWithResponse(_,a,c,null,E)});else{let E=m;E[f_]=E[f_]||[],E[f_].push({span:_,commandName:a,commandArgs:c})}return m}_endSpansWithRedisReplies(e,n,r=!1){if(!e)return this._diag.error("cannot find open spans to end for redis multi/pipeline");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");let o=e.map(a=>a.commandName),i=o.every(a=>a===o[0])?(r?"PIPELINE ":"MULTI ")+o[0]:r?"PIPELINE":"MULTI";for(let a=0;a<e.length;a++){let{span:c,commandArgs:d}=e[a],f=n[a],[_,m]=f instanceof Error?[null,f]:[f,void 0];this._semconvStability&ze.SemconvStability.STABLE&&c.setAttribute(lP.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],d,_,m)}}_endSpanWithResponse(e,n,r,o,s){let{responseHook:i}=this.getConfig();if(!s&&i)try{i(e,n,r,o)}catch(a){this._diag.error("responseHook throw an exception",a)}s&&(e.recordException(s),e.setStatus({code:ro.SpanStatusCode.ERROR,message:s?.message})),e.end()}};PS.RedisInstrumentationV4_V5=pP});var Z9=A(MS=>{"use strict";p();u();l();Object.defineProperty(MS,"__esModule",{value:!0});MS.RedisInstrumentation=void 0;var xxe=pe(),Q9=IS(),Lxe=V9(),Dxe=X9(),J9={requireParentSpan:!1},dP=class extends xxe.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...J9,...e};super(Q9.PACKAGE_NAME,Q9.PACKAGE_VERSION,n),this.instrumentationV2_V3=new Lxe.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new Dxe.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...J9,...e};super.setConfig(n),this.initialized&&(this.instrumentationV2_V3.setConfig(n),this.instrumentationV4_V5.setConfig(n))}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())}};MS.RedisInstrumentation=dP});var e6=A(vS=>{"use strict";p();u();l();Object.defineProperty(vS,"__esModule",{value:!0});vS.RedisInstrumentation=void 0;var wxe=Z9();Object.defineProperty(vS,"RedisInstrumentation",{enumerable:!0,get:function(){return wxe.RedisInstrumentation}})});var l6=A(LS=>{"use strict";p();u();l();Object.defineProperty(LS,"__esModule",{value:!0});LS.EVENT_LISTENERS_SET=void 0;LS.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var mP=A(h_=>{"use strict";p();u();l();Object.defineProperty(h_,"__esModule",{value:!0});h_.AttributeNames=void 0;var Fxe;(function(t){t.PG_VALUES="db.postgresql.values",t.PG_PLAN="db.postgresql.plan",t.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",t.MAX_CLIENT="db.postgresql.max.client"})(Fxe=h_.AttributeNames||(h_.AttributeNames={}))});var hP=A(xe=>{"use strict";p();u();l();Object.defineProperty(xe,"__esModule",{value:!0});xe.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=xe.METRIC_DB_CLIENT_CONNECTION_COUNT=xe.DB_SYSTEM_VALUE_POSTGRESQL=xe.DB_CLIENT_CONNECTION_STATE_VALUE_USED=xe.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=xe.ATTR_NET_PEER_PORT=xe.ATTR_NET_PEER_NAME=xe.ATTR_DB_USER=xe.ATTR_DB_SYSTEM=xe.ATTR_DB_STATEMENT=xe.ATTR_DB_NAME=xe.ATTR_DB_CONNECTION_STRING=xe.ATTR_DB_CLIENT_CONNECTION_STATE=xe.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;xe.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";xe.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";xe.ATTR_DB_CONNECTION_STRING="db.connection_string";xe.ATTR_DB_NAME="db.name";xe.ATTR_DB_STATEMENT="db.statement";xe.ATTR_DB_SYSTEM="db.system";xe.ATTR_DB_USER="db.user";xe.ATTR_NET_PEER_NAME="net.peer.name";xe.ATTR_NET_PEER_PORT="net.peer.port";xe.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";xe.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";xe.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";xe.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";xe.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var EP=A(E_=>{"use strict";p();u();l();Object.defineProperty(E_,"__esModule",{value:!0});E_.SpanNames=void 0;var $xe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})($xe=E_.SpanNames||(E_.SpanNames={}))});var E6=A(Ce=>{"use strict";p();u();l();Object.defineProperty(Ce,"__esModule",{value:!0});Ce.sanitizedErrorMessage=Ce.isObjectWithTextString=Ce.getErrorMessage=Ce.patchClientConnectCallback=Ce.patchCallbackPGPool=Ce.updateCounter=Ce.getPoolName=Ce.patchCallback=Ce.handleExecutionResult=Ce.handleConfigQuery=Ce.shouldSkipInstrumentation=Ce.getSemanticAttributesFromPoolConnection=Ce.getSemanticAttributesFromConnection=Ce.getConnectionString=Ce.parseAndMaskConnectionString=Ce.parseNormalizedOperationName=Ce.getQuerySpanName=void 0;var la=(D(),v(j)),DS=mP(),oo=(Re(),v(ke)),ft=hP(),Vc=pe(),p6=EP();function d6(t,e){if(!e)return p6.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:f6(e.text);return`${p6.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}Ce.getQuerySpanName=d6;function f6(t){let e=t.trim(),n=e.indexOf(" "),r=n===-1?e:e.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}Ce.parseNormalizedOperationName=f6;function _6(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}Ce.parseAndMaskConnectionString=_6;function gP(t){if("connectionString"in t&&t.connectionString)return _6(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}Ce.getConnectionString=gP;function wS(t){if(Number.isInteger(t))return t}function m6(t,e){let n={};return e&Vc.SemconvStability.OLD&&(n={...n,[ft.ATTR_DB_SYSTEM]:ft.DB_SYSTEM_VALUE_POSTGRESQL,[ft.ATTR_DB_NAME]:t.database,[ft.ATTR_DB_CONNECTION_STRING]:gP(t),[ft.ATTR_DB_USER]:t.user,[ft.ATTR_NET_PEER_NAME]:t.host,[ft.ATTR_NET_PEER_PORT]:wS(t.port)}),e&Vc.SemconvStability.STABLE&&(n={...n,[oo.ATTR_DB_SYSTEM_NAME]:oo.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[oo.ATTR_DB_NAMESPACE]:t.namespace,[oo.ATTR_SERVER_ADDRESS]:t.host,[oo.ATTR_SERVER_PORT]:wS(t.port)}),n}Ce.getSemanticAttributesFromConnection=m6;function Vxe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[DS.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[DS.AttributeNames.MAX_CLIENT]:t.maxClient};return e&Vc.SemconvStability.OLD&&(r={...r,[ft.ATTR_DB_SYSTEM]:ft.DB_SYSTEM_VALUE_POSTGRESQL,[ft.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[ft.ATTR_DB_CONNECTION_STRING]:gP(t),[ft.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[ft.ATTR_NET_PEER_PORT]:Number(n?.port)||wS(t.port),[ft.ATTR_DB_USER]:n?.username??t.user}),e&Vc.SemconvStability.STABLE&&(r={...r,[oo.ATTR_DB_SYSTEM_NAME]:oo.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[oo.ATTR_DB_NAMESPACE]:t.namespace,[oo.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[oo.ATTR_SERVER_PORT]:Number(n?.port)||wS(t.port)}),r}Ce.getSemanticAttributesFromPoolConnection=Vxe;function qxe(t){return t.requireParentSpan===!0&&la.trace.getSpan(la.context.active())===void 0}Ce.shouldSkipInstrumentation=qxe;function Yxe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=d6(s,r),a=t.startSpan(i,{kind:la.SpanKind.CLIENT,attributes:m6(o,n)});if(!r)return a;if(r.text&&(n&Vc.SemconvStability.OLD&&a.setAttribute(ft.ATTR_DB_STATEMENT,r.text),n&Vc.SemconvStability.STABLE&&a.setAttribute(oo.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(d=>d==null?"null":d instanceof Buffer?d.toString():typeof d=="object"?typeof d.toPostgres=="function"?d.toPostgres():JSON.stringify(d):d.toString());a.setAttribute(DS.AttributeNames.PG_VALUES,c)}catch(c){la.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(DS.AttributeNames.PG_PLAN,r.name),a}Ce.handleConfigQuery=Yxe;function h6(t,e,n){typeof t.responseHook=="function"&&(0,Vc.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&la.diag.error("Error running response hook",r)},!0)}Ce.handleExecutionResult=h6;function Wxe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[oo.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(US(i)),e.setStatus({code:la.SpanStatusCode.ERROR,message:i.message})):h6(t,e,a),o(),e.end(),n.call(this,i,a)}}Ce.patchCallback=Wxe;function Kxe(t){let e="";return e+=(t?.host?`${t.host}`:"unknown_host")+":",e+=(t?.port?`${t.port}`:"unknown_port")+"/",e+=t?.database?`${t.database}`:"unknown_database",e.trim()}Ce.getPoolName=Kxe;function zxe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[ft.ATTR_DB_CLIENT_CONNECTION_STATE]:ft.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[ft.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[ft.ATTR_DB_CLIENT_CONNECTION_STATE]:ft.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[ft.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[ft.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}Ce.updateCounter=zxe;function Xxe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(US(r)),t.setStatus({code:la.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}Ce.patchCallbackPGPool=Xxe;function Qxe(t,e){return function(r){r&&(r instanceof Error&&t.recordException(US(r)),t.setStatus({code:la.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}Ce.patchClientConnectCallback=Qxe;function Jxe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}Ce.getErrorMessage=Jxe;function Zxe(t){return typeof t=="object"&&typeof t?.text=="string"}Ce.isObjectWithTextString=Zxe;function US(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}Ce.sanitizedErrorMessage=US});var g6=A(op=>{"use strict";p();u();l();Object.defineProperty(op,"__esModule",{value:!0});op.PACKAGE_NAME=op.PACKAGE_VERSION=void 0;op.PACKAGE_VERSION="0.62.0";op.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var I6=A(BS=>{"use strict";p();u();l();Object.defineProperty(BS,"__esModule",{value:!0});BS.PgInstrumentation=void 0;var Fn=pe(),Ge=(D(),v(j)),T6=l6(),st=E6(),S6=tP(),A6=g6(),R6=EP(),kS=De(),xo=(Re(),v(ke)),g_=hP();function sp(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var TP=class extends Fn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(A6.PACKAGE_NAME,A6.PACKAGE_VERSION,e),this._semconvStability=(0,Fn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(xo.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ge.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(g_.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"}),this._connectionPendingRequests=this.meter.createUpDownCounter(g_.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:"The number of current pending requests for an open connection.",unit:"{connection}"})}init(){let e=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new Fn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new Fn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new Fn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=sp(a);return this._patchPgClient(c.Client),a},a=>{let c=sp(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new Fn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=sp(a);return(0,Fn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=sp(a);(0,Fn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=sp(e);return(0,Fn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Fn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),e}_unpatchPgClient(e){let n=sp(e);return(0,Fn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Fn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(st.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(R6.SpanNames.CONNECT,{kind:Ge.SpanKind.CLIENT,attributes:st.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ge.trace.getSpan(Ge.context.active());o=st.patchClientConnectCallback(i,o),c&&(o=Ge.context.bind(Ge.context.active(),o))}let a=Ge.context.with(Ge.trace.setSpan(Ge.context.active(),i),()=>n.call(this,o));return y6(i,a)}}recordOperationDuration(e,n){let r={},o=[xo.ATTR_DB_NAMESPACE,xo.ATTR_ERROR_TYPE,xo.ATTR_SERVER_PORT,xo.ATTR_SERVER_ADDRESS,xo.ATTR_DB_OPERATION_NAME];this._semconvStability&Fn.SemconvStability.OLD&&o.push(g_.ATTR_DB_SYSTEM),this._semconvStability&Fn.SemconvStability.STABLE&&o.push(xo.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,kS.hrTimeToMilliseconds)((0,kS.hrTimeDuration)(n,(0,kS.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(st.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,kS.hrTime)(),i=o[0],a=typeof i=="string",c=st.isObjectWithTextString(i),d=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(o[1])?o[1]:void 0)}:void 0,f={[g_.ATTR_DB_SYSTEM]:g_.DB_SYSTEM_VALUE_POSTGRESQL,[xo.ATTR_DB_NAMESPACE]:this.database,[xo.ATTR_SERVER_PORT]:this.connectionParameters.port,[xo.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};d?.text&&(f[xo.ATTR_DB_OPERATION_NAME]=st.parseNormalizedOperationName(d?.text));let _=()=>{e.recordOperationDuration(f,s)},m=e.getConfig(),E=st.handleConfigQuery.call(this,e.tracer,m,e._semconvStability,d);if(m.addSqlCommenterCommentToQueries&&(a?o[0]=(0,S6.addSqlCommenterComment)(E,i):c&&!("name"in i)&&(o[0]={...i,text:(0,S6.addSqlCommenterComment)(E,i.text)})),o.length>0){let R=Ge.trace.getSpan(Ge.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=st.patchCallback(m,E,o[o.length-1],f,_),R&&(o[o.length-1]=Ge.context.bind(Ge.context.active(),o[o.length-1]));else if(typeof d?.callback=="function"){let N=st.patchCallback(e.getConfig(),E,d.callback,f,_);R&&(N=Ge.context.bind(Ge.context.active(),N)),o[0].callback=N}}let{requestHook:T}=m;typeof T=="function"&&d&&(0,Fn.safeExecuteInTheMiddle)(()=>{let{database:R,host:N,port:y,user:P}=this.connectionParameters;T(E,{connection:{database:R,host:N,port:y,user:P},query:{text:d.text,values:d.values,name:d.name}})},R=>{R&&e._diag.error("Error running query hook",R)},!0);let S;try{S=n.apply(this,o)}catch(R){throw R instanceof Error&&E.recordException(st.sanitizedErrorMessage(R)),E.setStatus({code:Ge.SpanStatusCode.ERROR,message:st.getErrorMessage(R)}),E.end(),R}return S instanceof Promise?S.then(R=>new Promise(N=>{st.handleExecutionResult(e.getConfig(),E,R),_(),E.end(),N(R)})).catch(R=>new Promise((N,y)=>{R instanceof Error&&E.recordException(st.sanitizedErrorMessage(R)),E.setStatus({code:Ge.SpanStatusCode.ERROR,message:R.message}),_(),E.end(),y(R)})):S})}_setPoolConnectEventListeners(e){if(e[T6.EVENT_LISTENERS_SET])return;let n=st.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=st.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[T6.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(st.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(R6.SpanNames.POOL_CONNECT,{kind:Ge.SpanKind.CLIENT,attributes:st.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ge.trace.getSpan(Ge.context.active());o=st.patchCallbackPGPool(i,o),c&&(o=Ge.context.bind(Ge.context.active(),o))}let a=Ge.context.with(Ge.trace.setSpan(Ge.context.active(),i),()=>n.call(this,o));return y6(i,a)}}};BS.PgInstrumentation=TP;function y6(t,e){if(!(e instanceof Promise))return e;let n=e;return Ge.context.bind(Ge.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(st.sanitizedErrorMessage(r)),t.setStatus({code:Ge.SpanStatusCode.ERROR,message:st.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var N6=A(ip=>{"use strict";p();u();l();Object.defineProperty(ip,"__esModule",{value:!0});ip.AttributeNames=ip.PgInstrumentation=void 0;var eLe=I6();Object.defineProperty(ip,"PgInstrumentation",{enumerable:!0,get:function(){return eLe.PgInstrumentation}});var tLe=mP();Object.defineProperty(ip,"AttributeNames",{enumerable:!0,get:function(){return tLe.AttributeNames}})});var D6=A(T_=>{"use strict";p();u();l();Object.defineProperty(T_,"__esModule",{value:!0});T_.SeverityNumber=void 0;var sLe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(sLe=T_.SeverityNumber||(T_.SeverityNumber={}))});var FS=A(ap=>{"use strict";p();u();l();Object.defineProperty(ap,"__esModule",{value:!0});ap.NOOP_LOGGER=ap.NoopLogger=void 0;var HS=class{emit(e){}};ap.NoopLogger=HS;ap.NOOP_LOGGER=new HS});var VS=A(cp=>{"use strict";p();u();l();Object.defineProperty(cp,"__esModule",{value:!0});cp.NOOP_LOGGER_PROVIDER=cp.NoopLoggerProvider=void 0;var iLe=FS(),$S=class{getLogger(e,n,r){return new iLe.NoopLogger}};cp.NoopLoggerProvider=$S;cp.NOOP_LOGGER_PROVIDER=new $S});var yP=A(qS=>{"use strict";p();u();l();Object.defineProperty(qS,"__esModule",{value:!0});qS.ProxyLogger=void 0;var aLe=FS(),RP=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(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):aLe.NOOP_LOGGER}};qS.ProxyLogger=RP});var NP=A(YS=>{"use strict";p();u();l();Object.defineProperty(YS,"__esModule",{value:!0});YS.ProxyLoggerProvider=void 0;var cLe=VS(),uLe=yP(),IP=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new uLe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:cLe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};YS.ProxyLoggerProvider=IP});var w6=A(WS=>{"use strict";p();u();l();Object.defineProperty(WS,"__esModule",{value:!0});WS._globalThis=void 0;WS._globalThis=typeof globalThis=="object"?globalThis:global});var U6=A(KS=>{"use strict";p();u();l();Object.defineProperty(KS,"__esModule",{value:!0});KS._globalThis=void 0;var lLe=w6();Object.defineProperty(KS,"_globalThis",{enumerable:!0,get:function(){return lLe._globalThis}})});var k6=A(zS=>{"use strict";p();u();l();Object.defineProperty(zS,"__esModule",{value:!0});zS._globalThis=void 0;var pLe=U6();Object.defineProperty(zS,"_globalThis",{enumerable:!0,get:function(){return pLe._globalThis}})});var B6=A(ps=>{"use strict";p();u();l();Object.defineProperty(ps,"__esModule",{value:!0});ps.API_BACKWARDS_COMPATIBILITY_VERSION=ps.makeGetter=ps._global=ps.GLOBAL_LOGS_API_KEY=void 0;var dLe=k6();ps.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");ps._global=dLe._globalThis;function fLe(t,e,n){return r=>r===t?e:n}ps.makeGetter=fLe;ps.API_BACKWARDS_COMPATIBILITY_VERSION=1});var j6=A(XS=>{"use strict";p();u();l();Object.defineProperty(XS,"__esModule",{value:!0});XS.LogsAPI=void 0;var so=B6(),_Le=VS(),G6=NP(),OP=class t{constructor(){this._proxyLoggerProvider=new G6.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return so._global[so.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(so._global[so.GLOBAL_LOGS_API_KEY]=(0,so.makeGetter)(so.API_BACKWARDS_COMPATIBILITY_VERSION,e,_Le.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=so._global[so.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(so._global,so.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete so._global[so.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new G6.ProxyLoggerProvider}};XS.LogsAPI=OP});var bP=A(Xt=>{"use strict";p();u();l();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.logs=Xt.ProxyLoggerProvider=Xt.ProxyLogger=Xt.NoopLoggerProvider=Xt.NOOP_LOGGER_PROVIDER=Xt.NoopLogger=Xt.NOOP_LOGGER=Xt.SeverityNumber=void 0;var mLe=D6();Object.defineProperty(Xt,"SeverityNumber",{enumerable:!0,get:function(){return mLe.SeverityNumber}});var H6=FS();Object.defineProperty(Xt,"NOOP_LOGGER",{enumerable:!0,get:function(){return H6.NOOP_LOGGER}});Object.defineProperty(Xt,"NoopLogger",{enumerable:!0,get:function(){return H6.NoopLogger}});var F6=VS();Object.defineProperty(Xt,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return F6.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Xt,"NoopLoggerProvider",{enumerable:!0,get:function(){return F6.NoopLoggerProvider}});var hLe=yP();Object.defineProperty(Xt,"ProxyLogger",{enumerable:!0,get:function(){return hLe.ProxyLogger}});var ELe=NP();Object.defineProperty(Xt,"ProxyLoggerProvider",{enumerable:!0,get:function(){return ELe.ProxyLoggerProvider}});var gLe=j6();Xt.logs=gLe.LogsAPI.getInstance()});var $6=A(up=>{"use strict";p();u();l();Object.defineProperty(up,"__esModule",{value:!0});up.disableInstrumentations=up.enableInstrumentations=void 0;function TLe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}up.enableInstrumentations=TLe;function SLe(t){t.forEach(e=>e.disable())}up.disableInstrumentations=SLe});var Y6=A(QS=>{"use strict";p();u();l();Object.defineProperty(QS,"__esModule",{value:!0});QS.registerInstrumentations=void 0;var V6=(D(),v(j)),ALe=bP(),q6=$6();function RLe(t){let e=t.tracerProvider||V6.trace.getTracerProvider(),n=t.meterProvider||V6.metrics.getMeterProvider(),r=t.loggerProvider||ALe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,q6.enableInstrumentations)(o,e,n,r),()=>{(0,q6.disableInstrumentations)(o)}}QS.registerInstrumentations=RLe});var tX=A(JS=>{"use strict";p();u();l();Object.defineProperty(JS,"__esModule",{value:!0});JS.satisfies=void 0;var vP=(D(),v(j)),Q6=/^(?: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-]+)*))?$/,yLe=/^(?<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-]+)*))?$/,ILe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function NLe(t,e,n){if(!OLe(t))return vP.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=MLe(t);if(!r)return!1;let o=[],s=J6(r,e,o,n);return s&&!n?.includePrerelease?CLe(r,o):s}JS.satisfies=NLe;function OLe(t){return typeof t=="string"&&Q6.test(t)}function J6(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(CP(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=QLe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!CP(t,s,n,r))return!1;return!0}return CP(t,e,n,r)}function CP(t,e,n,r){if(e=PLe(e,r),e.includes(" "))return J6(t,e,n,r);{let o=vLe(e);return n.push(o),bLe(t,o)}}function bLe(t,e){if(e.invalid)return!1;if(!e.version||MP(e.version))return!0;let n=K6(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=K6(r,o)}return ILe[e.op]?.includes(n)}function CLe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function PLe(t,e){return t=t.trim(),t=zLe(t,e),t=KLe(t),t=XLe(t,e),t=t.trim(),t}function $n(t){return!t||t.toLowerCase()==="x"||t==="*"}function MLe(t){let e=t.match(Q6);if(!e){vP.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function vLe(t){if(!t)return{};let e=t.match(yLe);if(!e)return vP.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function MP(t){return t==="*"||t==="x"||t==="X"}function W6(t){let e=parseInt(t,10);return isNaN(e)?t:e}function xLe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function LLe(t,e){if(MP(t)||MP(e))return 0;let[n,r]=xLe(W6(t),W6(e));return n>r?1:n<r?-1:0}function K6(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=LLe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var Z6="[a-zA-Z0-9-]",eX="0|[1-9]\\d*",DLe=`\\d*[a-zA-Z-]${Z6}*`,wLe="((?:<|>)?=?)",z6=`(?:${eX}|${DLe})`,ULe=`(?:-(${z6}(?:\\.${z6})*))`,X6=`${Z6}+`,kLe=`(?:\\+(${X6}(?:\\.${X6})*))`,PP=`${eX}|x|X|\\*`,S_=`[v=\\s]*(${PP})(?:\\.(${PP})(?:\\.(${PP})(?:${ULe})?${kLe}?)?)?`,BLe=`^${wLe}\\s*${S_}$`,GLe=new RegExp(BLe),jLe=`^\\s*(${S_})\\s+-\\s+(${S_})\\s*$`,HLe=new RegExp(jLe),FLe="(?:~>?)",$Le=`^${FLe}${S_}$`,VLe=new RegExp($Le),qLe="(?:\\^)",YLe=`^${qLe}${S_}$`,WLe=new RegExp(YLe);function KLe(t){let e=VLe;return t.replace(e,(n,r,o,s,i)=>{let a;return $n(r)?a="":$n(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:$n(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function zLe(t,e){let n=WLe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let d;return $n(s)?d="":$n(i)?d=`>=${s}.0.0${r} <${+s+1}.0.0-0`:$n(a)?s==="0"?d=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:d=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?d=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:d=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:d=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?d=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:d=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:d=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,d})}function XLe(t,e){let n=GLe;return t.replace(n,(r,o,s,i,a,c)=>{let d=$n(s),f=d||$n(i),_=f||$n(a),m=_;return o==="="&&m&&(o=""),c=e?.includePrerelease?"-0":"",d?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&m?(f&&(i=0),a=0,o===">"?(o=">=",f?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",f?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):f?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:_&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function QLe(t,e){let n=HLe;return t.replace(n,(r,o,s,i,a,c,d,f,_,m,E,T)=>($n(s)?o="":$n(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:$n(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,$n(_)?f="":$n(m)?f=`<${+_+1}.0.0-0`:$n(E)?f=`<${_}.${+m+1}.0-0`:T?f=`<=${_}.${m}.${E}-${T}`:e?.includePrerelease?f=`<${_}.${m}.${+E+1}-0`:f=`<=${f}`,`${o} ${f}`.trim()))}});var xP=A(an=>{"use strict";p();u();l();Object.defineProperty(an,"__esModule",{value:!0});an.massUnwrap=an.unwrap=an.massWrap=an.wrap=void 0;var Vn=console.error.bind(console);function A_(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var JLe=(t,e,n)=>{if(!t||!t[e]){Vn("no original function "+String(e)+" to wrap");return}if(!n){Vn("no wrapper function"),Vn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){Vn("original object and wrapper must be functions");return}let o=n(r,e);return A_(o,"__original",r),A_(o,"__unwrap",()=>{t[e]===o&&A_(t,e,r)}),A_(o,"__wrapped",!0),A_(t,e,o),o};an.wrap=JLe;var ZLe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Vn("must provide one or more modules to patch"),Vn(new Error().stack);return}if(!(e&&Array.isArray(e))){Vn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,an.wrap)(r,o,n)})})};an.massWrap=ZLe;var eDe=(t,e)=>{if(!t||!t[e]){Vn("no function to unwrap."),Vn(new Error().stack);return}let n=t[e];if(!n.__unwrap)Vn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};an.unwrap=eDe;var tDe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Vn("must provide one or more modules to patch"),Vn(new Error().stack);return}if(!(e&&Array.isArray(e))){Vn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,an.unwrap)(n,r)})})};an.massUnwrap=tDe;function R_(t){t&&t.logger&&(typeof t.logger!="function"?Vn("new logger isn't a function, not replacing"):Vn=t.logger)}an.default=R_;R_.wrap=an.wrap;R_.massWrap=an.massWrap;R_.unwrap=an.unwrap;R_.massUnwrap=an.massUnwrap});var nX=A(eA=>{"use strict";p();u();l();Object.defineProperty(eA,"__esModule",{value:!0});eA.InstrumentationAbstract=void 0;var LP=(D(),v(j)),nDe=bP(),ZS=xP(),DP=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=LP.diag.createComponentLogger({namespace:e}),this._tracer=LP.trace.getTracer(e,n),this._meter=LP.metrics.getMeter(e,n),this._logger=nDe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=ZS.wrap;_unwrap=ZS.unwrap;_massWrap=ZS.massWrap;_massUnwrap=ZS.massUnwrap;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,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};eA.InstrumentationAbstract=DP});var rX=A(pa=>{"use strict";p();u();l();Object.defineProperty(pa,"__esModule",{value:!0});pa.ModuleNameTrie=pa.ModuleNameSeparator=void 0;pa.ModuleNameSeparator="/";var tA=class{hooks=[];children=new Map},wP=class{_trie=new tA;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(pa.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new tA,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(pa.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};pa.ModuleNameTrie=wP});var sX=A(nA=>{"use strict";p();u();l();Object.defineProperty(nA,"__esModule",{value:!0});nA.RequireInTheMiddleSingleton=void 0;var rDe=Od(),oX=require("path"),UP=rX(),oDe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),kP=class t{_moduleNameTrie=new UP.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new rDe.Hook(null,{internals:!0},(e,n,r)=>{let o=sDe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return oDe?new t:this._instance=this._instance??new t}};nA.RequireInTheMiddleSingleton=kP;function sDe(t){return oX.sep!==UP.ModuleNameSeparator?t.split(oX.sep).join(UP.ModuleNameSeparator):t}});var BP=A(da=>{"use strict";p();u();l();Object.defineProperty(da,"__esModule",{value:!0});da.isWrapped=da.safeExecuteInTheMiddleAsync=da.safeExecuteInTheMiddle=void 0;function iDe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}da.safeExecuteInTheMiddle=iDe;async function aDe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}da.safeExecuteInTheMiddleAsync=aDe;function cDe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}da.isWrapped=cDe});var cX=A(rA=>{"use strict";p();u();l();Object.defineProperty(rA,"__esModule",{value:!0});rA.InstrumentationBase=void 0;var y_=require("path"),iX=require("util"),uDe=tX(),GP=xP(),lDe=nX(),pDe=sX(),dDe=Yh(),I_=(D(),v(j)),fDe=Od(),_De=require("fs"),mDe=BP(),jP=class extends lDe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=pDe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,mDe.isWrapped)(e[n])&&this._unwrap(e,n),iX.types.isProxy(e)){let o=(0,GP.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,GP.wrap)(e,n,r)};_unwrap=(e,n)=>iX.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,GP.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{I_.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){I_.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{I_.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){I_.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=require.resolve(n);require.cache[r]&&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 n=(0,_De.readFileSync)(y_.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{I_.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return aX(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=y_.normalize(r);return i.filter(d=>d.name===a).filter(d=>aX(d.supportedVersions,s,e.includePrerelease)).reduce((d,f)=>(f.moduleExports=d,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:f.name,baseDir:o}),f.patch(d,e.moduleVersion)):d),n)}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 n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&y_.isAbsolute(a)){let d=y_.parse(a);a=d.name,c=d.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=y_.isAbsolute(e.name)?new fDe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new dDe.Hook([e.name],{internals:!1},n);this._hooks.push(s)}}}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 n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};rA.InstrumentationBase=jP;function aX(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,uDe.satisfies)(e,r,{includePrerelease:n}))}});var uX=A(oA=>{"use strict";p();u();l();Object.defineProperty(oA,"__esModule",{value:!0});oA.normalize=void 0;var hDe=require("path");Object.defineProperty(oA,"normalize",{enumerable:!0,get:function(){return hDe.normalize}})});var lX=A(lp=>{"use strict";p();u();l();Object.defineProperty(lp,"__esModule",{value:!0});lp.normalize=lp.InstrumentationBase=void 0;var EDe=cX();Object.defineProperty(lp,"InstrumentationBase",{enumerable:!0,get:function(){return EDe.InstrumentationBase}});var gDe=uX();Object.defineProperty(lp,"normalize",{enumerable:!0,get:function(){return gDe.normalize}})});var HP=A(pp=>{"use strict";p();u();l();Object.defineProperty(pp,"__esModule",{value:!0});pp.normalize=pp.InstrumentationBase=void 0;var pX=lX();Object.defineProperty(pp,"InstrumentationBase",{enumerable:!0,get:function(){return pX.InstrumentationBase}});Object.defineProperty(pp,"normalize",{enumerable:!0,get:function(){return pX.normalize}})});var dX=A(sA=>{"use strict";p();u();l();Object.defineProperty(sA,"__esModule",{value:!0});sA.InstrumentationNodeModuleDefinition=void 0;var FP=class{name;supportedVersions;patch;unpatch;files;constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};sA.InstrumentationNodeModuleDefinition=FP});var fX=A(iA=>{"use strict";p();u();l();Object.defineProperty(iA,"__esModule",{value:!0});iA.InstrumentationNodeModuleFile=void 0;var TDe=HP(),$P=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,TDe.normalize)(e)}};iA.InstrumentationNodeModuleFile=$P});var _X=A(qc=>{"use strict";p();u();l();Object.defineProperty(qc,"__esModule",{value:!0});qc.semconvStabilityFromStr=qc.SemconvStability=void 0;var aA;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(aA=qc.SemconvStability||(qc.SemconvStability={}));function SDe(t,e){let n=aA.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=aA.DUPLICATE;break}else o.toLowerCase()===t&&(n=aA.STABLE);return n}qc.semconvStabilityFromStr=SDe});var hX=A(Dt=>{"use strict";p();u();l();Object.defineProperty(Dt,"__esModule",{value:!0});Dt.semconvStabilityFromStr=Dt.SemconvStability=Dt.safeExecuteInTheMiddleAsync=Dt.safeExecuteInTheMiddle=Dt.isWrapped=Dt.InstrumentationNodeModuleFile=Dt.InstrumentationNodeModuleDefinition=Dt.InstrumentationBase=Dt.registerInstrumentations=void 0;var ADe=Y6();Object.defineProperty(Dt,"registerInstrumentations",{enumerable:!0,get:function(){return ADe.registerInstrumentations}});var RDe=HP();Object.defineProperty(Dt,"InstrumentationBase",{enumerable:!0,get:function(){return RDe.InstrumentationBase}});var yDe=dX();Object.defineProperty(Dt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return yDe.InstrumentationNodeModuleDefinition}});var IDe=fX();Object.defineProperty(Dt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return IDe.InstrumentationNodeModuleFile}});var VP=BP();Object.defineProperty(Dt,"isWrapped",{enumerable:!0,get:function(){return VP.isWrapped}});Object.defineProperty(Dt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return VP.safeExecuteInTheMiddle}});Object.defineProperty(Dt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return VP.safeExecuteInTheMiddleAsync}});var mX=_X();Object.defineProperty(Dt,"SemconvStability",{enumerable:!0,get:function(){return mX.SemconvStability}});Object.defineProperty(Dt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return mX.semconvStabilityFromStr}})});var OX=A(fp=>{"use strict";p();u();l();Object.defineProperty(fp,"__esModule",{value:!0});fp.PACKAGE_NAME=fp.PACKAGE_VERSION=void 0;fp.PACKAGE_VERSION="0.56.0";fp.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var KP=A(ds=>{"use strict";p();u();l();Object.defineProperty(ds,"__esModule",{value:!0});ds.HapiLifecycleMethodNames=ds.HapiLayerType=ds.handlerPatched=ds.HapiComponentName=void 0;ds.HapiComponentName="@hapi/hapi";ds.handlerPatched=Symbol("hapi-handler-patched");ds.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};ds.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var bX=A(uA=>{"use strict";p();u();l();Object.defineProperty(uA,"__esModule",{value:!0});uA.ATTR_HTTP_METHOD=void 0;uA.ATTR_HTTP_METHOD="http.method"});var zP=A(N_=>{"use strict";p();u();l();Object.defineProperty(N_,"__esModule",{value:!0});N_.AttributeNames=void 0;var jDe;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(jDe=N_.AttributeNames||(N_.AttributeNames={}))});var MX=A(wt=>{"use strict";p();u();l();Object.defineProperty(wt,"__esModule",{value:!0});wt.getPluginFromInput=wt.getExtMetadata=wt.getRouteMetadata=wt.isPatchableExtMethod=wt.isDirectExtInput=wt.isLifecycleExtEventObj=wt.isLifecycleExtType=wt.getPluginName=void 0;var CX=(Re(),v(ke)),HDe=bX(),O_=KP(),fa=zP(),PX=pe();function FDe(t){return t.name?t.name:t.pkg.name}wt.getPluginName=FDe;var $De=t=>typeof t=="string"&&O_.HapiLifecycleMethodNames.has(t);wt.isLifecycleExtType=$De;var VDe=t=>{let e=t?.type;return e!==void 0&&(0,wt.isLifecycleExtType)(e)};wt.isLifecycleExtEventObj=VDe;var qDe=t=>Array.isArray(t)&&t.length<=3&&(0,wt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";wt.isDirectExtInput=qDe;var YDe=t=>!Array.isArray(t);wt.isPatchableExtMethod=YDe;var WDe=(t,e,n)=>{let r={[CX.ATTR_HTTP_ROUTE]:t.path};e&PX.SemconvStability.OLD&&(r[HDe.ATTR_HTTP_METHOD]=t.method),e&PX.SemconvStability.STABLE&&(r[CX.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[fa.AttributeNames.HAPI_TYPE]=O_.HapiLayerType.PLUGIN,r[fa.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[fa.AttributeNames.HAPI_TYPE]=O_.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};wt.getRouteMetadata=WDe;var KDe=(t,e)=>e?{attributes:{[fa.AttributeNames.EXT_TYPE]:t,[fa.AttributeNames.HAPI_TYPE]:O_.HapiLayerType.EXT,[fa.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ext - ${t}`}:{attributes:{[fa.AttributeNames.EXT_TYPE]:t,[fa.AttributeNames.HAPI_TYPE]:O_.HapiLayerType.EXT},name:`ext - ${t}`};wt.getExtMetadata=KDe;var zDe=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;wt.getPluginFromInput=zDe});var LX=A(lA=>{"use strict";p();u();l();Object.defineProperty(lA,"__esModule",{value:!0});lA.HapiInstrumentation=void 0;var Ir=(D(),v(j)),vX=De(),b_=pe(),xX=OX(),C_=KP(),zs=MX(),XP=class extends b_.InstrumentationBase{_semconvStability;constructor(e={}){super(xX.PACKAGE_NAME,xX.PACKAGE_VERSION,e),this._semconvStability=(0,b_.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new b_.InstrumentationNodeModuleDefinition(C_.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,b_.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,b_.isWrapped)(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._massUnwrap([n],["server","Server"])})}_getServerPatch(e){let n=this,r=this;return function(s){let i=e.apply(this,[s]);return r._wrap(i,"route",a=>n._getServerRoutePatch.bind(n)(a)),r._wrap(i,"ext",a=>n._getServerExtPatch.bind(n)(a)),r._wrap(i,"register",n._getServerRegisterPatch.bind(n)),i}}_getServerRegisterPatch(e){let n=this;return function(o,s){if(Array.isArray(o))for(let i of o){let a=(0,zs.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,zs.getPluginFromInput)(o);n._wrapRegisterHandler(i)}return e.apply(this,[o,s])}}_getServerExtPatch(e,n){let r=this;return function(...s){if(Array.isArray(s[0])){let i=s[0];for(let a=0;a<i.length;a++){let c=i[a];if((0,zs.isLifecycleExtType)(c.type)){let d=c,f=r._wrapExtMethods(d.method,c.type,n);d.method=f,i[a]=d}}return e.apply(this,s)}else if((0,zs.isDirectExtInput)(s)){let i=s,a=i[1],c=r._wrapExtMethods(a,i[0],n);return e.apply(this,[i[0],c,i[2]])}else if((0,zs.isLifecycleExtEventObj)(s[0])){let i=s[0],a=r._wrapExtMethods(i.method,i.type,n);return i.method=a,e.call(this,i)}return e.apply(this,s)}}_getServerRoutePatch(e,n){let r=this;return function(o){if(Array.isArray(o))for(let s=0;s<o.length;s++){let i=r._wrapRouteHandler.call(r,o[s],n);o[s]=i}else o=r._wrapRouteHandler.call(r,o,n);return e.apply(this,[o])}}_wrapRegisterHandler(e){let n=this,r=(0,zs.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",d=>n._getServerRoutePatch.bind(n)(d,r)),s._wrap(a,"ext",d=>n._getServerExtPatch.bind(n)(d,r)),o.call(this,a,c)};e.register=i}_wrapExtMethods(e,n,r){let o=this;if(e instanceof Array){for(let s=0;s<e.length;s++)e[s]=o._wrapExtMethods(e[s],n);return e}else if((0,zs.isPatchableExtMethod)(e))return e[C_.handlerPatched]===!0?e:(e[C_.handlerPatched]=!0,async function(...i){if(Ir.trace.getSpan(Ir.context.active())===void 0)return await e.apply(this,i);let a=(0,zs.getExtMetadata)(n,r),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await Ir.context.with(Ir.trace.setSpan(Ir.context.active(),c),e,void 0,...i)}catch(d){throw c.recordException(d),c.setStatus({code:Ir.SpanStatusCode.ERROR,message:d.message}),d}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[C_.handlerPatched]===!0)return e;e[C_.handlerPatched]=!0;let o=s=>async function(...i){if(Ir.trace.getSpan(Ir.context.active())===void 0)return await s.call(this,...i);let a=(0,vX.getRPCMetadata)(Ir.context.active());a?.type===vX.RPCType.HTTP&&(a.route=e.path);let c=(0,zs.getRouteMetadata)(e,r._semconvStability,n),d=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await Ir.context.with(Ir.trace.setSpan(Ir.context.active(),d),()=>s.call(this,...i))}catch(f){throw d.recordException(f),d.setStatus({code:Ir.SpanStatusCode.ERROR,message:f.message}),f}finally{d.end()}};if(typeof e.handler=="function")e.handler=o(e.handler);else if(typeof e.options=="function"){let s=e.options;e.options=function(i){let a=s(i);return typeof a.handler=="function"&&(a.handler=o(a.handler)),a}}else typeof e.options?.handler=="function"&&(e.options.handler=o(e.options.handler));return e}};lA.HapiInstrumentation=XP});var DX=A(_p=>{"use strict";p();u();l();Object.defineProperty(_p,"__esModule",{value:!0});_p.AttributeNames=_p.HapiInstrumentation=void 0;var XDe=LX();Object.defineProperty(_p,"HapiInstrumentation",{enumerable:!0,get:function(){return XDe.HapiInstrumentation}});var QDe=zP();Object.defineProperty(_p,"AttributeNames",{enumerable:!0,get:function(){return QDe.AttributeNames}})});var fA=A(M_=>{"use strict";p();u();l();Object.defineProperty(M_,"__esModule",{value:!0});M_.KoaLayerType=void 0;var r0e;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(r0e=M_.KoaLayerType||(M_.KoaLayerType={}))});var FX=A(mp=>{"use strict";p();u();l();Object.defineProperty(mp,"__esModule",{value:!0});mp.PACKAGE_NAME=mp.PACKAGE_VERSION=void 0;mp.PACKAGE_VERSION="0.58.0";mp.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var QP=A(v_=>{"use strict";p();u();l();Object.defineProperty(v_,"__esModule",{value:!0});v_.AttributeNames=void 0;var o0e;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(o0e=v_.AttributeNames||(v_.AttributeNames={}))});var VX=A(hp=>{"use strict";p();u();l();Object.defineProperty(hp,"__esModule",{value:!0});hp.isLayerIgnored=hp.getMiddlewareMetadata=void 0;var $X=fA(),_A=QP(),s0e=(Re(),v(ke)),i0e=(t,e,n,r)=>n?{attributes:{[_A.AttributeNames.KOA_NAME]:r?.toString(),[_A.AttributeNames.KOA_TYPE]:$X.KoaLayerType.ROUTER,[s0e.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[_A.AttributeNames.KOA_NAME]:e.name??"middleware",[_A.AttributeNames.KOA_TYPE]:$X.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};hp.getMiddlewareMetadata=i0e;var a0e=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));hp.isLayerIgnored=a0e});var qX=A(mA=>{"use strict";p();u();l();Object.defineProperty(mA,"__esModule",{value:!0});mA.kLayerPatched=void 0;mA.kLayerPatched=Symbol("koa-layer-patched")});var QX=A(hA=>{"use strict";p();u();l();Object.defineProperty(hA,"__esModule",{value:!0});hA.KoaInstrumentation=void 0;var fs=(D(),v(j)),x_=pe(),YX=fA(),WX=FX(),KX=VX(),zX=De(),XX=qX(),JP=class extends x_.InstrumentationBase{constructor(e={}){super(WX.PACKAGE_NAME,WX.PACKAGE_VERSION,e)}init(){return new x_.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,x_.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),e)},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;(0,x_.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(e){let n=this;return function(o){let s;return o.router?s=n._patchRouterDispatch(o):s=n._patchLayer(o,!1),e.apply(this,[s])}}_patchRouterDispatch(e){fs.diag.debug("Patching @koa/router dispatch");let r=e.router?.stack??[];for(let o of r){let s=o.path,i=o.stack;for(let a=0;a<i.length;a++){let c=i[a];i[a]=this._patchLayer(c,!0,s)}}return e}_patchLayer(e,n,r){let o=n?YX.KoaLayerType.ROUTER:YX.KoaLayerType.MIDDLEWARE;return e[XX.kLayerPatched]===!0||(0,KX.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(fs.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[XX.kLayerPatched]=!0,fs.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(fs.trace.getSpan(fs.context.active())===void 0)return e(s,i);let c=(0,KX.getMiddlewareMetadata)(s,e,n,r),d=this.tracer.startSpan(c.name,{attributes:c.attributes}),f=(0,zX.getRPCMetadata)(fs.context.active());f?.type===zX.RPCType.HTTP&&s._matchedRoute&&(f.route=s._matchedRoute.toString());let{requestHook:_}=this.getConfig();_&&(0,x_.safeExecuteInTheMiddle)(()=>_(d,{context:s,middlewareLayer:e,layerType:o}),E=>{E&&fs.diag.error("koa instrumentation: request hook failed",E)},!0);let m=fs.trace.setSpan(fs.context.active(),d);return fs.context.with(m,async()=>{try{return await e(s,i)}catch(E){throw d.recordException(E),E}finally{d.end()}})})}};hA.KoaInstrumentation=JP});var JX=A(ma=>{"use strict";p();u();l();Object.defineProperty(ma,"__esModule",{value:!0});ma.KoaLayerType=ma.AttributeNames=ma.KoaInstrumentation=void 0;var c0e=QX();Object.defineProperty(ma,"KoaInstrumentation",{enumerable:!0,get:function(){return c0e.KoaInstrumentation}});var u0e=QP();Object.defineProperty(ma,"AttributeNames",{enumerable:!0,get:function(){return u0e.AttributeNames}});var l0e=fA();Object.defineProperty(ma,"KoaLayerType",{enumerable:!0,get:function(){return l0e.KoaLayerType}})});var ZP=A(Lo=>{"use strict";p();u();l();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.ConnectNames=Lo.ConnectTypes=Lo.AttributeNames=void 0;var d0e;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(d0e=Lo.AttributeNames||(Lo.AttributeNames={}));var f0e;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(f0e=Lo.ConnectTypes||(Lo.ConnectTypes={}));var _0e;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(_0e=Lo.ConnectNames||(Lo.ConnectNames={}))});var rQ=A(Ep=>{"use strict";p();u();l();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.PACKAGE_NAME=Ep.PACKAGE_VERSION=void 0;Ep.PACKAGE_VERSION="0.53.0";Ep.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var oQ=A(EA=>{"use strict";p();u();l();Object.defineProperty(EA,"__esModule",{value:!0});EA._LAYERS_STORE_PROPERTY=void 0;EA._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var sQ=A(Ea=>{"use strict";p();u();l();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.generateRoute=Ea.replaceCurrentStackRoute=Ea.addNewStackLayer=void 0;var m0e=(D(),v(j)),ha=oQ(),h0e=t=>{Array.isArray(t[ha._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ha._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ha._LAYERS_STORE_PROPERTY].push("/");let e=t[ha._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ha._LAYERS_STORE_PROPERTY].length?t[ha._LAYERS_STORE_PROPERTY].pop():m0e.diag.warn("Connect: Trying to pop the stack multiple time")}};Ea.addNewStackLayer=h0e;var E0e=(t,e)=>{e&&t[ha._LAYERS_STORE_PROPERTY].splice(-1,1,e)};Ea.replaceCurrentStackRoute=E0e;var g0e=t=>t[ha._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);Ea.generateRoute=g0e});var cQ=A(ga=>{"use strict";p();u();l();Object.defineProperty(ga,"__esModule",{value:!0});ga.ConnectInstrumentation=ga.ANONYMOUS_NAME=void 0;var T0e=(D(),v(j)),iQ=De(),gp=ZP(),aQ=rQ(),gA=pe(),S0e=(Re(),v(ke)),eM=sQ();ga.ANONYMOUS_NAME="anonymous";var tM=class extends gA.InstrumentationBase{constructor(e={}){super(aQ.PACKAGE_NAME,aQ.PACKAGE_VERSION,e)}init(){return[new gA.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,gA.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,gA.isWrapped)(e.handle)||this._wrap(e,"handle",this._patchHandle.bind(this))}_patchConstructor(e){let n=this;return function(...r){let o=e.apply(this,r);return n._patchApp(o),o}}_patchNext(e,n){return function(o){let s=e.apply(this,[o]);return n(),s}}_startSpan(e,n){let r,o,s;e?(r=gp.ConnectTypes.REQUEST_HANDLER,s=gp.ConnectNames.REQUEST_HANDLER,o=e):(r=gp.ConnectTypes.MIDDLEWARE,s=gp.ConnectNames.MIDDLEWARE,o=n.name||ga.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[S0e.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[gp.AttributeNames.CONNECT_TYPE]:r,[gp.AttributeNames.CONNECT_NAME]:o}};return this.tracer.startSpan(i,a)}_patchMiddleware(e,n){let r=this,o=n.length===4;function s(){if(!r.isEnabled())return n.apply(this,arguments);let[i,a,c]=o?[1,2,3]:[0,1,2],d=arguments[i],f=arguments[a],_=arguments[c];(0,eM.replaceCurrentStackRoute)(d,e);let m=(0,iQ.getRPCMetadata)(T0e.context.active());e&&m?.type===iQ.RPCType.HTTP&&(m.route=(0,eM.generateRoute)(d));let E="";e?E=`request handler - ${e}`:E=`middleware - ${n.name||ga.ANONYMOUS_NAME}`;let T=r._startSpan(e,n);r._diag.debug("start span",E);let S=!1;function R(){S?r._diag.debug(`span ${T.name} - already finished`):(S=!0,r._diag.debug(`finishing span ${T.name}`),T.end()),f.removeListener("close",R)}return f.addListener("close",R),arguments[c]=r._patchNext(_,R),n.apply(this,arguments)}return Object.defineProperty(s,"length",{value:n.length,writable:!1,configurable:!0}),s}_patchUse(e){let n=this;return function(...r){let o=r[r.length-1],s=r[r.length-2]||"";return r[r.length-1]=n._patchMiddleware(s,o),e.apply(this,r)}}_patchHandle(e){let n=this;return function(){let[r,o]=[0,2],s=arguments[r],i=arguments[o],a=(0,eM.addNewStackLayer)(s);return typeof i=="function"&&(arguments[o]=n._patchOut(i,a)),e.apply(this,arguments)}}_patchOut(e,n){return function(...o){return n(),Reflect.apply(e,this,o)}}};ga.ConnectInstrumentation=tM});var lQ=A(io=>{"use strict";p();u();l();Object.defineProperty(io,"__esModule",{value:!0});io.ConnectTypes=io.ConnectNames=io.AttributeNames=io.ANONYMOUS_NAME=io.ConnectInstrumentation=void 0;var uQ=cQ();Object.defineProperty(io,"ConnectInstrumentation",{enumerable:!0,get:function(){return uQ.ConnectInstrumentation}});Object.defineProperty(io,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return uQ.ANONYMOUS_NAME}});var nM=ZP();Object.defineProperty(io,"AttributeNames",{enumerable:!0,get:function(){return nM.AttributeNames}});Object.defineProperty(io,"ConnectNames",{enumerable:!0,get:function(){return nM.ConnectNames}});Object.defineProperty(io,"ConnectTypes",{enumerable:!0,get:function(){return nM.ConnectTypes}})});var mQ=A(Qt=>{"use strict";p();u();l();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.DB_SYSTEM_VALUE_MSSQL=Qt.ATTR_NET_PEER_PORT=Qt.ATTR_NET_PEER_NAME=Qt.ATTR_DB_USER=Qt.ATTR_DB_SYSTEM=Qt.ATTR_DB_STATEMENT=Qt.ATTR_DB_SQL_TABLE=Qt.ATTR_DB_NAME=void 0;Qt.ATTR_DB_NAME="db.name";Qt.ATTR_DB_SQL_TABLE="db.sql.table";Qt.ATTR_DB_STATEMENT="db.statement";Qt.ATTR_DB_SYSTEM="db.system";Qt.ATTR_DB_USER="db.user";Qt.ATTR_NET_PEER_NAME="net.peer.name";Qt.ATTR_NET_PEER_PORT="net.peer.port";Qt.DB_SYSTEM_VALUE_MSSQL="mssql"});var hQ=A(Tp=>{"use strict";p();u();l();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.once=Tp.getSpanName=void 0;function R0e(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}Tp.getSpanName=R0e;var y0e=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};Tp.once=y0e});var EQ=A(Sp=>{"use strict";p();u();l();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.PACKAGE_NAME=Sp.PACKAGE_VERSION=void 0;Sp.PACKAGE_VERSION="0.29.0";Sp.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var RQ=A(Sa=>{"use strict";p();u();l();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.TediousInstrumentation=Sa.INJECTED_CTX=void 0;var Ap=(D(),v(j)),I0e=require("events"),_s=pe(),Yc=(Re(),v(ke)),Ta=mQ(),gQ=hQ(),TQ=EQ(),AQ=Symbol("opentelemetry.instrumentation-tedious.current-database");Sa.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var SQ=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function TA(t){Object.defineProperty(this,AQ,{value:t,writable:!0})}var rM=class t extends _s.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(TQ.PACKAGE_NAME,TQ.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,_s.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,_s.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new _s.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of SQ)(0,_s.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,_s.isWrapped)(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),e},e=>{if(e===void 0)return;let n=e.Connection.prototype;for(let r of SQ)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return TA.call(this,this.config?.options?.database),this.removeListener("databaseChange",TA),this.on("databaseChange",TA),this.once("end",()=>{this.removeListener("databaseChange",TA)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||Ap.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,n,r){return new Promise(o=>{try{let s="set context_info @opentelemetry_traceparent",i=new n.Request(s,c=>{o()});Object.defineProperty(i,Sa.INJECTED_CTX,{value:!0});let a=Buffer.from(r,"utf8");i.addParameter("opentelemetry_traceparent",n.TYPES.VarBinary,a,{length:a.length}),e.execSql(i)}catch{o()}})}_shouldInjectFor(e){return e==="execSql"||e==="execSqlBatch"||e==="callProcedure"||e==="execute"}_patchQuery(e,n){return r=>{let o=this;function s(i){if(i?.[Sa.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof I0e.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,d=()=>c++,f=()=>a++,_=this[AQ],m=(M=>M.sqlTextOrProcedure==="sp_prepare"&&M.parametersByName?.stmt?.value?M.parametersByName.stmt.value:M.sqlTextOrProcedure)(i),E={};o._dbSemconvStability&_s.SemconvStability.OLD&&(E[Ta.ATTR_DB_SYSTEM]=Ta.DB_SYSTEM_VALUE_MSSQL,E[Ta.ATTR_DB_NAME]=_,E[Ta.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,E[Ta.ATTR_DB_STATEMENT]=m,E[Ta.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&_s.SemconvStability.STABLE&&(E[Yc.ATTR_DB_NAMESPACE]=_,E[Yc.ATTR_DB_SYSTEM_NAME]=Yc.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,E[Yc.ATTR_DB_QUERY_TEXT]=m,E[Yc.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&_s.SemconvStability.OLD&&(E[Ta.ATTR_NET_PEER_NAME]=this.config?.server,E[Ta.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&_s.SemconvStability.STABLE&&(E[Yc.ATTR_SERVER_ADDRESS]=this.config?.server,E[Yc.ATTR_SERVER_PORT]=this.config?.options?.port);let T=o.tracer.startSpan((0,gQ.getSpanName)(e,_,m,i.table),{kind:Ap.SpanKind.CLIENT,attributes:E}),S=(0,gQ.once)(M=>{i.removeListener("done",d),i.removeListener("doneInProc",d),i.removeListener("doneProc",f),i.removeListener("error",S),this.removeListener("end",S),T.setAttribute("tedious.procedure_count",a),T.setAttribute("tedious.statement_count",c),M&&T.setStatus({code:Ap.SpanStatusCode.ERROR,message:M.message}),T.end()});i.on("done",d),i.on("doneInProc",d),i.on("doneProc",f),i.once("error",S),this.on("end",S),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(S)):o._diag.error("Expected request.callback to be a function");let R=()=>Ap.context.with(Ap.trace.setSpan(Ap.context.active(),T),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return R();let P=o._buildTraceparent(T);o._injectContextInfo(this,n,P).finally(R)}return Object.defineProperty(s,"length",{value:r.length,writable:!1}),s}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};Sa.TediousInstrumentation=rM});var yQ=A(SA=>{"use strict";p();u();l();Object.defineProperty(SA,"__esModule",{value:!0});SA.TediousInstrumentation=void 0;var N0e=RQ();Object.defineProperty(SA,"TediousInstrumentation",{enumerable:!0,get:function(){return N0e.TediousInstrumentation}})});var CQ=A(Rp=>{"use strict";p();u();l();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.PACKAGE_NAME=Rp.PACKAGE_VERSION=void 0;Rp.PACKAGE_VERSION="0.53.0";Rp.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var MQ=A(AA=>{"use strict";p();u();l();Object.defineProperty(AA,"__esModule",{value:!0});AA.GenericPoolInstrumentation=void 0;var yp=(D(),v(j)),Wc=pe(),PQ=CQ(),oM="generic-pool",sM=class extends Wc.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(PQ.PACKAGE_NAME,PQ.PACKAGE_VERSION,e)}init(){return[new Wc.InstrumentationNodeModuleDefinition(oM,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,Wc.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Wc.InstrumentationNodeModuleDefinition(oM,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,Wc.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Wc.InstrumentationNodeModuleDefinition(oM,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,Wc.isWrapped)(e.Pool)&&this._unwrap(e,"Pool"),this._wrap(e,"Pool",this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let n=this;return function(...o){let s=yp.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return yp.context.with(yp.trace.setSpan(s,i),()=>e.call(this,...o).then(a=>(i.end(),a),a=>{throw i.recordException(a),i.end(),a}))}}_poolWrapper(e){let n=this;return function(){let o=e.apply(this,arguments);return n._wrap(o,"acquire",n._acquireWithCallbacksPatcher.bind(n)),o}}_acquireWithCallbacksPatcher(e){let n=this;return function(o,s){if(n._isDisabled)return e.call(this,o,s);let i=yp.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return yp.context.with(yp.trace.setSpan(i,a),()=>{e.call(this,(c,d)=>{if(a.end(),o)return o(c,d)},s)})}}};AA.GenericPoolInstrumentation=sM});var vQ=A(RA=>{"use strict";p();u();l();Object.defineProperty(RA,"__esModule",{value:!0});RA.GenericPoolInstrumentation=void 0;var C0e=MQ();Object.defineProperty(RA,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return C0e.GenericPoolInstrumentation}})});var iM=A(ms=>{"use strict";p();u();l();Object.defineProperty(ms,"__esModule",{value:!0});ms.ATTR_NET_PEER_PORT=ms.ATTR_NET_PEER_NAME=ms.ATTR_MESSAGING_SYSTEM=ms.ATTR_MESSAGING_OPERATION=void 0;ms.ATTR_MESSAGING_OPERATION="messaging.operation";ms.ATTR_MESSAGING_SYSTEM="messaging.system";ms.ATTR_NET_PEER_NAME="net.peer.name";ms.ATTR_NET_PEER_PORT="net.peer.port"});var aM=A(_t=>{"use strict";p();u();l();Object.defineProperty(_t,"__esModule",{value:!0});_t.ATTR_MESSAGING_CONVERSATION_ID=_t.OLD_ATTR_MESSAGING_MESSAGE_ID=_t.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=_t.ATTR_MESSAGING_URL=_t.ATTR_MESSAGING_PROTOCOL_VERSION=_t.ATTR_MESSAGING_PROTOCOL=_t.MESSAGING_OPERATION_VALUE_PROCESS=_t.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=_t.ATTR_MESSAGING_DESTINATION_KIND=_t.ATTR_MESSAGING_DESTINATION=void 0;_t.ATTR_MESSAGING_DESTINATION="messaging.destination";_t.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";_t.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";_t.MESSAGING_OPERATION_VALUE_PROCESS="process";_t.ATTR_MESSAGING_PROTOCOL="messaging.protocol";_t.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";_t.ATTR_MESSAGING_URL="messaging.url";_t.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";_t.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";_t.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var cM=A(Kc=>{"use strict";p();u();l();Object.defineProperty(Kc,"__esModule",{value:!0});Kc.DEFAULT_CONFIG=Kc.EndOperation=void 0;var M0e;(function(t){t.AutoAck="auto ack",t.Ack="ack",t.AckAll="ackAll",t.Reject="reject",t.Nack="nack",t.NackAll="nackAll",t.ChannelClosed="channel closed",t.ChannelError="channel error",t.InstrumentationTimeout="instrumentation timeout"})(M0e=Kc.EndOperation||(Kc.EndOperation={}));Kc.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var GQ=A(mt=>{"use strict";p();u();l();Object.defineProperty(mt,"__esModule",{value:!0});mt.isConfirmChannelTracing=mt.unmarkConfirmChannelTracing=mt.markConfirmChannelTracing=mt.getConnectionAttributesFromUrl=mt.getConnectionAttributesFromServer=mt.normalizeExchange=mt.CONNECTION_ATTRIBUTES=mt.CHANNEL_CONSUME_TIMEOUT_TIMER=mt.CHANNEL_SPANS_NOT_ENDED=mt.MESSAGE_STORED_SPAN=void 0;var uM=(D(),v(j)),Aa=pe(),yA=(Re(),v(ke)),L_=iM(),IA=aM();mt.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");mt.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");mt.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");mt.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var lM=(0,uM.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),v0e=t=>t!==""?t:"<default>";mt.normalizeExchange=v0e;var x0e=t=>t.replace(/:[^:@/]*@/,":***@"),UQ=(t,e)=>t||(e==="AMQP"?5672:5671),kQ=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},BQ=t=>t||"localhost",hs=(t,e,n,r)=>n?{[e]:n}:(uM.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),L0e=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[L_.ATTR_MESSAGING_SYSTEM]:e}:{}};mt.getConnectionAttributesFromServer=L0e;var D0e=(t,e)=>{let n={[IA.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=kQ(r?.protocol);Object.assign(n,{...hs(t,IA.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=BQ(r?.hostname);e&Aa.SemconvStability.OLD&&Object.assign(n,{...hs(t,L_.ATTR_NET_PEER_NAME,s,"hostname")}),e&Aa.SemconvStability.STABLE&&Object.assign(n,{...hs(t,yA.ATTR_SERVER_ADDRESS,s,"hostname")});let i=UQ(r.port,o);e&Aa.SemconvStability.OLD&&Object.assign(n,hs(t,L_.ATTR_NET_PEER_PORT,i,"port")),e&Aa.SemconvStability.STABLE&&Object.assign(n,hs(t,yA.ATTR_SERVER_PORT,i,"port"))}else{let r=x0e(t);n[IA.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=kQ(o.protocol);Object.assign(n,{...hs(r,IA.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=BQ(o.hostname);e&Aa.SemconvStability.OLD&&Object.assign(n,{...hs(r,L_.ATTR_NET_PEER_NAME,i,"hostname")}),e&Aa.SemconvStability.STABLE&&Object.assign(n,{...hs(r,yA.ATTR_SERVER_ADDRESS,i,"hostname")});let a=UQ(o.port?parseInt(o.port):void 0,s);e&Aa.SemconvStability.OLD&&Object.assign(n,hs(r,L_.ATTR_NET_PEER_PORT,a,"port")),e&Aa.SemconvStability.STABLE&&Object.assign(n,hs(r,yA.ATTR_SERVER_PORT,a,"port"))}catch(o){uM.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};mt.getConnectionAttributesFromUrl=D0e;var w0e=t=>t.setValue(lM,!0);mt.markConfirmChannelTracing=w0e;var U0e=t=>t.deleteValue(lM);mt.unmarkConfirmChannelTracing=U0e;var k0e=t=>t.getValue(lM)===!0;mt.isConfirmChannelTracing=k0e});var jQ=A(Ip=>{"use strict";p();u();l();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.PACKAGE_NAME=Ip.PACKAGE_VERSION=void 0;Ip.PACKAGE_VERSION="0.57.0";Ip.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var FQ=A(bA=>{"use strict";p();u();l();Object.defineProperty(bA,"__esModule",{value:!0});bA.AmqplibInstrumentation=void 0;var it=(D(),v(j)),NA=De(),ve=pe(),B0e=iM(),Nr=aM(),qn=cM(),ht=GQ(),HQ=jQ(),OA=[">=0.5.5 <1"],pM=class extends ve.InstrumentationBase{_netSemconvStability;constructor(e={}){super(HQ.PACKAGE_NAME,HQ.PACKAGE_VERSION,{...qn.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ve.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...qn.DEFAULT_CONFIG,...e})}init(){let e=new ve.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",OA,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new ve.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",OA,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new ve.InstrumentationNodeModuleFile("amqplib/lib/connect.js",OA,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new ve.InstrumentationNodeModuleDefinition("amqplib",OA,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,ve.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,ve.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,ve.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,ve.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,ve.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,qn.EndOperation.Ack)),(0,ve.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,qn.EndOperation.Nack)),(0,ve.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,qn.EndOperation.Reject)),(0,ve.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,qn.EndOperation.AckAll)),(0,ve.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,qn.EndOperation.NackAll)),(0,ve.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,ve.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,ve.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,ve.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,ve.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,ve.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,ve.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,ve.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,ve.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,ve.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,ve.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){let n=this;return function(o,s,i){return e.call(this,o,s,function(a,c){if(a==null){let d=(0,ht.getConnectionAttributesFromUrl)(o,n._netSemconvStability),f=(0,ht.getConnectionAttributesFromServer)(c);c[ht.CONNECTION_ATTRIBUTES]={...d,...f}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,qn.EndOperation.ChannelClosed,void 0);let s=this[ht.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[ht.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,qn.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,n,r){let o=this;return function(i){return o.endAllSpansOnChannel(this,e,n,i),r.apply(this,arguments)}}getAckPatch(e,n,r){let o=this;return function(i,a,c){let d=this,f=n===qn.EndOperation.Reject?a:c,_=d[ht.CHANNEL_SPANS_NOT_ENDED]??[],m=_.findIndex(E=>E.msg===i);if(m<0)o.endConsumerSpan(i,e,n,f);else if(n!==qn.EndOperation.Reject&&a){for(let E=0;E<=m;E++)o.endConsumerSpan(_[E].msg,e,n,f);_.splice(0,m+1)}else o.endConsumerSpan(i,e,n,f),_.splice(m,1);return r.apply(this,arguments)}}getConsumePatch(e,n){let r=this;return function(s,i,a){let c=this;if(!Object.prototype.hasOwnProperty.call(c,ht.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:f}=r.getConfig();if(f){let _=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},f);_.unref(),c[ht.CHANNEL_CONSUME_TIMEOUT_TIMER]=_}c[ht.CHANNEL_SPANS_NOT_ENDED]=[]}let d=function(f){if(!f)return i.call(this,f);let _=f.properties.headers??{},m=it.propagation.extract(it.ROOT_CONTEXT,_),E=f.fields?.exchange,T;if(r._config.useLinksForConsume){let y=m?it.trace.getSpan(m)?.spanContext():void 0;m=void 0,y&&(T=[{context:y}])}let S=r.tracer.startSpan(`${s} process`,{kind:it.SpanKind.CONSUMER,attributes:{...c?.connection?.[ht.CONNECTION_ATTRIBUTES],[Nr.ATTR_MESSAGING_DESTINATION]:E,[Nr.ATTR_MESSAGING_DESTINATION_KIND]:Nr.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Nr.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:f.fields?.routingKey,[B0e.ATTR_MESSAGING_OPERATION]:Nr.MESSAGING_OPERATION_VALUE_PROCESS,[Nr.OLD_ATTR_MESSAGING_MESSAGE_ID]:f?.properties.messageId,[Nr.ATTR_MESSAGING_CONVERSATION_ID]:f?.properties.correlationId},links:T},m),{consumeHook:R}=r.getConfig();R&&(0,ve.safeExecuteInTheMiddle)(()=>R(S,{moduleVersion:e,msg:f}),y=>{y&&it.diag.error("amqplib instrumentation: consumerHook error",y)},!0),a?.noAck||(c[ht.CHANNEL_SPANS_NOT_ENDED].push({msg:f,timeOfConsume:(0,NA.hrTime)()}),f[ht.MESSAGE_STORED_SPAN]=S);let N=m||it.ROOT_CONTEXT;it.context.with(it.trace.setSpan(N,S),()=>{i.call(this,f)}),a?.noAck&&(r.callConsumeEndHook(S,f,!1,qn.EndOperation.AutoAck),S.end())};return arguments[1]=d,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,d){let f=this,{span:_,modifiedOptions:m}=r.createPublishSpan(r,s,i,f,c),{publishHook:E}=r.getConfig();E&&(0,ve.safeExecuteInTheMiddle)(()=>E(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:m,isConfirmChannel:!0}),N=>{N&&it.diag.error("amqplib instrumentation: publishHook error",N)},!0);let T=function(N,y){try{d?.call(this,N,y)}finally{let{publishConfirmHook:P}=r.getConfig();P&&(0,ve.safeExecuteInTheMiddle)(()=>P(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:N}),M=>{M&&it.diag.error("amqplib instrumentation: publishConfirmHook error",M)},!0),N&&_.setStatus({code:it.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),_.end()}},S=(0,ht.markConfirmChannelTracing)(it.context.active()),R=[...arguments];return R[3]=m,R[4]=it.context.bind((0,ht.unmarkConfirmChannelTracing)(it.trace.setSpan(S,_)),T),it.context.with(S,n.bind(this,...R))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,ht.isConfirmChannelTracing)(it.context.active()))return n.apply(this,arguments);{let d=this,{span:f,modifiedOptions:_}=r.createPublishSpan(r,s,i,d,c),{publishHook:m}=r.getConfig();m&&(0,ve.safeExecuteInTheMiddle)(()=>m(f,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!1}),S=>{S&&it.diag.error("amqplib instrumentation: publishHook error",S)},!0);let E=[...arguments];E[3]=_;let T=n.apply(this,E);return f.end(),T}}}createPublishSpan(e,n,r,o,s){let i=(0,ht.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:it.SpanKind.PRODUCER,attributes:{...o.connection[ht.CONNECTION_ATTRIBUTES],[Nr.ATTR_MESSAGING_DESTINATION]:n,[Nr.ATTR_MESSAGING_DESTINATION_KIND]:Nr.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Nr.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[Nr.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[Nr.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},it.propagation.inject(it.trace.setSpan(it.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[ht.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:it.SpanStatusCode.ERROR,message:r!==qn.EndOperation.ChannelClosed&&r!==qn.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[ht.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[ht.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[ht.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,ve.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&it.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,NA.hrTime)(),r=e[ht.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,NA.hrTimeDuration)(i.timeOfConsume,n);if((0,NA.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,qn.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};bA.AmqplibInstrumentation=pM});var VQ=A(Ra=>{"use strict";p();u();l();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.EndOperation=Ra.DEFAULT_CONFIG=Ra.AmqplibInstrumentation=void 0;var G0e=FQ();Object.defineProperty(Ra,"AmqplibInstrumentation",{enumerable:!0,get:function(){return G0e.AmqplibInstrumentation}});var $Q=cM();Object.defineProperty(Ra,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return $Q.DEFAULT_CONFIG}});Object.defineProperty(Ra,"EndOperation",{enumerable:!0,get:function(){return $Q.EndOperation}})});var Dwe={};zc(Dwe,{default:()=>Lwe});module.exports=v(Dwe);p();u();l();p();u();l();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="0c2cd224-d4bf-4f29-baef-2ea6972283db",t._sentryDebugIdIdentifier="sentry-dbid-0c2cd224-d4bf-4f29-baef-2ea6972283db")}catch{}})();p();u();l();p();u();l();function lv(t,e){let n=t.env?.[e];return typeof n=="string"&&n!=="0"}var wo={UnknownCommand:-5,InvalidArgument:-4,ContextLoadError:-3,CommandLoadError:-2,InternalError:-1,Success:0,CommandRunError:1};function aR(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function co(t){return Array.from(t).map((e,n)=>{let r=e.toUpperCase(),o=e.toLowerCase();return n===0||r!==e||r===o?e:`-${o}`}).join("")}function vZ(t){let e=new Map;return{get:(...n)=>e.get(n.join(","))??t,set:(n,...r)=>{e.set(r.join(","),n)}}}function xZ(t,e,n){let{threshold:r,weights:o}=n;if(t===e)return 0;let s=Math.abs(t.length-e.length);if(typeof r=="number"&&s>r)return 1/0;let i=vZ(1/0);i.set(0,-1,-1);for(let d=0;d<e.length;++d)i.set((d+1)*o.insertion,-1,d);for(let d=0;d<t.length;++d)i.set((d+1)*o.deletion,d,-1);let a=-1/0;for(let d=0;d<t.length;++d){let f=1/0;for(let _=0;_<=e.length-1;++_){let m=t[d]===e[_]?0:1,E=[i.get(d-1,_)+o.deletion,i.get(d,_-1)+o.insertion,i.get(d-1,_-1)+m*o.substitution];t[d]===e[_-1]&&t[d-1]===e[_]&&E.push(i.get(d-2,_-2)+m*o.transposition);let T=Math.min(...E);i.set(T,d,_),T<f&&(f=T)}if(f>r){if(a>r)return 1/0;a=f}else a=-1/0}let c=i.get(t.length-1,e.length-1);return c>r?1/0:c}function LZ(t,e,n){let r=t[1]-e[1];if(r!==0)return r;let o=t[0].startsWith(n),s=e[0].startsWith(n);return o&&!s?-1:!o&&s?1:t[0].localeCompare(e[0])}function vp(t,e,n){let r=e.map(s=>[s,xZ(t,s,n)]).filter(([,s])=>s<=n.threshold),o=Math.min(...r.map(([,s])=>s));return r.filter(([,s])=>s===o).sort((s,i)=>LZ(s,i,t)).map(([s])=>s)}var Pn=class extends Error{};function V_(t){return t instanceof Error?t.stack??String(t):String(t)}function DZ(t,e){let n=[],r=Math.max(t.length,e.length);for(let o=0;o<r;++o)n[o]=Math.max(t[o],e[o]);return n}function q_(t,e){if(t.length===0)return[];let n=Array(Math.max(...t.map(o=>o.length))).fill(0,0),r=t.reduce((o,s)=>{let i=s.map(a=>a.length);return DZ(o,i)},n);return t.map(o=>{let s=(o[0]??"").padEnd(r[0]);return o.slice(1).reduce((i,a,c,d)=>{let f=d.length===c+1?a:a.padEnd(r[c+1]);return[...i,e?.[c]??" ",f]},[s]).join("").trimEnd()})}function cR(t,e){if(t.length<=1)return t[0]??"";if(t.length===2)return t.join(` ${e.conjunction} `);let n=t.slice(0,t.length-1).join(", ");return e.serialComma&&(n+=","),[n,e.conjunction,t[t.length-1]].join(" ")}function wZ(t,e){return t.reduce((n,r)=>{let o=e(r),s=n[o]??[];return s.push(r),n[o]=s,n},{})}function UZ(t,e){return wZ(t,n=>n[e])}async function nR(t){let e=await Promise.allSettled(t),n=UZ(e,"status");return n.rejected&&n.rejected.length>0?{status:"rejected",reasons:n.rejected.map(r=>r.reason)}:{status:"fulfilled",value:n.fulfilled?.map(r=>r.value)??[]}}var kZ=new Set(["true","t","yes","y","on","1"]),BZ=new Set(["false","f","no","n","off","0"]),GZ=t=>{let e=t.toLowerCase();if(kZ.has(e))return!0;if(BZ.has(e))return!1;throw new SyntaxError(`Cannot convert ${t} to a boolean`)},uo=t=>{let e=Number(t);if(Number.isNaN(e))throw new SyntaxError(`Cannot convert ${t} to a number`);return e},ko=class extends Pn{_brand};function jZ(t,e){let n=t.constructor.name,r=e[n];return r?r(t):t.message}function HZ(t,e,n){return Object.fromEntries(Object.entries(e).map(([r,o])=>{let s=o,i=t[s];if(!i){let a=gs(s,n);throw new Mp(a,[],r)}return[r,[s,i]]}))}var Mp=class extends ko{input;corrections;aliasName;constructor(t,e,n){let r=`No flag registered for --${t}`;if(n)r+=` (aliased from -${n})`;else if(e.length>0){let o=cR(e.map(s=>`--${s}`),{kind:"conjunctive",conjunction:"or",serialComma:!0});r+=`, did you mean ${o}?`}super(r),this.input=t,this.corrections=e,this.aliasName=n}},uR=class extends ko{input;constructor(t){super(`No alias registered for -${t}`),this.input=t}};function rR(t,e){return t.placeholder?t.placeholder:typeof e=="number"?`arg${e}`:"args"}function gs(t,e){return e==="allow-kebab-for-camel"?co(t):t}var iR=class extends ko{externalFlagNameOrPlaceholder;input;exception;constructor(t,e,n){super(`Failed to parse "${e}" for ${t}: ${n instanceof Error?n.message:String(n)}`),this.externalFlagNameOrPlaceholder=t,this.input=e,this.exception=n}};function ba(t,e,n,r){try{return e.parse.call(r,n)}catch(o){throw new iR(t,n,o)}}var oR=class extends ko{externalFlagName;input;values;constructor(t,e,n,r){let o=`Expected "${e}" to be one of (${n.join("|")})`;if(r.length>0){let s=cR(r.map(i=>`"${i}"`),{kind:"conjunctive",conjunction:"or",serialComma:!0});o+=`, did you mean ${s}?`}super(o),this.externalFlagName=t,this.input=e,this.values=n}},Zc=class extends ko{externalFlagName;nextFlagName;constructor(t,e){let n=`Expected input for flag --${t}`;e&&(n+=` but encountered --${e} instead`),super(n),this.externalFlagName=t,this.nextFlagName=e}},rv=class extends ko{expectedCount;input;constructor(t,e){super(`Too many arguments, expected ${t} but encountered "${e}"`),this.expectedCount=t,this.input=e}},ov=class extends ko{placeholder;limit;constructor(t,e){let n;e?(n=`Expected at least ${e[0]} argument(s) for ${t}`,e[1]===0?n+=" but found none":n+=` but only found ${e[1]}`):n=`Expected argument for ${t}`,super(n),this.placeholder=t,this.limit=e}};function sv(t){if(t.startsWith("no")&&t.length>2){if(t[2]==="-")return t.slice(4);let e=t[2],n=e.toUpperCase();return e!==n?void 0:e.toLowerCase()+t.slice(3)}}function pv(t,e,n){let r=t,o=e[r],s,i=!1;if(!o){let c=sv(r);if(c&&(o=e[c],o&&o.kind=="boolean")){if(o.withNegated!==!1)return{namedFlag:[c,o],negated:!0};s=c,o=void 0}}let a=aR(t);if(n.caseStyle==="allow-kebab-for-camel"&&!o){if(o=e[a],o)return{namedFlag:[a,o]};let c=sv(a);if(c&&(o=e[c],o&&o.kind=="boolean")){if(o.withNegated!==!1)return{namedFlag:[c,o],negated:!0};s=c,i=!0,o=void 0}}if(!o){if(s){let f=s;throw i&&t.includes("-")&&(f=co(s)),new Mp(t,[f])}if(a in e)throw new Mp(t,[a]);let c=co(t);if(c in e)throw new Mp(t,[c]);let d=vp(r,Object.keys(e),n.distanceOptions);throw new Mp(t,d)}return{namedFlag:[r,o]}}function iv(t){return t.namedFlag[1].kind==="boolean"||t.namedFlag[1].kind==="counter"}var dv=/^-([a-z]+)$/i,FZ=/^--([a-z][a-z-.\d_]+)$/i;function $Z(t,e,n,r){let o=dv.exec(t);if(o){let i=o[1];return Array.from(i).map(a=>{let c=a,d=n[c];if(!d)throw new uR(c);return{namedFlag:d}})}let s=FZ.exec(t);if(s){let i=s[1];return[pv(i,e,r)]}return[]}var VZ=/^--([a-z][a-z-.\d_]+)=(.+)$/i,qZ=/^-([a-z])=(.+)$/i,YZ=class extends ko{externalFlagName;valueText;constructor(t,e){super(`Cannot negate flag --${t} and pass "${e}" as value`),this.externalFlagName=t,this.valueText=e}};function WZ(t,e,n,r){let o=VZ.exec(t);if(o){let i=o[1],{namedFlag:a,negated:c}=pv(i,e,r),d=o[2];if(c)throw new YZ(i,d);return[a,d]}let s=qZ.exec(t);if(s){let i=s[1],a=n[i];if(!a)throw new uR(i);let c=s[2];return[a,c]}}async function KZ(t,e,n,r,o){if(!n){if("default"in e&&typeof e.default<"u"){if(e.kind==="boolean")return e.default;if(e.kind==="enum"){if("variadic"in e&&e.variadic&&Array.isArray(e.default)){let i=e.default;for(let a of i)if(!e.values.includes(a)){let c=vp(a,e.values,r.distanceOptions);throw new oR(t,a,e.values,c)}return e.default}return e.default}if("variadic"in e&&e.variadic&&Array.isArray(e.default)){let i=e.default;return Promise.all(i.map(a=>ba(t,e,a,o)))}return ba(t,e,e.default,o)}if(e.optional)return;if(e.kind==="boolean")return!1;if(e.kind==="counter")return 0;throw new Zc(t)}if(e.kind==="counter")return n.reduce((i,a)=>{try{return i+uo.call(o,a)}catch(c){throw new iR(t,a,c)}},0);if("variadic"in e&&e.variadic){if(e.kind==="enum"){for(let i of n)if(!e.values.includes(i)){let a=vp(i,e.values,r.distanceOptions);throw new oR(t,i,e.values,a)}return n}return Promise.all(n.map(i=>ba(t,e,i,o)))}let s=n[0];if(e.kind==="boolean")try{return GZ.call(o,s)}catch(i){throw new iR(t,s,i)}if(e.kind==="enum"){if(!e.values.includes(s)){let i=vp(s,e.values,r.distanceOptions);throw new oR(t,s,e.values,i)}return s}return ba(t,e,s,o)}var zZ=class extends ko{externalFlagName;previousInput;input;constructor(t,e,n){super(`Too many arguments for --${t}, encountered "${n}" after "${e}"`),this.externalFlagName=t,this.previousInput=e,this.input=n}};function fv(t){return t.kind==="counter"?!0:"variadic"in t?!!t.variadic:!1}function Es(t,e,[n,r],o){let s=t.get(n)??[];if(s.length>0&&!fv(r)){let i=gs(n,e);throw new zZ(i,s[0],o)}if("variadic"in r&&typeof r.variadic=="string"){let i=o.split(r.variadic);t.set(n,[...s,...i])}else t.set(n,[...s,o])}function sR(t,e,n){if(e.get(n)){let o=t[n];return!fv(o)}return!1}function XZ(t,e){let{flags:n={},aliases:r={},positional:o={kind:"tuple",parameters:[]}}=t,s=HZ(n,r,e.caseStyle),i=[],a=new Map,c=0,d,f=!1;return{next:_=>{if(!f&&e.allowArgumentEscapeSequence&&_==="--"){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Es(a,e.caseStyle,d,""),d=void 0;else{let m=gs(d[0],e.caseStyle);throw new Zc(m)}f=!0;return}if(!f){let m=WZ(_,n,s,e);if(m){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Es(a,e.caseStyle,d,""),d=void 0;else{let T=gs(d[0],e.caseStyle),S=gs(m[0][0],e.caseStyle);throw new Zc(T,S)}Es(a,e.caseStyle,...m);return}let E=$Z(_,n,s,e);if(E.length>0){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Es(a,e.caseStyle,d,""),d=void 0;else{let T=gs(d[0],e.caseStyle),S=gs(E[0].namedFlag[0],e.caseStyle);throw new Zc(T,S)}if(E.every(iv))for(let T of E)T.namedFlag[1].kind==="boolean"?Es(a,e.caseStyle,T.namedFlag,T.negated?"false":"true"):Es(a,e.caseStyle,T.namedFlag,"1");else if(E.length>1){let T=E.find(R=>!iv(R)),S=gs(T.namedFlag[0],e.caseStyle);throw new Zc(S)}else d=E[0].namedFlag;return}}if(d)Es(a,e.caseStyle,d,_),d=void 0;else{if(o.kind==="tuple"){if(c>=o.parameters.length)throw new rv(o.parameters.length,_)}else if(typeof o.maximum=="number"&&c>=o.maximum)throw new rv(o.maximum,_);i[c]=_,++c}},parseArguments:async _=>{let m=[],E;o.kind==="array"?(typeof o.minimum=="number"&&c<o.minimum&&m.push(new ov(rR(o.parameter),[o.minimum,c])),E=nR(i.map(async(y,P)=>{let M=rR(o.parameter,P+1);return ba(M,o.parameter,y,_)}))):E=nR(o.parameters.map(async(y,P)=>{let M=rR(y,P+1),G=i[P];if(typeof G!="string"){if(typeof y.default=="string")return ba(M,y,y.default,_);if(y.optional)return;throw new ov(M)}return ba(M,y,G,_)})),d&&d[1].kind==="parsed"&&d[1].inferEmpty&&(Es(a,e.caseStyle,d,""),d=void 0);let T=nR(Object.entries(n).map(async y=>{let[P,M]=y,G=gs(P,e.caseStyle);if(d&&d[0]===P)throw new Zc(G);let U=a.get(P),Q=await KZ(G,M,U,e,_);return[P,Q]})),[S,R]=await Promise.all([E,T]);if(S.status==="rejected")for(let y of S.reasons)m.push(y);if(R.status==="rejected")for(let y of R.reasons)m.push(y);if(m.length>0)return{success:!1,errors:m};if(S.status==="rejected")throw new Pn("Unknown failure while scanning positional arguments");if(R.status==="rejected")throw new Pn("Unknown failure while scanning flag arguments");return{success:!0,arguments:[Object.fromEntries(R.value),...S.value]}},proposeCompletions:async({partial:_,completionConfig:m,text:E,context:T,includeVersionFlag:S})=>{if(d)return _v(d[1],T,_);let R=[];if(!f){let N=dv.exec(_);if(m.includeAliases){if(_===""||_==="-"){let y=Object.entries(r).filter(P=>!sR(n,a,P[1]));for(let[P]of y){let M=s[P];M&&R.push({kind:"argument:flag",completion:`-${P}`,brief:M[1].brief})}}else if(N){let y=Array.from(N[1]);if(y.includes("h"))return[];if(S&&y.includes("v"))return[];let P=new Map(a);for(let U of y){let Q=s[U];if(!Q)throw new uR(U);Es(P,e.caseStyle,Q,Q[1].kind==="boolean"?"true":"1")}let M=y[y.length-1];if(M){let U=s[M];U&&R.push({kind:"argument:flag",completion:_,brief:U[1].brief})}let G=Object.entries(r).filter(U=>!sR(n,P,U[1]));for(let[U]of G){let Q=s[U];Q&&R.push({kind:"argument:flag",completion:`${_}${U}`,brief:Q[1].brief})}}}if(_===""||_==="-"||_.startsWith("--")){e.allowArgumentEscapeSequence&&R.push({kind:"argument:flag",completion:"--",brief:E.briefs.argumentEscapeSequence});let y=Object.entries(n).filter(([M])=>!sR(n,a,M));e.caseStyle==="allow-kebab-for-camel"&&(y=y.map(([M,G])=>[co(M),G]));let P=y.map(([M,G])=>[`--${M}`,G]).filter(([M])=>M.startsWith(_));R.push(...P.map(([M,G])=>({kind:"argument:flag",completion:M,brief:G.brief})))}}if(o.kind==="array"){if(o.parameter.proposeCompletions&&(typeof o.maximum!="number"||c<o.maximum)){let N=await o.parameter.proposeCompletions.call(T,_);R.push(...N.map(y=>({kind:"argument:value",completion:y,brief:o.parameter.brief})))}}else{let N=o.parameters[c];if(N?.proposeCompletions){let y=await N.proposeCompletions.call(T,_);R.push(...y.map(P=>({kind:"argument:value",completion:P,brief:N.brief})))}}return R.filter(({completion:N})=>N.startsWith(_))}}}async function _v(t,e,n){if(typeof t.variadic=="string"&&n.endsWith(t.variadic))return _v(t,e,"");let r;return t.kind==="enum"?r=t.values:t.proposeCompletions?r=await t.proposeCompletions.call(e,n):r=[],r.map(o=>({kind:"argument:value",completion:o,brief:t.brief})).filter(({completion:o})=>o.startsWith(n))}function QZ(t,e,n){let r=e==="allow-kebab-for-camel"?"convert-camel-to-kebab":e,o=t.getAllEntries();return n.includeHiddenRoutes||(o=o.filter(s=>!s.hidden)),o.flatMap(s=>{let i=s.name[r];return n.includeAliases?[i,...s.aliases]:[i]})}var JZ={headers:{usage:"USAGE",aliases:"ALIASES",commands:"COMMANDS",flags:"FLAGS",arguments:"ARGUMENTS"},keywords:{default:"default =",separator:"separator ="},briefs:{help:"Print help information and exit",helpAll:"Print help information (including hidden commands/flags) and exit",version:"Print version information and exit",argumentEscapeSequence:"All subsequent inputs should be interpreted as arguments"},noCommandRegisteredForInput:({input:t,corrections:e})=>{let n=`No command registered for \`${t}\``;if(e.length>0){let r=cR(e,{kind:"conjunctive",conjunction:"or",serialComma:!0});return`${n}, did you mean ${r}?`}else return n},noTextAvailableForLocale:({requestedLocale:t,defaultLocale:e})=>`Application does not support "${t}" locale, defaulting to "${e}"`,exceptionWhileParsingArguments:t=>t instanceof ko?jZ(t,{}):`Unable to parse arguments, ${V_(t)}`,exceptionWhileLoadingCommandFunction:t=>`Unable to load command function, ${V_(t)}`,exceptionWhileLoadingCommandContext:t=>`Unable to load command context, ${V_(t)}`,exceptionWhileRunningCommand:t=>`Command failed, ${V_(t)}`,commandErrorResult:t=>t.message,currentVersionIsNotLatest:({currentVersion:t,latestVersion:e,upgradeCommand:n})=>n?`Latest available version is ${e} (currently running ${t}), upgrade with "${n}"`:`Latest available version is ${e} (currently running ${t})`};function ZZ(t){if(t.startsWith("en"))return JZ}function Uo(t,e,n){return!n.disableAnsiColor&&!lv(t,"STRICLI_NO_COLOR")&&(e.getColorDepth?.(t.env)??1)>=4}async function e7({loader:t,parameters:e},{context:n,inputs:r,scannerConfig:o,errorFormatting:s,documentationConfig:i,determineExitCode:a}){let c;try{let f=XZ(e,o);for(let m of r)f.next(m);let _=await f.parseArguments(n);if(_.success)c=_.arguments;else{let m=Uo(n.process,n.process.stderr,i);for(let E of _.errors){let T=s.exceptionWhileParsingArguments(E,m);n.process.stderr.write(m?`\x1B[1m\x1B[31m${T}\x1B[39m\x1B[22m
116
117
  `:`${T}
117
118
  `)}return wo.InvalidArgument}}catch(f){let _=Uo(n.process,n.process.stderr,i),m=s.exceptionWhileParsingArguments(f,_);return n.process.stderr.write(_?`\x1B[1m\x1B[31m${m}\x1B[39m\x1B[22m
118
119
  `:`${m}
@@ -450,7 +451,7 @@ The organization and project are resolved from:
450
451
 
451
452
  In monorepos with multiple Sentry projects, shows details for all detected projects.`},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project slug (optional if auto-detected)",parse:String,optional:!0}]},flags:{org:{kind:"parsed",parse:String,brief:"Organization slug",optional:!0},json:{kind:"boolean",brief:"Output as JSON",default:!1},web:{kind:"boolean",brief:"Open in browser",default:!1}},aliases:{w:"web"}},async func(t,e){let{stdout:n,cwd:r}=this,{targets:o,footer:s,skippedSelfHosted:i}=await Su({org:t.org,project:e,cwd:r,usageHint:"sentry project view <project-slug> --org <org-slug>"});if(o.length===0)throw l0(i);if(t.web){await xoe(n,o);return}let{projects:a,targets:c}=await Doe(o);if(a.length===0)throw l0();if(t.json){Vt(n,a.length===1?a[0]:a);return}let d=a[0],f=c[0];a.length===1&&d?Om(n,d,{json:!1,formatHuman:ry,detectedFrom:f?.detectedFrom}):woe(n,a,c),s&&n.write(`
452
453
  ${s}
453
- `)}});var d0=Cr({routes:{list:u0,view:p0},docs:{brief:"Work with Sentry projects",fullDescription:"List and manage Sentry projects in your organizations.",hideRoute:{}}});var Ty=Cr({routes:{auth:uD,org:a0,project:d0,issue:o0,event:qD,api:Jx},docs:{brief:"A gh-like CLI for Sentry",fullDescription:"sentry is a command-line interface for interacting with Sentry. It provides commands for authentication, viewing issues, and making API calls.",hideRoute:{}}}),Uoe="0.3.2",f0=mv(Ty,{name:"sentry",versionInfo:{currentVersion:Uoe}});p();u();l();var P8=require("node:os");po();p();u();l();p();u();l();p();u();l();D();var w3=B(pV(),1);p();u();l();p();u();l();p();u();l();var $=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;p();u();l();p();u();l();var ae=globalThis;p();u();l();p();u();l();p();u();l();p();u();l();var ye="10.36.0";function Un(){return yi(ae),ae}function yi(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ye,e[ye]=e[ye]||{}}function So(t,e,n=ae){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[ye]=r[ye]||{};return o[t]||(o[t]=e())}var Ld=["debug","info","warn","error","log","assert","trace"],lSe="Sentry Logger ",Vu={};function Rt(t){if(!("console"in ae))return t();let e=ae.console,n={},r=Object.keys(Vu);r.forEach(o=>{let s=Vu[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function pSe(){lN().enabled=!0}function dSe(){lN().enabled=!1}function dV(){return lN().enabled}function fSe(...t){uN("log",...t)}function _Se(...t){uN("warn",...t)}function mSe(...t){uN("error",...t)}function uN(t,...e){$&&dV()&&Rt(()=>{ae.console[t](`${lSe}[${t}]:`,...e)})}function lN(){return $?So("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var I={enable:pSe,disable:dSe,isEnabled:dV,log:fSe,warn:_Se,error:mSe};p();u();l();var fV=/\(error: (.*)\)/,_V=/captureMessage|captureException/;function oE(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
454
+ `)}});var d0=Cr({routes:{list:u0,view:p0},docs:{brief:"Work with Sentry projects",fullDescription:"List and manage Sentry projects in your organizations.",hideRoute:{}}});var Ty=Cr({routes:{auth:uD,org:a0,project:d0,issue:o0,event:qD,api:Jx},docs:{brief:"A gh-like CLI for Sentry",fullDescription:"sentry is a command-line interface for interacting with Sentry. It provides commands for authentication, viewing issues, and making API calls.",hideRoute:{}}}),Uoe="0.3.3",f0=mv(Ty,{name:"sentry",versionInfo:{currentVersion:Uoe}});p();u();l();var P8=require("node:os");po();p();u();l();p();u();l();p();u();l();D();var w3=B(pV(),1);p();u();l();p();u();l();p();u();l();var $=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;p();u();l();p();u();l();var ae=globalThis;p();u();l();p();u();l();p();u();l();p();u();l();var ye="10.36.0";function Un(){return yi(ae),ae}function yi(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ye,e[ye]=e[ye]||{}}function So(t,e,n=ae){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[ye]=r[ye]||{};return o[t]||(o[t]=e())}var Ld=["debug","info","warn","error","log","assert","trace"],lSe="Sentry Logger ",Vu={};function Rt(t){if(!("console"in ae))return t();let e=ae.console,n={},r=Object.keys(Vu);r.forEach(o=>{let s=Vu[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function pSe(){lN().enabled=!0}function dSe(){lN().enabled=!1}function dV(){return lN().enabled}function fSe(...t){uN("log",...t)}function _Se(...t){uN("warn",...t)}function mSe(...t){uN("error",...t)}function uN(t,...e){$&&dV()&&Rt(()=>{ae.console[t](`${lSe}[${t}]:`,...e)})}function lN(){return $?So("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var I={enable:pSe,disable:dSe,isEnabled:dV,log:fSe,warn:_Se,error:mSe};p();u();l();var fV=/\(error: (.*)\)/,_V=/captureMessage|captureException/;function oE(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
454
455
  `);for(let a=r;a<i.length;a++){let c=i[a];c.length>1024&&(c=c.slice(0,1024));let d=fV.test(c)?c.replace(fV,"$1"):c;if(!d.match(/\S*Error: /)){for(let f of e){let _=f(d);if(_){s.push(_);break}}if(s.length>=50+o)break}}return mV(s.slice(o))}}function dN(t){return Array.isArray(t)?oE(...t):t}function mV(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(rE(e).function||"")&&e.pop(),e.reverse(),_V.test(rE(e).function||"")&&(e.pop(),_V.test(rE(e).function||"")&&e.pop()),e.slice(0,50).map(n=>({...n,filename:n.filename||rE(e).filename,function:n.function||"?"}))}function rE(t){return t[t.length-1]||{}}var pN="<anonymous>";function Dd(t){try{return!t||typeof t!="function"?pN:t.name||pN}catch{return pN}}function sE(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function hV(t){let e=t?.startsWith("file://")?t.slice(7):t;return e?.match(/\/[A-Z]:/)&&(e=e.slice(1)),e}var iE={},EV={};function qu(t,e){iE[t]=iE[t]||[],iE[t].push(e)}function Yu(t,e){if(!EV[t]){EV[t]=!0;try{e()}catch(n){$&&I.error(`Error while instrumenting ${t}`,n)}}}function Wu(t,e){let n=t&&iE[t];if(n)for(let r of n)try{r(e)}catch(o){$&&I.error(`Error while triggering instrumentation handler.
455
456
  Type: ${t}
456
457
  Name: ${Dd(r)}
@@ -479,7 +480,7 @@ Url: ${wE(t)}`),!0}return!1}function QAe(t,e){return e?.length?ME(t).some(n=>Oi(
479
480
  `;let c=A3(o);o.write(`${a}\r
480
481
  `);let{connect:d,buffered:f}=await c;if(e.emit("proxyConnect",d),this.emit("proxyConnect",d,e),d.statusCode===200){if(e.once("socket",_Pe),n.secureEndpoint){Ff("Upgrading socket connection to TLS");let m=n.servername||n.host;return AC.connect({...R3(n,"host","path","port"),socket:o,servername:Hs.isIP(m)?void 0:m})}return o}o.destroy();let _=new Hs.Socket({writable:!1});return _.readable=!0,e.once("socket",m=>{Ff("Replaying proxy buffer for failed request"),m.push(f),m.push(null)}),_}};$f.__initStatic();function _Pe(t){t.resume()}function R3(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var EPe=1024*32;function gPe(t){return new y3.Readable({read(){this.push(t),this.push(null)}})}function N3(t){let e;try{e=new URL(t.url)}catch{return Rt(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),ef(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=TPe(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?hPe:mPe,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new $f(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=SPe(t,t.httpModule??o,i);return ef(t,a)}function TPe(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function SPe(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(d){return new Promise((f,_)=>{ol(()=>{let m=gPe(d.body),E={...t.headers};d.body.length>EPe&&(E["content-encoding"]="gzip",m=m.pipe((0,I3.createGzip)()));let T=r.startsWith("["),S=e.request({method:"POST",agent:n,headers:E,hostname:T?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},R=>{R.on("data",()=>{}),R.on("end",()=>{}),R.setEncoding("utf8");let N=R.headers["retry-after"]??null,y=R.headers["x-sentry-rate-limits"]??null;f({statusCode:R.statusCode,headers:{"retry-after":N,"x-sentry-rate-limits":Array.isArray(y)?y[0]||null:y}})});S.on("error",_),m.pipe(S)})})}}p();u();l();var APe=new Set(["false","f","n","no","off","0"]),RPe=new Set(["true","t","y","yes","on","1"]);function PT(t,e){let n=String(t).toLowerCase();return APe.has(n)?!1:RPe.has(n)?!0:e?.strict?null:!!t}p();u();l();p();u();l();var MT=require("node:path");function O3(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function b3(t=process.argv[1]?_O(process.argv[1]):process.cwd(),e=MT.sep==="\\"){let n=e?O3(t):t;return r=>{if(!r)return;let o=e?O3(r):r,{dir:s,base:i,ext:a}=MT.posix.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let d=s.lastIndexOf("/node_modules");if(d>-1)return`${s.slice(d+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let f=s.slice(n.length+1).replace(/\//g,".");return f?`${f}:${c}`:c}return c}}function C3(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(ae.SENTRY_RELEASE?.id)return ae.SENTRY_RELEASE.id;let e=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_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 e||n||r||t}var P3=oE(BO(b3()));p();u();l();var M3=B(require("node:os"),1);D();var v3=B(pe(),1);var xT=require("worker_threads");var yPe=6e4,vT=class extends tf{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||M3.hostname(),r={...e,platform:"node",runtime:{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,v3.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Rc(r,"node"),I.log(`Initializing Sentry: process: ${process.pid}, thread: ${xT.isMainThread?"main":`worker-${xT.threadId}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Jd(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=ye,r=ce.getTracer(e,n);return this._tracer=r,r}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 n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{me&&I.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??yPe).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){aO(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?E4(this,e):[void 0,void 0]}};p();u();l();var x3=B(Yh(),1),L3=B(require("module"),1);function RC(){if(s3()&&!ae._sentryEsmLoaderHookRegistered){ae._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,x3.createAddHookMessageChannel)();L3.register("import-in-the-middle/hook.mjs",h,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){I.warn("Failed to register 'import-in-the-middle' hook",t)}}}function LT(){return[UE(),DE(),kE(),BE(),_3(),GE(),x4(),U4(),u3(),l3(),K4(),r3(),j4(),m3(),h3(),a3()]}function yC(t={}){return IPe(t,LT)}function IPe(t={},e){let n=NPe(t,e);n.debug===!0&&(me?I.enable():Rt(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&RC(),S4(),Me().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===dC)&&n.integrations.push(d3({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Rc(n,"node-core");let o=new vT(n);return Me().setClient(o),o.init(),ae._sentryInjectLoaderHookRegister?.(),I.log(`SDK initialized from ${Bf()?"CommonJS":"ESM"}`),o.startClientReportTracking(),CPe(),o4(o),T4(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function IC(){if(!me)return;let t=c4(),e=["SentryContextManager","SentryPropagator"];yt()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||I.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||I.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 NPe(t,e){let n=OPe(t.release),r;if(t.spotlight===!1)r=!1;else if(typeof t.spotlight=="string")r=t.spotlight;else{let c=PT(process.env.SENTRY_SPOTLIGHT,{strict:!0}),d=c===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;r=t.spotlight===!0?d??!0:c??d}let o=bPe(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??N3,stackParser:dN(t.stackParser||P3),release:n,tracesSampleRate:o,spotlight:r,debug:PT(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:JN({defaultIntegrations:a,integrations:i})}}function OPe(t){if(t!==void 0)return t;let e=C3();if(e!==void 0)return e}function bPe(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function CPe(){if(PT(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Hd(t,e);Me().setPropagationContext(n)}}p();u();l();function we(t,e){t.setAttribute(le,e)}var NC="Http",D3="@opentelemetry_sentry-patched/instrumentation-http",PPe=X(`${NC}.sentry`,t=>new wc(t)),MPe=X(NC,t=>{let e=new w3.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=xn.createComponentLogger({namespace:D3}),e.instrumentationName=D3}catch{}return e});function vPe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!yt(e)&&Uc.major>=22)}var Vf=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=gf(r),i=yf(o),a=e&&!n;return{name:NC,setup(c){let d=c.getOptions();a&&yt(d)&&i.setup(c)},setupOnce(){let c=q()?.getOptions()||{},d=vPe(t,c);s.setupOnce();let f={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:!d,ignoreOutgoingRequests:t.ignoreOutgoingRequests};if(PPe(f),d){let _=xPe(t);MPe(_)}},processEvent(c){return i.processEvent(c)}}};function xPe(t={}){return{ignoreOutgoingRequestHook:n=>{let r=Tl(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{we(n,"auto.http.otel.http");let o=Tl(r);if(o.startsWith("data:")){let s=nf(o);n.setAttribute("http.url",s),n.setAttribute(Bd,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}p();u();l();var H3=B(G3(),1);var F3="NodeFetch",wPe=X(F3,H3.UndiciInstrumentation,t=>GPe(t)),UPe=X(`${F3}.sentry`,kc,t=>t),kPe=((t={})=>({name:"NodeFetch",setupOnce(){BPe(t,q()?.getOptions())&&wPe(t),UPe(t)}})),$3=kPe;function j3(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e.slice(1)}`:`${n}${e}`}function BPe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&yt(e)}function GPe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=j3(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=j3(n.origin,n.path);if(r.startsWith("data:")){let o=nf(r);return{[le]:"auto.http.otel.node_fetch","http.url":o,[Bd]:o,[Vr]:`${n.method||"GET"} ${o}`}}return{[le]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook}}p();u();l();var ez=B(Z3(),1);p();u();l();var dt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var tz="Express";function tMe(t){we(t,"auto.http.otel.express");let e=oe(t).data,n=e["express.type"];n&&t.setAttribute(de,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function nMe(t,e){if(Ie()===Fr())return dt&&I.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";Ie().setTransactionName(`${r} ${t.route}`)}return e}var nz=X(tz,()=>new ez.ExpressInstrumentation({requestHook:t=>tMe(t),spanNameHook:(t,e)=>nMe(t,e)})),rMe=(()=>({name:tz,setupOnce(){nz()}})),rz=rMe;p();u();l();var kC=B(require("node:diagnostics_channel"),1);p();u();l();var wC=B(require("node:diagnostics_channel"),1);D();var qT=B(De(),1),Lz=B(pe(),1);Re();p();u();l();var Iz=B(hz(),1);p();u();l();var zf=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};p();u();l();p();u();l();var pMe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Xf=t=>t.replace(/[[\]\\-]/g,"\\$&"),dMe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ez=t=>t.join(""),gz=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],o=[],s=n+1,i=!1,a=!1,c=!1,d=!1,f=n,_="";e:for(;s<t.length;){let S=t.charAt(s);if((S==="!"||S==="^")&&s===n+1){d=!0,s++;continue}if(S==="]"&&i&&!c){f=s+1;break}if(i=!0,S==="\\"&&!c){c=!0,s++;continue}if(S==="["&&!c){for(let[R,[N,y,P]]of Object.entries(pMe))if(t.startsWith(R,s)){if(_)return["$.",!1,t.length-n,!0];s+=R.length,P?o.push(N):r.push(N),a=a||y;continue e}}if(c=!1,_){S>_?r.push(Xf(_)+"-"+Xf(S)):S===_&&r.push(Xf(S)),_="",s++;continue}if(t.startsWith("-]",s+1)){r.push(Xf(S+"-")),s+=2;continue}if(t.startsWith("-",s+1)){_=S,s+=2;continue}r.push(Xf(S)),s++}if(f<s)return["",!1,0,!1];if(!r.length&&!o.length)return["$.",!1,t.length-n,!0];if(o.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!d){let S=r[0].length===2?r[0].slice(-1):r[0];return[dMe(S),!1,f-n,!1]}let m="["+(d?"^":"")+Ez(r)+"]",E="["+(d?"":"^")+Ez(o)+"]";return[r.length&&o.length?"("+m+"|"+E+")":r.length?m:E,a,f-n,!0]};p();u();l();var ta=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var fMe=new Set(["!","?","+","*","@"]),Tz=t=>fMe.has(t),_Me="(?!(?:^|/)\\.\\.?(?:$|/))",FT="(?!\\.)",mMe=new Set(["[","."]),hMe=new Set(["..","."]),EMe=new Set("().*{}+?[]^$\\!"),gMe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),LC="[^/]",Sz=LC+"*?",Az=LC+"+?",Gl=class t{type;#r;#n;#o=!1;#t=[];#e;#i;#s;#u=!1;#a;#l;#p=!1;constructor(e,n,r={}){this.type=e,e&&(this.#n=!0),this.#e=n,this.#r=this.#e?this.#e.#r:this,this.#a=this.#r===this?r:this.#r.#a,this.#s=this.#r===this?[]:this.#r.#s,e==="!"&&!this.#r.#u&&this.#s.push(this),this.#i=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#l=this.#t.map(e=>String(e)).join("")}#d(){if(this!==this.#r)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#s.pop();){if(e.type!=="!")continue;let n=e,r=n.#e;for(;r;){for(let o=n.#i+1;!r.type&&o<r.#t.length;o++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[o])}n=r,r=n.#e}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof t&&n.#e===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let e=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#r||this.#r.#u&&this.#e?.type==="!")&&e.push({}),e}isStart(){if(this.#r===this)return!0;if(!this.#e?.isStart())return!1;if(this.#i===0)return!0;let e=this.#e;for(let n=0;n<this.#i;n++){let r=e.#t[n];if(!(r instanceof t&&r.type==="!"))return!1}return!0}isEnd(){if(this.#r===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();let e=this.#e?this.#e.#t.length:0;return this.#i===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new t(this.type,e);for(let r of this.#t)n.copyIn(r);return n}static#c(e,n,r,o){let s=!1,i=!1,a=-1,c=!1;if(n.type===null){let E=r,T="";for(;E<e.length;){let S=e.charAt(E++);if(s||S==="\\"){s=!s,T+=S;continue}if(i){E===a+1?(S==="^"||S==="!")&&(c=!0):S==="]"&&!(E===a+2&&c)&&(i=!1),T+=S;continue}else if(S==="["){i=!0,a=E,c=!1,T+=S;continue}if(!o.noext&&Tz(S)&&e.charAt(E)==="("){n.push(T),T="";let R=new t(S,n);E=t.#c(e,R,E,o),n.push(R);continue}T+=S}return n.push(T),E}let d=r+1,f=new t(null,n),_=[],m="";for(;d<e.length;){let E=e.charAt(d++);if(s||E==="\\"){s=!s,m+=E;continue}if(i){d===a+1?(E==="^"||E==="!")&&(c=!0):E==="]"&&!(d===a+2&&c)&&(i=!1),m+=E;continue}else if(E==="["){i=!0,a=d,c=!1,m+=E;continue}if(Tz(E)&&e.charAt(d)==="("){f.push(m),m="";let T=new t(E,f);f.push(T),d=t.#c(e,T,d,o);continue}if(E==="|"){f.push(m),m="",_.push(f),f=new t(null,n);continue}if(E===")")return m===""&&n.#t.length===0&&(n.#p=!0),f.push(m),m="",n.push(..._,f),d;m+=E}return n.type=null,n.#n=void 0,n.#t=[e.substring(r-1)],d}static fromGlob(e,n={}){let r=new t(null,void 0,n);return t.#c(e,r,0,n),r}toMMPattern(){if(this!==this.#r)return this.#r.toMMPattern();let e=this.toString(),[n,r,o,s]=this.toRegExpSource();if(!(o||this.#n||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#a.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#a}toRegExpSource(e){let n=e??!!this.#a.dot;if(this.#r===this&&this.#d(),!this.type){let c=this.isStart()&&this.isEnd(),d=this.#t.map(E=>{let[T,S,R,N]=typeof E=="string"?t.#m(E,this.#n,c):E.toRegExpSource(e);return this.#n=this.#n||R,this.#o=this.#o||N,T}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&hMe.has(this.#t[0]))){let T=mMe,S=n&&T.has(d.charAt(0))||d.startsWith("\\.")&&T.has(d.charAt(2))||d.startsWith("\\.\\.")&&T.has(d.charAt(4)),R=!n&&!e&&T.has(d.charAt(0));f=S?_Me:R?FT:""}let _="";return this.isEnd()&&this.#r.#u&&this.#e?.type==="!"&&(_="(?:$|\\/)"),[f+d+_,ta(d),this.#n=!!this.#n,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#f(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString();return this.#t=[c],this.type=null,this.#n=void 0,[c,ta(this.toString()),!1,!1]}let i=!r||e||n||!FT?"":this.#f(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#p)a=(this.isStart()&&!n?FT:"")+Az;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?FT:"")+Sz+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,ta(s),this.#n=!!this.#n,this.#o]}#f(e){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,s,i]=n.toRegExpSource(e);return this.#o=this.#o||i,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#m(e,n,r=!1){let o=!1,s="",i=!1;for(let a=0;a<e.length;a++){let c=e.charAt(a);if(o){o=!1,s+=(EMe.has(c)?"\\":"")+c;continue}if(c==="\\"){a===e.length-1?s+="\\\\":o=!0;continue}if(c==="["){let[d,f,_,m]=gz(e,a);if(_){s+=d,i=i||f,a+=_-1,n=n||m;continue}}if(c==="*"){r&&e==="*"?s+=Az:s+=Sz,n=!0;continue}if(c==="?"){s+=LC,n=!0;continue}s+=gMe(c)}return[s,ta(e),!!n,i]}};p();u();l();var DC=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var on=(t,e,n={})=>(zf(e),!n.nocomment&&e.charAt(0)==="#"?!1:new jl(e,n).match(t)),TMe=/^\*+([^+@!?\*\[\(]*)$/,SMe=t=>e=>!e.startsWith(".")&&e.endsWith(t),AMe=t=>e=>e.endsWith(t),RMe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),yMe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),IMe=/^\*+\.\*+$/,NMe=t=>!t.startsWith(".")&&t.includes("."),OMe=t=>t!=="."&&t!==".."&&t.includes("."),bMe=/^\.\*+$/,CMe=t=>t!=="."&&t!==".."&&t.startsWith("."),PMe=/^\*+$/,MMe=t=>t.length!==0&&!t.startsWith("."),vMe=t=>t.length!==0&&t!=="."&&t!=="..",xMe=/^\?+([^+@!?\*\[\(]*)?$/,LMe=([t,e=""])=>{let n=Nz([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},DMe=([t,e=""])=>{let n=Oz([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},wMe=([t,e=""])=>{let n=Oz([t]);return e?r=>n(r)&&r.endsWith(e):n},UMe=([t,e=""])=>{let n=Nz([t]);return e?r=>n(r)&&r.endsWith(e):n},Nz=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},Oz=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},bz=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Rz={win32:{sep:"\\"},posix:{sep:"/"}},kMe=bz==="win32"?Rz.win32.sep:Rz.posix.sep;on.sep=kMe;var Jr=Symbol("globstar **");on.GLOBSTAR=Jr;var BMe="[^/]",GMe=BMe+"*?",jMe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",HMe="(?:(?!(?:\\/|^)\\.).)*?",FMe=(t,e={})=>n=>on(n,t,e);on.filter=FMe;var Qr=(t,e={})=>Object.assign({},t,e),$Me=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return on;let e=on;return Object.assign((r,o,s={})=>e(r,o,Qr(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,Qr(t,s))}static defaults(o){return e.defaults(Qr(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,Qr(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,Qr(t,s))}},unescape:(r,o={})=>e.unescape(r,Qr(t,o)),escape:(r,o={})=>e.escape(r,Qr(t,o)),filter:(r,o={})=>e.filter(r,Qr(t,o)),defaults:r=>e.defaults(Qr(t,r)),makeRe:(r,o={})=>e.makeRe(r,Qr(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,Qr(t,o)),match:(r,o,s={})=>e.match(r,o,Qr(t,s)),sep:e.sep,GLOBSTAR:Jr})};on.defaults=$Me;var Cz=(t,e={})=>(zf(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,Iz.default)(t));on.braceExpand=Cz;var VMe=(t,e={})=>new jl(t,e).makeRe();on.makeRe=VMe;var qMe=(t,e,n={})=>{let r=new jl(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};on.match=qMe;var yz=/[?*]|[+@!]\(.*?\)|\[|\]/,YMe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),jl=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,n={}){zf(e),n=n||{},this.options=n,this.pattern=e,this.platform=n.platform||bz,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!yz.test(s[2]))&&!yz.test(s[3]),d=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(d)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let i=this.set[s];i[0]===""&&i[1]===""&&this.globParts[s][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let o=0;o<e[r].length;o++)e[r][o]==="**"&&(e[r][o]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let o=r;for(;n[o+1]==="**";)o++;o!==r&&n.splice(r,o-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,o)=>{let s=r[r.length-1];return o==="**"&&s==="**"?r:o===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(o),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let s=e[o];o===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let o=e[r-1];o&&o!=="."&&o!==".."&&o!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let o=-1;for(;(o=r.indexOf("**",o+1))!==-1;){let i=o;for(;r[i+1]==="**";)i++;i>o&&r.splice(o+1,i-o);let a=r[o+1],c=r[o+2],d=r[o+3];if(a!==".."||!c||c==="."||c===".."||!d||d==="."||d==="..")continue;n=!0,r.splice(o,1);let f=r.slice(0);f[o]="**",e.push(f),o--}if(!this.preserveMultipleSlashes){for(let i=1;i<r.length-1;i++){let a=r[i];i===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(i,1),i--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let i=r[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let o=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(o){e[n]=[],e[r]=o;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let o=0,s=0,i=[],a="";for(;o<e.length&&s<n.length;)if(e[o]===n[s])i.push(a==="b"?n[s]:e[o]),o++,s++;else if(r&&e[o]==="**"&&n[s]===e[o+1])i.push(e[o]),o++;else if(r&&n[s]==="**"&&e[o]===n[s+1])i.push(n[s]),s++;else if(e[o]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",i.push(e[o]),o++,s++}else if(n[s]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(a==="a")return!1;a="b",i.push(n[s]),o++,s++}else return!1;return e.length===n.length&&i}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let o=0;o<e.length&&e.charAt(o)==="!";o++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let o=this.options;if(this.isWindows){let S=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),R=!S&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),N=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),y=!N&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),P=R?3:S?0:void 0,M=y?3:N?0:void 0;if(typeof P=="number"&&typeof M=="number"){let[G,U]=[e[P],n[M]];G.toLowerCase()===U.toLowerCase()&&(n[M]=G,M>P?n=n.slice(M):P>M&&(e=e.slice(P)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:n}),this.debug("matchOne",e.length,n.length);for(var i=0,a=0,c=e.length,d=n.length;i<c&&a<d;i++,a++){this.debug("matchOne loop");var f=n[a],_=e[i];if(this.debug(n,f,_),f===!1)return!1;if(f===Jr){this.debug("GLOBSTAR",[n,f,_]);var m=i,E=a+1;if(E===d){for(this.debug("** at the end");i<c;i++)if(e[i]==="."||e[i]===".."||!o.dot&&e[i].charAt(0)===".")return!1;return!0}for(;m<c;){var T=e[m];if(this.debug(`
481
482
  globstar while`,e,m,n,E,T),this.matchOne(e.slice(m),n.slice(E),r))return this.debug("globstar found match!",m,c,T),!0;if(T==="."||T===".."||!o.dot&&T.charAt(0)==="."){this.debug("dot detected!",e,m,n,E);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(r&&(this.debug(`
482
- >>> no match, partial?`,e,m,n,E),m===c))}let S;if(typeof f=="string"?(S=_===f,this.debug("string match",f,_,S)):(S=f.test(_),this.debug("pattern match",f,_,S)),!S)return!1}if(i===c&&a===d)return!0;if(i===c)return r;if(a===d)return i===c-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return Cz(this.pattern,this.options)}parse(e){zf(e);let n=this.options;if(e==="**")return Jr;if(e==="")return"";let r,o=null;(r=e.match(PMe))?o=n.dot?vMe:MMe:(r=e.match(TMe))?o=(n.nocase?n.dot?yMe:RMe:n.dot?AMe:SMe)(r[1]):(r=e.match(xMe))?o=(n.nocase?n.dot?DMe:LMe:n.dot?wMe:UMe)(r):(r=e.match(IMe))?o=n.dot?OMe:NMe:(r=e.match(bMe))&&(o=CMe);let s=Gl.fromGlob(e,this.options).toMMPattern();return o&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?GMe:n.dot?jMe:HMe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let d=c.map(f=>{if(f instanceof RegExp)for(let _ of f.flags.split(""))o.add(_);return typeof f=="string"?YMe(f):f===Jr?Jr:f._src});return d.forEach((f,_)=>{let m=d[_+1],E=d[_-1];f!==Jr||E===Jr||(E===void 0?m!==void 0&&m!==Jr?d[_+1]="(?:\\/|"+r+"\\/)?"+m:d[_]=r:m===void 0?d[_-1]=E+"(?:\\/|"+r+")?":m!==Jr&&(d[_-1]=E+"(?:\\/|\\/"+r+"\\/)"+m,d[_+1]=Jr))}),d.filter(f=>f!==Jr).join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let o=this.slashSplit(e);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let i=o[o.length-1];if(!i)for(let a=o.length-2;!i&&a>=0;a--)i=o[a];for(let a=0;a<s.length;a++){let c=s[a],d=o;if(r.matchBase&&c.length===1&&(d=[i]),this.matchOne(d,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return on.defaults(e).Minimatch}};on.AST=Gl;on.Minimatch=jl;on.escape=DC;on.unescape=ta;var Pz="@fastify/otel",KMe="0.8.0",zMe=">=4.0.0 <6",Mz=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Ke={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},na={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},Fs="anonymous",Hn=Symbol("fastify otel instance"),ra=Symbol("fastify otel request spans"),Qf=Symbol("fastify otel request context"),vz=Symbol("fastify otel addhook original"),xz=Symbol("fastify otel setnotfound original"),$T=Symbol("fastify otel ignore path"),VT=class extends Lz.InstrumentationBase{constructor(e){if(super(Pz,KMe,e),this.servername=e?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[$T]=null,this._logger=xn.createComponentLogger({namespace:Pz}),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let n=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof n!="string"||n.length===0)&&typeof n!="function")throw new TypeError("ignorePaths must be a string or a function");let r=on;this[$T]=o=>typeof n=="function"?n(o):r(o.url,n)}}enable(){if(this._handleInitialization===void 0&&this.getConfig().registerOnInitialization){let e=this.plugin();this._handleInitialization=n=>{n.fastify.register(e)},wC.default.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){return this._handleInitialization&&(wC.default.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",n[Symbol.for("plugin-meta")]={fastify:zMe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate(Hn,e),r.decorate(vz,r.addHook),r.decorate(xz,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let m=this[Qf];return{span:this[ra],tracer:e.tracer,context:m,inject:(T,S)=>Ln.inject(m,T,S),extract:(T,S)=>Ln.extract(m,T,S)}}),r.decorateRequest(ra,null),r.decorateRequest(Qf,null),r.addHook("onRoute",function(_){if(e[$T]?.(_)===!0){e._logger.debug(`Ignoring route instrumentation ${_.method} ${_.url} because it matches the ignore path`);return}for(let m of Mz)if(_[m]!=null){let E=_[m];if(typeof E=="function")_[m]=f(E,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Ke.FASTIFY_TYPE]:na.ROUTE,[Qn]:_.url,[Ke.HOOK_CALLBACK_NAME]:E.name?.length>0?E.name:Fs});else if(Array.isArray(E)){let T=[];for(let S of E)T.push(f(S,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Ke.FASTIFY_TYPE]:na.ROUTE,[Qn]:_.url,[Ke.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:Fs}));_[m]=T}}_.onSend!=null?_.onSend=Array.isArray(_.onSend)?[..._.onSend,i]:[_.onSend,i]:_.onSend=i,_.onError!=null?_.onError=Array.isArray(_.onError)?[..._.onError,a]:[_.onError,a]:_.onError=a,_.handler=f(_.handler,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - route-handler`,[Ke.FASTIFY_TYPE]:na.HANDLER,[Qn]:_.url,[Ke.HOOK_CALLBACK_NAME]:_.handler.name.length>0?_.handler.name:Fs})}),r.addHook("onRequest",function(_,m,E){if(this[Hn].isEnabled()===!1)return E();if(this[Hn][$T]?.({url:_.url,method:_.method})===!0)return this[Hn]._logger.debug(`Ignoring request ${_.method} ${_.url} because it matches the ignore path`),E();let T=V.active();ce.getSpan(T)==null&&(T=Ln.extract(T,_.headers));let S=(0,qT.getRPCMetadata)(T);_.routeOptions.url!=null&&S?.type===qT.RPCType.HTTP&&(S.route=_.routeOptions.url);let R=this[Hn].tracer.startSpan("request",{attributes:{[_r]:r[Hn].servername,[Ke.ROOT]:"@fastify/otel",[Qn]:_.url,[Cs]:_.method}},T);_[Qf]=ce.setSpan(T,R),_[ra]=R,V.with(_[Qf],()=>{E()})}),r.addHook("onResponse",function(_,m,E){let T=_[ra];T!=null&&(T.setStatus({code:Ze.OK,message:"OK"}),T.setAttributes({[Wo]:404}),T.end()),_[ra]=null,E()}),r.addHook=c,r.setNotFoundHandler=d,s();function i(_,m,E,T){let S=_[ra];S!=null&&(m.statusCode<500&&S.setStatus({code:Ze.OK,message:"OK"}),S.setAttributes({[Wo]:m.statusCode}),S.end()),_[ra]=null,T(null,E)}function a(_,m,E,T){let S=_[ra];S!=null&&(S.setStatus({code:Ze.ERROR,message:E.message}),S.recordException(E)),T()}function c(_,m){let E=this[vz];return Mz.includes(_)?E.call(this,_,f(m,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - ${_}`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:m.name?.length>0?m.name:Fs})):E.call(this,_,m)}function d(_,m){let E=this[xz];typeof _=="function"?(m=f(_,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:Fs}),E.call(this,m)):(_.preValidation!=null&&(_.preValidation=f(_.preValidation,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:Fs})),_.preHandler!=null&&(_.preHandler=f(_.preHandler,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:Fs})),m=f(m,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:m.name?.length>0?m.name:Fs}),E.call(this,_,m))}function f(_,m={}){return function(...T){let S=this[Hn],[R]=T;if(S.isEnabled()===!1)return _.call(this,...T);let N=R[Qf]??V.active(),y=S.tracer.startSpan(`handler - ${_.name?.length>0?_.name:this.pluginName??Fs}`,{attributes:m},N);return V.with(ce.setSpan(N,y),function(){try{let P=_.call(this,...T);return typeof P?.then=="function"?P.then(M=>(y.end(),M),M=>(y.setStatus({code:Ze.ERROR,message:M.message}),y.recordException(M),y.end(),Promise.reject(M))):(y.end(),P)}catch(P){throw y.setStatus({code:Ze.ERROR,message:P.message}),y.recordException(P),y.end(),P}},this)}}}}};p();u();l();D();var KT=B(De(),1),Gc=B(pe(),1);Re();p();u();l();var $s;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($s||($s={}));var Jf;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(Jf||(Jf={}));var Zf;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(Zf||(Zf={}));p();u();l();D();p();u();l();var e_=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function UC(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[e_]||[];return s.push(o),Object.defineProperty(t,e_,{enumerable:!1,configurable:!0,value:s}),o}function YT(t,e){let n=t[e_]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Ze.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[e_])}function wz(t,e,n){let r,o;try{o=t(),Dz(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!Dz(o)&&(e(r,o),r))throw r;return o}}function Dz(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var XMe="0.1.0",QMe="@sentry/instrumentation-fastify-v3",Uz="anonymous",JMe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),WT=class extends Gc.InstrumentationBase{constructor(e={}){super(QMe,XMe,e)}init(){return[new Gc.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,KT.getRPCMetadata)(V.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===KT.RPCType.HTTP&&(a.route=c);let d=r.method||"GET";Ie().setTransactionName(`${d} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||Uz,c=`${Zf.MIDDLEWARE} - ${a}`,d=i[1],f=UC(d,s.tracer,c,{[$s.FASTIFY_TYPE]:Jf.MIDDLEWARE,[$s.PLUGIN_NAME]:e,[$s.HOOK_NAME]:n}),_=o&&i[i.length-1];return _&&(i[i.length-1]=function(...m){YT(d),_.apply(this,m)}),V.with(ce.setSpan(V.active(),f),()=>wz(()=>r.apply(this,i),m=>{m instanceof Error&&(f.setStatus({code:Ze.ERROR,message:m.message}),f.recordException(m)),o||YT(d)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!JMe.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),ZMe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,Gc.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),YT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,d=`${Zf.REQUEST_HANDLER} - ${c||this.pluginName||Uz}`,f={[$s.PLUGIN_NAME]:this.pluginName,[$s.FASTIFY_TYPE]:Jf.REQUEST_HANDLER,[iI]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(f[$s.FASTIFY_NAME]=c);let _=UC(o,e.tracer,d,f);kz(_);let{requestHook:m}=e.getConfig();return m&&(0,Gc.safeExecuteInTheMiddle)(()=>m(_,{request:r}),E=>{E&&e._diag.error("request hook failed",E)},!0),V.with(ce.setSpan(V.active(),_),()=>{s()})}}};function ZMe(){let t=q();t&&t.on("spanStart",e=>{kz(e)})}function kz(t){let e=oe(t).data,n=e["fastify.type"];if(e[de]||!n)return;t.setAttributes({[le]:"auto.http.otel.fastify",[de]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var zT="Fastify",Gz=X(`${zT}.v3`,()=>new WT);function eve(){let t=q();if(t)return t.getIntegrationByName(zT)}function Bz(t,e,n,r){let o=eve()?.getShouldHandleError()||Fz;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){dt&&I.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&fe(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var jz=X(`${zT}.v5`,()=>{let t=new VT,e=t.plugin();return kC.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?dt&&I.error("Failed to setup Fastify instrumentation",o):(nve(),r&&rve(r))})}),kC.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;Bz.call(Bz,r,o,s,"diagnostics-channel")}),t}),tve=(({shouldHandleError:t})=>{let e;return{name:zT,setupOnce(){e=t||Fz,Gz(),jz()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}}),Hz=(t={})=>tve(t);function Fz(t,e,n){let r=n.statusCode;return r>=500||r<=299}function $z(t){let e=oe(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[de]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request-handler":"<unknown>";t.setAttributes({[le]:"auto.http.otel.fastify",[de]:`${c}.fastify`});let d=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof d=="string"){let f=d.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(f)}}function nve(){let t=q();t&&t.on("spanStart",e=>{$z(e)})}function rve(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&$z(s)}let r=e.routeOptions?.url,o=e.method||"GET";Ie().setTransactionName(`${o} ${r}`)})}p();u();l();D();var l5=B(u5(),1);var p5="Graphql",d5=X(p5,l5.GraphQLInstrumentation,t=>{let e=_5(t);return{...e,responseHook(n,r){we(n,"auto.graphql.otel.graphql"),r.errors?.length&&!oe(n).status&&n.setStatus({code:Ze.ERROR});let s=oe(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=ut(n),f=oe(c).data[Ml]||[],_=a?`${i} ${a}`:`${i}`;Array.isArray(f)?(f.push(_),c.setAttribute(Ml,f)):typeof f=="string"?c.setAttribute(Ml,[f,_]):c.setAttribute(Ml,_),oe(c).data["original-description"]||c.setAttribute("original-description",oe(c).description),c.updateName(`${oe(c).data["original-description"]} (${Ive(f)})`)}}}}),yve=((t={})=>({name:p5,setupOnce(){d5(_5(t))}})),f5=yve;function _5(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function Ive(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}p();u();l();var O5=B(N5(),1);var b5="Kafka",C5=X(b5,()=>new O5.KafkaJsInstrumentation({consumerHook(t){we(t,"auto.kafkajs.otel.consumer")},producerHook(t){we(t,"auto.kafkajs.otel.producer")}})),Ove=(()=>({name:b5,setupOnce(){C5()}})),P5=Ove;p();u();l();var U5=B(w5(),1);var k5="LruMemoizer",B5=X(k5,()=>new U5.LruMemoizerInstrumentation),Cve=(()=>({name:k5,setupOnce(){B5()}})),G5=Cve;p();u();l();var K5=B(W5(),1);var z5="Mongo",X5=X(z5,()=>new K5.MongoDBInstrumentation({dbStatementSerializer:Lve,responseHook(t){we(t,"auto.db.otel.mongo")}}));function Lve(t){let e=YC(t);return JSON.stringify(e)}function YC(t){if(Array.isArray(t))return t.map(e=>YC(e));if(Dve(t)){let e={};return Object.entries(t).map(([n,r])=>[n,YC(r)]).reduce((n,r)=>(Uve(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function Dve(t){return typeof t=="object"&&t!==null&&!wve(t)}function wve(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function Uve(t){return Array.isArray(t)}var kve=(()=>({name:z5,setupOnce(){X5()}})),Q5=kve;p();u();l();var c9=B(a9(),1);var u9="Mongoose",l9=X(u9,()=>new c9.MongooseInstrumentation({responseHook(t){we(t,"auto.db.otel.mongoose")}})),Yve=(()=>({name:u9,setupOnce(){l9()}})),p9=Yve;p();u();l();var T9=B(g9(),1);var S9="Mysql",A9=X(S9,()=>new T9.MySQLInstrumentation({})),nxe=(()=>({name:S9,setupOnce(){A9()}})),R9=nxe;p();u();l();var M9=B(P9(),1);var v9="Mysql2",x9=X(v9,()=>new M9.MySQL2Instrumentation({responseHook(t){we(t,"auto.db.otel.mysql2")}})),Exe=(()=>({name:v9,setupOnce(){x9()}})),L9=Exe;p();u();l();var s6=B(H9(),1),i6=B(e6(),1);p();u();l();var Uxe=["get","set","setex"],fP=["get","mget"],kxe=["set","setex"];function __(t,e){return t.includes(e.toLowerCase())}function _P(t){return __(fP,t)?"cache.get":__(kxe,t)?"cache.put":void 0}function Bxe(t,e){return e.some(n=>t.startsWith(n))}function n6(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?t6(o.map(s=>n(s))):["<unknown>"],r=e[0];return __(Uxe,t)&&r!=null?n(r):t6(e.map(o=>n(o)))}catch{return}}function r6(t,e,n){if(!_P(t))return!1;for(let r of e)if(Bxe(r,n))return!0;return!1}function o6(t){let e=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function t6(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var xS="Redis",m_={},a6=(t,e,n,r)=>{t.setAttribute(le,"auto.db.otel.redis");let o=n6(e,n),s=_P(e);if(!o||!s||!m_.cachePrefixes||!r6(e,o,m_.cachePrefixes))return;let i=oe(t).data["net.peer.name"],a=oe(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=o6(r);c&&t.setAttribute(kN,c),__(fP,e)&&c!==void 0&&t.setAttribute(wN,c>0),t.setAttributes({[de]:s,[UN]:o});let d=o.join(", ");t.updateName(m_.maxCacheKeyLength?Ni(d,m_.maxCacheKeyLength):d)},Gxe=X(`${xS}.IORedis`,()=>new s6.IORedisInstrumentation({responseHook:a6})),jxe=X(`${xS}.Redis`,()=>new i6.RedisInstrumentation({responseHook:a6})),c6=Object.assign(()=>{Gxe(),jxe()},{id:xS}),Hxe=((t={})=>({name:xS,setupOnce(){m_=t,c6()}})),u6=Hxe;p();u();l();var O6=B(N6(),1);var b6="Postgres",C6=X(b6,()=>new O6.PgInstrumentation({requireParentSpan:!0,requestHook(t){we(t,"auto.db.otel.postgres")}})),nLe=(()=>({name:b6,setupOnce(){C6()}})),P6=nLe;p();u();l();D();var Ks=B(pe(),1);Re();var jS="PostgresJs",M6=[">=3.0.0 <4"],rLe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,GS=Symbol("sentryPostgresConnectionContext"),SP=Symbol.for("sentry.instrumented.postgresjs"),v6=Symbol.for("sentry.query.from.instrumented.sql"),x6=X(jS,t=>new AP({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),AP=class extends Ks.InstrumentationBase{constructor(e){super("sentry-postgres-js",ye,e)}init(){let e=new Ks.InstrumentationNodeModuleDefinition("postgres",M6,n=>{try{return this._patchPostgres(n)}catch(r){return dt&&I.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new Ks.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,M6,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return dt&&I.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);return!a||typeof a!="function"?(dt&&I.warn("postgres() did not return a valid instance"),a):o._instrumentSqlInstance(a)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(mf(e,"default",s),e)}_wrapQueryMethod(e,n,r){let o=this;return function(...s){let i=Reflect.apply(e,n,s);return i&&typeof i=="object"&&"handle"in i&&o._wrapSingleQueryHandle(i,r),i}}_wrapCallbackMethod(e,n,r){let o=this;return function(...s){let i=r[GS];if(!(typeof s[s.length-1]=="function")){let _=Reflect.apply(e,n,s);return _&&typeof _.then=="function"?_.then(m=>o._instrumentSqlInstance(m,i)):_}let c=s.length===1?s[0]:s[1],d=function(_){let m=o._instrumentSqlInstance(_,i);return c(m)},f=s.length===1?[d]:[s[0],d];return Reflect.apply(e,n,f)}}_setConnectionAttributes(e,n){if(n&&(n.ATTR_DB_NAMESPACE&&e.setAttribute(md,n.ATTR_DB_NAMESPACE),n.ATTR_SERVER_ADDRESS&&e.setAttribute(hd,n.ATTR_SERVER_ADDRESS),n.ATTR_SERVER_PORT!==void 0)){let r=parseInt(n.ATTR_SERVER_PORT,10);isNaN(r)||e.setAttribute(Ed,r)}}_setOperationName(e,n,r){if(r){e.setAttribute(Cu,r);return}let o=n?.match(rLe);o?.[1]&&e.setAttribute(Cu,o[1].toUpperCase())}_attachConnectionContext(e,n){let r=e;if(!r.options||typeof r.options!="object")return;let o=r.options,s=o.host?.[0]||"localhost",i=o.port?.[0]||5432,a={ATTR_DB_NAMESPACE:typeof o.database=="string"&&o.database!==""?o.database:void 0,ATTR_SERVER_ADDRESS:s,ATTR_SERVER_PORT:String(i)};n[GS]=a}_instrumentSqlInstance(e,n){if(e[SP])return e;let r=this,o=new Proxy(e,{apply(s,i,a){let c=Reflect.apply(s,i,a);return c&&typeof c=="object"&&"handle"in c&&r._wrapSingleQueryHandle(c,o),c},get(s,i){let a=s[i];return typeof i!="string"||typeof a!="function"?a:i==="unsafe"||i==="file"?r._wrapQueryMethod(a,s,o):i==="begin"||i==="reserve"?r._wrapCallbackMethod(a,s,o):a}});return n?o[GS]=n:this._attachConnectionContext(e,o),e[SP]=!0,o[SP]=!0,o}_wrapSingleQueryHandle(e,n){if(e.handle?.__sentryWrapped)return;e[v6]=!0;let r=e.handle,o=this,s=async function(...i){if(!o._shouldCreateSpans())return r.apply(this,i);let a=o._reconstructQuery(e.strings),c=o._sanitizeSqlQuery(a);return tn({name:c||"postgresjs.query",op:"db"},d=>{we(d,"auto.db.postgresjs"),d.setAttributes({[gi]:"postgres",[oh]:c});let f=n?n[GS]:void 0;o._setConnectionAttributes(d,f);let _=o.getConfig(),{requestHook:m}=_;m&&(0,Ks.safeExecuteInTheMiddle)(()=>m(d,c,f),T=>{T&&(d.setAttribute("sentry.hook.error","requestHook failed"),dt&&I.error(`Error in requestHook for ${jS} integration:`,T))},!0);let E=this;E.resolve=new Proxy(E.resolve,{apply:(T,S,R)=>{try{o._setOperationName(d,c,R?.[0]?.command),d.end()}catch(N){dt&&I.error("Error ending span in resolve callback:",N)}return Reflect.apply(T,S,R)}}),E.reject=new Proxy(E.reject,{apply:(T,S,R)=>{try{d.setStatus({code:2,message:R?.[0]?.message||"unknown_error"}),d.setAttribute(sh,R?.[0]?.code||"unknown"),d.setAttribute(ih,R?.[0]?.name||"unknown"),o._setOperationName(d,c),d.end()}catch(N){dt&&I.error("Error ending span in reject callback:",N)}return Reflect.apply(T,S,R)}});try{return r.apply(this,i)}catch(T){throw d.setStatus({code:2,message:T instanceof Error?T.message:"unknown_error"}),d.end(),T}})};s.__sentryWrapped=!0,e.handle=s}_shouldCreateSpans(){let e=this.getConfig();return ce.getSpan(V.active())!==void 0||!e.requireParentSpan}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_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 n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[v6])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return tn({name:i||"postgresjs.query",op:"db"},a=>{we(a,"auto.db.postgresjs"),a.setAttributes({[gi]:"postgres",[oh]:i});let c=n.getConfig(),{requestHook:d}=c;d&&(0,Ks.safeExecuteInTheMiddle)(()=>d(a,i,void 0),m=>{m&&(a.setAttribute("sentry.hook.error","requestHook failed"),dt&&I.error(`Error in requestHook for ${jS} integration:`,m))},!0);let f=this.resolve;this.resolve=new Proxy(f,{apply:(m,E,T)=>{try{n._setOperationName(a,i,T?.[0]?.command),a.end()}catch(S){dt&&I.error("Error ending span in resolve callback:",S)}return Reflect.apply(m,E,T)}});let _=this.reject;this.reject=new Proxy(_,{apply:(m,E,T)=>{try{a.setStatus({code:2,message:T?.[0]?.message||"unknown_error"}),a.setAttribute(sh,T?.[0]?.code||"unknown"),a.setAttribute(ih,T?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(S){dt&&I.error("Error ending span in reject callback:",S)}return Reflect.apply(m,E,T)}});try{return r.apply(this,o)}catch(m){throw a.setStatus({code:2,message:m instanceof Error?m.message:"unknown_error"}),a.end(),m}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},oLe=(t=>({name:jS,setupOnce(){x6(t)}})),L6=oLe;p();u();l();D();p();u();l();D();var cA=B(hX(),1);D();var NDe={name:"@prisma/instrumentation-contract",version:"7.2.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},ODe=NDe.version.split(".")[0],qP="PRISMA_INSTRUMENTATION",YP=`V${ODe}_PRISMA_INSTRUMENTATION`,dp=globalThis;function bDe(){let t=dp[YP];return t?.helper?t.helper:dp[qP]?.helper}function CDe(t){let e={helper:t};dp[YP]=e,dp[qP]=e}function PDe(){delete dp[YP],delete dp[qP]}var MDe=process.env.PRISMA_SHOW_ALL_TRACES==="true",vDe="00-10-10-00";function xDe(t){switch(t){case"client":return $e.CLIENT;case"internal":default:return $e.INTERNAL}}var LDe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=ce.getSpanContext(t??V.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:vDe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)TX(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return V.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!MDe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(SX(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return EX(s,e(s,r))}return n.startActiveSpan(o,t,s=>EX(s,e(s,r)))}};function TX(t,e,n,r,o){if(SX(e.name,o))return;let s={attributes:e.attributes,kind:xDe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let d=r.get(c);return d?{context:{spanId:d,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)TX(t,c,n,r,o);i.end(e.endTime)})}function EX(t,e){return DDe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function DDe(t){return t!=null&&typeof t.then=="function"}function SX(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var AX={name:"@prisma/instrumentation",version:"7.2.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},gX=AX.version,wDe=AX.name,UDe="@prisma/client",RX=class extends cA.InstrumentationBase{tracerProvider;constructor(t={}){super(wDe,gX,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new cA.InstrumentationNodeModuleDefinition(UDe,[gX])]}enable(){let t=this._config;CDe(new LDe({tracerProvider:this.tracerProvider??ce.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){PDe()}isEnabled(){return bDe()!==void 0}};var yX="Prisma";function kDe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function IX(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var WP=class extends RX{constructor(){super()}enable(){super.enable();let e=IX();kDe(e)&&(e.createEngineSpan=n=>{let r=ce.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Rt(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=BDe(s.kind),a=s.parent_span_id,c=s.span_id,d=s.trace_id,f=s.links?.map(m=>({context:{traceId:m.trace_id,spanId:m.span_id,traceFlags:vn.SAMPLED}})),_=ce.setSpanContext(V.active(),{traceId:d,spanId:a,traceFlags:vn.SAMPLED});V.with(_,()=>{let m={generateTraceId:()=>d,generateSpanId:()=>c};r._idGenerator=m,r.startSpan(s.name,{kind:i,links:f,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function BDe(t){switch(t){case"client":return $e.CLIENT;case"internal":default:return $e.INTERNAL}}var GDe=X(yX,t=>new WP),NX=t=>({name:yX,setupOnce(){GDe()},setup(e){IX()&&e.on("spanStart",n=>{let r=oe(n);r.description?.startsWith("prisma:")&&n.setAttribute(le,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});p();u();l();var wX=B(DX(),1);var UX="Hapi",kX=X(UX,()=>new wX.HapiInstrumentation),JDe=(()=>({name:UX,setupOnce(){kX()}})),BX=JDe;p();u();l();Re();p();u();l();var _a={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},P_={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};p();u();l();D();var dA=B(pe(),1);var ZDe="@sentry/instrumentation-hono",e0e="0.0.1",pA=class extends dA.InstrumentationBase{constructor(e={}){super(ZDe,e0e,e)}init(){return[new dA.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return V.with(ce.setSpan(V.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(kn(a))return a.then(c=>{let d=n._determineHandlerType(c);return i.setAttributes({[_a.HONO_TYPE]:d,[_a.HONO_NAME]:d===P_.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[_a.HONO_TYPE]:c,[_a.HONO_NAME]:c===P_.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return kn(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?P_.MIDDLEWARE:P_.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Ze.ERROR,message:n.message}),e.recordException(n))}};var GX="Hono";function t0e(t){let e=oe(t).data,n=e[_a.HONO_TYPE];if(e[de]||!n)return;t.setAttributes({[le]:"auto.http.otel.hono",[de]:`${n}.hono`});let r=e[_a.HONO_NAME];if(typeof r=="string"&&t.updateName(r),Ie()===Fr()){dt&&I.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Qn],s=e[Cs];typeof o=="string"&&typeof s=="string"&&Ie().setTransactionName(`${s} ${o}`)}var jX=X(GX,()=>new pA({responseHook:t=>{t0e(t)}})),n0e=(()=>({name:GX,setupOnce(){jX()}})),HX=n0e;p();u();l();var ZX=B(JX(),1);Re();var eQ="Koa",tQ=X(eQ,ZX.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){we(e,"auto.http.otel.koa");let r=oe(e).data,o=r["koa.type"];o&&e.setAttribute(de,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),Ie()===Fr()){dt&&I.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Qn],a=n.context?.request?.method?.toUpperCase()||"GET";i&&Ie().setTransactionName(`${a} ${i}`)}})),p0e=((t={})=>({name:eQ,setupOnce(){tQ(t)}})),nQ=p0e;p();u();l();var pQ=B(lQ(),1);var dQ="Connect",fQ=X(dQ,()=>new pQ.ConnectInstrumentation),A0e=(()=>({name:dQ,setupOnce(){fQ()}})),_Q=A0e;p();u();l();var IQ=B(yQ(),1);var O0e=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),NQ="Tedious",OQ=X(NQ,()=>new IQ.TediousInstrumentation({})),b0e=(()=>{let t;return{name:NQ,setupOnce(){let e=OQ();t=Ef(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=oe(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";O0e.has(s)&&n.setAttribute(le,"auto.db.otel.tedious")}))}}}),bQ=b0e;p();u();l();var xQ=B(vQ(),1);var LQ="GenericPool",DQ=X(LQ,()=>new xQ.GenericPoolInstrumentation({})),P0e=(()=>{let t;return{name:LQ,setupOnce(){let e=DQ();t=Ef(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=oe(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(le,"auto.db.otel.generic_pool")}))}}}),wQ=P0e;p();u();l();var qQ=B(VQ(),1);var YQ="Amqplib",j0e={consumeEndHook:t=>{we(t,"auto.amqplib.otel.consumer")},publishHook:t=>{we(t,"auto.amqplib.otel.publisher")}},WQ=X(YQ,()=>new qQ.AmqplibInstrumentation(j0e)),H0e=(()=>({name:YQ,setupOnce(){WQ()}})),KQ=H0e;p();u();l();p();u();l();var D_="VercelAI";p();u();l();var PA=B(pe(),1);var F0e=[">=3.0.0 <7"],zQ=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function $0e(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function V0e(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;if(Array.isArray(e.content)){for(let n of e.content)if($0e(n)){let r=OO(n.toolCallId);if(r){let o=r.spanContext();$r(s=>{s.setContext("trace",{trace_id:o.traceId,span_id:o.spanId}),s.setTag("vercel.ai.tool.name",n.toolName),s.setTag("vercel.ai.tool.callId",n.toolCallId),s.setLevel("error"),fe(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}),bO(n.toolCallId)}else $r(o=>{o.setTag("vercel.ai.tool.name",n.toolName),o.setTag("vercel.ai.tool.callId",n.toolCallId),o.setLevel("error"),fe(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}}function q0e(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var CA=class t extends PA.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",ye,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new PA.InstrumentationNodeModuleDefinition("ai",F0e,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,d=q(),f=d?.getIntegrationByName(D_),_=f?.options,m=f?!!d?.getOptions().sendDefaultPii:!1,{recordInputs:E,recordOutputs:T}=q0e(_,a,c,m);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:E,recordOutputs:T},Er(()=>Reflect.apply(o,s,i),S=>{S&&typeof S=="object"&&bt(S,"_sentry_active_span",qr())},()=>{},S=>{V0e(S)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of zQ)e[r]=n(e[r]);return e}else{let r=zQ.reduce((o,s)=>(o[s]=n(e[s]),o),{});return{...e,...r}}}};var XQ=X(D_,()=>new CA({}));function Y0e(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var W0e=((t={})=>{let e;return{name:D_,options:t,setupOnce(){e=XQ()},afterAllSetup(n){t.force??Y0e(n)?WE(n):e?.callWhenPatched(()=>WE(n))}}}),QQ=W0e;p();u();l();p();u();l();var vA=B(pe(),1);var K0e=[">=4.0.0 <7"],MA=class extends vA.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",ye,e)}init(){return new vA.InstrumentationNodeModuleDefinition("openai",K0e,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(Ac(Yi))return Reflect.construct(r,i);let a=Reflect.construct(r,i),d=!!q()?.getOptions().sendDefaultPii,f=o.recordInputs??d,_=o.recordOutputs??d;return XE(a,{recordInputs:f,recordOutputs:_})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var JQ=X(Yi,t=>new MA(t)),z0e=((t={})=>({name:Yi,setupOnce(){JQ(t)}})),ZQ=z0e;p();u();l();p();u();l();var LA=B(pe(),1);var X0e=[">=0.19.2 <1.0.0"],xA=class extends LA.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",ye,e)}init(){return new LA.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",X0e,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Ac(Wi))return Reflect.construct(n,s);let i=Reflect.construct(n,s),c=!!q()?.getOptions().sendDefaultPii,d=r.recordInputs??c,f=r.recordOutputs??c;return MO(i,{recordInputs:d,recordOutputs:f})};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var e8=X(Wi,t=>new xA(t)),Q0e=((t={})=>({name:Wi,options:t,setupOnce(){e8(t)}})),t8=Q0e;p();u();l();p();u();l();var Np=B(pe(),1);var n8=[">=0.10.0 <2"],DA=class extends Np.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",ye,e)}init(){return new Np.InstrumentationNodeModuleDefinition("@google/genai",n8,n=>this._patch(n),n=>n,[new Np.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",n8,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(Ac(Ki))return Reflect.construct(n,s);let i=Reflect.construct(n,s),c=!!q()?.getOptions().sendDefaultPii,d=r,f=d?.recordInputs??c,_=d?.recordOutputs??c;return DO(i,{recordInputs:f,recordOutputs:_})};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return mf(e,"GoogleGenAI",o),e}};var r8=X(Ki,t=>new DA(t)),J0e=((t={})=>({name:Ki,setupOnce(){r8(t)}})),o8=J0e;p();u();l();p();u();l();var ya=B(pe(),1);var wA=[">=0.1.0 <2.0.0"];function Z0e(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function ewe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,d=Z0e(c,e);return a.callbacks=d,Reflect.apply(r,o,s)}})}var UA=class extends ya.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",ye,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new ya.InstrumentationNodeModuleDefinition(r,wA,this._patch.bind(this),o=>o,[new ya.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,wA,this._patch.bind(this),o=>o)]));return e.push(new ya.InstrumentationNodeModuleDefinition("langchain",wA,this._patch.bind(this),r=>r,[new ya.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",wA,this._patch.bind(this),r=>r)])),e}_patch(e){iO([Yi,Wi,Ki]);let r=!!q()?.getOptions().sendDefaultPii,o=this.getConfig(),s=o?.recordInputs??r,i=o?.recordOutputs??r,a=JE({recordInputs:s,recordOutputs:i});return this._patchRunnableMethods(e,a),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype,a=["invoke","stream","batch"];for(let c of a){let d=i[c];typeof d=="function"&&(i[c]=ewe(d,n))}}};var s8=X(QE,t=>new UA(t)),twe=((t={})=>({name:QE,setupOnce(){s8(t)}})),i8=twe;p();u();l();p();u();l();var Op=B(pe(),1);var a8=[">=0.0.0 <2.0.0"],kA=class extends Op.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",ye,e)}init(){return new Op.InstrumentationNodeModuleDefinition("@langchain/langgraph",a8,this._patch.bind(this),n=>n,[new Op.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",a8,this._patch.bind(this),n=>n)])}_patch(e){let r=!!q()?.getOptions().sendDefaultPii,o=this.getConfig(),s=o.recordInputs??r,i=o.recordOutputs??r,a={recordInputs:s,recordOutputs:i};if(e.StateGraph&&typeof e.StateGraph=="function"){let c=e.StateGraph;c.prototype.compile=kO(c.prototype.compile,a)}return e}};var c8=X(ZE,t=>new kA(t)),nwe=((t={})=>({name:ZE,setupOnce(){c8(t)}})),u8=nwe;p();u();l();p();u();l();var E8=B(pe(),1);p();u();l();var p8=B(require("node:net"),1);D();var Xs=B(pe(),1);Re();function d8(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=f=>{(0,Xs.safeExecuteInTheMiddle)(()=>a(f),_=>{_&&xn.error(_?.message)},!0)});let c=new Xs.InstrumentationNodeModuleDefinition("@firebase/firestore",e,f=>l8(f,n,r,t,i)),d=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let f of d)c.files.push(new Xs.InstrumentationNodeModuleFile(f,e,_=>l8(_,n,r,t,i),_=>f8(_,r)));return c}function l8(t,e,n,r,o){return f8(t,n),e(t,"addDoc",rwe(r,o)),e(t,"getDocs",swe(r,o)),e(t,"setDoc",iwe(r,o)),e(t,"deleteDoc",owe(r,o)),t}function f8(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xs.isWrapped)(t[n])&&e(t,n);return t}function rwe(t,e){return function(r){return function(o,s){let i=GA(t,"addDoc",o);return e(i),BA(i,()=>r(o,s))}}}function owe(t,e){return function(r){return function(o){let s=GA(t,"deleteDoc",o.parent||o);return e(s),BA(s,()=>r(o))}}}function swe(t,e){return function(r){return function(o){let s=GA(t,"getDocs",o);return e(s),BA(s,()=>r(o))}}}function iwe(t,e){return function(r){return function(o,s,i){let a=GA(t,"setDoc",o.parent||o);return e(a),BA(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function BA(t,e){return V.with(ce.setSpan(V.active(),t),()=>(0,Xs.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function GA(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:$e.CLIENT});return cwe(r,n),r.setAttribute(Cu,e),r}function awe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(p8.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function cwe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[pI]:e.path,[md]:n.name,[gi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=awe(s);a&&(i[hd]=a),c&&(i[Ed]=c),t.setAttributes(i)}p();u();l();D();var Qs=B(pe(),1);function _8(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,d=o.functions?.responseHook;typeof d=="function"&&(i=(m,E)=>{(0,Qs.safeExecuteInTheMiddle)(()=>d(m,E),T=>{T&&xn.error(T?.message)},!0)}),typeof c=="function"&&(s=m=>{(0,Qs.safeExecuteInTheMiddle)(()=>c(m),E=>{E&&xn.error(E?.message)},!0)});let f=new Qs.InstrumentationNodeModuleDefinition("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:m,triggerType:E})=>{f.files.push(new Qs.InstrumentationNodeModuleFile(m,e,T=>uwe(T,n,r,t,{requestHook:s,responseHook:i,errorHook:a},E),T=>m8(T,r)))}),f}function Yn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...d){let f=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",_=t.startSpan(`firebase.function.${n}`,{kind:$e.SERVER}),m={"faas.name":f,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(m["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(m["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),_.setAttributes(m),e?.requestHook?.(_),V.with(ce.setSpan(V.active(),_),async()=>{let E,T;try{T=await i.apply(this,d)}catch(S){E=S}if(e?.responseHook?.(_,E),E&&_.recordException(E),_.end(),E)throw await e?.errorHook?.(_,E),E;return T})};return a?o.call(this,a,c):o.call(this,c)}}}function uwe(t,e,n,r,o,s){switch(m8(t,n),s){case"function":e(t,"onRequest",Yn(r,o,"http.request")),e(t,"onCall",Yn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Yn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Yn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Yn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Yn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Yn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Yn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Yn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Yn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Yn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Yn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Yn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Yn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Yn(r,o,"storage.object.metadataUpdated"));break}return t}function m8(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Qs.isWrapped)(t[r])&&e(t,r);return t}var h8={},lwe=[">=3.0.0 <5"],pwe=[">=6.0.0 <7"],jA=class extends E8.InstrumentationBase{constructor(e=h8){super("@sentry/instrumentation-firebase",ye,e)}setConfig(e={}){super.setConfig({...h8,...e})}init(){let e=[];return e.push(d8(this.tracer,lwe,this._wrap,this._unwrap,this.getConfig())),e.push(_8(this.tracer,pwe,this._wrap,this._unwrap,this.getConfig())),e}};var g8="Firebase",dwe={firestoreSpanCreationHook:t=>{we(t,"auto.firebase.otel.firestore"),t.setAttribute(de,"db.query")},functions:{requestHook:t=>{we(t,"auto.firebase.otel.functions"),t.setAttribute(de,"http.request")},errorHook:async(t,e)=>{e&&(fe(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await OE(2e3))}}},T8=X(g8,()=>new jA(dwe)),fwe=(()=>({name:g8,setupOnce(){T8()}})),S8=fwe;p();u();l();p();u();l();function A8(){return[rz(),Hz(),f5(),HX(),Q5(),p9(),R9(),L9(),u6(),P6(),NX(),BX(),nQ(),_Q(),bQ(),wQ(),P5(),KQ(),G5(),i8(),u8(),QQ(),ZQ(),t8(),o8(),L6(),S8()]}p();u();l();D();var HA=B(Sb(),1),R8=B(qb(),1);Re();var dM=1e6;function y8(t,e={}){t.getOptions().debug&&TC();let[n,r]=_we(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function _we(t,e={}){let n=new R8.BasicTracerProvider({sampler:new ET(t),resource:(0,HA.defaultResource)().merge((0,HA.resourceFromAttributes)({[_r]:"node",[lI]:"sentry",[dI]:ye})),forceFlushTimeoutMillis:500,spanProcessors:[new hT({timeout:mwe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});ce.setGlobalTracerProvider(n),Ln.setGlobalPropagator(new mT);let r=new gC;return V.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function mwe(t){if(t!=null){if(t>dM)return dt&&I.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${dM}`),dM;if(t<=0||Number.isNaN(t)){dt&&I.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function I8(){return LT().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(Vf(),$3())}function N8(t){return[...I8(),...yt(t)?A8():[]]}function fM(t={}){return hwe(t,N8)}function hwe(t={},e){Rc(t,"node");let n=yC({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(y8(n,{spanProcessors:t.openTelemetrySpanProcessors}),IC()),n}p();u();l();var O8="https://1188a86f3f8168f089450587b00bca66@o1.ingest.us.sentry.io/4510776311808000";async function b8(t){let e=process.env.SENTRY_CLI_NO_TELEMETRY!=="1",n=gwe(e);if(!n?.getOptions().enabled)return t();il(),CE();try{return await gr({name:"cli-execution",op:"cli.command"},async()=>t())}catch(r){fe(r);let o=Me().getSession();throw o&&(o.status="crashed"),r}finally{wi();try{await n.flush(3e3)}catch{}}}function gwe(t){let r=fM({dsn:O8,enabled:t,defaultIntegrations:!1,integrations:[Vf()],environment:"production",tracesSampleRate:1,sampleRate:1,release:"0.3.2",tracePropagationTargets:[],beforeSendTransaction:o=>(o.server_name=void 0,o),beforeSend:o=>{let s=process.env.HOME||process.env.USERPROFILE;for(let i of o.exception?.values??[])if(i.stacktrace?.frames)for(let a of i.stacktrace.frames)a.filename&&s&&(a.filename=a.filename.replace(s,"~"));return o.server_name=void 0,o}});if(r?.getOptions().enabled){Di("platform",process.platform),Di("arch",process.arch);let o=typeof process.versions.bun<"u"?"bun":"node";Di("runtime",o),Di("runtime.version",process.version)}return r}function C8(t){let e=qr();e&&e.updateName(t),Di("command",t)}function M8(t){let e={process:t,env:t.env,cwd:t.cwd(),homeDir:(0,P8.homedir)(),configDir:si(),stdout:t.stdout,stderr:t.stderr,stdin:t.stdin};return{...e,forCommand:({prefix:n})=>(C8(n.join(".")),e)}}$t();p();u();l();ii();var Twe=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557"," \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D"," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u255A\u2588\u2588\u2588\u2588\u2554\u255D "," \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u255A\u2588\u2588\u2554\u255D "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 "," \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D "],Swe=["#B4A4DE","#9C84D4","#8468C8","#6C4EBA","#5538A8","#432B8A"];function Awe(){return Twe.map((t,e)=>{let n=Swe[e]??"#B4A4DE";return Dr.hex(n)(t)}).join(`
483
+ >>> no match, partial?`,e,m,n,E),m===c))}let S;if(typeof f=="string"?(S=_===f,this.debug("string match",f,_,S)):(S=f.test(_),this.debug("pattern match",f,_,S)),!S)return!1}if(i===c&&a===d)return!0;if(i===c)return r;if(a===d)return i===c-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return Cz(this.pattern,this.options)}parse(e){zf(e);let n=this.options;if(e==="**")return Jr;if(e==="")return"";let r,o=null;(r=e.match(PMe))?o=n.dot?vMe:MMe:(r=e.match(TMe))?o=(n.nocase?n.dot?yMe:RMe:n.dot?AMe:SMe)(r[1]):(r=e.match(xMe))?o=(n.nocase?n.dot?DMe:LMe:n.dot?wMe:UMe)(r):(r=e.match(IMe))?o=n.dot?OMe:NMe:(r=e.match(bMe))&&(o=CMe);let s=Gl.fromGlob(e,this.options).toMMPattern();return o&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?GMe:n.dot?jMe:HMe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let d=c.map(f=>{if(f instanceof RegExp)for(let _ of f.flags.split(""))o.add(_);return typeof f=="string"?YMe(f):f===Jr?Jr:f._src});return d.forEach((f,_)=>{let m=d[_+1],E=d[_-1];f!==Jr||E===Jr||(E===void 0?m!==void 0&&m!==Jr?d[_+1]="(?:\\/|"+r+"\\/)?"+m:d[_]=r:m===void 0?d[_-1]=E+"(?:\\/|"+r+")?":m!==Jr&&(d[_-1]=E+"(?:\\/|\\/"+r+"\\/)"+m,d[_+1]=Jr))}),d.filter(f=>f!==Jr).join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let o=this.slashSplit(e);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let i=o[o.length-1];if(!i)for(let a=o.length-2;!i&&a>=0;a--)i=o[a];for(let a=0;a<s.length;a++){let c=s[a],d=o;if(r.matchBase&&c.length===1&&(d=[i]),this.matchOne(d,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return on.defaults(e).Minimatch}};on.AST=Gl;on.Minimatch=jl;on.escape=DC;on.unescape=ta;var Pz="@fastify/otel",KMe="0.8.0",zMe=">=4.0.0 <6",Mz=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Ke={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},na={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},Fs="anonymous",Hn=Symbol("fastify otel instance"),ra=Symbol("fastify otel request spans"),Qf=Symbol("fastify otel request context"),vz=Symbol("fastify otel addhook original"),xz=Symbol("fastify otel setnotfound original"),$T=Symbol("fastify otel ignore path"),VT=class extends Lz.InstrumentationBase{constructor(e){if(super(Pz,KMe,e),this.servername=e?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[$T]=null,this._logger=xn.createComponentLogger({namespace:Pz}),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let n=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof n!="string"||n.length===0)&&typeof n!="function")throw new TypeError("ignorePaths must be a string or a function");let r=on;this[$T]=o=>typeof n=="function"?n(o):r(o.url,n)}}enable(){if(this._handleInitialization===void 0&&this.getConfig().registerOnInitialization){let e=this.plugin();this._handleInitialization=n=>{n.fastify.register(e)},wC.default.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){return this._handleInitialization&&(wC.default.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",n[Symbol.for("plugin-meta")]={fastify:zMe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate(Hn,e),r.decorate(vz,r.addHook),r.decorate(xz,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let m=this[Qf];return{span:this[ra],tracer:e.tracer,context:m,inject:(T,S)=>Ln.inject(m,T,S),extract:(T,S)=>Ln.extract(m,T,S)}}),r.decorateRequest(ra,null),r.decorateRequest(Qf,null),r.addHook("onRoute",function(_){if(e[$T]?.(_)===!0){e._logger.debug(`Ignoring route instrumentation ${_.method} ${_.url} because it matches the ignore path`);return}for(let m of Mz)if(_[m]!=null){let E=_[m];if(typeof E=="function")_[m]=f(E,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Ke.FASTIFY_TYPE]:na.ROUTE,[Qn]:_.url,[Ke.HOOK_CALLBACK_NAME]:E.name?.length>0?E.name:Fs});else if(Array.isArray(E)){let T=[];for(let S of E)T.push(f(S,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Ke.FASTIFY_TYPE]:na.ROUTE,[Qn]:_.url,[Ke.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:Fs}));_[m]=T}}_.onSend!=null?_.onSend=Array.isArray(_.onSend)?[..._.onSend,i]:[_.onSend,i]:_.onSend=i,_.onError!=null?_.onError=Array.isArray(_.onError)?[..._.onError,a]:[_.onError,a]:_.onError=a,_.handler=f(_.handler,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - route-handler`,[Ke.FASTIFY_TYPE]:na.HANDLER,[Qn]:_.url,[Ke.HOOK_CALLBACK_NAME]:_.handler.name.length>0?_.handler.name:Fs})}),r.addHook("onRequest",function(_,m,E){if(this[Hn].isEnabled()===!1)return E();if(this[Hn][$T]?.({url:_.url,method:_.method})===!0)return this[Hn]._logger.debug(`Ignoring request ${_.method} ${_.url} because it matches the ignore path`),E();let T=V.active();ce.getSpan(T)==null&&(T=Ln.extract(T,_.headers));let S=(0,qT.getRPCMetadata)(T);_.routeOptions.url!=null&&S?.type===qT.RPCType.HTTP&&(S.route=_.routeOptions.url);let R=this[Hn].tracer.startSpan("request",{attributes:{[_r]:r[Hn].servername,[Ke.ROOT]:"@fastify/otel",[Qn]:_.url,[Cs]:_.method}},T);_[Qf]=ce.setSpan(T,R),_[ra]=R,V.with(_[Qf],()=>{E()})}),r.addHook("onResponse",function(_,m,E){let T=_[ra];T!=null&&(T.setStatus({code:Ze.OK,message:"OK"}),T.setAttributes({[Wo]:404}),T.end()),_[ra]=null,E()}),r.addHook=c,r.setNotFoundHandler=d,s();function i(_,m,E,T){let S=_[ra];S!=null&&(m.statusCode<500&&S.setStatus({code:Ze.OK,message:"OK"}),S.setAttributes({[Wo]:m.statusCode}),S.end()),_[ra]=null,T(null,E)}function a(_,m,E,T){let S=_[ra];S!=null&&(S.setStatus({code:Ze.ERROR,message:E.message}),S.recordException(E)),T()}function c(_,m){let E=this[vz];return Mz.includes(_)?E.call(this,_,f(m,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - ${_}`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:m.name?.length>0?m.name:Fs})):E.call(this,_,m)}function d(_,m){let E=this[xz];typeof _=="function"?(m=f(_,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:Fs}),E.call(this,m)):(_.preValidation!=null&&(_.preValidation=f(_.preValidation,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:Fs})),_.preHandler!=null&&(_.preHandler=f(_.preHandler,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:Fs})),m=f(m,{[_r]:r[Hn].servername,[Ke.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Ke.FASTIFY_TYPE]:na.INSTANCE,[Ke.HOOK_CALLBACK_NAME]:m.name?.length>0?m.name:Fs}),E.call(this,_,m))}function f(_,m={}){return function(...T){let S=this[Hn],[R]=T;if(S.isEnabled()===!1)return _.call(this,...T);let N=R[Qf]??V.active(),y=S.tracer.startSpan(`handler - ${_.name?.length>0?_.name:this.pluginName??Fs}`,{attributes:m},N);return V.with(ce.setSpan(N,y),function(){try{let P=_.call(this,...T);return typeof P?.then=="function"?P.then(M=>(y.end(),M),M=>(y.setStatus({code:Ze.ERROR,message:M.message}),y.recordException(M),y.end(),Promise.reject(M))):(y.end(),P)}catch(P){throw y.setStatus({code:Ze.ERROR,message:P.message}),y.recordException(P),y.end(),P}},this)}}}}};p();u();l();D();var KT=B(De(),1),Gc=B(pe(),1);Re();p();u();l();var $s;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($s||($s={}));var Jf;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(Jf||(Jf={}));var Zf;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(Zf||(Zf={}));p();u();l();D();p();u();l();var e_=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function UC(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[e_]||[];return s.push(o),Object.defineProperty(t,e_,{enumerable:!1,configurable:!0,value:s}),o}function YT(t,e){let n=t[e_]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Ze.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[e_])}function wz(t,e,n){let r,o;try{o=t(),Dz(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!Dz(o)&&(e(r,o),r))throw r;return o}}function Dz(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var XMe="0.1.0",QMe="@sentry/instrumentation-fastify-v3",Uz="anonymous",JMe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),WT=class extends Gc.InstrumentationBase{constructor(e={}){super(QMe,XMe,e)}init(){return[new Gc.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,KT.getRPCMetadata)(V.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===KT.RPCType.HTTP&&(a.route=c);let d=r.method||"GET";Ie().setTransactionName(`${d} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||Uz,c=`${Zf.MIDDLEWARE} - ${a}`,d=i[1],f=UC(d,s.tracer,c,{[$s.FASTIFY_TYPE]:Jf.MIDDLEWARE,[$s.PLUGIN_NAME]:e,[$s.HOOK_NAME]:n}),_=o&&i[i.length-1];return _&&(i[i.length-1]=function(...m){YT(d),_.apply(this,m)}),V.with(ce.setSpan(V.active(),f),()=>wz(()=>r.apply(this,i),m=>{m instanceof Error&&(f.setStatus({code:Ze.ERROR,message:m.message}),f.recordException(m)),o||YT(d)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!JMe.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),ZMe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,Gc.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),YT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,d=`${Zf.REQUEST_HANDLER} - ${c||this.pluginName||Uz}`,f={[$s.PLUGIN_NAME]:this.pluginName,[$s.FASTIFY_TYPE]:Jf.REQUEST_HANDLER,[iI]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(f[$s.FASTIFY_NAME]=c);let _=UC(o,e.tracer,d,f);kz(_);let{requestHook:m}=e.getConfig();return m&&(0,Gc.safeExecuteInTheMiddle)(()=>m(_,{request:r}),E=>{E&&e._diag.error("request hook failed",E)},!0),V.with(ce.setSpan(V.active(),_),()=>{s()})}}};function ZMe(){let t=q();t&&t.on("spanStart",e=>{kz(e)})}function kz(t){let e=oe(t).data,n=e["fastify.type"];if(e[de]||!n)return;t.setAttributes({[le]:"auto.http.otel.fastify",[de]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var zT="Fastify",Gz=X(`${zT}.v3`,()=>new WT);function eve(){let t=q();if(t)return t.getIntegrationByName(zT)}function Bz(t,e,n,r){let o=eve()?.getShouldHandleError()||Fz;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){dt&&I.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&fe(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var jz=X(`${zT}.v5`,()=>{let t=new VT,e=t.plugin();return kC.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?dt&&I.error("Failed to setup Fastify instrumentation",o):(nve(),r&&rve(r))})}),kC.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;Bz.call(Bz,r,o,s,"diagnostics-channel")}),t}),tve=(({shouldHandleError:t})=>{let e;return{name:zT,setupOnce(){e=t||Fz,Gz(),jz()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}}),Hz=(t={})=>tve(t);function Fz(t,e,n){let r=n.statusCode;return r>=500||r<=299}function $z(t){let e=oe(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[de]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request-handler":"<unknown>";t.setAttributes({[le]:"auto.http.otel.fastify",[de]:`${c}.fastify`});let d=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof d=="string"){let f=d.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(f)}}function nve(){let t=q();t&&t.on("spanStart",e=>{$z(e)})}function rve(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&$z(s)}let r=e.routeOptions?.url,o=e.method||"GET";Ie().setTransactionName(`${o} ${r}`)})}p();u();l();D();var l5=B(u5(),1);var p5="Graphql",d5=X(p5,l5.GraphQLInstrumentation,t=>{let e=_5(t);return{...e,responseHook(n,r){we(n,"auto.graphql.otel.graphql"),r.errors?.length&&!oe(n).status&&n.setStatus({code:Ze.ERROR});let s=oe(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=ut(n),f=oe(c).data[Ml]||[],_=a?`${i} ${a}`:`${i}`;Array.isArray(f)?(f.push(_),c.setAttribute(Ml,f)):typeof f=="string"?c.setAttribute(Ml,[f,_]):c.setAttribute(Ml,_),oe(c).data["original-description"]||c.setAttribute("original-description",oe(c).description),c.updateName(`${oe(c).data["original-description"]} (${Ive(f)})`)}}}}),yve=((t={})=>({name:p5,setupOnce(){d5(_5(t))}})),f5=yve;function _5(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function Ive(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}p();u();l();var O5=B(N5(),1);var b5="Kafka",C5=X(b5,()=>new O5.KafkaJsInstrumentation({consumerHook(t){we(t,"auto.kafkajs.otel.consumer")},producerHook(t){we(t,"auto.kafkajs.otel.producer")}})),Ove=(()=>({name:b5,setupOnce(){C5()}})),P5=Ove;p();u();l();var U5=B(w5(),1);var k5="LruMemoizer",B5=X(k5,()=>new U5.LruMemoizerInstrumentation),Cve=(()=>({name:k5,setupOnce(){B5()}})),G5=Cve;p();u();l();var K5=B(W5(),1);var z5="Mongo",X5=X(z5,()=>new K5.MongoDBInstrumentation({dbStatementSerializer:Lve,responseHook(t){we(t,"auto.db.otel.mongo")}}));function Lve(t){let e=YC(t);return JSON.stringify(e)}function YC(t){if(Array.isArray(t))return t.map(e=>YC(e));if(Dve(t)){let e={};return Object.entries(t).map(([n,r])=>[n,YC(r)]).reduce((n,r)=>(Uve(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function Dve(t){return typeof t=="object"&&t!==null&&!wve(t)}function wve(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function Uve(t){return Array.isArray(t)}var kve=(()=>({name:z5,setupOnce(){X5()}})),Q5=kve;p();u();l();var c9=B(a9(),1);var u9="Mongoose",l9=X(u9,()=>new c9.MongooseInstrumentation({responseHook(t){we(t,"auto.db.otel.mongoose")}})),Yve=(()=>({name:u9,setupOnce(){l9()}})),p9=Yve;p();u();l();var T9=B(g9(),1);var S9="Mysql",A9=X(S9,()=>new T9.MySQLInstrumentation({})),nxe=(()=>({name:S9,setupOnce(){A9()}})),R9=nxe;p();u();l();var M9=B(P9(),1);var v9="Mysql2",x9=X(v9,()=>new M9.MySQL2Instrumentation({responseHook(t){we(t,"auto.db.otel.mysql2")}})),Exe=(()=>({name:v9,setupOnce(){x9()}})),L9=Exe;p();u();l();var s6=B(H9(),1),i6=B(e6(),1);p();u();l();var Uxe=["get","set","setex"],fP=["get","mget"],kxe=["set","setex"];function __(t,e){return t.includes(e.toLowerCase())}function _P(t){return __(fP,t)?"cache.get":__(kxe,t)?"cache.put":void 0}function Bxe(t,e){return e.some(n=>t.startsWith(n))}function n6(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?t6(o.map(s=>n(s))):["<unknown>"],r=e[0];return __(Uxe,t)&&r!=null?n(r):t6(e.map(o=>n(o)))}catch{return}}function r6(t,e,n){if(!_P(t))return!1;for(let r of e)if(Bxe(r,n))return!0;return!1}function o6(t){let e=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function t6(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var xS="Redis",m_={},a6=(t,e,n,r)=>{t.setAttribute(le,"auto.db.otel.redis");let o=n6(e,n),s=_P(e);if(!o||!s||!m_.cachePrefixes||!r6(e,o,m_.cachePrefixes))return;let i=oe(t).data["net.peer.name"],a=oe(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=o6(r);c&&t.setAttribute(kN,c),__(fP,e)&&c!==void 0&&t.setAttribute(wN,c>0),t.setAttributes({[de]:s,[UN]:o});let d=o.join(", ");t.updateName(m_.maxCacheKeyLength?Ni(d,m_.maxCacheKeyLength):d)},Gxe=X(`${xS}.IORedis`,()=>new s6.IORedisInstrumentation({responseHook:a6})),jxe=X(`${xS}.Redis`,()=>new i6.RedisInstrumentation({responseHook:a6})),c6=Object.assign(()=>{Gxe(),jxe()},{id:xS}),Hxe=((t={})=>({name:xS,setupOnce(){m_=t,c6()}})),u6=Hxe;p();u();l();var O6=B(N6(),1);var b6="Postgres",C6=X(b6,()=>new O6.PgInstrumentation({requireParentSpan:!0,requestHook(t){we(t,"auto.db.otel.postgres")}})),nLe=(()=>({name:b6,setupOnce(){C6()}})),P6=nLe;p();u();l();D();var Ks=B(pe(),1);Re();var jS="PostgresJs",M6=[">=3.0.0 <4"],rLe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,GS=Symbol("sentryPostgresConnectionContext"),SP=Symbol.for("sentry.instrumented.postgresjs"),v6=Symbol.for("sentry.query.from.instrumented.sql"),x6=X(jS,t=>new AP({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),AP=class extends Ks.InstrumentationBase{constructor(e){super("sentry-postgres-js",ye,e)}init(){let e=new Ks.InstrumentationNodeModuleDefinition("postgres",M6,n=>{try{return this._patchPostgres(n)}catch(r){return dt&&I.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new Ks.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,M6,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return dt&&I.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);return!a||typeof a!="function"?(dt&&I.warn("postgres() did not return a valid instance"),a):o._instrumentSqlInstance(a)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(mf(e,"default",s),e)}_wrapQueryMethod(e,n,r){let o=this;return function(...s){let i=Reflect.apply(e,n,s);return i&&typeof i=="object"&&"handle"in i&&o._wrapSingleQueryHandle(i,r),i}}_wrapCallbackMethod(e,n,r){let o=this;return function(...s){let i=r[GS];if(!(typeof s[s.length-1]=="function")){let _=Reflect.apply(e,n,s);return _&&typeof _.then=="function"?_.then(m=>o._instrumentSqlInstance(m,i)):_}let c=s.length===1?s[0]:s[1],d=function(_){let m=o._instrumentSqlInstance(_,i);return c(m)},f=s.length===1?[d]:[s[0],d];return Reflect.apply(e,n,f)}}_setConnectionAttributes(e,n){if(n&&(n.ATTR_DB_NAMESPACE&&e.setAttribute(md,n.ATTR_DB_NAMESPACE),n.ATTR_SERVER_ADDRESS&&e.setAttribute(hd,n.ATTR_SERVER_ADDRESS),n.ATTR_SERVER_PORT!==void 0)){let r=parseInt(n.ATTR_SERVER_PORT,10);isNaN(r)||e.setAttribute(Ed,r)}}_setOperationName(e,n,r){if(r){e.setAttribute(Cu,r);return}let o=n?.match(rLe);o?.[1]&&e.setAttribute(Cu,o[1].toUpperCase())}_attachConnectionContext(e,n){let r=e;if(!r.options||typeof r.options!="object")return;let o=r.options,s=o.host?.[0]||"localhost",i=o.port?.[0]||5432,a={ATTR_DB_NAMESPACE:typeof o.database=="string"&&o.database!==""?o.database:void 0,ATTR_SERVER_ADDRESS:s,ATTR_SERVER_PORT:String(i)};n[GS]=a}_instrumentSqlInstance(e,n){if(e[SP])return e;let r=this,o=new Proxy(e,{apply(s,i,a){let c=Reflect.apply(s,i,a);return c&&typeof c=="object"&&"handle"in c&&r._wrapSingleQueryHandle(c,o),c},get(s,i){let a=s[i];return typeof i!="string"||typeof a!="function"?a:i==="unsafe"||i==="file"?r._wrapQueryMethod(a,s,o):i==="begin"||i==="reserve"?r._wrapCallbackMethod(a,s,o):a}});return n?o[GS]=n:this._attachConnectionContext(e,o),e[SP]=!0,o[SP]=!0,o}_wrapSingleQueryHandle(e,n){if(e.handle?.__sentryWrapped)return;e[v6]=!0;let r=e.handle,o=this,s=async function(...i){if(!o._shouldCreateSpans())return r.apply(this,i);let a=o._reconstructQuery(e.strings),c=o._sanitizeSqlQuery(a);return tn({name:c||"postgresjs.query",op:"db"},d=>{we(d,"auto.db.postgresjs"),d.setAttributes({[gi]:"postgres",[oh]:c});let f=n?n[GS]:void 0;o._setConnectionAttributes(d,f);let _=o.getConfig(),{requestHook:m}=_;m&&(0,Ks.safeExecuteInTheMiddle)(()=>m(d,c,f),T=>{T&&(d.setAttribute("sentry.hook.error","requestHook failed"),dt&&I.error(`Error in requestHook for ${jS} integration:`,T))},!0);let E=this;E.resolve=new Proxy(E.resolve,{apply:(T,S,R)=>{try{o._setOperationName(d,c,R?.[0]?.command),d.end()}catch(N){dt&&I.error("Error ending span in resolve callback:",N)}return Reflect.apply(T,S,R)}}),E.reject=new Proxy(E.reject,{apply:(T,S,R)=>{try{d.setStatus({code:2,message:R?.[0]?.message||"unknown_error"}),d.setAttribute(sh,R?.[0]?.code||"unknown"),d.setAttribute(ih,R?.[0]?.name||"unknown"),o._setOperationName(d,c),d.end()}catch(N){dt&&I.error("Error ending span in reject callback:",N)}return Reflect.apply(T,S,R)}});try{return r.apply(this,i)}catch(T){throw d.setStatus({code:2,message:T instanceof Error?T.message:"unknown_error"}),d.end(),T}})};s.__sentryWrapped=!0,e.handle=s}_shouldCreateSpans(){let e=this.getConfig();return ce.getSpan(V.active())!==void 0||!e.requireParentSpan}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_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 n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[v6])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return tn({name:i||"postgresjs.query",op:"db"},a=>{we(a,"auto.db.postgresjs"),a.setAttributes({[gi]:"postgres",[oh]:i});let c=n.getConfig(),{requestHook:d}=c;d&&(0,Ks.safeExecuteInTheMiddle)(()=>d(a,i,void 0),m=>{m&&(a.setAttribute("sentry.hook.error","requestHook failed"),dt&&I.error(`Error in requestHook for ${jS} integration:`,m))},!0);let f=this.resolve;this.resolve=new Proxy(f,{apply:(m,E,T)=>{try{n._setOperationName(a,i,T?.[0]?.command),a.end()}catch(S){dt&&I.error("Error ending span in resolve callback:",S)}return Reflect.apply(m,E,T)}});let _=this.reject;this.reject=new Proxy(_,{apply:(m,E,T)=>{try{a.setStatus({code:2,message:T?.[0]?.message||"unknown_error"}),a.setAttribute(sh,T?.[0]?.code||"unknown"),a.setAttribute(ih,T?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(S){dt&&I.error("Error ending span in reject callback:",S)}return Reflect.apply(m,E,T)}});try{return r.apply(this,o)}catch(m){throw a.setStatus({code:2,message:m instanceof Error?m.message:"unknown_error"}),a.end(),m}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},oLe=(t=>({name:jS,setupOnce(){x6(t)}})),L6=oLe;p();u();l();D();p();u();l();D();var cA=B(hX(),1);D();var NDe={name:"@prisma/instrumentation-contract",version:"7.2.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},ODe=NDe.version.split(".")[0],qP="PRISMA_INSTRUMENTATION",YP=`V${ODe}_PRISMA_INSTRUMENTATION`,dp=globalThis;function bDe(){let t=dp[YP];return t?.helper?t.helper:dp[qP]?.helper}function CDe(t){let e={helper:t};dp[YP]=e,dp[qP]=e}function PDe(){delete dp[YP],delete dp[qP]}var MDe=process.env.PRISMA_SHOW_ALL_TRACES==="true",vDe="00-10-10-00";function xDe(t){switch(t){case"client":return $e.CLIENT;case"internal":default:return $e.INTERNAL}}var LDe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=ce.getSpanContext(t??V.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:vDe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)TX(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return V.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!MDe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(SX(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return EX(s,e(s,r))}return n.startActiveSpan(o,t,s=>EX(s,e(s,r)))}};function TX(t,e,n,r,o){if(SX(e.name,o))return;let s={attributes:e.attributes,kind:xDe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let d=r.get(c);return d?{context:{spanId:d,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)TX(t,c,n,r,o);i.end(e.endTime)})}function EX(t,e){return DDe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function DDe(t){return t!=null&&typeof t.then=="function"}function SX(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var AX={name:"@prisma/instrumentation",version:"7.2.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},gX=AX.version,wDe=AX.name,UDe="@prisma/client",RX=class extends cA.InstrumentationBase{tracerProvider;constructor(t={}){super(wDe,gX,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new cA.InstrumentationNodeModuleDefinition(UDe,[gX])]}enable(){let t=this._config;CDe(new LDe({tracerProvider:this.tracerProvider??ce.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){PDe()}isEnabled(){return bDe()!==void 0}};var yX="Prisma";function kDe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function IX(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var WP=class extends RX{constructor(){super()}enable(){super.enable();let e=IX();kDe(e)&&(e.createEngineSpan=n=>{let r=ce.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Rt(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=BDe(s.kind),a=s.parent_span_id,c=s.span_id,d=s.trace_id,f=s.links?.map(m=>({context:{traceId:m.trace_id,spanId:m.span_id,traceFlags:vn.SAMPLED}})),_=ce.setSpanContext(V.active(),{traceId:d,spanId:a,traceFlags:vn.SAMPLED});V.with(_,()=>{let m={generateTraceId:()=>d,generateSpanId:()=>c};r._idGenerator=m,r.startSpan(s.name,{kind:i,links:f,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function BDe(t){switch(t){case"client":return $e.CLIENT;case"internal":default:return $e.INTERNAL}}var GDe=X(yX,t=>new WP),NX=t=>({name:yX,setupOnce(){GDe()},setup(e){IX()&&e.on("spanStart",n=>{let r=oe(n);r.description?.startsWith("prisma:")&&n.setAttribute(le,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});p();u();l();var wX=B(DX(),1);var UX="Hapi",kX=X(UX,()=>new wX.HapiInstrumentation),JDe=(()=>({name:UX,setupOnce(){kX()}})),BX=JDe;p();u();l();Re();p();u();l();var _a={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},P_={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};p();u();l();D();var dA=B(pe(),1);var ZDe="@sentry/instrumentation-hono",e0e="0.0.1",pA=class extends dA.InstrumentationBase{constructor(e={}){super(ZDe,e0e,e)}init(){return[new dA.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return V.with(ce.setSpan(V.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(kn(a))return a.then(c=>{let d=n._determineHandlerType(c);return i.setAttributes({[_a.HONO_TYPE]:d,[_a.HONO_NAME]:d===P_.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[_a.HONO_TYPE]:c,[_a.HONO_NAME]:c===P_.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return kn(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?P_.MIDDLEWARE:P_.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Ze.ERROR,message:n.message}),e.recordException(n))}};var GX="Hono";function t0e(t){let e=oe(t).data,n=e[_a.HONO_TYPE];if(e[de]||!n)return;t.setAttributes({[le]:"auto.http.otel.hono",[de]:`${n}.hono`});let r=e[_a.HONO_NAME];if(typeof r=="string"&&t.updateName(r),Ie()===Fr()){dt&&I.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Qn],s=e[Cs];typeof o=="string"&&typeof s=="string"&&Ie().setTransactionName(`${s} ${o}`)}var jX=X(GX,()=>new pA({responseHook:t=>{t0e(t)}})),n0e=(()=>({name:GX,setupOnce(){jX()}})),HX=n0e;p();u();l();var ZX=B(JX(),1);Re();var eQ="Koa",tQ=X(eQ,ZX.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){we(e,"auto.http.otel.koa");let r=oe(e).data,o=r["koa.type"];o&&e.setAttribute(de,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),Ie()===Fr()){dt&&I.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Qn],a=n.context?.request?.method?.toUpperCase()||"GET";i&&Ie().setTransactionName(`${a} ${i}`)}})),p0e=((t={})=>({name:eQ,setupOnce(){tQ(t)}})),nQ=p0e;p();u();l();var pQ=B(lQ(),1);var dQ="Connect",fQ=X(dQ,()=>new pQ.ConnectInstrumentation),A0e=(()=>({name:dQ,setupOnce(){fQ()}})),_Q=A0e;p();u();l();var IQ=B(yQ(),1);var O0e=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),NQ="Tedious",OQ=X(NQ,()=>new IQ.TediousInstrumentation({})),b0e=(()=>{let t;return{name:NQ,setupOnce(){let e=OQ();t=Ef(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=oe(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";O0e.has(s)&&n.setAttribute(le,"auto.db.otel.tedious")}))}}}),bQ=b0e;p();u();l();var xQ=B(vQ(),1);var LQ="GenericPool",DQ=X(LQ,()=>new xQ.GenericPoolInstrumentation({})),P0e=(()=>{let t;return{name:LQ,setupOnce(){let e=DQ();t=Ef(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=oe(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(le,"auto.db.otel.generic_pool")}))}}}),wQ=P0e;p();u();l();var qQ=B(VQ(),1);var YQ="Amqplib",j0e={consumeEndHook:t=>{we(t,"auto.amqplib.otel.consumer")},publishHook:t=>{we(t,"auto.amqplib.otel.publisher")}},WQ=X(YQ,()=>new qQ.AmqplibInstrumentation(j0e)),H0e=(()=>({name:YQ,setupOnce(){WQ()}})),KQ=H0e;p();u();l();p();u();l();var D_="VercelAI";p();u();l();var PA=B(pe(),1);var F0e=[">=3.0.0 <7"],zQ=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function $0e(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function V0e(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;if(Array.isArray(e.content)){for(let n of e.content)if($0e(n)){let r=OO(n.toolCallId);if(r){let o=r.spanContext();$r(s=>{s.setContext("trace",{trace_id:o.traceId,span_id:o.spanId}),s.setTag("vercel.ai.tool.name",n.toolName),s.setTag("vercel.ai.tool.callId",n.toolCallId),s.setLevel("error"),fe(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}),bO(n.toolCallId)}else $r(o=>{o.setTag("vercel.ai.tool.name",n.toolName),o.setTag("vercel.ai.tool.callId",n.toolCallId),o.setLevel("error"),fe(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}}function q0e(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var CA=class t extends PA.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",ye,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new PA.InstrumentationNodeModuleDefinition("ai",F0e,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,d=q(),f=d?.getIntegrationByName(D_),_=f?.options,m=f?!!d?.getOptions().sendDefaultPii:!1,{recordInputs:E,recordOutputs:T}=q0e(_,a,c,m);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:E,recordOutputs:T},Er(()=>Reflect.apply(o,s,i),S=>{S&&typeof S=="object"&&bt(S,"_sentry_active_span",qr())},()=>{},S=>{V0e(S)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of zQ)e[r]=n(e[r]);return e}else{let r=zQ.reduce((o,s)=>(o[s]=n(e[s]),o),{});return{...e,...r}}}};var XQ=X(D_,()=>new CA({}));function Y0e(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var W0e=((t={})=>{let e;return{name:D_,options:t,setupOnce(){e=XQ()},afterAllSetup(n){t.force??Y0e(n)?WE(n):e?.callWhenPatched(()=>WE(n))}}}),QQ=W0e;p();u();l();p();u();l();var vA=B(pe(),1);var K0e=[">=4.0.0 <7"],MA=class extends vA.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",ye,e)}init(){return new vA.InstrumentationNodeModuleDefinition("openai",K0e,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(Ac(Yi))return Reflect.construct(r,i);let a=Reflect.construct(r,i),d=!!q()?.getOptions().sendDefaultPii,f=o.recordInputs??d,_=o.recordOutputs??d;return XE(a,{recordInputs:f,recordOutputs:_})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var JQ=X(Yi,t=>new MA(t)),z0e=((t={})=>({name:Yi,setupOnce(){JQ(t)}})),ZQ=z0e;p();u();l();p();u();l();var LA=B(pe(),1);var X0e=[">=0.19.2 <1.0.0"],xA=class extends LA.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",ye,e)}init(){return new LA.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",X0e,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Ac(Wi))return Reflect.construct(n,s);let i=Reflect.construct(n,s),c=!!q()?.getOptions().sendDefaultPii,d=r.recordInputs??c,f=r.recordOutputs??c;return MO(i,{recordInputs:d,recordOutputs:f})};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var e8=X(Wi,t=>new xA(t)),Q0e=((t={})=>({name:Wi,options:t,setupOnce(){e8(t)}})),t8=Q0e;p();u();l();p();u();l();var Np=B(pe(),1);var n8=[">=0.10.0 <2"],DA=class extends Np.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",ye,e)}init(){return new Np.InstrumentationNodeModuleDefinition("@google/genai",n8,n=>this._patch(n),n=>n,[new Np.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",n8,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(Ac(Ki))return Reflect.construct(n,s);let i=Reflect.construct(n,s),c=!!q()?.getOptions().sendDefaultPii,d=r,f=d?.recordInputs??c,_=d?.recordOutputs??c;return DO(i,{recordInputs:f,recordOutputs:_})};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return mf(e,"GoogleGenAI",o),e}};var r8=X(Ki,t=>new DA(t)),J0e=((t={})=>({name:Ki,setupOnce(){r8(t)}})),o8=J0e;p();u();l();p();u();l();var ya=B(pe(),1);var wA=[">=0.1.0 <2.0.0"];function Z0e(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function ewe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,d=Z0e(c,e);return a.callbacks=d,Reflect.apply(r,o,s)}})}var UA=class extends ya.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",ye,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new ya.InstrumentationNodeModuleDefinition(r,wA,this._patch.bind(this),o=>o,[new ya.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,wA,this._patch.bind(this),o=>o)]));return e.push(new ya.InstrumentationNodeModuleDefinition("langchain",wA,this._patch.bind(this),r=>r,[new ya.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",wA,this._patch.bind(this),r=>r)])),e}_patch(e){iO([Yi,Wi,Ki]);let r=!!q()?.getOptions().sendDefaultPii,o=this.getConfig(),s=o?.recordInputs??r,i=o?.recordOutputs??r,a=JE({recordInputs:s,recordOutputs:i});return this._patchRunnableMethods(e,a),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype,a=["invoke","stream","batch"];for(let c of a){let d=i[c];typeof d=="function"&&(i[c]=ewe(d,n))}}};var s8=X(QE,t=>new UA(t)),twe=((t={})=>({name:QE,setupOnce(){s8(t)}})),i8=twe;p();u();l();p();u();l();var Op=B(pe(),1);var a8=[">=0.0.0 <2.0.0"],kA=class extends Op.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",ye,e)}init(){return new Op.InstrumentationNodeModuleDefinition("@langchain/langgraph",a8,this._patch.bind(this),n=>n,[new Op.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",a8,this._patch.bind(this),n=>n)])}_patch(e){let r=!!q()?.getOptions().sendDefaultPii,o=this.getConfig(),s=o.recordInputs??r,i=o.recordOutputs??r,a={recordInputs:s,recordOutputs:i};if(e.StateGraph&&typeof e.StateGraph=="function"){let c=e.StateGraph;c.prototype.compile=kO(c.prototype.compile,a)}return e}};var c8=X(ZE,t=>new kA(t)),nwe=((t={})=>({name:ZE,setupOnce(){c8(t)}})),u8=nwe;p();u();l();p();u();l();var E8=B(pe(),1);p();u();l();var p8=B(require("node:net"),1);D();var Xs=B(pe(),1);Re();function d8(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=f=>{(0,Xs.safeExecuteInTheMiddle)(()=>a(f),_=>{_&&xn.error(_?.message)},!0)});let c=new Xs.InstrumentationNodeModuleDefinition("@firebase/firestore",e,f=>l8(f,n,r,t,i)),d=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let f of d)c.files.push(new Xs.InstrumentationNodeModuleFile(f,e,_=>l8(_,n,r,t,i),_=>f8(_,r)));return c}function l8(t,e,n,r,o){return f8(t,n),e(t,"addDoc",rwe(r,o)),e(t,"getDocs",swe(r,o)),e(t,"setDoc",iwe(r,o)),e(t,"deleteDoc",owe(r,o)),t}function f8(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xs.isWrapped)(t[n])&&e(t,n);return t}function rwe(t,e){return function(r){return function(o,s){let i=GA(t,"addDoc",o);return e(i),BA(i,()=>r(o,s))}}}function owe(t,e){return function(r){return function(o){let s=GA(t,"deleteDoc",o.parent||o);return e(s),BA(s,()=>r(o))}}}function swe(t,e){return function(r){return function(o){let s=GA(t,"getDocs",o);return e(s),BA(s,()=>r(o))}}}function iwe(t,e){return function(r){return function(o,s,i){let a=GA(t,"setDoc",o.parent||o);return e(a),BA(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function BA(t,e){return V.with(ce.setSpan(V.active(),t),()=>(0,Xs.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function GA(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:$e.CLIENT});return cwe(r,n),r.setAttribute(Cu,e),r}function awe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(p8.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function cwe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[pI]:e.path,[md]:n.name,[gi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=awe(s);a&&(i[hd]=a),c&&(i[Ed]=c),t.setAttributes(i)}p();u();l();D();var Qs=B(pe(),1);function _8(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,d=o.functions?.responseHook;typeof d=="function"&&(i=(m,E)=>{(0,Qs.safeExecuteInTheMiddle)(()=>d(m,E),T=>{T&&xn.error(T?.message)},!0)}),typeof c=="function"&&(s=m=>{(0,Qs.safeExecuteInTheMiddle)(()=>c(m),E=>{E&&xn.error(E?.message)},!0)});let f=new Qs.InstrumentationNodeModuleDefinition("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:m,triggerType:E})=>{f.files.push(new Qs.InstrumentationNodeModuleFile(m,e,T=>uwe(T,n,r,t,{requestHook:s,responseHook:i,errorHook:a},E),T=>m8(T,r)))}),f}function Yn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...d){let f=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",_=t.startSpan(`firebase.function.${n}`,{kind:$e.SERVER}),m={"faas.name":f,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(m["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(m["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),_.setAttributes(m),e?.requestHook?.(_),V.with(ce.setSpan(V.active(),_),async()=>{let E,T;try{T=await i.apply(this,d)}catch(S){E=S}if(e?.responseHook?.(_,E),E&&_.recordException(E),_.end(),E)throw await e?.errorHook?.(_,E),E;return T})};return a?o.call(this,a,c):o.call(this,c)}}}function uwe(t,e,n,r,o,s){switch(m8(t,n),s){case"function":e(t,"onRequest",Yn(r,o,"http.request")),e(t,"onCall",Yn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Yn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Yn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Yn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Yn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Yn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Yn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Yn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Yn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Yn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Yn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Yn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Yn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Yn(r,o,"storage.object.metadataUpdated"));break}return t}function m8(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Qs.isWrapped)(t[r])&&e(t,r);return t}var h8={},lwe=[">=3.0.0 <5"],pwe=[">=6.0.0 <7"],jA=class extends E8.InstrumentationBase{constructor(e=h8){super("@sentry/instrumentation-firebase",ye,e)}setConfig(e={}){super.setConfig({...h8,...e})}init(){let e=[];return e.push(d8(this.tracer,lwe,this._wrap,this._unwrap,this.getConfig())),e.push(_8(this.tracer,pwe,this._wrap,this._unwrap,this.getConfig())),e}};var g8="Firebase",dwe={firestoreSpanCreationHook:t=>{we(t,"auto.firebase.otel.firestore"),t.setAttribute(de,"db.query")},functions:{requestHook:t=>{we(t,"auto.firebase.otel.functions"),t.setAttribute(de,"http.request")},errorHook:async(t,e)=>{e&&(fe(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await OE(2e3))}}},T8=X(g8,()=>new jA(dwe)),fwe=(()=>({name:g8,setupOnce(){T8()}})),S8=fwe;p();u();l();p();u();l();function A8(){return[rz(),Hz(),f5(),HX(),Q5(),p9(),R9(),L9(),u6(),P6(),NX(),BX(),nQ(),_Q(),bQ(),wQ(),P5(),KQ(),G5(),i8(),u8(),QQ(),ZQ(),t8(),o8(),L6(),S8()]}p();u();l();D();var HA=B(Sb(),1),R8=B(qb(),1);Re();var dM=1e6;function y8(t,e={}){t.getOptions().debug&&TC();let[n,r]=_we(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function _we(t,e={}){let n=new R8.BasicTracerProvider({sampler:new ET(t),resource:(0,HA.defaultResource)().merge((0,HA.resourceFromAttributes)({[_r]:"node",[lI]:"sentry",[dI]:ye})),forceFlushTimeoutMillis:500,spanProcessors:[new hT({timeout:mwe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});ce.setGlobalTracerProvider(n),Ln.setGlobalPropagator(new mT);let r=new gC;return V.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function mwe(t){if(t!=null){if(t>dM)return dt&&I.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${dM}`),dM;if(t<=0||Number.isNaN(t)){dt&&I.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function I8(){return LT().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(Vf(),$3())}function N8(t){return[...I8(),...yt(t)?A8():[]]}function fM(t={}){return hwe(t,N8)}function hwe(t={},e){Rc(t,"node");let n=yC({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(y8(n,{spanProcessors:t.openTelemetrySpanProcessors}),IC()),n}p();u();l();var O8="https://1188a86f3f8168f089450587b00bca66@o1.ingest.us.sentry.io/4510776311808000";async function b8(t){let e=process.env.SENTRY_CLI_NO_TELEMETRY!=="1",n=gwe(e);if(!n?.getOptions().enabled)return t();il(),CE();try{return await gr({name:"cli-execution",op:"cli.command"},async()=>t())}catch(r){fe(r);let o=Me().getSession();throw o&&(o.status="crashed"),r}finally{wi();try{await n.flush(3e3)}catch{}}}function gwe(t){let r=fM({dsn:O8,enabled:t,defaultIntegrations:!1,integrations:[Vf()],environment:"production",tracesSampleRate:1,sampleRate:1,release:"0.3.3",tracePropagationTargets:[],beforeSendTransaction:o=>(o.server_name=void 0,o),beforeSend:o=>{let s=process.env.HOME||process.env.USERPROFILE;for(let i of o.exception?.values??[])if(i.stacktrace?.frames)for(let a of i.stacktrace.frames)a.filename&&s&&(a.filename=a.filename.replace(s,"~"));return o.server_name=void 0,o}});if(r?.getOptions().enabled){Di("platform",process.platform),Di("arch",process.arch);let o=typeof process.versions.bun<"u"?"bun":"node";Di("runtime",o),Di("runtime.version",process.version)}return r}function C8(t){let e=qr();e&&e.updateName(t),Di("command",t)}function M8(t){let e={process:t,env:t.env,cwd:t.cwd(),homeDir:(0,P8.homedir)(),configDir:si(),stdout:t.stdout,stderr:t.stderr,stdin:t.stdin};return{...e,forCommand:({prefix:n})=>(C8(n.join(".")),e)}}$t();p();u();l();ii();var Twe=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557"," \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D"," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u255A\u2588\u2588\u2588\u2588\u2554\u255D "," \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u255A\u2588\u2588\u2554\u255D "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 "," \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D "],Swe=["#B4A4DE","#9C84D4","#8468C8","#6C4EBA","#5538A8","#432B8A"];function Awe(){return Twe.map((t,e)=>{let n=Swe[e]??"#B4A4DE";return Dr.hex(n)(t)}).join(`
483
484
  `)}var Rwe="The command-line interface for Sentry";function ywe(t){return typeof t=="object"&&t!==null&&"getAllEntries"in t&&typeof t.getAllEntries=="function"}function Iwe(t){return typeof t=="object"&&t!==null&&"parameters"in t&&!("getAllEntries"in t)}function Nwe(t){if(!Iwe(t))return"<...>";let e=t.parameters.positional;return e?e.kind==="tuple"&&e.parameters.length>0?e.parameters.map((r,o)=>`<${r.placeholder??`arg${o}`}>`).join(" "):e.kind==="array"?`<${e.parameter.placeholder??"args"}...>`:"<...>":""}function Owe(){return Ty.getAllEntries().filter(e=>!e.hidden).map(e=>{let n=e.name.original,r=e.target.brief;if(ywe(e.target)){let a=e.target.getAllEntries().filter(c=>!c.hidden).map(c=>c.name.original).join(" | ");return{usage:`sentry ${n} ${a}`,description:r}}let o=Nwe(e.target),s=o?` ${o}`:"";return{usage:`sentry ${n}${s}`,description:r}})}var bwe="sentry auth login",Cwe="sentry issue list",Pwe="https://docs.sentry.io/cli/";function Mwe(t){let e=Math.max(...t.map(r=>r.usage.length)),n=4;return t.map(r=>{let o=r.usage.padEnd(e+n);return` $ ${gu(o)}${ie(r.description)}`}).join(`
484
485
  `)}async function v8(t){let n=await ai()?Cwe:bwe,r=[];r.push(""),r.push(Awe()),r.push(""),r.push(` ${Rwe}`),r.push(""),r.push(Mwe(Owe())),r.push(""),r.push(` ${ie("try:")} ${UL(n)}`),r.push(""),r.push(` ${ie(`Learn more at ${Pwe}`)}`),r.push(""),r.push(""),t.write(r.join(`
485
486
  `))}function vwe(t){return t.length===0}async function xwe(){let t=process.argv.slice(2);try{await b8(async()=>{if(vwe(t)){await v8(process.stdout);return}return Sv(f0,t,M8(process))})}catch(e){process.stderr.write(`${Rm("Error:")} ${wR(e)}