sentry 0.4.0 → 0.4.2

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 +3 -3
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var gne=Object.create;var vm=Object.defineProperty;var Tne=Object.getOwnPropertyDescriptor;var Sne=Object.getOwnPropertyNames;var Ane=Object.getPrototypeOf,Rne=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ai=(t,e)=>{for(var n in e)vm(t,n,{get:e[n],enumerable:!0})},Nx=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Sne(e))!Rne.call(t,o)&&o!==n&&vm(t,o,{get:()=>e[o],enumerable:!(r=Tne(e,o))||r.enumerable});return t};var B=(t,e,n)=>(n=t!=null?gne(Ane(t)):{},Nx(e||!t||!t.__esModule?vm(n,"default",{value:t,enumerable:!0}):n,t)),x=t=>Nx(vm({},"__esModule",{value:!0}),t);var h,u=S(()=>{"use strict";h=require("node:url").pathToFileURL(__filename).href});var yne,l=S(()=>{yne=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};yne.SENTRY_RELEASE={id:"0.4.0"}});function Nne(t){let e=(0,kn.normalize)(t);return e.length>1&&e[e.length-1]===kn.sep&&(e=e.substring(0,e.length-1)),e}function Px(t,e){return t.replace(One,e)}function Cne(t){return t==="/"||bne.test(t)}function uy(t,e){let{resolvePaths:n,normalizePath:r,pathSeparator:o}=e,s=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(n&&(t=(0,kn.resolve)(t)),(r||s)&&(t=Nne(t)),t===".")return"";let i=t[t.length-1]!==o;return Px(i?t+o:t,o)}function Mx(t,e){return e+t}function Pne(t,e){return function(n,r){return r.startsWith(t)?r.slice(t.length)+n:Px((0,kn.relative)(t,r),e.pathSeparator)+e.pathSeparator+n}}function Mne(t){return t}function vne(t,e,n){return e+t+n}function xne(t,e){let{relativePaths:n,includeBasePath:r}=e;return n&&t?Pne(t,e):r?Mx:Mne}function Lne(t){return function(e,n){n.push(e.substring(t.length)||".")}}function Dne(t){return function(e,n,r){let o=e.substring(t.length)||".";r.every(s=>s(o,!0))&&n.push(o)}}function Bne(t,e){let{includeDirs:n,filters:r,relativePaths:o}=e;return n?o?r&&r.length?Dne(t):Lne(t):r&&r.length?Une:wne:kne}function Vne(t){let{excludeFiles:e,filters:n,onlyCounts:r}=t;return e?$ne:n&&n.length?r?Gne:jne:r?Hne:Fne}function Wne(t){return t.group?Yne:qne}function Xne(t){return t.group?Kne:zne}function Zne(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Jne:Qne}function vx(t,e,n){if(n.options.useRealPaths)return ere(e,n);let r=(0,kn.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,kn.dirname)(r)}return n.symlinks.set(t,e),o>1}function ere(t,e){return e.visited.includes(t+e.options.pathSeparator)}function xm(t,e,n,r){e(t&&!r?t:null,n)}function ure(t,e){let{onlyCounts:n,group:r,maxFiles:o}=t;return n?e?tre:sre:r?e?nre:cre:o?e?ore:are:e?rre:ire}function dre(t){return t?pre:lre}function hre(t,e){return new Promise((n,r)=>{Dx(t,e,(o,s)=>{if(o)return r(o);n(s)})})}function Dx(t,e,n){new Lx(t,e,n).start()}function Ere(t,e){return new Lx(t,e).start()}var Cx,kn,Ine,Ox,One,bne,wne,Une,kne,Gne,jne,Hne,Fne,$ne,qne,Yne,Kne,zne,Qne,Jne,tre,nre,rre,ore,sre,ire,are,cre,xx,lre,pre,fre,_re,mre,Lx,bx,wx,Ux,kx=S(()=>{p();u();l();Cx=require("module"),kn=require("path"),Ine=B(require("fs"),1),Ox=(0,Cx.createRequire)(h);One=/[\\/]/g;bne=/^[a-z]:[\\/]$/i;wne=(t,e)=>{e.push(t||".")},Une=(t,e,n)=>{let r=t||".";n.every(o=>o(r,!0))&&e.push(r)},kne=()=>{};Gne=(t,e,n,r)=>{r.every(o=>o(t,!1))&&n.files++},jne=(t,e,n,r)=>{r.every(o=>o(t,!1))&&e.push(t)},Hne=(t,e,n,r)=>{n.files++},Fne=(t,e)=>{e.push(t)},$ne=()=>{};qne=t=>t,Yne=()=>[""].slice(0,0);Kne=(t,e,n)=>{t.push({directory:e,files:n,dir:e})},zne=()=>{};Qne=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()&&vx(t,a,e))return r.dequeue(null,e);n(d,a),r.dequeue(null,e)})})},Jne=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()&&vx(t,i,e))return;n(a,i)}catch(i){if(!s)throw i}};tre=t=>t.counts,nre=t=>t.groups,rre=t=>t.paths,ore=t=>t.paths.slice(0,t.options.maxFiles),sre=(t,e,n)=>(xm(e,n,t.counts,t.options.suppressErrors),null),ire=(t,e,n)=>(xm(e,n,t.paths,t.options.suppressErrors),null),are=(t,e,n)=>(xm(e,n,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),cre=(t,e,n)=>(xm(e,n,t.groups,t.options.suppressErrors),null);xx={withFileTypes:!0},lre=(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||".",xx,(i,a=[])=>{o(a,n,r),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},pre=(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||".",xx)}catch(a){if(!t.options.suppressErrors)throw a}o(i,n,r)};fre=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))}},_re=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}},mre=class{aborted=!1;abort(){this.aborted=!0}},Lx=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,n){this.isSynchronous=!n,this.callbackInvoker=ure(e,this.isSynchronous),this.root=uy(t,e),this.state={root:Cne(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _re,options:e,queue:new fre((r,o)=>this.callbackInvoker(o,r,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new mre,fs:e.fs||Ine},this.joinPath=xne(this.root,e),this.pushDirectory=Bne(this.root,e),this.pushFile=Vne(e),this.getArray=Wne(e),this.groupFiles=Xne(e),this.resolveSymlink=Zne(e,this.isSynchronous),this.walkDirectory=dre(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 A=t[T];if(A.isFile()||A.isSymbolicLink()&&!s&&!i){let y=this.joinPath(A.name,e);this.pushFile(y,E,this.state.counts,o)}else if(A.isDirectory()){let y=vne(A.name,e,this.state.options.pathSeparator);if(a&&a(A.name,y))continue;this.pushDirectory(y,r,o),this.walkDirectory(this.state,y,y,n-1,this.walk)}else if(this.resolveSymlink&&A.isSymbolicLink()){let y=Mx(A.name,e);this.resolveSymlink(y,this.state,(O,I)=>{if(O.isDirectory()){if(I=uy(I,this.state.options),a&&a(A.name,f?I:y+_))return;this.walkDirectory(this.state,I,f?I:y+_,n-1,this.walk)}else{I=f?I:y;let M=(0,kn.basename)(I),v=uy((0,kn.dirname)(I),this.state.options);I=this.joinPath(M,v),this.pushFile(I,E,this.state.counts,o)}})}}this.groupFiles(this.state.groups,e,E)}};bx=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return hre(this.root,this.options)}withCallback(t){Dx(this.root,this.options,t)}sync(){return Ere(this.root,this.options)}},wx=null;try{Ox.resolve("picomatch"),wx=Ox("picomatch")}catch{}Ux=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:kn.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 bx(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new bx(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let n=this.globFunction||wx;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 fd=R((Cje,Fx)=>{"use strict";p();u();l();var Bx="[^\\\\/]",gre="(?=.)",Gx="[^/]",ly="(?:\\/|$)",jx="(?:^|\\/)",py=`\\.{1,2}${ly}`,Tre="(?!\\.)",Sre=`(?!${jx}${py})`,Are=`(?!\\.{0,1}${ly})`,Rre=`(?!${py})`,yre="[^.\\/]",Ire=`${Gx}*?`,Nre="/",Hx={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:gre,QMARK:Gx,END_ANCHOR:ly,DOTS_SLASH:py,NO_DOT:Tre,NO_DOTS:Sre,NO_DOT_SLASH:Are,NO_DOTS_SLASH:Rre,QMARK_NO_DOT:yre,STAR:Ire,START_ANCHOR:jx,SEP:Nre},Ore={...Hx,SLASH_LITERAL:"[\\\\/]",QMARK:Bx,STAR:`${Bx}*?`,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:"\\"},bre={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"};Fx.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:bre,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?Ore:Hx}}});var _d=R(or=>{"use strict";p();u();l();var{REGEX_BACKSLASH:Cre,REGEX_REMOVE_BACKSLASH:Pre,REGEX_SPECIAL_CHARS:Mre,REGEX_SPECIAL_CHARS_GLOBAL:vre}=fd();or.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);or.hasRegexChars=t=>Mre.test(t);or.isRegexChar=t=>t.length===1&&or.hasRegexChars(t);or.escapeRegex=t=>t.replace(vre,"\\$1");or.toPosixSlashes=t=>t.replace(Cre,"/");or.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};or.removeBackslashes=t=>t.replace(Pre,e=>e==="\\"?"":e);or.escapeLast=(t,e,n)=>{let r=t.lastIndexOf(e,n);return r===-1?t:t[r-1]==="\\"?or.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};or.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n};or.wrapOutput=(t,e={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${t})${o}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s};or.basename=(t,{windows:e}={})=>{let n=t.split(e?/[\\/]/:"/"),r=n[n.length-1];return r===""?n[n.length-2]:r}});var Xx=R((Uje,zx)=>{"use strict";p();u();l();var $x=_d(),{CHAR_ASTERISK:dy,CHAR_AT:xre,CHAR_BACKWARD_SLASH:md,CHAR_COMMA:Lre,CHAR_DOT:fy,CHAR_EXCLAMATION_MARK:_y,CHAR_FORWARD_SLASH:Kx,CHAR_LEFT_CURLY_BRACE:my,CHAR_LEFT_PARENTHESES:hy,CHAR_LEFT_SQUARE_BRACKET:Dre,CHAR_PLUS:wre,CHAR_QUESTION_MARK:Vx,CHAR_RIGHT_CURLY_BRACE:Ure,CHAR_RIGHT_PARENTHESES:qx,CHAR_RIGHT_SQUARE_BRACKET:kre}=fd(),Yx=t=>t===Kx||t===md,Wx=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Bre=(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,A=!1,y=!1,O=!1,I=!1,M=!1,v=!1,G=!1,k=0,Q,K,ee={value:"",depth:0,isGlob:!1},b=()=>d>=r,pt=()=>c.charCodeAt(d+1),Fe=()=>(Q=K,c.charCodeAt(++d));for(;d<r;){K=Fe();let Me;if(K===md){I=ee.backslashes=!0,K=Fe(),K===my&&(O=!0);continue}if(O===!0||K===my){for(k++;b()!==!0&&(K=Fe());){if(K===md){I=ee.backslashes=!0,Fe();continue}if(K===my){k++;continue}if(O!==!0&&K===fy&&(K=Fe())===fy){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(O!==!0&&K===Lre){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===Ure&&(k--,k===0)){O=!1,m=ee.isBrace=!0,G=!0;break}}if(o===!0)continue;break}if(K===Kx){if(s.push(d),i.push(ee),ee={value:"",depth:0,isGlob:!1},G===!0)continue;if(Q===fy&&d===f+1){f+=2;continue}_=d+1;continue}if(n.noext!==!0&&(K===wre||K===xre||K===dy||K===Vx||K===_y)===!0&&pt()===hy){if(T=ee.isGlob=!0,A=ee.isExtglob=!0,G=!0,K===_y&&d===f&&(v=!0),o===!0){for(;b()!==!0&&(K=Fe());){if(K===md){I=ee.backslashes=!0,K=Fe();continue}if(K===qx){T=ee.isGlob=!0,G=!0;break}}continue}break}if(K===dy){if(Q===dy&&(y=ee.isGlobstar=!0),T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===Vx){if(T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===Dre){for(;b()!==!0&&(Me=Fe());){if(Me===md){I=ee.backslashes=!0,Fe();continue}if(Me===kre){E=ee.isBracket=!0,T=ee.isGlob=!0,G=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&K===_y&&d===f){M=ee.negated=!0,f++;continue}if(n.noparen!==!0&&K===hy){if(T=ee.isGlob=!0,o===!0){for(;b()!==!0&&(K=Fe());){if(K===hy){I=ee.backslashes=!0,K=Fe();continue}if(K===qx){G=!0;break}}continue}break}if(T===!0){if(G=!0,o===!0)continue;break}}n.noext===!0&&(A=!1,T=!1);let Se=c,C="",P="";f>0&&(C=c.slice(0,f),c=c.slice(f),_-=f),Se&&T===!0&&_>0?(Se=c.slice(0,_),P=c.slice(_)):T===!0?(Se="",P=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&Yx(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),n.unescape===!0&&(P&&(P=$x.removeBackslashes(P)),Se&&I===!0&&(Se=$x.removeBackslashes(Se)));let wn={prefix:C,input:t,start:f,base:Se,glob:P,isBrace:m,isBracket:E,isGlob:T,isExtglob:A,isGlobstar:y,negated:M,negatedExtglob:v};if(n.tokens===!0&&(wn.maxDepth=0,Yx(K)||i.push(ee),wn.tokens=i),n.parts===!0||n.tokens===!0){let Me;for(let qe=0;qe<s.length;qe++){let Gr=Me?Me+1:f,jr=s[qe],Si=t.slice(Gr,jr);n.tokens&&(qe===0&&f!==0?(i[qe].isPrefix=!0,i[qe].value=C):i[qe].value=Si,Wx(i[qe]),wn.maxDepth+=i[qe].depth),(qe!==0||Si!=="")&&a.push(Si),Me=jr}if(Me&&Me+1<t.length){let qe=t.slice(Me+1);a.push(qe),n.tokens&&(i[i.length-1].value=qe,Wx(i[i.length-1]),wn.maxDepth+=i[i.length-1].depth)}wn.slashes=s,wn.parts=a}return wn};zx.exports=Bre});var Zx=R((jje,Jx)=>{"use strict";p();u();l();var Lm=fd(),Xo=_d(),{MAX_LENGTH:Dm,POSIX_REGEX_SOURCE:Gre,REGEX_NON_SPECIAL_CHARS:jre,REGEX_SPECIAL_CHARS_BACKREF:Hre,REPLACEMENTS:Qx}=Lm,Fre=(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=>Xo.escapeRegex(o)).join("..")}return n},Cu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ey=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Qx[t]||t;let n={...e},r=typeof n.maxLength=="number"?Math.min(Dm,n.maxLength):Dm,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=Lm.globChars(n.windows),d=Lm.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:_,SLASH_LITERAL:m,ONE_CHAR:E,DOTS_SLASH:T,NO_DOT:A,NO_DOT_SLASH:y,NO_DOTS_SLASH:O,QMARK:I,QMARK_NO_DOT:M,STAR:v,START_ANCHOR:G}=c,k=z=>`(${a}(?:(?!${G}${z.dot?T:f}).)*?)`,Q=n.dot?"":A,K=n.dot?I:M,ee=n.bash===!0?k(n):v;n.capture&&(ee=`(${ee})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let b={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=Xo.removePrefix(t,b),o=t.length;let pt=[],Fe=[],Se=[],C=s,P,wn=()=>b.index===o-1,Me=b.peek=(z=1)=>t[b.index+z],qe=b.advance=()=>t[++b.index]||"",Gr=()=>t.slice(b.index+1),jr=(z="",Xe=0)=>{b.consumed+=z,b.index+=Xe},Si=z=>{b.output+=z.output!=null?z.output:z.value,jr(z.value)},hne=()=>{let z=1;for(;Me()==="!"&&(Me(2)!=="("||Me(3)==="?");)qe(),b.start++,z++;return z%2===0?!1:(b.negated=!0,b.start++,!0)},Cm=z=>{b[z]++,Se.push(z)},Qa=z=>{b[z]--,Se.pop()},Oe=z=>{if(C.type==="globstar"){let Xe=b.braces>0&&(z.type==="comma"||z.type==="brace"),H=z.extglob===!0||pt.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!Xe&&!H&&(b.output=b.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=ee,b.output+=C.output)}if(pt.length&&z.type!=="paren"&&(pt[pt.length-1].inner+=z.value),(z.value||z.output)&&Si(z),C&&C.type==="text"&&z.type==="text"){C.output=(C.output||C.value)+z.value,C.value+=z.value;return}z.prev=C,i.push(z),C=z},Pm=(z,Xe)=>{let H={...d[Xe],conditions:1,inner:""};H.prev=C,H.parens=b.parens,H.output=b.output;let Ae=(n.capture?"(":"")+H.open;Cm("parens"),Oe({type:z,value:Xe,output:b.output?"":E}),Oe({type:"paren",extglob:!0,value:qe(),output:Ae}),pt.push(H)},Ene=z=>{let Xe=z.close+(n.capture?")":""),H;if(z.type==="negate"){let Ae=ee;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(Ae=k(n)),(Ae!==ee||wn()||/^\)+$/.test(Gr()))&&(Xe=z.close=`)$))${Ae}`),z.inner.includes("*")&&(H=Gr())&&/^\.[^\\/.]+$/.test(H)){let st=Ey(H,{...e,fastpaths:!1}).output;Xe=z.close=`)${st})${Ae})`}z.prev.type==="bos"&&(b.negatedExtglob=!0)}Oe({type:"paren",extglob:!0,value:P,output:Xe}),Qa("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,Xe=t.replace(Hre,(H,Ae,st,Un,Ht,cy)=>Un==="\\"?(z=!0,H):Un==="?"?Ae?Ae+Un+(Ht?I.repeat(Ht.length):""):cy===0?K+(Ht?I.repeat(Ht.length):""):I.repeat(st.length):Un==="."?f.repeat(st.length):Un==="*"?Ae?Ae+Un+(Ht?ee:""):ee:Ae?H:`\\${H}`);return z===!0&&(n.unescape===!0?Xe=Xe.replace(/\\/g,""):Xe=Xe.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),Xe===t&&n.contains===!0?(b.output=t,b):(b.output=Xo.wrapOutput(Xe,b,e),b)}for(;!wn();){if(P=qe(),P==="\0")continue;if(P==="\\"){let H=Me();if(H==="/"&&n.bash!==!0||H==="."||H===";")continue;if(!H){P+="\\",Oe({type:"text",value:P});continue}let Ae=/^\\+/.exec(Gr()),st=0;if(Ae&&Ae[0].length>2&&(st=Ae[0].length,b.index+=st,st%2!==0&&(P+="\\")),n.unescape===!0?P=qe():P+=qe(),b.brackets===0){Oe({type:"text",value:P});continue}}if(b.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(n.posix!==!1&&P===":"){let H=C.value.slice(1);if(H.includes("[")&&(C.posix=!0,H.includes(":"))){let Ae=C.value.lastIndexOf("["),st=C.value.slice(0,Ae),Un=C.value.slice(Ae+2),Ht=Gre[Un];if(Ht){C.value=st+Ht,b.backtrack=!0,qe(),!s.output&&i.indexOf(C)===1&&(s.output=E);continue}}}(P==="["&&Me()!==":"||P==="-"&&Me()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),n.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Si({value:P});continue}if(b.quotes===1&&P!=='"'){P=Xo.escapeRegex(P),C.value+=P,Si({value:P});continue}if(P==='"'){b.quotes=b.quotes===1?0:1,n.keepQuotes===!0&&Oe({type:"text",value:P});continue}if(P==="("){Cm("parens"),Oe({type:"paren",value:P});continue}if(P===")"){if(b.parens===0&&n.strictBrackets===!0)throw new SyntaxError(Cu("opening","("));let H=pt[pt.length-1];if(H&&b.parens===H.parens+1){Ene(pt.pop());continue}Oe({type:"paren",value:P,output:b.parens?")":"\\)"}),Qa("parens");continue}if(P==="["){if(n.nobracket===!0||!Gr().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(Cu("closing","]"));P=`\\${P}`}else Cm("brackets");Oe({type:"bracket",value:P});continue}if(P==="]"){if(n.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){Oe({type:"text",value:P,output:`\\${P}`});continue}if(b.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(Cu("opening","["));Oe({type:"text",value:P,output:`\\${P}`});continue}Qa("brackets");let H=C.value.slice(1);if(C.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(P=`/${P}`),C.value+=P,Si({value:P}),n.literalBrackets===!1||Xo.hasRegexChars(H))continue;let Ae=Xo.escapeRegex(C.value);if(b.output=b.output.slice(0,-C.value.length),n.literalBrackets===!0){b.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,b.output+=C.value;continue}if(P==="{"&&n.nobrace!==!0){Cm("braces");let H={type:"brace",value:P,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};Fe.push(H),Oe(H);continue}if(P==="}"){let H=Fe[Fe.length-1];if(n.nobrace===!0||!H){Oe({type:"text",value:P,output:P});continue}let Ae=")";if(H.dots===!0){let st=i.slice(),Un=[];for(let Ht=st.length-1;Ht>=0&&(i.pop(),st[Ht].type!=="brace");Ht--)st[Ht].type!=="dots"&&Un.unshift(st[Ht].value);Ae=Fre(Un,n),b.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let st=b.output.slice(0,H.outputIndex),Un=b.tokens.slice(H.tokensIndex);H.value=H.output="\\{",P=Ae="\\}",b.output=st;for(let Ht of Un)b.output+=Ht.output||Ht.value}Oe({type:"brace",value:P,output:Ae}),Qa("braces"),Fe.pop();continue}if(P==="|"){pt.length>0&&pt[pt.length-1].conditions++,Oe({type:"text",value:P});continue}if(P===","){let H=P,Ae=Fe[Fe.length-1];Ae&&Se[Se.length-1]==="braces"&&(Ae.comma=!0,H="|"),Oe({type:"comma",value:P,output:H});continue}if(P==="/"){if(C.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",i.pop(),C=s;continue}Oe({type:"slash",value:P,output:m});continue}if(P==="."){if(b.braces>0&&C.type==="dot"){C.value==="."&&(C.output=f);let H=Fe[Fe.length-1];C.type="dots",C.output+=P,C.value+=P,H.dots=!0;continue}if(b.braces+b.parens===0&&C.type!=="bos"&&C.type!=="slash"){Oe({type:"text",value:P,output:f});continue}Oe({type:"dot",value:P,output:f});continue}if(P==="?"){if(!(C&&C.value==="(")&&n.noextglob!==!0&&Me()==="("&&Me(2)!=="?"){Pm("qmark",P);continue}if(C&&C.type==="paren"){let Ae=Me(),st=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Gr()))&&(st=`\\${P}`),Oe({type:"text",value:P,output:st});continue}if(n.dot!==!0&&(C.type==="slash"||C.type==="bos")){Oe({type:"qmark",value:P,output:M});continue}Oe({type:"qmark",value:P,output:I});continue}if(P==="!"){if(n.noextglob!==!0&&Me()==="("&&(Me(2)!=="?"||!/[!=<:]/.test(Me(3)))){Pm("negate",P);continue}if(n.nonegate!==!0&&b.index===0){hne();continue}}if(P==="+"){if(n.noextglob!==!0&&Me()==="("&&Me(2)!=="?"){Pm("plus",P);continue}if(C&&C.value==="("||n.regex===!1){Oe({type:"plus",value:P,output:_});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||b.parens>0){Oe({type:"plus",value:P});continue}Oe({type:"plus",value:_});continue}if(P==="@"){if(n.noextglob!==!0&&Me()==="("&&Me(2)!=="?"){Oe({type:"at",extglob:!0,value:P,output:""});continue}Oe({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let H=jre.exec(Gr());H&&(P+=H[0],b.index+=H[0].length),Oe({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=ee,b.backtrack=!0,b.globstar=!0,jr(P);continue}let z=Gr();if(n.noextglob!==!0&&/^\([^?]/.test(z)){Pm("star",P);continue}if(C.type==="star"){if(n.noglobstar===!0){jr(P);continue}let H=C.prev,Ae=H.prev,st=H.type==="slash"||H.type==="bos",Un=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(n.bash===!0&&(!st||z[0]&&z[0]!=="/")){Oe({type:"star",value:P,output:""});continue}let Ht=b.braces>0&&(H.type==="comma"||H.type==="brace"),cy=pt.length&&(H.type==="pipe"||H.type==="paren");if(!st&&H.type!=="paren"&&!Ht&&!cy){Oe({type:"star",value:P,output:""});continue}for(;z.slice(0,3)==="/**";){let Mm=t[b.index+4];if(Mm&&Mm!=="/")break;z=z.slice(3),jr("/**",3)}if(H.type==="bos"&&wn()){C.type="globstar",C.value+=P,C.output=k(n),b.output=C.output,b.globstar=!0,jr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!Un&&wn()){b.output=b.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=k(n)+(n.strictSlashes?")":"|$)"),C.value+=P,b.globstar=!0,b.output+=H.output+C.output,jr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&z[0]==="/"){let Mm=z[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=`${k(n)}${m}|${m}${Mm})`,C.value+=P,b.output+=H.output+C.output,b.globstar=!0,jr(P+qe()),Oe({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&z[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${m}|${k(n)}${m})`,b.output=C.output,b.globstar=!0,jr(P+qe()),Oe({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-C.output.length),C.type="globstar",C.output=k(n),C.value+=P,b.output+=C.output,b.globstar=!0,jr(P);continue}let Xe={type:"star",value:P,output:ee};if(n.bash===!0){Xe.output=".*?",(C.type==="bos"||C.type==="slash")&&(Xe.output=Q+Xe.output),Oe(Xe);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&n.regex===!0){Xe.output=P,Oe(Xe);continue}(b.index===b.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?(b.output+=y,C.output+=y):n.dot===!0?(b.output+=O,C.output+=O):(b.output+=Q,C.output+=Q),Me()!=="*"&&(b.output+=E,C.output+=E)),Oe(Xe)}for(;b.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(Cu("closing","]"));b.output=Xo.escapeLast(b.output,"["),Qa("brackets")}for(;b.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(Cu("closing",")"));b.output=Xo.escapeLast(b.output,"("),Qa("parens")}for(;b.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(Cu("closing","}"));b.output=Xo.escapeLast(b.output,"{"),Qa("braces")}if(n.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&Oe({type:"maybe_slash",value:"",output:`${m}?`}),b.backtrack===!0){b.output="";for(let z of b.tokens)b.output+=z.output!=null?z.output:z.value,z.suffix&&(b.output+=z.suffix)}return b};Ey.fastpaths=(t,e)=>{let n={...e},r=typeof n.maxLength=="number"?Math.min(Dm,n.maxLength):Dm,o=t.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);t=Qx[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}=Lm.globChars(n.windows),T=n.dot?f:d,A=n.dot?_:d,y=n.capture?"":"?:",O={negated:!1,prefix:""},I=n.bash===!0?".*?":m;n.capture&&(I=`(${I})`);let M=Q=>Q.noglobstar===!0?I:`(${y}(?:(?!${E}${Q.dot?c:s}).)*?)`,v=Q=>{switch(Q){case"*":return`${T}${a}${I}`;case".*":return`${s}${a}${I}`;case"*.*":return`${T}${I}${s}${a}${I}`;case"*/*":return`${T}${I}${i}${a}${A}${I}`;case"**":return T+M(n);case"**/*":return`(?:${T}${M(n)}${i})?${A}${a}${I}`;case"**/*.*":return`(?:${T}${M(n)}${i})?${A}${I}${s}${a}${I}`;case"**/.*":return`(?:${T}${M(n)}${i})?${s}${a}${I}`;default:{let K=/^(.*?)\.(\w+)$/.exec(Q);if(!K)return;let ee=v(K[1]);return ee?ee+s+K[2]:void 0}}},G=Xo.removePrefix(t,O),k=v(G);return k&&n.strictSlashes!==!0&&(k+=`${i}?`),k};Jx.exports=Ey});var nL=R((Vje,tL)=>{"use strict";p();u();l();var $re=Xx(),gy=Zx(),eL=_d(),Vre=fd(),qre=t=>t&&typeof t=="object"&&!Array.isArray(t),At=(t,e,n=!1)=>{if(Array.isArray(t)){let f=t.map(m=>At(m,e,n));return m=>{for(let E of f){let T=E(m);if(T)return T}return!1}}let r=qre(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?At.compileRe(t,e):At.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=At(o.ignore,f,n)}let d=(f,_=!1)=>{let{isMatch:m,match:E,output:T}=At.test(f,i,e,{glob:t,posix:s}),A={glob:t,state:a,regex:i,posix:s,input:f,output:T,match:E,isMatch:m};return typeof o.onResult=="function"&&o.onResult(A),m===!1?(A.isMatch=!1,_?A:!1):c(f)?(typeof o.onIgnore=="function"&&o.onIgnore(A),A.isMatch=!1,_?A:!1):(typeof o.onMatch=="function"&&o.onMatch(A),_?A:!0)};return n&&(d.state=a),d};At.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?eL.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=At.matchBase(t,e,n,o):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};At.matchBase=(t,e,n)=>(e instanceof RegExp?e:At.makeRe(e,n)).test(eL.basename(t));At.isMatch=(t,e,n)=>At(e,n)(t);At.parse=(t,e)=>Array.isArray(t)?t.map(n=>At.parse(n,e)):gy(t,{...e,fastpaths:!1});At.scan=(t,e)=>$re(t,e);At.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=At.toRegex(a,e);return r===!0&&(c.state=t),c};At.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=gy.fastpaths(t,e)),o.output||(o=gy(t,e)),At.compileRe(o,e,n,r)};At.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/$^/}};At.constants=Vre;tL.exports=At});var iL=R((Kje,sL)=>{"use strict";p();u();l();var rL=nL(),Yre=_d();function oL(t,e,n=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Yre.isWindows()}),rL(t,e,n)}Object.assign(oL,rL);sL.exports=oL});function zre(t,e={}){let n=t.length,r=Array(n),o=Array(n),s=!e.noglobstar;for(let i=0;i<n;i++){let a=lL(t[i]);r[i]=a;let c=a.length,d=Array(c);for(let f=0;f<c;f++)d[f]=(0,Mu.default)(a[f],e);o[i]=d}return i=>{let a=i.split("/");if(a[0]===".."&&Kre.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 aL(t,e,n){if(t===e||e.startsWith(`${t}/`)){if(n){let o=Qre(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=>yo.posix.relative(t,r)||".":r=>yo.posix.relative(t,`${e}/${r}`)||"."}function Jre(t,e){if(e.startsWith(`${t}/`)){let n=e.slice(t.length+1);return r=>`${n}/${r}`}return n=>{let r=yo.posix.relative(t,`${e}/${n}`);return n.endsWith("/")&&r!==""?`${r}/`:r||"."}}function lL(t){var e;let n=Mu.default.scan(t,Zre);return!((e=n.parts)===null||e===void 0)&&e.length?n.parts:[t]}function soe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let n=Mu.default.scan(t);return n.isGlob||n.negated}function Pu(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function Ty(t,e,n,r,o){let s=t;t.endsWith("/")&&(s=t.slice(0,-1)),!s.endsWith("*")&&e&&(s+="/**");let i=ooe(n);yo.default.isAbsolute(s.replace(aoe,""))?s=yo.posix.relative(i,s):s=yo.posix.normalize(s);let a=ioe.exec(s),c=lL(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=yo.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]||soe(E)||m===c.length-1)break;f.push(E)}r.depthOffset=f.length,r.commonPath=f,r.root=f.length>0?yo.posix.join(n,...f):n}return s}function coe({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(Ty(a,n,r,o,!0));for(let a of t)a&&(a[0]!=="!"||a[1]==="("?s.push(Ty(a,n,r,o,!1)):(a[1]!=="!"||a[2]==="(")&&i.push(Ty(a.slice(1),n,r,o,!0)));return{match:s,ignore:i}}function uoe(t,e){for(let n=t.length-1;n>=0;n--){let r=t[n];t[n]=e(r)}return t}function loe(t){return t?t instanceof URL?(0,cL.fileURLToPath)(t).replace(wm,"/"):yo.default.resolve(t).replace(wm,"/"):process.cwd().replace(wm,"/")}function poe(t,e={}){let n=process.env.TINYGLOBBY_DEBUG?{...e,debug:!0}:e,r=loe(n.cwd);if(n.debug&&Pu("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=coe({...n,patterns:t},r,o);n.debug&&Pu("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,Mu.default)(s.match,{...i,ignore:s.ignore}),c=(0,Mu.default)(s.ignore,i),d=zre(s.match,i),f=aL(r,o.root,n.absolute),_=n.absolute?f:aL(r,o.root,!0),m={filters:[n.debug?(A,y)=>{let O=f(A,y),I=a(O);return I&&Pu(`matched ${O}`),I}:(A,y)=>a(f(A,y))],exclude:n.debug?(A,y)=>{let O=_(y,!0),I=O!=="."&&!d(O)||c(O);return Pu(I?`skipped ${y}`:`crawling ${y}`),I}:(A,y)=>{let O=_(y,!0);return O!=="."&&!d(O)||c(O)},fs:n.fs?{readdir:n.fs.readdir||Ja.default.readdir,readdirSync:n.fs.readdirSync||Ja.default.readdirSync,realpath:n.fs.realpath||Ja.default.realpath,realpathSync:n.fs.realpathSync||Ja.default.realpathSync,stat:n.fs.stat||Ja.default.stat,statSync:n.fs.statSync||Ja.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(wm,"");let E=o.root;n.debug&&Pu("internal properties:",o);let T=r!==E&&!n.absolute&&Jre(r,o.root);return[new Ux(m).crawl(E),T]}async function pL(t,e){if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=Wre(t)||typeof t=="string",r=n?e:t,o=n?t:t.patterns,[s,i]=poe(o,r);return i?uoe(await s.withPromise(),i):s.withPromise()}var Ja,yo,cL,Mu,Wre,uL,Kre,Xre,Qre,Zre,eoe,toe,noe,roe,ooe,ioe,aoe,wm,dL=S(()=>{p();u();l();Ja=B(require("fs"),1),yo=B(require("path"),1),cL=require("url");kx();Mu=B(iL(),1),Wre=Array.isArray,uL=process.platform==="win32",Kre=/^(\/?\.\.)+$/;Xre=/^[A-Z]:\/$/i,Qre=uL?t=>Xre.test(t):t=>t==="/";Zre={parts:!0};eoe=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,toe=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,noe=t=>t.replace(eoe,"\\$&"),roe=t=>t.replace(toe,"\\$&"),ooe=uL?roe:noe;ioe=/^(\/?\.\.)+/,aoe=/\\(?=[()[\]{}!*+?@|])/g,wm=/\\/g});var Um,Za,fL,Sy,Ay,doe,foe,p=S(()=>{"use strict";Um=require("node:child_process"),Za=require("node:fs/promises"),fL=require("node:sqlite");dL();Sy=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)}},Ay=class{db;constructor(e){this.db=new fL.DatabaseSync(e)}exec(e){this.db.exec(e)}query(e){return new Sy(this.db.prepare(e))}close(){this.db.close()}},doe={Database:Ay};globalThis.__bun_sqlite_polyfill=doe;foe={file(t){return{async exists(){try{return await(0,Za.access)(t),!0}catch{return!1}},text(){return(0,Za.readFile)(t,"utf-8")},async json(){let e=await(0,Za.readFile)(t,"utf-8");return JSON.parse(e)}}},async write(t,e){await(0,Za.writeFile)(t,e,"utf-8")},which(t){try{let n=process.platform==="win32"?`where ${t}`:`which ${t}`;return(0,Um.execSync)(n,{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).trim().split(`
2
+ var gne=Object.create;var vm=Object.defineProperty;var Tne=Object.getOwnPropertyDescriptor;var Sne=Object.getOwnPropertyNames;var Ane=Object.getPrototypeOf,Rne=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ai=(t,e)=>{for(var n in e)vm(t,n,{get:e[n],enumerable:!0})},Nx=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Sne(e))!Rne.call(t,o)&&o!==n&&vm(t,o,{get:()=>e[o],enumerable:!(r=Tne(e,o))||r.enumerable});return t};var B=(t,e,n)=>(n=t!=null?gne(Ane(t)):{},Nx(e||!t||!t.__esModule?vm(n,"default",{value:t,enumerable:!0}):n,t)),x=t=>Nx(vm({},"__esModule",{value:!0}),t);var h,u=S(()=>{"use strict";h=require("node:url").pathToFileURL(__filename).href});var yne,l=S(()=>{yne=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};yne.SENTRY_RELEASE={id:"0.4.2"}});function Nne(t){let e=(0,kn.normalize)(t);return e.length>1&&e[e.length-1]===kn.sep&&(e=e.substring(0,e.length-1)),e}function Px(t,e){return t.replace(One,e)}function Cne(t){return t==="/"||bne.test(t)}function uy(t,e){let{resolvePaths:n,normalizePath:r,pathSeparator:o}=e,s=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(n&&(t=(0,kn.resolve)(t)),(r||s)&&(t=Nne(t)),t===".")return"";let i=t[t.length-1]!==o;return Px(i?t+o:t,o)}function Mx(t,e){return e+t}function Pne(t,e){return function(n,r){return r.startsWith(t)?r.slice(t.length)+n:Px((0,kn.relative)(t,r),e.pathSeparator)+e.pathSeparator+n}}function Mne(t){return t}function vne(t,e,n){return e+t+n}function xne(t,e){let{relativePaths:n,includeBasePath:r}=e;return n&&t?Pne(t,e):r?Mx:Mne}function Lne(t){return function(e,n){n.push(e.substring(t.length)||".")}}function Dne(t){return function(e,n,r){let o=e.substring(t.length)||".";r.every(s=>s(o,!0))&&n.push(o)}}function Bne(t,e){let{includeDirs:n,filters:r,relativePaths:o}=e;return n?o?r&&r.length?Dne(t):Lne(t):r&&r.length?Une:wne:kne}function Vne(t){let{excludeFiles:e,filters:n,onlyCounts:r}=t;return e?$ne:n&&n.length?r?Gne:jne:r?Hne:Fne}function Wne(t){return t.group?Yne:qne}function Xne(t){return t.group?Kne:zne}function Zne(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Jne:Qne}function vx(t,e,n){if(n.options.useRealPaths)return ere(e,n);let r=(0,kn.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,kn.dirname)(r)}return n.symlinks.set(t,e),o>1}function ere(t,e){return e.visited.includes(t+e.options.pathSeparator)}function xm(t,e,n,r){e(t&&!r?t:null,n)}function ure(t,e){let{onlyCounts:n,group:r,maxFiles:o}=t;return n?e?tre:sre:r?e?nre:cre:o?e?ore:are:e?rre:ire}function dre(t){return t?pre:lre}function hre(t,e){return new Promise((n,r)=>{Dx(t,e,(o,s)=>{if(o)return r(o);n(s)})})}function Dx(t,e,n){new Lx(t,e,n).start()}function Ere(t,e){return new Lx(t,e).start()}var Cx,kn,Ine,Ox,One,bne,wne,Une,kne,Gne,jne,Hne,Fne,$ne,qne,Yne,Kne,zne,Qne,Jne,tre,nre,rre,ore,sre,ire,are,cre,xx,lre,pre,fre,_re,mre,Lx,bx,wx,Ux,kx=S(()=>{p();u();l();Cx=require("module"),kn=require("path"),Ine=B(require("fs"),1),Ox=(0,Cx.createRequire)(h);One=/[\\/]/g;bne=/^[a-z]:[\\/]$/i;wne=(t,e)=>{e.push(t||".")},Une=(t,e,n)=>{let r=t||".";n.every(o=>o(r,!0))&&e.push(r)},kne=()=>{};Gne=(t,e,n,r)=>{r.every(o=>o(t,!1))&&n.files++},jne=(t,e,n,r)=>{r.every(o=>o(t,!1))&&e.push(t)},Hne=(t,e,n,r)=>{n.files++},Fne=(t,e)=>{e.push(t)},$ne=()=>{};qne=t=>t,Yne=()=>[""].slice(0,0);Kne=(t,e,n)=>{t.push({directory:e,files:n,dir:e})},zne=()=>{};Qne=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()&&vx(t,a,e))return r.dequeue(null,e);n(d,a),r.dequeue(null,e)})})},Jne=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()&&vx(t,i,e))return;n(a,i)}catch(i){if(!s)throw i}};tre=t=>t.counts,nre=t=>t.groups,rre=t=>t.paths,ore=t=>t.paths.slice(0,t.options.maxFiles),sre=(t,e,n)=>(xm(e,n,t.counts,t.options.suppressErrors),null),ire=(t,e,n)=>(xm(e,n,t.paths,t.options.suppressErrors),null),are=(t,e,n)=>(xm(e,n,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),cre=(t,e,n)=>(xm(e,n,t.groups,t.options.suppressErrors),null);xx={withFileTypes:!0},lre=(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||".",xx,(i,a=[])=>{o(a,n,r),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},pre=(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||".",xx)}catch(a){if(!t.options.suppressErrors)throw a}o(i,n,r)};fre=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))}},_re=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}},mre=class{aborted=!1;abort(){this.aborted=!0}},Lx=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,n){this.isSynchronous=!n,this.callbackInvoker=ure(e,this.isSynchronous),this.root=uy(t,e),this.state={root:Cne(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _re,options:e,queue:new fre((r,o)=>this.callbackInvoker(o,r,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new mre,fs:e.fs||Ine},this.joinPath=xne(this.root,e),this.pushDirectory=Bne(this.root,e),this.pushFile=Vne(e),this.getArray=Wne(e),this.groupFiles=Xne(e),this.resolveSymlink=Zne(e,this.isSynchronous),this.walkDirectory=dre(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 A=t[T];if(A.isFile()||A.isSymbolicLink()&&!s&&!i){let y=this.joinPath(A.name,e);this.pushFile(y,E,this.state.counts,o)}else if(A.isDirectory()){let y=vne(A.name,e,this.state.options.pathSeparator);if(a&&a(A.name,y))continue;this.pushDirectory(y,r,o),this.walkDirectory(this.state,y,y,n-1,this.walk)}else if(this.resolveSymlink&&A.isSymbolicLink()){let y=Mx(A.name,e);this.resolveSymlink(y,this.state,(O,I)=>{if(O.isDirectory()){if(I=uy(I,this.state.options),a&&a(A.name,f?I:y+_))return;this.walkDirectory(this.state,I,f?I:y+_,n-1,this.walk)}else{I=f?I:y;let M=(0,kn.basename)(I),v=uy((0,kn.dirname)(I),this.state.options);I=this.joinPath(M,v),this.pushFile(I,E,this.state.counts,o)}})}}this.groupFiles(this.state.groups,e,E)}};bx=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return hre(this.root,this.options)}withCallback(t){Dx(this.root,this.options,t)}sync(){return Ere(this.root,this.options)}},wx=null;try{Ox.resolve("picomatch"),wx=Ox("picomatch")}catch{}Ux=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:kn.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 bx(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new bx(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let n=this.globFunction||wx;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 fd=R((Cje,Fx)=>{"use strict";p();u();l();var Bx="[^\\\\/]",gre="(?=.)",Gx="[^/]",ly="(?:\\/|$)",jx="(?:^|\\/)",py=`\\.{1,2}${ly}`,Tre="(?!\\.)",Sre=`(?!${jx}${py})`,Are=`(?!\\.{0,1}${ly})`,Rre=`(?!${py})`,yre="[^.\\/]",Ire=`${Gx}*?`,Nre="/",Hx={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:gre,QMARK:Gx,END_ANCHOR:ly,DOTS_SLASH:py,NO_DOT:Tre,NO_DOTS:Sre,NO_DOT_SLASH:Are,NO_DOTS_SLASH:Rre,QMARK_NO_DOT:yre,STAR:Ire,START_ANCHOR:jx,SEP:Nre},Ore={...Hx,SLASH_LITERAL:"[\\\\/]",QMARK:Bx,STAR:`${Bx}*?`,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:"\\"},bre={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"};Fx.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:bre,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?Ore:Hx}}});var _d=R(or=>{"use strict";p();u();l();var{REGEX_BACKSLASH:Cre,REGEX_REMOVE_BACKSLASH:Pre,REGEX_SPECIAL_CHARS:Mre,REGEX_SPECIAL_CHARS_GLOBAL:vre}=fd();or.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);or.hasRegexChars=t=>Mre.test(t);or.isRegexChar=t=>t.length===1&&or.hasRegexChars(t);or.escapeRegex=t=>t.replace(vre,"\\$1");or.toPosixSlashes=t=>t.replace(Cre,"/");or.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};or.removeBackslashes=t=>t.replace(Pre,e=>e==="\\"?"":e);or.escapeLast=(t,e,n)=>{let r=t.lastIndexOf(e,n);return r===-1?t:t[r-1]==="\\"?or.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};or.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n};or.wrapOutput=(t,e={},n={})=>{let r=n.contains?"":"^",o=n.contains?"":"$",s=`${r}(?:${t})${o}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s};or.basename=(t,{windows:e}={})=>{let n=t.split(e?/[\\/]/:"/"),r=n[n.length-1];return r===""?n[n.length-2]:r}});var Xx=R((Uje,zx)=>{"use strict";p();u();l();var $x=_d(),{CHAR_ASTERISK:dy,CHAR_AT:xre,CHAR_BACKWARD_SLASH:md,CHAR_COMMA:Lre,CHAR_DOT:fy,CHAR_EXCLAMATION_MARK:_y,CHAR_FORWARD_SLASH:Kx,CHAR_LEFT_CURLY_BRACE:my,CHAR_LEFT_PARENTHESES:hy,CHAR_LEFT_SQUARE_BRACKET:Dre,CHAR_PLUS:wre,CHAR_QUESTION_MARK:Vx,CHAR_RIGHT_CURLY_BRACE:Ure,CHAR_RIGHT_PARENTHESES:qx,CHAR_RIGHT_SQUARE_BRACKET:kre}=fd(),Yx=t=>t===Kx||t===md,Wx=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Bre=(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,A=!1,y=!1,O=!1,I=!1,M=!1,v=!1,G=!1,k=0,Q,K,ee={value:"",depth:0,isGlob:!1},b=()=>d>=r,pt=()=>c.charCodeAt(d+1),Fe=()=>(Q=K,c.charCodeAt(++d));for(;d<r;){K=Fe();let Me;if(K===md){I=ee.backslashes=!0,K=Fe(),K===my&&(O=!0);continue}if(O===!0||K===my){for(k++;b()!==!0&&(K=Fe());){if(K===md){I=ee.backslashes=!0,Fe();continue}if(K===my){k++;continue}if(O!==!0&&K===fy&&(K=Fe())===fy){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(O!==!0&&K===Lre){if(m=ee.isBrace=!0,T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===Ure&&(k--,k===0)){O=!1,m=ee.isBrace=!0,G=!0;break}}if(o===!0)continue;break}if(K===Kx){if(s.push(d),i.push(ee),ee={value:"",depth:0,isGlob:!1},G===!0)continue;if(Q===fy&&d===f+1){f+=2;continue}_=d+1;continue}if(n.noext!==!0&&(K===wre||K===xre||K===dy||K===Vx||K===_y)===!0&&pt()===hy){if(T=ee.isGlob=!0,A=ee.isExtglob=!0,G=!0,K===_y&&d===f&&(v=!0),o===!0){for(;b()!==!0&&(K=Fe());){if(K===md){I=ee.backslashes=!0,K=Fe();continue}if(K===qx){T=ee.isGlob=!0,G=!0;break}}continue}break}if(K===dy){if(Q===dy&&(y=ee.isGlobstar=!0),T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===Vx){if(T=ee.isGlob=!0,G=!0,o===!0)continue;break}if(K===Dre){for(;b()!==!0&&(Me=Fe());){if(Me===md){I=ee.backslashes=!0,Fe();continue}if(Me===kre){E=ee.isBracket=!0,T=ee.isGlob=!0,G=!0;break}}if(o===!0)continue;break}if(n.nonegate!==!0&&K===_y&&d===f){M=ee.negated=!0,f++;continue}if(n.noparen!==!0&&K===hy){if(T=ee.isGlob=!0,o===!0){for(;b()!==!0&&(K=Fe());){if(K===hy){I=ee.backslashes=!0,K=Fe();continue}if(K===qx){G=!0;break}}continue}break}if(T===!0){if(G=!0,o===!0)continue;break}}n.noext===!0&&(A=!1,T=!1);let Se=c,C="",P="";f>0&&(C=c.slice(0,f),c=c.slice(f),_-=f),Se&&T===!0&&_>0?(Se=c.slice(0,_),P=c.slice(_)):T===!0?(Se="",P=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&Yx(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),n.unescape===!0&&(P&&(P=$x.removeBackslashes(P)),Se&&I===!0&&(Se=$x.removeBackslashes(Se)));let wn={prefix:C,input:t,start:f,base:Se,glob:P,isBrace:m,isBracket:E,isGlob:T,isExtglob:A,isGlobstar:y,negated:M,negatedExtglob:v};if(n.tokens===!0&&(wn.maxDepth=0,Yx(K)||i.push(ee),wn.tokens=i),n.parts===!0||n.tokens===!0){let Me;for(let qe=0;qe<s.length;qe++){let Gr=Me?Me+1:f,jr=s[qe],Si=t.slice(Gr,jr);n.tokens&&(qe===0&&f!==0?(i[qe].isPrefix=!0,i[qe].value=C):i[qe].value=Si,Wx(i[qe]),wn.maxDepth+=i[qe].depth),(qe!==0||Si!=="")&&a.push(Si),Me=jr}if(Me&&Me+1<t.length){let qe=t.slice(Me+1);a.push(qe),n.tokens&&(i[i.length-1].value=qe,Wx(i[i.length-1]),wn.maxDepth+=i[i.length-1].depth)}wn.slashes=s,wn.parts=a}return wn};zx.exports=Bre});var Zx=R((jje,Jx)=>{"use strict";p();u();l();var Lm=fd(),Xo=_d(),{MAX_LENGTH:Dm,POSIX_REGEX_SOURCE:Gre,REGEX_NON_SPECIAL_CHARS:jre,REGEX_SPECIAL_CHARS_BACKREF:Hre,REPLACEMENTS:Qx}=Lm,Fre=(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=>Xo.escapeRegex(o)).join("..")}return n},Cu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ey=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Qx[t]||t;let n={...e},r=typeof n.maxLength=="number"?Math.min(Dm,n.maxLength):Dm,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=Lm.globChars(n.windows),d=Lm.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:_,SLASH_LITERAL:m,ONE_CHAR:E,DOTS_SLASH:T,NO_DOT:A,NO_DOT_SLASH:y,NO_DOTS_SLASH:O,QMARK:I,QMARK_NO_DOT:M,STAR:v,START_ANCHOR:G}=c,k=z=>`(${a}(?:(?!${G}${z.dot?T:f}).)*?)`,Q=n.dot?"":A,K=n.dot?I:M,ee=n.bash===!0?k(n):v;n.capture&&(ee=`(${ee})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let b={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=Xo.removePrefix(t,b),o=t.length;let pt=[],Fe=[],Se=[],C=s,P,wn=()=>b.index===o-1,Me=b.peek=(z=1)=>t[b.index+z],qe=b.advance=()=>t[++b.index]||"",Gr=()=>t.slice(b.index+1),jr=(z="",Xe=0)=>{b.consumed+=z,b.index+=Xe},Si=z=>{b.output+=z.output!=null?z.output:z.value,jr(z.value)},hne=()=>{let z=1;for(;Me()==="!"&&(Me(2)!=="("||Me(3)==="?");)qe(),b.start++,z++;return z%2===0?!1:(b.negated=!0,b.start++,!0)},Cm=z=>{b[z]++,Se.push(z)},Qa=z=>{b[z]--,Se.pop()},Oe=z=>{if(C.type==="globstar"){let Xe=b.braces>0&&(z.type==="comma"||z.type==="brace"),H=z.extglob===!0||pt.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!Xe&&!H&&(b.output=b.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=ee,b.output+=C.output)}if(pt.length&&z.type!=="paren"&&(pt[pt.length-1].inner+=z.value),(z.value||z.output)&&Si(z),C&&C.type==="text"&&z.type==="text"){C.output=(C.output||C.value)+z.value,C.value+=z.value;return}z.prev=C,i.push(z),C=z},Pm=(z,Xe)=>{let H={...d[Xe],conditions:1,inner:""};H.prev=C,H.parens=b.parens,H.output=b.output;let Ae=(n.capture?"(":"")+H.open;Cm("parens"),Oe({type:z,value:Xe,output:b.output?"":E}),Oe({type:"paren",extglob:!0,value:qe(),output:Ae}),pt.push(H)},Ene=z=>{let Xe=z.close+(n.capture?")":""),H;if(z.type==="negate"){let Ae=ee;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(Ae=k(n)),(Ae!==ee||wn()||/^\)+$/.test(Gr()))&&(Xe=z.close=`)$))${Ae}`),z.inner.includes("*")&&(H=Gr())&&/^\.[^\\/.]+$/.test(H)){let st=Ey(H,{...e,fastpaths:!1}).output;Xe=z.close=`)${st})${Ae})`}z.prev.type==="bos"&&(b.negatedExtglob=!0)}Oe({type:"paren",extglob:!0,value:P,output:Xe}),Qa("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,Xe=t.replace(Hre,(H,Ae,st,Un,Ht,cy)=>Un==="\\"?(z=!0,H):Un==="?"?Ae?Ae+Un+(Ht?I.repeat(Ht.length):""):cy===0?K+(Ht?I.repeat(Ht.length):""):I.repeat(st.length):Un==="."?f.repeat(st.length):Un==="*"?Ae?Ae+Un+(Ht?ee:""):ee:Ae?H:`\\${H}`);return z===!0&&(n.unescape===!0?Xe=Xe.replace(/\\/g,""):Xe=Xe.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),Xe===t&&n.contains===!0?(b.output=t,b):(b.output=Xo.wrapOutput(Xe,b,e),b)}for(;!wn();){if(P=qe(),P==="\0")continue;if(P==="\\"){let H=Me();if(H==="/"&&n.bash!==!0||H==="."||H===";")continue;if(!H){P+="\\",Oe({type:"text",value:P});continue}let Ae=/^\\+/.exec(Gr()),st=0;if(Ae&&Ae[0].length>2&&(st=Ae[0].length,b.index+=st,st%2!==0&&(P+="\\")),n.unescape===!0?P=qe():P+=qe(),b.brackets===0){Oe({type:"text",value:P});continue}}if(b.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(n.posix!==!1&&P===":"){let H=C.value.slice(1);if(H.includes("[")&&(C.posix=!0,H.includes(":"))){let Ae=C.value.lastIndexOf("["),st=C.value.slice(0,Ae),Un=C.value.slice(Ae+2),Ht=Gre[Un];if(Ht){C.value=st+Ht,b.backtrack=!0,qe(),!s.output&&i.indexOf(C)===1&&(s.output=E);continue}}}(P==="["&&Me()!==":"||P==="-"&&Me()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),n.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Si({value:P});continue}if(b.quotes===1&&P!=='"'){P=Xo.escapeRegex(P),C.value+=P,Si({value:P});continue}if(P==='"'){b.quotes=b.quotes===1?0:1,n.keepQuotes===!0&&Oe({type:"text",value:P});continue}if(P==="("){Cm("parens"),Oe({type:"paren",value:P});continue}if(P===")"){if(b.parens===0&&n.strictBrackets===!0)throw new SyntaxError(Cu("opening","("));let H=pt[pt.length-1];if(H&&b.parens===H.parens+1){Ene(pt.pop());continue}Oe({type:"paren",value:P,output:b.parens?")":"\\)"}),Qa("parens");continue}if(P==="["){if(n.nobracket===!0||!Gr().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(Cu("closing","]"));P=`\\${P}`}else Cm("brackets");Oe({type:"bracket",value:P});continue}if(P==="]"){if(n.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){Oe({type:"text",value:P,output:`\\${P}`});continue}if(b.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(Cu("opening","["));Oe({type:"text",value:P,output:`\\${P}`});continue}Qa("brackets");let H=C.value.slice(1);if(C.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(P=`/${P}`),C.value+=P,Si({value:P}),n.literalBrackets===!1||Xo.hasRegexChars(H))continue;let Ae=Xo.escapeRegex(C.value);if(b.output=b.output.slice(0,-C.value.length),n.literalBrackets===!0){b.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,b.output+=C.value;continue}if(P==="{"&&n.nobrace!==!0){Cm("braces");let H={type:"brace",value:P,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};Fe.push(H),Oe(H);continue}if(P==="}"){let H=Fe[Fe.length-1];if(n.nobrace===!0||!H){Oe({type:"text",value:P,output:P});continue}let Ae=")";if(H.dots===!0){let st=i.slice(),Un=[];for(let Ht=st.length-1;Ht>=0&&(i.pop(),st[Ht].type!=="brace");Ht--)st[Ht].type!=="dots"&&Un.unshift(st[Ht].value);Ae=Fre(Un,n),b.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let st=b.output.slice(0,H.outputIndex),Un=b.tokens.slice(H.tokensIndex);H.value=H.output="\\{",P=Ae="\\}",b.output=st;for(let Ht of Un)b.output+=Ht.output||Ht.value}Oe({type:"brace",value:P,output:Ae}),Qa("braces"),Fe.pop();continue}if(P==="|"){pt.length>0&&pt[pt.length-1].conditions++,Oe({type:"text",value:P});continue}if(P===","){let H=P,Ae=Fe[Fe.length-1];Ae&&Se[Se.length-1]==="braces"&&(Ae.comma=!0,H="|"),Oe({type:"comma",value:P,output:H});continue}if(P==="/"){if(C.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",i.pop(),C=s;continue}Oe({type:"slash",value:P,output:m});continue}if(P==="."){if(b.braces>0&&C.type==="dot"){C.value==="."&&(C.output=f);let H=Fe[Fe.length-1];C.type="dots",C.output+=P,C.value+=P,H.dots=!0;continue}if(b.braces+b.parens===0&&C.type!=="bos"&&C.type!=="slash"){Oe({type:"text",value:P,output:f});continue}Oe({type:"dot",value:P,output:f});continue}if(P==="?"){if(!(C&&C.value==="(")&&n.noextglob!==!0&&Me()==="("&&Me(2)!=="?"){Pm("qmark",P);continue}if(C&&C.type==="paren"){let Ae=Me(),st=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Gr()))&&(st=`\\${P}`),Oe({type:"text",value:P,output:st});continue}if(n.dot!==!0&&(C.type==="slash"||C.type==="bos")){Oe({type:"qmark",value:P,output:M});continue}Oe({type:"qmark",value:P,output:I});continue}if(P==="!"){if(n.noextglob!==!0&&Me()==="("&&(Me(2)!=="?"||!/[!=<:]/.test(Me(3)))){Pm("negate",P);continue}if(n.nonegate!==!0&&b.index===0){hne();continue}}if(P==="+"){if(n.noextglob!==!0&&Me()==="("&&Me(2)!=="?"){Pm("plus",P);continue}if(C&&C.value==="("||n.regex===!1){Oe({type:"plus",value:P,output:_});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||b.parens>0){Oe({type:"plus",value:P});continue}Oe({type:"plus",value:_});continue}if(P==="@"){if(n.noextglob!==!0&&Me()==="("&&Me(2)!=="?"){Oe({type:"at",extglob:!0,value:P,output:""});continue}Oe({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let H=jre.exec(Gr());H&&(P+=H[0],b.index+=H[0].length),Oe({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=ee,b.backtrack=!0,b.globstar=!0,jr(P);continue}let z=Gr();if(n.noextglob!==!0&&/^\([^?]/.test(z)){Pm("star",P);continue}if(C.type==="star"){if(n.noglobstar===!0){jr(P);continue}let H=C.prev,Ae=H.prev,st=H.type==="slash"||H.type==="bos",Un=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(n.bash===!0&&(!st||z[0]&&z[0]!=="/")){Oe({type:"star",value:P,output:""});continue}let Ht=b.braces>0&&(H.type==="comma"||H.type==="brace"),cy=pt.length&&(H.type==="pipe"||H.type==="paren");if(!st&&H.type!=="paren"&&!Ht&&!cy){Oe({type:"star",value:P,output:""});continue}for(;z.slice(0,3)==="/**";){let Mm=t[b.index+4];if(Mm&&Mm!=="/")break;z=z.slice(3),jr("/**",3)}if(H.type==="bos"&&wn()){C.type="globstar",C.value+=P,C.output=k(n),b.output=C.output,b.globstar=!0,jr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!Un&&wn()){b.output=b.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=k(n)+(n.strictSlashes?")":"|$)"),C.value+=P,b.globstar=!0,b.output+=H.output+C.output,jr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&z[0]==="/"){let Mm=z[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=`${k(n)}${m}|${m}${Mm})`,C.value+=P,b.output+=H.output+C.output,b.globstar=!0,jr(P+qe()),Oe({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&z[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${m}|${k(n)}${m})`,b.output=C.output,b.globstar=!0,jr(P+qe()),Oe({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-C.output.length),C.type="globstar",C.output=k(n),C.value+=P,b.output+=C.output,b.globstar=!0,jr(P);continue}let Xe={type:"star",value:P,output:ee};if(n.bash===!0){Xe.output=".*?",(C.type==="bos"||C.type==="slash")&&(Xe.output=Q+Xe.output),Oe(Xe);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&n.regex===!0){Xe.output=P,Oe(Xe);continue}(b.index===b.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?(b.output+=y,C.output+=y):n.dot===!0?(b.output+=O,C.output+=O):(b.output+=Q,C.output+=Q),Me()!=="*"&&(b.output+=E,C.output+=E)),Oe(Xe)}for(;b.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(Cu("closing","]"));b.output=Xo.escapeLast(b.output,"["),Qa("brackets")}for(;b.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(Cu("closing",")"));b.output=Xo.escapeLast(b.output,"("),Qa("parens")}for(;b.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(Cu("closing","}"));b.output=Xo.escapeLast(b.output,"{"),Qa("braces")}if(n.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&Oe({type:"maybe_slash",value:"",output:`${m}?`}),b.backtrack===!0){b.output="";for(let z of b.tokens)b.output+=z.output!=null?z.output:z.value,z.suffix&&(b.output+=z.suffix)}return b};Ey.fastpaths=(t,e)=>{let n={...e},r=typeof n.maxLength=="number"?Math.min(Dm,n.maxLength):Dm,o=t.length;if(o>r)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);t=Qx[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}=Lm.globChars(n.windows),T=n.dot?f:d,A=n.dot?_:d,y=n.capture?"":"?:",O={negated:!1,prefix:""},I=n.bash===!0?".*?":m;n.capture&&(I=`(${I})`);let M=Q=>Q.noglobstar===!0?I:`(${y}(?:(?!${E}${Q.dot?c:s}).)*?)`,v=Q=>{switch(Q){case"*":return`${T}${a}${I}`;case".*":return`${s}${a}${I}`;case"*.*":return`${T}${I}${s}${a}${I}`;case"*/*":return`${T}${I}${i}${a}${A}${I}`;case"**":return T+M(n);case"**/*":return`(?:${T}${M(n)}${i})?${A}${a}${I}`;case"**/*.*":return`(?:${T}${M(n)}${i})?${A}${I}${s}${a}${I}`;case"**/.*":return`(?:${T}${M(n)}${i})?${s}${a}${I}`;default:{let K=/^(.*?)\.(\w+)$/.exec(Q);if(!K)return;let ee=v(K[1]);return ee?ee+s+K[2]:void 0}}},G=Xo.removePrefix(t,O),k=v(G);return k&&n.strictSlashes!==!0&&(k+=`${i}?`),k};Jx.exports=Ey});var nL=R((Vje,tL)=>{"use strict";p();u();l();var $re=Xx(),gy=Zx(),eL=_d(),Vre=fd(),qre=t=>t&&typeof t=="object"&&!Array.isArray(t),At=(t,e,n=!1)=>{if(Array.isArray(t)){let f=t.map(m=>At(m,e,n));return m=>{for(let E of f){let T=E(m);if(T)return T}return!1}}let r=qre(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?At.compileRe(t,e):At.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=At(o.ignore,f,n)}let d=(f,_=!1)=>{let{isMatch:m,match:E,output:T}=At.test(f,i,e,{glob:t,posix:s}),A={glob:t,state:a,regex:i,posix:s,input:f,output:T,match:E,isMatch:m};return typeof o.onResult=="function"&&o.onResult(A),m===!1?(A.isMatch=!1,_?A:!1):c(f)?(typeof o.onIgnore=="function"&&o.onIgnore(A),A.isMatch=!1,_?A:!1):(typeof o.onMatch=="function"&&o.onMatch(A),_?A:!0)};return n&&(d.state=a),d};At.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?eL.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=At.matchBase(t,e,n,o):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};At.matchBase=(t,e,n)=>(e instanceof RegExp?e:At.makeRe(e,n)).test(eL.basename(t));At.isMatch=(t,e,n)=>At(e,n)(t);At.parse=(t,e)=>Array.isArray(t)?t.map(n=>At.parse(n,e)):gy(t,{...e,fastpaths:!1});At.scan=(t,e)=>$re(t,e);At.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=At.toRegex(a,e);return r===!0&&(c.state=t),c};At.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=gy.fastpaths(t,e)),o.output||(o=gy(t,e)),At.compileRe(o,e,n,r)};At.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/$^/}};At.constants=Vre;tL.exports=At});var iL=R((Kje,sL)=>{"use strict";p();u();l();var rL=nL(),Yre=_d();function oL(t,e,n=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Yre.isWindows()}),rL(t,e,n)}Object.assign(oL,rL);sL.exports=oL});function zre(t,e={}){let n=t.length,r=Array(n),o=Array(n),s=!e.noglobstar;for(let i=0;i<n;i++){let a=lL(t[i]);r[i]=a;let c=a.length,d=Array(c);for(let f=0;f<c;f++)d[f]=(0,Mu.default)(a[f],e);o[i]=d}return i=>{let a=i.split("/");if(a[0]===".."&&Kre.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 aL(t,e,n){if(t===e||e.startsWith(`${t}/`)){if(n){let o=Qre(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=>yo.posix.relative(t,r)||".":r=>yo.posix.relative(t,`${e}/${r}`)||"."}function Jre(t,e){if(e.startsWith(`${t}/`)){let n=e.slice(t.length+1);return r=>`${n}/${r}`}return n=>{let r=yo.posix.relative(t,`${e}/${n}`);return n.endsWith("/")&&r!==""?`${r}/`:r||"."}}function lL(t){var e;let n=Mu.default.scan(t,Zre);return!((e=n.parts)===null||e===void 0)&&e.length?n.parts:[t]}function soe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let n=Mu.default.scan(t);return n.isGlob||n.negated}function Pu(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function Ty(t,e,n,r,o){let s=t;t.endsWith("/")&&(s=t.slice(0,-1)),!s.endsWith("*")&&e&&(s+="/**");let i=ooe(n);yo.default.isAbsolute(s.replace(aoe,""))?s=yo.posix.relative(i,s):s=yo.posix.normalize(s);let a=ioe.exec(s),c=lL(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=yo.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]||soe(E)||m===c.length-1)break;f.push(E)}r.depthOffset=f.length,r.commonPath=f,r.root=f.length>0?yo.posix.join(n,...f):n}return s}function coe({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(Ty(a,n,r,o,!0));for(let a of t)a&&(a[0]!=="!"||a[1]==="("?s.push(Ty(a,n,r,o,!1)):(a[1]!=="!"||a[2]==="(")&&i.push(Ty(a.slice(1),n,r,o,!0)));return{match:s,ignore:i}}function uoe(t,e){for(let n=t.length-1;n>=0;n--){let r=t[n];t[n]=e(r)}return t}function loe(t){return t?t instanceof URL?(0,cL.fileURLToPath)(t).replace(wm,"/"):yo.default.resolve(t).replace(wm,"/"):process.cwd().replace(wm,"/")}function poe(t,e={}){let n=process.env.TINYGLOBBY_DEBUG?{...e,debug:!0}:e,r=loe(n.cwd);if(n.debug&&Pu("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=coe({...n,patterns:t},r,o);n.debug&&Pu("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,Mu.default)(s.match,{...i,ignore:s.ignore}),c=(0,Mu.default)(s.ignore,i),d=zre(s.match,i),f=aL(r,o.root,n.absolute),_=n.absolute?f:aL(r,o.root,!0),m={filters:[n.debug?(A,y)=>{let O=f(A,y),I=a(O);return I&&Pu(`matched ${O}`),I}:(A,y)=>a(f(A,y))],exclude:n.debug?(A,y)=>{let O=_(y,!0),I=O!=="."&&!d(O)||c(O);return Pu(I?`skipped ${y}`:`crawling ${y}`),I}:(A,y)=>{let O=_(y,!0);return O!=="."&&!d(O)||c(O)},fs:n.fs?{readdir:n.fs.readdir||Ja.default.readdir,readdirSync:n.fs.readdirSync||Ja.default.readdirSync,realpath:n.fs.realpath||Ja.default.realpath,realpathSync:n.fs.realpathSync||Ja.default.realpathSync,stat:n.fs.stat||Ja.default.stat,statSync:n.fs.statSync||Ja.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(wm,"");let E=o.root;n.debug&&Pu("internal properties:",o);let T=r!==E&&!n.absolute&&Jre(r,o.root);return[new Ux(m).crawl(E),T]}async function pL(t,e){if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=Wre(t)||typeof t=="string",r=n?e:t,o=n?t:t.patterns,[s,i]=poe(o,r);return i?uoe(await s.withPromise(),i):s.withPromise()}var Ja,yo,cL,Mu,Wre,uL,Kre,Xre,Qre,Zre,eoe,toe,noe,roe,ooe,ioe,aoe,wm,dL=S(()=>{p();u();l();Ja=B(require("fs"),1),yo=B(require("path"),1),cL=require("url");kx();Mu=B(iL(),1),Wre=Array.isArray,uL=process.platform==="win32",Kre=/^(\/?\.\.)+$/;Xre=/^[A-Z]:\/$/i,Qre=uL?t=>Xre.test(t):t=>t==="/";Zre={parts:!0};eoe=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,toe=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,noe=t=>t.replace(eoe,"\\$&"),roe=t=>t.replace(toe,"\\$&"),ooe=uL?roe:noe;ioe=/^(\/?\.\.)+/,aoe=/\\(?=[()[\]{}!*+?@|])/g,wm=/\\/g});var Um,Za,fL,Sy,Ay,doe,foe,p=S(()=>{"use strict";Um=require("node:child_process"),Za=require("node:fs/promises"),fL=require("node:sqlite");dL();Sy=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)}},Ay=class{db;constructor(e){this.db=new fL.DatabaseSync(e)}exec(e){this.db.exec(e)}query(e){return new Sy(this.db.prepare(e))}close(){this.db.close()}},doe={Database:Ay};globalThis.__bun_sqlite_polyfill=doe;foe={file(t){return{async exists(){try{return await(0,Za.access)(t),!0}catch{return!1}},text(){return(0,Za.readFile)(t,"utf-8")},async json(){let e=await(0,Za.readFile)(t,"utf-8");return JSON.parse(e)}}},async write(t,e){await(0,Za.writeFile)(t,e,"utf-8")},which(t){try{let n=process.platform==="win32"?`where ${t}`:`which ${t}`;return(0,Um.execSync)(n,{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).trim().split(`
3
3
  `)[0]||null}catch{return null}},spawn(t,e){let[n,...r]=t,o=["ignore",e?.stdout??"ignore",e?.stderr??"ignore"],s=(0,Um.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 pL(this.pattern,{cwd:e?.cwd||process.cwd()});for(let r of n)yield r}}};globalThis.Bun=foe});function AL(t,e){let n=t.env?.[e];return typeof n=="string"&&n!=="0"}function by(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function Io(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 _oe(t){let e=new Map;return{get:(...n)=>e.get(n.join(","))??t,set:(n,...r)=>{e.set(r.join(","),n)}}}function moe(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=_oe(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 hoe(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 Ed(t,e,n){let r=e.map(s=>[s,moe(t,s,n)]).filter(([,s])=>s<=n.threshold),o=Math.min(...r.map(([,s])=>s));return r.filter(([,s])=>s===o).sort((s,i)=>hoe(s,i,t)).map(([s])=>s)}function km(t){return t instanceof Error?t.stack??String(t):String(t)}function Eoe(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 Bm(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 Eoe(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 Cy(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 goe(t,e){return t.reduce((n,r)=>{let o=e(r),s=n[o]??[];return s.push(r),n[o]=s,n},{})}function Toe(t,e){return goe(t,n=>n[e])}async function Ry(t){let e=await Promise.allSettled(t),n=Toe(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)??[]}}function yoe(t,e){let n=t.constructor.name,r=e[n];return r?r(t):t.message}function Ioe(t,e,n){return Object.fromEntries(Object.entries(e).map(([r,o])=>{let s=o,i=t[s];if(!i){let a=ks(s,n);throw new hd(a,[],r)}return[r,[s,i]]}))}function yy(t,e){return t.placeholder?t.placeholder:typeof e=="number"?`arg${e}`:"args"}function ks(t,e){return e==="allow-kebab-for-camel"?Io(t):t}function ec(t,e,n,r){try{return e.parse.call(r,n)}catch(o){throw new Oy(t,n,o)}}function hL(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 RL(t,e,n){let r=t,o=e[r],s,i=!1;if(!o){let c=hL(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=by(t);if(n.caseStyle==="allow-kebab-for-camel"&&!o){if(o=e[a],o)return{namedFlag:[a,o]};let c=hL(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=Io(s)),new hd(t,[f])}if(a in e)throw new hd(t,[a]);let c=Io(t);if(c in e)throw new hd(t,[c]);let d=Ed(r,Object.keys(e),n.distanceOptions);throw new hd(t,d)}return{namedFlag:[r,o]}}function EL(t){return t.namedFlag[1].kind==="boolean"||t.namedFlag[1].kind==="counter"}function Ooe(t,e,n,r){let o=yL.exec(t);if(o){let i=o[1];return Array.from(i).map(a=>{let c=a,d=n[c];if(!d)throw new Py(c);return{namedFlag:d}})}let s=Noe.exec(t);if(s){let i=s[1];return[RL(i,e,r)]}return[]}function Moe(t,e,n,r){let o=boe.exec(t);if(o){let i=o[1],{namedFlag:a,negated:c}=RL(i,e,r),d=o[2];if(c)throw new Poe(i,d);return[a,d]}let s=Coe.exec(t);if(s){let i=s[1],a=n[i];if(!a)throw new Py(i);let c=s[2];return[a,c]}}async function voe(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=Ed(a,e.values,r.distanceOptions);throw new Iy(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=>ec(t,e,a,o)))}return ec(t,e,e.default,o)}if(e.optional)return;if(e.kind==="boolean")return!1;if(e.kind==="counter")return 0;throw new vu(t)}if(e.kind==="counter")return n.reduce((i,a)=>{try{return i+No.call(o,a)}catch(c){throw new Oy(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=Ed(i,e.values,r.distanceOptions);throw new Iy(t,i,e.values,a)}return n}return Promise.all(n.map(i=>ec(t,e,i,o)))}let s=n[0];if(e.kind==="boolean")try{return Roe.call(o,s)}catch(i){throw new Oy(t,s,i)}if(e.kind==="enum"){if(!e.values.includes(s)){let i=Ed(s,e.values,r.distanceOptions);throw new Iy(t,s,e.values,i)}return s}return ec(t,e,s,o)}function IL(t){return t.kind==="counter"?!0:"variadic"in t?!!t.variadic:!1}function Us(t,e,[n,r],o){let s=t.get(n)??[];if(s.length>0&&!IL(r)){let i=ks(n,e);throw new xoe(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 Ny(t,e,n){if(e.get(n)){let o=t[n];return!IL(o)}return!1}function Loe(t,e){let{flags:n={},aliases:r={},positional:o={kind:"tuple",parameters:[]}}=t,s=Ioe(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)Us(a,e.caseStyle,d,""),d=void 0;else{let m=ks(d[0],e.caseStyle);throw new vu(m)}f=!0;return}if(!f){let m=Moe(_,n,s,e);if(m){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Us(a,e.caseStyle,d,""),d=void 0;else{let T=ks(d[0],e.caseStyle),A=ks(m[0][0],e.caseStyle);throw new vu(T,A)}Us(a,e.caseStyle,...m);return}let E=Ooe(_,n,s,e);if(E.length>0){if(d)if(d[1].kind==="parsed"&&d[1].inferEmpty)Us(a,e.caseStyle,d,""),d=void 0;else{let T=ks(d[0],e.caseStyle),A=ks(E[0].namedFlag[0],e.caseStyle);throw new vu(T,A)}if(E.every(EL))for(let T of E)T.namedFlag[1].kind==="boolean"?Us(a,e.caseStyle,T.namedFlag,T.negated?"false":"true"):Us(a,e.caseStyle,T.namedFlag,"1");else if(E.length>1){let T=E.find(y=>!EL(y)),A=ks(T.namedFlag[0],e.caseStyle);throw new vu(A)}else d=E[0].namedFlag;return}}if(d)Us(a,e.caseStyle,d,_),d=void 0;else{if(o.kind==="tuple"){if(c>=o.parameters.length)throw new _L(o.parameters.length,_)}else if(typeof o.maximum=="number"&&c>=o.maximum)throw new _L(o.maximum,_);i[c]=_,++c}},parseArguments:async _=>{let m=[],E;o.kind==="array"?(typeof o.minimum=="number"&&c<o.minimum&&m.push(new mL(yy(o.parameter),[o.minimum,c])),E=Ry(i.map(async(I,M)=>{let v=yy(o.parameter,M+1);return ec(v,o.parameter,I,_)}))):E=Ry(o.parameters.map(async(I,M)=>{let v=yy(I,M+1),G=i[M];if(typeof G!="string"){if(typeof I.default=="string")return ec(v,I,I.default,_);if(I.optional)return;throw new mL(v)}return ec(v,I,G,_)})),d&&d[1].kind==="parsed"&&d[1].inferEmpty&&(Us(a,e.caseStyle,d,""),d=void 0);let T=Ry(Object.entries(n).map(async I=>{let[M,v]=I,G=ks(M,e.caseStyle);if(d&&d[0]===M)throw new vu(G);let k=a.get(M),Q=await voe(G,v,k,e,_);return[M,Q]})),[A,y]=await Promise.all([E,T]);if(A.status==="rejected")for(let I of A.reasons)m.push(I);if(y.status==="rejected")for(let I of y.reasons)m.push(I);if(m.length>0)return{success:!1,errors:m};if(A.status==="rejected")throw new Bn("Unknown failure while scanning positional arguments");if(y.status==="rejected")throw new Bn("Unknown failure while scanning flag arguments");return{success:!0,arguments:[Object.fromEntries(y.value),...A.value]}},proposeCompletions:async({partial:_,completionConfig:m,text:E,context:T,includeVersionFlag:A})=>{if(d)return NL(d[1],T,_);let y=[];if(!f){let O=yL.exec(_);if(m.includeAliases){if(_===""||_==="-"){let I=Object.entries(r).filter(M=>!Ny(n,a,M[1]));for(let[M]of I){let v=s[M];v&&y.push({kind:"argument:flag",completion:`-${M}`,brief:v[1].brief})}}else if(O){let I=Array.from(O[1]);if(I.includes("h"))return[];if(A&&I.includes("v"))return[];let M=new Map(a);for(let k of I){let Q=s[k];if(!Q)throw new Py(k);Us(M,e.caseStyle,Q,Q[1].kind==="boolean"?"true":"1")}let v=I[I.length-1];if(v){let k=s[v];k&&y.push({kind:"argument:flag",completion:_,brief:k[1].brief})}let G=Object.entries(r).filter(k=>!Ny(n,M,k[1]));for(let[k]of G){let Q=s[k];Q&&y.push({kind:"argument:flag",completion:`${_}${k}`,brief:Q[1].brief})}}}if(_===""||_==="-"||_.startsWith("--")){e.allowArgumentEscapeSequence&&y.push({kind:"argument:flag",completion:"--",brief:E.briefs.argumentEscapeSequence});let I=Object.entries(n).filter(([v])=>!Ny(n,a,v));e.caseStyle==="allow-kebab-for-camel"&&(I=I.map(([v,G])=>[Io(v),G]));let M=I.map(([v,G])=>[`--${v}`,G]).filter(([v])=>v.startsWith(_));y.push(...M.map(([v,G])=>({kind:"argument:flag",completion:v,brief:G.brief})))}}if(o.kind==="array"){if(o.parameter.proposeCompletions&&(typeof o.maximum!="number"||c<o.maximum)){let O=await o.parameter.proposeCompletions.call(T,_);y.push(...O.map(I=>({kind:"argument:value",completion:I,brief:o.parameter.brief})))}}else{let O=o.parameters[c];if(O?.proposeCompletions){let I=await O.proposeCompletions.call(T,_);y.push(...I.map(M=>({kind:"argument:value",completion:M,brief:O.brief})))}}return y.filter(({completion:O})=>O.startsWith(_))}}}async function NL(t,e,n){if(typeof t.variadic=="string"&&n.endsWith(t.variadic))return NL(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 Doe(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]})}function Uoe(t){if(t.startsWith("en"))return woe}function Jo(t,e,n){return!n.disableAnsiColor&&!AL(t,"STRICLI_NO_COLOR")&&(e.getColorDepth?.(t.env)??1)>=4}async function koe({loader:t,parameters:e},{context:n,inputs:r,scannerConfig:o,errorFormatting:s,documentationConfig:i,determineExitCode:a}){let c;try{let f=Loe(e,o);for(let m of r)f.next(m);let _=await f.parseArguments(n);if(_.success)c=_.arguments;else{let m=Jo(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
4
4
  `:`${T}
5
5
  `)}return Qo.InvalidArgument}}catch(f){let _=Jo(n.process,n.process.stderr,i),m=s.exceptionWhileParsingArguments(f,_);return n.process.stderr.write(_?`\x1B[1m\x1B[31m${m}\x1B[39m\x1B[22m
@@ -336,7 +336,7 @@ Url: ${Vg(t)}`),!0}return!1}function ibe(t,e){return e?.length?Gg(t).some(n=>Xi(
336
336
  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(`
337
337
  >>> no match, partial?`,e,m,n,E),m===c))}let A;if(typeof f=="string"?(A=_===f,this.debug("string match",f,_,A)):(A=f.test(_),this.debug("pattern match",f,_,A)),!A)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 xX(this.pattern,this.options)}parse(e){F_(e);let n=this.options;if(e==="**")return _o;if(e==="")return"";let r,o=null;(r=e.match(B0e))?o=n.dot?j0e:G0e:(r=e.match(C0e))?o=(n.nocase?n.dot?x0e:v0e:n.dot?M0e:P0e)(r[1]):(r=e.match(H0e))?o=(n.nocase?n.dot?$0e:F0e:n.dot?V0e:q0e)(r):(r=e.match(L0e))?o=n.dot?w0e:D0e:(r=e.match(U0e))&&(o=k0e);let s=Rp.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?K0e:n.dot?z0e:X0e,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"?twe(f):f===_o?_o:f._src});return d.forEach((f,_)=>{let m=d[_+1],E=d[_-1];f!==_o||E===_o||(E===void 0?m!==void 0&&m!==_o?d[_+1]="(?:\\/|"+r+"\\/)?"+m:d[_]=r:m===void 0?d[_-1]=E+"(?:\\/|"+r+")?":m!==_o&&(d[_-1]=E+"(?:\\/|\\/"+r+"\\/)"+m,d[_+1]=_o))}),d.filter(f=>f!==_o).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 pn.defaults(e).Minimatch}};pn.AST=Rp;pn.Minimatch=yp;pn.escape=vM;pn.unescape=Ca});var LM,cA,BX,DX,rwe,owe,wX,Qe,Pa,li,Jn,Ma,V_,UX,kX,iA,aA,GX=S(()=>{p();u();l();LM=B(require("node:diagnostics_channel"),1);w();cA=B(ke(),1),BX=B(de(),1);ye();LX();DX="@fastify/otel",rwe="0.8.0",owe=">=4.0.0 <6",wX=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Qe={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},Pa={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},li="anonymous",Jn=Symbol("fastify otel instance"),Ma=Symbol("fastify otel request spans"),V_=Symbol("fastify otel request context"),UX=Symbol("fastify otel addhook original"),kX=Symbol("fastify otel setnotfound original"),iA=Symbol("fastify otel ignore path"),aA=class extends BX.InstrumentationBase{constructor(e){if(super(DX,rwe,e),this.servername=e?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[iA]=null,this._logger=Hn.createComponentLogger({namespace:DX}),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=pn;this[iA]=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)},LM.default.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){return this._handleInitialization&&(LM.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:owe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate(Jn,e),r.decorate(UX,r.addHook),r.decorate(kX,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let m=this[V_];return{span:this[Ma],tracer:e.tracer,context:m,inject:(T,A)=>Fn.inject(m,T,A),extract:(T,A)=>Fn.extract(m,T,A)}}),r.decorateRequest(Ma,null),r.decorateRequest(V_,null),r.addHook("onRoute",function(_){if(e[iA]?.(_)===!0){e._logger.debug(`Ignoring route instrumentation ${_.method} ${_.url} because it matches the ignore path`);return}for(let m of wX)if(_[m]!=null){let E=_[m];if(typeof E=="function")_[m]=f(E,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Qe.FASTIFY_TYPE]:Pa.ROUTE,[cr]:_.url,[Qe.HOOK_CALLBACK_NAME]:E.name?.length>0?E.name:li});else if(Array.isArray(E)){let T=[];for(let A of E)T.push(f(A,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Qe.FASTIFY_TYPE]:Pa.ROUTE,[cr]:_.url,[Qe.HOOK_CALLBACK_NAME]:A.name?.length>0?A.name:li}));_[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,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - route-handler`,[Qe.FASTIFY_TYPE]:Pa.HANDLER,[cr]:_.url,[Qe.HOOK_CALLBACK_NAME]:_.handler.name.length>0?_.handler.name:li})}),r.addHook("onRequest",function(_,m,E){if(this[Jn].isEnabled()===!1)return E();if(this[Jn][iA]?.({url:_.url,method:_.method})===!0)return this[Jn]._logger.debug(`Ignoring request ${_.method} ${_.url} because it matches the ignore path`),E();let T=V.active();ue.getSpan(T)==null&&(T=Fn.extract(T,_.headers));let A=(0,cA.getRPCMetadata)(T);_.routeOptions.url!=null&&A?.type===cA.RPCType.HTTP&&(A.route=_.routeOptions.url);let y=this[Jn].tracer.startSpan("request",{attributes:{[br]:r[Jn].servername,[Qe.ROOT]:"@fastify/otel",[cr]:_.url,[Ws]:_.method}},T);_[V_]=ue.setSpan(T,y),_[Ma]=y,V.with(_[V_],()=>{E()})}),r.addHook("onResponse",function(_,m,E){let T=_[Ma];T!=null&&(T.setStatus({code:nt.OK,message:"OK"}),T.setAttributes({[ls]:404}),T.end()),_[Ma]=null,E()}),r.addHook=c,r.setNotFoundHandler=d,s();function i(_,m,E,T){let A=_[Ma];A!=null&&(m.statusCode<500&&A.setStatus({code:nt.OK,message:"OK"}),A.setAttributes({[ls]:m.statusCode}),A.end()),_[Ma]=null,T(null,E)}function a(_,m,E,T){let A=_[Ma];A!=null&&(A.setStatus({code:nt.ERROR,message:E.message}),A.recordException(E)),T()}function c(_,m){let E=this[UX];return wX.includes(_)?E.call(this,_,f(m,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - ${_}`,[Qe.FASTIFY_TYPE]:Pa.INSTANCE,[Qe.HOOK_CALLBACK_NAME]:m.name?.length>0?m.name:li})):E.call(this,_,m)}function d(_,m){let E=this[kX];typeof _=="function"?(m=f(_,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Qe.FASTIFY_TYPE]:Pa.INSTANCE,[Qe.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:li}),E.call(this,m)):(_.preValidation!=null&&(_.preValidation=f(_.preValidation,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Qe.FASTIFY_TYPE]:Pa.INSTANCE,[Qe.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:li})),_.preHandler!=null&&(_.preHandler=f(_.preHandler,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Qe.FASTIFY_TYPE]:Pa.INSTANCE,[Qe.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:li})),m=f(m,{[br]:r[Jn].servername,[Qe.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Qe.FASTIFY_TYPE]:Pa.INSTANCE,[Qe.HOOK_CALLBACK_NAME]:m.name?.length>0?m.name:li}),E.call(this,_,m))}function f(_,m={}){return function(...T){let A=this[Jn],[y]=T;if(A.isEnabled()===!1)return _.call(this,...T);let O=y[V_]??V.active(),I=A.tracer.startSpan(`handler - ${_.name?.length>0?_.name:this.pluginName??li}`,{attributes:m},O);return V.with(ue.setSpan(O,I),function(){try{let M=_.call(this,...T);return typeof M?.then=="function"?M.then(v=>(I.end(),v),v=>(I.setStatus({code:nt.ERROR,message:v.message}),I.recordException(v),I.end(),Promise.reject(v))):(I.end(),M)}catch(M){throw I.setStatus({code:nt.ERROR,message:M.message}),I.recordException(M),I.end(),M}},this)}}}}}});var pi,q_,Y_,jX=S(()=>{p();u();l();(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})(pi||(pi={}));(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(q_||(q_={}));(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(Y_||(Y_={}))});var W_,HX=S(()=>{p();u();l();W_=Symbol("opentelemetry.instrumentation.fastify.request_active_span")});function DM(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[W_]||[];return s.push(o),Object.defineProperty(t,W_,{enumerable:!1,configurable:!0,value:s}),o}function uA(t,e){let n=t[W_]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:nt.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[W_])}function $X(t,e,n){let r,o;try{o=t(),FX(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!FX(o)&&(e(r,o),r))throw r;return o}}function FX(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var VX=S(()=>{p();u();l();w();HX()});function cwe(){let t=q();t&&t.on("spanStart",e=>{YX(e)})}function YX(t){let e=se(t).data,n=e["fastify.type"];if(e[fe]||!n)return;t.setAttributes({[pe]:"auto.http.otel.fastify",[fe]:`${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 pA,gu,swe,iwe,qX,awe,lA,WX=S(()=>{p();u();l();w();pA=B(ke(),1),gu=B(de(),1);ye();te();jX();VX();swe="0.1.0",iwe="@sentry/instrumentation-fastify-v3",qX="anonymous",awe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),lA=class extends gu.InstrumentationBase{constructor(e={}){super(iwe,swe,e)}init(){return[new gu.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,pA.getRPCMetadata)(V.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===pA.RPCType.HTTP&&(a.route=c);let d=r.method||"GET";Ne().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||qX,c=`${Y_.MIDDLEWARE} - ${a}`,d=i[1],f=DM(d,s.tracer,c,{[pi.FASTIFY_TYPE]:q_.MIDDLEWARE,[pi.PLUGIN_NAME]:e,[pi.HOOK_NAME]:n}),_=o&&i[i.length-1];return _&&(i[i.length-1]=function(...m){uA(d),_.apply(this,m)}),V.with(ue.setSpan(V.active(),f),()=>$X(()=>r.apply(this,i),m=>{m instanceof Error&&(f.setStatus({code:nt.ERROR,message:m.message}),f.recordException(m)),o||uA(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(!awe.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()),cwe(),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,gu.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),uA(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=`${Y_.REQUEST_HANDLER} - ${c||this.pluginName||qX}`,f={[pi.PLUGIN_NAME]:this.pluginName,[pi.FASTIFY_TYPE]:q_.REQUEST_HANDLER,[bN]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(f[pi.FASTIFY_NAME]=c);let _=DM(o,e.tracer,d,f);YX(_);let{requestHook:m}=e.getConfig();return m&&(0,gu.safeExecuteInTheMiddle)(()=>m(_,{request:r}),E=>{E&&e._diag.error("request hook failed",E)},!0),V.with(ue.setSpan(V.active(),_),()=>{s()})}}}});function uwe(){let t=q();if(t)return t.getIntegrationByName(dA)}function KX(t,e,n,r){let o=uwe()?.getShouldHandleError()||JX;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){ht&&N.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)&&_e(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}function JX(t,e,n){let r=n.statusCode;return r>=500||r<=299}function ZX(t){let e=se(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[fe]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request-handler":"<unknown>";t.setAttributes({[pe]:"auto.http.otel.fastify",[fe]:`${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 pwe(){let t=q();t&&t.on("spanStart",e=>{ZX(e)})}function dwe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&ZX(s)}let r=e.routeOptions?.url,o=e.method||"GET";Ne().setTransactionName(`${o} ${r}`)})}var wM,dA,zX,XX,lwe,QX,eQ=S(()=>{p();u();l();wM=B(require("node:diagnostics_channel"),1);te();xe();Eu();GX();WX();dA="Fastify",zX=X(`${dA}.v3`,()=>new lA);XX=X(`${dA}.v5`,()=>{let t=new aA,e=t.plugin();return wM.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?ht&&N.error("Failed to setup Fastify instrumentation",o):(pwe(),r&&dwe(r))})}),wM.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;KX.call(KX,r,o,s,"diagnostics-channel")}),t}),lwe=(({shouldHandleError:t})=>{let e;return{name:dA,setupOnce(){e=t||JX,zX(),XX()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}}),QX=(t={})=>lwe(t)});var UM=R(Yo=>{"use strict";p();u();l();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.SpanNames=Yo.TokenKind=Yo.AllowedOperationTypes=void 0;var fwe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(fwe=Yo.AllowedOperationTypes||(Yo.AllowedOperationTypes={}));var _we;(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"})(_we=Yo.TokenKind||(Yo.TokenKind={}));var mwe;(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"})(mwe=Yo.SpanNames||(Yo.SpanNames={}))});var kM=R(K_=>{"use strict";p();u();l();Object.defineProperty(K_,"__esModule",{value:!0});K_.AttributeNames=void 0;var hwe;(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"})(hwe=K_.AttributeNames||(K_.AttributeNames={}))});var fA=R(Ip=>{"use strict";p();u();l();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.OTEL_GRAPHQL_DATA_SYMBOL=Ip.OTEL_PATCHED_SYMBOL=void 0;Ip.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");Ip.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var tQ=R(_A=>{"use strict";p();u();l();Object.defineProperty(_A,"__esModule",{value:!0});_A.OPERATION_NOT_SUPPORTED=void 0;var gxt=fA();_A.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var mQ=R(Wt=>{"use strict";p();u();l();Object.defineProperty(Wt,"__esModule",{value:!0});Wt.wrapFieldResolver=Wt.wrapFields=Wt.getSourceFromLocation=Wt.getOperation=Wt.endSpan=Wt.addSpanSource=Wt.addInputVariableAttributes=Wt.isPromise=void 0;var Op=(w(),x(j)),va=UM(),Np=kM(),di=fA(),nQ=Object.values(va.AllowedOperationTypes),Ewe=t=>typeof t?.then=="function";Wt.isPromise=Ewe;var gwe=t=>typeof t=="object"&&t!==null;function BM(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{BM(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{BM(t,`${e}.${r}`,o)}):t.setAttribute(`${Np.AttributeNames.VARIABLES}${String(e)}`,n)}function Twe(t,e){Object.entries(e).forEach(([n,r])=>{BM(t,n,r)})}Wt.addInputVariableAttributes=Twe;function iQ(t,e,n,r,o){let s=pQ(e,n,r,o);t.setAttribute(Np.AttributeNames.SOURCE,s)}Wt.addSpanSource=iQ;function Swe(t,e,n,r,o){let s=aQ(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?uQ(n):cQ(n,o);return s={span:Awe(t,e,n,r,o,a)},Iwe(n,o,s),{field:s,spanAdded:!0}}function Awe(t,e,n,r,o,s){let i={[Np.AttributeNames.FIELD_NAME]:r.fieldName,[Np.AttributeNames.FIELD_PATH]:o.join("."),[Np.AttributeNames.FIELD_TYPE]:r.returnType.toString()},a=t.startSpan(`${va.SpanNames.RESOLVE} ${i[Np.AttributeNames.FIELD_PATH]}`,{attributes:i},s?Op.trace.setSpan(Op.context.active(),s):void 0),c=n[di.OTEL_GRAPHQL_DATA_SYMBOL].source,d=r.fieldNodes.find(f=>f.kind==="Field");return d&&iQ(a,c.loc,e().allowValues,d.loc?.start,d.loc?.end),a}function Rwe(t,e){e&&t.recordException(e),t.end()}Wt.endSpan=Rwe;function ywe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>nQ.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>nQ.indexOf(n?.operation)!==-1)}Wt.getOperation=ywe;function Iwe(t,e,n){return t[di.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function aQ(t,e){return t[di.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function cQ(t,e){for(let n=e.length-1;n>0;n--){let r=aQ(t,e.slice(0,n));if(r)return r.span}return uQ(t)}function uQ(t){return t[di.OTEL_GRAPHQL_DATA_SYMBOL].span}function Nwe(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 Owe(t){return lQ(`
338
338
  `,t)}function rQ(t){return lQ(" ",t)}function lQ(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var bwe=[va.TokenKind.FLOAT,va.TokenKind.STRING,va.TokenKind.INT,va.TokenKind.BLOCK_STRING];function pQ(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&&bwe.indexOf(a.kind)>=0&&(d="*"),a.kind===va.TokenKind.STRING&&(d=`"${d}"`),a.kind===va.TokenKind.EOF&&(d=""),a.line>c?(o+=Owe(a.line-c),c=a.line,f=rQ(a.column-1)):a.line===a.prev?.line&&(f=rQ(a.start-(a.prev?.end||0))),o+=f+d,a&&(a=a.next)}}return o}Wt.getSourceFromLocation=pQ;function dQ(t,e,n){if(!t||t[di.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[di.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=_Q(e,n,s.resolve)),s.type)){let i=fQ(s.type);for(let a of i)dQ(a,e,n)}})}Wt.wrapFields=dQ;function fQ(t){return"ofType"in t?fQ(t.ofType):Cwe(t)?t.getTypes():Pwe(t)?[t]:[]}function Cwe(t){return"getTypes"in t&&typeof t.getTypes=="function"}function Pwe(t){return"getFields"in t&&typeof t.getFields=="function"}var oQ=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:Op.SpanStatusCode.ERROR,message:e.message}),t.end())},sQ=(t,e)=>{e&&t.end()};function _Q(t,e,n,r=!1){if(o[di.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let d=e();if(d.ignoreTrivialResolveSpans&&r&&(gwe(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[di.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let f=Nwe(d.mergeItems,c&&c.path),_=f.filter(T=>typeof T=="string").length,m,E=!1;if(d.depth>=0&&d.depth<_)m=cQ(a,f);else{let{field:T,spanAdded:A}=Swe(t,e,a,c,f);m=T.span,E=A}return Op.context.with(Op.trace.setSpan(Op.context.active(),m),()=>{try{let T=n.call(this,s,i,a,c);return(0,Wt.isPromise)(T)?T.then(A=>(sQ(m,E),A),A=>{throw oQ(m,A,E),A}):(sQ(m,E),T)}catch(T){throw oQ(m,T,E),T}})}return o[di.OTEL_PATCHED_SYMBOL]=!0,o}Wt.wrapFieldResolver=_Q});var hQ=R(bp=>{"use strict";p();u();l();Object.defineProperty(bp,"__esModule",{value:!0});bp.PACKAGE_NAME=bp.PACKAGE_VERSION=void 0;bp.PACKAGE_VERSION="0.57.0";bp.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var TQ=R(EA=>{"use strict";p();u();l();Object.defineProperty(EA,"__esModule",{value:!0});EA.GraphQLInstrumentation=void 0;var fi=(w(),x(j)),mo=de(),z_=UM(),mA=kM(),GM=fA(),Mwe=tQ(),vn=mQ(),EQ=hQ(),gQ={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},hA=[">=14.0.0 <17"],jM=class extends mo.InstrumentationBase{constructor(e={}){super(EQ.PACKAGE_NAME,EQ.PACKAGE_VERSION,{...gQ,...e})}setConfig(e={}){super.setConfig({...gQ,...e})}init(){let e=new mo.InstrumentationNodeModuleDefinition("graphql",hA);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new mo.InstrumentationNodeModuleFile("graphql/execution/execute.js",hA,e=>((0,mo.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 mo.InstrumentationNodeModuleFile("graphql/language/parser.js",hA,e=>((0,mo.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new mo.InstrumentationNodeModuleFile("graphql/validation/validate.js",hA,e=>((0,mo.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,vn.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[GM.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[GM.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},fi.context.with(fi.trace.setSpan(fi.context.active(),c),()=>(0,mo.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,vn.endSpan)(e,n);return}if((0,vn.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,vn.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,vn.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,vn.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,mo.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,vn.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(z_.SpanNames.PARSE);return fi.context.with(fi.trace.setSpan(fi.context.active(),i),()=>(0,mo.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,vn.getOperation)(c)?c.loc&&(0,vn.addSpanSource)(i,c.loc,s.allowValues):i.updateName(z_.SpanNames.SCHEMA_PARSE)),(0,vn.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(z_.SpanNames.VALIDATE,{});return fi.context.with(fi.trace.setSpan(fi.context.active(),c),()=>(0,mo.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(d,f)=>{o.loc||c.updateName(z_.SpanNames.SCHEMA_VALIDATE),f&&f.length&&c.recordException({name:mA.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(f)}),(0,vn.endSpan)(c,d)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(z_.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(mA.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(mA.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=Mwe.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(mA.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,vn.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,vn.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,d){if(o||(o={}),o[GM.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,vn.wrapFieldResolver)(this.tracer,()=>this.getConfig(),_,f),e&&((0,vn.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,vn.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};EA.GraphQLInstrumentation=jM});var SQ=R(gA=>{"use strict";p();u();l();Object.defineProperty(gA,"__esModule",{value:!0});gA.GraphQLInstrumentation=void 0;var vwe=TQ();Object.defineProperty(gA,"GraphQLInstrumentation",{enumerable:!0,get:function(){return vwe.GraphQLInstrumentation}})});function NQ(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function Lwe(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}`}var AQ,RQ,yQ,xwe,IQ,OQ=S(()=>{p();u();l();w();AQ=B(SQ(),1);te();xe();Na();RQ="Graphql",yQ=X(RQ,AQ.GraphQLInstrumentation,t=>{let e=NQ(t);return{...e,responseHook(n,r){Be(n,"auto.graphql.otel.graphql"),r.errors?.length&&!se(n).status&&n.setStatus({code:nt.ERROR});let s=se(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=ft(n),f=se(c).data[dp]||[],_=a?`${i} ${a}`:`${i}`;Array.isArray(f)?(f.push(_),c.setAttribute(dp,f)):typeof f=="string"?c.setAttribute(dp,[f,_]):c.setAttribute(dp,_),se(c).data["original-description"]||c.setAttribute("original-description",se(c).description),c.updateName(`${se(c).data["original-description"]} (${Lwe(f)})`)}}}}),xwe=((t={})=>({name:RQ,setupOnce(){yQ(NQ(t))}})),IQ=xwe});var bQ=R(TA=>{"use strict";p();u();l();Object.defineProperty(TA,"__esModule",{value:!0});TA.EVENT_LISTENERS_SET=void 0;TA.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var CQ=R(SA=>{"use strict";p();u();l();Object.defineProperty(SA,"__esModule",{value:!0});SA.bufferTextMapGetter=void 0;SA.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 PQ=R(be=>{"use strict";p();u();l();Object.defineProperty(be,"__esModule",{value:!0});be.METRIC_MESSAGING_PROCESS_DURATION=be.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=be.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=be.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=be.MESSAGING_SYSTEM_VALUE_KAFKA=be.MESSAGING_OPERATION_TYPE_VALUE_SEND=be.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=be.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=be.ATTR_MESSAGING_SYSTEM=be.ATTR_MESSAGING_OPERATION_TYPE=be.ATTR_MESSAGING_OPERATION_NAME=be.ATTR_MESSAGING_KAFKA_OFFSET=be.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=be.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=be.ATTR_MESSAGING_DESTINATION_PARTITION_ID=be.ATTR_MESSAGING_DESTINATION_NAME=be.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;be.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";be.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";be.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";be.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";be.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";be.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";be.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";be.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";be.ATTR_MESSAGING_SYSTEM="messaging.system";be.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";be.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";be.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";be.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";be.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";be.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";be.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";be.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var MQ=R(Cp=>{"use strict";p();u();l();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.PACKAGE_NAME=Cp.PACKAGE_VERSION=void 0;Cp.PACKAGE_VERSION="0.19.0";Cp.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var UQ=R(RA=>{"use strict";p();u();l();Object.defineProperty(RA,"__esModule",{value:!0});RA.KafkaJsInstrumentation=void 0;var je=(w(),x(j)),ho=de(),Pp=(ye(),x(Ge)),vQ=bQ(),xQ=CQ(),J=PQ(),LQ=MQ();function AA(t,e,n){return r=>{t.add(e,{...n,...r?{[Pp.ATTR_ERROR_TYPE]:r}:{}})}}function DQ(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[Pp.ATTR_ERROR_TYPE]:r}:{}})}}var wQ=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],HM=class extends ho.InstrumentationBase{constructor(e={}){super(LQ.PACKAGE_NAME,LQ.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(J.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:wQ}}),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:wQ}})}init(){let e=r=>{(0,ho.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,ho.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new ho.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,ho.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[vQ.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[vQ.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}`,[Pp.ATTR_SERVER_ADDRESS]:n,[Pp.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,ho.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,ho.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,ho.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,ho.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,ho.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=je.propagation.extract(je.ROOT_CONTEXT,s.message.headers,xQ.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=[DQ(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)}),AA(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=je.context.with(je.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:je.ROOT_CONTEXT,attributes:{[J.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[J.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return je.context.with(je.trace.setSpan(je.context.active(),i),()=>{let a=Date.now(),c=[],d=[AA(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=je.propagation.extract(je.ROOT_CONTEXT,_.headers,xQ.bufferTextMapGetter),E=je.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(DQ(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 je.context.with(je.trace.setSpan(je.context.active(),s),()=>e._getSendPatch()(c).apply(this,E).catch(A=>{throw s.setStatus({code:je.SpanStatusCode.ERROR,message:A?.message}),s.recordException(A),A}))};let d=a.sendBatch;a.sendBatch=function(...E){return je.context.with(je.trace.setSpan(je.context.active(),s),()=>e._getSendBatchPatch()(d).apply(this,E).catch(A=>{throw s.setStatus({code:je.SpanStatusCode.ERROR,message:A?.message}),s.recordException(A),A}))};let f=a.commit;a.commit=function(...E){let T=f.apply(this,E).then(()=>{s.setStatus({code:je.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:je.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(AA(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=>AA(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=Pp.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(Pp.ATTR_ERROR_TYPE,i),a.setStatus({code:je.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?je.SpanKind.CLIENT:je.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,ho.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:je.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??{},je.propagation.inject(je.trace.setSpan(je.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,ho.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};RA.KafkaJsInstrumentation=HM});var kQ=R(yA=>{"use strict";p();u();l();Object.defineProperty(yA,"__esModule",{value:!0});yA.KafkaJsInstrumentation=void 0;var Dwe=UQ();Object.defineProperty(yA,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return Dwe.KafkaJsInstrumentation}})});var BQ,GQ,jQ,wwe,HQ,FQ=S(()=>{p();u();l();BQ=B(kQ(),1);xe();GQ="Kafka",jQ=X(GQ,()=>new BQ.KafkaJsInstrumentation({consumerHook(t){Be(t,"auto.kafkajs.otel.consumer")},producerHook(t){Be(t,"auto.kafkajs.otel.producer")}})),wwe=(()=>({name:GQ,setupOnce(){jQ()}})),HQ=wwe});var $Q=R(Mp=>{"use strict";p();u();l();Object.defineProperty(Mp,"__esModule",{value:!0});Mp.PACKAGE_NAME=Mp.PACKAGE_VERSION=void 0;Mp.PACKAGE_VERSION="0.54.0";Mp.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var WQ=R(IA=>{"use strict";p();u();l();Object.defineProperty(IA,"__esModule",{value:!0});IA.LruMemoizerInstrumentation=void 0;var VQ=(w(),x(j)),qQ=de(),YQ=$Q(),FM=class extends qQ.InstrumentationBase{constructor(e={}){super(YQ.PACKAGE_NAME,YQ.PACKAGE_VERSION,e)}init(){return[new qQ.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"?VQ.context.bind(VQ.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};IA.LruMemoizerInstrumentation=FM});var KQ=R(NA=>{"use strict";p();u();l();Object.defineProperty(NA,"__esModule",{value:!0});NA.LruMemoizerInstrumentation=void 0;var Uwe=WQ();Object.defineProperty(NA,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return Uwe.LruMemoizerInstrumentation}})});var zQ,XQ,QQ,kwe,JQ,ZQ=S(()=>{p();u();l();zQ=B(KQ(),1);xe();XQ="LruMemoizer",QQ=X(XQ,()=>new zQ.LruMemoizerInstrumentation),kwe=(()=>({name:XQ,setupOnce(){QQ()}})),JQ=kwe});var e8=R(ot=>{"use strict";p();u();l();Object.defineProperty(ot,"__esModule",{value:!0});ot.METRIC_DB_CLIENT_CONNECTIONS_USAGE=ot.DB_SYSTEM_VALUE_MONGODB=ot.DB_SYSTEM_NAME_VALUE_MONGODB=ot.ATTR_NET_PEER_PORT=ot.ATTR_NET_PEER_NAME=ot.ATTR_DB_SYSTEM=ot.ATTR_DB_STATEMENT=ot.ATTR_DB_OPERATION=ot.ATTR_DB_NAME=ot.ATTR_DB_MONGODB_COLLECTION=ot.ATTR_DB_CONNECTION_STRING=void 0;ot.ATTR_DB_CONNECTION_STRING="db.connection_string";ot.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";ot.ATTR_DB_NAME="db.name";ot.ATTR_DB_OPERATION="db.operation";ot.ATTR_DB_STATEMENT="db.statement";ot.ATTR_DB_SYSTEM="db.system";ot.ATTR_NET_PEER_NAME="net.peer.name";ot.ATTR_NET_PEER_PORT="net.peer.port";ot.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";ot.DB_SYSTEM_VALUE_MONGODB="mongodb";ot.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var t8=R(X_=>{"use strict";p();u();l();Object.defineProperty(X_,"__esModule",{value:!0});X_.MongodbCommandType=void 0;var Bwe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(Bwe=X_.MongodbCommandType||(X_.MongodbCommandType={}))});var n8=R(vp=>{"use strict";p();u();l();Object.defineProperty(vp,"__esModule",{value:!0});vp.PACKAGE_NAME=vp.PACKAGE_VERSION=void 0;vp.PACKAGE_VERSION="0.63.0";vp.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var s8=R(OA=>{"use strict";p();u();l();Object.defineProperty(OA,"__esModule",{value:!0});OA.MongoDBInstrumentation=void 0;var ct=(w(),x(j)),Ce=de(),_i=(ye(),x(Ge)),wr=e8(),Tu=t8(),r8=n8(),o8={requireParentSpan:!0},$M=class t extends Ce.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(r8.PACKAGE_NAME,r8.PACKAGE_VERSION,{...o8,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ce.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ce.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...o8,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter(wr.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 Ce.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new Ce.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new Ce.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new Ce.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new Ce.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new Ce.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,d),new Ce.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new Ce.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],f,_)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,Ce.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,Ce.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,Ce.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,Ce.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,Ce.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,Ce.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,Ce.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,Ce.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,Ce.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,Ce.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,Ce.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,Ce.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=ct.context.bind(ct.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,Ce.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,Ce.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=ct.trace.getSpan(ct.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),A=n.tracer.startSpan(T,{kind:ct.SpanKind.CLIENT,attributes:E}),y=n._patchEnd(A,m);return typeof c=="function"?r.call(this,s,i,a,y):r.call(this,s,i,a,c,y)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let d=ct.trace.getSpan(ct.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===Tu.MongodbCommandType.UNKNOWN?void 0:m,T=e._getV3SpanAttributes(s,o,i,E),A=e._spanNameFromAttrs(T),y=e.tracer.startSpan(A,{kind:ct.SpanKind.CLIENT,attributes:T}),O=e._patchEnd(y,_);return typeof a=="function"?n.call(this,o,s,i,O):n.call(this,o,s,i,a,O)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=ct.trace.getSpan(ct.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,_),A=e._spanNameFromAttrs(T);m=e.tracer.startSpan(A,{kind:ct.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=ct.trace.getSpan(ct.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),A=e._spanNameFromAttrs(T);_=e.tracer.startSpan(A,{kind:ct.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=ct.trace.getSpan(ct.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),A=e.tracer.startSpan(T,{kind:ct.SpanKind.CLIENT,attributes:E}),y=e._patchEnd(A,m);return typeof c=="function"?n.call(this,o,s,i,a,y):n.call(this,o,s,i,a,c,y)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,d){let f=ct.trace.getSpan(ct.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),A=e.tracer.startSpan(T,{kind:ct.SpanKind.CLIENT,attributes:E}),y=e._patchEnd(A,m);return typeof c=="function"?n.call(this,o,s,i,a,y):n.call(this,o,s,i,a,c,y)}}static _getCommandType(e){return e.createIndexes!==void 0?Tu.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?Tu.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?Tu.MongodbCommandType.IS_MASTER:e.count!==void 0?Tu.MongodbCommandType.COUNT:e.aggregate!==void 0?Tu.MongodbCommandType.AGGREGATE:Tu.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&Ce.SemconvStability.OLD&&(a[wr.ATTR_DB_SYSTEM]=wr.DB_SYSTEM_VALUE_MONGODB,a[wr.ATTR_DB_NAME]=e,a[wr.ATTR_DB_MONGODB_COLLECTION]=n,a[wr.ATTR_DB_OPERATION]=i,a[wr.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&Ce.SemconvStability.STABLE&&(a[_i.ATTR_DB_SYSTEM_NAME]=wr.DB_SYSTEM_NAME_VALUE_MONGODB,a[_i.ATTR_DB_NAMESPACE]=e,a[_i.ATTR_DB_OPERATION_NAME]=i,a[_i.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&Ce.SemconvStability.OLD&&(a[wr.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&Ce.SemconvStability.STABLE&&(a[_i.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&Ce.SemconvStability.OLD&&(a[wr.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&Ce.SemconvStability.STABLE&&(a[_i.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),d=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,Ce.safeExecuteInTheMiddle)(()=>{let f=d(s);this._dbSemconvStability&Ce.SemconvStability.OLD&&(a[wr.ATTR_DB_STATEMENT]=f),this._dbSemconvStability&Ce.SemconvStability.STABLE&&(a[_i.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&Ce.SemconvStability.STABLE?n=[e[_i.ATTR_DB_OPERATION_NAME],e[_i.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||wr.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[wr.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,Ce.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=ct.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:ct.SpanStatusCode.ERROR,message:f.message});else{let _=d[1];i._handleExecutionResult(e,_)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return ct.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}};OA.MongoDBInstrumentation=$M});var i8=R(Q_=>{"use strict";p();u();l();Object.defineProperty(Q_,"__esModule",{value:!0});Q_.MongodbCommandType=void 0;var Gwe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(Gwe=Q_.MongodbCommandType||(Q_.MongodbCommandType={}))});var a8=R(xp=>{"use strict";p();u();l();Object.defineProperty(xp,"__esModule",{value:!0});xp.MongodbCommandType=xp.MongoDBInstrumentation=void 0;var jwe=s8();Object.defineProperty(xp,"MongoDBInstrumentation",{enumerable:!0,get:function(){return jwe.MongoDBInstrumentation}});var Hwe=i8();Object.defineProperty(xp,"MongodbCommandType",{enumerable:!0,get:function(){return Hwe.MongodbCommandType}})});function Fwe(t){let e=VM(t);return JSON.stringify(e)}function VM(t){if(Array.isArray(t))return t.map(e=>VM(e));if($we(t)){let e={};return Object.entries(t).map(([n,r])=>[n,VM(r)]).reduce((n,r)=>(qwe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function $we(t){return typeof t=="object"&&t!==null&&!Vwe(t)}function Vwe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function qwe(t){return Array.isArray(t)}var c8,u8,l8,Ywe,p8,d8=S(()=>{p();u();l();c8=B(a8(),1);xe();u8="Mongo",l8=X(u8,()=>new c8.MongoDBInstrumentation({dbStatementSerializer:Fwe,responseHook(t){Be(t,"auto.db.otel.mongo")}}));Ywe=(()=>({name:u8,setupOnce(){l8()}})),p8=Ywe});var qM=R(kt=>{"use strict";p();u();l();Object.defineProperty(kt,"__esModule",{value:!0});kt.DB_SYSTEM_NAME_VALUE_MONGODB=kt.ATTR_NET_PEER_PORT=kt.ATTR_NET_PEER_NAME=kt.ATTR_DB_USER=kt.ATTR_DB_SYSTEM=kt.ATTR_DB_STATEMENT=kt.ATTR_DB_OPERATION=kt.ATTR_DB_NAME=kt.ATTR_DB_MONGODB_COLLECTION=void 0;kt.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";kt.ATTR_DB_NAME="db.name";kt.ATTR_DB_OPERATION="db.operation";kt.ATTR_DB_STATEMENT="db.statement";kt.ATTR_DB_SYSTEM="db.system";kt.ATTR_DB_USER="db.user";kt.ATTR_NET_PEER_NAME="net.peer.name";kt.ATTR_NET_PEER_PORT="net.peer.port";kt.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var m8=R(xa=>{"use strict";p();u();l();Object.defineProperty(xa,"__esModule",{value:!0});xa.handleCallbackResponse=xa.handlePromiseResponse=xa.getAttributesFromCollection=void 0;var f8=(w(),x(j)),Z_=de(),J_=qM(),bA=(ye(),x(Ge));function Wwe(t,e,n){let r={};return e&Z_.SemconvStability.OLD&&(r[J_.ATTR_DB_MONGODB_COLLECTION]=t.name,r[J_.ATTR_DB_NAME]=t.conn.name,r[J_.ATTR_DB_USER]=t.conn.user),e&Z_.SemconvStability.STABLE&&(r[bA.ATTR_DB_COLLECTION_NAME]=t.name,r[bA.ATTR_DB_NAMESPACE]=t.conn.name),n&Z_.SemconvStability.OLD&&(r[J_.ATTR_NET_PEER_NAME]=t.conn.host,r[J_.ATTR_NET_PEER_PORT]=t.conn.port),n&Z_.SemconvStability.STABLE&&(r[bA.ATTR_SERVER_ADDRESS]=t.conn.host,r[bA.ATTR_SERVER_PORT]=t.conn.port),r}xa.getAttributesFromCollection=Wwe;function _8(t,e={}){t.recordException(e),t.setStatus({code:f8.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
339
- Mongoose Error Code: ${e.code}`:""}`})}function YM(t,e,n,r=void 0){n&&(0,Z_.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&f8.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function Kwe(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(YM(e,o,n,r),o)).catch(o=>{throw _8(e,o),o}).finally(()=>e.end()):(YM(e,t,n,r),e.end(),t)}xa.handlePromiseResponse=Kwe;function zwe(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?_8(r,c):YM(r,d,s,i),r.end(),t(c,d)),e.apply(n,o)}xa.handleCallbackResponse=zwe});var h8=R(Lp=>{"use strict";p();u();l();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.PACKAGE_NAME=Lp.PACKAGE_VERSION=void 0;Lp.PACKAGE_VERSION="0.56.0";Lp.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var A8=R(Tr=>{"use strict";p();u();l();Object.defineProperty(Tr,"__esModule",{value:!0});Tr.MongooseInstrumentation=Tr._ALREADY_INSTRUMENTED=Tr._STORED_PARENT_SPAN=void 0;var Kt=(w(),x(j)),Xwe=ke(),WM=m8(),dn=de(),E8=h8(),La=qM(),Su=(ye(),x(Ge)),CA=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],Qwe=["remove","count","findOneAndRemove",...CA],Jwe=["count","findOneAndRemove",...CA],Zwe=[...CA];function g8(t){return t?t.startsWith("6.")||t.startsWith("5.")?Qwe:t.startsWith("7.")?Jwe:Zwe:CA}function T8(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function S8(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}Tr._STORED_PARENT_SPAN=Symbol("stored-parent-span");Tr._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var KM=class extends dn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(E8.PACKAGE_NAME,E8.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,dn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,dn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new dn.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,T8(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),S8(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)),g8(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=g8(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,T8(n)&&this._unwrap(r.Model.prototype,"remove"),S8(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&&Kt.trace.getSpan(Kt.context.active())===void 0)return r.apply(this,arguments);let i=this[Tr._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let f=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&dn.SemconvStability.OLD&&(a[La.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&dn.SemconvStability.STABLE&&(a[Su.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[Tr._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Kt.trace.getSpan(Kt.context.active())===void 0)return r.apply(this,arguments);let i=this[Tr._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&dn.SemconvStability.OLD&&(a[La.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&dn.SemconvStability.STABLE&&(a[Su.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&&Kt.trace.getSpan(Kt.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&dn.SemconvStability.OLD&&(d[La.ATTR_DB_STATEMENT]=m),r._dbSemconvStability&dn.SemconvStability.STABLE&&(d[Su.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&&Kt.trace.getSpan(Kt.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 y=E(e,{condition:{_id:this._id},updates:f,options:_});r._dbSemconvStability&dn.SemconvStability.OLD&&(m[La.ATTR_DB_STATEMENT]=y),r._dbSemconvStability&dn.SemconvStability.STABLE&&(m[Su.ATTR_DB_QUERY_TEXT]=y)}let T=r._startSpan(this.constructor.collection,this.constructor.modelName,e,m),A=r._handleResponse(T,o,this,arguments,d,n);return A&&typeof A=="object"&&(A[Tr._ALREADY_INSTRUMENTED]=!0),A}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Kt.trace.getSpan(Kt.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&dn.SemconvStability.OLD&&(f[La.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&dn.SemconvStability.STABLE&&(f[Su.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=Kt.trace.getSpan(Kt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[Tr._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[Tr._STORED_PARENT_SPAN]=Kt.trace.getSpan(Kt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,WM.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&dn.SemconvStability.OLD&&(i[La.ATTR_DB_OPERATION]=r,i[La.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&dn.SemconvStability.STABLE&&(i[Su.ATTR_DB_OPERATION_NAME]=r,i[Su.ATTR_DB_SYSTEM_NAME]=La.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&dn.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Kt.SpanKind.CLIENT,attributes:i},s?Kt.trace.setSpan(Kt.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,WM.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,WM.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Kt.context.with((0,Xwe.suppressTracing)(Kt.context.active()),e):e()}};Tr.MongooseInstrumentation=KM});var R8=R(PA=>{"use strict";p();u();l();Object.defineProperty(PA,"__esModule",{value:!0});PA.MongooseInstrumentation=void 0;var eUe=A8();Object.defineProperty(PA,"MongooseInstrumentation",{enumerable:!0,get:function(){return eUe.MongooseInstrumentation}})});var y8,I8,N8,tUe,O8,b8=S(()=>{p();u();l();y8=B(R8(),1);xe();I8="Mongoose",N8=X(I8,()=>new y8.MongooseInstrumentation({responseHook(t){Be(t,"auto.db.otel.mongoose")}})),tUe=(()=>({name:I8,setupOnce(){N8()}})),O8=tUe});var C8=R(Bt=>{"use strict";p();u();l();Object.defineProperty(Bt,"__esModule",{value:!0});Bt.METRIC_DB_CLIENT_CONNECTIONS_USAGE=Bt.DB_SYSTEM_VALUE_MYSQL=Bt.ATTR_NET_PEER_PORT=Bt.ATTR_NET_PEER_NAME=Bt.ATTR_DB_USER=Bt.ATTR_DB_SYSTEM=Bt.ATTR_DB_STATEMENT=Bt.ATTR_DB_NAME=Bt.ATTR_DB_CONNECTION_STRING=void 0;Bt.ATTR_DB_CONNECTION_STRING="db.connection_string";Bt.ATTR_DB_NAME="db.name";Bt.ATTR_DB_STATEMENT="db.statement";Bt.ATTR_DB_SYSTEM="db.system";Bt.ATTR_DB_USER="db.user";Bt.ATTR_NET_PEER_NAME="net.peer.name";Bt.ATTR_NET_PEER_PORT="net.peer.port";Bt.DB_SYSTEM_VALUE_MYSQL="mysql";Bt.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var P8=R(em=>{"use strict";p();u();l();Object.defineProperty(em,"__esModule",{value:!0});em.AttributeNames=void 0;var nUe;(function(t){t.MYSQL_VALUES="db.mysql.values"})(nUe=em.AttributeNames||(em.AttributeNames={}))});var M8=R(xn=>{"use strict";p();u();l();Object.defineProperty(xn,"__esModule",{value:!0});xn.getPoolNameOld=xn.arrayStringifyHelper=xn.getSpanName=xn.getDbValues=xn.getDbQueryText=xn.getJDBCString=xn.getConfig=void 0;function rUe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}xn.getConfig=rUe;function oUe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}xn.getJDBCString=oUe;function sUe(t){return typeof t=="string"?t:t.sql}xn.getDbQueryText=sUe;function iUe(t,e){return zM(typeof t=="string"?e:e||t.values)}xn.getDbValues=iUe;function aUe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}xn.getSpanName=aUe;function zM(t){return t?`[${t.toString()}]`:""}xn.arrayStringifyHelper=zM;function cUe(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()}xn.getPoolNameOld=cUe});var v8=R(Dp=>{"use strict";p();u();l();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.PACKAGE_NAME=Dp.PACKAGE_VERSION=void 0;Dp.PACKAGE_VERSION="0.56.0";Dp.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var L8=R(MA=>{"use strict";p();u();l();Object.defineProperty(MA,"__esModule",{value:!0});MA.MySQLInstrumentation=void 0;var Sr=(w(),x(j)),Eo=de(),wp=(ye(),x(Ge)),mi=C8(),uUe=P8(),Au=M8(),x8=v8(),XM=class extends Eo.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(x8.PACKAGE_NAME,x8.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Eo.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Eo.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(mi.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 Eo.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,Eo.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,Eo.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,Eo.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,Au.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=Sr.context.active();return function(o,s){s&&((0,Eo.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&Sr.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,Au.getConfig)(e.config),m=parseInt(d,10),E=(0,Au.getDbQueryText)(o);r._dbSemconvStability&Eo.SemconvStability.OLD&&(a[mi.ATTR_DB_SYSTEM]=mi.DB_SYSTEM_VALUE_MYSQL,a[mi.ATTR_DB_CONNECTION_STRING]=(0,Au.getJDBCString)(c,d,f),a[mi.ATTR_DB_NAME]=f,a[mi.ATTR_DB_USER]=_,a[mi.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&Eo.SemconvStability.STABLE&&(a[wp.ATTR_DB_SYSTEM_NAME]=wp.DB_SYSTEM_NAME_VALUE_MYSQL,a[wp.ATTR_DB_NAMESPACE]=f,a[wp.ATTR_DB_QUERY_TEXT]=E),r._netSemconvStability&Eo.SemconvStability.OLD&&(a[mi.ATTR_NET_PEER_NAME]=c,isNaN(m)||(a[mi.ATTR_NET_PEER_PORT]=m)),r._netSemconvStability&Eo.SemconvStability.STABLE&&(a[wp.ATTR_SERVER_ADDRESS]=c,isNaN(m)||(a[wp.ATTR_SERVER_PORT]=m));let T=r.tracer.startSpan((0,Au.getSpanName)(o),{kind:Sr.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let O;Array.isArray(s)?O=s:arguments[2]&&(O=[s]),T.setAttribute(uUe.AttributeNames.MYSQL_VALUES,(0,Au.getDbValues)(o,O))}let A=Array.from(arguments).findIndex(O=>typeof O=="function"),y=Sr.context.active();if(A===-1){let O=Sr.context.with(Sr.trace.setSpan(Sr.context.active(),T),()=>n.apply(e,arguments));return Sr.context.bind(y,O),O.on("error",I=>T.setStatus({code:Sr.SpanStatusCode.ERROR,message:I.message})).on("end",()=>{T.end()})}else return r._wrap(arguments,A,r._patchCallbackQuery(T,y)),Sr.context.with(Sr.trace.setSpan(Sr.context.active(),T),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:Sr.SpanStatusCode.ERROR,message:o.message}),e.end(),Sr.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Au.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")})}};MA.MySQLInstrumentation=XM});var D8=R(vA=>{"use strict";p();u();l();Object.defineProperty(vA,"__esModule",{value:!0});vA.MySQLInstrumentation=void 0;var lUe=L8();Object.defineProperty(vA,"MySQLInstrumentation",{enumerable:!0,get:function(){return lUe.MySQLInstrumentation}})});var w8,U8,k8,pUe,B8,G8=S(()=>{p();u();l();w8=B(D8(),1);xe();U8="Mysql",k8=X(U8,()=>new w8.MySQLInstrumentation({})),pUe=(()=>({name:U8,setupOnce(){k8()}})),B8=pUe});var QM=R(tn=>{"use strict";p();u();l();Object.defineProperty(tn,"__esModule",{value:!0});tn.DB_SYSTEM_VALUE_MYSQL=tn.ATTR_NET_PEER_PORT=tn.ATTR_NET_PEER_NAME=tn.ATTR_DB_USER=tn.ATTR_DB_SYSTEM=tn.ATTR_DB_STATEMENT=tn.ATTR_DB_NAME=tn.ATTR_DB_CONNECTION_STRING=void 0;tn.ATTR_DB_CONNECTION_STRING="db.connection_string";tn.ATTR_DB_NAME="db.name";tn.ATTR_DB_STATEMENT="db.statement";tn.ATTR_DB_SYSTEM="db.system";tn.ATTR_DB_USER="db.user";tn.ATTR_NET_PEER_NAME="net.peer.name";tn.ATTR_NET_PEER_PORT="net.peer.port";tn.DB_SYSTEM_VALUE_MYSQL="mysql"});var ZM=R(xA=>{"use strict";p();u();l();Object.defineProperty(xA,"__esModule",{value:!0});xA.addSqlCommenterComment=void 0;var JM=(w(),x(j)),dUe=ke();function fUe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function _Ue(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function mUe(t,e){if(typeof e!="string"||e.length===0||fUe(e))return e;let n=new dUe.W3CTraceContextPropagator,r={};n.inject(JM.trace.setSpan(JM.ROOT_CONTEXT,t),r,JM.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=_Ue(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}xA.addSqlCommenterComment=mUe});var j8=R(go=>{"use strict";p();u();l();Object.defineProperty(go,"__esModule",{value:!0});go.getConnectionPrototypeToInstrument=go.once=go.getSpanName=go.getQueryText=go.getConnectionAttributes=void 0;var tm=QM(),LA=de(),ev=(ye(),x(Ge));function hUe(t,e,n){let{host:r,port:o,database:s,user:i}=EUe(t),a={};e&LA.SemconvStability.OLD&&(a[tm.ATTR_DB_CONNECTION_STRING]=gUe(r,o,s),a[tm.ATTR_DB_NAME]=s,a[tm.ATTR_DB_USER]=i),e&LA.SemconvStability.STABLE&&(a[ev.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&LA.SemconvStability.OLD&&(a[tm.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[tm.ATTR_NET_PEER_PORT]=c)),n&LA.SemconvStability.STABLE&&(a[ev.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[ev.ATTR_SERVER_PORT]=c)),a}go.getConnectionAttributes=hUe;function EUe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function gUe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function TUe(t,e,n,r=!1,o=SUe){let[s,i]=typeof t=="string"?[t,n]:[t.sql,AUe(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"}}go.getQueryText=TUe;function SUe(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function AUe(t){return"values"in t}function RUe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}go.getSpanName=RUe;var yUe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};go.once=yUe;function IUe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}go.getConnectionPrototypeToInstrument=IUe});var H8=R(Up=>{"use strict";p();u();l();Object.defineProperty(Up,"__esModule",{value:!0});Up.PACKAGE_NAME=Up.PACKAGE_VERSION=void 0;Up.PACKAGE_VERSION="0.56.0";Up.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var q8=R(DA=>{"use strict";p();u();l();Object.defineProperty(DA,"__esModule",{value:!0});DA.MySQL2Instrumentation=void 0;var F8=(w(),x(j)),Wo=de(),tv=QM(),$8=ZM(),kp=j8(),V8=H8(),nv=(ye(),x(Ge)),rv=[">=1.4.2 <4"],ov=class extends Wo.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(V8.PACKAGE_NAME,V8.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Wo.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Wo.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,Wo.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,Wo.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 Wo.InstrumentationNodeModuleDefinition("mysql2",rv,s=>(n(s),s),()=>{},[new Wo.InstrumentationNodeModuleFile("mysql2/promise.js",rv,s=>(n(s),s),()=>{}),new Wo.InstrumentationNodeModuleFile("mysql2/lib/connection.js",rv,s=>{let i=(0,kp.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,kp.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,kp.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),E=(0,kp.getQueryText)(s,e,c,d,f);o._dbSemconvStability&Wo.SemconvStability.OLD&&(m[tv.ATTR_DB_SYSTEM]=tv.DB_SYSTEM_VALUE_MYSQL,m[tv.ATTR_DB_STATEMENT]=E),o._dbSemconvStability&Wo.SemconvStability.STABLE&&(m[nv.ATTR_DB_SYSTEM_NAME]=nv.DB_SYSTEM_NAME_VALUE_MYSQL,m[nv.ATTR_DB_QUERY_TEXT]=E);let T=o.tracer.startSpan((0,kp.getSpanName)(s),{kind:F8.SpanKind.CLIENT,attributes:m});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,$8.addSqlCommenterComment)(T,s):Object.assign(s,{sql:(0,$8.addSqlCommenterComment)(T,s.sql)}));let A=(0,kp.once)((y,O)=>{y?T.setStatus({code:F8.SpanStatusCode.ERROR,message:y.message}):typeof _=="function"&&(0,Wo.safeExecuteInTheMiddle)(()=>{_(T,{queryResults:O})},I=>{I&&o._diag.warn("Failed executing responseHook",I)},!0),T.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(A));let y=r.apply(this,arguments);return y.once("error",O=>{A(O)}).once("result",O=>{A(void 0,O)}),y}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(A)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(A)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};DA.MySQL2Instrumentation=ov});var Y8=R(wA=>{"use strict";p();u();l();Object.defineProperty(wA,"__esModule",{value:!0});wA.MySQL2Instrumentation=void 0;var NUe=q8();Object.defineProperty(wA,"MySQL2Instrumentation",{enumerable:!0,get:function(){return NUe.MySQL2Instrumentation}})});var W8,K8,z8,OUe,X8,Q8=S(()=>{p();u();l();W8=B(Y8(),1);xe();K8="Mysql2",z8=X(K8,()=>new W8.MySQL2Instrumentation({responseHook(t){Be(t,"auto.db.otel.mysql2")}})),OUe=(()=>({name:K8,setupOnce(){z8()}})),X8=OUe});var J8=R(Ln=>{"use strict";p();u();l();Object.defineProperty(Ln,"__esModule",{value:!0});Ln.DB_SYSTEM_VALUE_REDIS=Ln.DB_SYSTEM_NAME_VALUE_REDIS=Ln.ATTR_NET_PEER_PORT=Ln.ATTR_NET_PEER_NAME=Ln.ATTR_DB_SYSTEM=Ln.ATTR_DB_STATEMENT=Ln.ATTR_DB_CONNECTION_STRING=void 0;Ln.ATTR_DB_CONNECTION_STRING="db.connection_string";Ln.ATTR_DB_STATEMENT="db.statement";Ln.ATTR_DB_SYSTEM="db.system";Ln.ATTR_NET_PEER_NAME="net.peer.name";Ln.ATTR_NET_PEER_PORT="net.peer.port";Ln.DB_SYSTEM_NAME_VALUE_REDIS="redis";Ln.DB_SYSTEM_VALUE_REDIS="redis"});var Z8=R(UA=>{"use strict";p();u();l();Object.defineProperty(UA,"__esModule",{value:!0});UA.endSpan=void 0;var bUe=(w(),x(j)),CUe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:bUe.SpanStatusCode.ERROR,message:e.message})),t.end()};UA.endSpan=CUe});var BA=R(kA=>{"use strict";p();u();l();Object.defineProperty(kA,"__esModule",{value:!0});kA.defaultDbStatementSerializer=void 0;var PUe=[{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}],MUe=(t,e)=>{if(Array.isArray(e)&&e.length){let n=PUe.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};kA.defaultDbStatementSerializer=MUe});var eJ=R(Bp=>{"use strict";p();u();l();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.PACKAGE_NAME=Bp.PACKAGE_VERSION=void 0;Bp.PACKAGE_VERSION="0.58.0";Bp.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var oJ=R(GA=>{"use strict";p();u();l();Object.defineProperty(GA,"__esModule",{value:!0});GA.IORedisInstrumentation=void 0;var Da=(w(),x(j)),Ar=de(),wa=(ye(),x(Ge)),Rr=J8(),tJ=de(),nm=Z8(),vUe=BA(),nJ=eJ(),rJ={requireParentSpan:!0},sv=class extends Ar.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(nJ.PACKAGE_NAME,nJ.PACKAGE_VERSION,{...rJ,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ar.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ar.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...rJ,...e})}init(){return[new Ar.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Ar.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Ar.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||vUe.defaultDbStatementSerializer,a=Da.trace.getSpan(Da.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&Ar.SemconvStability.OLD&&(c[Rr.ATTR_DB_SYSTEM]=Rr.DB_SYSTEM_VALUE_REDIS,c[Rr.ATTR_DB_STATEMENT]=_,c[Rr.ATTR_DB_CONNECTION_STRING]=`redis://${d}:${f}`),r._dbSemconvStability&Ar.SemconvStability.STABLE&&(c[wa.ATTR_DB_SYSTEM_NAME]=Rr.DB_SYSTEM_NAME_VALUE_REDIS,c[wa.ATTR_DB_QUERY_TEXT]=_),r._netSemconvStability&Ar.SemconvStability.OLD&&(c[Rr.ATTR_NET_PEER_NAME]=d,c[Rr.ATTR_NET_PEER_PORT]=f),r._netSemconvStability&Ar.SemconvStability.STABLE&&(c[wa.ATTR_SERVER_ADDRESS]=d,c[wa.ATTR_SERVER_PORT]=f);let m=r.tracer.startSpan(o.name,{kind:Da.SpanKind.CLIENT,attributes:c}),{requestHook:E}=s;E&&(0,tJ.safeExecuteInTheMiddle)(()=>E(m,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),T=>{T&&Da.diag.error("ioredis instrumentation: request hook failed",T)},!0);try{let T=e.apply(this,arguments),A=o.resolve;o.resolve=function(O){(0,tJ.safeExecuteInTheMiddle)(()=>s.responseHook?.(m,o.name,o.args,O),I=>{I&&Da.diag.error("ioredis instrumentation: response hook failed",I)},!0),(0,nm.endSpan)(m,null),A(O)};let y=o.reject;return o.reject=function(O){(0,nm.endSpan)(m,O),y(O)},T}catch(T){throw(0,nm.endSpan)(m,T),T}}}_traceConnection(e){let n=this;return function(){let r=Da.trace.getSpan(Da.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&Ar.SemconvStability.OLD&&(o[Rr.ATTR_DB_SYSTEM]=Rr.DB_SYSTEM_VALUE_REDIS,o[Rr.ATTR_DB_STATEMENT]="connect",o[Rr.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Ar.SemconvStability.STABLE&&(o[wa.ATTR_DB_SYSTEM_NAME]=Rr.DB_SYSTEM_NAME_VALUE_REDIS,o[wa.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Ar.SemconvStability.OLD&&(o[Rr.ATTR_NET_PEER_NAME]=s,o[Rr.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Ar.SemconvStability.STABLE&&(o[wa.ATTR_SERVER_ADDRESS]=s,o[wa.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:Da.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,nm.endSpan)(a,null),c}catch(c){throw(0,nm.endSpan)(a,c),c}}}};GA.IORedisInstrumentation=sv});var sJ=R(jA=>{"use strict";p();u();l();Object.defineProperty(jA,"__esModule",{value:!0});jA.IORedisInstrumentation=void 0;var xUe=oJ();Object.defineProperty(jA,"IORedisInstrumentation",{enumerable:!0,get:function(){return xUe.IORedisInstrumentation}})});var HA=R(Gp=>{"use strict";p();u();l();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.PACKAGE_NAME=Gp.PACKAGE_VERSION=void 0;Gp.PACKAGE_VERSION="0.58.0";Gp.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var iJ=R(Ua=>{"use strict";p();u();l();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.getTracedCreateStreamTrace=Ua.getTracedCreateClient=Ua.endSpan=void 0;var rm=(w(),x(j)),LUe=(t,e)=>{e&&t.setStatus({code:rm.SpanStatusCode.ERROR,message:e.message}),t.end()};Ua.endSpan=LUe;var DUe=t=>function(){let n=t.apply(this,arguments);return rm.context.bind(rm.context.active(),n)};Ua.getTracedCreateClient=DUe;var wUe=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){rm.context.bind(rm.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Ua.getTracedCreateStreamTrace=wUe});var FA=R(Dn=>{"use strict";p();u();l();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.DB_SYSTEM_VALUE_REDIS=Dn.DB_SYSTEM_NAME_VALUE_REDIS=Dn.ATTR_NET_PEER_PORT=Dn.ATTR_NET_PEER_NAME=Dn.ATTR_DB_SYSTEM=Dn.ATTR_DB_STATEMENT=Dn.ATTR_DB_CONNECTION_STRING=void 0;Dn.ATTR_DB_CONNECTION_STRING="db.connection_string";Dn.ATTR_DB_STATEMENT="db.statement";Dn.ATTR_DB_SYSTEM="db.system";Dn.ATTR_NET_PEER_NAME="net.peer.name";Dn.ATTR_NET_PEER_PORT="net.peer.port";Dn.DB_SYSTEM_NAME_VALUE_REDIS="redis";Dn.DB_SYSTEM_VALUE_REDIS="redis"});var cJ=R(VA=>{"use strict";p();u();l();Object.defineProperty(VA,"__esModule",{value:!0});VA.RedisInstrumentationV2_V3=void 0;var Ur=de(),$A=iJ(),aJ=HA(),om=(w(),x(j)),sm=(ye(),x(Ge)),Ru=FA(),UUe=BA(),iv=class t extends Ur.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(aJ.PACKAGE_NAME,aJ.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Ur.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,Ur.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,Ur.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,Ur.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=om.trace.getSpan(om.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||UUe.defaultDbStatementSerializer,d={};e._semconvStability&Ur.SemconvStability.OLD&&Object.assign(d,{[Ru.ATTR_DB_SYSTEM]:Ru.DB_SYSTEM_VALUE_REDIS,[Ru.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&Ur.SemconvStability.STABLE&&Object.assign(d,{[sm.ATTR_DB_SYSTEM_NAME]:Ru.DB_SYSTEM_NAME_VALUE_REDIS,[sm.ATTR_DB_OPERATION_NAME]:s.command,[sm.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let f=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:om.SpanKind.CLIENT,attributes:d});if(this.connection_options){let m={};e._semconvStability&Ur.SemconvStability.OLD&&Object.assign(m,{[Ru.ATTR_NET_PEER_NAME]:this.connection_options.host,[Ru.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&Ur.SemconvStability.STABLE&&Object.assign(m,{[sm.ATTR_SERVER_ADDRESS]:this.connection_options.host,[sm.ATTR_SERVER_PORT]:this.connection_options.port}),f.setAttributes(m)}this.address&&e._semconvStability&Ur.SemconvStability.OLD&&f.setAttribute(Ru.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let _=arguments[0].callback;if(_){let m=om.context.active();arguments[0].callback=function(T,A){if(i?.responseHook){let y=i.responseHook;(0,Ur.safeExecuteInTheMiddle)(()=>{y(f,s.command,s.args,A)},O=>{O&&e._diag.error("Error executing responseHook",O)},!0)}return(0,$A.endSpan)(f,T),om.context.with(m,_,this,...arguments)}}try{return r.apply(this,arguments)}catch(m){throw(0,$A.endSpan)(f,m),m}}}}_getPatchCreateClient(){return function(n){return(0,$A.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,$A.getTracedCreateStreamTrace)(n)}}};VA.RedisInstrumentationV2_V3=iv});var lJ=R(qA=>{"use strict";p();u();l();Object.defineProperty(qA,"__esModule",{value:!0});qA.getClientAttributes=void 0;var av=(ye(),x(Ge)),jp=FA(),uJ=de();function kUe(t,e,n){let r={};return n&uJ.SemconvStability.OLD&&Object.assign(r,{[jp.ATTR_DB_SYSTEM]:jp.DB_SYSTEM_VALUE_REDIS,[jp.ATTR_NET_PEER_NAME]:e?.socket?.host,[jp.ATTR_NET_PEER_PORT]:e?.socket?.port,[jp.ATTR_DB_CONNECTION_STRING]:BUe(t,e?.url)}),n&uJ.SemconvStability.STABLE&&Object.assign(r,{[av.ATTR_DB_SYSTEM_NAME]:jp.DB_SYSTEM_NAME_VALUE_REDIS,[av.ATTR_SERVER_ADDRESS]:e?.socket?.host,[av.ATTR_SERVER_PORT]:e?.socket?.port}),r}qA.getClientAttributes=kUe;function BUe(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 _J=R(YA=>{"use strict";p();u();l();Object.defineProperty(YA,"__esModule",{value:!0});YA.RedisInstrumentationV4_V5=void 0;var To=(w(),x(j)),Je=de(),pJ=lJ(),GUe=BA(),dJ=HA(),cv=(ye(),x(Ge)),jUe=FA(),im=Symbol("opentelemetry.instrumentation.redis.open_spans"),fJ=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),uv=class t extends Je.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(dJ.PACKAGE_NAME,dJ.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Je.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Je.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 Je.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,Je.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,Je.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,Je.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new Je.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,Je.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,Je.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,Je.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,Je.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,Je.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new Je.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,Je.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,Je.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,Je.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,Je.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,Je.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,Je.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new Je.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[im];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[im];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[fJ]=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,pJ.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:To.SpanKind.CLIENT,attributes:i});return To.context.with(To.trace.setSpan(To.context.active(),a),()=>r.apply(this)).then(d=>(a.end(),d)).catch(d=>(a.recordException(d),a.setStatus({code:To.SpanStatusCode.ERROR,message:d.message}),a.end(),Promise.reject(d)))}}}_traceClientCommand(e,n,r,o){if(To.trace.getSpan(To.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[fJ],a=o[0],c=o.slice(1),d=this.getConfig().dbStatementSerializer||GUe.defaultDbStatementSerializer,f=(0,pJ.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&Je.SemconvStability.STABLE&&(f[cv.ATTR_DB_OPERATION_NAME]=a);try{let E=d(a,c);E!=null&&(this._semconvStability&Je.SemconvStability.OLD&&(f[jUe.ATTR_DB_STATEMENT]=E),this._semconvStability&Je.SemconvStability.STABLE&&(f[cv.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:To.SpanKind.CLIENT,attributes:f}),m=To.context.with(To.trace.setSpan(To.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[im]=E[im]||[],E[im].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&Je.SemconvStability.STABLE&&c.setAttribute(cv.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:To.SpanStatusCode.ERROR,message:s?.message})),e.end()}};YA.RedisInstrumentationV4_V5=uv});var EJ=R(WA=>{"use strict";p();u();l();Object.defineProperty(WA,"__esModule",{value:!0});WA.RedisInstrumentation=void 0;var HUe=de(),mJ=HA(),FUe=cJ(),$Ue=_J(),hJ={requireParentSpan:!1},lv=class extends HUe.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...hJ,...e};super(mJ.PACKAGE_NAME,mJ.PACKAGE_VERSION,n),this.instrumentationV2_V3=new FUe.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new $Ue.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...hJ,...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())}};WA.RedisInstrumentation=lv});var gJ=R(KA=>{"use strict";p();u();l();Object.defineProperty(KA,"__esModule",{value:!0});KA.RedisInstrumentation=void 0;var VUe=EJ();Object.defineProperty(KA,"RedisInstrumentation",{enumerable:!0,get:function(){return VUe.RedisInstrumentation}})});function am(t,e){return t.includes(e.toLowerCase())}function dv(t){return am(pv,t)?"cache.get":am(YUe,t)?"cache.put":void 0}function WUe(t,e){return e.some(n=>t.startsWith(n))}function SJ(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)?TJ(o.map(s=>n(s))):["<unknown>"],r=e[0];return am(qUe,t)&&r!=null?n(r):TJ(e.map(o=>n(o)))}catch{return}}function AJ(t,e,n){if(!dv(t))return!1;for(let r of e)if(WUe(r,n))return!0;return!1}function RJ(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 TJ(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var qUe,pv,YUe,yJ=S(()=>{p();u();l();qUe=["get","set","setex"],pv=["get","mget"],YUe=["set","setex"]});var IJ,NJ,zA,cm,OJ,KUe,zUe,bJ,XUe,CJ,PJ=S(()=>{p();u();l();IJ=B(sJ(),1),NJ=B(gJ(),1);te();xe();yJ();zA="Redis",cm={},OJ=(t,e,n,r)=>{t.setAttribute(pe,"auto.db.otel.redis");let o=SJ(e,n),s=dv(e);if(!o||!s||!cm.cachePrefixes||!AJ(e,o,cm.cachePrefixes))return;let i=se(t).data["net.peer.name"],a=se(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=RJ(r);c&&t.setAttribute(sb,c),am(pv,e)&&c!==void 0&&t.setAttribute(rb,c>0),t.setAttributes({[fe]:s,[ob]:o});let d=o.join(", ");t.updateName(cm.maxCacheKeyLength?zi(d,cm.maxCacheKeyLength):d)},KUe=X(`${zA}.IORedis`,()=>new IJ.IORedisInstrumentation({responseHook:OJ})),zUe=X(`${zA}.Redis`,()=>new NJ.RedisInstrumentation({responseHook:OJ})),bJ=Object.assign(()=>{KUe(),zUe()},{id:zA}),XUe=((t={})=>({name:zA,setupOnce(){cm=t,bJ()}})),CJ=XUe});var MJ=R(XA=>{"use strict";p();u();l();Object.defineProperty(XA,"__esModule",{value:!0});XA.EVENT_LISTENERS_SET=void 0;XA.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var fv=R(um=>{"use strict";p();u();l();Object.defineProperty(um,"__esModule",{value:!0});um.AttributeNames=void 0;var QUe;(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"})(QUe=um.AttributeNames||(um.AttributeNames={}))});var _v=R(we=>{"use strict";p();u();l();Object.defineProperty(we,"__esModule",{value:!0});we.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=we.METRIC_DB_CLIENT_CONNECTION_COUNT=we.DB_SYSTEM_VALUE_POSTGRESQL=we.DB_CLIENT_CONNECTION_STATE_VALUE_USED=we.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=we.ATTR_NET_PEER_PORT=we.ATTR_NET_PEER_NAME=we.ATTR_DB_USER=we.ATTR_DB_SYSTEM=we.ATTR_DB_STATEMENT=we.ATTR_DB_NAME=we.ATTR_DB_CONNECTION_STRING=we.ATTR_DB_CLIENT_CONNECTION_STATE=we.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;we.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";we.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";we.ATTR_DB_CONNECTION_STRING="db.connection_string";we.ATTR_DB_NAME="db.name";we.ATTR_DB_STATEMENT="db.statement";we.ATTR_DB_SYSTEM="db.system";we.ATTR_DB_USER="db.user";we.ATTR_NET_PEER_NAME="net.peer.name";we.ATTR_NET_PEER_PORT="net.peer.port";we.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";we.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";we.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";we.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";we.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var mv=R(lm=>{"use strict";p();u();l();Object.defineProperty(lm,"__esModule",{value:!0});lm.SpanNames=void 0;var JUe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(JUe=lm.SpanNames||(lm.SpanNames={}))});var kJ=R(Pe=>{"use strict";p();u();l();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.sanitizedErrorMessage=Pe.isObjectWithTextString=Pe.getErrorMessage=Pe.patchClientConnectCallback=Pe.patchCallbackPGPool=Pe.updateCounter=Pe.getPoolName=Pe.patchCallback=Pe.handleExecutionResult=Pe.handleConfigQuery=Pe.shouldSkipInstrumentation=Pe.getSemanticAttributesFromPoolConnection=Pe.getSemanticAttributesFromConnection=Pe.getConnectionString=Pe.parseAndMaskConnectionString=Pe.parseNormalizedOperationName=Pe.getQuerySpanName=void 0;var ka=(w(),x(j)),QA=fv(),So=(ye(),x(Ge)),Et=_v(),yu=de(),vJ=mv();function xJ(t,e){if(!e)return vJ.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:LJ(e.text);return`${vJ.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}Pe.getQuerySpanName=xJ;function LJ(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}Pe.parseNormalizedOperationName=LJ;function DJ(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}Pe.parseAndMaskConnectionString=DJ;function hv(t){if("connectionString"in t&&t.connectionString)return DJ(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}Pe.getConnectionString=hv;function JA(t){if(Number.isInteger(t))return t}function wJ(t,e){let n={};return e&yu.SemconvStability.OLD&&(n={...n,[Et.ATTR_DB_SYSTEM]:Et.DB_SYSTEM_VALUE_POSTGRESQL,[Et.ATTR_DB_NAME]:t.database,[Et.ATTR_DB_CONNECTION_STRING]:hv(t),[Et.ATTR_DB_USER]:t.user,[Et.ATTR_NET_PEER_NAME]:t.host,[Et.ATTR_NET_PEER_PORT]:JA(t.port)}),e&yu.SemconvStability.STABLE&&(n={...n,[So.ATTR_DB_SYSTEM_NAME]:So.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[So.ATTR_DB_NAMESPACE]:t.namespace,[So.ATTR_SERVER_ADDRESS]:t.host,[So.ATTR_SERVER_PORT]:JA(t.port)}),n}Pe.getSemanticAttributesFromConnection=wJ;function ZUe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[QA.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[QA.AttributeNames.MAX_CLIENT]:t.maxClient};return e&yu.SemconvStability.OLD&&(r={...r,[Et.ATTR_DB_SYSTEM]:Et.DB_SYSTEM_VALUE_POSTGRESQL,[Et.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Et.ATTR_DB_CONNECTION_STRING]:hv(t),[Et.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Et.ATTR_NET_PEER_PORT]:Number(n?.port)||JA(t.port),[Et.ATTR_DB_USER]:n?.username??t.user}),e&yu.SemconvStability.STABLE&&(r={...r,[So.ATTR_DB_SYSTEM_NAME]:So.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[So.ATTR_DB_NAMESPACE]:t.namespace,[So.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[So.ATTR_SERVER_PORT]:Number(n?.port)||JA(t.port)}),r}Pe.getSemanticAttributesFromPoolConnection=ZUe;function eke(t){return t.requireParentSpan===!0&&ka.trace.getSpan(ka.context.active())===void 0}Pe.shouldSkipInstrumentation=eke;function tke(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=xJ(s,r),a=t.startSpan(i,{kind:ka.SpanKind.CLIENT,attributes:wJ(o,n)});if(!r)return a;if(r.text&&(n&yu.SemconvStability.OLD&&a.setAttribute(Et.ATTR_DB_STATEMENT,r.text),n&yu.SemconvStability.STABLE&&a.setAttribute(So.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(QA.AttributeNames.PG_VALUES,c)}catch(c){ka.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(QA.AttributeNames.PG_PLAN,r.name),a}Pe.handleConfigQuery=tke;function UJ(t,e,n){typeof t.responseHook=="function"&&(0,yu.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&ka.diag.error("Error running response hook",r)},!0)}Pe.handleExecutionResult=UJ;function nke(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[So.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(ZA(i)),e.setStatus({code:ka.SpanStatusCode.ERROR,message:i.message})):UJ(t,e,a),o(),e.end(),n.call(this,i,a)}}Pe.patchCallback=nke;function rke(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()}Pe.getPoolName=rke;function oke(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Et.ATTR_DB_CLIENT_CONNECTION_STATE]:Et.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Et.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Et.ATTR_DB_CLIENT_CONNECTION_STATE]:Et.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Et.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Et.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}Pe.updateCounter=oke;function ske(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(ZA(r)),t.setStatus({code:ka.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}Pe.patchCallbackPGPool=ske;function ike(t,e){return function(r){r&&(r instanceof Error&&t.recordException(ZA(r)),t.setStatus({code:ka.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}Pe.patchClientConnectCallback=ike;function ake(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}Pe.getErrorMessage=ake;function cke(t){return typeof t=="object"&&typeof t?.text=="string"}Pe.isObjectWithTextString=cke;function ZA(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}Pe.sanitizedErrorMessage=ZA});var BJ=R(Hp=>{"use strict";p();u();l();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.PACKAGE_NAME=Hp.PACKAGE_VERSION=void 0;Hp.PACKAGE_VERSION="0.62.0";Hp.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var VJ=R(tR=>{"use strict";p();u();l();Object.defineProperty(tR,"__esModule",{value:!0});tR.PgInstrumentation=void 0;var Zn=de(),He=(w(),x(j)),GJ=MJ(),ut=kJ(),jJ=ZM(),HJ=BJ(),FJ=mv(),eR=ke(),Ko=(ye(),x(Ge)),pm=_v();function Fp(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var Ev=class extends Zn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(HJ.PACKAGE_NAME,HJ.PACKAGE_VERSION,e),this._semconvStability=(0,Zn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(Ko.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:He.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(pm.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(pm.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 Zn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new Zn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new Zn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=Fp(a);return this._patchPgClient(c.Client),a},a=>{let c=Fp(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new Zn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=Fp(a);return(0,Zn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=Fp(a);(0,Zn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=Fp(e);return(0,Zn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Zn.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=Fp(e);return(0,Zn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Zn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ut.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(FJ.SpanNames.CONNECT,{kind:He.SpanKind.CLIENT,attributes:ut.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=He.trace.getSpan(He.context.active());o=ut.patchClientConnectCallback(i,o),c&&(o=He.context.bind(He.context.active(),o))}let a=He.context.with(He.trace.setSpan(He.context.active(),i),()=>n.call(this,o));return $J(i,a)}}recordOperationDuration(e,n){let r={},o=[Ko.ATTR_DB_NAMESPACE,Ko.ATTR_ERROR_TYPE,Ko.ATTR_SERVER_PORT,Ko.ATTR_SERVER_ADDRESS,Ko.ATTR_DB_OPERATION_NAME];this._semconvStability&Zn.SemconvStability.OLD&&o.push(pm.ATTR_DB_SYSTEM),this._semconvStability&Zn.SemconvStability.STABLE&&o.push(Ko.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,eR.hrTimeToMilliseconds)((0,eR.hrTimeDuration)(n,(0,eR.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ut.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,eR.hrTime)(),i=o[0],a=typeof i=="string",c=ut.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={[pm.ATTR_DB_SYSTEM]:pm.DB_SYSTEM_VALUE_POSTGRESQL,[Ko.ATTR_DB_NAMESPACE]:this.database,[Ko.ATTR_SERVER_PORT]:this.connectionParameters.port,[Ko.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};d?.text&&(f[Ko.ATTR_DB_OPERATION_NAME]=ut.parseNormalizedOperationName(d?.text));let _=()=>{e.recordOperationDuration(f,s)},m=e.getConfig(),E=ut.handleConfigQuery.call(this,e.tracer,m,e._semconvStability,d);if(m.addSqlCommenterCommentToQueries&&(a?o[0]=(0,jJ.addSqlCommenterComment)(E,i):c&&!("name"in i)&&(o[0]={...i,text:(0,jJ.addSqlCommenterComment)(E,i.text)})),o.length>0){let y=He.trace.getSpan(He.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ut.patchCallback(m,E,o[o.length-1],f,_),y&&(o[o.length-1]=He.context.bind(He.context.active(),o[o.length-1]));else if(typeof d?.callback=="function"){let O=ut.patchCallback(e.getConfig(),E,d.callback,f,_);y&&(O=He.context.bind(He.context.active(),O)),o[0].callback=O}}let{requestHook:T}=m;typeof T=="function"&&d&&(0,Zn.safeExecuteInTheMiddle)(()=>{let{database:y,host:O,port:I,user:M}=this.connectionParameters;T(E,{connection:{database:y,host:O,port:I,user:M},query:{text:d.text,values:d.values,name:d.name}})},y=>{y&&e._diag.error("Error running query hook",y)},!0);let A;try{A=n.apply(this,o)}catch(y){throw y instanceof Error&&E.recordException(ut.sanitizedErrorMessage(y)),E.setStatus({code:He.SpanStatusCode.ERROR,message:ut.getErrorMessage(y)}),E.end(),y}return A instanceof Promise?A.then(y=>new Promise(O=>{ut.handleExecutionResult(e.getConfig(),E,y),_(),E.end(),O(y)})).catch(y=>new Promise((O,I)=>{y instanceof Error&&E.recordException(ut.sanitizedErrorMessage(y)),E.setStatus({code:He.SpanStatusCode.ERROR,message:y.message}),_(),E.end(),I(y)})):A})}_setPoolConnectEventListeners(e){if(e[GJ.EVENT_LISTENERS_SET])return;let n=ut.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[GJ.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ut.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(FJ.SpanNames.POOL_CONNECT,{kind:He.SpanKind.CLIENT,attributes:ut.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=He.trace.getSpan(He.context.active());o=ut.patchCallbackPGPool(i,o),c&&(o=He.context.bind(He.context.active(),o))}let a=He.context.with(He.trace.setSpan(He.context.active(),i),()=>n.call(this,o));return $J(i,a)}}};tR.PgInstrumentation=Ev;function $J(t,e){if(!(e instanceof Promise))return e;let n=e;return He.context.bind(He.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ut.sanitizedErrorMessage(r)),t.setStatus({code:He.SpanStatusCode.ERROR,message:ut.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var qJ=R($p=>{"use strict";p();u();l();Object.defineProperty($p,"__esModule",{value:!0});$p.AttributeNames=$p.PgInstrumentation=void 0;var uke=VJ();Object.defineProperty($p,"PgInstrumentation",{enumerable:!0,get:function(){return uke.PgInstrumentation}});var lke=fv();Object.defineProperty($p,"AttributeNames",{enumerable:!0,get:function(){return lke.AttributeNames}})});var YJ,WJ,KJ,pke,zJ,XJ=S(()=>{p();u();l();YJ=B(qJ(),1);xe();WJ="Postgres",KJ=X(WJ,()=>new YJ.PgInstrumentation({requireParentSpan:!0,requestHook(t){Be(t,"auto.db.otel.postgres")}})),pke=(()=>({name:WJ,setupOnce(){KJ()}})),zJ=pke});var hi,rR,QJ,dke,nR,gv,JJ,ZJ,Tv,fke,eZ,tZ=S(()=>{p();u();l();w();hi=B(de(),1);ye();te();xe();Eu();rR="PostgresJs",QJ=[">=3.0.0 <4"],dke=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,nR=Symbol("sentryPostgresConnectionContext"),gv=Symbol.for("sentry.instrumented.postgresjs"),JJ=Symbol.for("sentry.query.from.instrumented.sql"),ZJ=X(rR,t=>new Tv({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),Tv=class extends hi.InstrumentationBase{constructor(e){super("sentry-postgres-js",Ie,e)}init(){let e=new hi.InstrumentationNodeModuleDefinition("postgres",QJ,n=>{try{return this._patchPostgres(n)}catch(r){return ht&&N.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new hi.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,QJ,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 ht&&N.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"?(ht&&N.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:(c_(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[nR];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(nf,n.ATTR_DB_NAMESPACE),n.ATTR_SERVER_ADDRESS&&e.setAttribute(rf,n.ATTR_SERVER_ADDRESS),n.ATTR_SERVER_PORT!==void 0)){let r=parseInt(n.ATTR_SERVER_PORT,10);isNaN(r)||e.setAttribute(of,r)}}_setOperationName(e,n,r){if(r){e.setAttribute(il,r);return}let o=n?.match(dke);o?.[1]&&e.setAttribute(il,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[nR]=a}_instrumentSqlInstance(e,n){if(e[gv])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[nR]=n:this._attachConnectionContext(e,o),e[gv]=!0,o[gv]=!0,o}_wrapSingleQueryHandle(e,n){if(e.handle?.__sentryWrapped)return;e[JJ]=!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 cn({name:c||"postgresjs.query",op:"db"},d=>{Be(d,"auto.db.postgresjs"),d.setAttributes({[Hi]:"postgres",[oE]:c});let f=n?n[nR]:void 0;o._setConnectionAttributes(d,f);let _=o.getConfig(),{requestHook:m}=_;m&&(0,hi.safeExecuteInTheMiddle)(()=>m(d,c,f),T=>{T&&(d.setAttribute("sentry.hook.error","requestHook failed"),ht&&N.error(`Error in requestHook for ${rR} integration:`,T))},!0);let E=this;E.resolve=new Proxy(E.resolve,{apply:(T,A,y)=>{try{o._setOperationName(d,c,y?.[0]?.command),d.end()}catch(O){ht&&N.error("Error ending span in resolve callback:",O)}return Reflect.apply(T,A,y)}}),E.reject=new Proxy(E.reject,{apply:(T,A,y)=>{try{d.setStatus({code:2,message:y?.[0]?.message||"unknown_error"}),d.setAttribute(sE,y?.[0]?.code||"unknown"),d.setAttribute(iE,y?.[0]?.name||"unknown"),o._setOperationName(d,c),d.end()}catch(O){ht&&N.error("Error ending span in reject callback:",O)}return Reflect.apply(T,A,y)}});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 ue.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[JJ])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return cn({name:i||"postgresjs.query",op:"db"},a=>{Be(a,"auto.db.postgresjs"),a.setAttributes({[Hi]:"postgres",[oE]:i});let c=n.getConfig(),{requestHook:d}=c;d&&(0,hi.safeExecuteInTheMiddle)(()=>d(a,i,void 0),m=>{m&&(a.setAttribute("sentry.hook.error","requestHook failed"),ht&&N.error(`Error in requestHook for ${rR} 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(A){ht&&N.error("Error ending span in resolve callback:",A)}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(sE,T?.[0]?.code||"unknown"),a.setAttribute(iE,T?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(A){ht&&N.error("Error ending span in reject callback:",A)}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}},fke=(t=>({name:rR,setupOnce(){ZJ(t)}})),eZ=fke});var nZ=R(dm=>{"use strict";p();u();l();Object.defineProperty(dm,"__esModule",{value:!0});dm.SeverityNumber=void 0;var _ke;(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"})(_ke=dm.SeverityNumber||(dm.SeverityNumber={}))});var sR=R(Vp=>{"use strict";p();u();l();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.NOOP_LOGGER=Vp.NoopLogger=void 0;var oR=class{emit(e){}};Vp.NoopLogger=oR;Vp.NOOP_LOGGER=new oR});var aR=R(qp=>{"use strict";p();u();l();Object.defineProperty(qp,"__esModule",{value:!0});qp.NOOP_LOGGER_PROVIDER=qp.NoopLoggerProvider=void 0;var mke=sR(),iR=class{getLogger(e,n,r){return new mke.NoopLogger}};qp.NoopLoggerProvider=iR;qp.NOOP_LOGGER_PROVIDER=new iR});var Av=R(cR=>{"use strict";p();u();l();Object.defineProperty(cR,"__esModule",{value:!0});cR.ProxyLogger=void 0;var hke=sR(),Sv=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):hke.NOOP_LOGGER}};cR.ProxyLogger=Sv});var yv=R(uR=>{"use strict";p();u();l();Object.defineProperty(uR,"__esModule",{value:!0});uR.ProxyLoggerProvider=void 0;var Eke=aR(),gke=Av(),Rv=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new gke.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Eke.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)}};uR.ProxyLoggerProvider=Rv});var rZ=R(lR=>{"use strict";p();u();l();Object.defineProperty(lR,"__esModule",{value:!0});lR._globalThis=void 0;lR._globalThis=typeof globalThis=="object"?globalThis:global});var oZ=R(pR=>{"use strict";p();u();l();Object.defineProperty(pR,"__esModule",{value:!0});pR._globalThis=void 0;var Tke=rZ();Object.defineProperty(pR,"_globalThis",{enumerable:!0,get:function(){return Tke._globalThis}})});var sZ=R(dR=>{"use strict";p();u();l();Object.defineProperty(dR,"__esModule",{value:!0});dR._globalThis=void 0;var Ske=oZ();Object.defineProperty(dR,"_globalThis",{enumerable:!0,get:function(){return Ske._globalThis}})});var iZ=R(Ms=>{"use strict";p();u();l();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.API_BACKWARDS_COMPATIBILITY_VERSION=Ms.makeGetter=Ms._global=Ms.GLOBAL_LOGS_API_KEY=void 0;var Ake=sZ();Ms.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Ms._global=Ake._globalThis;function Rke(t,e,n){return r=>r===t?e:n}Ms.makeGetter=Rke;Ms.API_BACKWARDS_COMPATIBILITY_VERSION=1});var cZ=R(fR=>{"use strict";p();u();l();Object.defineProperty(fR,"__esModule",{value:!0});fR.LogsAPI=void 0;var Ao=iZ(),yke=aR(),aZ=yv(),Iv=class t{constructor(){this._proxyLoggerProvider=new aZ.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Ao._global[Ao.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Ao._global[Ao.GLOBAL_LOGS_API_KEY]=(0,Ao.makeGetter)(Ao.API_BACKWARDS_COMPATIBILITY_VERSION,e,yke.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Ao._global[Ao.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Ao._global,Ao.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Ao._global[Ao.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new aZ.ProxyLoggerProvider}};fR.LogsAPI=Iv});var Nv=R(nn=>{"use strict";p();u();l();Object.defineProperty(nn,"__esModule",{value:!0});nn.logs=nn.ProxyLoggerProvider=nn.ProxyLogger=nn.NoopLoggerProvider=nn.NOOP_LOGGER_PROVIDER=nn.NoopLogger=nn.NOOP_LOGGER=nn.SeverityNumber=void 0;var Ike=nZ();Object.defineProperty(nn,"SeverityNumber",{enumerable:!0,get:function(){return Ike.SeverityNumber}});var uZ=sR();Object.defineProperty(nn,"NOOP_LOGGER",{enumerable:!0,get:function(){return uZ.NOOP_LOGGER}});Object.defineProperty(nn,"NoopLogger",{enumerable:!0,get:function(){return uZ.NoopLogger}});var lZ=aR();Object.defineProperty(nn,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return lZ.NOOP_LOGGER_PROVIDER}});Object.defineProperty(nn,"NoopLoggerProvider",{enumerable:!0,get:function(){return lZ.NoopLoggerProvider}});var Nke=Av();Object.defineProperty(nn,"ProxyLogger",{enumerable:!0,get:function(){return Nke.ProxyLogger}});var Oke=yv();Object.defineProperty(nn,"ProxyLoggerProvider",{enumerable:!0,get:function(){return Oke.ProxyLoggerProvider}});var bke=cZ();nn.logs=bke.LogsAPI.getInstance()});var pZ=R(Yp=>{"use strict";p();u();l();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.disableInstrumentations=Yp.enableInstrumentations=void 0;function Cke(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()}}Yp.enableInstrumentations=Cke;function Pke(t){t.forEach(e=>e.disable())}Yp.disableInstrumentations=Pke});var _Z=R(_R=>{"use strict";p();u();l();Object.defineProperty(_R,"__esModule",{value:!0});_R.registerInstrumentations=void 0;var dZ=(w(),x(j)),Mke=Nv(),fZ=pZ();function vke(t){let e=t.tracerProvider||dZ.trace.getTracerProvider(),n=t.meterProvider||dZ.metrics.getMeterProvider(),r=t.loggerProvider||Mke.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,fZ.enableInstrumentations)(o,e,n,r),()=>{(0,fZ.disableInstrumentations)(o)}}_R.registerInstrumentations=vke});var yZ=R(mR=>{"use strict";p();u();l();Object.defineProperty(mR,"__esModule",{value:!0});mR.satisfies=void 0;var Pv=(w(),x(j)),TZ=/^(?: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-]+)*))?$/,xke=/^(?<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-]+)*))?$/,Lke={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Dke(t,e,n){if(!wke(t))return Pv.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Gke(t);if(!r)return!1;let o=[],s=SZ(r,e,o,n);return s&&!n?.includePrerelease?kke(r,o):s}mR.satisfies=Dke;function wke(t){return typeof t=="string"&&TZ.test(t)}function SZ(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(Ov(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=i1e(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!Ov(t,s,n,r))return!1;return!0}return Ov(t,e,n,r)}function Ov(t,e,n,r){if(e=Bke(e,r),e.includes(" "))return SZ(t,e,n,r);{let o=jke(e);return n.push(o),Uke(t,o)}}function Uke(t,e){if(e.invalid)return!1;if(!e.version||Cv(e.version))return!0;let n=hZ(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=hZ(r,o)}return Lke[e.op]?.includes(n)}function kke(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Bke(t,e){return t=t.trim(),t=o1e(t,e),t=r1e(t),t=s1e(t,e),t=t.trim(),t}function er(t){return!t||t.toLowerCase()==="x"||t==="*"}function Gke(t){let e=t.match(TZ);if(!e){Pv.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 jke(t){if(!t)return{};let e=t.match(xke);if(!e)return Pv.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 Cv(t){return t==="*"||t==="x"||t==="X"}function mZ(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Hke(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 Fke(t,e){if(Cv(t)||Cv(e))return 0;let[n,r]=Hke(mZ(t),mZ(e));return n>r?1:n<r?-1:0}function hZ(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Fke(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var AZ="[a-zA-Z0-9-]",RZ="0|[1-9]\\d*",$ke=`\\d*[a-zA-Z-]${AZ}*`,Vke="((?:<|>)?=?)",EZ=`(?:${RZ}|${$ke})`,qke=`(?:-(${EZ}(?:\\.${EZ})*))`,gZ=`${AZ}+`,Yke=`(?:\\+(${gZ}(?:\\.${gZ})*))`,bv=`${RZ}|x|X|\\*`,fm=`[v=\\s]*(${bv})(?:\\.(${bv})(?:\\.(${bv})(?:${qke})?${Yke}?)?)?`,Wke=`^${Vke}\\s*${fm}$`,Kke=new RegExp(Wke),zke=`^\\s*(${fm})\\s+-\\s+(${fm})\\s*$`,Xke=new RegExp(zke),Qke="(?:~>?)",Jke=`^${Qke}${fm}$`,Zke=new RegExp(Jke),e1e="(?:\\^)",t1e=`^${e1e}${fm}$`,n1e=new RegExp(t1e);function r1e(t){let e=Zke;return t.replace(e,(n,r,o,s,i)=>{let a;return er(r)?a="":er(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:er(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 o1e(t,e){let n=n1e,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let d;return er(s)?d="":er(i)?d=`>=${s}.0.0${r} <${+s+1}.0.0-0`:er(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 s1e(t,e){let n=Kke;return t.replace(n,(r,o,s,i,a,c)=>{let d=er(s),f=d||er(i),_=f||er(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 i1e(t,e){let n=Xke;return t.replace(n,(r,o,s,i,a,c,d,f,_,m,E,T)=>(er(s)?o="":er(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:er(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,er(_)?f="":er(m)?f=`<${+_+1}.0.0-0`:er(E)?f=`<${_}.${+m+1}.0-0`:T?f=`<=${_}.${m}.${E}-${T}`:e?.includePrerelease?f=`<${_}.${m}.${+E+1}-0`:f=`<=${f}`,`${o} ${f}`.trim()))}});var Mv=R(fn=>{"use strict";p();u();l();Object.defineProperty(fn,"__esModule",{value:!0});fn.massUnwrap=fn.unwrap=fn.massWrap=fn.wrap=void 0;var tr=console.error.bind(console);function _m(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 a1e=(t,e,n)=>{if(!t||!t[e]){tr("no original function "+String(e)+" to wrap");return}if(!n){tr("no wrapper function"),tr(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){tr("original object and wrapper must be functions");return}let o=n(r,e);return _m(o,"__original",r),_m(o,"__unwrap",()=>{t[e]===o&&_m(t,e,r)}),_m(o,"__wrapped",!0),_m(t,e,o),o};fn.wrap=a1e;var c1e=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{tr("must provide one or more modules to patch"),tr(new Error().stack);return}if(!(e&&Array.isArray(e))){tr("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,fn.wrap)(r,o,n)})})};fn.massWrap=c1e;var u1e=(t,e)=>{if(!t||!t[e]){tr("no function to unwrap."),tr(new Error().stack);return}let n=t[e];if(!n.__unwrap)tr("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};fn.unwrap=u1e;var l1e=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{tr("must provide one or more modules to patch"),tr(new Error().stack);return}if(!(e&&Array.isArray(e))){tr("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,fn.unwrap)(n,r)})})};fn.massUnwrap=l1e;function mm(t){t&&t.logger&&(typeof t.logger!="function"?tr("new logger isn't a function, not replacing"):tr=t.logger)}fn.default=mm;mm.wrap=fn.wrap;mm.massWrap=fn.massWrap;mm.unwrap=fn.unwrap;mm.massUnwrap=fn.massUnwrap});var IZ=R(ER=>{"use strict";p();u();l();Object.defineProperty(ER,"__esModule",{value:!0});ER.InstrumentationAbstract=void 0;var vv=(w(),x(j)),p1e=Nv(),hR=Mv(),xv=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=vv.diag.createComponentLogger({namespace:e}),this._tracer=vv.trace.getTracer(e,n),this._meter=vv.metrics.getMeter(e,n),this._logger=p1e.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=hR.wrap;_unwrap=hR.unwrap;_massWrap=hR.massWrap;_massUnwrap=hR.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)}}};ER.InstrumentationAbstract=xv});var NZ=R(Ba=>{"use strict";p();u();l();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.ModuleNameTrie=Ba.ModuleNameSeparator=void 0;Ba.ModuleNameSeparator="/";var gR=class{hooks=[];children=new Map},Lv=class{_trie=new gR;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Ba.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new gR,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(Ba.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))}};Ba.ModuleNameTrie=Lv});var bZ=R(TR=>{"use strict";p();u();l();Object.defineProperty(TR,"__esModule",{value:!0});TR.RequireInTheMiddleSingleton=void 0;var d1e=_f(),OZ=require("path"),Dv=NZ(),f1e=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),wv=class t{_moduleNameTrie=new Dv.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new d1e.Hook(null,{internals:!0},(e,n,r)=>{let o=_1e(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 f1e?new t:this._instance=this._instance??new t}};TR.RequireInTheMiddleSingleton=wv;function _1e(t){return OZ.sep!==Dv.ModuleNameSeparator?t.split(OZ.sep).join(Dv.ModuleNameSeparator):t}});var Uv=R(Ga=>{"use strict";p();u();l();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.isWrapped=Ga.safeExecuteInTheMiddleAsync=Ga.safeExecuteInTheMiddle=void 0;function m1e(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Ga.safeExecuteInTheMiddle=m1e;async function h1e(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}}Ga.safeExecuteInTheMiddleAsync=h1e;function E1e(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Ga.isWrapped=E1e});var MZ=R(SR=>{"use strict";p();u();l();Object.defineProperty(SR,"__esModule",{value:!0});SR.InstrumentationBase=void 0;var hm=require("path"),CZ=require("util"),g1e=yZ(),kv=Mv(),T1e=IZ(),S1e=bZ(),A1e=YE(),Em=(w(),x(j)),R1e=_f(),y1e=require("fs"),I1e=Uv(),Bv=class extends T1e.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=S1e.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,I1e.isWrapped)(e[n])&&this._unwrap(e,n),CZ.types.isProxy(e)){let o=(0,kv.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,kv.wrap)(e,n,r)};_unwrap=(e,n)=>CZ.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,kv.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Em.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Em.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{Em.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Em.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,y1e.readFileSync)(hm.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Em.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 PZ(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=hm.normalize(r);return i.filter(d=>d.name===a).filter(d=>PZ(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&&hm.isAbsolute(a)){let d=hm.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=hm.isAbsolute(e.name)?new R1e.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new A1e.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}};SR.InstrumentationBase=Bv;function PZ(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,g1e.satisfies)(e,r,{includePrerelease:n}))}});var vZ=R(AR=>{"use strict";p();u();l();Object.defineProperty(AR,"__esModule",{value:!0});AR.normalize=void 0;var N1e=require("path");Object.defineProperty(AR,"normalize",{enumerable:!0,get:function(){return N1e.normalize}})});var xZ=R(Wp=>{"use strict";p();u();l();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.normalize=Wp.InstrumentationBase=void 0;var O1e=MZ();Object.defineProperty(Wp,"InstrumentationBase",{enumerable:!0,get:function(){return O1e.InstrumentationBase}});var b1e=vZ();Object.defineProperty(Wp,"normalize",{enumerable:!0,get:function(){return b1e.normalize}})});var Gv=R(Kp=>{"use strict";p();u();l();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.normalize=Kp.InstrumentationBase=void 0;var LZ=xZ();Object.defineProperty(Kp,"InstrumentationBase",{enumerable:!0,get:function(){return LZ.InstrumentationBase}});Object.defineProperty(Kp,"normalize",{enumerable:!0,get:function(){return LZ.normalize}})});var DZ=R(RR=>{"use strict";p();u();l();Object.defineProperty(RR,"__esModule",{value:!0});RR.InstrumentationNodeModuleDefinition=void 0;var jv=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||[]}};RR.InstrumentationNodeModuleDefinition=jv});var wZ=R(yR=>{"use strict";p();u();l();Object.defineProperty(yR,"__esModule",{value:!0});yR.InstrumentationNodeModuleFile=void 0;var C1e=Gv(),Hv=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,C1e.normalize)(e)}};yR.InstrumentationNodeModuleFile=Hv});var UZ=R(Iu=>{"use strict";p();u();l();Object.defineProperty(Iu,"__esModule",{value:!0});Iu.semconvStabilityFromStr=Iu.SemconvStability=void 0;var IR;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(IR=Iu.SemconvStability||(Iu.SemconvStability={}));function P1e(t,e){let n=IR.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=IR.DUPLICATE;break}else o.toLowerCase()===t&&(n=IR.STABLE);return n}Iu.semconvStabilityFromStr=P1e});var BZ=R(Gt=>{"use strict";p();u();l();Object.defineProperty(Gt,"__esModule",{value:!0});Gt.semconvStabilityFromStr=Gt.SemconvStability=Gt.safeExecuteInTheMiddleAsync=Gt.safeExecuteInTheMiddle=Gt.isWrapped=Gt.InstrumentationNodeModuleFile=Gt.InstrumentationNodeModuleDefinition=Gt.InstrumentationBase=Gt.registerInstrumentations=void 0;var M1e=_Z();Object.defineProperty(Gt,"registerInstrumentations",{enumerable:!0,get:function(){return M1e.registerInstrumentations}});var v1e=Gv();Object.defineProperty(Gt,"InstrumentationBase",{enumerable:!0,get:function(){return v1e.InstrumentationBase}});var x1e=DZ();Object.defineProperty(Gt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return x1e.InstrumentationNodeModuleDefinition}});var L1e=wZ();Object.defineProperty(Gt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return L1e.InstrumentationNodeModuleFile}});var Fv=Uv();Object.defineProperty(Gt,"isWrapped",{enumerable:!0,get:function(){return Fv.isWrapped}});Object.defineProperty(Gt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return Fv.safeExecuteInTheMiddle}});Object.defineProperty(Gt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return Fv.safeExecuteInTheMiddleAsync}});var kZ=UZ();Object.defineProperty(Gt,"SemconvStability",{enumerable:!0,get:function(){return kZ.SemconvStability}});Object.defineProperty(Gt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return kZ.semconvStabilityFromStr}})});function U1e(){let t=zp[Vv];return t?.helper?t.helper:zp[$v]?.helper}function k1e(t){let e={helper:t};zp[Vv]=e,zp[$v]=e}function B1e(){delete zp[Vv],delete zp[$v]}function H1e(t){switch(t){case"client":return Ye.CLIENT;case"internal":default:return Ye.INTERNAL}}function HZ(t,e,n,r,o){if(FZ(e.name,o))return;let s={attributes:e.attributes,kind:H1e(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)HZ(t,c,n,r,o);i.end(e.endTime)})}function GZ(t,e){return $1e(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function $1e(t){return t!=null&&typeof t.then=="function"}function FZ(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var NR,D1e,w1e,$v,Vv,zp,G1e,j1e,F1e,$Z,jZ,V1e,q1e,VZ,qZ=S(()=>{p();u();l();w();NR=B(BZ(),1);w();D1e={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"}},w1e=D1e.version.split(".")[0],$v="PRISMA_INSTRUMENTATION",Vv=`V${w1e}_PRISMA_INSTRUMENTATION`,zp=globalThis;G1e=process.env.PRISMA_SHOW_ALL_TRACES==="true",j1e="00-10-10-00";F1e=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=ue.getSpanContext(t??V.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:j1e}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)HZ(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return V.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!G1e)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(FZ(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return GZ(s,e(s,r))}return n.startActiveSpan(o,t,s=>GZ(s,e(s,r)))}};$Z={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},jZ=$Z.version,V1e=$Z.name,q1e="@prisma/client",VZ=class extends NR.InstrumentationBase{tracerProvider;constructor(t={}){super(V1e,jZ,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new NR.InstrumentationNodeModuleDefinition(q1e,[jZ])]}enable(){let t=this._config;k1e(new F1e({tracerProvider:this.tracerProvider??ue.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){B1e()}isEnabled(){return U1e()!==void 0}}});function Y1e(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function WZ(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}function W1e(t){switch(t){case"client":return Ye.CLIENT;case"internal":default:return Ye.INTERNAL}}var YZ,qv,K1e,KZ,zZ=S(()=>{p();u();l();w();qZ();te();xe();YZ="Prisma";qv=class extends VZ{constructor(){super()}enable(){super.enable();let e=WZ();Y1e(e)&&(e.createEngineSpan=n=>{let r=ue.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){bt(()=>{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=W1e(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:jn.SAMPLED}})),_=ue.setSpanContext(V.active(),{traceId:d,spanId:a,traceFlags:jn.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}})}};K1e=X(YZ,t=>new qv),KZ=t=>({name:YZ,setupOnce(){K1e()},setup(e){WZ()&&e.on("spanStart",n=>{let r=se(n);r.description?.startsWith("prisma:")&&n.setAttribute(pe,"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")})}})});var XZ=R(Xp=>{"use strict";p();u();l();Object.defineProperty(Xp,"__esModule",{value:!0});Xp.PACKAGE_NAME=Xp.PACKAGE_VERSION=void 0;Xp.PACKAGE_VERSION="0.56.0";Xp.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var Yv=R(vs=>{"use strict";p();u();l();Object.defineProperty(vs,"__esModule",{value:!0});vs.HapiLifecycleMethodNames=vs.HapiLayerType=vs.handlerPatched=vs.HapiComponentName=void 0;vs.HapiComponentName="@hapi/hapi";vs.handlerPatched=Symbol("hapi-handler-patched");vs.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};vs.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var QZ=R(OR=>{"use strict";p();u();l();Object.defineProperty(OR,"__esModule",{value:!0});OR.ATTR_HTTP_METHOD=void 0;OR.ATTR_HTTP_METHOD="http.method"});var Wv=R(gm=>{"use strict";p();u();l();Object.defineProperty(gm,"__esModule",{value:!0});gm.AttributeNames=void 0;var z1e;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(z1e=gm.AttributeNames||(gm.AttributeNames={}))});var e7=R(jt=>{"use strict";p();u();l();Object.defineProperty(jt,"__esModule",{value:!0});jt.getPluginFromInput=jt.getExtMetadata=jt.getRouteMetadata=jt.isPatchableExtMethod=jt.isDirectExtInput=jt.isLifecycleExtEventObj=jt.isLifecycleExtType=jt.getPluginName=void 0;var JZ=(ye(),x(Ge)),X1e=QZ(),Tm=Yv(),ja=Wv(),ZZ=de();function Q1e(t){return t.name?t.name:t.pkg.name}jt.getPluginName=Q1e;var J1e=t=>typeof t=="string"&&Tm.HapiLifecycleMethodNames.has(t);jt.isLifecycleExtType=J1e;var Z1e=t=>{let e=t?.type;return e!==void 0&&(0,jt.isLifecycleExtType)(e)};jt.isLifecycleExtEventObj=Z1e;var eBe=t=>Array.isArray(t)&&t.length<=3&&(0,jt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";jt.isDirectExtInput=eBe;var tBe=t=>!Array.isArray(t);jt.isPatchableExtMethod=tBe;var nBe=(t,e,n)=>{let r={[JZ.ATTR_HTTP_ROUTE]:t.path};e&ZZ.SemconvStability.OLD&&(r[X1e.ATTR_HTTP_METHOD]=t.method),e&ZZ.SemconvStability.STABLE&&(r[JZ.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[ja.AttributeNames.HAPI_TYPE]=Tm.HapiLayerType.PLUGIN,r[ja.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[ja.AttributeNames.HAPI_TYPE]=Tm.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};jt.getRouteMetadata=nBe;var rBe=(t,e)=>e?{attributes:{[ja.AttributeNames.EXT_TYPE]:t,[ja.AttributeNames.HAPI_TYPE]:Tm.HapiLayerType.EXT,[ja.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ext - ${t}`}:{attributes:{[ja.AttributeNames.EXT_TYPE]:t,[ja.AttributeNames.HAPI_TYPE]:Tm.HapiLayerType.EXT},name:`ext - ${t}`};jt.getExtMetadata=rBe;var oBe=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;jt.getPluginFromInput=oBe});var r7=R(bR=>{"use strict";p();u();l();Object.defineProperty(bR,"__esModule",{value:!0});bR.HapiInstrumentation=void 0;var kr=(w(),x(j)),t7=ke(),Sm=de(),n7=XZ(),Am=Yv(),Ei=e7(),Kv=class extends Sm.InstrumentationBase{_semconvStability;constructor(e={}){super(n7.PACKAGE_NAME,n7.PACKAGE_VERSION,e),this._semconvStability=(0,Sm.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new Sm.InstrumentationNodeModuleDefinition(Am.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Sm.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,Sm.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,Ei.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Ei.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,Ei.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,Ei.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,Ei.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,Ei.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,Ei.isPatchableExtMethod)(e))return e[Am.handlerPatched]===!0?e:(e[Am.handlerPatched]=!0,async function(...i){if(kr.trace.getSpan(kr.context.active())===void 0)return await e.apply(this,i);let a=(0,Ei.getExtMetadata)(n,r),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await kr.context.with(kr.trace.setSpan(kr.context.active(),c),e,void 0,...i)}catch(d){throw c.recordException(d),c.setStatus({code:kr.SpanStatusCode.ERROR,message:d.message}),d}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[Am.handlerPatched]===!0)return e;e[Am.handlerPatched]=!0;let o=s=>async function(...i){if(kr.trace.getSpan(kr.context.active())===void 0)return await s.call(this,...i);let a=(0,t7.getRPCMetadata)(kr.context.active());a?.type===t7.RPCType.HTTP&&(a.route=e.path);let c=(0,Ei.getRouteMetadata)(e,r._semconvStability,n),d=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await kr.context.with(kr.trace.setSpan(kr.context.active(),d),()=>s.call(this,...i))}catch(f){throw d.recordException(f),d.setStatus({code:kr.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}};bR.HapiInstrumentation=Kv});var o7=R(Qp=>{"use strict";p();u();l();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.AttributeNames=Qp.HapiInstrumentation=void 0;var sBe=r7();Object.defineProperty(Qp,"HapiInstrumentation",{enumerable:!0,get:function(){return sBe.HapiInstrumentation}});var iBe=Wv();Object.defineProperty(Qp,"AttributeNames",{enumerable:!0,get:function(){return iBe.AttributeNames}})});var s7,i7,a7,aBe,c7,u7=S(()=>{p();u();l();s7=B(o7(),1);xe();i7="Hapi",a7=X(i7,()=>new s7.HapiInstrumentation),aBe=(()=>({name:i7,setupOnce(){a7()}})),c7=aBe});var Ha,Rm,zv=S(()=>{p();u();l();Ha={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Rm={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"}});var PR,cBe,uBe,CR,l7=S(()=>{p();u();l();w();PR=B(de(),1);te();zv();cBe="@sentry/instrumentation-hono",uBe="0.0.1",CR=class extends PR.InstrumentationBase{constructor(e={}){super(cBe,uBe,e)}init(){return[new PR.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(ue.setSpan(V.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Yn(a))return a.then(c=>{let d=n._determineHandlerType(c);return i.setAttributes({[Ha.HONO_TYPE]:d,[Ha.HONO_NAME]:d===Rm.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[Ha.HONO_TYPE]:c,[Ha.HONO_NAME]:c===Rm.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 Yn(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Rm.MIDDLEWARE:Rm.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:nt.ERROR,message:n.message}),e.recordException(n))}}});function lBe(t){let e=se(t).data,n=e[Ha.HONO_TYPE];if(e[fe]||!n)return;t.setAttributes({[pe]:"auto.http.otel.hono",[fe]:`${n}.hono`});let r=e[Ha.HONO_NAME];if(typeof r=="string"&&t.updateName(r),Ne()===no()){ht&&N.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[cr],s=e[Ws];typeof o=="string"&&typeof s=="string"&&Ne().setTransactionName(`${s} ${o}`)}var p7,d7,pBe,f7,_7=S(()=>{p();u();l();ye();te();xe();Eu();zv();l7();p7="Hono";d7=X(p7,()=>new CR({responseHook:t=>{lBe(t)}})),pBe=(()=>({name:p7,setupOnce(){d7()}})),f7=pBe});var MR=R(ym=>{"use strict";p();u();l();Object.defineProperty(ym,"__esModule",{value:!0});ym.KoaLayerType=void 0;var dBe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(dBe=ym.KoaLayerType||(ym.KoaLayerType={}))});var m7=R(Jp=>{"use strict";p();u();l();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.PACKAGE_NAME=Jp.PACKAGE_VERSION=void 0;Jp.PACKAGE_VERSION="0.58.0";Jp.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var Xv=R(Im=>{"use strict";p();u();l();Object.defineProperty(Im,"__esModule",{value:!0});Im.AttributeNames=void 0;var fBe;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(fBe=Im.AttributeNames||(Im.AttributeNames={}))});var E7=R(Zp=>{"use strict";p();u();l();Object.defineProperty(Zp,"__esModule",{value:!0});Zp.isLayerIgnored=Zp.getMiddlewareMetadata=void 0;var h7=MR(),vR=Xv(),_Be=(ye(),x(Ge)),mBe=(t,e,n,r)=>n?{attributes:{[vR.AttributeNames.KOA_NAME]:r?.toString(),[vR.AttributeNames.KOA_TYPE]:h7.KoaLayerType.ROUTER,[_Be.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[vR.AttributeNames.KOA_NAME]:e.name??"middleware",[vR.AttributeNames.KOA_TYPE]:h7.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Zp.getMiddlewareMetadata=mBe;var hBe=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Zp.isLayerIgnored=hBe});var g7=R(xR=>{"use strict";p();u();l();Object.defineProperty(xR,"__esModule",{value:!0});xR.kLayerPatched=void 0;xR.kLayerPatched=Symbol("koa-layer-patched")});var I7=R(LR=>{"use strict";p();u();l();Object.defineProperty(LR,"__esModule",{value:!0});LR.KoaInstrumentation=void 0;var xs=(w(),x(j)),Nm=de(),T7=MR(),S7=m7(),A7=E7(),R7=ke(),y7=g7(),Qv=class extends Nm.InstrumentationBase{constructor(e={}){super(S7.PACKAGE_NAME,S7.PACKAGE_VERSION,e)}init(){return new Nm.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Nm.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,Nm.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){xs.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?T7.KoaLayerType.ROUTER:T7.KoaLayerType.MIDDLEWARE;return e[y7.kLayerPatched]===!0||(0,A7.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(xs.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[y7.kLayerPatched]=!0,xs.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(xs.trace.getSpan(xs.context.active())===void 0)return e(s,i);let c=(0,A7.getMiddlewareMetadata)(s,e,n,r),d=this.tracer.startSpan(c.name,{attributes:c.attributes}),f=(0,R7.getRPCMetadata)(xs.context.active());f?.type===R7.RPCType.HTTP&&s._matchedRoute&&(f.route=s._matchedRoute.toString());let{requestHook:_}=this.getConfig();_&&(0,Nm.safeExecuteInTheMiddle)(()=>_(d,{context:s,middlewareLayer:e,layerType:o}),E=>{E&&xs.diag.error("koa instrumentation: request hook failed",E)},!0);let m=xs.trace.setSpan(xs.context.active(),d);return xs.context.with(m,async()=>{try{return await e(s,i)}catch(E){throw d.recordException(E),E}finally{d.end()}})})}};LR.KoaInstrumentation=Qv});var N7=R(Fa=>{"use strict";p();u();l();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.KoaLayerType=Fa.AttributeNames=Fa.KoaInstrumentation=void 0;var EBe=I7();Object.defineProperty(Fa,"KoaInstrumentation",{enumerable:!0,get:function(){return EBe.KoaInstrumentation}});var gBe=Xv();Object.defineProperty(Fa,"AttributeNames",{enumerable:!0,get:function(){return gBe.AttributeNames}});var TBe=MR();Object.defineProperty(Fa,"KoaLayerType",{enumerable:!0,get:function(){return TBe.KoaLayerType}})});var O7,b7,C7,SBe,P7,M7=S(()=>{p();u();l();O7=B(N7(),1);ye();te();xe();Eu();b7="Koa",C7=X(b7,O7.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Be(e,"auto.http.otel.koa");let r=se(e).data,o=r["koa.type"];o&&e.setAttribute(fe,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),Ne()===no()){ht&&N.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[cr],a=n.context?.request?.method?.toUpperCase()||"GET";i&&Ne().setTransactionName(`${a} ${i}`)}})),SBe=((t={})=>({name:b7,setupOnce(){C7(t)}})),P7=SBe});var Jv=R(zo=>{"use strict";p();u();l();Object.defineProperty(zo,"__esModule",{value:!0});zo.ConnectNames=zo.ConnectTypes=zo.AttributeNames=void 0;var ABe;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(ABe=zo.AttributeNames||(zo.AttributeNames={}));var RBe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(RBe=zo.ConnectTypes||(zo.ConnectTypes={}));var yBe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(yBe=zo.ConnectNames||(zo.ConnectNames={}))});var v7=R(ed=>{"use strict";p();u();l();Object.defineProperty(ed,"__esModule",{value:!0});ed.PACKAGE_NAME=ed.PACKAGE_VERSION=void 0;ed.PACKAGE_VERSION="0.53.0";ed.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var x7=R(DR=>{"use strict";p();u();l();Object.defineProperty(DR,"__esModule",{value:!0});DR._LAYERS_STORE_PROPERTY=void 0;DR._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var L7=R(Va=>{"use strict";p();u();l();Object.defineProperty(Va,"__esModule",{value:!0});Va.generateRoute=Va.replaceCurrentStackRoute=Va.addNewStackLayer=void 0;var IBe=(w(),x(j)),$a=x7(),NBe=t=>{Array.isArray(t[$a._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,$a._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[$a._LAYERS_STORE_PROPERTY].push("/");let e=t[$a._LAYERS_STORE_PROPERTY].length;return()=>{e===t[$a._LAYERS_STORE_PROPERTY].length?t[$a._LAYERS_STORE_PROPERTY].pop():IBe.diag.warn("Connect: Trying to pop the stack multiple time")}};Va.addNewStackLayer=NBe;var OBe=(t,e)=>{e&&t[$a._LAYERS_STORE_PROPERTY].splice(-1,1,e)};Va.replaceCurrentStackRoute=OBe;var bBe=t=>t[$a._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);Va.generateRoute=bBe});var U7=R(qa=>{"use strict";p();u();l();Object.defineProperty(qa,"__esModule",{value:!0});qa.ConnectInstrumentation=qa.ANONYMOUS_NAME=void 0;var CBe=(w(),x(j)),D7=ke(),td=Jv(),w7=v7(),wR=de(),PBe=(ye(),x(Ge)),Zv=L7();qa.ANONYMOUS_NAME="anonymous";var ex=class extends wR.InstrumentationBase{constructor(e={}){super(w7.PACKAGE_NAME,w7.PACKAGE_VERSION,e)}init(){return[new wR.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,wR.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,wR.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=td.ConnectTypes.REQUEST_HANDLER,s=td.ConnectNames.REQUEST_HANDLER,o=e):(r=td.ConnectTypes.MIDDLEWARE,s=td.ConnectNames.MIDDLEWARE,o=n.name||qa.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[PBe.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[td.AttributeNames.CONNECT_TYPE]:r,[td.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,Zv.replaceCurrentStackRoute)(d,e);let m=(0,D7.getRPCMetadata)(CBe.context.active());e&&m?.type===D7.RPCType.HTTP&&(m.route=(0,Zv.generateRoute)(d));let E="";e?E=`request handler - ${e}`:E=`middleware - ${n.name||qa.ANONYMOUS_NAME}`;let T=r._startSpan(e,n);r._diag.debug("start span",E);let A=!1;function y(){A?r._diag.debug(`span ${T.name} - already finished`):(A=!0,r._diag.debug(`finishing span ${T.name}`),T.end()),f.removeListener("close",y)}return f.addListener("close",y),arguments[c]=r._patchNext(_,y),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,Zv.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)}}};qa.ConnectInstrumentation=ex});var B7=R(Ro=>{"use strict";p();u();l();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.ConnectTypes=Ro.ConnectNames=Ro.AttributeNames=Ro.ANONYMOUS_NAME=Ro.ConnectInstrumentation=void 0;var k7=U7();Object.defineProperty(Ro,"ConnectInstrumentation",{enumerable:!0,get:function(){return k7.ConnectInstrumentation}});Object.defineProperty(Ro,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return k7.ANONYMOUS_NAME}});var tx=Jv();Object.defineProperty(Ro,"AttributeNames",{enumerable:!0,get:function(){return tx.AttributeNames}});Object.defineProperty(Ro,"ConnectNames",{enumerable:!0,get:function(){return tx.ConnectNames}});Object.defineProperty(Ro,"ConnectTypes",{enumerable:!0,get:function(){return tx.ConnectTypes}})});var G7,j7,H7,MBe,F7,$7=S(()=>{p();u();l();G7=B(B7(),1);xe();j7="Connect",H7=X(j7,()=>new G7.ConnectInstrumentation),MBe=(()=>({name:j7,setupOnce(){H7()}})),F7=MBe});var V7=R(rn=>{"use strict";p();u();l();Object.defineProperty(rn,"__esModule",{value:!0});rn.DB_SYSTEM_VALUE_MSSQL=rn.ATTR_NET_PEER_PORT=rn.ATTR_NET_PEER_NAME=rn.ATTR_DB_USER=rn.ATTR_DB_SYSTEM=rn.ATTR_DB_STATEMENT=rn.ATTR_DB_SQL_TABLE=rn.ATTR_DB_NAME=void 0;rn.ATTR_DB_NAME="db.name";rn.ATTR_DB_SQL_TABLE="db.sql.table";rn.ATTR_DB_STATEMENT="db.statement";rn.ATTR_DB_SYSTEM="db.system";rn.ATTR_DB_USER="db.user";rn.ATTR_NET_PEER_NAME="net.peer.name";rn.ATTR_NET_PEER_PORT="net.peer.port";rn.DB_SYSTEM_VALUE_MSSQL="mssql"});var q7=R(nd=>{"use strict";p();u();l();Object.defineProperty(nd,"__esModule",{value:!0});nd.once=nd.getSpanName=void 0;function vBe(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}nd.getSpanName=vBe;var xBe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};nd.once=xBe});var Y7=R(rd=>{"use strict";p();u();l();Object.defineProperty(rd,"__esModule",{value:!0});rd.PACKAGE_NAME=rd.PACKAGE_VERSION=void 0;rd.PACKAGE_VERSION="0.29.0";rd.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var Q7=R(Wa=>{"use strict";p();u();l();Object.defineProperty(Wa,"__esModule",{value:!0});Wa.TediousInstrumentation=Wa.INJECTED_CTX=void 0;var od=(w(),x(j)),LBe=require("events"),Ls=de(),Nu=(ye(),x(Ge)),Ya=V7(),W7=q7(),K7=Y7(),X7=Symbol("opentelemetry.instrumentation-tedious.current-database");Wa.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var z7=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function UR(t){Object.defineProperty(this,X7,{value:t,writable:!0})}var nx=class t extends Ls.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(K7.PACKAGE_NAME,K7.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ls.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ls.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Ls.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of z7)(0,Ls.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,Ls.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 z7)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return UR.call(this,this.config?.options?.database),this.removeListener("databaseChange",UR),this.on("databaseChange",UR),this.once("end",()=>{this.removeListener("databaseChange",UR)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||od.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,Wa.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?.[Wa.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof LBe.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[X7],m=(v=>v.sqlTextOrProcedure==="sp_prepare"&&v.parametersByName?.stmt?.value?v.parametersByName.stmt.value:v.sqlTextOrProcedure)(i),E={};o._dbSemconvStability&Ls.SemconvStability.OLD&&(E[Ya.ATTR_DB_SYSTEM]=Ya.DB_SYSTEM_VALUE_MSSQL,E[Ya.ATTR_DB_NAME]=_,E[Ya.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,E[Ya.ATTR_DB_STATEMENT]=m,E[Ya.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&Ls.SemconvStability.STABLE&&(E[Nu.ATTR_DB_NAMESPACE]=_,E[Nu.ATTR_DB_SYSTEM_NAME]=Nu.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,E[Nu.ATTR_DB_QUERY_TEXT]=m,E[Nu.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&Ls.SemconvStability.OLD&&(E[Ya.ATTR_NET_PEER_NAME]=this.config?.server,E[Ya.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&Ls.SemconvStability.STABLE&&(E[Nu.ATTR_SERVER_ADDRESS]=this.config?.server,E[Nu.ATTR_SERVER_PORT]=this.config?.options?.port);let T=o.tracer.startSpan((0,W7.getSpanName)(e,_,m,i.table),{kind:od.SpanKind.CLIENT,attributes:E}),A=(0,W7.once)(v=>{i.removeListener("done",d),i.removeListener("doneInProc",d),i.removeListener("doneProc",f),i.removeListener("error",A),this.removeListener("end",A),T.setAttribute("tedious.procedure_count",a),T.setAttribute("tedious.statement_count",c),v&&T.setStatus({code:od.SpanStatusCode.ERROR,message:v.message}),T.end()});i.on("done",d),i.on("doneInProc",d),i.on("doneProc",f),i.once("error",A),this.on("end",A),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(A)):o._diag.error("Expected request.callback to be a function");let y=()=>od.context.with(od.trace.setSpan(od.context.active(),T),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return y();let M=o._buildTraceparent(T);o._injectContextInfo(this,n,M).finally(y)}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)}}};Wa.TediousInstrumentation=nx});var J7=R(kR=>{"use strict";p();u();l();Object.defineProperty(kR,"__esModule",{value:!0});kR.TediousInstrumentation=void 0;var DBe=Q7();Object.defineProperty(kR,"TediousInstrumentation",{enumerable:!0,get:function(){return DBe.TediousInstrumentation}})});var Z7,wBe,eee,tee,UBe,nee,ree=S(()=>{p();u();l();Z7=B(J7(),1);te();xe();wBe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),eee="Tedious",tee=X(eee,()=>new Z7.TediousInstrumentation({})),UBe=(()=>{let t;return{name:eee,setupOnce(){let e=tee();t=l_(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=se(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";wBe.has(s)&&n.setAttribute(pe,"auto.db.otel.tedious")}))}}}),nee=UBe});var oee=R(sd=>{"use strict";p();u();l();Object.defineProperty(sd,"__esModule",{value:!0});sd.PACKAGE_NAME=sd.PACKAGE_VERSION=void 0;sd.PACKAGE_VERSION="0.53.0";sd.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var iee=R(BR=>{"use strict";p();u();l();Object.defineProperty(BR,"__esModule",{value:!0});BR.GenericPoolInstrumentation=void 0;var id=(w(),x(j)),Ou=de(),see=oee(),rx="generic-pool",ox=class extends Ou.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(see.PACKAGE_NAME,see.PACKAGE_VERSION,e)}init(){return[new Ou.InstrumentationNodeModuleDefinition(rx,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,Ou.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 Ou.InstrumentationNodeModuleDefinition(rx,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,Ou.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 Ou.InstrumentationNodeModuleDefinition(rx,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,Ou.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=id.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return id.context.with(id.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=id.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return id.context.with(id.trace.setSpan(i,a),()=>{e.call(this,(c,d)=>{if(a.end(),o)return o(c,d)},s)})}}};BR.GenericPoolInstrumentation=ox});var aee=R(GR=>{"use strict";p();u();l();Object.defineProperty(GR,"__esModule",{value:!0});GR.GenericPoolInstrumentation=void 0;var kBe=iee();Object.defineProperty(GR,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return kBe.GenericPoolInstrumentation}})});var cee,uee,lee,BBe,pee,dee=S(()=>{p();u();l();cee=B(aee(),1);te();xe();uee="GenericPool",lee=X(uee,()=>new cee.GenericPoolInstrumentation({})),BBe=(()=>{let t;return{name:uee,setupOnce(){let e=lee();t=l_(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=se(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(pe,"auto.db.otel.generic_pool")}))}}}),pee=BBe});var sx=R(Ds=>{"use strict";p();u();l();Object.defineProperty(Ds,"__esModule",{value:!0});Ds.ATTR_NET_PEER_PORT=Ds.ATTR_NET_PEER_NAME=Ds.ATTR_MESSAGING_SYSTEM=Ds.ATTR_MESSAGING_OPERATION=void 0;Ds.ATTR_MESSAGING_OPERATION="messaging.operation";Ds.ATTR_MESSAGING_SYSTEM="messaging.system";Ds.ATTR_NET_PEER_NAME="net.peer.name";Ds.ATTR_NET_PEER_PORT="net.peer.port"});var ix=R(gt=>{"use strict";p();u();l();Object.defineProperty(gt,"__esModule",{value:!0});gt.ATTR_MESSAGING_CONVERSATION_ID=gt.OLD_ATTR_MESSAGING_MESSAGE_ID=gt.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=gt.ATTR_MESSAGING_URL=gt.ATTR_MESSAGING_PROTOCOL_VERSION=gt.ATTR_MESSAGING_PROTOCOL=gt.MESSAGING_OPERATION_VALUE_PROCESS=gt.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=gt.ATTR_MESSAGING_DESTINATION_KIND=gt.ATTR_MESSAGING_DESTINATION=void 0;gt.ATTR_MESSAGING_DESTINATION="messaging.destination";gt.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";gt.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";gt.MESSAGING_OPERATION_VALUE_PROCESS="process";gt.ATTR_MESSAGING_PROTOCOL="messaging.protocol";gt.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";gt.ATTR_MESSAGING_URL="messaging.url";gt.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";gt.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";gt.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var ax=R(bu=>{"use strict";p();u();l();Object.defineProperty(bu,"__esModule",{value:!0});bu.DEFAULT_CONFIG=bu.EndOperation=void 0;var GBe;(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"})(GBe=bu.EndOperation||(bu.EndOperation={}));bu.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var hee=R(Tt=>{"use strict";p();u();l();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.isConfirmChannelTracing=Tt.unmarkConfirmChannelTracing=Tt.markConfirmChannelTracing=Tt.getConnectionAttributesFromUrl=Tt.getConnectionAttributesFromServer=Tt.normalizeExchange=Tt.CONNECTION_ATTRIBUTES=Tt.CHANNEL_CONSUME_TIMEOUT_TIMER=Tt.CHANNEL_SPANS_NOT_ENDED=Tt.MESSAGE_STORED_SPAN=void 0;var cx=(w(),x(j)),Ka=de(),jR=(ye(),x(Ge)),Om=sx(),HR=ix();Tt.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");Tt.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");Tt.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");Tt.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var ux=(0,cx.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),jBe=t=>t!==""?t:"<default>";Tt.normalizeExchange=jBe;var HBe=t=>t.replace(/:[^:@/]*@/,":***@"),fee=(t,e)=>t||(e==="AMQP"?5672:5671),_ee=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},mee=t=>t||"localhost",ws=(t,e,n,r)=>n?{[e]:n}:(cx.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),FBe=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Om.ATTR_MESSAGING_SYSTEM]:e}:{}};Tt.getConnectionAttributesFromServer=FBe;var $Be=(t,e)=>{let n={[HR.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=_ee(r?.protocol);Object.assign(n,{...ws(t,HR.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=mee(r?.hostname);e&Ka.SemconvStability.OLD&&Object.assign(n,{...ws(t,Om.ATTR_NET_PEER_NAME,s,"hostname")}),e&Ka.SemconvStability.STABLE&&Object.assign(n,{...ws(t,jR.ATTR_SERVER_ADDRESS,s,"hostname")});let i=fee(r.port,o);e&Ka.SemconvStability.OLD&&Object.assign(n,ws(t,Om.ATTR_NET_PEER_PORT,i,"port")),e&Ka.SemconvStability.STABLE&&Object.assign(n,ws(t,jR.ATTR_SERVER_PORT,i,"port"))}else{let r=HBe(t);n[HR.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=_ee(o.protocol);Object.assign(n,{...ws(r,HR.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=mee(o.hostname);e&Ka.SemconvStability.OLD&&Object.assign(n,{...ws(r,Om.ATTR_NET_PEER_NAME,i,"hostname")}),e&Ka.SemconvStability.STABLE&&Object.assign(n,{...ws(r,jR.ATTR_SERVER_ADDRESS,i,"hostname")});let a=fee(o.port?parseInt(o.port):void 0,s);e&Ka.SemconvStability.OLD&&Object.assign(n,ws(r,Om.ATTR_NET_PEER_PORT,a,"port")),e&Ka.SemconvStability.STABLE&&Object.assign(n,ws(r,jR.ATTR_SERVER_PORT,a,"port"))}catch(o){cx.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};Tt.getConnectionAttributesFromUrl=$Be;var VBe=t=>t.setValue(ux,!0);Tt.markConfirmChannelTracing=VBe;var qBe=t=>t.deleteValue(ux);Tt.unmarkConfirmChannelTracing=qBe;var YBe=t=>t.getValue(ux)===!0;Tt.isConfirmChannelTracing=YBe});var Eee=R(ad=>{"use strict";p();u();l();Object.defineProperty(ad,"__esModule",{value:!0});ad.PACKAGE_NAME=ad.PACKAGE_VERSION=void 0;ad.PACKAGE_VERSION="0.57.0";ad.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var Tee=R(VR=>{"use strict";p();u();l();Object.defineProperty(VR,"__esModule",{value:!0});VR.AmqplibInstrumentation=void 0;var lt=(w(),x(j)),FR=ke(),Le=de(),WBe=sx(),Br=ix(),nr=ax(),St=hee(),gee=Eee(),$R=[">=0.5.5 <1"],lx=class extends Le.InstrumentationBase{_netSemconvStability;constructor(e={}){super(gee.PACKAGE_NAME,gee.PACKAGE_VERSION,{...nr.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Le.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...nr.DEFAULT_CONFIG,...e})}init(){let e=new Le.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",$R,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Le.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",$R,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Le.InstrumentationNodeModuleFile("amqplib/lib/connect.js",$R,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Le.InstrumentationNodeModuleDefinition("amqplib",$R,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Le.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Le.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Le.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Le.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Le.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,nr.EndOperation.Ack)),(0,Le.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,nr.EndOperation.Nack)),(0,Le.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,nr.EndOperation.Reject)),(0,Le.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,nr.EndOperation.AckAll)),(0,Le.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,nr.EndOperation.NackAll)),(0,Le.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Le.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Le.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Le.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Le.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Le.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Le.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Le.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Le.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Le.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Le.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,St.getConnectionAttributesFromUrl)(o,n._netSemconvStability),f=(0,St.getConnectionAttributesFromServer)(c);c[St.CONNECTION_ATTRIBUTES]={...d,...f}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,nr.EndOperation.ChannelClosed,void 0);let s=this[St.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[St.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,nr.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===nr.EndOperation.Reject?a:c,_=d[St.CHANNEL_SPANS_NOT_ENDED]??[],m=_.findIndex(E=>E.msg===i);if(m<0)o.endConsumerSpan(i,e,n,f);else if(n!==nr.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,St.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:f}=r.getConfig();if(f){let _=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},f);_.unref(),c[St.CHANNEL_CONSUME_TIMEOUT_TIMER]=_}c[St.CHANNEL_SPANS_NOT_ENDED]=[]}let d=function(f){if(!f)return i.call(this,f);let _=f.properties.headers??{},m=lt.propagation.extract(lt.ROOT_CONTEXT,_),E=f.fields?.exchange,T;if(r._config.useLinksForConsume){let I=m?lt.trace.getSpan(m)?.spanContext():void 0;m=void 0,I&&(T=[{context:I}])}let A=r.tracer.startSpan(`${s} process`,{kind:lt.SpanKind.CONSUMER,attributes:{...c?.connection?.[St.CONNECTION_ATTRIBUTES],[Br.ATTR_MESSAGING_DESTINATION]:E,[Br.ATTR_MESSAGING_DESTINATION_KIND]:Br.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Br.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:f.fields?.routingKey,[WBe.ATTR_MESSAGING_OPERATION]:Br.MESSAGING_OPERATION_VALUE_PROCESS,[Br.OLD_ATTR_MESSAGING_MESSAGE_ID]:f?.properties.messageId,[Br.ATTR_MESSAGING_CONVERSATION_ID]:f?.properties.correlationId},links:T},m),{consumeHook:y}=r.getConfig();y&&(0,Le.safeExecuteInTheMiddle)(()=>y(A,{moduleVersion:e,msg:f}),I=>{I&&lt.diag.error("amqplib instrumentation: consumerHook error",I)},!0),a?.noAck||(c[St.CHANNEL_SPANS_NOT_ENDED].push({msg:f,timeOfConsume:(0,FR.hrTime)()}),f[St.MESSAGE_STORED_SPAN]=A);let O=m||lt.ROOT_CONTEXT;lt.context.with(lt.trace.setSpan(O,A),()=>{i.call(this,f)}),a?.noAck&&(r.callConsumeEndHook(A,f,!1,nr.EndOperation.AutoAck),A.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,Le.safeExecuteInTheMiddle)(()=>E(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:m,isConfirmChannel:!0}),O=>{O&&lt.diag.error("amqplib instrumentation: publishHook error",O)},!0);let T=function(O,I){try{d?.call(this,O,I)}finally{let{publishConfirmHook:M}=r.getConfig();M&&(0,Le.safeExecuteInTheMiddle)(()=>M(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:O}),v=>{v&&lt.diag.error("amqplib instrumentation: publishConfirmHook error",v)},!0),O&&_.setStatus({code:lt.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),_.end()}},A=(0,St.markConfirmChannelTracing)(lt.context.active()),y=[...arguments];return y[3]=m,y[4]=lt.context.bind((0,St.unmarkConfirmChannelTracing)(lt.trace.setSpan(A,_)),T),lt.context.with(A,n.bind(this,...y))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,St.isConfirmChannelTracing)(lt.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,Le.safeExecuteInTheMiddle)(()=>m(f,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!1}),A=>{A&&lt.diag.error("amqplib instrumentation: publishHook error",A)},!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,St.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:lt.SpanKind.PRODUCER,attributes:{...o.connection[St.CONNECTION_ATTRIBUTES],[Br.ATTR_MESSAGING_DESTINATION]:n,[Br.ATTR_MESSAGING_DESTINATION_KIND]:Br.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Br.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[Br.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[Br.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},lt.propagation.inject(lt.trace.setSpan(lt.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[St.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:lt.SpanStatusCode.ERROR,message:r!==nr.EndOperation.ChannelClosed&&r!==nr.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[St.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[St.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[St.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Le.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&lt.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,FR.hrTime)(),r=e[St.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,FR.hrTimeDuration)(i.timeOfConsume,n);if((0,FR.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,nr.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};VR.AmqplibInstrumentation=lx});var Aee=R(za=>{"use strict";p();u();l();Object.defineProperty(za,"__esModule",{value:!0});za.EndOperation=za.DEFAULT_CONFIG=za.AmqplibInstrumentation=void 0;var KBe=Tee();Object.defineProperty(za,"AmqplibInstrumentation",{enumerable:!0,get:function(){return KBe.AmqplibInstrumentation}});var See=ax();Object.defineProperty(za,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return See.DEFAULT_CONFIG}});Object.defineProperty(za,"EndOperation",{enumerable:!0,get:function(){return See.EndOperation}})});var Ree,yee,zBe,Iee,XBe,Nee,Oee=S(()=>{p();u();l();Ree=B(Aee(),1);xe();yee="Amqplib",zBe={consumeEndHook:t=>{Be(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Be(t,"auto.amqplib.otel.publisher")}},Iee=X(yee,()=>new Ree.AmqplibInstrumentation(zBe)),XBe=(()=>({name:yee,setupOnce(){Iee()}})),Nee=XBe});var bm,px=S(()=>{p();u();l();bm="VercelAI"});function JBe(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 ZBe(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(JBe(n)){let r=cC(n.toolCallId);if(r){let o=r.spanContext();ro(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"),_e(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}),uC(n.toolCallId)}else ro(o=>{o.setTag("vercel.ai.tool.name",n.toolName),o.setTag("vercel.ai.tool.callId",n.toolCallId),o.setLevel("error"),_e(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}}function eGe(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 YR,QBe,bee,qR,Cee=S(()=>{p();u();l();YR=B(de(),1);te();px();QBe=[">=3.0.0 <7"],bee=["generateText","streamText","generateObject","streamObject","embed","embedMany"];qR=class t extends YR.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",Ie,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new YR.InstrumentationNodeModuleDefinition("ai",QBe,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(bm),_=f?.options,m=f?!!d?.getOptions().sendDefaultPii:!1,{recordInputs:E,recordOutputs:T}=eGe(_,a,c,m);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:E,recordOutputs:T},Mr(()=>Reflect.apply(o,s,i),A=>{A&&typeof A=="object"&&xt(A,"_sentry_active_span",so())},()=>{},A=>{ZBe(A)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of bee)e[r]=n(e[r]);return e}else{let r=bee.reduce((o,s)=>(o[s]=n(e[s]),o),{});return{...e,...r}}}}});function tGe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var Pee,nGe,Mee,vee=S(()=>{p();u();l();te();xe();px();Cee();Pee=X(bm,()=>new qR({}));nGe=((t={})=>{let e;return{name:bm,options:t,setupOnce(){e=Pee()},afterAllSetup(n){t.force??tGe(n)?nT(n):e?.callWhenPatched(()=>nT(n))}}}),Mee=nGe});var KR,rGe,WR,xee=S(()=>{p();u();l();KR=B(de(),1);te();rGe=[">=4.0.0 <7"],WR=class extends KR.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",Ie,e)}init(){return new KR.InstrumentationNodeModuleDefinition("openai",rGe,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(Jc(ga))return Reflect.construct(r,i);let a=Reflect.construct(r,i),d=!!q()?.getOptions().sendDefaultPii,f=o.recordInputs??d,_=o.recordOutputs??d;return iT(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 Lee,oGe,Dee,wee=S(()=>{p();u();l();te();xe();xee();Lee=X(ga,t=>new WR(t)),oGe=((t={})=>({name:ga,setupOnce(){Lee(t)}})),Dee=oGe});var XR,sGe,zR,Uee=S(()=>{p();u();l();XR=B(de(),1);te();sGe=[">=0.19.2 <1.0.0"],zR=class extends XR.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",Ie,e)}init(){return new XR.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",sGe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Jc(Ta))return Reflect.construct(n,s);let i=Reflect.construct(n,s),c=!!q()?.getOptions().sendDefaultPii,d=r.recordInputs??c,f=r.recordOutputs??c;return mC(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 kee,iGe,Bee,Gee=S(()=>{p();u();l();te();xe();Uee();kee=X(Ta,t=>new zR(t)),iGe=((t={})=>({name:Ta,options:t,setupOnce(){kee(t)}})),Bee=iGe});var cd,jee,QR,Hee=S(()=>{p();u();l();cd=B(de(),1);te();jee=[">=0.10.0 <2"],QR=class extends cd.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",Ie,e)}init(){return new cd.InstrumentationNodeModuleDefinition("@google/genai",jee,n=>this._patch(n),n=>n,[new cd.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",jee,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(Jc(Sa))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 TC(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 c_(e,"GoogleGenAI",o),e}}});var Fee,aGe,$ee,Vee=S(()=>{p();u();l();te();xe();Hee();Fee=X(Sa,t=>new QR(t)),aGe=((t={})=>({name:Sa,setupOnce(){Fee(t)}})),$ee=aGe});function cGe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function uGe(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=cGe(c,e);return a.callbacks=d,Reflect.apply(r,o,s)}})}var Xa,JR,ZR,qee=S(()=>{p();u();l();Xa=B(de(),1);te();JR=[">=0.1.0 <2.0.0"];ZR=class extends Xa.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",Ie,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 Xa.InstrumentationNodeModuleDefinition(r,JR,this._patch.bind(this),o=>o,[new Xa.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,JR,this._patch.bind(this),o=>o)]));return e.push(new Xa.InstrumentationNodeModuleDefinition("langchain",JR,this._patch.bind(this),r=>r,[new Xa.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",JR,this._patch.bind(this),r=>r)])),e}_patch(e){Gb([ga,Ta,Sa]);let r=!!q()?.getOptions().sendDefaultPii,o=this.getConfig(),s=o?.recordInputs??r,i=o?.recordOutputs??r,a=pT({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]=uGe(d,n))}}}});var Yee,lGe,Wee,Kee=S(()=>{p();u();l();te();xe();qee();Yee=X(cT,t=>new ZR(t)),lGe=((t={})=>({name:cT,setupOnce(){Yee(t)}})),Wee=lGe});var ud,zee,ey,Xee=S(()=>{p();u();l();ud=B(de(),1);te();zee=[">=0.0.0 <2.0.0"],ey=class extends ud.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",Ie,e)}init(){return new ud.InstrumentationNodeModuleDefinition("@langchain/langgraph",zee,this._patch.bind(this),n=>n,[new ud.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",zee,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=yC(c.prototype.compile,a)}return e}}});var Qee,pGe,Jee,Zee=S(()=>{p();u();l();te();xe();Xee();Qee=X(dT,t=>new ey(t)),pGe=((t={})=>({name:dT,setupOnce(){Qee(t)}})),Jee=pGe});function nte(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=f=>{(0,gi.safeExecuteInTheMiddle)(()=>a(f),_=>{_&&Hn.error(_?.message)},!0)});let c=new gi.InstrumentationNodeModuleDefinition("@firebase/firestore",e,f=>ete(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 gi.InstrumentationNodeModuleFile(f,e,_=>ete(_,n,r,t,i),_=>rte(_,r)));return c}function ete(t,e,n,r,o){return rte(t,n),e(t,"addDoc",dGe(r,o)),e(t,"getDocs",_Ge(r,o)),e(t,"setDoc",mGe(r,o)),e(t,"deleteDoc",fGe(r,o)),t}function rte(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,gi.isWrapped)(t[n])&&e(t,n);return t}function dGe(t,e){return function(r){return function(o,s){let i=ny(t,"addDoc",o);return e(i),ty(i,()=>r(o,s))}}}function fGe(t,e){return function(r){return function(o){let s=ny(t,"deleteDoc",o.parent||o);return e(s),ty(s,()=>r(o))}}}function _Ge(t,e){return function(r){return function(o){let s=ny(t,"getDocs",o);return e(s),ty(s,()=>r(o))}}}function mGe(t,e){return function(r){return function(o,s,i){let a=ny(t,"setDoc",o.parent||o);return e(a),ty(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function ty(t,e){return V.with(ue.setSpan(V.active(),t),()=>(0,gi.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function ny(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ye.CLIENT});return EGe(r,n),r.setAttribute(il,e),r}function hGe(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(tte.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 EGe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[xN]:e.path,[nf]:n.name,[Hi]:"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}=hGe(s);a&&(i[rf]=a),c&&(i[of]=c),t.setAttributes(i)}var tte,gi,ote=S(()=>{p();u();l();tte=B(require("node:net"),1);w();gi=B(de(),1);ye()});function ste(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,Ti.safeExecuteInTheMiddle)(()=>d(m,E),T=>{T&&Hn.error(T?.message)},!0)}),typeof c=="function"&&(s=m=>{(0,Ti.safeExecuteInTheMiddle)(()=>c(m),E=>{E&&Hn.error(E?.message)},!0)});let f=new Ti.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 Ti.InstrumentationNodeModuleFile(m,e,T=>gGe(T,n,r,t,{requestHook:s,responseHook:i,errorHook:a},E),T=>ite(T,r)))}),f}function rr(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:Ye.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(ue.setSpan(V.active(),_),async()=>{let E,T;try{T=await i.apply(this,d)}catch(A){E=A}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 gGe(t,e,n,r,o,s){switch(ite(t,n),s){case"function":e(t,"onRequest",rr(r,o,"http.request")),e(t,"onCall",rr(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",rr(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",rr(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",rr(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",rr(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",rr(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",rr(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",rr(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",rr(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",rr(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",rr(r,o,"storage.object.finalized")),e(t,"onObjectArchived",rr(r,o,"storage.object.archived")),e(t,"onObjectDeleted",rr(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",rr(r,o,"storage.object.metadataUpdated"));break}return t}function ite(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,Ti.isWrapped)(t[r])&&e(t,r);return t}var Ti,ate=S(()=>{p();u();l();w();Ti=B(de(),1)});var ute,cte,TGe,SGe,ry,lte=S(()=>{p();u();l();ute=B(de(),1);te();ote();ate();cte={},TGe=[">=3.0.0 <5"],SGe=[">=6.0.0 <7"],ry=class extends ute.InstrumentationBase{constructor(e=cte){super("@sentry/instrumentation-firebase",Ie,e)}setConfig(e={}){super.setConfig({...cte,...e})}init(){let e=[];return e.push(nte(this.tracer,TGe,this._wrap,this._unwrap,this.getConfig())),e.push(ste(this.tracer,SGe,this._wrap,this._unwrap,this.getConfig())),e}}});var pte,AGe,dte,RGe,fte,_te=S(()=>{p();u();l();te();xe();lte();pte="Firebase",AGe={firestoreSpanCreationHook:t=>{Be(t,"auto.firebase.otel.firestore"),t.setAttribute(fe,"db.query")},functions:{requestHook:t=>{Be(t,"auto.firebase.otel.functions"),t.setAttribute(fe,"http.request")},errorHook:async(t,e)=>{e&&(_e(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await wg(2e3))}}},dte=X(pte,()=>new ry(AGe)),RGe=(()=>({name:pte,setupOnce(){dte()}})),fte=RGe});function mte(){return[oX(),QX(),IQ(),f7(),p8(),O8(),B8(),X8(),CJ(),zJ(),KZ(),c7(),P7(),F7(),nee(),pee(),HQ(),Nee(),JQ(),Wee(),Jee(),Mee(),Dee(),Bee(),$ee(),eZ(),fte()]}var hte=S(()=>{p();u();l();Oee();Gee();$7();sX();eQ();_te();dee();Vee();OQ();u7();_7();FQ();M7();Kee();Zee();ZQ();d8();b8();G8();Q8();wee();XJ();tZ();zZ();PJ();ree();vee()});function gte(t,e={}){t.getOptions().debug&&_M();let[n,r]=yGe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function yGe(t,e={}){let n=new Ete.BasicTracerProvider({sampler:new xS(t),resource:(0,oy.defaultResource)().merge((0,oy.resourceFromAttributes)({[br]:"node",[vN]:"sentry",[LN]:Ie})),forceFlushTimeoutMillis:500,spanProcessors:[new vS({timeout:IGe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});ue.setGlobalTracerProvider(n),Fn.setGlobalPropagator(new MS);let r=new fM;return V.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function IGe(t){if(t!=null){if(t>dx)return ht&&N.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${dx}`),dx;if(t<=0||Number.isNaN(t)){ht&&N.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}var oy,Ete,dx,Tte=S(()=>{p();u();l();w();oy=B(uP(),1),Ete=B(DP(),1);ye();te();xe();Na();Eu();dx=1e6});function Ste(){return zS().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(k_(),$6())}function Ate(t){return[...Ste(),...Ct(t)?mte():[]]}function fx(t={}){return NGe(t,Ate)}function NGe(t={},e){Zc(t,"node");let n=gM({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(gte(n,{spanProcessors:t.openTelemetrySpanProcessors}),TM()),n}var Rte=S(()=>{p();u();l();te();xe();AM();V6();hte();Tte()});var yte=S(()=>{p();u();l();AM();Rte();te()});var Ite,Nte=S(()=>{"use strict";p();u();l();Ite="https://1188a86f3f8168f089450587b00bca66@o1.ingest.us.sentry.io/4510776311808000"});async function Ote(t){let e=process.env.SENTRY_CLI_NO_TELEMETRY!=="1",n=bGe(e);if(!n?.getOptions().enabled)return t();Fl(),kg();try{return await vr({name:"cli-execution",op:"cli.command"},async()=>t())}catch(r){_e(r);let o=ve().getSession();throw o&&(o.status="crashed"),r}finally{aa();try{await n.flush(3e3)}catch{}}}function bGe(t){let r=fx({dsn:Ite,enabled:t,defaultIntegrations:!1,integrations:[k_()],environment:"production",tracesSampleRate:1,sampleRate:1,release:"0.4.0",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){ia("platform",process.platform),ia("arch",process.arch);let o=typeof process.versions.bun<"u"?"bun":"node";ia("runtime",o),ia("runtime.version",process.version)}return r}function bte(t){let e=so();e&&e.updateName(t),ia("command",t)}var _x=S(()=>{"use strict";p();u();l();yte();Nte()});var Pte={};Ai(Pte,{buildContext:()=>mx});function mx(t){let e={process:t,env:t.env,cwd:t.cwd(),homeDir:(0,Cte.homedir)(),configDir:Ci(),stdout:t.stdout,stderr:t.stderr,stdin:t.stdin};return{...e,forCommand:({prefix:n})=>(bte(n.join(".")),e)}}var Cte,hx=S(()=>{"use strict";p();u();l();Cte=require("node:os");bo();_x()});var Mte,vte=S(()=>{"use strict";p();u();l();it();kU();Mte=De({docs:{brief:"Display help for a command",fullDescription:"Display help information. Run 'sentry help' for an overview, or 'sentry help <command>' for detailed help on a specific command."},parameters:{flags:{},positional:{kind:"array",parameter:{brief:"Command to get help for",parse:String,placeholder:"command"}}},async func(t,...e){let{stdout:n}=this;if(e.length===0){await UU(n);return}let{app:r}=await Promise.resolve().then(()=>(Bh(),xte)),{buildContext:o}=await Promise.resolve().then(()=>(hx(),Pte));await Hm(r,[...e,"--helpAll"],o(this.process))}})});async function Lte(t,e){let n=Ze(),r=Date.now();n.exec("BEGIN TRANSACTION");try{n.query("DELETE FROM project_aliases").run();let o=n.query(`
339
+ Mongoose Error Code: ${e.code}`:""}`})}function YM(t,e,n,r=void 0){n&&(0,Z_.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&f8.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function Kwe(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(YM(e,o,n,r),o)).catch(o=>{throw _8(e,o),o}).finally(()=>e.end()):(YM(e,t,n,r),e.end(),t)}xa.handlePromiseResponse=Kwe;function zwe(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?_8(r,c):YM(r,d,s,i),r.end(),t(c,d)),e.apply(n,o)}xa.handleCallbackResponse=zwe});var h8=R(Lp=>{"use strict";p();u();l();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.PACKAGE_NAME=Lp.PACKAGE_VERSION=void 0;Lp.PACKAGE_VERSION="0.56.0";Lp.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var A8=R(Tr=>{"use strict";p();u();l();Object.defineProperty(Tr,"__esModule",{value:!0});Tr.MongooseInstrumentation=Tr._ALREADY_INSTRUMENTED=Tr._STORED_PARENT_SPAN=void 0;var Kt=(w(),x(j)),Xwe=ke(),WM=m8(),dn=de(),E8=h8(),La=qM(),Su=(ye(),x(Ge)),CA=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],Qwe=["remove","count","findOneAndRemove",...CA],Jwe=["count","findOneAndRemove",...CA],Zwe=[...CA];function g8(t){return t?t.startsWith("6.")||t.startsWith("5.")?Qwe:t.startsWith("7.")?Jwe:Zwe:CA}function T8(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function S8(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}Tr._STORED_PARENT_SPAN=Symbol("stored-parent-span");Tr._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var KM=class extends dn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(E8.PACKAGE_NAME,E8.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,dn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,dn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new dn.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,T8(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),S8(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)),g8(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=g8(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,T8(n)&&this._unwrap(r.Model.prototype,"remove"),S8(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&&Kt.trace.getSpan(Kt.context.active())===void 0)return r.apply(this,arguments);let i=this[Tr._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let f=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&dn.SemconvStability.OLD&&(a[La.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&dn.SemconvStability.STABLE&&(a[Su.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[Tr._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Kt.trace.getSpan(Kt.context.active())===void 0)return r.apply(this,arguments);let i=this[Tr._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&dn.SemconvStability.OLD&&(a[La.ATTR_DB_STATEMENT]=f),n._dbSemconvStability&dn.SemconvStability.STABLE&&(a[Su.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&&Kt.trace.getSpan(Kt.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&dn.SemconvStability.OLD&&(d[La.ATTR_DB_STATEMENT]=m),r._dbSemconvStability&dn.SemconvStability.STABLE&&(d[Su.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&&Kt.trace.getSpan(Kt.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 y=E(e,{condition:{_id:this._id},updates:f,options:_});r._dbSemconvStability&dn.SemconvStability.OLD&&(m[La.ATTR_DB_STATEMENT]=y),r._dbSemconvStability&dn.SemconvStability.STABLE&&(m[Su.ATTR_DB_QUERY_TEXT]=y)}let T=r._startSpan(this.constructor.collection,this.constructor.modelName,e,m),A=r._handleResponse(T,o,this,arguments,d,n);return A&&typeof A=="object"&&(A[Tr._ALREADY_INSTRUMENTED]=!0),A}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Kt.trace.getSpan(Kt.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&dn.SemconvStability.OLD&&(f[La.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&dn.SemconvStability.STABLE&&(f[Su.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=Kt.trace.getSpan(Kt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[Tr._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[Tr._STORED_PARENT_SPAN]=Kt.trace.getSpan(Kt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,WM.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&dn.SemconvStability.OLD&&(i[La.ATTR_DB_OPERATION]=r,i[La.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&dn.SemconvStability.STABLE&&(i[Su.ATTR_DB_OPERATION_NAME]=r,i[Su.ATTR_DB_SYSTEM_NAME]=La.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&dn.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Kt.SpanKind.CLIENT,attributes:i},s?Kt.trace.setSpan(Kt.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,WM.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,WM.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Kt.context.with((0,Xwe.suppressTracing)(Kt.context.active()),e):e()}};Tr.MongooseInstrumentation=KM});var R8=R(PA=>{"use strict";p();u();l();Object.defineProperty(PA,"__esModule",{value:!0});PA.MongooseInstrumentation=void 0;var eUe=A8();Object.defineProperty(PA,"MongooseInstrumentation",{enumerable:!0,get:function(){return eUe.MongooseInstrumentation}})});var y8,I8,N8,tUe,O8,b8=S(()=>{p();u();l();y8=B(R8(),1);xe();I8="Mongoose",N8=X(I8,()=>new y8.MongooseInstrumentation({responseHook(t){Be(t,"auto.db.otel.mongoose")}})),tUe=(()=>({name:I8,setupOnce(){N8()}})),O8=tUe});var C8=R(Bt=>{"use strict";p();u();l();Object.defineProperty(Bt,"__esModule",{value:!0});Bt.METRIC_DB_CLIENT_CONNECTIONS_USAGE=Bt.DB_SYSTEM_VALUE_MYSQL=Bt.ATTR_NET_PEER_PORT=Bt.ATTR_NET_PEER_NAME=Bt.ATTR_DB_USER=Bt.ATTR_DB_SYSTEM=Bt.ATTR_DB_STATEMENT=Bt.ATTR_DB_NAME=Bt.ATTR_DB_CONNECTION_STRING=void 0;Bt.ATTR_DB_CONNECTION_STRING="db.connection_string";Bt.ATTR_DB_NAME="db.name";Bt.ATTR_DB_STATEMENT="db.statement";Bt.ATTR_DB_SYSTEM="db.system";Bt.ATTR_DB_USER="db.user";Bt.ATTR_NET_PEER_NAME="net.peer.name";Bt.ATTR_NET_PEER_PORT="net.peer.port";Bt.DB_SYSTEM_VALUE_MYSQL="mysql";Bt.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var P8=R(em=>{"use strict";p();u();l();Object.defineProperty(em,"__esModule",{value:!0});em.AttributeNames=void 0;var nUe;(function(t){t.MYSQL_VALUES="db.mysql.values"})(nUe=em.AttributeNames||(em.AttributeNames={}))});var M8=R(xn=>{"use strict";p();u();l();Object.defineProperty(xn,"__esModule",{value:!0});xn.getPoolNameOld=xn.arrayStringifyHelper=xn.getSpanName=xn.getDbValues=xn.getDbQueryText=xn.getJDBCString=xn.getConfig=void 0;function rUe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}xn.getConfig=rUe;function oUe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}xn.getJDBCString=oUe;function sUe(t){return typeof t=="string"?t:t.sql}xn.getDbQueryText=sUe;function iUe(t,e){return zM(typeof t=="string"?e:e||t.values)}xn.getDbValues=iUe;function aUe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}xn.getSpanName=aUe;function zM(t){return t?`[${t.toString()}]`:""}xn.arrayStringifyHelper=zM;function cUe(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()}xn.getPoolNameOld=cUe});var v8=R(Dp=>{"use strict";p();u();l();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.PACKAGE_NAME=Dp.PACKAGE_VERSION=void 0;Dp.PACKAGE_VERSION="0.56.0";Dp.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var L8=R(MA=>{"use strict";p();u();l();Object.defineProperty(MA,"__esModule",{value:!0});MA.MySQLInstrumentation=void 0;var Sr=(w(),x(j)),Eo=de(),wp=(ye(),x(Ge)),mi=C8(),uUe=P8(),Au=M8(),x8=v8(),XM=class extends Eo.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(x8.PACKAGE_NAME,x8.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Eo.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Eo.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(mi.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 Eo.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,Eo.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,Eo.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,Eo.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,Au.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=Sr.context.active();return function(o,s){s&&((0,Eo.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&Sr.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,Au.getConfig)(e.config),m=parseInt(d,10),E=(0,Au.getDbQueryText)(o);r._dbSemconvStability&Eo.SemconvStability.OLD&&(a[mi.ATTR_DB_SYSTEM]=mi.DB_SYSTEM_VALUE_MYSQL,a[mi.ATTR_DB_CONNECTION_STRING]=(0,Au.getJDBCString)(c,d,f),a[mi.ATTR_DB_NAME]=f,a[mi.ATTR_DB_USER]=_,a[mi.ATTR_DB_STATEMENT]=E),r._dbSemconvStability&Eo.SemconvStability.STABLE&&(a[wp.ATTR_DB_SYSTEM_NAME]=wp.DB_SYSTEM_NAME_VALUE_MYSQL,a[wp.ATTR_DB_NAMESPACE]=f,a[wp.ATTR_DB_QUERY_TEXT]=E),r._netSemconvStability&Eo.SemconvStability.OLD&&(a[mi.ATTR_NET_PEER_NAME]=c,isNaN(m)||(a[mi.ATTR_NET_PEER_PORT]=m)),r._netSemconvStability&Eo.SemconvStability.STABLE&&(a[wp.ATTR_SERVER_ADDRESS]=c,isNaN(m)||(a[wp.ATTR_SERVER_PORT]=m));let T=r.tracer.startSpan((0,Au.getSpanName)(o),{kind:Sr.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let O;Array.isArray(s)?O=s:arguments[2]&&(O=[s]),T.setAttribute(uUe.AttributeNames.MYSQL_VALUES,(0,Au.getDbValues)(o,O))}let A=Array.from(arguments).findIndex(O=>typeof O=="function"),y=Sr.context.active();if(A===-1){let O=Sr.context.with(Sr.trace.setSpan(Sr.context.active(),T),()=>n.apply(e,arguments));return Sr.context.bind(y,O),O.on("error",I=>T.setStatus({code:Sr.SpanStatusCode.ERROR,message:I.message})).on("end",()=>{T.end()})}else return r._wrap(arguments,A,r._patchCallbackQuery(T,y)),Sr.context.with(Sr.trace.setSpan(Sr.context.active(),T),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:Sr.SpanStatusCode.ERROR,message:o.message}),e.end(),Sr.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Au.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")})}};MA.MySQLInstrumentation=XM});var D8=R(vA=>{"use strict";p();u();l();Object.defineProperty(vA,"__esModule",{value:!0});vA.MySQLInstrumentation=void 0;var lUe=L8();Object.defineProperty(vA,"MySQLInstrumentation",{enumerable:!0,get:function(){return lUe.MySQLInstrumentation}})});var w8,U8,k8,pUe,B8,G8=S(()=>{p();u();l();w8=B(D8(),1);xe();U8="Mysql",k8=X(U8,()=>new w8.MySQLInstrumentation({})),pUe=(()=>({name:U8,setupOnce(){k8()}})),B8=pUe});var QM=R(tn=>{"use strict";p();u();l();Object.defineProperty(tn,"__esModule",{value:!0});tn.DB_SYSTEM_VALUE_MYSQL=tn.ATTR_NET_PEER_PORT=tn.ATTR_NET_PEER_NAME=tn.ATTR_DB_USER=tn.ATTR_DB_SYSTEM=tn.ATTR_DB_STATEMENT=tn.ATTR_DB_NAME=tn.ATTR_DB_CONNECTION_STRING=void 0;tn.ATTR_DB_CONNECTION_STRING="db.connection_string";tn.ATTR_DB_NAME="db.name";tn.ATTR_DB_STATEMENT="db.statement";tn.ATTR_DB_SYSTEM="db.system";tn.ATTR_DB_USER="db.user";tn.ATTR_NET_PEER_NAME="net.peer.name";tn.ATTR_NET_PEER_PORT="net.peer.port";tn.DB_SYSTEM_VALUE_MYSQL="mysql"});var ZM=R(xA=>{"use strict";p();u();l();Object.defineProperty(xA,"__esModule",{value:!0});xA.addSqlCommenterComment=void 0;var JM=(w(),x(j)),dUe=ke();function fUe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function _Ue(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function mUe(t,e){if(typeof e!="string"||e.length===0||fUe(e))return e;let n=new dUe.W3CTraceContextPropagator,r={};n.inject(JM.trace.setSpan(JM.ROOT_CONTEXT,t),r,JM.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=_Ue(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}xA.addSqlCommenterComment=mUe});var j8=R(go=>{"use strict";p();u();l();Object.defineProperty(go,"__esModule",{value:!0});go.getConnectionPrototypeToInstrument=go.once=go.getSpanName=go.getQueryText=go.getConnectionAttributes=void 0;var tm=QM(),LA=de(),ev=(ye(),x(Ge));function hUe(t,e,n){let{host:r,port:o,database:s,user:i}=EUe(t),a={};e&LA.SemconvStability.OLD&&(a[tm.ATTR_DB_CONNECTION_STRING]=gUe(r,o,s),a[tm.ATTR_DB_NAME]=s,a[tm.ATTR_DB_USER]=i),e&LA.SemconvStability.STABLE&&(a[ev.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&LA.SemconvStability.OLD&&(a[tm.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[tm.ATTR_NET_PEER_PORT]=c)),n&LA.SemconvStability.STABLE&&(a[ev.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[ev.ATTR_SERVER_PORT]=c)),a}go.getConnectionAttributes=hUe;function EUe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function gUe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function TUe(t,e,n,r=!1,o=SUe){let[s,i]=typeof t=="string"?[t,n]:[t.sql,AUe(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"}}go.getQueryText=TUe;function SUe(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function AUe(t){return"values"in t}function RUe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}go.getSpanName=RUe;var yUe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};go.once=yUe;function IUe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}go.getConnectionPrototypeToInstrument=IUe});var H8=R(Up=>{"use strict";p();u();l();Object.defineProperty(Up,"__esModule",{value:!0});Up.PACKAGE_NAME=Up.PACKAGE_VERSION=void 0;Up.PACKAGE_VERSION="0.56.0";Up.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var q8=R(DA=>{"use strict";p();u();l();Object.defineProperty(DA,"__esModule",{value:!0});DA.MySQL2Instrumentation=void 0;var F8=(w(),x(j)),Wo=de(),tv=QM(),$8=ZM(),kp=j8(),V8=H8(),nv=(ye(),x(Ge)),rv=[">=1.4.2 <4"],ov=class extends Wo.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(V8.PACKAGE_NAME,V8.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Wo.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Wo.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,Wo.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,Wo.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 Wo.InstrumentationNodeModuleDefinition("mysql2",rv,s=>(n(s),s),()=>{},[new Wo.InstrumentationNodeModuleFile("mysql2/promise.js",rv,s=>(n(s),s),()=>{}),new Wo.InstrumentationNodeModuleFile("mysql2/lib/connection.js",rv,s=>{let i=(0,kp.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,kp.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,kp.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),E=(0,kp.getQueryText)(s,e,c,d,f);o._dbSemconvStability&Wo.SemconvStability.OLD&&(m[tv.ATTR_DB_SYSTEM]=tv.DB_SYSTEM_VALUE_MYSQL,m[tv.ATTR_DB_STATEMENT]=E),o._dbSemconvStability&Wo.SemconvStability.STABLE&&(m[nv.ATTR_DB_SYSTEM_NAME]=nv.DB_SYSTEM_NAME_VALUE_MYSQL,m[nv.ATTR_DB_QUERY_TEXT]=E);let T=o.tracer.startSpan((0,kp.getSpanName)(s),{kind:F8.SpanKind.CLIENT,attributes:m});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,$8.addSqlCommenterComment)(T,s):Object.assign(s,{sql:(0,$8.addSqlCommenterComment)(T,s.sql)}));let A=(0,kp.once)((y,O)=>{y?T.setStatus({code:F8.SpanStatusCode.ERROR,message:y.message}):typeof _=="function"&&(0,Wo.safeExecuteInTheMiddle)(()=>{_(T,{queryResults:O})},I=>{I&&o._diag.warn("Failed executing responseHook",I)},!0),T.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(A));let y=r.apply(this,arguments);return y.once("error",O=>{A(O)}).once("result",O=>{A(void 0,O)}),y}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(A)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(A)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};DA.MySQL2Instrumentation=ov});var Y8=R(wA=>{"use strict";p();u();l();Object.defineProperty(wA,"__esModule",{value:!0});wA.MySQL2Instrumentation=void 0;var NUe=q8();Object.defineProperty(wA,"MySQL2Instrumentation",{enumerable:!0,get:function(){return NUe.MySQL2Instrumentation}})});var W8,K8,z8,OUe,X8,Q8=S(()=>{p();u();l();W8=B(Y8(),1);xe();K8="Mysql2",z8=X(K8,()=>new W8.MySQL2Instrumentation({responseHook(t){Be(t,"auto.db.otel.mysql2")}})),OUe=(()=>({name:K8,setupOnce(){z8()}})),X8=OUe});var J8=R(Ln=>{"use strict";p();u();l();Object.defineProperty(Ln,"__esModule",{value:!0});Ln.DB_SYSTEM_VALUE_REDIS=Ln.DB_SYSTEM_NAME_VALUE_REDIS=Ln.ATTR_NET_PEER_PORT=Ln.ATTR_NET_PEER_NAME=Ln.ATTR_DB_SYSTEM=Ln.ATTR_DB_STATEMENT=Ln.ATTR_DB_CONNECTION_STRING=void 0;Ln.ATTR_DB_CONNECTION_STRING="db.connection_string";Ln.ATTR_DB_STATEMENT="db.statement";Ln.ATTR_DB_SYSTEM="db.system";Ln.ATTR_NET_PEER_NAME="net.peer.name";Ln.ATTR_NET_PEER_PORT="net.peer.port";Ln.DB_SYSTEM_NAME_VALUE_REDIS="redis";Ln.DB_SYSTEM_VALUE_REDIS="redis"});var Z8=R(UA=>{"use strict";p();u();l();Object.defineProperty(UA,"__esModule",{value:!0});UA.endSpan=void 0;var bUe=(w(),x(j)),CUe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:bUe.SpanStatusCode.ERROR,message:e.message})),t.end()};UA.endSpan=CUe});var BA=R(kA=>{"use strict";p();u();l();Object.defineProperty(kA,"__esModule",{value:!0});kA.defaultDbStatementSerializer=void 0;var PUe=[{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}],MUe=(t,e)=>{if(Array.isArray(e)&&e.length){let n=PUe.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};kA.defaultDbStatementSerializer=MUe});var eJ=R(Bp=>{"use strict";p();u();l();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.PACKAGE_NAME=Bp.PACKAGE_VERSION=void 0;Bp.PACKAGE_VERSION="0.58.0";Bp.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var oJ=R(GA=>{"use strict";p();u();l();Object.defineProperty(GA,"__esModule",{value:!0});GA.IORedisInstrumentation=void 0;var Da=(w(),x(j)),Ar=de(),wa=(ye(),x(Ge)),Rr=J8(),tJ=de(),nm=Z8(),vUe=BA(),nJ=eJ(),rJ={requireParentSpan:!0},sv=class extends Ar.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(nJ.PACKAGE_NAME,nJ.PACKAGE_VERSION,{...rJ,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ar.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ar.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...rJ,...e})}init(){return[new Ar.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Ar.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Ar.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||vUe.defaultDbStatementSerializer,a=Da.trace.getSpan(Da.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&Ar.SemconvStability.OLD&&(c[Rr.ATTR_DB_SYSTEM]=Rr.DB_SYSTEM_VALUE_REDIS,c[Rr.ATTR_DB_STATEMENT]=_,c[Rr.ATTR_DB_CONNECTION_STRING]=`redis://${d}:${f}`),r._dbSemconvStability&Ar.SemconvStability.STABLE&&(c[wa.ATTR_DB_SYSTEM_NAME]=Rr.DB_SYSTEM_NAME_VALUE_REDIS,c[wa.ATTR_DB_QUERY_TEXT]=_),r._netSemconvStability&Ar.SemconvStability.OLD&&(c[Rr.ATTR_NET_PEER_NAME]=d,c[Rr.ATTR_NET_PEER_PORT]=f),r._netSemconvStability&Ar.SemconvStability.STABLE&&(c[wa.ATTR_SERVER_ADDRESS]=d,c[wa.ATTR_SERVER_PORT]=f);let m=r.tracer.startSpan(o.name,{kind:Da.SpanKind.CLIENT,attributes:c}),{requestHook:E}=s;E&&(0,tJ.safeExecuteInTheMiddle)(()=>E(m,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),T=>{T&&Da.diag.error("ioredis instrumentation: request hook failed",T)},!0);try{let T=e.apply(this,arguments),A=o.resolve;o.resolve=function(O){(0,tJ.safeExecuteInTheMiddle)(()=>s.responseHook?.(m,o.name,o.args,O),I=>{I&&Da.diag.error("ioredis instrumentation: response hook failed",I)},!0),(0,nm.endSpan)(m,null),A(O)};let y=o.reject;return o.reject=function(O){(0,nm.endSpan)(m,O),y(O)},T}catch(T){throw(0,nm.endSpan)(m,T),T}}}_traceConnection(e){let n=this;return function(){let r=Da.trace.getSpan(Da.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&Ar.SemconvStability.OLD&&(o[Rr.ATTR_DB_SYSTEM]=Rr.DB_SYSTEM_VALUE_REDIS,o[Rr.ATTR_DB_STATEMENT]="connect",o[Rr.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Ar.SemconvStability.STABLE&&(o[wa.ATTR_DB_SYSTEM_NAME]=Rr.DB_SYSTEM_NAME_VALUE_REDIS,o[wa.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Ar.SemconvStability.OLD&&(o[Rr.ATTR_NET_PEER_NAME]=s,o[Rr.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Ar.SemconvStability.STABLE&&(o[wa.ATTR_SERVER_ADDRESS]=s,o[wa.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:Da.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,nm.endSpan)(a,null),c}catch(c){throw(0,nm.endSpan)(a,c),c}}}};GA.IORedisInstrumentation=sv});var sJ=R(jA=>{"use strict";p();u();l();Object.defineProperty(jA,"__esModule",{value:!0});jA.IORedisInstrumentation=void 0;var xUe=oJ();Object.defineProperty(jA,"IORedisInstrumentation",{enumerable:!0,get:function(){return xUe.IORedisInstrumentation}})});var HA=R(Gp=>{"use strict";p();u();l();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.PACKAGE_NAME=Gp.PACKAGE_VERSION=void 0;Gp.PACKAGE_VERSION="0.58.0";Gp.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var iJ=R(Ua=>{"use strict";p();u();l();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.getTracedCreateStreamTrace=Ua.getTracedCreateClient=Ua.endSpan=void 0;var rm=(w(),x(j)),LUe=(t,e)=>{e&&t.setStatus({code:rm.SpanStatusCode.ERROR,message:e.message}),t.end()};Ua.endSpan=LUe;var DUe=t=>function(){let n=t.apply(this,arguments);return rm.context.bind(rm.context.active(),n)};Ua.getTracedCreateClient=DUe;var wUe=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){rm.context.bind(rm.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Ua.getTracedCreateStreamTrace=wUe});var FA=R(Dn=>{"use strict";p();u();l();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.DB_SYSTEM_VALUE_REDIS=Dn.DB_SYSTEM_NAME_VALUE_REDIS=Dn.ATTR_NET_PEER_PORT=Dn.ATTR_NET_PEER_NAME=Dn.ATTR_DB_SYSTEM=Dn.ATTR_DB_STATEMENT=Dn.ATTR_DB_CONNECTION_STRING=void 0;Dn.ATTR_DB_CONNECTION_STRING="db.connection_string";Dn.ATTR_DB_STATEMENT="db.statement";Dn.ATTR_DB_SYSTEM="db.system";Dn.ATTR_NET_PEER_NAME="net.peer.name";Dn.ATTR_NET_PEER_PORT="net.peer.port";Dn.DB_SYSTEM_NAME_VALUE_REDIS="redis";Dn.DB_SYSTEM_VALUE_REDIS="redis"});var cJ=R(VA=>{"use strict";p();u();l();Object.defineProperty(VA,"__esModule",{value:!0});VA.RedisInstrumentationV2_V3=void 0;var Ur=de(),$A=iJ(),aJ=HA(),om=(w(),x(j)),sm=(ye(),x(Ge)),Ru=FA(),UUe=BA(),iv=class t extends Ur.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(aJ.PACKAGE_NAME,aJ.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Ur.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,Ur.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,Ur.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,Ur.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=om.trace.getSpan(om.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||UUe.defaultDbStatementSerializer,d={};e._semconvStability&Ur.SemconvStability.OLD&&Object.assign(d,{[Ru.ATTR_DB_SYSTEM]:Ru.DB_SYSTEM_VALUE_REDIS,[Ru.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&Ur.SemconvStability.STABLE&&Object.assign(d,{[sm.ATTR_DB_SYSTEM_NAME]:Ru.DB_SYSTEM_NAME_VALUE_REDIS,[sm.ATTR_DB_OPERATION_NAME]:s.command,[sm.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let f=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:om.SpanKind.CLIENT,attributes:d});if(this.connection_options){let m={};e._semconvStability&Ur.SemconvStability.OLD&&Object.assign(m,{[Ru.ATTR_NET_PEER_NAME]:this.connection_options.host,[Ru.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&Ur.SemconvStability.STABLE&&Object.assign(m,{[sm.ATTR_SERVER_ADDRESS]:this.connection_options.host,[sm.ATTR_SERVER_PORT]:this.connection_options.port}),f.setAttributes(m)}this.address&&e._semconvStability&Ur.SemconvStability.OLD&&f.setAttribute(Ru.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let _=arguments[0].callback;if(_){let m=om.context.active();arguments[0].callback=function(T,A){if(i?.responseHook){let y=i.responseHook;(0,Ur.safeExecuteInTheMiddle)(()=>{y(f,s.command,s.args,A)},O=>{O&&e._diag.error("Error executing responseHook",O)},!0)}return(0,$A.endSpan)(f,T),om.context.with(m,_,this,...arguments)}}try{return r.apply(this,arguments)}catch(m){throw(0,$A.endSpan)(f,m),m}}}}_getPatchCreateClient(){return function(n){return(0,$A.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,$A.getTracedCreateStreamTrace)(n)}}};VA.RedisInstrumentationV2_V3=iv});var lJ=R(qA=>{"use strict";p();u();l();Object.defineProperty(qA,"__esModule",{value:!0});qA.getClientAttributes=void 0;var av=(ye(),x(Ge)),jp=FA(),uJ=de();function kUe(t,e,n){let r={};return n&uJ.SemconvStability.OLD&&Object.assign(r,{[jp.ATTR_DB_SYSTEM]:jp.DB_SYSTEM_VALUE_REDIS,[jp.ATTR_NET_PEER_NAME]:e?.socket?.host,[jp.ATTR_NET_PEER_PORT]:e?.socket?.port,[jp.ATTR_DB_CONNECTION_STRING]:BUe(t,e?.url)}),n&uJ.SemconvStability.STABLE&&Object.assign(r,{[av.ATTR_DB_SYSTEM_NAME]:jp.DB_SYSTEM_NAME_VALUE_REDIS,[av.ATTR_SERVER_ADDRESS]:e?.socket?.host,[av.ATTR_SERVER_PORT]:e?.socket?.port}),r}qA.getClientAttributes=kUe;function BUe(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 _J=R(YA=>{"use strict";p();u();l();Object.defineProperty(YA,"__esModule",{value:!0});YA.RedisInstrumentationV4_V5=void 0;var To=(w(),x(j)),Je=de(),pJ=lJ(),GUe=BA(),dJ=HA(),cv=(ye(),x(Ge)),jUe=FA(),im=Symbol("opentelemetry.instrumentation.redis.open_spans"),fJ=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),uv=class t extends Je.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(dJ.PACKAGE_NAME,dJ.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Je.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Je.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 Je.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,Je.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,Je.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,Je.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new Je.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,Je.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,Je.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,Je.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,Je.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,Je.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new Je.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,Je.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,Je.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,Je.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,Je.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,Je.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,Je.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new Je.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[im];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[im];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[fJ]=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,pJ.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:To.SpanKind.CLIENT,attributes:i});return To.context.with(To.trace.setSpan(To.context.active(),a),()=>r.apply(this)).then(d=>(a.end(),d)).catch(d=>(a.recordException(d),a.setStatus({code:To.SpanStatusCode.ERROR,message:d.message}),a.end(),Promise.reject(d)))}}}_traceClientCommand(e,n,r,o){if(To.trace.getSpan(To.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[fJ],a=o[0],c=o.slice(1),d=this.getConfig().dbStatementSerializer||GUe.defaultDbStatementSerializer,f=(0,pJ.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&Je.SemconvStability.STABLE&&(f[cv.ATTR_DB_OPERATION_NAME]=a);try{let E=d(a,c);E!=null&&(this._semconvStability&Je.SemconvStability.OLD&&(f[jUe.ATTR_DB_STATEMENT]=E),this._semconvStability&Je.SemconvStability.STABLE&&(f[cv.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:To.SpanKind.CLIENT,attributes:f}),m=To.context.with(To.trace.setSpan(To.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[im]=E[im]||[],E[im].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&Je.SemconvStability.STABLE&&c.setAttribute(cv.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:To.SpanStatusCode.ERROR,message:s?.message})),e.end()}};YA.RedisInstrumentationV4_V5=uv});var EJ=R(WA=>{"use strict";p();u();l();Object.defineProperty(WA,"__esModule",{value:!0});WA.RedisInstrumentation=void 0;var HUe=de(),mJ=HA(),FUe=cJ(),$Ue=_J(),hJ={requireParentSpan:!1},lv=class extends HUe.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...hJ,...e};super(mJ.PACKAGE_NAME,mJ.PACKAGE_VERSION,n),this.instrumentationV2_V3=new FUe.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new $Ue.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...hJ,...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())}};WA.RedisInstrumentation=lv});var gJ=R(KA=>{"use strict";p();u();l();Object.defineProperty(KA,"__esModule",{value:!0});KA.RedisInstrumentation=void 0;var VUe=EJ();Object.defineProperty(KA,"RedisInstrumentation",{enumerable:!0,get:function(){return VUe.RedisInstrumentation}})});function am(t,e){return t.includes(e.toLowerCase())}function dv(t){return am(pv,t)?"cache.get":am(YUe,t)?"cache.put":void 0}function WUe(t,e){return e.some(n=>t.startsWith(n))}function SJ(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)?TJ(o.map(s=>n(s))):["<unknown>"],r=e[0];return am(qUe,t)&&r!=null?n(r):TJ(e.map(o=>n(o)))}catch{return}}function AJ(t,e,n){if(!dv(t))return!1;for(let r of e)if(WUe(r,n))return!0;return!1}function RJ(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 TJ(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var qUe,pv,YUe,yJ=S(()=>{p();u();l();qUe=["get","set","setex"],pv=["get","mget"],YUe=["set","setex"]});var IJ,NJ,zA,cm,OJ,KUe,zUe,bJ,XUe,CJ,PJ=S(()=>{p();u();l();IJ=B(sJ(),1),NJ=B(gJ(),1);te();xe();yJ();zA="Redis",cm={},OJ=(t,e,n,r)=>{t.setAttribute(pe,"auto.db.otel.redis");let o=SJ(e,n),s=dv(e);if(!o||!s||!cm.cachePrefixes||!AJ(e,o,cm.cachePrefixes))return;let i=se(t).data["net.peer.name"],a=se(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=RJ(r);c&&t.setAttribute(sb,c),am(pv,e)&&c!==void 0&&t.setAttribute(rb,c>0),t.setAttributes({[fe]:s,[ob]:o});let d=o.join(", ");t.updateName(cm.maxCacheKeyLength?zi(d,cm.maxCacheKeyLength):d)},KUe=X(`${zA}.IORedis`,()=>new IJ.IORedisInstrumentation({responseHook:OJ})),zUe=X(`${zA}.Redis`,()=>new NJ.RedisInstrumentation({responseHook:OJ})),bJ=Object.assign(()=>{KUe(),zUe()},{id:zA}),XUe=((t={})=>({name:zA,setupOnce(){cm=t,bJ()}})),CJ=XUe});var MJ=R(XA=>{"use strict";p();u();l();Object.defineProperty(XA,"__esModule",{value:!0});XA.EVENT_LISTENERS_SET=void 0;XA.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var fv=R(um=>{"use strict";p();u();l();Object.defineProperty(um,"__esModule",{value:!0});um.AttributeNames=void 0;var QUe;(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"})(QUe=um.AttributeNames||(um.AttributeNames={}))});var _v=R(we=>{"use strict";p();u();l();Object.defineProperty(we,"__esModule",{value:!0});we.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=we.METRIC_DB_CLIENT_CONNECTION_COUNT=we.DB_SYSTEM_VALUE_POSTGRESQL=we.DB_CLIENT_CONNECTION_STATE_VALUE_USED=we.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=we.ATTR_NET_PEER_PORT=we.ATTR_NET_PEER_NAME=we.ATTR_DB_USER=we.ATTR_DB_SYSTEM=we.ATTR_DB_STATEMENT=we.ATTR_DB_NAME=we.ATTR_DB_CONNECTION_STRING=we.ATTR_DB_CLIENT_CONNECTION_STATE=we.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;we.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";we.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";we.ATTR_DB_CONNECTION_STRING="db.connection_string";we.ATTR_DB_NAME="db.name";we.ATTR_DB_STATEMENT="db.statement";we.ATTR_DB_SYSTEM="db.system";we.ATTR_DB_USER="db.user";we.ATTR_NET_PEER_NAME="net.peer.name";we.ATTR_NET_PEER_PORT="net.peer.port";we.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";we.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";we.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";we.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";we.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var mv=R(lm=>{"use strict";p();u();l();Object.defineProperty(lm,"__esModule",{value:!0});lm.SpanNames=void 0;var JUe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(JUe=lm.SpanNames||(lm.SpanNames={}))});var kJ=R(Pe=>{"use strict";p();u();l();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.sanitizedErrorMessage=Pe.isObjectWithTextString=Pe.getErrorMessage=Pe.patchClientConnectCallback=Pe.patchCallbackPGPool=Pe.updateCounter=Pe.getPoolName=Pe.patchCallback=Pe.handleExecutionResult=Pe.handleConfigQuery=Pe.shouldSkipInstrumentation=Pe.getSemanticAttributesFromPoolConnection=Pe.getSemanticAttributesFromConnection=Pe.getConnectionString=Pe.parseAndMaskConnectionString=Pe.parseNormalizedOperationName=Pe.getQuerySpanName=void 0;var ka=(w(),x(j)),QA=fv(),So=(ye(),x(Ge)),Et=_v(),yu=de(),vJ=mv();function xJ(t,e){if(!e)return vJ.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:LJ(e.text);return`${vJ.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}Pe.getQuerySpanName=xJ;function LJ(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}Pe.parseNormalizedOperationName=LJ;function DJ(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}Pe.parseAndMaskConnectionString=DJ;function hv(t){if("connectionString"in t&&t.connectionString)return DJ(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}Pe.getConnectionString=hv;function JA(t){if(Number.isInteger(t))return t}function wJ(t,e){let n={};return e&yu.SemconvStability.OLD&&(n={...n,[Et.ATTR_DB_SYSTEM]:Et.DB_SYSTEM_VALUE_POSTGRESQL,[Et.ATTR_DB_NAME]:t.database,[Et.ATTR_DB_CONNECTION_STRING]:hv(t),[Et.ATTR_DB_USER]:t.user,[Et.ATTR_NET_PEER_NAME]:t.host,[Et.ATTR_NET_PEER_PORT]:JA(t.port)}),e&yu.SemconvStability.STABLE&&(n={...n,[So.ATTR_DB_SYSTEM_NAME]:So.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[So.ATTR_DB_NAMESPACE]:t.namespace,[So.ATTR_SERVER_ADDRESS]:t.host,[So.ATTR_SERVER_PORT]:JA(t.port)}),n}Pe.getSemanticAttributesFromConnection=wJ;function ZUe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[QA.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[QA.AttributeNames.MAX_CLIENT]:t.maxClient};return e&yu.SemconvStability.OLD&&(r={...r,[Et.ATTR_DB_SYSTEM]:Et.DB_SYSTEM_VALUE_POSTGRESQL,[Et.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Et.ATTR_DB_CONNECTION_STRING]:hv(t),[Et.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Et.ATTR_NET_PEER_PORT]:Number(n?.port)||JA(t.port),[Et.ATTR_DB_USER]:n?.username??t.user}),e&yu.SemconvStability.STABLE&&(r={...r,[So.ATTR_DB_SYSTEM_NAME]:So.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[So.ATTR_DB_NAMESPACE]:t.namespace,[So.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[So.ATTR_SERVER_PORT]:Number(n?.port)||JA(t.port)}),r}Pe.getSemanticAttributesFromPoolConnection=ZUe;function eke(t){return t.requireParentSpan===!0&&ka.trace.getSpan(ka.context.active())===void 0}Pe.shouldSkipInstrumentation=eke;function tke(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=xJ(s,r),a=t.startSpan(i,{kind:ka.SpanKind.CLIENT,attributes:wJ(o,n)});if(!r)return a;if(r.text&&(n&yu.SemconvStability.OLD&&a.setAttribute(Et.ATTR_DB_STATEMENT,r.text),n&yu.SemconvStability.STABLE&&a.setAttribute(So.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(QA.AttributeNames.PG_VALUES,c)}catch(c){ka.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(QA.AttributeNames.PG_PLAN,r.name),a}Pe.handleConfigQuery=tke;function UJ(t,e,n){typeof t.responseHook=="function"&&(0,yu.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&ka.diag.error("Error running response hook",r)},!0)}Pe.handleExecutionResult=UJ;function nke(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[So.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(ZA(i)),e.setStatus({code:ka.SpanStatusCode.ERROR,message:i.message})):UJ(t,e,a),o(),e.end(),n.call(this,i,a)}}Pe.patchCallback=nke;function rke(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()}Pe.getPoolName=rke;function oke(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Et.ATTR_DB_CLIENT_CONNECTION_STATE]:Et.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Et.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Et.ATTR_DB_CLIENT_CONNECTION_STATE]:Et.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Et.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Et.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}Pe.updateCounter=oke;function ske(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(ZA(r)),t.setStatus({code:ka.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}Pe.patchCallbackPGPool=ske;function ike(t,e){return function(r){r&&(r instanceof Error&&t.recordException(ZA(r)),t.setStatus({code:ka.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}Pe.patchClientConnectCallback=ike;function ake(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}Pe.getErrorMessage=ake;function cke(t){return typeof t=="object"&&typeof t?.text=="string"}Pe.isObjectWithTextString=cke;function ZA(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}Pe.sanitizedErrorMessage=ZA});var BJ=R(Hp=>{"use strict";p();u();l();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.PACKAGE_NAME=Hp.PACKAGE_VERSION=void 0;Hp.PACKAGE_VERSION="0.62.0";Hp.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var VJ=R(tR=>{"use strict";p();u();l();Object.defineProperty(tR,"__esModule",{value:!0});tR.PgInstrumentation=void 0;var Zn=de(),He=(w(),x(j)),GJ=MJ(),ut=kJ(),jJ=ZM(),HJ=BJ(),FJ=mv(),eR=ke(),Ko=(ye(),x(Ge)),pm=_v();function Fp(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var Ev=class extends Zn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(HJ.PACKAGE_NAME,HJ.PACKAGE_VERSION,e),this._semconvStability=(0,Zn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(Ko.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:He.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(pm.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(pm.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 Zn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new Zn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new Zn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=Fp(a);return this._patchPgClient(c.Client),a},a=>{let c=Fp(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new Zn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=Fp(a);return(0,Zn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=Fp(a);(0,Zn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=Fp(e);return(0,Zn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Zn.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=Fp(e);return(0,Zn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,Zn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ut.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(FJ.SpanNames.CONNECT,{kind:He.SpanKind.CLIENT,attributes:ut.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=He.trace.getSpan(He.context.active());o=ut.patchClientConnectCallback(i,o),c&&(o=He.context.bind(He.context.active(),o))}let a=He.context.with(He.trace.setSpan(He.context.active(),i),()=>n.call(this,o));return $J(i,a)}}recordOperationDuration(e,n){let r={},o=[Ko.ATTR_DB_NAMESPACE,Ko.ATTR_ERROR_TYPE,Ko.ATTR_SERVER_PORT,Ko.ATTR_SERVER_ADDRESS,Ko.ATTR_DB_OPERATION_NAME];this._semconvStability&Zn.SemconvStability.OLD&&o.push(pm.ATTR_DB_SYSTEM),this._semconvStability&Zn.SemconvStability.STABLE&&o.push(Ko.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,eR.hrTimeToMilliseconds)((0,eR.hrTimeDuration)(n,(0,eR.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ut.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,eR.hrTime)(),i=o[0],a=typeof i=="string",c=ut.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={[pm.ATTR_DB_SYSTEM]:pm.DB_SYSTEM_VALUE_POSTGRESQL,[Ko.ATTR_DB_NAMESPACE]:this.database,[Ko.ATTR_SERVER_PORT]:this.connectionParameters.port,[Ko.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};d?.text&&(f[Ko.ATTR_DB_OPERATION_NAME]=ut.parseNormalizedOperationName(d?.text));let _=()=>{e.recordOperationDuration(f,s)},m=e.getConfig(),E=ut.handleConfigQuery.call(this,e.tracer,m,e._semconvStability,d);if(m.addSqlCommenterCommentToQueries&&(a?o[0]=(0,jJ.addSqlCommenterComment)(E,i):c&&!("name"in i)&&(o[0]={...i,text:(0,jJ.addSqlCommenterComment)(E,i.text)})),o.length>0){let y=He.trace.getSpan(He.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ut.patchCallback(m,E,o[o.length-1],f,_),y&&(o[o.length-1]=He.context.bind(He.context.active(),o[o.length-1]));else if(typeof d?.callback=="function"){let O=ut.patchCallback(e.getConfig(),E,d.callback,f,_);y&&(O=He.context.bind(He.context.active(),O)),o[0].callback=O}}let{requestHook:T}=m;typeof T=="function"&&d&&(0,Zn.safeExecuteInTheMiddle)(()=>{let{database:y,host:O,port:I,user:M}=this.connectionParameters;T(E,{connection:{database:y,host:O,port:I,user:M},query:{text:d.text,values:d.values,name:d.name}})},y=>{y&&e._diag.error("Error running query hook",y)},!0);let A;try{A=n.apply(this,o)}catch(y){throw y instanceof Error&&E.recordException(ut.sanitizedErrorMessage(y)),E.setStatus({code:He.SpanStatusCode.ERROR,message:ut.getErrorMessage(y)}),E.end(),y}return A instanceof Promise?A.then(y=>new Promise(O=>{ut.handleExecutionResult(e.getConfig(),E,y),_(),E.end(),O(y)})).catch(y=>new Promise((O,I)=>{y instanceof Error&&E.recordException(ut.sanitizedErrorMessage(y)),E.setStatus({code:He.SpanStatusCode.ERROR,message:y.message}),_(),E.end(),I(y)})):A})}_setPoolConnectEventListeners(e){if(e[GJ.EVENT_LISTENERS_SET])return;let n=ut.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ut.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[GJ.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ut.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(FJ.SpanNames.POOL_CONNECT,{kind:He.SpanKind.CLIENT,attributes:ut.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=He.trace.getSpan(He.context.active());o=ut.patchCallbackPGPool(i,o),c&&(o=He.context.bind(He.context.active(),o))}let a=He.context.with(He.trace.setSpan(He.context.active(),i),()=>n.call(this,o));return $J(i,a)}}};tR.PgInstrumentation=Ev;function $J(t,e){if(!(e instanceof Promise))return e;let n=e;return He.context.bind(He.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ut.sanitizedErrorMessage(r)),t.setStatus({code:He.SpanStatusCode.ERROR,message:ut.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var qJ=R($p=>{"use strict";p();u();l();Object.defineProperty($p,"__esModule",{value:!0});$p.AttributeNames=$p.PgInstrumentation=void 0;var uke=VJ();Object.defineProperty($p,"PgInstrumentation",{enumerable:!0,get:function(){return uke.PgInstrumentation}});var lke=fv();Object.defineProperty($p,"AttributeNames",{enumerable:!0,get:function(){return lke.AttributeNames}})});var YJ,WJ,KJ,pke,zJ,XJ=S(()=>{p();u();l();YJ=B(qJ(),1);xe();WJ="Postgres",KJ=X(WJ,()=>new YJ.PgInstrumentation({requireParentSpan:!0,requestHook(t){Be(t,"auto.db.otel.postgres")}})),pke=(()=>({name:WJ,setupOnce(){KJ()}})),zJ=pke});var hi,rR,QJ,dke,nR,gv,JJ,ZJ,Tv,fke,eZ,tZ=S(()=>{p();u();l();w();hi=B(de(),1);ye();te();xe();Eu();rR="PostgresJs",QJ=[">=3.0.0 <4"],dke=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,nR=Symbol("sentryPostgresConnectionContext"),gv=Symbol.for("sentry.instrumented.postgresjs"),JJ=Symbol.for("sentry.query.from.instrumented.sql"),ZJ=X(rR,t=>new Tv({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),Tv=class extends hi.InstrumentationBase{constructor(e){super("sentry-postgres-js",Ie,e)}init(){let e=new hi.InstrumentationNodeModuleDefinition("postgres",QJ,n=>{try{return this._patchPostgres(n)}catch(r){return ht&&N.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new hi.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,QJ,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 ht&&N.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"?(ht&&N.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:(c_(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[nR];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(nf,n.ATTR_DB_NAMESPACE),n.ATTR_SERVER_ADDRESS&&e.setAttribute(rf,n.ATTR_SERVER_ADDRESS),n.ATTR_SERVER_PORT!==void 0)){let r=parseInt(n.ATTR_SERVER_PORT,10);isNaN(r)||e.setAttribute(of,r)}}_setOperationName(e,n,r){if(r){e.setAttribute(il,r);return}let o=n?.match(dke);o?.[1]&&e.setAttribute(il,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[nR]=a}_instrumentSqlInstance(e,n){if(e[gv])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[nR]=n:this._attachConnectionContext(e,o),e[gv]=!0,o[gv]=!0,o}_wrapSingleQueryHandle(e,n){if(e.handle?.__sentryWrapped)return;e[JJ]=!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 cn({name:c||"postgresjs.query",op:"db"},d=>{Be(d,"auto.db.postgresjs"),d.setAttributes({[Hi]:"postgres",[oE]:c});let f=n?n[nR]:void 0;o._setConnectionAttributes(d,f);let _=o.getConfig(),{requestHook:m}=_;m&&(0,hi.safeExecuteInTheMiddle)(()=>m(d,c,f),T=>{T&&(d.setAttribute("sentry.hook.error","requestHook failed"),ht&&N.error(`Error in requestHook for ${rR} integration:`,T))},!0);let E=this;E.resolve=new Proxy(E.resolve,{apply:(T,A,y)=>{try{o._setOperationName(d,c,y?.[0]?.command),d.end()}catch(O){ht&&N.error("Error ending span in resolve callback:",O)}return Reflect.apply(T,A,y)}}),E.reject=new Proxy(E.reject,{apply:(T,A,y)=>{try{d.setStatus({code:2,message:y?.[0]?.message||"unknown_error"}),d.setAttribute(sE,y?.[0]?.code||"unknown"),d.setAttribute(iE,y?.[0]?.name||"unknown"),o._setOperationName(d,c),d.end()}catch(O){ht&&N.error("Error ending span in reject callback:",O)}return Reflect.apply(T,A,y)}});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 ue.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[JJ])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return cn({name:i||"postgresjs.query",op:"db"},a=>{Be(a,"auto.db.postgresjs"),a.setAttributes({[Hi]:"postgres",[oE]:i});let c=n.getConfig(),{requestHook:d}=c;d&&(0,hi.safeExecuteInTheMiddle)(()=>d(a,i,void 0),m=>{m&&(a.setAttribute("sentry.hook.error","requestHook failed"),ht&&N.error(`Error in requestHook for ${rR} 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(A){ht&&N.error("Error ending span in resolve callback:",A)}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(sE,T?.[0]?.code||"unknown"),a.setAttribute(iE,T?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(A){ht&&N.error("Error ending span in reject callback:",A)}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}},fke=(t=>({name:rR,setupOnce(){ZJ(t)}})),eZ=fke});var nZ=R(dm=>{"use strict";p();u();l();Object.defineProperty(dm,"__esModule",{value:!0});dm.SeverityNumber=void 0;var _ke;(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"})(_ke=dm.SeverityNumber||(dm.SeverityNumber={}))});var sR=R(Vp=>{"use strict";p();u();l();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.NOOP_LOGGER=Vp.NoopLogger=void 0;var oR=class{emit(e){}};Vp.NoopLogger=oR;Vp.NOOP_LOGGER=new oR});var aR=R(qp=>{"use strict";p();u();l();Object.defineProperty(qp,"__esModule",{value:!0});qp.NOOP_LOGGER_PROVIDER=qp.NoopLoggerProvider=void 0;var mke=sR(),iR=class{getLogger(e,n,r){return new mke.NoopLogger}};qp.NoopLoggerProvider=iR;qp.NOOP_LOGGER_PROVIDER=new iR});var Av=R(cR=>{"use strict";p();u();l();Object.defineProperty(cR,"__esModule",{value:!0});cR.ProxyLogger=void 0;var hke=sR(),Sv=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):hke.NOOP_LOGGER}};cR.ProxyLogger=Sv});var yv=R(uR=>{"use strict";p();u();l();Object.defineProperty(uR,"__esModule",{value:!0});uR.ProxyLoggerProvider=void 0;var Eke=aR(),gke=Av(),Rv=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new gke.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Eke.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)}};uR.ProxyLoggerProvider=Rv});var rZ=R(lR=>{"use strict";p();u();l();Object.defineProperty(lR,"__esModule",{value:!0});lR._globalThis=void 0;lR._globalThis=typeof globalThis=="object"?globalThis:global});var oZ=R(pR=>{"use strict";p();u();l();Object.defineProperty(pR,"__esModule",{value:!0});pR._globalThis=void 0;var Tke=rZ();Object.defineProperty(pR,"_globalThis",{enumerable:!0,get:function(){return Tke._globalThis}})});var sZ=R(dR=>{"use strict";p();u();l();Object.defineProperty(dR,"__esModule",{value:!0});dR._globalThis=void 0;var Ske=oZ();Object.defineProperty(dR,"_globalThis",{enumerable:!0,get:function(){return Ske._globalThis}})});var iZ=R(Ms=>{"use strict";p();u();l();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.API_BACKWARDS_COMPATIBILITY_VERSION=Ms.makeGetter=Ms._global=Ms.GLOBAL_LOGS_API_KEY=void 0;var Ake=sZ();Ms.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Ms._global=Ake._globalThis;function Rke(t,e,n){return r=>r===t?e:n}Ms.makeGetter=Rke;Ms.API_BACKWARDS_COMPATIBILITY_VERSION=1});var cZ=R(fR=>{"use strict";p();u();l();Object.defineProperty(fR,"__esModule",{value:!0});fR.LogsAPI=void 0;var Ao=iZ(),yke=aR(),aZ=yv(),Iv=class t{constructor(){this._proxyLoggerProvider=new aZ.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Ao._global[Ao.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Ao._global[Ao.GLOBAL_LOGS_API_KEY]=(0,Ao.makeGetter)(Ao.API_BACKWARDS_COMPATIBILITY_VERSION,e,yke.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Ao._global[Ao.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Ao._global,Ao.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Ao._global[Ao.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new aZ.ProxyLoggerProvider}};fR.LogsAPI=Iv});var Nv=R(nn=>{"use strict";p();u();l();Object.defineProperty(nn,"__esModule",{value:!0});nn.logs=nn.ProxyLoggerProvider=nn.ProxyLogger=nn.NoopLoggerProvider=nn.NOOP_LOGGER_PROVIDER=nn.NoopLogger=nn.NOOP_LOGGER=nn.SeverityNumber=void 0;var Ike=nZ();Object.defineProperty(nn,"SeverityNumber",{enumerable:!0,get:function(){return Ike.SeverityNumber}});var uZ=sR();Object.defineProperty(nn,"NOOP_LOGGER",{enumerable:!0,get:function(){return uZ.NOOP_LOGGER}});Object.defineProperty(nn,"NoopLogger",{enumerable:!0,get:function(){return uZ.NoopLogger}});var lZ=aR();Object.defineProperty(nn,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return lZ.NOOP_LOGGER_PROVIDER}});Object.defineProperty(nn,"NoopLoggerProvider",{enumerable:!0,get:function(){return lZ.NoopLoggerProvider}});var Nke=Av();Object.defineProperty(nn,"ProxyLogger",{enumerable:!0,get:function(){return Nke.ProxyLogger}});var Oke=yv();Object.defineProperty(nn,"ProxyLoggerProvider",{enumerable:!0,get:function(){return Oke.ProxyLoggerProvider}});var bke=cZ();nn.logs=bke.LogsAPI.getInstance()});var pZ=R(Yp=>{"use strict";p();u();l();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.disableInstrumentations=Yp.enableInstrumentations=void 0;function Cke(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()}}Yp.enableInstrumentations=Cke;function Pke(t){t.forEach(e=>e.disable())}Yp.disableInstrumentations=Pke});var _Z=R(_R=>{"use strict";p();u();l();Object.defineProperty(_R,"__esModule",{value:!0});_R.registerInstrumentations=void 0;var dZ=(w(),x(j)),Mke=Nv(),fZ=pZ();function vke(t){let e=t.tracerProvider||dZ.trace.getTracerProvider(),n=t.meterProvider||dZ.metrics.getMeterProvider(),r=t.loggerProvider||Mke.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,fZ.enableInstrumentations)(o,e,n,r),()=>{(0,fZ.disableInstrumentations)(o)}}_R.registerInstrumentations=vke});var yZ=R(mR=>{"use strict";p();u();l();Object.defineProperty(mR,"__esModule",{value:!0});mR.satisfies=void 0;var Pv=(w(),x(j)),TZ=/^(?: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-]+)*))?$/,xke=/^(?<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-]+)*))?$/,Lke={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Dke(t,e,n){if(!wke(t))return Pv.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Gke(t);if(!r)return!1;let o=[],s=SZ(r,e,o,n);return s&&!n?.includePrerelease?kke(r,o):s}mR.satisfies=Dke;function wke(t){return typeof t=="string"&&TZ.test(t)}function SZ(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(Ov(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=i1e(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!Ov(t,s,n,r))return!1;return!0}return Ov(t,e,n,r)}function Ov(t,e,n,r){if(e=Bke(e,r),e.includes(" "))return SZ(t,e,n,r);{let o=jke(e);return n.push(o),Uke(t,o)}}function Uke(t,e){if(e.invalid)return!1;if(!e.version||Cv(e.version))return!0;let n=hZ(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=hZ(r,o)}return Lke[e.op]?.includes(n)}function kke(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Bke(t,e){return t=t.trim(),t=o1e(t,e),t=r1e(t),t=s1e(t,e),t=t.trim(),t}function er(t){return!t||t.toLowerCase()==="x"||t==="*"}function Gke(t){let e=t.match(TZ);if(!e){Pv.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 jke(t){if(!t)return{};let e=t.match(xke);if(!e)return Pv.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 Cv(t){return t==="*"||t==="x"||t==="X"}function mZ(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Hke(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 Fke(t,e){if(Cv(t)||Cv(e))return 0;let[n,r]=Hke(mZ(t),mZ(e));return n>r?1:n<r?-1:0}function hZ(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Fke(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var AZ="[a-zA-Z0-9-]",RZ="0|[1-9]\\d*",$ke=`\\d*[a-zA-Z-]${AZ}*`,Vke="((?:<|>)?=?)",EZ=`(?:${RZ}|${$ke})`,qke=`(?:-(${EZ}(?:\\.${EZ})*))`,gZ=`${AZ}+`,Yke=`(?:\\+(${gZ}(?:\\.${gZ})*))`,bv=`${RZ}|x|X|\\*`,fm=`[v=\\s]*(${bv})(?:\\.(${bv})(?:\\.(${bv})(?:${qke})?${Yke}?)?)?`,Wke=`^${Vke}\\s*${fm}$`,Kke=new RegExp(Wke),zke=`^\\s*(${fm})\\s+-\\s+(${fm})\\s*$`,Xke=new RegExp(zke),Qke="(?:~>?)",Jke=`^${Qke}${fm}$`,Zke=new RegExp(Jke),e1e="(?:\\^)",t1e=`^${e1e}${fm}$`,n1e=new RegExp(t1e);function r1e(t){let e=Zke;return t.replace(e,(n,r,o,s,i)=>{let a;return er(r)?a="":er(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:er(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 o1e(t,e){let n=n1e,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let d;return er(s)?d="":er(i)?d=`>=${s}.0.0${r} <${+s+1}.0.0-0`:er(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 s1e(t,e){let n=Kke;return t.replace(n,(r,o,s,i,a,c)=>{let d=er(s),f=d||er(i),_=f||er(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 i1e(t,e){let n=Xke;return t.replace(n,(r,o,s,i,a,c,d,f,_,m,E,T)=>(er(s)?o="":er(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:er(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,er(_)?f="":er(m)?f=`<${+_+1}.0.0-0`:er(E)?f=`<${_}.${+m+1}.0-0`:T?f=`<=${_}.${m}.${E}-${T}`:e?.includePrerelease?f=`<${_}.${m}.${+E+1}-0`:f=`<=${f}`,`${o} ${f}`.trim()))}});var Mv=R(fn=>{"use strict";p();u();l();Object.defineProperty(fn,"__esModule",{value:!0});fn.massUnwrap=fn.unwrap=fn.massWrap=fn.wrap=void 0;var tr=console.error.bind(console);function _m(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 a1e=(t,e,n)=>{if(!t||!t[e]){tr("no original function "+String(e)+" to wrap");return}if(!n){tr("no wrapper function"),tr(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){tr("original object and wrapper must be functions");return}let o=n(r,e);return _m(o,"__original",r),_m(o,"__unwrap",()=>{t[e]===o&&_m(t,e,r)}),_m(o,"__wrapped",!0),_m(t,e,o),o};fn.wrap=a1e;var c1e=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{tr("must provide one or more modules to patch"),tr(new Error().stack);return}if(!(e&&Array.isArray(e))){tr("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,fn.wrap)(r,o,n)})})};fn.massWrap=c1e;var u1e=(t,e)=>{if(!t||!t[e]){tr("no function to unwrap."),tr(new Error().stack);return}let n=t[e];if(!n.__unwrap)tr("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};fn.unwrap=u1e;var l1e=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{tr("must provide one or more modules to patch"),tr(new Error().stack);return}if(!(e&&Array.isArray(e))){tr("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,fn.unwrap)(n,r)})})};fn.massUnwrap=l1e;function mm(t){t&&t.logger&&(typeof t.logger!="function"?tr("new logger isn't a function, not replacing"):tr=t.logger)}fn.default=mm;mm.wrap=fn.wrap;mm.massWrap=fn.massWrap;mm.unwrap=fn.unwrap;mm.massUnwrap=fn.massUnwrap});var IZ=R(ER=>{"use strict";p();u();l();Object.defineProperty(ER,"__esModule",{value:!0});ER.InstrumentationAbstract=void 0;var vv=(w(),x(j)),p1e=Nv(),hR=Mv(),xv=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=vv.diag.createComponentLogger({namespace:e}),this._tracer=vv.trace.getTracer(e,n),this._meter=vv.metrics.getMeter(e,n),this._logger=p1e.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=hR.wrap;_unwrap=hR.unwrap;_massWrap=hR.massWrap;_massUnwrap=hR.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)}}};ER.InstrumentationAbstract=xv});var NZ=R(Ba=>{"use strict";p();u();l();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.ModuleNameTrie=Ba.ModuleNameSeparator=void 0;Ba.ModuleNameSeparator="/";var gR=class{hooks=[];children=new Map},Lv=class{_trie=new gR;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Ba.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new gR,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(Ba.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))}};Ba.ModuleNameTrie=Lv});var bZ=R(TR=>{"use strict";p();u();l();Object.defineProperty(TR,"__esModule",{value:!0});TR.RequireInTheMiddleSingleton=void 0;var d1e=_f(),OZ=require("path"),Dv=NZ(),f1e=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),wv=class t{_moduleNameTrie=new Dv.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new d1e.Hook(null,{internals:!0},(e,n,r)=>{let o=_1e(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 f1e?new t:this._instance=this._instance??new t}};TR.RequireInTheMiddleSingleton=wv;function _1e(t){return OZ.sep!==Dv.ModuleNameSeparator?t.split(OZ.sep).join(Dv.ModuleNameSeparator):t}});var Uv=R(Ga=>{"use strict";p();u();l();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.isWrapped=Ga.safeExecuteInTheMiddleAsync=Ga.safeExecuteInTheMiddle=void 0;function m1e(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Ga.safeExecuteInTheMiddle=m1e;async function h1e(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}}Ga.safeExecuteInTheMiddleAsync=h1e;function E1e(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Ga.isWrapped=E1e});var MZ=R(SR=>{"use strict";p();u();l();Object.defineProperty(SR,"__esModule",{value:!0});SR.InstrumentationBase=void 0;var hm=require("path"),CZ=require("util"),g1e=yZ(),kv=Mv(),T1e=IZ(),S1e=bZ(),A1e=YE(),Em=(w(),x(j)),R1e=_f(),y1e=require("fs"),I1e=Uv(),Bv=class extends T1e.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=S1e.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,I1e.isWrapped)(e[n])&&this._unwrap(e,n),CZ.types.isProxy(e)){let o=(0,kv.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,kv.wrap)(e,n,r)};_unwrap=(e,n)=>CZ.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,kv.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Em.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Em.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{Em.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Em.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,y1e.readFileSync)(hm.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Em.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 PZ(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=hm.normalize(r);return i.filter(d=>d.name===a).filter(d=>PZ(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&&hm.isAbsolute(a)){let d=hm.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=hm.isAbsolute(e.name)?new R1e.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new A1e.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}};SR.InstrumentationBase=Bv;function PZ(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,g1e.satisfies)(e,r,{includePrerelease:n}))}});var vZ=R(AR=>{"use strict";p();u();l();Object.defineProperty(AR,"__esModule",{value:!0});AR.normalize=void 0;var N1e=require("path");Object.defineProperty(AR,"normalize",{enumerable:!0,get:function(){return N1e.normalize}})});var xZ=R(Wp=>{"use strict";p();u();l();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.normalize=Wp.InstrumentationBase=void 0;var O1e=MZ();Object.defineProperty(Wp,"InstrumentationBase",{enumerable:!0,get:function(){return O1e.InstrumentationBase}});var b1e=vZ();Object.defineProperty(Wp,"normalize",{enumerable:!0,get:function(){return b1e.normalize}})});var Gv=R(Kp=>{"use strict";p();u();l();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.normalize=Kp.InstrumentationBase=void 0;var LZ=xZ();Object.defineProperty(Kp,"InstrumentationBase",{enumerable:!0,get:function(){return LZ.InstrumentationBase}});Object.defineProperty(Kp,"normalize",{enumerable:!0,get:function(){return LZ.normalize}})});var DZ=R(RR=>{"use strict";p();u();l();Object.defineProperty(RR,"__esModule",{value:!0});RR.InstrumentationNodeModuleDefinition=void 0;var jv=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||[]}};RR.InstrumentationNodeModuleDefinition=jv});var wZ=R(yR=>{"use strict";p();u();l();Object.defineProperty(yR,"__esModule",{value:!0});yR.InstrumentationNodeModuleFile=void 0;var C1e=Gv(),Hv=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,C1e.normalize)(e)}};yR.InstrumentationNodeModuleFile=Hv});var UZ=R(Iu=>{"use strict";p();u();l();Object.defineProperty(Iu,"__esModule",{value:!0});Iu.semconvStabilityFromStr=Iu.SemconvStability=void 0;var IR;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(IR=Iu.SemconvStability||(Iu.SemconvStability={}));function P1e(t,e){let n=IR.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=IR.DUPLICATE;break}else o.toLowerCase()===t&&(n=IR.STABLE);return n}Iu.semconvStabilityFromStr=P1e});var BZ=R(Gt=>{"use strict";p();u();l();Object.defineProperty(Gt,"__esModule",{value:!0});Gt.semconvStabilityFromStr=Gt.SemconvStability=Gt.safeExecuteInTheMiddleAsync=Gt.safeExecuteInTheMiddle=Gt.isWrapped=Gt.InstrumentationNodeModuleFile=Gt.InstrumentationNodeModuleDefinition=Gt.InstrumentationBase=Gt.registerInstrumentations=void 0;var M1e=_Z();Object.defineProperty(Gt,"registerInstrumentations",{enumerable:!0,get:function(){return M1e.registerInstrumentations}});var v1e=Gv();Object.defineProperty(Gt,"InstrumentationBase",{enumerable:!0,get:function(){return v1e.InstrumentationBase}});var x1e=DZ();Object.defineProperty(Gt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return x1e.InstrumentationNodeModuleDefinition}});var L1e=wZ();Object.defineProperty(Gt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return L1e.InstrumentationNodeModuleFile}});var Fv=Uv();Object.defineProperty(Gt,"isWrapped",{enumerable:!0,get:function(){return Fv.isWrapped}});Object.defineProperty(Gt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return Fv.safeExecuteInTheMiddle}});Object.defineProperty(Gt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return Fv.safeExecuteInTheMiddleAsync}});var kZ=UZ();Object.defineProperty(Gt,"SemconvStability",{enumerable:!0,get:function(){return kZ.SemconvStability}});Object.defineProperty(Gt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return kZ.semconvStabilityFromStr}})});function U1e(){let t=zp[Vv];return t?.helper?t.helper:zp[$v]?.helper}function k1e(t){let e={helper:t};zp[Vv]=e,zp[$v]=e}function B1e(){delete zp[Vv],delete zp[$v]}function H1e(t){switch(t){case"client":return Ye.CLIENT;case"internal":default:return Ye.INTERNAL}}function HZ(t,e,n,r,o){if(FZ(e.name,o))return;let s={attributes:e.attributes,kind:H1e(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)HZ(t,c,n,r,o);i.end(e.endTime)})}function GZ(t,e){return $1e(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function $1e(t){return t!=null&&typeof t.then=="function"}function FZ(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var NR,D1e,w1e,$v,Vv,zp,G1e,j1e,F1e,$Z,jZ,V1e,q1e,VZ,qZ=S(()=>{p();u();l();w();NR=B(BZ(),1);w();D1e={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"}},w1e=D1e.version.split(".")[0],$v="PRISMA_INSTRUMENTATION",Vv=`V${w1e}_PRISMA_INSTRUMENTATION`,zp=globalThis;G1e=process.env.PRISMA_SHOW_ALL_TRACES==="true",j1e="00-10-10-00";F1e=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=ue.getSpanContext(t??V.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:j1e}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)HZ(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return V.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!G1e)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(FZ(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return GZ(s,e(s,r))}return n.startActiveSpan(o,t,s=>GZ(s,e(s,r)))}};$Z={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},jZ=$Z.version,V1e=$Z.name,q1e="@prisma/client",VZ=class extends NR.InstrumentationBase{tracerProvider;constructor(t={}){super(V1e,jZ,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new NR.InstrumentationNodeModuleDefinition(q1e,[jZ])]}enable(){let t=this._config;k1e(new F1e({tracerProvider:this.tracerProvider??ue.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){B1e()}isEnabled(){return U1e()!==void 0}}});function Y1e(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function WZ(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}function W1e(t){switch(t){case"client":return Ye.CLIENT;case"internal":default:return Ye.INTERNAL}}var YZ,qv,K1e,KZ,zZ=S(()=>{p();u();l();w();qZ();te();xe();YZ="Prisma";qv=class extends VZ{constructor(){super()}enable(){super.enable();let e=WZ();Y1e(e)&&(e.createEngineSpan=n=>{let r=ue.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){bt(()=>{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=W1e(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:jn.SAMPLED}})),_=ue.setSpanContext(V.active(),{traceId:d,spanId:a,traceFlags:jn.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}})}};K1e=X(YZ,t=>new qv),KZ=t=>({name:YZ,setupOnce(){K1e()},setup(e){WZ()&&e.on("spanStart",n=>{let r=se(n);r.description?.startsWith("prisma:")&&n.setAttribute(pe,"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")})}})});var XZ=R(Xp=>{"use strict";p();u();l();Object.defineProperty(Xp,"__esModule",{value:!0});Xp.PACKAGE_NAME=Xp.PACKAGE_VERSION=void 0;Xp.PACKAGE_VERSION="0.56.0";Xp.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var Yv=R(vs=>{"use strict";p();u();l();Object.defineProperty(vs,"__esModule",{value:!0});vs.HapiLifecycleMethodNames=vs.HapiLayerType=vs.handlerPatched=vs.HapiComponentName=void 0;vs.HapiComponentName="@hapi/hapi";vs.handlerPatched=Symbol("hapi-handler-patched");vs.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};vs.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var QZ=R(OR=>{"use strict";p();u();l();Object.defineProperty(OR,"__esModule",{value:!0});OR.ATTR_HTTP_METHOD=void 0;OR.ATTR_HTTP_METHOD="http.method"});var Wv=R(gm=>{"use strict";p();u();l();Object.defineProperty(gm,"__esModule",{value:!0});gm.AttributeNames=void 0;var z1e;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(z1e=gm.AttributeNames||(gm.AttributeNames={}))});var e7=R(jt=>{"use strict";p();u();l();Object.defineProperty(jt,"__esModule",{value:!0});jt.getPluginFromInput=jt.getExtMetadata=jt.getRouteMetadata=jt.isPatchableExtMethod=jt.isDirectExtInput=jt.isLifecycleExtEventObj=jt.isLifecycleExtType=jt.getPluginName=void 0;var JZ=(ye(),x(Ge)),X1e=QZ(),Tm=Yv(),ja=Wv(),ZZ=de();function Q1e(t){return t.name?t.name:t.pkg.name}jt.getPluginName=Q1e;var J1e=t=>typeof t=="string"&&Tm.HapiLifecycleMethodNames.has(t);jt.isLifecycleExtType=J1e;var Z1e=t=>{let e=t?.type;return e!==void 0&&(0,jt.isLifecycleExtType)(e)};jt.isLifecycleExtEventObj=Z1e;var eBe=t=>Array.isArray(t)&&t.length<=3&&(0,jt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";jt.isDirectExtInput=eBe;var tBe=t=>!Array.isArray(t);jt.isPatchableExtMethod=tBe;var nBe=(t,e,n)=>{let r={[JZ.ATTR_HTTP_ROUTE]:t.path};e&ZZ.SemconvStability.OLD&&(r[X1e.ATTR_HTTP_METHOD]=t.method),e&ZZ.SemconvStability.STABLE&&(r[JZ.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[ja.AttributeNames.HAPI_TYPE]=Tm.HapiLayerType.PLUGIN,r[ja.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[ja.AttributeNames.HAPI_TYPE]=Tm.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};jt.getRouteMetadata=nBe;var rBe=(t,e)=>e?{attributes:{[ja.AttributeNames.EXT_TYPE]:t,[ja.AttributeNames.HAPI_TYPE]:Tm.HapiLayerType.EXT,[ja.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ext - ${t}`}:{attributes:{[ja.AttributeNames.EXT_TYPE]:t,[ja.AttributeNames.HAPI_TYPE]:Tm.HapiLayerType.EXT},name:`ext - ${t}`};jt.getExtMetadata=rBe;var oBe=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;jt.getPluginFromInput=oBe});var r7=R(bR=>{"use strict";p();u();l();Object.defineProperty(bR,"__esModule",{value:!0});bR.HapiInstrumentation=void 0;var kr=(w(),x(j)),t7=ke(),Sm=de(),n7=XZ(),Am=Yv(),Ei=e7(),Kv=class extends Sm.InstrumentationBase{_semconvStability;constructor(e={}){super(n7.PACKAGE_NAME,n7.PACKAGE_VERSION,e),this._semconvStability=(0,Sm.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new Sm.InstrumentationNodeModuleDefinition(Am.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Sm.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,Sm.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,Ei.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Ei.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,Ei.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,Ei.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,Ei.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,Ei.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,Ei.isPatchableExtMethod)(e))return e[Am.handlerPatched]===!0?e:(e[Am.handlerPatched]=!0,async function(...i){if(kr.trace.getSpan(kr.context.active())===void 0)return await e.apply(this,i);let a=(0,Ei.getExtMetadata)(n,r),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await kr.context.with(kr.trace.setSpan(kr.context.active(),c),e,void 0,...i)}catch(d){throw c.recordException(d),c.setStatus({code:kr.SpanStatusCode.ERROR,message:d.message}),d}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[Am.handlerPatched]===!0)return e;e[Am.handlerPatched]=!0;let o=s=>async function(...i){if(kr.trace.getSpan(kr.context.active())===void 0)return await s.call(this,...i);let a=(0,t7.getRPCMetadata)(kr.context.active());a?.type===t7.RPCType.HTTP&&(a.route=e.path);let c=(0,Ei.getRouteMetadata)(e,r._semconvStability,n),d=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await kr.context.with(kr.trace.setSpan(kr.context.active(),d),()=>s.call(this,...i))}catch(f){throw d.recordException(f),d.setStatus({code:kr.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}};bR.HapiInstrumentation=Kv});var o7=R(Qp=>{"use strict";p();u();l();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.AttributeNames=Qp.HapiInstrumentation=void 0;var sBe=r7();Object.defineProperty(Qp,"HapiInstrumentation",{enumerable:!0,get:function(){return sBe.HapiInstrumentation}});var iBe=Wv();Object.defineProperty(Qp,"AttributeNames",{enumerable:!0,get:function(){return iBe.AttributeNames}})});var s7,i7,a7,aBe,c7,u7=S(()=>{p();u();l();s7=B(o7(),1);xe();i7="Hapi",a7=X(i7,()=>new s7.HapiInstrumentation),aBe=(()=>({name:i7,setupOnce(){a7()}})),c7=aBe});var Ha,Rm,zv=S(()=>{p();u();l();Ha={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Rm={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"}});var PR,cBe,uBe,CR,l7=S(()=>{p();u();l();w();PR=B(de(),1);te();zv();cBe="@sentry/instrumentation-hono",uBe="0.0.1",CR=class extends PR.InstrumentationBase{constructor(e={}){super(cBe,uBe,e)}init(){return[new PR.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(ue.setSpan(V.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Yn(a))return a.then(c=>{let d=n._determineHandlerType(c);return i.setAttributes({[Ha.HONO_TYPE]:d,[Ha.HONO_NAME]:d===Rm.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[Ha.HONO_TYPE]:c,[Ha.HONO_NAME]:c===Rm.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 Yn(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Rm.MIDDLEWARE:Rm.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:nt.ERROR,message:n.message}),e.recordException(n))}}});function lBe(t){let e=se(t).data,n=e[Ha.HONO_TYPE];if(e[fe]||!n)return;t.setAttributes({[pe]:"auto.http.otel.hono",[fe]:`${n}.hono`});let r=e[Ha.HONO_NAME];if(typeof r=="string"&&t.updateName(r),Ne()===no()){ht&&N.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[cr],s=e[Ws];typeof o=="string"&&typeof s=="string"&&Ne().setTransactionName(`${s} ${o}`)}var p7,d7,pBe,f7,_7=S(()=>{p();u();l();ye();te();xe();Eu();zv();l7();p7="Hono";d7=X(p7,()=>new CR({responseHook:t=>{lBe(t)}})),pBe=(()=>({name:p7,setupOnce(){d7()}})),f7=pBe});var MR=R(ym=>{"use strict";p();u();l();Object.defineProperty(ym,"__esModule",{value:!0});ym.KoaLayerType=void 0;var dBe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(dBe=ym.KoaLayerType||(ym.KoaLayerType={}))});var m7=R(Jp=>{"use strict";p();u();l();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.PACKAGE_NAME=Jp.PACKAGE_VERSION=void 0;Jp.PACKAGE_VERSION="0.58.0";Jp.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var Xv=R(Im=>{"use strict";p();u();l();Object.defineProperty(Im,"__esModule",{value:!0});Im.AttributeNames=void 0;var fBe;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(fBe=Im.AttributeNames||(Im.AttributeNames={}))});var E7=R(Zp=>{"use strict";p();u();l();Object.defineProperty(Zp,"__esModule",{value:!0});Zp.isLayerIgnored=Zp.getMiddlewareMetadata=void 0;var h7=MR(),vR=Xv(),_Be=(ye(),x(Ge)),mBe=(t,e,n,r)=>n?{attributes:{[vR.AttributeNames.KOA_NAME]:r?.toString(),[vR.AttributeNames.KOA_TYPE]:h7.KoaLayerType.ROUTER,[_Be.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[vR.AttributeNames.KOA_NAME]:e.name??"middleware",[vR.AttributeNames.KOA_TYPE]:h7.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Zp.getMiddlewareMetadata=mBe;var hBe=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Zp.isLayerIgnored=hBe});var g7=R(xR=>{"use strict";p();u();l();Object.defineProperty(xR,"__esModule",{value:!0});xR.kLayerPatched=void 0;xR.kLayerPatched=Symbol("koa-layer-patched")});var I7=R(LR=>{"use strict";p();u();l();Object.defineProperty(LR,"__esModule",{value:!0});LR.KoaInstrumentation=void 0;var xs=(w(),x(j)),Nm=de(),T7=MR(),S7=m7(),A7=E7(),R7=ke(),y7=g7(),Qv=class extends Nm.InstrumentationBase{constructor(e={}){super(S7.PACKAGE_NAME,S7.PACKAGE_VERSION,e)}init(){return new Nm.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Nm.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,Nm.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){xs.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?T7.KoaLayerType.ROUTER:T7.KoaLayerType.MIDDLEWARE;return e[y7.kLayerPatched]===!0||(0,A7.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(xs.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[y7.kLayerPatched]=!0,xs.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(xs.trace.getSpan(xs.context.active())===void 0)return e(s,i);let c=(0,A7.getMiddlewareMetadata)(s,e,n,r),d=this.tracer.startSpan(c.name,{attributes:c.attributes}),f=(0,R7.getRPCMetadata)(xs.context.active());f?.type===R7.RPCType.HTTP&&s._matchedRoute&&(f.route=s._matchedRoute.toString());let{requestHook:_}=this.getConfig();_&&(0,Nm.safeExecuteInTheMiddle)(()=>_(d,{context:s,middlewareLayer:e,layerType:o}),E=>{E&&xs.diag.error("koa instrumentation: request hook failed",E)},!0);let m=xs.trace.setSpan(xs.context.active(),d);return xs.context.with(m,async()=>{try{return await e(s,i)}catch(E){throw d.recordException(E),E}finally{d.end()}})})}};LR.KoaInstrumentation=Qv});var N7=R(Fa=>{"use strict";p();u();l();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.KoaLayerType=Fa.AttributeNames=Fa.KoaInstrumentation=void 0;var EBe=I7();Object.defineProperty(Fa,"KoaInstrumentation",{enumerable:!0,get:function(){return EBe.KoaInstrumentation}});var gBe=Xv();Object.defineProperty(Fa,"AttributeNames",{enumerable:!0,get:function(){return gBe.AttributeNames}});var TBe=MR();Object.defineProperty(Fa,"KoaLayerType",{enumerable:!0,get:function(){return TBe.KoaLayerType}})});var O7,b7,C7,SBe,P7,M7=S(()=>{p();u();l();O7=B(N7(),1);ye();te();xe();Eu();b7="Koa",C7=X(b7,O7.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Be(e,"auto.http.otel.koa");let r=se(e).data,o=r["koa.type"];o&&e.setAttribute(fe,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),Ne()===no()){ht&&N.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[cr],a=n.context?.request?.method?.toUpperCase()||"GET";i&&Ne().setTransactionName(`${a} ${i}`)}})),SBe=((t={})=>({name:b7,setupOnce(){C7(t)}})),P7=SBe});var Jv=R(zo=>{"use strict";p();u();l();Object.defineProperty(zo,"__esModule",{value:!0});zo.ConnectNames=zo.ConnectTypes=zo.AttributeNames=void 0;var ABe;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(ABe=zo.AttributeNames||(zo.AttributeNames={}));var RBe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(RBe=zo.ConnectTypes||(zo.ConnectTypes={}));var yBe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(yBe=zo.ConnectNames||(zo.ConnectNames={}))});var v7=R(ed=>{"use strict";p();u();l();Object.defineProperty(ed,"__esModule",{value:!0});ed.PACKAGE_NAME=ed.PACKAGE_VERSION=void 0;ed.PACKAGE_VERSION="0.53.0";ed.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var x7=R(DR=>{"use strict";p();u();l();Object.defineProperty(DR,"__esModule",{value:!0});DR._LAYERS_STORE_PROPERTY=void 0;DR._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var L7=R(Va=>{"use strict";p();u();l();Object.defineProperty(Va,"__esModule",{value:!0});Va.generateRoute=Va.replaceCurrentStackRoute=Va.addNewStackLayer=void 0;var IBe=(w(),x(j)),$a=x7(),NBe=t=>{Array.isArray(t[$a._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,$a._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[$a._LAYERS_STORE_PROPERTY].push("/");let e=t[$a._LAYERS_STORE_PROPERTY].length;return()=>{e===t[$a._LAYERS_STORE_PROPERTY].length?t[$a._LAYERS_STORE_PROPERTY].pop():IBe.diag.warn("Connect: Trying to pop the stack multiple time")}};Va.addNewStackLayer=NBe;var OBe=(t,e)=>{e&&t[$a._LAYERS_STORE_PROPERTY].splice(-1,1,e)};Va.replaceCurrentStackRoute=OBe;var bBe=t=>t[$a._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);Va.generateRoute=bBe});var U7=R(qa=>{"use strict";p();u();l();Object.defineProperty(qa,"__esModule",{value:!0});qa.ConnectInstrumentation=qa.ANONYMOUS_NAME=void 0;var CBe=(w(),x(j)),D7=ke(),td=Jv(),w7=v7(),wR=de(),PBe=(ye(),x(Ge)),Zv=L7();qa.ANONYMOUS_NAME="anonymous";var ex=class extends wR.InstrumentationBase{constructor(e={}){super(w7.PACKAGE_NAME,w7.PACKAGE_VERSION,e)}init(){return[new wR.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,wR.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,wR.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=td.ConnectTypes.REQUEST_HANDLER,s=td.ConnectNames.REQUEST_HANDLER,o=e):(r=td.ConnectTypes.MIDDLEWARE,s=td.ConnectNames.MIDDLEWARE,o=n.name||qa.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[PBe.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[td.AttributeNames.CONNECT_TYPE]:r,[td.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,Zv.replaceCurrentStackRoute)(d,e);let m=(0,D7.getRPCMetadata)(CBe.context.active());e&&m?.type===D7.RPCType.HTTP&&(m.route=(0,Zv.generateRoute)(d));let E="";e?E=`request handler - ${e}`:E=`middleware - ${n.name||qa.ANONYMOUS_NAME}`;let T=r._startSpan(e,n);r._diag.debug("start span",E);let A=!1;function y(){A?r._diag.debug(`span ${T.name} - already finished`):(A=!0,r._diag.debug(`finishing span ${T.name}`),T.end()),f.removeListener("close",y)}return f.addListener("close",y),arguments[c]=r._patchNext(_,y),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,Zv.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)}}};qa.ConnectInstrumentation=ex});var B7=R(Ro=>{"use strict";p();u();l();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.ConnectTypes=Ro.ConnectNames=Ro.AttributeNames=Ro.ANONYMOUS_NAME=Ro.ConnectInstrumentation=void 0;var k7=U7();Object.defineProperty(Ro,"ConnectInstrumentation",{enumerable:!0,get:function(){return k7.ConnectInstrumentation}});Object.defineProperty(Ro,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return k7.ANONYMOUS_NAME}});var tx=Jv();Object.defineProperty(Ro,"AttributeNames",{enumerable:!0,get:function(){return tx.AttributeNames}});Object.defineProperty(Ro,"ConnectNames",{enumerable:!0,get:function(){return tx.ConnectNames}});Object.defineProperty(Ro,"ConnectTypes",{enumerable:!0,get:function(){return tx.ConnectTypes}})});var G7,j7,H7,MBe,F7,$7=S(()=>{p();u();l();G7=B(B7(),1);xe();j7="Connect",H7=X(j7,()=>new G7.ConnectInstrumentation),MBe=(()=>({name:j7,setupOnce(){H7()}})),F7=MBe});var V7=R(rn=>{"use strict";p();u();l();Object.defineProperty(rn,"__esModule",{value:!0});rn.DB_SYSTEM_VALUE_MSSQL=rn.ATTR_NET_PEER_PORT=rn.ATTR_NET_PEER_NAME=rn.ATTR_DB_USER=rn.ATTR_DB_SYSTEM=rn.ATTR_DB_STATEMENT=rn.ATTR_DB_SQL_TABLE=rn.ATTR_DB_NAME=void 0;rn.ATTR_DB_NAME="db.name";rn.ATTR_DB_SQL_TABLE="db.sql.table";rn.ATTR_DB_STATEMENT="db.statement";rn.ATTR_DB_SYSTEM="db.system";rn.ATTR_DB_USER="db.user";rn.ATTR_NET_PEER_NAME="net.peer.name";rn.ATTR_NET_PEER_PORT="net.peer.port";rn.DB_SYSTEM_VALUE_MSSQL="mssql"});var q7=R(nd=>{"use strict";p();u();l();Object.defineProperty(nd,"__esModule",{value:!0});nd.once=nd.getSpanName=void 0;function vBe(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}nd.getSpanName=vBe;var xBe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};nd.once=xBe});var Y7=R(rd=>{"use strict";p();u();l();Object.defineProperty(rd,"__esModule",{value:!0});rd.PACKAGE_NAME=rd.PACKAGE_VERSION=void 0;rd.PACKAGE_VERSION="0.29.0";rd.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var Q7=R(Wa=>{"use strict";p();u();l();Object.defineProperty(Wa,"__esModule",{value:!0});Wa.TediousInstrumentation=Wa.INJECTED_CTX=void 0;var od=(w(),x(j)),LBe=require("events"),Ls=de(),Nu=(ye(),x(Ge)),Ya=V7(),W7=q7(),K7=Y7(),X7=Symbol("opentelemetry.instrumentation-tedious.current-database");Wa.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var z7=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function UR(t){Object.defineProperty(this,X7,{value:t,writable:!0})}var nx=class t extends Ls.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(K7.PACKAGE_NAME,K7.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ls.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ls.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Ls.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of z7)(0,Ls.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,Ls.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 z7)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return UR.call(this,this.config?.options?.database),this.removeListener("databaseChange",UR),this.on("databaseChange",UR),this.once("end",()=>{this.removeListener("databaseChange",UR)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||od.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,Wa.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?.[Wa.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof LBe.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[X7],m=(v=>v.sqlTextOrProcedure==="sp_prepare"&&v.parametersByName?.stmt?.value?v.parametersByName.stmt.value:v.sqlTextOrProcedure)(i),E={};o._dbSemconvStability&Ls.SemconvStability.OLD&&(E[Ya.ATTR_DB_SYSTEM]=Ya.DB_SYSTEM_VALUE_MSSQL,E[Ya.ATTR_DB_NAME]=_,E[Ya.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,E[Ya.ATTR_DB_STATEMENT]=m,E[Ya.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&Ls.SemconvStability.STABLE&&(E[Nu.ATTR_DB_NAMESPACE]=_,E[Nu.ATTR_DB_SYSTEM_NAME]=Nu.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,E[Nu.ATTR_DB_QUERY_TEXT]=m,E[Nu.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&Ls.SemconvStability.OLD&&(E[Ya.ATTR_NET_PEER_NAME]=this.config?.server,E[Ya.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&Ls.SemconvStability.STABLE&&(E[Nu.ATTR_SERVER_ADDRESS]=this.config?.server,E[Nu.ATTR_SERVER_PORT]=this.config?.options?.port);let T=o.tracer.startSpan((0,W7.getSpanName)(e,_,m,i.table),{kind:od.SpanKind.CLIENT,attributes:E}),A=(0,W7.once)(v=>{i.removeListener("done",d),i.removeListener("doneInProc",d),i.removeListener("doneProc",f),i.removeListener("error",A),this.removeListener("end",A),T.setAttribute("tedious.procedure_count",a),T.setAttribute("tedious.statement_count",c),v&&T.setStatus({code:od.SpanStatusCode.ERROR,message:v.message}),T.end()});i.on("done",d),i.on("doneInProc",d),i.on("doneProc",f),i.once("error",A),this.on("end",A),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(A)):o._diag.error("Expected request.callback to be a function");let y=()=>od.context.with(od.trace.setSpan(od.context.active(),T),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return y();let M=o._buildTraceparent(T);o._injectContextInfo(this,n,M).finally(y)}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)}}};Wa.TediousInstrumentation=nx});var J7=R(kR=>{"use strict";p();u();l();Object.defineProperty(kR,"__esModule",{value:!0});kR.TediousInstrumentation=void 0;var DBe=Q7();Object.defineProperty(kR,"TediousInstrumentation",{enumerable:!0,get:function(){return DBe.TediousInstrumentation}})});var Z7,wBe,eee,tee,UBe,nee,ree=S(()=>{p();u();l();Z7=B(J7(),1);te();xe();wBe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),eee="Tedious",tee=X(eee,()=>new Z7.TediousInstrumentation({})),UBe=(()=>{let t;return{name:eee,setupOnce(){let e=tee();t=l_(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=se(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";wBe.has(s)&&n.setAttribute(pe,"auto.db.otel.tedious")}))}}}),nee=UBe});var oee=R(sd=>{"use strict";p();u();l();Object.defineProperty(sd,"__esModule",{value:!0});sd.PACKAGE_NAME=sd.PACKAGE_VERSION=void 0;sd.PACKAGE_VERSION="0.53.0";sd.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var iee=R(BR=>{"use strict";p();u();l();Object.defineProperty(BR,"__esModule",{value:!0});BR.GenericPoolInstrumentation=void 0;var id=(w(),x(j)),Ou=de(),see=oee(),rx="generic-pool",ox=class extends Ou.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(see.PACKAGE_NAME,see.PACKAGE_VERSION,e)}init(){return[new Ou.InstrumentationNodeModuleDefinition(rx,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,Ou.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 Ou.InstrumentationNodeModuleDefinition(rx,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,Ou.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 Ou.InstrumentationNodeModuleDefinition(rx,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,Ou.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=id.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return id.context.with(id.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=id.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return id.context.with(id.trace.setSpan(i,a),()=>{e.call(this,(c,d)=>{if(a.end(),o)return o(c,d)},s)})}}};BR.GenericPoolInstrumentation=ox});var aee=R(GR=>{"use strict";p();u();l();Object.defineProperty(GR,"__esModule",{value:!0});GR.GenericPoolInstrumentation=void 0;var kBe=iee();Object.defineProperty(GR,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return kBe.GenericPoolInstrumentation}})});var cee,uee,lee,BBe,pee,dee=S(()=>{p();u();l();cee=B(aee(),1);te();xe();uee="GenericPool",lee=X(uee,()=>new cee.GenericPoolInstrumentation({})),BBe=(()=>{let t;return{name:uee,setupOnce(){let e=lee();t=l_(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=se(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(pe,"auto.db.otel.generic_pool")}))}}}),pee=BBe});var sx=R(Ds=>{"use strict";p();u();l();Object.defineProperty(Ds,"__esModule",{value:!0});Ds.ATTR_NET_PEER_PORT=Ds.ATTR_NET_PEER_NAME=Ds.ATTR_MESSAGING_SYSTEM=Ds.ATTR_MESSAGING_OPERATION=void 0;Ds.ATTR_MESSAGING_OPERATION="messaging.operation";Ds.ATTR_MESSAGING_SYSTEM="messaging.system";Ds.ATTR_NET_PEER_NAME="net.peer.name";Ds.ATTR_NET_PEER_PORT="net.peer.port"});var ix=R(gt=>{"use strict";p();u();l();Object.defineProperty(gt,"__esModule",{value:!0});gt.ATTR_MESSAGING_CONVERSATION_ID=gt.OLD_ATTR_MESSAGING_MESSAGE_ID=gt.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=gt.ATTR_MESSAGING_URL=gt.ATTR_MESSAGING_PROTOCOL_VERSION=gt.ATTR_MESSAGING_PROTOCOL=gt.MESSAGING_OPERATION_VALUE_PROCESS=gt.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=gt.ATTR_MESSAGING_DESTINATION_KIND=gt.ATTR_MESSAGING_DESTINATION=void 0;gt.ATTR_MESSAGING_DESTINATION="messaging.destination";gt.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";gt.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";gt.MESSAGING_OPERATION_VALUE_PROCESS="process";gt.ATTR_MESSAGING_PROTOCOL="messaging.protocol";gt.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";gt.ATTR_MESSAGING_URL="messaging.url";gt.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";gt.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";gt.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var ax=R(bu=>{"use strict";p();u();l();Object.defineProperty(bu,"__esModule",{value:!0});bu.DEFAULT_CONFIG=bu.EndOperation=void 0;var GBe;(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"})(GBe=bu.EndOperation||(bu.EndOperation={}));bu.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var hee=R(Tt=>{"use strict";p();u();l();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.isConfirmChannelTracing=Tt.unmarkConfirmChannelTracing=Tt.markConfirmChannelTracing=Tt.getConnectionAttributesFromUrl=Tt.getConnectionAttributesFromServer=Tt.normalizeExchange=Tt.CONNECTION_ATTRIBUTES=Tt.CHANNEL_CONSUME_TIMEOUT_TIMER=Tt.CHANNEL_SPANS_NOT_ENDED=Tt.MESSAGE_STORED_SPAN=void 0;var cx=(w(),x(j)),Ka=de(),jR=(ye(),x(Ge)),Om=sx(),HR=ix();Tt.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");Tt.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");Tt.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");Tt.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var ux=(0,cx.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),jBe=t=>t!==""?t:"<default>";Tt.normalizeExchange=jBe;var HBe=t=>t.replace(/:[^:@/]*@/,":***@"),fee=(t,e)=>t||(e==="AMQP"?5672:5671),_ee=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},mee=t=>t||"localhost",ws=(t,e,n,r)=>n?{[e]:n}:(cx.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),FBe=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Om.ATTR_MESSAGING_SYSTEM]:e}:{}};Tt.getConnectionAttributesFromServer=FBe;var $Be=(t,e)=>{let n={[HR.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=_ee(r?.protocol);Object.assign(n,{...ws(t,HR.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=mee(r?.hostname);e&Ka.SemconvStability.OLD&&Object.assign(n,{...ws(t,Om.ATTR_NET_PEER_NAME,s,"hostname")}),e&Ka.SemconvStability.STABLE&&Object.assign(n,{...ws(t,jR.ATTR_SERVER_ADDRESS,s,"hostname")});let i=fee(r.port,o);e&Ka.SemconvStability.OLD&&Object.assign(n,ws(t,Om.ATTR_NET_PEER_PORT,i,"port")),e&Ka.SemconvStability.STABLE&&Object.assign(n,ws(t,jR.ATTR_SERVER_PORT,i,"port"))}else{let r=HBe(t);n[HR.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=_ee(o.protocol);Object.assign(n,{...ws(r,HR.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=mee(o.hostname);e&Ka.SemconvStability.OLD&&Object.assign(n,{...ws(r,Om.ATTR_NET_PEER_NAME,i,"hostname")}),e&Ka.SemconvStability.STABLE&&Object.assign(n,{...ws(r,jR.ATTR_SERVER_ADDRESS,i,"hostname")});let a=fee(o.port?parseInt(o.port):void 0,s);e&Ka.SemconvStability.OLD&&Object.assign(n,ws(r,Om.ATTR_NET_PEER_PORT,a,"port")),e&Ka.SemconvStability.STABLE&&Object.assign(n,ws(r,jR.ATTR_SERVER_PORT,a,"port"))}catch(o){cx.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};Tt.getConnectionAttributesFromUrl=$Be;var VBe=t=>t.setValue(ux,!0);Tt.markConfirmChannelTracing=VBe;var qBe=t=>t.deleteValue(ux);Tt.unmarkConfirmChannelTracing=qBe;var YBe=t=>t.getValue(ux)===!0;Tt.isConfirmChannelTracing=YBe});var Eee=R(ad=>{"use strict";p();u();l();Object.defineProperty(ad,"__esModule",{value:!0});ad.PACKAGE_NAME=ad.PACKAGE_VERSION=void 0;ad.PACKAGE_VERSION="0.57.0";ad.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var Tee=R(VR=>{"use strict";p();u();l();Object.defineProperty(VR,"__esModule",{value:!0});VR.AmqplibInstrumentation=void 0;var lt=(w(),x(j)),FR=ke(),Le=de(),WBe=sx(),Br=ix(),nr=ax(),St=hee(),gee=Eee(),$R=[">=0.5.5 <1"],lx=class extends Le.InstrumentationBase{_netSemconvStability;constructor(e={}){super(gee.PACKAGE_NAME,gee.PACKAGE_VERSION,{...nr.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Le.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...nr.DEFAULT_CONFIG,...e})}init(){let e=new Le.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",$R,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Le.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",$R,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Le.InstrumentationNodeModuleFile("amqplib/lib/connect.js",$R,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Le.InstrumentationNodeModuleDefinition("amqplib",$R,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Le.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Le.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Le.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Le.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Le.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,nr.EndOperation.Ack)),(0,Le.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,nr.EndOperation.Nack)),(0,Le.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,nr.EndOperation.Reject)),(0,Le.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,nr.EndOperation.AckAll)),(0,Le.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,nr.EndOperation.NackAll)),(0,Le.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Le.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Le.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Le.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Le.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Le.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Le.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Le.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Le.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Le.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Le.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,St.getConnectionAttributesFromUrl)(o,n._netSemconvStability),f=(0,St.getConnectionAttributesFromServer)(c);c[St.CONNECTION_ATTRIBUTES]={...d,...f}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,nr.EndOperation.ChannelClosed,void 0);let s=this[St.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[St.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,nr.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===nr.EndOperation.Reject?a:c,_=d[St.CHANNEL_SPANS_NOT_ENDED]??[],m=_.findIndex(E=>E.msg===i);if(m<0)o.endConsumerSpan(i,e,n,f);else if(n!==nr.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,St.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:f}=r.getConfig();if(f){let _=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},f);_.unref(),c[St.CHANNEL_CONSUME_TIMEOUT_TIMER]=_}c[St.CHANNEL_SPANS_NOT_ENDED]=[]}let d=function(f){if(!f)return i.call(this,f);let _=f.properties.headers??{},m=lt.propagation.extract(lt.ROOT_CONTEXT,_),E=f.fields?.exchange,T;if(r._config.useLinksForConsume){let I=m?lt.trace.getSpan(m)?.spanContext():void 0;m=void 0,I&&(T=[{context:I}])}let A=r.tracer.startSpan(`${s} process`,{kind:lt.SpanKind.CONSUMER,attributes:{...c?.connection?.[St.CONNECTION_ATTRIBUTES],[Br.ATTR_MESSAGING_DESTINATION]:E,[Br.ATTR_MESSAGING_DESTINATION_KIND]:Br.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Br.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:f.fields?.routingKey,[WBe.ATTR_MESSAGING_OPERATION]:Br.MESSAGING_OPERATION_VALUE_PROCESS,[Br.OLD_ATTR_MESSAGING_MESSAGE_ID]:f?.properties.messageId,[Br.ATTR_MESSAGING_CONVERSATION_ID]:f?.properties.correlationId},links:T},m),{consumeHook:y}=r.getConfig();y&&(0,Le.safeExecuteInTheMiddle)(()=>y(A,{moduleVersion:e,msg:f}),I=>{I&&lt.diag.error("amqplib instrumentation: consumerHook error",I)},!0),a?.noAck||(c[St.CHANNEL_SPANS_NOT_ENDED].push({msg:f,timeOfConsume:(0,FR.hrTime)()}),f[St.MESSAGE_STORED_SPAN]=A);let O=m||lt.ROOT_CONTEXT;lt.context.with(lt.trace.setSpan(O,A),()=>{i.call(this,f)}),a?.noAck&&(r.callConsumeEndHook(A,f,!1,nr.EndOperation.AutoAck),A.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,Le.safeExecuteInTheMiddle)(()=>E(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:m,isConfirmChannel:!0}),O=>{O&&lt.diag.error("amqplib instrumentation: publishHook error",O)},!0);let T=function(O,I){try{d?.call(this,O,I)}finally{let{publishConfirmHook:M}=r.getConfig();M&&(0,Le.safeExecuteInTheMiddle)(()=>M(_,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:O}),v=>{v&&lt.diag.error("amqplib instrumentation: publishConfirmHook error",v)},!0),O&&_.setStatus({code:lt.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),_.end()}},A=(0,St.markConfirmChannelTracing)(lt.context.active()),y=[...arguments];return y[3]=m,y[4]=lt.context.bind((0,St.unmarkConfirmChannelTracing)(lt.trace.setSpan(A,_)),T),lt.context.with(A,n.bind(this,...y))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,St.isConfirmChannelTracing)(lt.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,Le.safeExecuteInTheMiddle)(()=>m(f,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!1}),A=>{A&&lt.diag.error("amqplib instrumentation: publishHook error",A)},!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,St.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:lt.SpanKind.PRODUCER,attributes:{...o.connection[St.CONNECTION_ATTRIBUTES],[Br.ATTR_MESSAGING_DESTINATION]:n,[Br.ATTR_MESSAGING_DESTINATION_KIND]:Br.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Br.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[Br.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[Br.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},lt.propagation.inject(lt.trace.setSpan(lt.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[St.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:lt.SpanStatusCode.ERROR,message:r!==nr.EndOperation.ChannelClosed&&r!==nr.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[St.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[St.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[St.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Le.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&lt.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,FR.hrTime)(),r=e[St.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,FR.hrTimeDuration)(i.timeOfConsume,n);if((0,FR.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,nr.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};VR.AmqplibInstrumentation=lx});var Aee=R(za=>{"use strict";p();u();l();Object.defineProperty(za,"__esModule",{value:!0});za.EndOperation=za.DEFAULT_CONFIG=za.AmqplibInstrumentation=void 0;var KBe=Tee();Object.defineProperty(za,"AmqplibInstrumentation",{enumerable:!0,get:function(){return KBe.AmqplibInstrumentation}});var See=ax();Object.defineProperty(za,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return See.DEFAULT_CONFIG}});Object.defineProperty(za,"EndOperation",{enumerable:!0,get:function(){return See.EndOperation}})});var Ree,yee,zBe,Iee,XBe,Nee,Oee=S(()=>{p();u();l();Ree=B(Aee(),1);xe();yee="Amqplib",zBe={consumeEndHook:t=>{Be(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Be(t,"auto.amqplib.otel.publisher")}},Iee=X(yee,()=>new Ree.AmqplibInstrumentation(zBe)),XBe=(()=>({name:yee,setupOnce(){Iee()}})),Nee=XBe});var bm,px=S(()=>{p();u();l();bm="VercelAI"});function JBe(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 ZBe(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(JBe(n)){let r=cC(n.toolCallId);if(r){let o=r.spanContext();ro(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"),_e(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}),uC(n.toolCallId)}else ro(o=>{o.setTag("vercel.ai.tool.name",n.toolName),o.setTag("vercel.ai.tool.callId",n.toolCallId),o.setLevel("error"),_e(n.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}}function eGe(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 YR,QBe,bee,qR,Cee=S(()=>{p();u();l();YR=B(de(),1);te();px();QBe=[">=3.0.0 <7"],bee=["generateText","streamText","generateObject","streamObject","embed","embedMany"];qR=class t extends YR.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",Ie,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new YR.InstrumentationNodeModuleDefinition("ai",QBe,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(bm),_=f?.options,m=f?!!d?.getOptions().sendDefaultPii:!1,{recordInputs:E,recordOutputs:T}=eGe(_,a,c,m);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:E,recordOutputs:T},Mr(()=>Reflect.apply(o,s,i),A=>{A&&typeof A=="object"&&xt(A,"_sentry_active_span",so())},()=>{},A=>{ZBe(A)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of bee)e[r]=n(e[r]);return e}else{let r=bee.reduce((o,s)=>(o[s]=n(e[s]),o),{});return{...e,...r}}}}});function tGe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var Pee,nGe,Mee,vee=S(()=>{p();u();l();te();xe();px();Cee();Pee=X(bm,()=>new qR({}));nGe=((t={})=>{let e;return{name:bm,options:t,setupOnce(){e=Pee()},afterAllSetup(n){t.force??tGe(n)?nT(n):e?.callWhenPatched(()=>nT(n))}}}),Mee=nGe});var KR,rGe,WR,xee=S(()=>{p();u();l();KR=B(de(),1);te();rGe=[">=4.0.0 <7"],WR=class extends KR.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",Ie,e)}init(){return new KR.InstrumentationNodeModuleDefinition("openai",rGe,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(Jc(ga))return Reflect.construct(r,i);let a=Reflect.construct(r,i),d=!!q()?.getOptions().sendDefaultPii,f=o.recordInputs??d,_=o.recordOutputs??d;return iT(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 Lee,oGe,Dee,wee=S(()=>{p();u();l();te();xe();xee();Lee=X(ga,t=>new WR(t)),oGe=((t={})=>({name:ga,setupOnce(){Lee(t)}})),Dee=oGe});var XR,sGe,zR,Uee=S(()=>{p();u();l();XR=B(de(),1);te();sGe=[">=0.19.2 <1.0.0"],zR=class extends XR.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",Ie,e)}init(){return new XR.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",sGe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Jc(Ta))return Reflect.construct(n,s);let i=Reflect.construct(n,s),c=!!q()?.getOptions().sendDefaultPii,d=r.recordInputs??c,f=r.recordOutputs??c;return mC(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 kee,iGe,Bee,Gee=S(()=>{p();u();l();te();xe();Uee();kee=X(Ta,t=>new zR(t)),iGe=((t={})=>({name:Ta,options:t,setupOnce(){kee(t)}})),Bee=iGe});var cd,jee,QR,Hee=S(()=>{p();u();l();cd=B(de(),1);te();jee=[">=0.10.0 <2"],QR=class extends cd.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",Ie,e)}init(){return new cd.InstrumentationNodeModuleDefinition("@google/genai",jee,n=>this._patch(n),n=>n,[new cd.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",jee,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(Jc(Sa))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 TC(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 c_(e,"GoogleGenAI",o),e}}});var Fee,aGe,$ee,Vee=S(()=>{p();u();l();te();xe();Hee();Fee=X(Sa,t=>new QR(t)),aGe=((t={})=>({name:Sa,setupOnce(){Fee(t)}})),$ee=aGe});function cGe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function uGe(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=cGe(c,e);return a.callbacks=d,Reflect.apply(r,o,s)}})}var Xa,JR,ZR,qee=S(()=>{p();u();l();Xa=B(de(),1);te();JR=[">=0.1.0 <2.0.0"];ZR=class extends Xa.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",Ie,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 Xa.InstrumentationNodeModuleDefinition(r,JR,this._patch.bind(this),o=>o,[new Xa.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,JR,this._patch.bind(this),o=>o)]));return e.push(new Xa.InstrumentationNodeModuleDefinition("langchain",JR,this._patch.bind(this),r=>r,[new Xa.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",JR,this._patch.bind(this),r=>r)])),e}_patch(e){Gb([ga,Ta,Sa]);let r=!!q()?.getOptions().sendDefaultPii,o=this.getConfig(),s=o?.recordInputs??r,i=o?.recordOutputs??r,a=pT({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]=uGe(d,n))}}}});var Yee,lGe,Wee,Kee=S(()=>{p();u();l();te();xe();qee();Yee=X(cT,t=>new ZR(t)),lGe=((t={})=>({name:cT,setupOnce(){Yee(t)}})),Wee=lGe});var ud,zee,ey,Xee=S(()=>{p();u();l();ud=B(de(),1);te();zee=[">=0.0.0 <2.0.0"],ey=class extends ud.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",Ie,e)}init(){return new ud.InstrumentationNodeModuleDefinition("@langchain/langgraph",zee,this._patch.bind(this),n=>n,[new ud.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",zee,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=yC(c.prototype.compile,a)}return e}}});var Qee,pGe,Jee,Zee=S(()=>{p();u();l();te();xe();Xee();Qee=X(dT,t=>new ey(t)),pGe=((t={})=>({name:dT,setupOnce(){Qee(t)}})),Jee=pGe});function nte(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=f=>{(0,gi.safeExecuteInTheMiddle)(()=>a(f),_=>{_&&Hn.error(_?.message)},!0)});let c=new gi.InstrumentationNodeModuleDefinition("@firebase/firestore",e,f=>ete(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 gi.InstrumentationNodeModuleFile(f,e,_=>ete(_,n,r,t,i),_=>rte(_,r)));return c}function ete(t,e,n,r,o){return rte(t,n),e(t,"addDoc",dGe(r,o)),e(t,"getDocs",_Ge(r,o)),e(t,"setDoc",mGe(r,o)),e(t,"deleteDoc",fGe(r,o)),t}function rte(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,gi.isWrapped)(t[n])&&e(t,n);return t}function dGe(t,e){return function(r){return function(o,s){let i=ny(t,"addDoc",o);return e(i),ty(i,()=>r(o,s))}}}function fGe(t,e){return function(r){return function(o){let s=ny(t,"deleteDoc",o.parent||o);return e(s),ty(s,()=>r(o))}}}function _Ge(t,e){return function(r){return function(o){let s=ny(t,"getDocs",o);return e(s),ty(s,()=>r(o))}}}function mGe(t,e){return function(r){return function(o,s,i){let a=ny(t,"setDoc",o.parent||o);return e(a),ty(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function ty(t,e){return V.with(ue.setSpan(V.active(),t),()=>(0,gi.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function ny(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ye.CLIENT});return EGe(r,n),r.setAttribute(il,e),r}function hGe(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(tte.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 EGe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[xN]:e.path,[nf]:n.name,[Hi]:"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}=hGe(s);a&&(i[rf]=a),c&&(i[of]=c),t.setAttributes(i)}var tte,gi,ote=S(()=>{p();u();l();tte=B(require("node:net"),1);w();gi=B(de(),1);ye()});function ste(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,Ti.safeExecuteInTheMiddle)(()=>d(m,E),T=>{T&&Hn.error(T?.message)},!0)}),typeof c=="function"&&(s=m=>{(0,Ti.safeExecuteInTheMiddle)(()=>c(m),E=>{E&&Hn.error(E?.message)},!0)});let f=new Ti.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 Ti.InstrumentationNodeModuleFile(m,e,T=>gGe(T,n,r,t,{requestHook:s,responseHook:i,errorHook:a},E),T=>ite(T,r)))}),f}function rr(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:Ye.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(ue.setSpan(V.active(),_),async()=>{let E,T;try{T=await i.apply(this,d)}catch(A){E=A}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 gGe(t,e,n,r,o,s){switch(ite(t,n),s){case"function":e(t,"onRequest",rr(r,o,"http.request")),e(t,"onCall",rr(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",rr(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",rr(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",rr(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",rr(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",rr(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",rr(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",rr(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",rr(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",rr(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",rr(r,o,"storage.object.finalized")),e(t,"onObjectArchived",rr(r,o,"storage.object.archived")),e(t,"onObjectDeleted",rr(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",rr(r,o,"storage.object.metadataUpdated"));break}return t}function ite(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,Ti.isWrapped)(t[r])&&e(t,r);return t}var Ti,ate=S(()=>{p();u();l();w();Ti=B(de(),1)});var ute,cte,TGe,SGe,ry,lte=S(()=>{p();u();l();ute=B(de(),1);te();ote();ate();cte={},TGe=[">=3.0.0 <5"],SGe=[">=6.0.0 <7"],ry=class extends ute.InstrumentationBase{constructor(e=cte){super("@sentry/instrumentation-firebase",Ie,e)}setConfig(e={}){super.setConfig({...cte,...e})}init(){let e=[];return e.push(nte(this.tracer,TGe,this._wrap,this._unwrap,this.getConfig())),e.push(ste(this.tracer,SGe,this._wrap,this._unwrap,this.getConfig())),e}}});var pte,AGe,dte,RGe,fte,_te=S(()=>{p();u();l();te();xe();lte();pte="Firebase",AGe={firestoreSpanCreationHook:t=>{Be(t,"auto.firebase.otel.firestore"),t.setAttribute(fe,"db.query")},functions:{requestHook:t=>{Be(t,"auto.firebase.otel.functions"),t.setAttribute(fe,"http.request")},errorHook:async(t,e)=>{e&&(_e(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await wg(2e3))}}},dte=X(pte,()=>new ry(AGe)),RGe=(()=>({name:pte,setupOnce(){dte()}})),fte=RGe});function mte(){return[oX(),QX(),IQ(),f7(),p8(),O8(),B8(),X8(),CJ(),zJ(),KZ(),c7(),P7(),F7(),nee(),pee(),HQ(),Nee(),JQ(),Wee(),Jee(),Mee(),Dee(),Bee(),$ee(),eZ(),fte()]}var hte=S(()=>{p();u();l();Oee();Gee();$7();sX();eQ();_te();dee();Vee();OQ();u7();_7();FQ();M7();Kee();Zee();ZQ();d8();b8();G8();Q8();wee();XJ();tZ();zZ();PJ();ree();vee()});function gte(t,e={}){t.getOptions().debug&&_M();let[n,r]=yGe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function yGe(t,e={}){let n=new Ete.BasicTracerProvider({sampler:new xS(t),resource:(0,oy.defaultResource)().merge((0,oy.resourceFromAttributes)({[br]:"node",[vN]:"sentry",[LN]:Ie})),forceFlushTimeoutMillis:500,spanProcessors:[new vS({timeout:IGe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});ue.setGlobalTracerProvider(n),Fn.setGlobalPropagator(new MS);let r=new fM;return V.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function IGe(t){if(t!=null){if(t>dx)return ht&&N.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${dx}`),dx;if(t<=0||Number.isNaN(t)){ht&&N.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}var oy,Ete,dx,Tte=S(()=>{p();u();l();w();oy=B(uP(),1),Ete=B(DP(),1);ye();te();xe();Na();Eu();dx=1e6});function Ste(){return zS().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(k_(),$6())}function Ate(t){return[...Ste(),...Ct(t)?mte():[]]}function fx(t={}){return NGe(t,Ate)}function NGe(t={},e){Zc(t,"node");let n=gM({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(gte(n,{spanProcessors:t.openTelemetrySpanProcessors}),TM()),n}var Rte=S(()=>{p();u();l();te();xe();AM();V6();hte();Tte()});var yte=S(()=>{p();u();l();AM();Rte();te()});var Ite,Nte=S(()=>{"use strict";p();u();l();Ite="https://1188a86f3f8168f089450587b00bca66@o1.ingest.us.sentry.io/4510776311808000"});async function Ote(t){let e=process.env.SENTRY_CLI_NO_TELEMETRY!=="1",n=bGe(e);if(!n?.getOptions().enabled)return t();Fl(),kg();try{return await vr({name:"cli-execution",op:"cli.command"},async()=>t())}catch(r){_e(r);let o=ve().getSession();throw o&&(o.status="crashed"),r}finally{aa();try{await n.flush(3e3)}catch{}}}function bGe(t){let r=fx({dsn:Ite,enabled:t,defaultIntegrations:!1,integrations:[k_()],environment:"production",tracesSampleRate:1,sampleRate:1,release:"0.4.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){ia("platform",process.platform),ia("arch",process.arch);let o=typeof process.versions.bun<"u"?"bun":"node";ia("runtime",o),ia("runtime.version",process.version)}return r}function bte(t){let e=so();e&&e.updateName(t),ia("command",t)}var _x=S(()=>{"use strict";p();u();l();yte();Nte()});var Pte={};Ai(Pte,{buildContext:()=>mx});function mx(t){let e={process:t,env:t.env,cwd:t.cwd(),homeDir:(0,Cte.homedir)(),configDir:Ci(),stdout:t.stdout,stderr:t.stderr,stdin:t.stdin};return{...e,forCommand:({prefix:n})=>(bte(n.join(".")),e)}}var Cte,hx=S(()=>{"use strict";p();u();l();Cte=require("node:os");bo();_x()});var Mte,vte=S(()=>{"use strict";p();u();l();it();kU();Mte=De({docs:{brief:"Display help for a command",fullDescription:"Display help information. Run 'sentry help' for an overview, or 'sentry help <command>' for detailed help on a specific command."},parameters:{flags:{},positional:{kind:"array",parameter:{brief:"Command to get help for",parse:String,placeholder:"command"}}},async func(t,...e){let{stdout:n}=this;if(e.length===0){await UU(n);return}let{app:r}=await Promise.resolve().then(()=>(Bh(),xte)),{buildContext:o}=await Promise.resolve().then(()=>(hx(),Pte));await Hm(r,[...e,"--helpAll"],o(this.process))}})});async function Lte(t,e){let n=Ze(),r=Date.now();n.exec("BEGIN TRANSACTION");try{n.query("DELETE FROM project_aliases").run();let o=n.query(`
340
340
  INSERT INTO project_aliases
341
341
  (alias, org_slug, project_slug, dsn_fingerprint, cached_at, last_accessed)
342
342
  VALUES (?, ?, ?, ?, ?, ?)
@@ -483,7 +483,7 @@ The organization and project are resolved from:
483
483
 
484
484
  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 tl({org:t.org,project:e,cwd:r,usageHint:"sentry project view <project-slug> --org <org-slug>"});if(o.length===0)throw une(i);if(t.web){await uje(n,o);return}let{projects:a,targets:c}=await pje(o);if(a.length===0)throw une();if(t.json){Xt(n,a.length===1?a[0]:a);return}let d=a[0],f=c[0];a.length===1&&d?Rh(n,d,{json:!1,formatHuman:CI,detectedFrom:f?.detectedFrom}):dje(n,a,c),s&&n.write(`
485
485
  ${s}
486
- `)}})});var dne,fne=S(()=>{"use strict";p();u();l();it();cne();pne();dne=Hr({routes:{list:ane,view:lne},docs:{brief:"Work with Sentry projects",fullDescription:"List and manage Sentry projects in your organizations.",hideRoute:{}}})});var xte={};Ai(xte,{CLI_VERSION:()=>_ne,app:()=>Ix,routes:()=>kh});var kh,_ne,Ix,Bh=S(()=>{"use strict";p();u();l();it();T0();Gw();wU();vte();Zte();sne();fne();kh=Hr({routes:{help:Mte,auth:Bw,org:one,project:dne,issue:Jte,event:DU,api:g0},defaultCommand:"help",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."}}),_ne="0.4.0",Ix=OL(kh,{name:"sentry",versionInfo:{currentVersion:_ne}})});var mje={};Ai(mje,{default:()=>_je});module.exports=x(mje);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]="8a42eb8c-f13d-4f59-8017-2591fd4cf31a",t._sentryDebugIdIdentifier="sentry-dbid-8a42eb8c-f13d-4f59-8017-2591fd4cf31a")}catch{}})();p();u();l();it();Bh();hx();zt();Ir();_x();async function fje(){let t=process.argv.slice(2);try{await Ote(async()=>Hm(Ix,t,mx(process)))}catch(e){process.stderr.write(`${Eh("Error:")} ${sI(e)}
486
+ `)}})});var dne,fne=S(()=>{"use strict";p();u();l();it();cne();pne();dne=Hr({routes:{list:ane,view:lne},docs:{brief:"Work with Sentry projects",fullDescription:"List and manage Sentry projects in your organizations.",hideRoute:{}}})});var xte={};Ai(xte,{CLI_VERSION:()=>_ne,app:()=>Ix,routes:()=>kh});var kh,_ne,Ix,Bh=S(()=>{"use strict";p();u();l();it();T0();Gw();wU();vte();Zte();sne();fne();kh=Hr({routes:{help:Mte,auth:Bw,org:one,project:dne,issue:Jte,event:DU,api:g0},defaultCommand:"help",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."}}),_ne="0.4.2",Ix=OL(kh,{name:"sentry",versionInfo:{currentVersion:_ne}})});var mje={};Ai(mje,{default:()=>_je});module.exports=x(mje);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]="fb111e87-678f-4747-84d0-56f4c8caa213",t._sentryDebugIdIdentifier="sentry-dbid-fb111e87-678f-4747-84d0-56f4c8caa213")}catch{}})();p();u();l();it();Bh();hx();zt();Ir();_x();async function fje(){let t=process.argv.slice(2);try{await Ote(async()=>Hm(Ix,t,mx(process)))}catch(e){process.stderr.write(`${Eh("Error:")} ${sI(e)}
487
487
  `),process.exit(iI(e))}}fje();var _je=void 0;
488
488
  /*! Bundled license information:
489
489