@tanagram/lore 0.1.6 → 0.1.8
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.
- package/dist/index.js +56 -21
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,34 +1,69 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var nn=Object.defineProperty;var sn=(r,t)=>{for(var n in t)nn(r,n,{get:t[n],enumerable:!0})};import{pathToFileURL as Pc}from"node:url";var an=/\d/,on=["-","_","/","."];function cn(r=""){if(!an.test(r))return r!==r.toLowerCase()}function It(r,t){let n=t??on,s=[];if(!r||typeof r!="string")return s;let a="",o,c;for(let i of r){let d=n.includes(i);if(d===!0){s.push(a),a="",o=void 0;continue}let p=cn(i);if(c===!1){if(o===!1&&p===!0){s.push(a),a=i,o=p;continue}if(o===!0&&p===!1&&a.length>1){let u=a.at(-1);s.push(a.slice(0,Math.max(0,a.length-1))),a=u+i,o=p;continue}}a+=i,o=p,c=d}return s.push(a),s}function ln(r){return r?r[0].toUpperCase()+r.slice(1):""}function dn(r){return r?r[0].toLowerCase()+r.slice(1):""}function pn(r,t){return r?(Array.isArray(r)?r:It(r)).map(n=>ln(t?.normalize?n.toLowerCase():n)).join(""):""}function Be(r,t){return dn(pn(r||"",t))}function Ze(r,t){return r?(Array.isArray(r)?r:It(r)).map(n=>n.toLowerCase()).join(t??"-"):""}function Lt(r){return Ze(r||"","_")}import{parseArgs as mn}from"node:util";function Je(r){return Array.isArray(r)?r:r===void 0?[]:[r]}function mt(r,t=""){let n=[];for(let s of r)for(let[a,o]of s.entries())n[a]=Math.max(n[a]||0,o.length);return r.map(s=>s.map((a,o)=>t+a[o===0?"padStart":"padEnd"](n[o])).join(" ")).join(`
|
|
3
|
-
`)
|
|
4
|
-
`)}function ut(r){let t=r.valueHint?`=<${r.valueHint}>`:"",n=t||`=<${Lt(r.name)}>`;return!r.type||r.type==="positional"||r.type==="boolean"?t:r.type==="enum"&&r.options?.length?`=<${r.options.join("|")}>`:n}function Ut(r,t){let n=t?Qe("(Required)"):"",s=r.default===void 0?"":Qe(`(Default: ${r.default})`);return[r.description,n,s].filter(Boolean).join(" ")}var e={};sn(e,{BRAND:()=>Zn,DIRTY:()=>ce,EMPTY_PATH:()=>kn,INVALID:()=>y,NEVER:()=>Ps,OK:()=>O,ParseStatus:()=>A,Schema:()=>S,ZodAny:()=>re,ZodArray:()=>X,ZodBigInt:()=>de,ZodBoolean:()=>pe,ZodBranded:()=>De,ZodCatch:()=>Se,ZodDate:()=>me,ZodDefault:()=>xe,ZodDiscriminatedUnion:()=>et,ZodEffects:()=>q,ZodEnum:()=>_e,ZodError:()=>N,ZodFirstPartyTypeKind:()=>b,ZodFunction:()=>rt,ZodIntersection:()=>ge,ZodIssueCode:()=>m,ZodLazy:()=>ye,ZodLiteral:()=>be,ZodMap:()=>Oe,ZodNaN:()=>Ie,ZodNativeEnum:()=>ve,ZodNever:()=>F,ZodNull:()=>he,ZodNullable:()=>H,ZodNumber:()=>le,ZodObject:()=>U,ZodOptional:()=>$,ZodParsedType:()=>f,ZodPipeline:()=>qe,ZodPromise:()=>ne,ZodReadonly:()=>ke,ZodRecord:()=>tt,ZodSchema:()=>S,ZodSet:()=>Ee,ZodString:()=>te,ZodSymbol:()=>ze,ZodTransformer:()=>q,ZodTuple:()=>G,ZodType:()=>S,ZodUndefined:()=>ue,ZodUnion:()=>fe,ZodUnknown:()=>Y,ZodVoid:()=>Ae,addIssueToContext:()=>h,any:()=>es,array:()=>ss,bigint:()=>Wn,boolean:()=>Jt,coerce:()=>Cs,custom:()=>Ht,date:()=>Jn,datetimeRegex:()=>Zt,defaultErrorMap:()=>J,discriminatedUnion:()=>cs,effect:()=>vs,enum:()=>ys,function:()=>hs,getErrorMap:()=>Re,getParsedType:()=>Z,instanceof:()=>Hn,intersection:()=>ls,isAborted:()=>Ye,isAsync:()=>Ce,isDirty:()=>Xe,isValid:()=>ee,late:()=>Gn,lazy:()=>fs,literal:()=>gs,makeIssue:()=>$e,map:()=>ms,nan:()=>Qn,nativeEnum:()=>bs,never:()=>rs,null:()=>Xn,nullable:()=>Ss,number:()=>Wt,object:()=>as,objectUtil:()=>ht,oboolean:()=>Rs,onumber:()=>ws,optional:()=>xs,ostring:()=>Ts,pipeline:()=>js,preprocess:()=>ks,promise:()=>_s,quotelessJson:()=>vn,record:()=>ps,set:()=>us,setErrorMap:()=>Sn,strictObject:()=>os,string:()=>Qt,symbol:()=>Kn,transformer:()=>vs,tuple:()=>ds,undefined:()=>Yn,union:()=>is,unknown:()=>ts,util:()=>j,void:()=>ns});var j;(function(r){r.assertEqual=a=>{};function t(a){}r.assertIs=t;function n(a){throw new Error}r.assertNever=n,r.arrayToEnum=a=>{let o={};for(let c of a)o[c]=c;return o},r.getValidEnumValues=a=>{let o=r.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),c={};for(let i of o)c[i]=a[i];return r.objectValues(c)},r.objectValues=a=>r.objectKeys(a).map(function(o){return a[o]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&o.push(c);return o},r.find=(a,o)=>{for(let c of a)if(o(c))return c},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,o=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}r.joinValues=s,r.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(j||(j={}));var ht;(function(r){r.mergeShapes=(t,n)=>({...t,...n})})(ht||(ht={}));var f=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var m=j.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),vn=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),N=class r extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(o){return o.message},s={_errors:[]},a=o=>{for(let c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(a);else if(c.code==="invalid_return_type")a(c.returnTypeError);else if(c.code==="invalid_arguments")a(c.argumentsError);else if(c.path.length===0)s._errors.push(n(c));else{let i=s,d=0;for(;d<c.path.length;){let p=c.path[d];d===c.path.length-1?(i[p]=i[p]||{_errors:[]},i[p]._errors.push(n(c))):i[p]=i[p]||{_errors:[]},i=i[p],d++}}};return a(this),s}static assert(t){if(!(t instanceof r))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,j.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},s=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];n[o]=n[o]||[],n[o].push(t(a))}else s.push(t(a));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}};N.create=r=>new N(r);var xn=(r,t)=>{let n;switch(r.code){case m.invalid_type:r.received===f.undefined?n="Required":n=`Expected ${r.expected}, received ${r.received}`;break;case m.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(r.expected,j.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:n=`Unrecognized key(s) in object: ${j.joinValues(r.keys,", ")}`;break;case m.invalid_union:n="Invalid input";break;case m.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${j.joinValues(r.options)}`;break;case m.invalid_enum_value:n=`Invalid enum value. Expected ${j.joinValues(r.options)}, received '${r.received}'`;break;case m.invalid_arguments:n="Invalid function arguments";break;case m.invalid_return_type:n="Invalid function return type";break;case m.invalid_date:n="Invalid date";break;case m.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(n=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?n=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?n=`Invalid input: must end with "${r.validation.endsWith}"`:j.assertNever(r.validation):r.validation!=="regex"?n=`Invalid ${r.validation}`:n="Invalid";break;case m.too_small:r.type==="array"?n=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?n=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?n=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?n=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?n=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:n="Invalid input";break;case m.too_big:r.type==="array"?n=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?n=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?n=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?n=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?n=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:n="Invalid input";break;case m.custom:n="Invalid input";break;case m.invalid_intersection_types:n="Intersection results could not be merged";break;case m.not_multiple_of:n=`Number must be a multiple of ${r.multipleOf}`;break;case m.not_finite:n="Number must be finite";break;default:n=t.defaultError,j.assertNever(r)}return{message:n}},J=xn;var Dt=J;function Sn(r){Dt=r}function Re(){return Dt}var $e=r=>{let{data:t,path:n,errorMaps:s,issueData:a}=r,o=[...n,...a.path||[]],c={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="",d=s.filter(p=>!!p).slice().reverse();for(let p of d)i=p(c,{data:t,defaultError:i}).message;return{...a,path:o,message:i}},kn=[];function h(r,t){let n=Re(),s=$e({issueData:t,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,n,n===J?void 0:J].filter(a=>!!a)});r.common.issues.push(s)}var A=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let s=[];for(let a of n){if(a.status==="aborted")return y;a.status==="dirty"&&t.dirty(),s.push(a.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){let s=[];for(let a of n){let o=await a.key,c=await a.value;s.push({key:o,value:c})}return r.mergeObjectSync(t,s)}static mergeObjectSync(t,n){let s={};for(let a of n){let{key:o,value:c}=a;if(o.status==="aborted"||c.status==="aborted")return y;o.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof c.value<"u"||a.alwaysSet)&&(s[o.value]=c.value)}return{status:t.value,value:s}}},y=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),O=r=>({status:"valid",value:r}),Ye=r=>r.status==="aborted",Xe=r=>r.status==="dirty",ee=r=>r.status==="valid",Ce=r=>typeof Promise<"u"&&r instanceof Promise;var g;(function(r){r.errToObj=t=>typeof t=="string"?{message:t}:t||{},r.toString=t=>typeof t=="string"?t:t?.message})(g||(g={}));var D=class{constructor(t,n,s,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},qt=(r,t)=>{if(ee(t))return{success:!0,data:t.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new N(r.common.issues);return this._error=n,this._error}}};function x(r){if(!r)return{};let{errorMap:t,invalid_type_error:n,required_error:s,description:a}=r;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(c,i)=>{let{message:d}=r;return c.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??s??i.defaultError}:c.code!=="invalid_type"?{message:i.defaultError}:{message:d??n??i.defaultError}},description:a}}var S=class{get description(){return this._def.description}_getType(t){return Z(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Z(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new A,ctx:{common:t.parent.common,data:t.data,parsedType:Z(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Ce(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,n){let s={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Z(t)},a=this._parseSync({data:t,path:s.path,parent:s});return qt(s,a)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Z(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:n});return ee(s)?{value:s.value}:{issues:n.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>ee(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){let s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,n){let s={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Z(t)},a=this._parse({data:t,path:s.path,parent:s}),o=await(Ce(a)?a:Promise.resolve(a));return qt(s,o)}refine(t,n){let s=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{let c=t(a),i=()=>o.addIssue({code:m.custom,...s(a)});return typeof Promise<"u"&&c instanceof Promise?c.then(d=>d?!0:(i(),!1)):c?!0:(i(),!1)})}refinement(t,n){return this._refinement((s,a)=>t(s)?!0:(a.addIssue(typeof n=="function"?n(s,a):n),!1))}_refinement(t){return new q({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return $.create(this,this._def)}nullable(){return H.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return X.create(this)}promise(){return ne.create(this,this._def)}or(t){return fe.create([this,t],this._def)}and(t){return ge.create(this,t,this._def)}transform(t){return new q({...x(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new xe({...x(this._def),innerType:this,defaultValue:n,typeName:b.ZodDefault})}brand(){return new De({typeName:b.ZodBranded,type:this,...x(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Se({...x(this._def),innerType:this,catchValue:n,typeName:b.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return qe.create(this,t)}readonly(){return ke.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jn=/^c[^\s-]{8,}$/i,Tn=/^[0-9a-z]+$/,wn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Cn=/^[a-z0-9_-]{21}$/i,Pn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,An=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,On="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ft,En=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,In=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Nn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Un=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Bn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ft="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",$n=new RegExp(`^${Ft}$`);function Vt(r){let t="[0-5]\\d";r.precision?t=`${t}\\.\\d{${r.precision}}`:r.precision==null&&(t=`${t}(\\.\\d+)?`);let n=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Dn(r){return new RegExp(`^${Vt(r)}$`)}function Zt(r){let t=`${Ft}T${Vt(r)}`,n=[];return n.push(r.local?"Z?":"Z"),r.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function qn(r,t){return!!((t==="v4"||!t)&&En.test(r)||(t==="v6"||!t)&&Ln.test(r))}function Mn(r,t){if(!Pn.test(r))return!1;try{let[n]=r.split(".");if(!n)return!1;let s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function Fn(r,t){return!!((t==="v4"||!t)&&In.test(r)||(t==="v6"||!t)&&Nn.test(r))}var te=class r extends S{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==f.string){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_type,expected:f.string,received:o.parsedType}),y}let s=new A,a;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="max")t.data.length>o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){let c=t.data.length>o.value,i=t.data.length<o.value;(c||i)&&(a=this._getOrReturnCtx(t,a),c?h(a,{code:m.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&h(a,{code:m.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),s.dirty())}else if(o.kind==="email")An.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"email",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="emoji")ft||(ft=new RegExp(On,"u")),ft.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"emoji",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="uuid")Rn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"uuid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="nanoid")Cn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"nanoid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid")jn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cuid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid2")Tn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cuid2",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="ulid")wn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"ulid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),h(a,{validation:"url",code:m.invalid_string,message:o.message}),s.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"regex",code:m.invalid_string,message:o.message}),s.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),s.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:{startsWith:o.value},message:o.message}),s.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:{endsWith:o.value},message:o.message}),s.dirty()):o.kind==="datetime"?Zt(o).test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:"datetime",message:o.message}),s.dirty()):o.kind==="date"?$n.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:"date",message:o.message}),s.dirty()):o.kind==="time"?Dn(o).test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:"time",message:o.message}),s.dirty()):o.kind==="duration"?zn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"duration",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="ip"?qn(t.data,o.version)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"ip",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="jwt"?Mn(t.data,o.alg)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"jwt",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="cidr"?Fn(t.data,o.version)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cidr",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="base64"?Un.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"base64",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="base64url"?Bn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"base64url",code:m.invalid_string,message:o.message}),s.dirty()):j.assertNever(o);return{status:s.value,value:t.data}}_regex(t,n,s){return this.refinement(a=>t.test(a),{validation:n,code:m.invalid_string,...g.errToObj(s)})}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...g.errToObj(t)})}url(t){return this._addCheck({kind:"url",...g.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...g.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...g.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...g.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...g.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...g.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...g.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...g.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...g.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...g.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...g.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...g.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...g.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...g.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...g.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...g.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...g.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...g.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...g.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...g.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...g.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...g.errToObj(n)})}nonempty(t){return this.min(1,g.errToObj(t))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};te.create=r=>new te({checks:[],typeName:b.ZodString,coerce:r?.coerce??!1,...x(r)});function Vn(r,t){let n=(r.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,a=n>s?n:s,o=Number.parseInt(r.toFixed(a).replace(".","")),c=Number.parseInt(t.toFixed(a).replace(".",""));return o%c/10**a}var le=class r extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==f.number){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_type,expected:f.number,received:o.parsedType}),y}let s,a=new A;for(let o of this._def.checks)o.kind==="int"?j.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),h(s,{code:m.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Vn(t.data,o.value)!==0&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),h(s,{code:m.not_finite,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,g.toString(n))}gt(t,n){return this.setLimit("min",t,!1,g.toString(n))}lte(t,n){return this.setLimit("max",t,!0,g.toString(n))}lt(t,n){return this.setLimit("max",t,!1,g.toString(n))}setLimit(t,n,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:g.toString(a)}]})}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:g.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:g.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:g.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&j.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(t===null||s.value<t)&&(t=s.value)}return Number.isFinite(n)&&Number.isFinite(t)}};le.create=r=>new le({checks:[],typeName:b.ZodNumber,coerce:r?.coerce||!1,...x(r)});var de=class r extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==f.bigint)return this._getInvalidInput(t);let s,a=new A;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return h(n,{code:m.invalid_type,expected:f.bigint,received:n.parsedType}),y}gte(t,n){return this.setLimit("min",t,!0,g.toString(n))}gt(t,n){return this.setLimit("min",t,!1,g.toString(n))}lte(t,n){return this.setLimit("max",t,!0,g.toString(n))}lt(t,n){return this.setLimit("max",t,!1,g.toString(n))}setLimit(t,n,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:g.toString(a)}]})}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:g.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};de.create=r=>new de({checks:[],typeName:b.ZodBigInt,coerce:r?.coerce??!1,...x(r)});var pe=class extends S{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==f.boolean){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.boolean,received:s.parsedType}),y}return O(t.data)}};pe.create=r=>new pe({typeName:b.ZodBoolean,coerce:r?.coerce||!1,...x(r)});var me=class r extends S{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==f.date){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_type,expected:f.date,received:o.parsedType}),y}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_date}),y}let s=new A,a;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),s.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):j.assertNever(o);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:g.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:g.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};me.create=r=>new me({checks:[],coerce:r?.coerce||!1,typeName:b.ZodDate,...x(r)});var ze=class extends S{_parse(t){if(this._getType(t)!==f.symbol){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.symbol,received:s.parsedType}),y}return O(t.data)}};ze.create=r=>new ze({typeName:b.ZodSymbol,...x(r)});var ue=class extends S{_parse(t){if(this._getType(t)!==f.undefined){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.undefined,received:s.parsedType}),y}return O(t.data)}};ue.create=r=>new ue({typeName:b.ZodUndefined,...x(r)});var he=class extends S{_parse(t){if(this._getType(t)!==f.null){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.null,received:s.parsedType}),y}return O(t.data)}};he.create=r=>new he({typeName:b.ZodNull,...x(r)});var re=class extends S{constructor(){super(...arguments),this._any=!0}_parse(t){return O(t.data)}};re.create=r=>new re({typeName:b.ZodAny,...x(r)});var Y=class extends S{constructor(){super(...arguments),this._unknown=!0}_parse(t){return O(t.data)}};Y.create=r=>new Y({typeName:b.ZodUnknown,...x(r)});var F=class extends S{_parse(t){let n=this._getOrReturnCtx(t);return h(n,{code:m.invalid_type,expected:f.never,received:n.parsedType}),y}};F.create=r=>new F({typeName:b.ZodNever,...x(r)});var Ae=class extends S{_parse(t){if(this._getType(t)!==f.undefined){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.void,received:s.parsedType}),y}return O(t.data)}};Ae.create=r=>new Ae({typeName:b.ZodVoid,...x(r)});var X=class r extends S{_parse(t){let{ctx:n,status:s}=this._processInputParams(t),a=this._def;if(n.parsedType!==f.array)return h(n,{code:m.invalid_type,expected:f.array,received:n.parsedType}),y;if(a.exactLength!==null){let c=n.data.length>a.exactLength.value,i=n.data.length<a.exactLength.value;(c||i)&&(h(n,{code:c?m.too_big:m.too_small,minimum:i?a.exactLength.value:void 0,maximum:c?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(h(n,{code:m.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(h(n,{code:m.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((c,i)=>a.type._parseAsync(new D(n,c,n.path,i)))).then(c=>A.mergeArray(s,c));let o=[...n.data].map((c,i)=>a.type._parseSync(new D(n,c,n.path,i)));return A.mergeArray(s,o)}get element(){return this._def.type}min(t,n){return new r({...this._def,minLength:{value:t,message:g.toString(n)}})}max(t,n){return new r({...this._def,maxLength:{value:t,message:g.toString(n)}})}length(t,n){return new r({...this._def,exactLength:{value:t,message:g.toString(n)}})}nonempty(t){return this.min(1,t)}};X.create=(r,t)=>new X({type:r,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...x(t)});function Pe(r){if(r instanceof U){let t={};for(let n in r.shape){let s=r.shape[n];t[n]=$.create(Pe(s))}return new U({...r._def,shape:()=>t})}else return r instanceof X?new X({...r._def,type:Pe(r.element)}):r instanceof $?$.create(Pe(r.unwrap())):r instanceof H?H.create(Pe(r.unwrap())):r instanceof G?G.create(r.items.map(t=>Pe(t))):r}var U=class r extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=j.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==f.object){let p=this._getOrReturnCtx(t);return h(p,{code:m.invalid_type,expected:f.object,received:p.parsedType}),y}let{status:s,ctx:a}=this._processInputParams(t),{shape:o,keys:c}=this._getCached(),i=[];if(!(this._def.catchall instanceof F&&this._def.unknownKeys==="strip"))for(let p in a.data)c.includes(p)||i.push(p);let d=[];for(let p of c){let u=o[p],T=a.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new D(a,T,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof F){let p=this._def.unknownKeys;if(p==="passthrough")for(let u of i)d.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(p==="strict")i.length>0&&(h(a,{code:m.unrecognized_keys,keys:i}),s.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let u of i){let T=a.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new D(a,T,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let u of d){let T=await u.key,w=await u.value;p.push({key:T,value:w,alwaysSet:u.alwaysSet})}return p}).then(p=>A.mergeObjectSync(s,p)):A.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(t){return g.errToObj,new r({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{let a=this._def.errorMap?.(n,s).message??s.defaultError;return n.code==="unrecognized_keys"?{message:g.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(t){return new r({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new r({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:b.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new r({...this._def,catchall:t})}pick(t){let n={};for(let s of j.objectKeys(t))t[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new r({...this._def,shape:()=>n})}omit(t){let n={};for(let s of j.objectKeys(this.shape))t[s]||(n[s]=this.shape[s]);return new r({...this._def,shape:()=>n})}deepPartial(){return Pe(this)}partial(t){let n={};for(let s of j.objectKeys(this.shape)){let a=this.shape[s];t&&!t[s]?n[s]=a:n[s]=a.optional()}return new r({...this._def,shape:()=>n})}required(t){let n={};for(let s of j.objectKeys(this.shape))if(t&&!t[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof $;)o=o._def.innerType;n[s]=o}return new r({...this._def,shape:()=>n})}keyof(){return Gt(j.objectKeys(this.shape))}};U.create=(r,t)=>new U({shape:()=>r,unknownKeys:"strip",catchall:F.create(),typeName:b.ZodObject,...x(t)});U.strictCreate=(r,t)=>new U({shape:()=>r,unknownKeys:"strict",catchall:F.create(),typeName:b.ZodObject,...x(t)});U.lazycreate=(r,t)=>new U({shape:r,unknownKeys:"strip",catchall:F.create(),typeName:b.ZodObject,...x(t)});var fe=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s=this._def.options;function a(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;let c=o.map(i=>new N(i.ctx.common.issues));return h(n,{code:m.invalid_union,unionErrors:c}),y}if(n.common.async)return Promise.all(s.map(async o=>{let c={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:c}),ctx:c}})).then(a);{let o,c=[];for(let d of s){let p={...n,common:{...n.common,issues:[]},parent:null},u=d._parseSync({data:n.data,path:n.path,parent:p});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let i=c.map(d=>new N(d));return h(n,{code:m.invalid_union,unionErrors:i}),y}}get options(){return this._def.options}};fe.create=(r,t)=>new fe({options:r,typeName:b.ZodUnion,...x(t)});var K=r=>r instanceof ye?K(r.schema):r instanceof q?K(r.innerType()):r instanceof be?[r.value]:r instanceof _e?r.options:r instanceof ve?j.objectValues(r.enum):r instanceof xe?K(r._def.innerType):r instanceof ue?[void 0]:r instanceof he?[null]:r instanceof $?[void 0,...K(r.unwrap())]:r instanceof H?[null,...K(r.unwrap())]:r instanceof De||r instanceof ke?K(r.unwrap()):r instanceof Se?K(r._def.innerType):[],et=class r extends S{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==f.object)return h(n,{code:m.invalid_type,expected:f.object,received:n.parsedType}),y;let s=this.discriminator,a=n.data[s],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(h(n,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,s){let a=new Map;for(let o of n){let c=K(o.shape[t]);if(!c.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let i of c){if(a.has(i))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);a.set(i,o)}}return new r({typeName:b.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...x(s)})}};function gt(r,t){let n=Z(r),s=Z(t);if(r===t)return{valid:!0,data:r};if(n===f.object&&s===f.object){let a=j.objectKeys(t),o=j.objectKeys(r).filter(i=>a.indexOf(i)!==-1),c={...r,...t};for(let i of o){let d=gt(r[i],t[i]);if(!d.valid)return{valid:!1};c[i]=d.data}return{valid:!0,data:c}}else if(n===f.array&&s===f.array){if(r.length!==t.length)return{valid:!1};let a=[];for(let o=0;o<r.length;o++){let c=r[o],i=t[o],d=gt(c,i);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return n===f.date&&s===f.date&&+r==+t?{valid:!0,data:r}:{valid:!1}}var ge=class extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t),a=(o,c)=>{if(Ye(o)||Ye(c))return y;let i=gt(o.value,c.value);return i.valid?((Xe(o)||Xe(c))&&n.dirty(),{status:n.value,value:i.data}):(h(s,{code:m.invalid_intersection_types}),y)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,c])=>a(o,c)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ge.create=(r,t,n)=>new ge({left:r,right:t,typeName:b.ZodIntersection,...x(n)});var G=class r extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.array)return h(s,{code:m.invalid_type,expected:f.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return h(s,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(h(s,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...s.data].map((c,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new D(s,c,s.path,i)):null}).filter(c=>!!c);return s.common.async?Promise.all(o).then(c=>A.mergeArray(n,c)):A.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new r({...this._def,rest:t})}};G.create=(r,t)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new G({items:r,typeName:b.ZodTuple,rest:null,...x(t)})};var tt=class r extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.object)return h(s,{code:m.invalid_type,expected:f.object,received:s.parsedType}),y;let a=[],o=this._def.keyType,c=this._def.valueType;for(let i in s.data)a.push({key:o._parse(new D(s,i,s.path,i)),value:c._parse(new D(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?A.mergeObjectAsync(n,a):A.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,s){return n instanceof S?new r({keyType:t,valueType:n,typeName:b.ZodRecord,...x(s)}):new r({keyType:te.create(),valueType:t,typeName:b.ZodRecord,...x(n)})}},Oe=class extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.map)return h(s,{code:m.invalid_type,expected:f.map,received:s.parsedType}),y;let a=this._def.keyType,o=this._def.valueType,c=[...s.data.entries()].map(([i,d],p)=>({key:a._parse(new D(s,i,s.path,[p,"key"])),value:o._parse(new D(s,d,s.path,[p,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of c){let p=await d.key,u=await d.value;if(p.status==="aborted"||u.status==="aborted")return y;(p.status==="dirty"||u.status==="dirty")&&n.dirty(),i.set(p.value,u.value)}return{status:n.value,value:i}})}else{let i=new Map;for(let d of c){let p=d.key,u=d.value;if(p.status==="aborted"||u.status==="aborted")return y;(p.status==="dirty"||u.status==="dirty")&&n.dirty(),i.set(p.value,u.value)}return{status:n.value,value:i}}}};Oe.create=(r,t,n)=>new Oe({valueType:t,keyType:r,typeName:b.ZodMap,...x(n)});var Ee=class r extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.set)return h(s,{code:m.invalid_type,expected:f.set,received:s.parsedType}),y;let a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(h(s,{code:m.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(h(s,{code:m.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let o=this._def.valueType;function c(d){let p=new Set;for(let u of d){if(u.status==="aborted")return y;u.status==="dirty"&&n.dirty(),p.add(u.value)}return{status:n.value,value:p}}let i=[...s.data.values()].map((d,p)=>o._parse(new D(s,d,s.path,p)));return s.common.async?Promise.all(i).then(d=>c(d)):c(i)}min(t,n){return new r({...this._def,minSize:{value:t,message:g.toString(n)}})}max(t,n){return new r({...this._def,maxSize:{value:t,message:g.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Ee.create=(r,t)=>new Ee({valueType:r,minSize:null,maxSize:null,typeName:b.ZodSet,...x(t)});var rt=class r extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==f.function)return h(n,{code:m.invalid_type,expected:f.function,received:n.parsedType}),y;function s(i,d){return $e({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Re(),J].filter(p=>!!p),issueData:{code:m.invalid_arguments,argumentsError:d}})}function a(i,d){return $e({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Re(),J].filter(p=>!!p),issueData:{code:m.invalid_return_type,returnTypeError:d}})}let o={errorMap:n.common.contextualErrorMap},c=n.data;if(this._def.returns instanceof ne){let i=this;return O(async function(...d){let p=new N([]),u=await i._def.args.parseAsync(d,o).catch(_=>{throw p.addIssue(s(d,_)),p}),T=await Reflect.apply(c,this,u);return await i._def.returns._def.type.parseAsync(T,o).catch(_=>{throw p.addIssue(a(T,_)),p})})}else{let i=this;return O(function(...d){let p=i._def.args.safeParse(d,o);if(!p.success)throw new N([s(d,p.error)]);let u=Reflect.apply(c,this,p.data),T=i._def.returns.safeParse(u,o);if(!T.success)throw new N([a(u,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new r({...this._def,args:G.create(t).rest(Y.create())})}returns(t){return new r({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,s){return new r({args:t||G.create([]).rest(Y.create()),returns:n||Y.create(),typeName:b.ZodFunction,...x(s)})}},ye=class extends S{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ye.create=(r,t)=>new ye({getter:r,typeName:b.ZodLazy,...x(t)});var be=class extends S{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return h(n,{received:n.data,code:m.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:t.data}}get value(){return this._def.value}};be.create=(r,t)=>new be({value:r,typeName:b.ZodLiteral,...x(t)});function Gt(r,t){return new _e({values:r,typeName:b.ZodEnum,...x(t)})}var _e=class r extends S{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),s=this._def.values;return h(n,{expected:j.joinValues(s),received:n.parsedType,code:m.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),s=this._def.values;return h(n,{received:n.data,code:m.invalid_enum_value,options:s}),y}return O(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return r.create(t,{...this._def,...n})}exclude(t,n=this._def){return r.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}};_e.create=Gt;var ve=class extends S{_parse(t){let n=j.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==f.string&&s.parsedType!==f.number){let a=j.objectValues(n);return h(s,{expected:j.joinValues(a),received:s.parsedType,code:m.invalid_type}),y}if(this._cache||(this._cache=new Set(j.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let a=j.objectValues(n);return h(s,{received:s.data,code:m.invalid_enum_value,options:a}),y}return O(t.data)}get enum(){return this._def.values}};ve.create=(r,t)=>new ve({values:r,typeName:b.ZodNativeEnum,...x(t)});var ne=class extends S{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==f.promise&&n.common.async===!1)return h(n,{code:m.invalid_type,expected:f.promise,received:n.parsedType}),y;let s=n.parsedType===f.promise?n.data:Promise.resolve(n.data);return O(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ne.create=(r,t)=>new ne({type:r,typeName:b.ZodPromise,...x(t)});var q=class extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:s}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:c=>{h(s,c),c.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let c=a.transform(s.data,o);if(s.common.async)return Promise.resolve(c).then(async i=>{if(n.value==="aborted")return y;let d=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return d.status==="aborted"?y:d.status==="dirty"?ce(d.value):n.value==="dirty"?ce(d.value):d});{if(n.value==="aborted")return y;let i=this._def.schema._parseSync({data:c,path:s.path,parent:s});return i.status==="aborted"?y:i.status==="dirty"?ce(i.value):n.value==="dirty"?ce(i.value):i}}if(a.type==="refinement"){let c=i=>{let d=a.refinement(i,o);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?y:(i.status==="dirty"&&n.dirty(),c(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?y:(i.status==="dirty"&&n.dirty(),c(i.value).then(()=>({status:n.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){let c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ee(c))return y;let i=a.transform(c.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>ee(c)?Promise.resolve(a.transform(c.value,o)).then(i=>({status:n.value,value:i})):y);j.assertNever(a)}};q.create=(r,t,n)=>new q({schema:r,typeName:b.ZodEffects,effect:t,...x(n)});q.createWithPreprocess=(r,t,n)=>new q({schema:t,effect:{type:"preprocess",transform:r},typeName:b.ZodEffects,...x(n)});var $=class extends S{_parse(t){return this._getType(t)===f.undefined?O(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};$.create=(r,t)=>new $({innerType:r,typeName:b.ZodOptional,...x(t)});var H=class extends S{_parse(t){return this._getType(t)===f.null?O(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};H.create=(r,t)=>new H({innerType:r,typeName:b.ZodNullable,...x(t)});var xe=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s=n.data;return n.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xe.create=(r,t)=>new xe({innerType:r,typeName:b.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...x(t)});var Se=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ce(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Se.create=(r,t)=>new Se({innerType:r,typeName:b.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...x(t)});var Ie=class extends S{_parse(t){if(this._getType(t)!==f.nan){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.nan,received:s.parsedType}),y}return{status:"valid",value:t.data}}};Ie.create=r=>new Ie({typeName:b.ZodNaN,...x(r)});var Zn=Symbol("zod_brand"),De=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}},qe=class r extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"?(n.dirty(),ce(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{let a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?y:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(t,n){return new r({in:t,out:n,typeName:b.ZodPipeline})}},ke=class extends S{_parse(t){let n=this._def.innerType._parse(t),s=a=>(ee(a)&&(a.value=Object.freeze(a.value)),a);return Ce(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}};ke.create=(r,t)=>new ke({innerType:r,typeName:b.ZodReadonly,...x(t)});function Mt(r,t){let n=typeof r=="function"?r(t):typeof r=="string"?{message:r}:r;return typeof n=="string"?{message:n}:n}function Ht(r,t={},n){return r?re.create().superRefine((s,a)=>{let o=r(s);if(o instanceof Promise)return o.then(c=>{if(!c){let i=Mt(t,s),d=i.fatal??n??!0;a.addIssue({code:"custom",...i,fatal:d})}});if(!o){let c=Mt(t,s),i=c.fatal??n??!0;a.addIssue({code:"custom",...c,fatal:i})}}):re.create()}var Gn={object:U.lazycreate},b;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(b||(b={}));var Hn=(r,t={message:`Input not instance of ${r.name}`})=>Ht(n=>n instanceof r,t),Qt=te.create,Wt=le.create,Qn=Ie.create,Wn=de.create,Jt=pe.create,Jn=me.create,Kn=ze.create,Yn=ue.create,Xn=he.create,es=re.create,ts=Y.create,rs=F.create,ns=Ae.create,ss=X.create,as=U.create,os=U.strictCreate,is=fe.create,cs=et.create,ls=ge.create,ds=G.create,ps=tt.create,ms=Oe.create,us=Ee.create,hs=rt.create,fs=ye.create,gs=be.create,ys=_e.create,bs=ve.create,_s=ne.create,vs=q.create,xs=$.create,Ss=H.create,ks=q.createWithPreprocess,js=qe.create,Ts=()=>Qt().optional(),ws=()=>Wt().optional(),Rs=()=>Jt().optional(),Cs={string:r=>te.create({...r,coerce:!0}),number:r=>le.create({...r,coerce:!0}),boolean:r=>pe.create({...r,coerce:!0}),bigint:r=>de.create({...r,coerce:!0}),date:r=>me.create({...r,coerce:!0})};var Ps=y;var zs=r=>typeof r?.safeParse=="function";var yt=r=>typeof r?.passthrough=="function";var As=(r,t)=>yt(r)?yt(t)?r.merge(t):r:yt(t)?t:Object.assign({},r,t);var hl=e.object({name:e.literal("ZodError"),issues:e.array(e.object({path:e.array(e.union([e.string(),e.number()])),message:e.string().optional(),code:e.nativeEnum(e.ZodIssueCode)}).catchall(e.any()))}),Os=Symbol("ContractNoBody"),Yt=r=>"method"in r&&"path"in r;var Xt=(r,t)=>Object.fromEntries(Object.entries(r).map(([n,s])=>{var a,o,c;return Yt(s)?[n,{...s,path:t?.pathPrefix?t.pathPrefix+s.path:s.path,headers:As(t?.baseHeaders,s.headers),strictStatusCodes:(a=s.strictStatusCodes)!==null&&a!==void 0?a:t?.strictStatusCodes,validateResponseOnClient:(o=s.validateResponseOnClient)!==null&&o!==void 0?o:t?.validateResponseOnClient,responses:{...t?.commonResponses,...s.responses},metadata:t?.metadata?{...t?.metadata,...(c=s.metadata)!==null&&c!==void 0?c:{}}:s.metadata}]:[n,Xt(s,t)]})),bt=Symbol("ContractPlainType"),Q=()=>({router:(r,t)=>Xt(r,t),query:r=>r,mutation:r=>r,responses:r=>r,response:()=>bt,body:()=>bt,type:()=>bt,otherResponse:({contentType:r,body:t})=>({contentType:r,body:t}),noBody:()=>Os}),Es=({path:r,params:t})=>{let n=t;return r.replace(/\/?:([^/?]+)\??/g,(s,a)=>n[a]?`${s.startsWith("/")?"/":""}${n[a]}`:"")},Is=(r,t=!1)=>{let n=t?Ls(r):Ns(r);return n?.length>0?"?"+n:""},Ls=r=>r?Object.entries(r).filter(([,t])=>t!==void 0).map(([t,n])=>{let s;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?s=n:s=JSON.stringify(n),`${encodeURIComponent(t)}=${encodeURIComponent(s)}`}).join("&"):"",Ns=r=>r?Object.keys(r).flatMap(t=>_t(t,r[t])).map(([t,n])=>`${encodeURIComponent(t)}=${encodeURIComponent(n)}`).join("&"):"",_t=(r,t)=>Array.isArray(t)?t.flatMap((n,s)=>_t(`${r}[${s}]`,n)):t instanceof Date?[[`${r}`,t.toISOString()]]:t===null?[[`${r}`,""]]:t===void 0?[]:typeof t=="object"?Object.keys(t).flatMap(n=>_t(`${r}[${n}]`,t[n])):[[`${r}`,`${t}`]];var vt=class extends Error{constructor(t,n){let s=n.join(",");super(`Server returned unexpected response. Expected one of: ${s} got: ${t.status}`),this.response=t}};var Us=async({route:r,path:t,method:n,headers:s,body:a,validateResponse:o,fetchOptions:c})=>{let i=await fetch(t,{...c,method:n,headers:s,body:a}),d=i.headers.get("content-type");if(d?.includes("application/")&&d?.includes("json")){let p={status:i.status,body:await i.json(),headers:i.headers},u=r.responses[p.status];return(o??r.validateResponseOnClient)&&zs(u)?{...p,body:u.parse(p.body)}:p}return d?.includes("text/")?{status:i.status,body:await i.text(),headers:i.headers}:{status:i.status,body:await i.blob(),headers:i.headers}},Bs=r=>{let t=new FormData,n=(s,a)=>{a instanceof File?t.append(s,a):t.append(s,JSON.stringify(a))};return Object.entries(r).forEach(([s,a])=>{if(Array.isArray(a))for(let o of a)n(s,o);else n(s,a)}),t},Kt=r=>Object.fromEntries(Object.entries(r).map(([t,n])=>[t.toLowerCase(),n])),$s=r=>{let{path:t,clientArgs:n,route:s,body:a,query:o,extraInputArgs:c,headers:i,fetchOptions:d}=r,p=n.api||Us,u=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([_,P])=>typeof P=="function"?[_,P(r)]:[_,P])),T={...u&&Kt(u),...Kt(i)};Object.keys(T).forEach(_=>{T[_]===void 0&&delete T[_]});let w={route:s,path:t,method:s.method,headers:T,body:void 0,rawBody:a,rawQuery:o,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...d},...d?.signal&&{signal:d.signal},...d?.cache&&{cache:d.cache},...d&&"next"in d&&!!d?.next&&{next:d.next}};return s.method!=="GET"&&("contentType"in s&&s.contentType==="multipart/form-data"?w={...w,contentType:"multipart/form-data",body:a instanceof FormData?a:Bs(a)}:"contentType"in s&&s.contentType==="application/x-www-form-urlencoded"?w={...w,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",...w.headers},body:typeof a=="string"?a:new URLSearchParams(a)}:a!=null&&(w={...w,contentType:"application/json",headers:{"content-type":"application/json",...w.headers},body:JSON.stringify(a)})),p({...w,...c})},Ds=(r,t,n)=>{let{query:s,params:a,body:o,headers:c,extraHeaders:i,overrideClientOptions:d,fetchOptions:p,cache:u,next:T,...w}=n||{},_={...t,...d};return{path:qs(s,_.baseUrl,a,r,!!_.jsonQuery),clientArgs:_,route:r,body:o,query:s,extraInputArgs:w,fetchOptions:{...u&&{cache:u},...T&&{next:T},...p},headers:{...i,...c}}},qs=(r,t,n,s,a)=>{let o=Es({path:s.path,params:n}),c=Is(r,a);return`${t}${o}${c}`},Ms=(r,t)=>{let n=Object.keys(r.responses);return async s=>{let a=Ds(r,t,s),o=await $s(a);if(!t.throwOnUnknownStatus||n.includes(o.status.toString()))return o;throw new vt(o,n)}},xt=(r,t)=>Object.fromEntries(Object.entries(r).map(([n,s])=>Yt(s)?[n,Ms(s,t)]:[n,xt(s,t)]));var St=["free","creator","team"],er=typeof process<"u"&&process.env?.NODE_ENV!=="production",Fs={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:er?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:er?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var tr=Fs.stripe.plans,gl=Object.freeze(Object.fromEntries(tr.map(r=>[r.tier,r])));var Vs=Q(),E=e.object({message:e.string()}),kt=e.record(e.unknown()),je=e.string().regex(/^doc_[0-9A-Za-z]{22}$/),nt=e.string().regex(/^proj_[0-9A-Za-z]{22}$/),Zs=["active","archived"],st=e.enum(Zs),rr=e.object({id:e.string().min(1),display_name:e.string().min(1)}),nr=e.object({id:nt,name:e.string().min(1)}),jt=e.object({id:je,title:e.string().min(1),status:st,author:rr,project:nr.nullable(),created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable()}),Gs=e.object({type:e.literal("list"),list_type:e.literal("doc"),objects:e.array(jt)}),Hs=e.object({project_id:nt.optional(),status:st.optional()}),Qs=e.object({title:e.string().trim().min(1).max(300).optional(),prosemirror_json:kt.optional(),project_id:nt.nullable().optional()}),Ws=e.object({id:je,created_at:e.string().datetime()}),Js=e.object({title:e.string().trim().min(1).max(300).optional(),prosemirror_json:kt.optional(),project_id:nt.nullable().optional(),status:st.optional()}).refine(r=>Object.keys(r).length>0,{message:"At least one field must be provided"}),Ks=e.object({id:je,updated_at:e.string().datetime()}),Ys=e.object({id:je,title:e.string().min(1),prosemirror_json:kt,status:st,author:rr,project:nr.nullable(),created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable()}),sr=Vs.router({listDocs:{method:"GET",path:"/docs",headers:e.object({authorization:e.string().min(1).optional()}),query:Hs,responses:{200:Gs,401:E,403:E},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:e.object({authorization:e.string().min(1).optional()}),body:Qs,responses:{201:Ws,401:E,403:E,404:E,422:E},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:e.object({docId:je}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ys,401:E,403:E,404:E},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:e.object({docId:je}),headers:e.object({authorization:e.string().min(1).optional()}),body:Js,responses:{200:Ks,401:E,403:E,404:E,422:E},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:e.object({docId:je}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.object({}),401:E,403:E,404:E},summary:"Hard-delete a doc and any mention references it owns"}});var Xs=Q(),C=e.object({message:e.string()}),Tt=e.record(e.unknown()),W=e.string().regex(/^proj_[0-9A-Za-z]{22}$/),ea=["active","archived"],at=e.enum(ea),wt=e.object({id:e.string().min(1),display_name:e.string().min(1)}),ar=e.object({thread_id:e.string().min(1),title:e.string().min(1),added_at:e.string().datetime(),added_by:wt}),ta=e.object({id:W,name:e.string().min(1),status:at,author:wt,thread_count:e.number().int().nonnegative(),doc_count:e.number().int().nonnegative(),created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable()}),ra=e.object({type:e.literal("list"),list_type:e.literal("project"),objects:e.array(ta)}),na=e.object({status:at.optional()}),sa=e.object({name:e.string().trim().min(1).max(200),prosemirror_json:Tt.optional()}),aa=e.object({id:W,created_at:e.string().datetime()}),oa=e.object({name:e.string().trim().min(1).max(200).optional(),prosemirror_json:Tt.optional()}).refine(r=>Object.keys(r).length>0,{message:"At least one field must be provided"}),ia=e.object({id:W,updated_at:e.string().datetime()}),ca=e.object({archived:e.boolean()}),la=e.object({id:W,status:at,archived_at:e.string().datetime().nullable()}),da=e.object({id:W,name:e.string().min(1),prosemirror_json:Tt,status:at,author:wt,created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable(),threads:e.array(ar),docs:e.array(jt)}),pa=e.object({thread_id:e.string().min(1).max(64)}),ma=ar,or=Xs.router({listProjects:{method:"GET",path:"/projects",headers:e.object({authorization:e.string().min(1).optional()}),query:na,responses:{200:ra,401:C},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:e.object({authorization:e.string().min(1).optional()}),body:sa,responses:{201:aa,401:C,422:C},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:da,401:C,403:C,404:C},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),body:oa,responses:{200:ia,401:C,403:C,404:C,422:C},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),body:ca,responses:{200:la,401:C,403:C,404:C},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),body:pa,responses:{201:ma,401:C,403:C,404:C,409:C,422:C},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:e.object({projectId:W,threadId:e.string().min(1).max(64)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.object({}),401:C,403:C,404:C},summary:"Remove a thread membership from a project"}});var ua=Q(),ot=e.object({message:e.string()}),ha=["thread","plan","doc","user"],it=e.enum(ha),fa=["doc","project"],ga=e.enum(fa),ya=e.object({kind:it,id:e.string().min(1),title:e.string().min(1),href:e.string().min(1)}),ba=e.object({type:e.literal("list"),list_type:e.literal("mention"),objects:e.array(ya)}),_a=e.object({q:e.string().trim().min(1).max(50),kinds:e.string().optional().transform(r=>{if(!r)return;let t=r.split(",").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}).pipe(e.array(it).optional())}),va=e.object({source_kind:ga,source_id:e.string().min(1),source_title:e.string().min(1),source_href:e.string().min(1),target_kind:it,target_id:e.string().min(1),created_at:e.string().datetime()}),xa=e.object({type:e.literal("list"),list_type:e.literal("backlink"),objects:e.array(va)}),Sa=e.object({target_kind:it,target_id:e.string().min(1).max(64)}),ir=ua.router({searchMentions:{method:"GET",path:"/mentions/search",headers:e.object({authorization:e.string().min(1).optional()}),query:_a,responses:{200:ba,401:ot,422:ot},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:e.object({authorization:e.string().min(1).optional()}),query:Sa,responses:{200:xa,401:ot,403:ot},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var ka=Q(),ja=e.object({type:e.literal("list"),list_type:e.literal("thread"),has_more:e.boolean(),objects:e.array(e.unknown())}),se=e.object({message:e.string()}),cr=e.object({thread_id:e.string().min(1),is_favorited:e.boolean(),favorited_at:e.string().datetime().nullable()}),Ta=e.object({before:e.string().min(1).max(64).optional()}),lr=ka.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:e.object({id:e.string().min(1).max(64)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{201:cr,401:se,403:se,404:se},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:e.object({id:e.string().min(1).max(64)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:cr,401:se,403:se,404:se},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:Ta,responses:{200:ja,401:se,403:se},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var wa=Q(),Ra=e.object({id:e.string().uuid(),role:e.enum(["user","assistant"]),content:e.string().min(1),timestamp:e.string().datetime()}),Ca=e.object({id:e.string().uuid(),title:e.string().min(1),author:e.string().min(1),authorAvatar:e.string().min(1).max(4),model:e.string().min(1),turnCount:e.number().int().nonnegative(),createdAt:e.string().datetime(),preview:e.string()}),Wl=Ca.extend({messages:e.array(Ra)}),l=e.object({message:e.string()}),Pa=/^[a-zA-Z0-9_-]{2,32}$/,yr=e.string().regex(Pa,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),Rt=e.object({id:e.string(),first_name:e.string().min(1),last_name:e.string().min(1),display_name:e.string().min(1),stytch_id:e.string().nullable(),handle:e.string().nullable(),bio:e.string().max(280).nullable(),avatar_url:e.string().nullable(),banner_url:e.string().nullable(),share_new_threads_to_workspace:e.boolean(),experimental_features_enabled:e.boolean(),onboarded_at:e.string().nullable()}),za=e.object({stytchMemberId:e.string().min(1).optional(),emailAddress:e.string().email(),name:e.string().nullable(),user:Rt,is_admin:e.boolean()}),Aa=e.object({share_new_threads_to_workspace:e.boolean().optional(),experimental_features_enabled:e.boolean().optional(),onboarded_at:e.union([e.literal("now"),e.null()]).optional(),display_name:e.string().min(1).max(120).optional(),handle:yr.optional(),bio:e.string().max(280).nullable().optional(),avatar_storage_url:e.string().min(1).nullable().optional(),banner_storage_url:e.string().min(1).nullable().optional()}).refine(r=>Object.keys(r).length>0,{message:"At least one field must be provided"}),Oa=e.object({id:e.string(),display_name:e.string(),handle:e.string().nullable(),avatar_url:e.string().nullable(),visible_thread_count:e.number().int().nonnegative(),last_active_at:e.string().datetime().nullable()}),br=e.object({id:e.string().min(1),display_name:e.string().min(1),handle:e.string().nullable(),bio:e.string().max(280).nullable(),avatar_url:e.string().nullable(),banner_url:e.string().nullable(),organization_name:e.string().min(1).nullable(),created_at:e.string().min(1),visible_thread_count:e.number().int().nonnegative(),follower_count:e.number().int().nonnegative(),following_count:e.number().int().nonnegative(),published_project_count:e.number().int().nonnegative(),is_following:e.boolean(),is_self:e.boolean()}),Ea=e.object({type:e.literal("list"),list_type:e.literal("organization_member"),objects:e.array(Oa)}),Ia=e.object({email_address:e.string().email()}),La=e.object({email_address:e.string().email(),member_id:e.string().min(1)}),Na=e.object({location:e.string().trim().min(1),contact:e.string().trim().email()}),Ua=e.object({location:e.string().min(1),contact:e.string().email(),created_at:e.string().datetime()}),Ba=e.object({first_name:e.string().min(1),last_name:e.string().min(1),display_name:e.string().min(1),stytch_id:e.string().min(1).optional()}),$a=e.object({name:e.string().min(1),email_domains:e.array(e.string().min(1)).nonempty(),stytch_org_id:e.string().min(1)}),Da=e.object({user:Ba,organization:$a}),qa=e.object({path_glob:e.string().min(1),name:e.string().min(1),description:e.string().min(1)}),Ma=e.object({repo_origin_path:e.string().min(1),building_blocks:e.array(qa)}),_r=e.string().regex(/^th_[0-9A-Za-z]{22}$/),lt=e.string().regex(/^tb_[0-9A-Za-z]{22}$/),Fa=e.object({id:_r,author:e.object({id:e.string().min(1),display_name:e.string().min(1)}),body:e.string(),created_at:e.string().datetime(),repo_origin_path:e.string().min(1),latest_revision_id:lt,revision_count:e.number().int().positive()}),Va=e.object({id:e.string().min(1),display_name:e.string().min(1)}),Za=e.object({id:e.string().min(1),author_id:e.string().min(1).nullable(),author:Va.nullable(),created_at:e.string().datetime(),deleted_at:e.string().datetime().nullable(),content:e.string().min(1)}),Ga=e.object({id:e.string().min(1),thread_block_id:e.string().min(1),created_at:e.string().datetime(),resolved_at:e.string().datetime().nullable(),comments:e.array(Za)}),Ha=e.object({thread_block_id:lt,from_position:e.number().int().positive(),to_position:e.number().int().positive(),selected_text:e.string().min(1),content:e.string().trim().min(1)}),Qa=e.object({id:e.string().min(1)}),Wa=e.object({content:e.string().trim().min(1)}),Ja=e.object({id:e.string().min(1)}),Ka=e.object({content:e.string().trim().min(1)}),Ya=e.object({id:e.string().min(1)}),Xa=e.object({content:e.string().trim().min(1)}),eo=e.object({id:e.string().min(1)}),to=e.object({resolved:e.boolean()}),ro=e.object({id:e.string().min(1),resolved_at:e.string().datetime().nullable()}),no=e.object({resolved:e.boolean()}),so=e.object({id:e.string().min(1),resolved_at:e.string().datetime().nullable()}),vr=e.record(e.unknown()),ao=e.object({id:lt,body:e.string(),created_at:e.string().datetime(),prosemirror_json:vr,comment_threads:e.array(Ga)}),oo=e.object({id:_r,created_at:e.string().datetime(),repo_origin_path:e.string().min(1),author:e.object({id:e.string().min(1),display_name:e.string().min(1)}),latest_revision_id:lt,revision_count:e.number().int().positive(),revisions:e.array(ao)}),io=e.object({type:e.literal("list"),list_type:e.literal("plan"),has_more:e.boolean(),objects:e.array(Fa)}),co=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional(),author_id:e.string().min(1).optional(),repo_origin_path:e.string().min(1).optional()}),xr=e.object({id:e.string().min(1),organization_id:e.string().min(1),created_at:e.string().min(1),repo_origin_path:e.string().min(1),path_glob:e.string().min(1),name:e.string().min(1),description:e.string().min(1)}),lo=e.array(xr),po=e.object({type:e.literal("list"),list_type:e.literal("building_block"),has_more:e.boolean(),objects:e.array(xr)}),mo=e.object({repo_origin_path:e.string().min(1),before:e.string().min(1).optional(),after:e.string().min(1).optional()}),uo=e.enum(["thread","building_block"]),ho=e.object({repo_origin_path:e.string().min(1),sources:e.array(uo).nonempty()}),fo=e.object({type:e.literal("list"),list_type:e.literal("repository"),has_more:e.boolean(),objects:e.array(ho)}),ae=e.enum(["claudeCode","codex","amp","cursor","unspecified"]),go=["transcript","plan"],yo=e.enum(go),bo=e.object({md5:e.string().min(1),harness:ae,filename:e.string().min(1).optional(),repo_origin_path:e.string().min(1).optional(),harness_internal_id:e.string().min(1).optional(),file_type:yo.optional()}).refine(r=>(r.filename?.trim().length??0)>0||(r.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),Pt=e.object({id:e.string().min(1),display_name:e.string().min(1)}),_o=e.object({id:e.string().min(1),display_name:e.string().min(1)}),Sr=e.object({id:e.string().min(1),author_id:e.string().min(1).nullable(),author:_o.nullable(),created_at:e.string().datetime(),deleted_at:e.string().datetime().nullable(),content:e.string().min(1)}),kr=e.object({id:e.string().min(1),thread_block_id:e.string().min(1),created_at:e.string().datetime(),resolved_at:e.string().datetime().nullable()}),vo=kr.extend({comments:e.array(Sr)}),Me=e.object({id:e.string().min(1),type:e.string().min(1),index_in_thread:e.number().int().nonnegative(),isCritiqued:e.boolean(),comment_threads:e.array(vo).optional()}).passthrough(),jr=e.object({type:e.literal("list"),list_type:e.literal("thread_block"),has_more:e.boolean(),objects:e.array(Me)}),dr=Me.extend({type:e.literal("plan"),prosemirror_json:vr,thread_file_id:e.string().min(1)}),xo=e.union([e.literal(-1),e.literal(1)]),Tr=e.union([e.literal(-1),e.literal(0),e.literal(1)]),pr=e.object({score:e.number().int(),up_count:e.number().int().nonnegative(),down_count:e.number().int().nonnegative(),viewer_vote:Tr}),So=e.object({value:xo}),ko=e.object({id:e.string().min(1),display_name:e.string().min(1),avatar_url:e.string().nullable()}),Te=e.object({id:e.string().min(1),thread_id:e.string().min(1),author_id:e.string().min(1).nullable(),author:ko.nullable(),parent_comment_id:e.string().min(1).nullable(),content:e.string(),created_at:e.string().datetime(),updated_at:e.string().datetime(),deleted_at:e.string().datetime().nullable()}),jo=e.object({type:e.literal("list"),list_type:e.literal("thread_comment"),objects:e.array(Te)}),To=e.object({content:e.string().trim().min(1).max(4e3),parent_comment_id:e.string().min(1).optional()}),wo=Te,Ro=e.object({content:e.string().trim().min(1).max(4e3)}),Co=Te,Po=Te,Jl=e.discriminatedUnion("kind",[e.object({kind:e.literal("created"),thread_id:e.string().min(1),actor_user_id:e.string().min(1),version:e.number(),comment:Te}),e.object({kind:e.literal("updated"),thread_id:e.string().min(1),actor_user_id:e.string().min(1),version:e.number(),comment:Te}),e.object({kind:e.literal("deleted"),thread_id:e.string().min(1),actor_user_id:e.string().min(1),version:e.number(),comment:Te})]),zo=e.enum(["pending","generating","ready","failed"]),Ao=e.enum(["pending","generating","ready","failed"]),Oo=e.enum(["pending","placeholder","ai","user"]),wr=e.enum(["pending","generating","ready","failed"]),Eo=e.enum(["asked","requested","decided","corrected","shared"]),Io=e.object({id:e.string().min(1),kind:Eo,summary:e.string().min(1),block_id:e.string().min(1)}),Lo=e.object({type:e.literal("list"),list_type:e.literal("thread_decision"),status:wr,generated_at:e.string().nullable(),objects:e.array(Io)}),Le=e.object({id:e.string().min(1),thread_file_id:e.string().min(1),organization_id:e.string().min(1),author:Pt,repo:e.string().min(1),title:e.string().min(1),started_at:e.string().min(1),blocks:jr,user_message_count:e.number().int().nonnegative(),files_touched:e.array(e.string()),skills_invoked:e.array(e.string()),harness:ae,transcript_parsing_state:e.enum(["pending","parsed","too_large_to_parse"]),visibility:e.enum(["private","workspace","public"]),has_plan:e.boolean().optional(),summary:e.string().nullable(),summary_status:zo,summary_generated_at:e.string().nullable(),title_status:Ao,title_generated_at:e.string().nullable(),title_source:Oo,decisions_status:wr,decisions_generated_at:e.string().nullable(),score:e.number().int(),up_count:e.number().int().nonnegative(),down_count:e.number().int().nonnegative(),viewer_vote:Tr,comment_count:e.number().int().nonnegative(),is_favorited:e.boolean()}),No=e.object({storage_url:e.string().min(1)}),Uo=e.object({storage_url:e.string(),harness:ae,thread:Le.nullable()}),Bo=e.object({status:e.literal("complete"),thread_files:e.array(Uo)}),$o=e.object({id:e.string(),presigned_url:e.string().nullable(),presigned_url_expires_at:e.string().nullable(),storage_url:e.string(),harness:ae,expected_md5:e.string(),error:e.string().nullable(),thread:Le.nullable()}),Do=e.object({id:e.string(),substrate:e.enum(["s3","filesystem"]),status:e.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:e.array($o)}),qo=e.object({visibility:e.enum(["private","workspace","public"]).optional(),title:e.string().trim().min(1).max(200).optional()}).refine(r=>r.visibility!==void 0||r.title!==void 0,{message:"At least one of visibility or title must be provided"}),Mo=e.discriminatedUnion("visibility",[e.object({visibility:e.literal("private")}),e.object({visibility:e.literal("workspace")}),e.object({visibility:e.literal("public"),title:e.string().min(1),author_display_name:e.string().min(1),first_user_message:e.string().nullable(),summary:e.string().nullable(),started_at:e.string().min(1),harness:ae})]),Fo=Le,mr=e.object({type:e.literal("list"),list_type:e.literal("thread"),has_more:e.boolean(),objects:e.array(Fo)}),Vo=e.enum(["recent","popular"]),Zo=Le,Go=e.object({type:e.literal("list"),list_type:e.literal("discover_thread"),has_more:e.boolean(),objects:e.array(Zo)}),Ho=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional(),sort:Vo.optional(),harness:ae.optional(),search:e.string().max(200).optional()}),Qo=e.object({thread_count:e.number().int().nonnegative(),author_count:e.number().int().nonnegative(),organization_count:e.number().int().nonnegative(),harness_breakdown:e.record(ae,e.number().int().nonnegative())}),Wo=e.object({id:e.string(),status:e.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:e.string(),thread_count:e.number().int().nonnegative()}),Jo=e.object({type:e.literal("list"),list_type:e.literal("upload_session"),objects:e.array(Wo)}),Ko=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional()}),Yo=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional(),author_ids:e.string().min(1).optional(),created_at:e.string().min(1).optional(),filepath_prefixes:e.string().min(1).optional()}),Xo=e.object({path:e.string().min(1),start_offset:e.number().int().nonnegative(),end_offset:e.number().int().positive()}),ei=e.object({name:e.string(),usage_count:e.number().int().nonnegative(),author_count:e.number().int().nonnegative(),first_used_at:e.string().nullable(),last_used_at:e.string().nullable(),usage_count_last_24h:e.number().int().nonnegative(),usage_count_last_7d:e.number().int().nonnegative()}),ti=e.object({type:e.literal("list"),list_type:e.literal("skill"),objects:e.array(ei)}),ri=e.object({id:e.string(),title:e.string(),visibility:e.enum(["private","workspace","public"]),started_at:e.string(),author:Pt,skills_invoked:e.array(e.string())}),ni=e.object({name:e.string(),usage_count:e.number().int().nonnegative(),author_count:e.number().int().nonnegative(),first_used_at:e.string().nullable(),last_used_at:e.string().nullable(),threads:e.array(ri)}),si=e.object({path:e.string().min(1),text:e.string().max(64e3)}),ai=e.enum(["text_edit","redact","delete_block"]),oi=e.object({id:e.string(),thread_block_id:e.string(),editor:e.object({id:e.string(),display_name:e.string()}),kind:ai,path:e.string().nullable(),previous_text:e.string().nullable(),new_text:e.string().nullable(),created_at:e.string()}),ii=e.object({type:e.literal("list"),list_type:e.literal("thread_block_edit"),objects:e.array(oi)}),ci=e.object({organization_count:e.number().int().nonnegative(),user_count:e.number().int().nonnegative(),thread_count:e.number().int().nonnegative(),thread_count_last_24h:e.number().int().nonnegative(),user_count_last_24h:e.number().int().nonnegative()}),li=e.object({id:e.string(),name:e.string(),email_domains:e.array(e.string()),stytch_org_id:e.string(),member_count:e.number().int().nonnegative(),thread_count:e.number().int().nonnegative(),default_thread_visibility:e.enum(["private","workspace","public"]),created_at:e.string()}),di=e.object({type:e.literal("list"),list_type:e.literal("admin_organization"),objects:e.array(li)}),Rr=e.object({id:e.string(),name:e.string()}),pi=e.object({id:e.string(),display_name:e.string(),stytch_id:e.string().nullable(),thread_count:e.number().int().nonnegative(),onboarded_at:e.string().nullable(),created_at:e.string(),organizations:e.array(Rr)}),mi=e.object({type:e.literal("list"),list_type:e.literal("admin_user"),objects:e.array(pi)}),ui=e.object({id:e.string(),title:e.string(),started_at:e.string(),created_at:e.string(),deleted_at:e.string().nullable(),visibility:e.enum(["private","workspace","public"]),harness:ae,author:Pt,organization:Rr}),hi=e.object({type:e.literal("list"),list_type:e.literal("admin_thread"),has_more:e.boolean(),objects:e.array(ui)}),fi=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional()}),ur=e.object({token:e.string().min(1),thread_id:e.string().min(1)}),gi=e.object({visitor:e.string().min(1).max(64).optional()}),yi=e.object({user_id:e.string(),display_name:e.string(),shares_sent:e.number().int().nonnegative(),unique_viewers:e.number().int().nonnegative(),attributed_signups:e.number().int().nonnegative()}),bi=e.object({window_days:e.number().int().positive(),shares_sent:e.number().int().nonnegative(),unique_viewers:e.number().int().nonnegative(),attributed_signups:e.number().int().nonnegative(),active_sharers:e.number().int().nonnegative(),k_factor:e.number().nullable(),shares_sent_sparkline:e.array(e.number().int().nonnegative()),top_sharers:e.array(yi)}),_i=e.object({windows:e.array(bi)}),vi=e.object({quoted_text:e.string().min(1),comment:e.string().nullable(),type:e.enum(["comment","highlight:trapdoor"])}),xi=kr,Si=Sr.extend({comment_thread_id:e.string().min(1)}),ki=e.object({markdown:e.string().min(1)}),ji=e.object({storage_url:e.string().min(1),thread_file_id:e.string().min(1),parsed_plan_block:dr,critiqued_plan_block:dr,annotations:e.array(vi),comment_threads:e.array(xi),comments:e.array(Si)}),Ne=e.enum(St),Cr=e.object({skills:e.boolean(),workspace_scope:e.boolean(),review:e.boolean(),shared_thread_ttl_days:e.number().int().positive().nullable()}),Ct=e.object({subject_type:e.enum(["user","organization"]),subject_id:e.string().min(1),effective_plan:Ne,admin_override:Ne.nullable(),stripe_subscription_status:e.string().nullable(),cancel_at_period_end:e.boolean(),current_period_end:e.string().nullable(),seat_quantity:e.number().int().positive(),member_count:e.number().int().nonnegative().nullable(),features:Cr}),Ti=e.object({effective_plan:Ne,features:Cr,user:Ct,organization:Ct.nullable()}),wi=e.object({plan:e.enum(["creator","team"]),seat_quantity:e.number().int().positive().optional()}),Ri=e.object({checkout_url:e.string().min(1)}),Ci=e.object({portal_url:e.string().min(1)}),Pi=e.object({seat_quantity:e.number().int().positive()}),hr=e.object({plan:Ne.nullable()}),ct=e.object({subject_type:e.enum(["user","organization"]),subject_id:e.string().min(1),label:e.string().min(1),effective_plan:Ne,admin_override:Ne.nullable(),stripe_subscription_status:e.string().nullable(),seat_quantity:e.number().int().positive()}),zi=e.object({users:e.array(ct),organizations:e.array(ct)}),Ai=e.object({id:e.string().min(1),display_name:e.string().min(1),handle:e.string().nullable(),avatar_url:e.string().nullable()}),Oi=e.object({thread_id:e.string().min(1),title:e.string().min(1),author:Ai,last_active_at:e.string().datetime(),last_block_excerpt:e.string().nullable(),last_block_kind:e.string().min(1).nullable(),is_streaming:e.boolean()}),Ei=e.object({type:e.literal("list"),list_type:e.literal("live_thread"),objects:e.array(Oi)}),Ii=e.object({thread_id:e.string().min(1)}),Li=e.object({thread_id:e.string().min(1),last_seen_at:e.string().datetime(),started_at:e.string().datetime()}),Ni=e.object({follower_id:e.string().min(1),followee_id:e.string().min(1),is_following:e.literal(!0),follower_count:e.number().int().nonnegative()}),Ui=e.object({follower_id:e.string().min(1),followee_id:e.string().min(1),is_following:e.literal(!1),follower_count:e.number().int().nonnegative()}),Pr=e.object({id:e.string().min(1),display_name:e.string().min(1),handle:e.string().nullable(),avatar_url:e.string().nullable(),bio:e.string().max(280).nullable(),is_following:e.boolean(),is_self:e.boolean()}),fr=e.object({type:e.literal("list"),list_type:e.literal("user_follow"),objects:e.array(Pr)}),Bi=e.object({date:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:e.number().int().nonnegative()}),$i=e.object({window_start:e.string().datetime(),window_end:e.string().datetime(),total_contributions:e.number().int().nonnegative(),days_active:e.number().int().nonnegative(),daily_average:e.number().nonnegative(),current_streak_days:e.number().int().nonnegative(),days:e.array(Bi)}),Di=e.object({type:e.literal("thread_created"),occurred_at:e.string().datetime(),id:e.string().min(1),thread:e.object({id:e.string().min(1),title:e.string(),visibility:e.enum(["private","workspace","public"])})}),qi=e.object({type:e.literal("comment_posted"),occurred_at:e.string().datetime(),id:e.string().min(1),comment_excerpt:e.string(),thread:e.object({id:e.string().min(1),title:e.string(),visibility:e.enum(["private","workspace","public"])})}),Mi=e.object({type:e.literal("project_published"),occurred_at:e.string().datetime(),id:e.string().min(1),project:e.object({id:e.string().min(1),name:e.string().min(1)})}),Fi=e.object({type:e.literal("user_followed"),occurred_at:e.string().datetime(),id:e.string().min(1),followee:Pr}),Vi=e.discriminatedUnion("type",[Di,qi,Mi,Fi]),Zi=e.object({type:e.literal("list"),list_type:e.literal("user_activity"),objects:e.array(Vi)}),Gi=e.object({id:e.string().min(1),name:e.string().min(1),excerpt:e.string(),published_at:e.string().datetime(),updated_at:e.string().datetime()}),Hi=e.object({type:e.literal("list"),list_type:e.literal("profile_published_project"),objects:e.array(Gi)}),gr=e.object({id:e.string().min(1),published_at:e.string().datetime().nullable()}),Qi=e.enum(["avatar","banner"]),Wi=e.enum(["image/png","image/jpeg","image/webp","image/gif"]),Ji=e.object({kind:Qi,content_type:Wi,base64_data:e.string().min(1)}),Ki=e.object({substrate:e.enum(["s3","filesystem"]),storage_url:e.string().min(1)}),Yi=br,zr=wa.router({health:{method:"GET",path:"/health",responses:{200:e.object({status:e.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:e.object({authorization:e.string().min(1).optional(),"x-lore-referral-token":e.string().min(1).max(16).optional()}),responses:{200:za,401:l},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:e.object({authorization:e.string().min(1).optional()}),body:Ii,responses:{200:Li,401:l,403:l,404:l,422:l},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ei,401:l,403:l},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:Yo,responses:{200:mr,401:l},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Le,404:l},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:mr,404:l,409:l},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),query:Ko,responses:{200:jr,401:l},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Wa,responses:{201:Ja,401:l,404:l},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1),commentThreadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Xa,responses:{201:eo,401:l,404:l,409:l},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1),commentThreadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:no,responses:{200:so,401:l,404:l},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:ti,401:l},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:e.object({name:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:ni,401:l,404:l},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Xo,responses:{200:Me,401:l,403:l,404:l,422:l},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:si,responses:{200:Me,401:l,403:l,404:l,422:l},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:Me,401:l,403:l,404:l,409:l,422:l},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.null(),401:l,403:l,404:l},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:ii,401:l,404:l},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Lo,401:l,404:l},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:qo,responses:{200:Le,401:l,403:l,404:l},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.null(),401:l,403:l,404:l},summary:"Soft-delete a thread (author only)"},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:So,responses:{200:pr,401:l,403:l,404:l,422:l},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:pr,401:l,404:l},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:e.object({threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:jo,403:l,404:l},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:e.object({threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:To,responses:{201:wo,401:l,403:l,404:l,422:l},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:e.object({threadId:e.string().min(1),commentId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Ro,responses:{200:Co,401:l,403:l,404:l,422:l},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:e.object({threadId:e.string().min(1),commentId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:Po,401:l,403:l,404:l},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:e.object({id:e.string().min(1)}),responses:{200:Mo,404:l},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:e.object({authorization:e.string().min(1).optional()}),body:Da,responses:{201:Rt,401:l},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:br,404:l},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:e.object({authorization:e.string().min(1).optional()}),body:Aa,responses:{200:Rt,401:l,409:l,422:l},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:e.object({handle:yr}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Yi,404:l},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),query:e.object({limit:e.coerce.number().int().positive().max(100).optional()}),responses:{200:Zi,404:l},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:$i,404:l},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:fr,404:l},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:fr,404:l},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:Ni,401:l,404:l,409:l,422:l},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:Ui,401:l,404:l},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Hi,404:l},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:gr,401:l,403:l,404:l},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:gr,401:l,403:l,404:l},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:e.object({authorization:e.string().min(1).optional()}),body:Ji,responses:{200:Ki,401:l,413:l,422:l},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ea,401:l},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:e.object({authorization:e.string().min(1).optional()}),body:Ia,responses:{201:La,401:l,403:l,409:l,422:l},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:fo,401:l,403:l},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:e.object({authorization:e.string().min(1).optional()}),body:Ma,responses:{201:lo,401:l,403:l},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:oo,401:l,403:l,404:l},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Ha,responses:{201:Qa,401:l,403:l,404:l,422:l},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:e.object({id:e.string().min(1),threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Ka,responses:{201:Ya,401:l,403:l,404:l,409:l},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:e.object({id:e.string().min(1),threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:to,responses:{200:ro,401:l,403:l,404:l},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:e.object({authorization:e.string().min(1).optional()}),query:co,responses:{200:io,401:l,403:l},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:e.object({authorization:e.string().min(1).optional()}),query:mo,responses:{200:po,401:l,403:l},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Jo,401:l},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({thread_files:e.array(bo).nonempty()}),responses:{201:Do,400:l,401:l},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({thread_files:e.array(No).nonempty()}),responses:{200:Bo,400:l,401:l,404:l,409:l,422:l},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:ci,401:l,403:l},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:di,401:l,403:l},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:mi,401:l,403:l},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:fi,responses:{200:hi,401:l,403:l},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.null(),401:l,403:l,404:l},summary:"Permanently remove a thread. Tanagram admins only."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:Ho,responses:{200:Go},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:Qo},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:Na,responses:{201:Ua,409:l},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{201:ur,401:l,403:l,404:l,409:l},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:e.object({token:e.string().min(1).max(16)}),query:gi,responses:{200:ur,404:l},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:_i,401:l,403:l},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:e.object({authorization:e.string().min(1).optional()}),body:ki,responses:{200:ji,401:l,403:l,409:l},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ti,401:l},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:e.object({authorization:e.string().min(1).optional()}),body:wi,responses:{200:Ri,400:l,401:l,403:l,503:l},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({subject_type:e.enum(["user","organization"]).default("user")}).optional(),responses:{200:Ci,401:l,404:l,503:l},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:e.object({authorization:e.string().min(1).optional()}),body:Pi,responses:{200:Ct,400:l,401:l,403:l,404:l,503:l},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:zi,401:l,403:l},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:hr,responses:{200:ct,401:l,403:l,404:l},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:hr,responses:{200:ct,401:l,403:l,404:l},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:or,docs:sr,mentions:ir,favorites:lr},{pathPrefix:"/api"});import Ve from"node:fs";import Or from"node:path";import ec from"node:os";import Ar from"node:path";var Xi="prod";function L(){return Xi}function Fe(){let r=L()==="dev"?".lore-dev":".lore";return Ar.join(ec.homedir(),r)}function dt(){return Ar.join(Fe(),"log.txt")}function pt(){return Or.join(Fe(),"token")}function zt(){let r;try{r=Ve.readFileSync(pt(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let t=r.trim();return!t||rc(t,new Date)?{token:"",source:"none"}:{token:t,source:"file"}}function Er(){return zt().token}function Ir(){return Ve.existsSync(pt())}function Lr(r){let t=pt();Ve.mkdirSync(Or.dirname(t),{recursive:!0,mode:448}),Ve.writeFileSync(t,r,{mode:384})}function Nr(){try{Ve.rmSync(pt())}catch(r){if(r&&typeof r=="object"&&"code"in r&&r.code==="ENOENT")return;throw r}}function tc(r){let t=r.split(".");if(t.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(t[1],"base64url").toString("utf8"))}function rc(r,t){let n;try{n=tc(r)}catch{return!1}let s=n["https://stytch.com/session"]?.expires_at;if(typeof s!="string")return!1;let a=Date.parse(s.trim());return Number.isNaN(a)?!1:t.getTime()>=a}var nc={dev:"http://localhost:4000",prod:"https://lore.tanagram.ai"};function Ue(r={}){let t=r.token??Er();return xt(zr,{baseUrl:nc[L()],baseHeaders:t?{authorization:`Bearer ${t}`}:{}})}import Br from"node:fs";var Ur=!1;function sc(){Ur||(Br.mkdirSync(Fe(),{recursive:!0}),Ur=!0)}function ac(r){let t=typeof r=="string"?r:JSON.stringify(r);return/[\s"=]/.test(t)?JSON.stringify(t):t}function oc(r,t,n){let s=`${new Date().toISOString()} ${r} ${t}`;if(!n)return`${s}
|
|
5
|
-
|
|
6
|
-
`:`${s}
|
|
7
|
-
`}function At(r,t,n){let s=oc(r,t,n);sc(),Br.appendFileSync(dt(),s),L()==="dev"&&process.stderr.write(s)}var I={info(r,t){At("info",r,t)},warn(r,t){At("warn",r,t)},error(r,t){At("error",r,t)}};var $r={meta:{name:"health",description:"Check API health"},async run({data:r}){I.info("command_start",{command:"health"});let n=await(r?.client??Ue()).health();if(n.status===200){console.log(n.body.status);return}throw I.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};var Dr={meta:{name:"hello",description:"Print a friendly greeting"},run(){I.info("command_start",{command:"hello"}),console.log("hello world")}};import{spawn as cc}from"node:child_process";import Fr from"node:crypto";import lc from"node:http";var ic={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function qr(){return ic[L()]}var dc=5*60*1e3;function pc(){return Fr.randomBytes(32).toString("base64url")}function mc(r){return Fr.createHash("sha256").update(r).digest("base64url")}function uc(r){let t;try{t=JSON.parse(Buffer.from(r.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof t.session_jwt!="string"||!t.session_jwt)throw new Error("missing session token");if(typeof t.code_challenge!="string"||!t.code_challenge)throw new Error("missing code challenge");return{sessionJwt:t.session_jwt,codeChallenge:t.code_challenge}}function hc(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Mr(r,t,n){let s=t==="success";r.writeHead(200,{"Content-Type":"text/html"}),r.end(`<!DOCTYPE html>
|
|
2
|
+
var b3=Object.create;var qd=Object.defineProperty;var C3=Object.getOwnPropertyDescriptor;var P3=Object.getOwnPropertyNames;var M3=Object.getPrototypeOf,x3=Object.prototype.hasOwnProperty;var U=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),US=(t,e)=>{for(var n in e)qd(t,n,{get:e[n],enumerable:!0})},eC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of P3(e))!x3.call(t,o)&&o!==n&&qd(t,o,{get:()=>e[o],enumerable:!(r=C3(e,o))||r.enumerable});return t};var K=(t,e,n)=>(n=t!=null?b3(M3(t)):{},eC(e||!t||!t.__esModule?qd(n,"default",{value:t,enumerable:!0}):n,t)),N=t=>eC(qd({},"__esModule",{value:!0}),t);var Ro,wS=z(()=>{Ro="1.9.1"});function v3(t){let e=new Set([t]),n=new Set,r=t.match(tC);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===t};function s(a){return n.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;let l=c.match(tC);if(!l)return s(c);let p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?s(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?i(c):s(c):o.minor<=p.minor?i(c):s(c)}}var tC,nC,rC=z(()=>{wS();tC=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;nC=v3(Ro)});function kr(t,e,n,r=!1){var o;let s=pl[ll]=(o=pl[ll])!==null&&o!==void 0?o:{version:Ro};if(!r&&s[t]){let i=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(i.stack||i.message),!1}if(s.version!==Ro){let i=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Ro}`);return n.error(i.stack||i.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Ro}.`),!0}function vn(t){var e,n;let r=(e=pl[ll])===null||e===void 0?void 0:e.version;if(!(!r||!nC(r)))return(n=pl[ll])===null||n===void 0?void 0:n[t]}function Gr(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Ro}.`);let n=pl[ll];n&&delete n[t]}var L3,ll,pl,hi=z(()=>{wS();rC();L3=Ro.split(".")[0],ll=Symbol.for(`opentelemetry.js.api.${L3}`),pl=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function dl(t,e,n){let r=vn("diag");if(r)return r[t](e,...n)}var $d,oC=z(()=>{hi();$d=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return dl("debug",this._namespace,e)}error(...e){return dl("error",this._namespace,e)}info(...e){return dl("info",this._namespace,e)}warn(...e){return dl("warn",this._namespace,e)}verbose(...e){return dl("verbose",this._namespace,e)}}});var pt,Yd=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(pt||(pt={}))});function sC(t,e){t<pt.NONE?t=pt.NONE:t>pt.ALL&&(t=pt.ALL),e=e||{};function n(r,o){let s=e[r];return typeof s=="function"&&t>=o?s.bind(e):function(){}}return{error:n("error",pt.ERROR),warn:n("warn",pt.WARN),info:n("info",pt.INFO),debug:n("debug",pt.DEBUG),verbose:n("verbose",pt.VERBOSE)}}var iC=z(()=>{Yd()});var D3,Et,Ei=z(()=>{oC();iC();Yd();hi();D3="diag",Et=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(o){return function(...s){let i=vn("diag");if(i)return i[o](...s)}}let n=this,r=(o,s={logLevel:pt.INFO})=>{var i,a,c;if(o===n){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}typeof s=="number"&&(s={logLevel:s});let l=vn("diag"),p=sC((a=s.logLevel)!==null&&a!==void 0?a:pt.INFO,o);if(l&&!s.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),p.warn(`Current logger will overwrite one already registered from ${d}`)}return kr("diag",p,n,!0)};n.setLogger=r,n.disable=()=>{Gr(D3,n)},n.createComponentLogger=o=>new $d(o),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var Wd,aC=z(()=>{Wd=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let r=new t(this._entries);return r._entries.set(e,n),r}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let r of e)n._entries.delete(r);return n}clear(){return new t}}});var cC,uC=z(()=>{cC=Symbol("BaggageEntryMetadata")});function lC(t={}){return new Wd(new Map(Object.entries(t)))}function pC(t){return typeof t!="string"&&(U3.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:cC,toString(){return t}}}var U3,kS=z(()=>{Ei();aC();uC();U3=Et.instance()});function Ln(t){return Symbol.for(t)}var GS,Ba,_l=z(()=>{GS=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,o)=>{let s=new t(n._currentContext);return s._currentContext.set(r,o),s},n.deleteValue=r=>{let o=new t(n._currentContext);return o._currentContext.delete(r),o}}},Ba=new GS});var BS,jS,zd,dC=z(()=>{BS=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],jS={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(jS[e]=console[e])}zd=class{constructor(){function e(n){return function(...r){let o=jS[n];if(typeof o!="function"&&(o=jS.log),typeof o!="function"&&console&&(o=console[n],typeof o!="function"&&(o=console.log)),typeof o=="function")return o.apply(console,r)}}for(let n=0;n<BS.length;n++)this[BS[n].n]=e(BS[n].c)}}});function _C(){return KS}var HS,ja,VS,FS,qS,$S,fl,YS,WS,zS,KS,w3,k3,G3,B3,j3,H3,V3,QS=z(()=>{HS=class{constructor(){}createGauge(e,n){return k3}createHistogram(e,n){return G3}createCounter(e,n){return w3}createUpDownCounter(e,n){return B3}createObservableGauge(e,n){return H3}createObservableCounter(e,n){return j3}createObservableUpDownCounter(e,n){return V3}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},ja=class{},VS=class extends ja{add(e,n){}},FS=class extends ja{add(e,n){}},qS=class extends ja{record(e,n){}},$S=class extends ja{record(e,n){}},fl=class{addCallback(e){}removeCallback(e){}},YS=class extends fl{},WS=class extends fl{},zS=class extends fl{},KS=new HS,w3=new VS,k3=new qS,G3=new $S,B3=new FS,j3=new YS,H3=new WS,V3=new zS});var Kd,fC=z(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(Kd||(Kd={}))});var Qd,Xd,XS=z(()=>{Qd={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},Xd={set(t,e,n){t!=null&&(t[e]=n)}}});var Jd,mC=z(()=>{_l();Jd=class{active(){return Ba}with(e,n,r,...o){return n.call(r,...o)}bind(e,n){return n}enable(){return this}disable(){return this}}});var JS,F3,Br,ml=z(()=>{mC();hi();Ei();JS="context",F3=new Jd,Br=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return kr(JS,e,Et.instance())}active(){return this._getContextManager().active()}with(e,n,r,...o){return this._getContextManager().with(e,n,r,...o)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return vn(JS)||F3}disable(){this._getContextManager().disable(),Gr(JS,Et.instance())}}});var Vt,ZS=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Vt||(Vt={}))});var Tl,Si,Zd,e_=z(()=>{ZS();Tl="0000000000000000",Si="00000000000000000000000000000000",Zd={traceId:Si,spanId:Tl,traceFlags:Vt.NONE}});var jr,t_=z(()=>{e_();jr=class{constructor(e=Zd){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function n_(t){return t.getValue(eg)||void 0}function TC(){return n_(Br.getInstance().active())}function hl(t,e){return t.setValue(eg,e)}function hC(t){return t.deleteValue(eg)}function EC(t,e){return hl(t,new jr(e))}function r_(t){var e;return(e=n_(t))===null||e===void 0?void 0:e.spanContext()}var eg,tg=z(()=>{_l();t_();ml();eg=Ln("OpenTelemetry Context Key SPAN")});function SC(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(o_[t.charCodeAt(r)]|0)+(o_[t.charCodeAt(r+1)]|0)+(o_[t.charCodeAt(r+2)]|0)+(o_[t.charCodeAt(r+3)]|0);return n===e}function ng(t){return SC(t,32)&&t!==Si}function rg(t){return SC(t,16)&&t!==Tl}function yo(t){return ng(t.traceId)&&rg(t.spanId)}function gC(t){return new jr(t)}var o_,s_=z(()=>{e_();t_();o_=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function q3(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var og,Ha,sg=z(()=>{ml();tg();t_();s_();og=Br.getInstance(),Ha=class{startSpan(e,n,r=og.active()){if(!!n?.root)return new jr;let s=r&&r_(r);return q3(s)&&yo(s)?new jr(s):new jr}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??og.active(),l=this.startSpan(e,s,c),p=hl(c,l);return og.with(p,a,void 0,l)}}});var $3,Va,ig=z(()=>{sg();$3=new Ha,Va=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,o){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):$3}}});var i_,AC=z(()=>{sg();i_=class{getTracer(e,n,r){return new Ha}}});var Y3,gi,ag=z(()=>{ig();AC();Y3=new i_,gi=class{getTracer(e,n,r){var o;return(o=this.getDelegateTracer(e,n,r))!==null&&o!==void 0?o:new Va(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Y3}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,n,r)}}});var a_,RC=z(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(a_||(a_={}))});var Oe,yC=z(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Oe||(Oe={}))});var Be,IC=z(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Be||(Be={}))});function NC(t){return K3.test(t)}function OC(t){return Q3.test(t)&&!X3.test(t)}var cg,W3,z3,K3,Q3,X3,bC=z(()=>{cg="[_0-9a-z-*/]",W3=`[a-z]${cg}{0,255}`,z3=`[a-z0-9]${cg}{0,240}@[a-z]${cg}{0,13}`,K3=new RegExp(`^(?:${W3}|${z3})$`),Q3=/^[ -~]{0,255}[!-~]$/,X3=/,|=/});var CC,J3,PC,MC,c_,xC=z(()=>{bC();CC=32,J3=512,PC=",",MC="=",c_=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+MC+this.get(n)),e),[]).join(PC)}_parse(e){e.length>J3||(this._internalState=e.split(PC).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(MC);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);NC(i)&&OC(a)&&n.set(i,a)}return n},new Map),this._internalState.size>CC&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,CC))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function vC(t){return new c_(t)}var LC=z(()=>{xC()});var P,DC=z(()=>{ml();P=Br.getInstance()});var Dn,UC=z(()=>{Ei();Dn=Et.instance()});var ug,wC,kC=z(()=>{QS();ug=class{getMeter(e,n,r){return KS}},wC=new ug});var lg,u_,GC=z(()=>{kC();hi();Ei();lg="metrics",u_=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return kr(lg,e,Et.instance())}getMeterProvider(){return vn(lg)||wC}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Gr(lg,Et.instance())}}});var pg,BC=z(()=>{GC();pg=u_.getInstance()});var l_,jC=z(()=>{l_=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function _g(t){return t.getValue(dg)||void 0}function HC(){return _g(Br.getInstance().active())}function VC(t,e){return t.setValue(dg,e)}function FC(t){return t.deleteValue(dg)}var dg,qC=z(()=>{ml();_l();dg=Ln("OpenTelemetry Baggage Key")});var fg,Z3,p_,$C=z(()=>{hi();jC();XS();qC();kS();Ei();fg="propagation",Z3=new l_,p_=class t{constructor(){this.createBaggage=lC,this.getBaggage=_g,this.getActiveBaggage=HC,this.setBaggage=VC,this.deleteBaggage=FC}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return kr(fg,e,Et.instance())}inject(e,n,r=Xd){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=Qd){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Gr(fg,Et.instance())}_getGlobalPropagator(){return vn(fg)||Z3}}});var Er,YC=z(()=>{$C();Er=p_.getInstance()});var mg,d_,WC=z(()=>{hi();ag();s_();tg();Ei();mg="trace",d_=class t{constructor(){this._proxyTracerProvider=new gi,this.wrapSpanContext=gC,this.isSpanContextValid=yo,this.deleteSpan=hC,this.getSpan=n_,this.getActiveSpan=TC,this.getSpanContext=r_,this.setSpan=hl,this.setSpanContext=EC}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=kr(mg,this._proxyTracerProvider,Et.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return vn(mg)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Gr(mg,Et.instance()),this._proxyTracerProvider=new gi}}});var X,zC=z(()=>{WC();X=d_.getInstance()});var v={};US(v,{DiagConsoleLogger:()=>zd,DiagLogLevel:()=>pt,INVALID_SPANID:()=>Tl,INVALID_SPAN_CONTEXT:()=>Zd,INVALID_TRACEID:()=>Si,ProxyTracer:()=>Va,ProxyTracerProvider:()=>gi,ROOT_CONTEXT:()=>Ba,SamplingDecision:()=>a_,SpanKind:()=>Oe,SpanStatusCode:()=>Be,TraceFlags:()=>Vt,ValueType:()=>Kd,baggageEntryMetadataFromString:()=>pC,context:()=>P,createContextKey:()=>Ln,createNoopMeter:()=>_C,createTraceState:()=>vC,default:()=>e9,defaultTextMapGetter:()=>Qd,defaultTextMapSetter:()=>Xd,diag:()=>Dn,isSpanContextValid:()=>yo,isValidSpanId:()=>rg,isValidTraceId:()=>ng,metrics:()=>pg,propagation:()=>Er,trace:()=>X});var e9,b=z(()=>{kS();_l();dC();Yd();QS();fC();XS();ig();ag();RC();yC();IC();ZS();LC();s_();e_();DC();UC();BC();YC();zC();e9={context:P,diag:Dn,metrics:pg,propagation:Er,trace:X}});var El=E(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.isTracingSuppressed=ts.unsuppressTracing=ts.suppressTracing=void 0;var t9=(b(),N(v)),Tg=(0,t9.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function n9(t){return t.setValue(Tg,!0)}ts.suppressTracing=n9;function r9(t){return t.deleteValue(Tg)}ts.unsuppressTracing=r9;function o9(t){return t.getValue(Tg)===!0}ts.isTracingSuppressed=o9});var hg=E(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.BAGGAGE_MAX_TOTAL_LENGTH=Ft.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=Ft.BAGGAGE_MAX_NAME_VALUE_PAIRS=Ft.BAGGAGE_HEADER=Ft.BAGGAGE_ITEMS_SEPARATOR=Ft.BAGGAGE_PROPERTIES_SEPARATOR=Ft.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;Ft.BAGGAGE_KEY_PAIR_SEPARATOR="=";Ft.BAGGAGE_PROPERTIES_SEPARATOR=";";Ft.BAGGAGE_ITEMS_SEPARATOR=",";Ft.BAGGAGE_HEADER="baggage";Ft.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;Ft.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;Ft.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Eg=E(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.parseKeyPairsIntoRecord=Hr.parsePairKeyValue=Hr.getKeyPairs=Hr.serializeKeyPairs=void 0;var s9=(b(),N(v)),Fa=hg();function i9(t){return t.reduce((e,n)=>{let r=`${e}${e!==""?Fa.BAGGAGE_ITEMS_SEPARATOR:""}${n}`;return r.length>Fa.BAGGAGE_MAX_TOTAL_LENGTH?e:r},"")}Hr.serializeKeyPairs=i9;function a9(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=Fa.BAGGAGE_PROPERTIES_SEPARATOR+n.metadata.toString()),r})}Hr.getKeyPairs=a9;function KC(t){if(!t)return;let e=t.indexOf(Fa.BAGGAGE_PROPERTIES_SEPARATOR),n=e===-1?t:t.substring(0,e),r=n.indexOf(Fa.BAGGAGE_KEY_PAIR_SEPARATOR);if(r<=0)return;let o=n.substring(0,r).trim(),s=n.substring(r+1).trim();if(!o||!s)return;let i,a;try{i=decodeURIComponent(o),a=decodeURIComponent(s)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=(0,s9.baggageEntryMetadataFromString)(l)}return{key:i,value:a,metadata:c}}Hr.parsePairKeyValue=KC;function c9(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Fa.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let r=KC(n);r!==void 0&&r.value.length>0&&(e[r.key]=r.value)}),e}Hr.parseKeyPairsIntoRecord=c9});var QC=E(__=>{"use strict";Object.defineProperty(__,"__esModule",{value:!0});__.W3CBaggagePropagator=void 0;var Sg=(b(),N(v)),u9=El(),Ai=hg(),gg=Eg(),Ag=class{inject(e,n,r){let o=Sg.propagation.getBaggage(e);if(!o||(0,u9.isTracingSuppressed)(e))return;let s=(0,gg.getKeyPairs)(o).filter(a=>a.length<=Ai.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Ai.BAGGAGE_MAX_NAME_VALUE_PAIRS),i=(0,gg.serializeKeyPairs)(s);i.length>0&&r.set(n,Ai.BAGGAGE_HEADER,i)}extract(e,n,r){let o=r.get(n,Ai.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Ai.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let i={};return s.length===0||(s.split(Ai.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let l=(0,gg.parsePairKeyValue)(c);if(l){let p={value:l.value};l.metadata&&(p.metadata=l.metadata),i[l.key]=p}}),Object.entries(i).length===0)?e:Sg.propagation.setBaggage(e,Sg.propagation.createBaggage(i))}fields(){return[Ai.BAGGAGE_HEADER]}};__.W3CBaggagePropagator=Ag});var XC=E(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});f_.AnchoredClock=void 0;var Rg=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,n){this._monotonicClock=n,this._epochMillis=e.now(),this._performanceMillis=n.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};f_.AnchoredClock=Rg});var nP=E(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.isAttributeValue=ns.isAttributeKey=ns.sanitizeAttributes=void 0;var JC=(b(),N(v));function l9(t){let e={};if(typeof t!="object"||t==null)return e;for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!ZC(n)){JC.diag.warn(`Invalid attribute key: ${n}`);continue}let r=t[n];if(!eP(r)){JC.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}ns.sanitizeAttributes=l9;function ZC(t){return typeof t=="string"&&t!==""}ns.isAttributeKey=ZC;function eP(t){return t==null?!0:Array.isArray(t)?p9(t):tP(typeof t)}ns.isAttributeValue=eP;function p9(t){let e;for(let n of t){if(n==null)continue;let r=typeof n;if(r!==e){if(!e){if(tP(r)){e=r;continue}return!1}return!1}}return!0}function tP(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var yg=E(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});m_.loggingErrorHandler=void 0;var d9=(b(),N(v));function _9(){return t=>{d9.diag.error(f9(t))}}m_.loggingErrorHandler=_9;function f9(t){return typeof t=="string"?t:JSON.stringify(m9(t))}function m9(t){let e={},n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;let o=n[r];o&&(e[r]=String(o))}),n=Object.getPrototypeOf(n);return e}});var oP=E(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.globalErrorHandler=qa.setGlobalErrorHandler=void 0;var T9=yg(),rP=(0,T9.loggingErrorHandler)();function h9(t){rP=t}qa.setGlobalErrorHandler=h9;function E9(t){try{rP(t)}catch{}}qa.globalErrorHandler=E9});var cP=E(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.getStringListFromEnv=Vr.getBooleanFromEnv=Vr.getStringFromEnv=Vr.getNumberFromEnv=void 0;var sP=(b(),N(v)),iP=U("util");function S9(t){let e=process.env[t];if(e==null||e.trim()==="")return;let n=Number(e);if(isNaN(n)){sP.diag.warn(`Unknown value ${(0,iP.inspect)(e)} for ${t}, expected a number, using defaults`);return}return n}Vr.getNumberFromEnv=S9;function aP(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}Vr.getStringFromEnv=aP;function g9(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||sP.diag.warn(`Unknown value ${(0,iP.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}Vr.getBooleanFromEnv=g9;function A9(t){return aP(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}Vr.getStringListFromEnv=A9});var uP=E(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});T_._globalThis=void 0;T_._globalThis=globalThis});var lP=E(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});h_.VERSION=void 0;h_.VERSION="2.6.1"});function We(t){let e={},n=t.length;for(let r=0;r<n;r++){let o=t[r];o&&(e[String(o).toUpperCase().replace(/[-.]/g,"_")]=o)}return e}var Ig=z(()=>{});var pP,dP,_P,fP,mP,TP,hP,EP,SP,gP,AP,RP,yP,IP,NP,OP,bP,CP,PP,MP,xP,vP,LP,DP,UP,wP,kP,GP,BP,jP,HP,VP,FP,qP,$P,YP,WP,zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,TM,hM,EM,SM,gM,AM,RM,yM,IM,NM,OM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,VM,FM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,Tx,hx,Ex,Sx,gx,Ax,Rx,yx,Ix,Nx,Ox,bx,Cx,Px,Mx,R9,Ng,y9,I9,N9,O9,Og,b9,C9,P9,M9,x9,v9,L9,D9,U9,w9,k9,G9,B9,j9,H9,V9,F9,q9,bg,$9,Y9,W9,z9,K9,Q9,X9,J9,Z9,eQ,tQ,nQ,Cg,rQ,oQ,Pg,Mg,sQ,iQ,aQ,cQ,uQ,lQ,pQ,dQ,_Q,fQ,mQ,TQ,hQ,EQ,SQ,gQ,AQ,Sl,$a,xg,RQ,yQ,Ri,IQ,NQ,OQ,bQ,vg,Lg,CQ,Dg,PQ,MQ,xQ,vQ,LQ,DQ,UQ,wQ,kQ,GQ,BQ,jQ,HQ,VQ,FQ,qQ,$Q,YQ,WQ,zQ,KQ,QQ,XQ,Ug,JQ,ZQ,eX,tX,nX,rX,oX,sX,iX,aX,cX,uX,lX,pX,dX,_X,fX,mX,TX,wg,hX,kg,EX,SX,gX,AX,RX,yX,IX,NX,OX,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Vx,Fx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,fv,mv,Tv,hv,Ev,Sv,gv,Av,Rv,yv,bX,CX,PX,MX,xX,vX,LX,DX,UX,wX,kX,GX,BX,jX,HX,VX,FX,qX,$X,YX,WX,zX,KX,QX,XX,JX,ZX,eJ,tJ,nJ,rJ,oJ,sJ,iJ,aJ,cJ,uJ,lJ,pJ,dJ,_J,fJ,mJ,TJ,hJ,EJ,SJ,gJ,Iv,Nv,Ov,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,AJ,RJ,yJ,IJ,NJ,OJ,bJ,CJ,PJ,MJ,xJ,vJ,Uv,wv,kv,Gv,Bv,LJ,DJ,UJ,wJ,kJ,GJ,jv,Hv,Vv,BJ,jJ,HJ,VJ,Fv,qv,$v,Yv,FJ,qJ,$J,YJ,WJ,Wv,zv,Kv,Qv,Xv,Jv,Zv,zJ,KJ,QJ,XJ,JJ,ZJ,eZ,tZ,eL,tL,nL,rL,oL,nZ,rZ,oZ,sZ,iZ,aZ,sL,iL,aL,cL,uL,lL,pL,dL,_L,fL,mL,TL,hL,EL,SL,gL,AL,RL,yL,IL,NL,cZ,uZ,lZ,pZ,dZ,_Z,fZ,mZ,TZ,hZ,EZ,SZ,gZ,AZ,RZ,yZ,IZ,NZ,OZ,bZ,CZ,PZ,OL,bL,CL,PL,ML,MZ,xZ,vZ,LZ,DZ,UZ,xL,vL,wZ,kZ,GZ,LL,DL,BZ,jZ,HZ,UL,wL,kL,GL,BL,jL,HL,VL,FL,qL,$L,YL,WL,zL,KL,QL,XL,VZ,FZ,qZ,$Z,YZ,WZ,zZ,KZ,QZ,XZ,JZ,ZZ,e5,t5,n5,r5,o5,s5,JL,ZL,i5,a5,c5,e0=z(()=>{Ig();pP="aws.lambda.invoked_arn",dP="db.system",_P="db.connection_string",fP="db.user",mP="db.jdbc.driver_classname",TP="db.name",hP="db.statement",EP="db.operation",SP="db.mssql.instance_name",gP="db.cassandra.keyspace",AP="db.cassandra.page_size",RP="db.cassandra.consistency_level",yP="db.cassandra.table",IP="db.cassandra.idempotence",NP="db.cassandra.speculative_execution_count",OP="db.cassandra.coordinator.id",bP="db.cassandra.coordinator.dc",CP="db.hbase.namespace",PP="db.redis.database_index",MP="db.mongodb.collection",xP="db.sql.table",vP="exception.type",LP="exception.message",DP="exception.stacktrace",UP="exception.escaped",wP="faas.trigger",kP="faas.execution",GP="faas.document.collection",BP="faas.document.operation",jP="faas.document.time",HP="faas.document.name",VP="faas.time",FP="faas.cron",qP="faas.coldstart",$P="faas.invoked_name",YP="faas.invoked_provider",WP="faas.invoked_region",zP="net.transport",KP="net.peer.ip",QP="net.peer.port",XP="net.peer.name",JP="net.host.ip",ZP="net.host.port",eM="net.host.name",tM="net.host.connection.type",nM="net.host.connection.subtype",rM="net.host.carrier.name",oM="net.host.carrier.mcc",sM="net.host.carrier.mnc",iM="net.host.carrier.icc",aM="peer.service",cM="enduser.id",uM="enduser.role",lM="enduser.scope",pM="thread.id",dM="thread.name",_M="code.function",fM="code.namespace",mM="code.filepath",TM="code.lineno",hM="http.method",EM="http.url",SM="http.target",gM="http.host",AM="http.scheme",RM="http.status_code",yM="http.flavor",IM="http.user_agent",NM="http.request_content_length",OM="http.request_content_length_uncompressed",bM="http.response_content_length",CM="http.response_content_length_uncompressed",PM="http.server_name",MM="http.route",xM="http.client_ip",vM="aws.dynamodb.table_names",LM="aws.dynamodb.consumed_capacity",DM="aws.dynamodb.item_collection_metrics",UM="aws.dynamodb.provisioned_read_capacity",wM="aws.dynamodb.provisioned_write_capacity",kM="aws.dynamodb.consistent_read",GM="aws.dynamodb.projection",BM="aws.dynamodb.limit",jM="aws.dynamodb.attributes_to_get",HM="aws.dynamodb.index_name",VM="aws.dynamodb.select",FM="aws.dynamodb.global_secondary_indexes",qM="aws.dynamodb.local_secondary_indexes",$M="aws.dynamodb.exclusive_start_table",YM="aws.dynamodb.table_count",WM="aws.dynamodb.scan_forward",zM="aws.dynamodb.segment",KM="aws.dynamodb.total_segments",QM="aws.dynamodb.count",XM="aws.dynamodb.scanned_count",JM="aws.dynamodb.attribute_definitions",ZM="aws.dynamodb.global_secondary_index_updates",ex="messaging.system",tx="messaging.destination",nx="messaging.destination_kind",rx="messaging.temp_destination",ox="messaging.protocol",sx="messaging.protocol_version",ix="messaging.url",ax="messaging.message_id",cx="messaging.conversation_id",ux="messaging.message_payload_size_bytes",lx="messaging.message_payload_compressed_size_bytes",px="messaging.operation",dx="messaging.consumer_id",_x="messaging.rabbitmq.routing_key",fx="messaging.kafka.message_key",mx="messaging.kafka.consumer_group",Tx="messaging.kafka.client_id",hx="messaging.kafka.partition",Ex="messaging.kafka.tombstone",Sx="rpc.system",gx="rpc.service",Ax="rpc.method",Rx="rpc.grpc.status_code",yx="rpc.jsonrpc.version",Ix="rpc.jsonrpc.request_id",Nx="rpc.jsonrpc.error_code",Ox="rpc.jsonrpc.error_message",bx="message.type",Cx="message.id",Px="message.compressed_size",Mx="message.uncompressed_size",R9=pP,Ng=dP,y9=_P,I9=fP,N9=mP,O9=TP,Og=hP,b9=EP,C9=SP,P9=gP,M9=AP,x9=RP,v9=yP,L9=IP,D9=NP,U9=OP,w9=bP,k9=CP,G9=PP,B9=MP,j9=xP,H9=vP,V9=LP,F9=DP,q9=UP,bg=wP,$9=kP,Y9=GP,W9=BP,z9=jP,K9=HP,Q9=VP,X9=FP,J9=qP,Z9=$P,eQ=YP,tQ=WP,nQ=zP,Cg=KP,rQ=QP,oQ=XP,Pg=JP,Mg=ZP,sQ=eM,iQ=tM,aQ=nM,cQ=rM,uQ=oM,lQ=sM,pQ=iM,dQ=aM,_Q=cM,fQ=uM,mQ=lM,TQ=pM,hQ=dM,EQ=_M,SQ=fM,gQ=mM,AQ=TM,Sl=hM,$a=EM,xg=SM,RQ=gM,yQ=AM,Ri=RM,IQ=yM,NQ=IM,OQ=NM,bQ=OM,vg=bM,Lg=CM,CQ=PM,Dg=MM,PQ=xM,MQ=vM,xQ=LM,vQ=DM,LQ=UM,DQ=wM,UQ=kM,wQ=GM,kQ=BM,GQ=jM,BQ=HM,jQ=VM,HQ=FM,VQ=qM,FQ=$M,qQ=YM,$Q=WM,YQ=zM,WQ=KM,zQ=QM,KQ=XM,QQ=JM,XQ=ZM,Ug=ex,JQ=tx,ZQ=nx,eX=rx,tX=ox,nX=sx,rX=ix,oX=ax,sX=cx,iX=ux,aX=lx,cX=px,uX=dx,lX=_x,pX=fx,dX=mx,_X=Tx,fX=hx,mX=Ex,TX=Sx,wg=gx,hX=Ax,kg=Rx,EX=yx,SX=Ix,gX=Nx,AX=Ox,RX=bx,yX=Cx,IX=Px,NX=Mx,OX=We([pP,dP,_P,fP,mP,TP,hP,EP,SP,gP,AP,RP,yP,IP,NP,OP,bP,CP,PP,MP,xP,vP,LP,DP,UP,wP,kP,GP,BP,jP,HP,VP,FP,qP,$P,YP,WP,zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,TM,hM,EM,SM,gM,AM,RM,yM,IM,NM,OM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,VM,FM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,Tx,hx,Ex,Sx,gx,Ax,Rx,yx,Ix,Nx,Ox,bx,Cx,Px,Mx]),xx="other_sql",vx="mssql",Lx="mysql",Dx="oracle",Ux="db2",wx="postgresql",kx="redshift",Gx="hive",Bx="cloudscape",jx="hsqldb",Hx="progress",Vx="maxdb",Fx="hanadb",qx="ingres",$x="firstsql",Yx="edb",Wx="cache",zx="adabas",Kx="firebird",Qx="derby",Xx="filemaker",Jx="informix",Zx="instantdb",ev="interbase",tv="mariadb",nv="netezza",rv="pervasive",ov="pointbase",sv="sqlite",iv="sybase",av="teradata",cv="vertica",uv="h2",lv="coldfusion",pv="cassandra",dv="hbase",_v="mongodb",fv="redis",mv="couchbase",Tv="couchdb",hv="cosmosdb",Ev="dynamodb",Sv="neo4j",gv="geode",Av="elasticsearch",Rv="memcached",yv="cockroachdb",bX=xx,CX=vx,PX=Lx,MX=Dx,xX=Ux,vX=wx,LX=kx,DX=Gx,UX=Bx,wX=jx,kX=Hx,GX=Vx,BX=Fx,jX=qx,HX=$x,VX=Yx,FX=Wx,qX=zx,$X=Kx,YX=Qx,WX=Xx,zX=Jx,KX=Zx,QX=ev,XX=tv,JX=nv,ZX=rv,eJ=ov,tJ=sv,nJ=iv,rJ=av,oJ=cv,sJ=uv,iJ=lv,aJ=pv,cJ=dv,uJ=_v,lJ=fv,pJ=mv,dJ=Tv,_J=hv,fJ=Ev,mJ=Sv,TJ=gv,hJ=Av,EJ=Rv,SJ=yv,gJ=We([xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Vx,Fx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,fv,mv,Tv,hv,Ev,Sv,gv,Av,Rv,yv]),Iv="all",Nv="each_quorum",Ov="quorum",bv="local_quorum",Cv="one",Pv="two",Mv="three",xv="local_one",vv="any",Lv="serial",Dv="local_serial",AJ=Iv,RJ=Nv,yJ=Ov,IJ=bv,NJ=Cv,OJ=Pv,bJ=Mv,CJ=xv,PJ=vv,MJ=Lv,xJ=Dv,vJ=We([Iv,Nv,Ov,bv,Cv,Pv,Mv,xv,vv,Lv,Dv]),Uv="datasource",wv="http",kv="pubsub",Gv="timer",Bv="other",LJ=Uv,DJ=wv,UJ=kv,wJ=Gv,kJ=Bv,GJ=We([Uv,wv,kv,Gv,Bv]),jv="insert",Hv="edit",Vv="delete",BJ=jv,jJ=Hv,HJ=Vv,VJ=We([jv,Hv,Vv]),Fv="alibaba_cloud",qv="aws",$v="azure",Yv="gcp",FJ=Fv,qJ=qv,$J=$v,YJ=Yv,WJ=We([Fv,qv,$v,Yv]),Wv="ip_tcp",zv="ip_udp",Kv="ip",Qv="unix",Xv="pipe",Jv="inproc",Zv="other",zJ=Wv,KJ=zv,QJ=Kv,XJ=Qv,JJ=Xv,ZJ=Jv,eZ=Zv,tZ=We([Wv,zv,Kv,Qv,Xv,Jv,Zv]),eL="wifi",tL="wired",nL="cell",rL="unavailable",oL="unknown",nZ=eL,rZ=tL,oZ=nL,sZ=rL,iZ=oL,aZ=We([eL,tL,nL,rL,oL]),sL="gprs",iL="edge",aL="umts",cL="cdma",uL="evdo_0",lL="evdo_a",pL="cdma2000_1xrtt",dL="hsdpa",_L="hsupa",fL="hspa",mL="iden",TL="evdo_b",hL="lte",EL="ehrpd",SL="hspap",gL="gsm",AL="td_scdma",RL="iwlan",yL="nr",IL="nrnsa",NL="lte_ca",cZ=sL,uZ=iL,lZ=aL,pZ=cL,dZ=uL,_Z=lL,fZ=pL,mZ=dL,TZ=_L,hZ=fL,EZ=mL,SZ=TL,gZ=hL,AZ=EL,RZ=SL,yZ=gL,IZ=AL,NZ=RL,OZ=yL,bZ=IL,CZ=NL,PZ=We([sL,iL,aL,cL,uL,lL,pL,dL,_L,fL,mL,TL,hL,EL,SL,gL,AL,RL,yL,IL,NL]),OL="1.0",bL="1.1",CL="2.0",PL="SPDY",ML="QUIC",MZ=OL,xZ=bL,vZ=CL,LZ=PL,DZ=ML,UZ={HTTP_1_0:OL,HTTP_1_1:bL,HTTP_2_0:CL,SPDY:PL,QUIC:ML},xL="queue",vL="topic",wZ=xL,kZ=vL,GZ=We([xL,vL]),LL="receive",DL="process",BZ=LL,jZ=DL,HZ=We([LL,DL]),UL=0,wL=1,kL=2,GL=3,BL=4,jL=5,HL=6,VL=7,FL=8,qL=9,$L=10,YL=11,WL=12,zL=13,KL=14,QL=15,XL=16,VZ=UL,FZ=wL,qZ=kL,$Z=GL,YZ=BL,WZ=jL,zZ=HL,KZ=VL,QZ=FL,XZ=qL,JZ=$L,ZZ=YL,e5=WL,t5=zL,n5=KL,r5=QL,o5=XL,s5={OK:UL,CANCELLED:wL,UNKNOWN:kL,INVALID_ARGUMENT:GL,DEADLINE_EXCEEDED:BL,NOT_FOUND:jL,ALREADY_EXISTS:HL,PERMISSION_DENIED:VL,RESOURCE_EXHAUSTED:FL,FAILED_PRECONDITION:qL,ABORTED:$L,OUT_OF_RANGE:YL,UNIMPLEMENTED:WL,INTERNAL:zL,UNAVAILABLE:KL,DATA_LOSS:QL,UNAUTHENTICATED:XL},JL="SENT",ZL="RECEIVED",i5=JL,a5=ZL,c5=We([JL,ZL])});var t0=z(()=>{e0()});var n0,r0,o0,s0,i0,a0,c0,u0,l0,p0,d0,_0,f0,m0,T0,h0,E0,S0,g0,A0,R0,y0,I0,N0,O0,b0,C0,P0,M0,x0,v0,L0,D0,U0,w0,k0,G0,B0,j0,H0,V0,F0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,TD,hD,ED,SD,gD,AD,RD,yD,ID,ND,OD,bD,CD,u5,l5,p5,d5,_5,f5,m5,T5,h5,E5,S5,g5,A5,R5,y5,I5,N5,O5,b5,C5,P5,M5,x5,v5,L5,D5,U5,w5,k5,G5,B5,j5,H5,V5,F5,q5,$5,Y5,W5,z5,K5,Q5,X5,J5,Z5,e6,t6,n6,r6,o6,s6,i6,a6,c6,u6,l6,p6,d6,_6,f6,m6,T6,h6,E6,S6,g6,A6,R6,y6,I6,N6,Gg,O6,b6,C6,P6,M6,x6,v6,L6,D6,U6,PD,MD,xD,vD,w6,k6,G6,B6,j6,LD,DD,UD,wD,kD,GD,BD,jD,HD,VD,FD,qD,$D,YD,WD,zD,KD,H6,V6,F6,q6,$6,Y6,W6,z6,K6,Q6,X6,J6,Z6,e8,t8,n8,r8,o8,QD,XD,s8,i8,a8,JD,ZD,eU,tU,nU,rU,oU,c8,u8,l8,p8,d8,_8,f8,m8,sU,iU,aU,cU,uU,lU,pU,dU,_U,fU,mU,T8,h8,E8,S8,g8,A8,R8,y8,I8,N8,O8,b8,TU,hU,EU,SU,gU,AU,RU,yU,IU,NU,C8,P8,M8,x8,v8,L8,D8,U8,w8,k8,G8,OU=z(()=>{Ig();n0="cloud.provider",r0="cloud.account.id",o0="cloud.region",s0="cloud.availability_zone",i0="cloud.platform",a0="aws.ecs.container.arn",c0="aws.ecs.cluster.arn",u0="aws.ecs.launchtype",l0="aws.ecs.task.arn",p0="aws.ecs.task.family",d0="aws.ecs.task.revision",_0="aws.eks.cluster.arn",f0="aws.log.group.names",m0="aws.log.group.arns",T0="aws.log.stream.names",h0="aws.log.stream.arns",E0="container.name",S0="container.id",g0="container.runtime",A0="container.image.name",R0="container.image.tag",y0="deployment.environment",I0="device.id",N0="device.model.identifier",O0="device.model.name",b0="faas.name",C0="faas.id",P0="faas.version",M0="faas.instance",x0="faas.max_memory",v0="host.id",L0="host.name",D0="host.type",U0="host.arch",w0="host.image.name",k0="host.image.id",G0="host.image.version",B0="k8s.cluster.name",j0="k8s.node.name",H0="k8s.node.uid",V0="k8s.namespace.name",F0="k8s.pod.uid",q0="k8s.pod.name",$0="k8s.container.name",Y0="k8s.replicaset.uid",W0="k8s.replicaset.name",z0="k8s.deployment.uid",K0="k8s.deployment.name",Q0="k8s.statefulset.uid",X0="k8s.statefulset.name",J0="k8s.daemonset.uid",Z0="k8s.daemonset.name",eD="k8s.job.uid",tD="k8s.job.name",nD="k8s.cronjob.uid",rD="k8s.cronjob.name",oD="os.type",sD="os.description",iD="os.name",aD="os.version",cD="process.pid",uD="process.executable.name",lD="process.executable.path",pD="process.command",dD="process.command_line",_D="process.command_args",fD="process.owner",mD="process.runtime.name",TD="process.runtime.version",hD="process.runtime.description",ED="service.name",SD="service.namespace",gD="service.instance.id",AD="service.version",RD="telemetry.sdk.name",yD="telemetry.sdk.language",ID="telemetry.sdk.version",ND="telemetry.auto.version",OD="webengine.name",bD="webengine.version",CD="webengine.description",u5=n0,l5=r0,p5=o0,d5=s0,_5=i0,f5=a0,m5=c0,T5=u0,h5=l0,E5=p0,S5=d0,g5=_0,A5=f0,R5=m0,y5=T0,I5=h0,N5=E0,O5=S0,b5=g0,C5=A0,P5=R0,M5=y0,x5=I0,v5=N0,L5=O0,D5=b0,U5=C0,w5=P0,k5=M0,G5=x0,B5=v0,j5=L0,H5=D0,V5=U0,F5=w0,q5=k0,$5=G0,Y5=B0,W5=j0,z5=H0,K5=V0,Q5=F0,X5=q0,J5=$0,Z5=Y0,e6=W0,t6=z0,n6=K0,r6=Q0,o6=X0,s6=J0,i6=Z0,a6=eD,c6=tD,u6=nD,l6=rD,p6=oD,d6=sD,_6=iD,f6=aD,m6=cD,T6=uD,h6=lD,E6=pD,S6=dD,g6=_D,A6=fD,R6=mD,y6=TD,I6=hD,N6=ED,Gg=SD,O6=gD,b6=AD,C6=RD,P6=yD,M6=ID,x6=ND,v6=OD,L6=bD,D6=CD,U6=We([n0,r0,o0,s0,i0,a0,c0,u0,l0,p0,d0,_0,f0,m0,T0,h0,E0,S0,g0,A0,R0,y0,I0,N0,O0,b0,C0,P0,M0,x0,v0,L0,D0,U0,w0,k0,G0,B0,j0,H0,V0,F0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,TD,hD,ED,SD,gD,AD,RD,yD,ID,ND,OD,bD,CD]),PD="alibaba_cloud",MD="aws",xD="azure",vD="gcp",w6=PD,k6=MD,G6=xD,B6=vD,j6=We([PD,MD,xD,vD]),LD="alibaba_cloud_ecs",DD="alibaba_cloud_fc",UD="aws_ec2",wD="aws_ecs",kD="aws_eks",GD="aws_lambda",BD="aws_elastic_beanstalk",jD="azure_vm",HD="azure_container_instances",VD="azure_aks",FD="azure_functions",qD="azure_app_service",$D="gcp_compute_engine",YD="gcp_cloud_run",WD="gcp_kubernetes_engine",zD="gcp_cloud_functions",KD="gcp_app_engine",H6=LD,V6=DD,F6=UD,q6=wD,$6=kD,Y6=GD,W6=BD,z6=jD,K6=HD,Q6=VD,X6=FD,J6=qD,Z6=$D,e8=YD,t8=WD,n8=zD,r8=KD,o8=We([LD,DD,UD,wD,kD,GD,BD,jD,HD,VD,FD,qD,$D,YD,WD,zD,KD]),QD="ec2",XD="fargate",s8=QD,i8=XD,a8=We([QD,XD]),JD="amd64",ZD="arm32",eU="arm64",tU="ia64",nU="ppc32",rU="ppc64",oU="x86",c8=JD,u8=ZD,l8=eU,p8=tU,d8=nU,_8=rU,f8=oU,m8=We([JD,ZD,eU,tU,nU,rU,oU]),sU="windows",iU="linux",aU="darwin",cU="freebsd",uU="netbsd",lU="openbsd",pU="dragonflybsd",dU="hpux",_U="aix",fU="solaris",mU="z_os",T8=sU,h8=iU,E8=aU,S8=cU,g8=uU,A8=lU,R8=pU,y8=dU,I8=_U,N8=fU,O8=mU,b8=We([sU,iU,aU,cU,uU,lU,pU,dU,_U,fU,mU]),TU="cpp",hU="dotnet",EU="erlang",SU="go",gU="java",AU="nodejs",RU="php",yU="python",IU="ruby",NU="webjs",C8=TU,P8=hU,M8=EU,x8=SU,v8=gU,L8=AU,D8=RU,U8=yU,w8=IU,k8=NU,G8=We([TU,hU,EU,SU,gU,AU,RU,yU,IU,NU])});var bU=z(()=>{OU()});var B8,j8,H8,V8,F8,q8,$8,Y8,W8,z8,K8,Q8,X8,J8,Z8,e7,t7,n7,r7,o7,s7,i7,a7,c7,u7,Bg,jg,l7,Ya,p7,Hg,Vg,d7,yi,_7,f7,m7,T7,h7,E7,S7,g7,A7,R7,Fg,y7,I7,N7,O7,b7,C7,Ii,P7,M7,x7,v7,L7,D7,U7,w7,k7,G7,B7,j7,H7,Io,No,V7,F7,q7,$7,Y7,W7,z7,K7,Q7,X7,J7,Z7,eee,tee,nee,ree,qg,$g,oee,Yg,Wg,see,iee,aee,cee,uee,lee,pee,dee,_ee,fee,mee,Tee,hee,Eee,zg,Kg,See,Qg,gee,Xg,Aee,Ree,yee,Iee,Nee,Oee,bee,Cee,Pee,Mee,xee,vee,Lee,Dee,Uee,wee,kee,Gee,Bee,jee,Hee,Vee,Fee,qee,rs,$ee,Yee,Wee,Jg,CU=z(()=>{B8="aspnetcore.diagnostics.exception.result",j8="aborted",H8="handled",V8="skipped",F8="unhandled",q8="aspnetcore.diagnostics.handler.type",$8="aspnetcore.rate_limiting.policy",Y8="aspnetcore.rate_limiting.result",W8="acquired",z8="endpoint_limiter",K8="global_limiter",Q8="request_canceled",X8="aspnetcore.request.is_unhandled",J8="aspnetcore.routing.is_fallback",Z8="aspnetcore.routing.match_status",e7="failure",t7="success",n7="aspnetcore.user.is_authenticated",r7="client.address",o7="client.port",s7="code.column.number",i7="code.file.path",a7="code.function.name",c7="code.line.number",u7="code.stacktrace",Bg="db.collection.name",jg="db.namespace",l7="db.operation.batch.size",Ya="db.operation.name",p7="db.query.summary",Hg="db.query.text",Vg="db.response.status_code",d7="db.stored_procedure.name",yi="db.system.name",_7="mariadb",f7="microsoft.sql_server",m7="mysql",T7="postgresql",h7="dotnet.gc.heap.generation",E7="gen0",S7="gen1",g7="gen2",A7="loh",R7="poh",Fg="error.type",y7="_OTHER",I7="exception.escaped",N7="exception.message",O7="exception.stacktrace",b7="exception.type",C7=t=>`http.request.header.${t}`,Ii="http.request.method",P7="_OTHER",M7="CONNECT",x7="DELETE",v7="GET",L7="HEAD",D7="OPTIONS",U7="PATCH",w7="POST",k7="PUT",G7="TRACE",B7="http.request.method_original",j7="http.request.resend_count",H7=t=>`http.response.header.${t}`,Io="http.response.status_code",No="http.route",V7="jvm.gc.action",F7="jvm.gc.name",q7="jvm.memory.pool.name",$7="jvm.memory.type",Y7="heap",W7="non_heap",z7="jvm.thread.daemon",K7="jvm.thread.state",Q7="blocked",X7="new",J7="runnable",Z7="terminated",eee="timed_waiting",tee="waiting",nee="network.local.address",ree="network.local.port",qg="network.peer.address",$g="network.peer.port",oee="network.protocol.name",Yg="network.protocol.version",Wg="network.transport",see="pipe",iee="quic",aee="tcp",cee="udp",uee="unix",lee="network.type",pee="ipv4",dee="ipv6",_ee="otel.scope.name",fee="otel.scope.version",mee="otel.status_code",Tee="ERROR",hee="OK",Eee="otel.status_description",zg="server.address",Kg="server.port",See="service.instance.id",Qg="service.name",gee="service.namespace",Xg="service.version",Aee="signalr.connection.status",Ree="app_shutdown",yee="normal_closure",Iee="timeout",Nee="signalr.transport",Oee="long_polling",bee="server_sent_events",Cee="web_sockets",Pee="telemetry.sdk.language",Mee="cpp",xee="dotnet",vee="erlang",Lee="go",Dee="java",Uee="nodejs",wee="php",kee="python",Gee="ruby",Bee="rust",jee="swift",Hee="webjs",Vee="telemetry.sdk.name",Fee="telemetry.sdk.version",qee="url.fragment",rs="url.full",$ee="url.path",Yee="url.query",Wee="url.scheme",Jg="user_agent.original"});var zee,Kee,Qee,Xee,Jee,Zee,ete,tte,nte,rte,ote,ste,ite,ate,cte,ute,lte,pte,dte,_te,fte,mte,Tte,hte,Ete,Ste,gte,Ate,Rte,yte,Ite,Nte,Ote,bte,Cte,Pte,Mte,xte,vte,Lte,Dte,Ute,wte,kte,Gte,Bte,jte,Hte,Vte,Fte,qte,PU=z(()=>{zee="aspnetcore.diagnostics.exceptions",Kee="aspnetcore.rate_limiting.active_request_leases",Qee="aspnetcore.rate_limiting.queued_requests",Xee="aspnetcore.rate_limiting.request.time_in_queue",Jee="aspnetcore.rate_limiting.request_lease.duration",Zee="aspnetcore.rate_limiting.requests",ete="aspnetcore.routing.match_attempts",tte="db.client.operation.duration",nte="dotnet.assembly.count",rte="dotnet.exceptions",ote="dotnet.gc.collections",ste="dotnet.gc.heap.total_allocated",ite="dotnet.gc.last_collection.heap.fragmentation.size",ate="dotnet.gc.last_collection.heap.size",cte="dotnet.gc.last_collection.memory.committed_size",ute="dotnet.gc.pause.time",lte="dotnet.jit.compilation.time",pte="dotnet.jit.compiled_il.size",dte="dotnet.jit.compiled_methods",_te="dotnet.monitor.lock_contentions",fte="dotnet.process.cpu.count",mte="dotnet.process.cpu.time",Tte="dotnet.process.memory.working_set",hte="dotnet.thread_pool.queue.length",Ete="dotnet.thread_pool.thread.count",Ste="dotnet.thread_pool.work_item.count",gte="dotnet.timer.count",Ate="http.client.request.duration",Rte="http.server.request.duration",yte="jvm.class.count",Ite="jvm.class.loaded",Nte="jvm.class.unloaded",Ote="jvm.cpu.count",bte="jvm.cpu.recent_utilization",Cte="jvm.cpu.time",Pte="jvm.gc.duration",Mte="jvm.memory.committed",xte="jvm.memory.limit",vte="jvm.memory.used",Lte="jvm.memory.used_after_last_gc",Dte="jvm.thread.count",Ute="kestrel.active_connections",wte="kestrel.active_tls_handshakes",kte="kestrel.connection.duration",Gte="kestrel.queued_connections",Bte="kestrel.queued_requests",jte="kestrel.rejected_connections",Hte="kestrel.tls_handshake.duration",Vte="kestrel.upgraded_connections",Fte="signalr.server.active_connections",qte="signalr.server.connection.duration"});var $te,MU=z(()=>{$te="exception"});var Ae={};US(Ae,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>j8,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>H8,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>V8,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>F8,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>W8,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>z8,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>K8,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>Q8,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>e7,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>t7,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>B8,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>q8,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>$8,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>Y8,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>X8,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>J8,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>Z8,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>n7,ATTR_CLIENT_ADDRESS:()=>r7,ATTR_CLIENT_PORT:()=>o7,ATTR_CODE_COLUMN_NUMBER:()=>s7,ATTR_CODE_FILE_PATH:()=>i7,ATTR_CODE_FUNCTION_NAME:()=>a7,ATTR_CODE_LINE_NUMBER:()=>c7,ATTR_CODE_STACKTRACE:()=>u7,ATTR_DB_COLLECTION_NAME:()=>Bg,ATTR_DB_NAMESPACE:()=>jg,ATTR_DB_OPERATION_BATCH_SIZE:()=>l7,ATTR_DB_OPERATION_NAME:()=>Ya,ATTR_DB_QUERY_SUMMARY:()=>p7,ATTR_DB_QUERY_TEXT:()=>Hg,ATTR_DB_RESPONSE_STATUS_CODE:()=>Vg,ATTR_DB_STORED_PROCEDURE_NAME:()=>d7,ATTR_DB_SYSTEM_NAME:()=>yi,ATTR_DOTNET_GC_HEAP_GENERATION:()=>h7,ATTR_ERROR_TYPE:()=>Fg,ATTR_EXCEPTION_ESCAPED:()=>I7,ATTR_EXCEPTION_MESSAGE:()=>N7,ATTR_EXCEPTION_STACKTRACE:()=>O7,ATTR_EXCEPTION_TYPE:()=>b7,ATTR_HTTP_REQUEST_HEADER:()=>C7,ATTR_HTTP_REQUEST_METHOD:()=>Ii,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>B7,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>j7,ATTR_HTTP_RESPONSE_HEADER:()=>H7,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>Io,ATTR_HTTP_ROUTE:()=>No,ATTR_JVM_GC_ACTION:()=>V7,ATTR_JVM_GC_NAME:()=>F7,ATTR_JVM_MEMORY_POOL_NAME:()=>q7,ATTR_JVM_MEMORY_TYPE:()=>$7,ATTR_JVM_THREAD_DAEMON:()=>z7,ATTR_JVM_THREAD_STATE:()=>K7,ATTR_NETWORK_LOCAL_ADDRESS:()=>nee,ATTR_NETWORK_LOCAL_PORT:()=>ree,ATTR_NETWORK_PEER_ADDRESS:()=>qg,ATTR_NETWORK_PEER_PORT:()=>$g,ATTR_NETWORK_PROTOCOL_NAME:()=>oee,ATTR_NETWORK_PROTOCOL_VERSION:()=>Yg,ATTR_NETWORK_TRANSPORT:()=>Wg,ATTR_NETWORK_TYPE:()=>lee,ATTR_OTEL_SCOPE_NAME:()=>_ee,ATTR_OTEL_SCOPE_VERSION:()=>fee,ATTR_OTEL_STATUS_CODE:()=>mee,ATTR_OTEL_STATUS_DESCRIPTION:()=>Eee,ATTR_SERVER_ADDRESS:()=>zg,ATTR_SERVER_PORT:()=>Kg,ATTR_SERVICE_INSTANCE_ID:()=>See,ATTR_SERVICE_NAME:()=>Qg,ATTR_SERVICE_NAMESPACE:()=>gee,ATTR_SERVICE_VERSION:()=>Xg,ATTR_SIGNALR_CONNECTION_STATUS:()=>Aee,ATTR_SIGNALR_TRANSPORT:()=>Nee,ATTR_TELEMETRY_SDK_LANGUAGE:()=>Pee,ATTR_TELEMETRY_SDK_NAME:()=>Vee,ATTR_TELEMETRY_SDK_VERSION:()=>Fee,ATTR_URL_FRAGMENT:()=>qee,ATTR_URL_FULL:()=>rs,ATTR_URL_PATH:()=>$ee,ATTR_URL_QUERY:()=>Yee,ATTR_URL_SCHEME:()=>Wee,ATTR_USER_AGENT_ORIGINAL:()=>Jg,AWSECSLAUNCHTYPEVALUES_EC2:()=>s8,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>i8,AwsEcsLaunchtypeValues:()=>a8,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>H6,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>V6,CLOUDPLATFORMVALUES_AWS_EC2:()=>F6,CLOUDPLATFORMVALUES_AWS_ECS:()=>q6,CLOUDPLATFORMVALUES_AWS_EKS:()=>$6,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>W6,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>Y6,CLOUDPLATFORMVALUES_AZURE_AKS:()=>Q6,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>J6,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>K6,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>X6,CLOUDPLATFORMVALUES_AZURE_VM:()=>z6,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>r8,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>n8,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>e8,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>Z6,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>t8,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>w6,CLOUDPROVIDERVALUES_AWS:()=>k6,CLOUDPROVIDERVALUES_AZURE:()=>G6,CLOUDPROVIDERVALUES_GCP:()=>B6,CloudPlatformValues:()=>o8,CloudProviderValues:()=>j6,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>AJ,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>PJ,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>RJ,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>CJ,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>IJ,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>xJ,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>NJ,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>yJ,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>MJ,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>bJ,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>OJ,DBSYSTEMVALUES_ADABAS:()=>qX,DBSYSTEMVALUES_CACHE:()=>FX,DBSYSTEMVALUES_CASSANDRA:()=>aJ,DBSYSTEMVALUES_CLOUDSCAPE:()=>UX,DBSYSTEMVALUES_COCKROACHDB:()=>SJ,DBSYSTEMVALUES_COLDFUSION:()=>iJ,DBSYSTEMVALUES_COSMOSDB:()=>_J,DBSYSTEMVALUES_COUCHBASE:()=>pJ,DBSYSTEMVALUES_COUCHDB:()=>dJ,DBSYSTEMVALUES_DB2:()=>xX,DBSYSTEMVALUES_DERBY:()=>YX,DBSYSTEMVALUES_DYNAMODB:()=>fJ,DBSYSTEMVALUES_EDB:()=>VX,DBSYSTEMVALUES_ELASTICSEARCH:()=>hJ,DBSYSTEMVALUES_FILEMAKER:()=>WX,DBSYSTEMVALUES_FIREBIRD:()=>$X,DBSYSTEMVALUES_FIRSTSQL:()=>HX,DBSYSTEMVALUES_GEODE:()=>TJ,DBSYSTEMVALUES_H2:()=>sJ,DBSYSTEMVALUES_HANADB:()=>BX,DBSYSTEMVALUES_HBASE:()=>cJ,DBSYSTEMVALUES_HIVE:()=>DX,DBSYSTEMVALUES_HSQLDB:()=>wX,DBSYSTEMVALUES_INFORMIX:()=>zX,DBSYSTEMVALUES_INGRES:()=>jX,DBSYSTEMVALUES_INSTANTDB:()=>KX,DBSYSTEMVALUES_INTERBASE:()=>QX,DBSYSTEMVALUES_MARIADB:()=>XX,DBSYSTEMVALUES_MAXDB:()=>GX,DBSYSTEMVALUES_MEMCACHED:()=>EJ,DBSYSTEMVALUES_MONGODB:()=>uJ,DBSYSTEMVALUES_MSSQL:()=>CX,DBSYSTEMVALUES_MYSQL:()=>PX,DBSYSTEMVALUES_NEO4J:()=>mJ,DBSYSTEMVALUES_NETEZZA:()=>JX,DBSYSTEMVALUES_ORACLE:()=>MX,DBSYSTEMVALUES_OTHER_SQL:()=>bX,DBSYSTEMVALUES_PERVASIVE:()=>ZX,DBSYSTEMVALUES_POINTBASE:()=>eJ,DBSYSTEMVALUES_POSTGRESQL:()=>vX,DBSYSTEMVALUES_PROGRESS:()=>kX,DBSYSTEMVALUES_REDIS:()=>lJ,DBSYSTEMVALUES_REDSHIFT:()=>LX,DBSYSTEMVALUES_SQLITE:()=>tJ,DBSYSTEMVALUES_SYBASE:()=>nJ,DBSYSTEMVALUES_TERADATA:()=>rJ,DBSYSTEMVALUES_VERTICA:()=>oJ,DB_SYSTEM_NAME_VALUE_MARIADB:()=>_7,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>f7,DB_SYSTEM_NAME_VALUE_MYSQL:()=>m7,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>T7,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>E7,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>S7,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>g7,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>A7,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>R7,DbCassandraConsistencyLevelValues:()=>vJ,DbSystemValues:()=>gJ,ERROR_TYPE_VALUE_OTHER:()=>y7,EVENT_EXCEPTION:()=>$te,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>HJ,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>jJ,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>BJ,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>FJ,FAASINVOKEDPROVIDERVALUES_AWS:()=>qJ,FAASINVOKEDPROVIDERVALUES_AZURE:()=>$J,FAASINVOKEDPROVIDERVALUES_GCP:()=>YJ,FAASTRIGGERVALUES_DATASOURCE:()=>LJ,FAASTRIGGERVALUES_HTTP:()=>DJ,FAASTRIGGERVALUES_OTHER:()=>kJ,FAASTRIGGERVALUES_PUBSUB:()=>UJ,FAASTRIGGERVALUES_TIMER:()=>wJ,FaasDocumentOperationValues:()=>VJ,FaasInvokedProviderValues:()=>WJ,FaasTriggerValues:()=>GJ,HOSTARCHVALUES_AMD64:()=>c8,HOSTARCHVALUES_ARM32:()=>u8,HOSTARCHVALUES_ARM64:()=>l8,HOSTARCHVALUES_IA64:()=>p8,HOSTARCHVALUES_PPC32:()=>d8,HOSTARCHVALUES_PPC64:()=>_8,HOSTARCHVALUES_X86:()=>f8,HTTPFLAVORVALUES_HTTP_1_0:()=>MZ,HTTPFLAVORVALUES_HTTP_1_1:()=>xZ,HTTPFLAVORVALUES_HTTP_2_0:()=>vZ,HTTPFLAVORVALUES_QUIC:()=>DZ,HTTPFLAVORVALUES_SPDY:()=>LZ,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>M7,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>x7,HTTP_REQUEST_METHOD_VALUE_GET:()=>v7,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>L7,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>D7,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>P7,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>U7,HTTP_REQUEST_METHOD_VALUE_POST:()=>w7,HTTP_REQUEST_METHOD_VALUE_PUT:()=>k7,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>G7,HostArchValues:()=>m8,HttpFlavorValues:()=>UZ,JVM_MEMORY_TYPE_VALUE_HEAP:()=>Y7,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>W7,JVM_THREAD_STATE_VALUE_BLOCKED:()=>Q7,JVM_THREAD_STATE_VALUE_NEW:()=>X7,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>J7,JVM_THREAD_STATE_VALUE_TERMINATED:()=>Z7,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>eee,JVM_THREAD_STATE_VALUE_WAITING:()=>tee,MESSAGETYPEVALUES_RECEIVED:()=>a5,MESSAGETYPEVALUES_SENT:()=>i5,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>wZ,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>kZ,MESSAGINGOPERATIONVALUES_PROCESS:()=>jZ,MESSAGINGOPERATIONVALUES_RECEIVE:()=>BZ,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>zee,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>Kee,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>Qee,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>Zee,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>Jee,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>Xee,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>ete,METRIC_DB_CLIENT_OPERATION_DURATION:()=>tte,METRIC_DOTNET_ASSEMBLY_COUNT:()=>nte,METRIC_DOTNET_EXCEPTIONS:()=>rte,METRIC_DOTNET_GC_COLLECTIONS:()=>ote,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>ste,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>ite,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>ate,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>cte,METRIC_DOTNET_GC_PAUSE_TIME:()=>ute,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>lte,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>pte,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>dte,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>_te,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>fte,METRIC_DOTNET_PROCESS_CPU_TIME:()=>mte,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>Tte,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>hte,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>Ete,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>Ste,METRIC_DOTNET_TIMER_COUNT:()=>gte,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>Ate,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>Rte,METRIC_JVM_CLASS_COUNT:()=>yte,METRIC_JVM_CLASS_LOADED:()=>Ite,METRIC_JVM_CLASS_UNLOADED:()=>Nte,METRIC_JVM_CPU_COUNT:()=>Ote,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>bte,METRIC_JVM_CPU_TIME:()=>Cte,METRIC_JVM_GC_DURATION:()=>Pte,METRIC_JVM_MEMORY_COMMITTED:()=>Mte,METRIC_JVM_MEMORY_LIMIT:()=>xte,METRIC_JVM_MEMORY_USED:()=>vte,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>Lte,METRIC_JVM_THREAD_COUNT:()=>Dte,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>Ute,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>wte,METRIC_KESTREL_CONNECTION_DURATION:()=>kte,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>Gte,METRIC_KESTREL_QUEUED_REQUESTS:()=>Bte,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>jte,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>Hte,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>Vte,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>Fte,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>qte,MessageTypeValues:()=>c5,MessagingDestinationKindValues:()=>GZ,MessagingOperationValues:()=>HZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>pZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>fZ,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>uZ,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>AZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>dZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>_Z,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>SZ,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>cZ,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>yZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>mZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>hZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>RZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>TZ,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>EZ,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>NZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>gZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>CZ,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>OZ,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>bZ,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>IZ,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>lZ,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>oZ,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>sZ,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>iZ,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>nZ,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>rZ,NETTRANSPORTVALUES_INPROC:()=>ZJ,NETTRANSPORTVALUES_IP:()=>QJ,NETTRANSPORTVALUES_IP_TCP:()=>zJ,NETTRANSPORTVALUES_IP_UDP:()=>KJ,NETTRANSPORTVALUES_OTHER:()=>eZ,NETTRANSPORTVALUES_PIPE:()=>JJ,NETTRANSPORTVALUES_UNIX:()=>XJ,NETWORK_TRANSPORT_VALUE_PIPE:()=>see,NETWORK_TRANSPORT_VALUE_QUIC:()=>iee,NETWORK_TRANSPORT_VALUE_TCP:()=>aee,NETWORK_TRANSPORT_VALUE_UDP:()=>cee,NETWORK_TRANSPORT_VALUE_UNIX:()=>uee,NETWORK_TYPE_VALUE_IPV4:()=>pee,NETWORK_TYPE_VALUE_IPV6:()=>dee,NetHostConnectionSubtypeValues:()=>PZ,NetHostConnectionTypeValues:()=>aZ,NetTransportValues:()=>tZ,OSTYPEVALUES_AIX:()=>I8,OSTYPEVALUES_DARWIN:()=>E8,OSTYPEVALUES_DRAGONFLYBSD:()=>R8,OSTYPEVALUES_FREEBSD:()=>S8,OSTYPEVALUES_HPUX:()=>y8,OSTYPEVALUES_LINUX:()=>h8,OSTYPEVALUES_NETBSD:()=>g8,OSTYPEVALUES_OPENBSD:()=>A8,OSTYPEVALUES_SOLARIS:()=>N8,OSTYPEVALUES_WINDOWS:()=>T8,OSTYPEVALUES_Z_OS:()=>O8,OTEL_STATUS_CODE_VALUE_ERROR:()=>Tee,OTEL_STATUS_CODE_VALUE_OK:()=>hee,OsTypeValues:()=>b8,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>JZ,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>zZ,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>FZ,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>r5,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>YZ,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>XZ,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>t5,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>$Z,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>WZ,RPCGRPCSTATUSCODEVALUES_OK:()=>VZ,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>ZZ,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>KZ,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>QZ,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>o5,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>n5,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>e5,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>qZ,RpcGrpcStatusCodeValues:()=>s5,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>GQ,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>QQ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>UQ,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>xQ,SEMATTRS_AWS_DYNAMODB_COUNT:()=>zQ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>FQ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>HQ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>XQ,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>BQ,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>vQ,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>kQ,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>VQ,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>wQ,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>LQ,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>DQ,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>KQ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>$Q,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>YQ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>jQ,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>qQ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>MQ,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>WQ,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>R9,SEMATTRS_CODE_FILEPATH:()=>gQ,SEMATTRS_CODE_FUNCTION:()=>EQ,SEMATTRS_CODE_LINENO:()=>AQ,SEMATTRS_CODE_NAMESPACE:()=>SQ,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>x9,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>w9,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>U9,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>L9,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>P9,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>M9,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>D9,SEMATTRS_DB_CASSANDRA_TABLE:()=>v9,SEMATTRS_DB_CONNECTION_STRING:()=>y9,SEMATTRS_DB_HBASE_NAMESPACE:()=>k9,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>N9,SEMATTRS_DB_MONGODB_COLLECTION:()=>B9,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>C9,SEMATTRS_DB_NAME:()=>O9,SEMATTRS_DB_OPERATION:()=>b9,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>G9,SEMATTRS_DB_SQL_TABLE:()=>j9,SEMATTRS_DB_STATEMENT:()=>Og,SEMATTRS_DB_SYSTEM:()=>Ng,SEMATTRS_DB_USER:()=>I9,SEMATTRS_ENDUSER_ID:()=>_Q,SEMATTRS_ENDUSER_ROLE:()=>fQ,SEMATTRS_ENDUSER_SCOPE:()=>mQ,SEMATTRS_EXCEPTION_ESCAPED:()=>q9,SEMATTRS_EXCEPTION_MESSAGE:()=>V9,SEMATTRS_EXCEPTION_STACKTRACE:()=>F9,SEMATTRS_EXCEPTION_TYPE:()=>H9,SEMATTRS_FAAS_COLDSTART:()=>J9,SEMATTRS_FAAS_CRON:()=>X9,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>Y9,SEMATTRS_FAAS_DOCUMENT_NAME:()=>K9,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>W9,SEMATTRS_FAAS_DOCUMENT_TIME:()=>z9,SEMATTRS_FAAS_EXECUTION:()=>$9,SEMATTRS_FAAS_INVOKED_NAME:()=>Z9,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>eQ,SEMATTRS_FAAS_INVOKED_REGION:()=>tQ,SEMATTRS_FAAS_TIME:()=>Q9,SEMATTRS_FAAS_TRIGGER:()=>bg,SEMATTRS_HTTP_CLIENT_IP:()=>PQ,SEMATTRS_HTTP_FLAVOR:()=>IQ,SEMATTRS_HTTP_HOST:()=>RQ,SEMATTRS_HTTP_METHOD:()=>Sl,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>OQ,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>bQ,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>vg,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>Lg,SEMATTRS_HTTP_ROUTE:()=>Dg,SEMATTRS_HTTP_SCHEME:()=>yQ,SEMATTRS_HTTP_SERVER_NAME:()=>CQ,SEMATTRS_HTTP_STATUS_CODE:()=>Ri,SEMATTRS_HTTP_TARGET:()=>xg,SEMATTRS_HTTP_URL:()=>$a,SEMATTRS_HTTP_USER_AGENT:()=>NQ,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>IX,SEMATTRS_MESSAGE_ID:()=>yX,SEMATTRS_MESSAGE_TYPE:()=>RX,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>NX,SEMATTRS_MESSAGING_CONSUMER_ID:()=>uX,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>sX,SEMATTRS_MESSAGING_DESTINATION:()=>JQ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>ZQ,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>_X,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>dX,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>pX,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>fX,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>mX,SEMATTRS_MESSAGING_MESSAGE_ID:()=>oX,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>aX,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>iX,SEMATTRS_MESSAGING_OPERATION:()=>cX,SEMATTRS_MESSAGING_PROTOCOL:()=>tX,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>nX,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>lX,SEMATTRS_MESSAGING_SYSTEM:()=>Ug,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>eX,SEMATTRS_MESSAGING_URL:()=>rX,SEMATTRS_NET_HOST_CARRIER_ICC:()=>pQ,SEMATTRS_NET_HOST_CARRIER_MCC:()=>uQ,SEMATTRS_NET_HOST_CARRIER_MNC:()=>lQ,SEMATTRS_NET_HOST_CARRIER_NAME:()=>cQ,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>aQ,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>iQ,SEMATTRS_NET_HOST_IP:()=>Pg,SEMATTRS_NET_HOST_NAME:()=>sQ,SEMATTRS_NET_HOST_PORT:()=>Mg,SEMATTRS_NET_PEER_IP:()=>Cg,SEMATTRS_NET_PEER_NAME:()=>oQ,SEMATTRS_NET_PEER_PORT:()=>rQ,SEMATTRS_NET_TRANSPORT:()=>nQ,SEMATTRS_PEER_SERVICE:()=>dQ,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>kg,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>gX,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>AX,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>SX,SEMATTRS_RPC_JSONRPC_VERSION:()=>EX,SEMATTRS_RPC_METHOD:()=>hX,SEMATTRS_RPC_SERVICE:()=>wg,SEMATTRS_RPC_SYSTEM:()=>TX,SEMATTRS_THREAD_ID:()=>TQ,SEMATTRS_THREAD_NAME:()=>hQ,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>m5,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>f5,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>T5,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>h5,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>E5,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>S5,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>g5,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>R5,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>A5,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>I5,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>y5,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>l5,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>d5,SEMRESATTRS_CLOUD_PLATFORM:()=>_5,SEMRESATTRS_CLOUD_PROVIDER:()=>u5,SEMRESATTRS_CLOUD_REGION:()=>p5,SEMRESATTRS_CONTAINER_ID:()=>O5,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>C5,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>P5,SEMRESATTRS_CONTAINER_NAME:()=>N5,SEMRESATTRS_CONTAINER_RUNTIME:()=>b5,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>M5,SEMRESATTRS_DEVICE_ID:()=>x5,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>v5,SEMRESATTRS_DEVICE_MODEL_NAME:()=>L5,SEMRESATTRS_FAAS_ID:()=>U5,SEMRESATTRS_FAAS_INSTANCE:()=>k5,SEMRESATTRS_FAAS_MAX_MEMORY:()=>G5,SEMRESATTRS_FAAS_NAME:()=>D5,SEMRESATTRS_FAAS_VERSION:()=>w5,SEMRESATTRS_HOST_ARCH:()=>V5,SEMRESATTRS_HOST_ID:()=>B5,SEMRESATTRS_HOST_IMAGE_ID:()=>q5,SEMRESATTRS_HOST_IMAGE_NAME:()=>F5,SEMRESATTRS_HOST_IMAGE_VERSION:()=>$5,SEMRESATTRS_HOST_NAME:()=>j5,SEMRESATTRS_HOST_TYPE:()=>H5,SEMRESATTRS_K8S_CLUSTER_NAME:()=>Y5,SEMRESATTRS_K8S_CONTAINER_NAME:()=>J5,SEMRESATTRS_K8S_CRONJOB_NAME:()=>l6,SEMRESATTRS_K8S_CRONJOB_UID:()=>u6,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>i6,SEMRESATTRS_K8S_DAEMONSET_UID:()=>s6,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>n6,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>t6,SEMRESATTRS_K8S_JOB_NAME:()=>c6,SEMRESATTRS_K8S_JOB_UID:()=>a6,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>K5,SEMRESATTRS_K8S_NODE_NAME:()=>W5,SEMRESATTRS_K8S_NODE_UID:()=>z5,SEMRESATTRS_K8S_POD_NAME:()=>X5,SEMRESATTRS_K8S_POD_UID:()=>Q5,SEMRESATTRS_K8S_REPLICASET_NAME:()=>e6,SEMRESATTRS_K8S_REPLICASET_UID:()=>Z5,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>o6,SEMRESATTRS_K8S_STATEFULSET_UID:()=>r6,SEMRESATTRS_OS_DESCRIPTION:()=>d6,SEMRESATTRS_OS_NAME:()=>_6,SEMRESATTRS_OS_TYPE:()=>p6,SEMRESATTRS_OS_VERSION:()=>f6,SEMRESATTRS_PROCESS_COMMAND:()=>E6,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>g6,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>S6,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>T6,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>h6,SEMRESATTRS_PROCESS_OWNER:()=>A6,SEMRESATTRS_PROCESS_PID:()=>m6,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>I6,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>R6,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>y6,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>O6,SEMRESATTRS_SERVICE_NAME:()=>N6,SEMRESATTRS_SERVICE_NAMESPACE:()=>Gg,SEMRESATTRS_SERVICE_VERSION:()=>b6,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>x6,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>P6,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>C6,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>M6,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>D6,SEMRESATTRS_WEBENGINE_NAME:()=>v6,SEMRESATTRS_WEBENGINE_VERSION:()=>L6,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>Ree,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>yee,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>Iee,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>Oee,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>bee,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>Cee,SemanticAttributes:()=>OX,SemanticResourceAttributes:()=>U6,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>C8,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>P8,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>M8,TELEMETRYSDKLANGUAGEVALUES_GO:()=>x8,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>v8,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>L8,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>D8,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>U8,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>w8,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>k8,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>Mee,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>xee,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>vee,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>Lee,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>Dee,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>Uee,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>wee,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>kee,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>Gee,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>Bee,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>jee,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>Hee,TelemetrySdkLanguageValues:()=>G8});var le=z(()=>{t0();bU();CU();PU();MU()});var xU=E(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});E_.ATTR_PROCESS_RUNTIME_NAME=void 0;E_.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var vU=E(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});g_.SDK_INFO=void 0;var Yte=lP(),S_=(le(),N(Ae)),Wte=xU();g_.SDK_INFO={[S_.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[Wte.ATTR_PROCESS_RUNTIME_NAME]:"node",[S_.ATTR_TELEMETRY_SDK_LANGUAGE]:S_.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[S_.ATTR_TELEMETRY_SDK_VERSION]:Yte.VERSION}});var LU=E(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.otperformance=qt.SDK_INFO=qt._globalThis=qt.getStringListFromEnv=qt.getNumberFromEnv=qt.getBooleanFromEnv=qt.getStringFromEnv=void 0;var A_=cP();Object.defineProperty(qt,"getStringFromEnv",{enumerable:!0,get:function(){return A_.getStringFromEnv}});Object.defineProperty(qt,"getBooleanFromEnv",{enumerable:!0,get:function(){return A_.getBooleanFromEnv}});Object.defineProperty(qt,"getNumberFromEnv",{enumerable:!0,get:function(){return A_.getNumberFromEnv}});Object.defineProperty(qt,"getStringListFromEnv",{enumerable:!0,get:function(){return A_.getStringListFromEnv}});var zte=uP();Object.defineProperty(qt,"_globalThis",{enumerable:!0,get:function(){return zte._globalThis}});var Kte=vU();Object.defineProperty(qt,"SDK_INFO",{enumerable:!0,get:function(){return Kte.SDK_INFO}});qt.otperformance=performance});var Zg=E($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.getStringListFromEnv=$t.getNumberFromEnv=$t.getStringFromEnv=$t.getBooleanFromEnv=$t.otperformance=$t._globalThis=$t.SDK_INFO=void 0;var Ni=LU();Object.defineProperty($t,"SDK_INFO",{enumerable:!0,get:function(){return Ni.SDK_INFO}});Object.defineProperty($t,"_globalThis",{enumerable:!0,get:function(){return Ni._globalThis}});Object.defineProperty($t,"otperformance",{enumerable:!0,get:function(){return Ni.otperformance}});Object.defineProperty($t,"getBooleanFromEnv",{enumerable:!0,get:function(){return Ni.getBooleanFromEnv}});Object.defineProperty($t,"getStringFromEnv",{enumerable:!0,get:function(){return Ni.getStringFromEnv}});Object.defineProperty($t,"getNumberFromEnv",{enumerable:!0,get:function(){return Ni.getNumberFromEnv}});Object.defineProperty($t,"getStringListFromEnv",{enumerable:!0,get:function(){return Ni.getStringListFromEnv}})});var kU=E(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.addHrTimes=be.isTimeInput=be.isTimeInputHrTime=be.hrTimeToMicroseconds=be.hrTimeToMilliseconds=be.hrTimeToNanoseconds=be.hrTimeToTimeStamp=be.hrTimeDuration=be.timeInputToHrTime=be.hrTime=be.getTimeOrigin=be.millisToHrTime=void 0;var R_=Zg(),DU=9,Qte=6,Xte=Math.pow(10,Qte),y_=Math.pow(10,DU);function gl(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*Xte);return[n,r]}be.millisToHrTime=gl;function Jte(){return R_.otperformance.timeOrigin}be.getTimeOrigin=Jte;function UU(t){let e=gl(R_.otperformance.timeOrigin),n=gl(typeof t=="number"?t:R_.otperformance.now());return wU(e,n)}be.hrTime=UU;function Zte(t){if(eA(t))return t;if(typeof t=="number")return t<R_.otperformance.timeOrigin?UU(t):gl(t);if(t instanceof Date)return gl(t.getTime());throw TypeError("Invalid input type")}be.timeInputToHrTime=Zte;function ene(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=y_),[n,r]}be.hrTimeDuration=ene;function tne(t){let e=DU,n=`${"0".repeat(e)}${t[1]}Z`,r=n.substring(n.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",r)}be.hrTimeToTimeStamp=tne;function nne(t){return t[0]*y_+t[1]}be.hrTimeToNanoseconds=nne;function rne(t){return t[0]*1e3+t[1]/1e6}be.hrTimeToMilliseconds=rne;function one(t){return t[0]*1e6+t[1]/1e3}be.hrTimeToMicroseconds=one;function eA(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}be.isTimeInputHrTime=eA;function sne(t){return eA(t)||typeof t=="number"||t instanceof Date}be.isTimeInput=sne;function wU(t,e){let n=[t[0]+e[0],t[1]+e[1]];return n[1]>=y_&&(n[1]-=y_,n[0]+=1),n}be.addHrTimes=wU});var GU=E(I_=>{"use strict";Object.defineProperty(I_,"__esModule",{value:!0});I_.unrefTimer=void 0;function ine(t){typeof t!="number"&&t.unref()}I_.unrefTimer=ine});var BU=E(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.ExportResultCode=void 0;var ane;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(ane=Al.ExportResultCode||(Al.ExportResultCode={}))});var HU=E(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});N_.CompositePropagator=void 0;var jU=(b(),N(v)),tA=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(let o of this._propagators)try{o.inject(e,n,r)}catch(s){jU.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,n,r){return this._propagators.reduce((o,s)=>{try{return s.extract(o,n,r)}catch(i){jU.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};N_.CompositePropagator=tA});var VU=E(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.validateValue=Wa.validateKey=void 0;var nA="[_0-9a-z-*/]",cne=`[a-z]${nA}{0,255}`,une=`[a-z0-9]${nA}{0,240}@[a-z]${nA}{0,13}`,lne=new RegExp(`^(?:${cne}|${une})$`),pne=/^[ -~]{0,255}[!-~]$/,dne=/,|=/;function _ne(t){return lne.test(t)}Wa.validateKey=_ne;function fne(t){return pne.test(t)&&!dne.test(t)}Wa.validateValue=fne});var oA=E(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});O_.TraceState=void 0;var FU=VU(),qU=32,mne=512,$U=",",YU="=",rA=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+YU+this.get(n)),e),[]).join($U)}_parse(e){e.length>mne||(this._internalState=e.split($U).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(YU);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,FU.validateKey)(i)&&(0,FU.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>qU&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,qU))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};O_.TraceState=rA});var zU=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.W3CTraceContextPropagator=Yt.parseTraceParent=Yt.TRACE_STATE_HEADER=Yt.TRACE_PARENT_HEADER=void 0;var b_=(b(),N(v)),Tne=El(),hne=oA();Yt.TRACE_PARENT_HEADER="traceparent";Yt.TRACE_STATE_HEADER="tracestate";var Ene="00",Sne="(?!ff)[\\da-f]{2}",gne="(?![0]{32})[\\da-f]{32}",Ane="(?![0]{16})[\\da-f]{16}",Rne="[\\da-f]{2}",yne=new RegExp(`^\\s?(${Sne})-(${gne})-(${Ane})-(${Rne})(-.*)?\\s?$`);function WU(t){let e=yne.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}Yt.parseTraceParent=WU;var sA=class{inject(e,n,r){let o=b_.trace.getSpanContext(e);if(!o||(0,Tne.isTracingSuppressed)(e)||!(0,b_.isSpanContextValid)(o))return;let s=`${Ene}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||b_.TraceFlags.NONE).toString(16)}`;r.set(n,Yt.TRACE_PARENT_HEADER,s),o.traceState&&r.set(n,Yt.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,n,r){let o=r.get(n,Yt.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=WU(s);if(!i)return e;i.isRemote=!0;let a=r.get(n,Yt.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=new hne.TraceState(typeof c=="string"?c:void 0)}return b_.trace.setSpanContext(e,i)}fields(){return[Yt.TRACE_PARENT_HEADER,Yt.TRACE_STATE_HEADER]}};Yt.W3CTraceContextPropagator=sA});var KU=E(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.getRPCMetadata=Sr.deleteRPCMetadata=Sr.setRPCMetadata=Sr.RPCType=void 0;var Ine=(b(),N(v)),iA=(0,Ine.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),Nne;(function(t){t.HTTP="http"})(Nne=Sr.RPCType||(Sr.RPCType={}));function One(t,e){return t.setValue(iA,e)}Sr.setRPCMetadata=One;function bne(t){return t.deleteValue(iA)}Sr.deleteRPCMetadata=bne;function Cne(t){return t.getValue(iA)}Sr.getRPCMetadata=Cne});var ew=E(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});C_.isPlainObject=void 0;var Pne="[object Object]",Mne="[object Null]",xne="[object Undefined]",vne=Function.prototype,QU=vne.toString,Lne=QU.call(Object),Dne=Object.getPrototypeOf,XU=Object.prototype,JU=XU.hasOwnProperty,Oi=Symbol?Symbol.toStringTag:void 0,ZU=XU.toString;function Une(t){if(!wne(t)||kne(t)!==Pne)return!1;let e=Dne(t);if(e===null)return!0;let n=JU.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&QU.call(n)===Lne}C_.isPlainObject=Une;function wne(t){return t!=null&&typeof t=="object"}function kne(t){return t==null?t===void 0?xne:Mne:Oi&&Oi in Object(t)?Gne(t):Bne(t)}function Gne(t){let e=JU.call(t,Oi),n=t[Oi],r=!1;try{t[Oi]=void 0,r=!0}catch{}let o=ZU.call(t);return r&&(e?t[Oi]=n:delete t[Oi]),o}function Bne(t){return ZU.call(t)}});var sw=E(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_.merge=void 0;var tw=ew(),jne=20;function Hne(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=rw(e,t.shift(),0,n);return e}x_.merge=Hne;function aA(t){return M_(t)?t.slice():t}function rw(t,e,n=0,r){let o;if(!(n>jne)){if(n++,P_(t)||P_(e)||ow(e))o=aA(e);else if(M_(t)){if(o=t.slice(),M_(e))for(let s=0,i=e.length;s<i;s++)o.push(aA(e[s]));else if(Rl(e)){let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i];o[c]=aA(e[c])}}}else if(Rl(t))if(Rl(e)){if(!Vne(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i],l=e[c];if(P_(l))typeof l>"u"?delete o[c]:o[c]=l;else{let p=o[c],d=l;if(nw(t,c,r)||nw(e,c,r))delete o[c];else{if(Rl(p)&&Rl(d)){let _=r.get(p)||[],f=r.get(d)||[];_.push({obj:t,key:c}),f.push({obj:e,key:c}),r.set(p,_),r.set(d,f)}o[c]=rw(o[c],l,n,r)}}}}else o=e;return o}}function nw(t,e,n){let r=n.get(t[e])||[];for(let o=0,s=r.length;o<s;o++){let i=r[o];if(i.key===e&&i.obj===t)return!0}return!1}function M_(t){return Array.isArray(t)}function ow(t){return typeof t=="function"}function Rl(t){return!P_(t)&&!M_(t)&&!ow(t)&&typeof t=="object"}function P_(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Vne(t,e){return!(!(0,tw.isPlainObject)(t)||!(0,tw.isPlainObject)(e))}});var iw=E(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.callWithTimeout=za.TimeoutError=void 0;var v_=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};za.TimeoutError=v_;function Fne(t,e){let n,r=new Promise(function(s,i){n=setTimeout(function(){i(new v_("Operation timed out."))},e)});return Promise.race([t,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}za.callWithTimeout=Fne});var cw=E(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.isUrlIgnored=Ka.urlMatches=void 0;function aw(t,e){return typeof e=="string"?t===e:!!t.match(e)}Ka.urlMatches=aw;function qne(t,e){if(!e)return!1;for(let n of e)if(aw(t,n))return!0;return!1}Ka.isUrlIgnored=qne});var uw=E(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});L_.Deferred=void 0;var cA=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};L_.Deferred=cA});var lw=E(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});D_.BindOnceFuture=void 0;var $ne=uw(),uA=class{_isCalled=!1;_deferred=new $ne.Deferred;_callback;_that;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}};D_.BindOnceFuture=uA});var dw=E(U_=>{"use strict";Object.defineProperty(U_,"__esModule",{value:!0});U_.diagLogLevelFromString=void 0;var Oo=(b(),N(v)),pw={ALL:Oo.DiagLogLevel.ALL,VERBOSE:Oo.DiagLogLevel.VERBOSE,DEBUG:Oo.DiagLogLevel.DEBUG,INFO:Oo.DiagLogLevel.INFO,WARN:Oo.DiagLogLevel.WARN,ERROR:Oo.DiagLogLevel.ERROR,NONE:Oo.DiagLogLevel.NONE};function Yne(t){if(t==null)return;let e=pw[t.toUpperCase()];return e??(Oo.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(pw)}, using default`),Oo.DiagLogLevel.INFO)}U_.diagLogLevelFromString=Yne});var fw=E(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});w_._export=void 0;var _w=(b(),N(v)),Wne=El();function zne(t,e){return new Promise(n=>{_w.context.with((0,Wne.suppressTracing)(_w.context.active()),()=>{t.export(e,n)})})}w_._export=zne});var he=E(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.internal=y.diagLogLevelFromString=y.BindOnceFuture=y.urlMatches=y.isUrlIgnored=y.callWithTimeout=y.TimeoutError=y.merge=y.TraceState=y.unsuppressTracing=y.suppressTracing=y.isTracingSuppressed=y.setRPCMetadata=y.getRPCMetadata=y.deleteRPCMetadata=y.RPCType=y.parseTraceParent=y.W3CTraceContextPropagator=y.TRACE_STATE_HEADER=y.TRACE_PARENT_HEADER=y.CompositePropagator=y.otperformance=y.getStringListFromEnv=y.getNumberFromEnv=y.getBooleanFromEnv=y.getStringFromEnv=y._globalThis=y.SDK_INFO=y.parseKeyPairsIntoRecord=y.ExportResultCode=y.unrefTimer=y.timeInputToHrTime=y.millisToHrTime=y.isTimeInputHrTime=y.isTimeInput=y.hrTimeToTimeStamp=y.hrTimeToNanoseconds=y.hrTimeToMilliseconds=y.hrTimeToMicroseconds=y.hrTimeDuration=y.hrTime=y.getTimeOrigin=y.addHrTimes=y.loggingErrorHandler=y.setGlobalErrorHandler=y.globalErrorHandler=y.sanitizeAttributes=y.isAttributeValue=y.AnchoredClock=y.W3CBaggagePropagator=void 0;var Kne=QC();Object.defineProperty(y,"W3CBaggagePropagator",{enumerable:!0,get:function(){return Kne.W3CBaggagePropagator}});var Qne=XC();Object.defineProperty(y,"AnchoredClock",{enumerable:!0,get:function(){return Qne.AnchoredClock}});var mw=nP();Object.defineProperty(y,"isAttributeValue",{enumerable:!0,get:function(){return mw.isAttributeValue}});Object.defineProperty(y,"sanitizeAttributes",{enumerable:!0,get:function(){return mw.sanitizeAttributes}});var Tw=oP();Object.defineProperty(y,"globalErrorHandler",{enumerable:!0,get:function(){return Tw.globalErrorHandler}});Object.defineProperty(y,"setGlobalErrorHandler",{enumerable:!0,get:function(){return Tw.setGlobalErrorHandler}});var Xne=yg();Object.defineProperty(y,"loggingErrorHandler",{enumerable:!0,get:function(){return Xne.loggingErrorHandler}});var zn=kU();Object.defineProperty(y,"addHrTimes",{enumerable:!0,get:function(){return zn.addHrTimes}});Object.defineProperty(y,"getTimeOrigin",{enumerable:!0,get:function(){return zn.getTimeOrigin}});Object.defineProperty(y,"hrTime",{enumerable:!0,get:function(){return zn.hrTime}});Object.defineProperty(y,"hrTimeDuration",{enumerable:!0,get:function(){return zn.hrTimeDuration}});Object.defineProperty(y,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return zn.hrTimeToMicroseconds}});Object.defineProperty(y,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return zn.hrTimeToMilliseconds}});Object.defineProperty(y,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return zn.hrTimeToNanoseconds}});Object.defineProperty(y,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return zn.hrTimeToTimeStamp}});Object.defineProperty(y,"isTimeInput",{enumerable:!0,get:function(){return zn.isTimeInput}});Object.defineProperty(y,"isTimeInputHrTime",{enumerable:!0,get:function(){return zn.isTimeInputHrTime}});Object.defineProperty(y,"millisToHrTime",{enumerable:!0,get:function(){return zn.millisToHrTime}});Object.defineProperty(y,"timeInputToHrTime",{enumerable:!0,get:function(){return zn.timeInputToHrTime}});var Jne=GU();Object.defineProperty(y,"unrefTimer",{enumerable:!0,get:function(){return Jne.unrefTimer}});var Zne=BU();Object.defineProperty(y,"ExportResultCode",{enumerable:!0,get:function(){return Zne.ExportResultCode}});var ere=Eg();Object.defineProperty(y,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return ere.parseKeyPairsIntoRecord}});var bi=Zg();Object.defineProperty(y,"SDK_INFO",{enumerable:!0,get:function(){return bi.SDK_INFO}});Object.defineProperty(y,"_globalThis",{enumerable:!0,get:function(){return bi._globalThis}});Object.defineProperty(y,"getStringFromEnv",{enumerable:!0,get:function(){return bi.getStringFromEnv}});Object.defineProperty(y,"getBooleanFromEnv",{enumerable:!0,get:function(){return bi.getBooleanFromEnv}});Object.defineProperty(y,"getNumberFromEnv",{enumerable:!0,get:function(){return bi.getNumberFromEnv}});Object.defineProperty(y,"getStringListFromEnv",{enumerable:!0,get:function(){return bi.getStringListFromEnv}});Object.defineProperty(y,"otperformance",{enumerable:!0,get:function(){return bi.otperformance}});var tre=HU();Object.defineProperty(y,"CompositePropagator",{enumerable:!0,get:function(){return tre.CompositePropagator}});var k_=zU();Object.defineProperty(y,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return k_.TRACE_PARENT_HEADER}});Object.defineProperty(y,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return k_.TRACE_STATE_HEADER}});Object.defineProperty(y,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return k_.W3CTraceContextPropagator}});Object.defineProperty(y,"parseTraceParent",{enumerable:!0,get:function(){return k_.parseTraceParent}});var G_=KU();Object.defineProperty(y,"RPCType",{enumerable:!0,get:function(){return G_.RPCType}});Object.defineProperty(y,"deleteRPCMetadata",{enumerable:!0,get:function(){return G_.deleteRPCMetadata}});Object.defineProperty(y,"getRPCMetadata",{enumerable:!0,get:function(){return G_.getRPCMetadata}});Object.defineProperty(y,"setRPCMetadata",{enumerable:!0,get:function(){return G_.setRPCMetadata}});var lA=El();Object.defineProperty(y,"isTracingSuppressed",{enumerable:!0,get:function(){return lA.isTracingSuppressed}});Object.defineProperty(y,"suppressTracing",{enumerable:!0,get:function(){return lA.suppressTracing}});Object.defineProperty(y,"unsuppressTracing",{enumerable:!0,get:function(){return lA.unsuppressTracing}});var nre=oA();Object.defineProperty(y,"TraceState",{enumerable:!0,get:function(){return nre.TraceState}});var rre=sw();Object.defineProperty(y,"merge",{enumerable:!0,get:function(){return rre.merge}});var hw=iw();Object.defineProperty(y,"TimeoutError",{enumerable:!0,get:function(){return hw.TimeoutError}});Object.defineProperty(y,"callWithTimeout",{enumerable:!0,get:function(){return hw.callWithTimeout}});var Ew=cw();Object.defineProperty(y,"isUrlIgnored",{enumerable:!0,get:function(){return Ew.isUrlIgnored}});Object.defineProperty(y,"urlMatches",{enumerable:!0,get:function(){return Ew.urlMatches}});var ore=lw();Object.defineProperty(y,"BindOnceFuture",{enumerable:!0,get:function(){return ore.BindOnceFuture}});var sre=dw();Object.defineProperty(y,"diagLogLevelFromString",{enumerable:!0,get:function(){return sre.diagLogLevelFromString}});var ire=fw();y.internal={_export:ire._export}});var Sw=E(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});B_.VERSION=void 0;B_.VERSION="0.214.0"});var gw=E(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.SeverityNumber=void 0;var are;(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"})(are=yl.SeverityNumber||(yl.SeverityNumber={}))});var H_=E(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.NOOP_LOGGER=Qa.NoopLogger=void 0;var j_=class{emit(e){}};Qa.NoopLogger=j_;Qa.NOOP_LOGGER=new j_});var Aw=E(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.API_BACKWARDS_COMPATIBILITY_VERSION=Fr.makeGetter=Fr._global=Fr.GLOBAL_LOGS_API_KEY=void 0;Fr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Fr._global=globalThis;function cre(t,e,n){return r=>r===t?e:n}Fr.makeGetter=cre;Fr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var pA=E(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.NOOP_LOGGER_PROVIDER=Xa.NoopLoggerProvider=void 0;var ure=H_(),V_=class{getLogger(e,n,r){return new ure.NoopLogger}};Xa.NoopLoggerProvider=V_;Xa.NOOP_LOGGER_PROVIDER=new V_});var Rw=E(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});F_.ProxyLogger=void 0;var lre=H_(),dA=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):lre.NOOP_LOGGER}};F_.ProxyLogger=dA});var yw=E(q_=>{"use strict";Object.defineProperty(q_,"__esModule",{value:!0});q_.ProxyLoggerProvider=void 0;var pre=pA(),dre=Rw(),_A=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new dre.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:pre.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)}};q_.ProxyLoggerProvider=_A});var Nw=E($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});$_.LogsAPI=void 0;var Kn=Aw(),_re=pA(),Iw=yw(),fA=class t{constructor(){this._proxyLoggerProvider=new Iw.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Kn._global[Kn.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Kn._global[Kn.GLOBAL_LOGS_API_KEY]=(0,Kn.makeGetter)(Kn.API_BACKWARDS_COMPATIBILITY_VERSION,e,_re.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Kn._global[Kn.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Kn._global,Kn.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Kn._global[Kn.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Iw.ProxyLoggerProvider}};$_.LogsAPI=fA});var mA=E(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.logs=qr.NoopLogger=qr.NOOP_LOGGER=qr.SeverityNumber=void 0;var fre=gw();Object.defineProperty(qr,"SeverityNumber",{enumerable:!0,get:function(){return fre.SeverityNumber}});var Ow=H_();Object.defineProperty(qr,"NOOP_LOGGER",{enumerable:!0,get:function(){return Ow.NOOP_LOGGER}});Object.defineProperty(qr,"NoopLogger",{enumerable:!0,get:function(){return Ow.NoopLogger}});var mre=Nw();qr.logs=mre.LogsAPI.getInstance()});var bw=E(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.disableInstrumentations=Ja.enableInstrumentations=void 0;function Tre(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()}}Ja.enableInstrumentations=Tre;function hre(t){t.forEach(e=>e.disable())}Ja.disableInstrumentations=hre});var Mw=E(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});Y_.registerInstrumentations=void 0;var Cw=(b(),N(v)),Ere=mA(),Pw=bw();function Sre(t){let e=t.tracerProvider||Cw.trace.getTracerProvider(),n=t.meterProvider||Cw.metrics.getMeterProvider(),r=t.loggerProvider||Ere.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,Pw.enableInstrumentations)(o,e,n,r),()=>{(0,Pw.disableInstrumentations)(o)}}Y_.registerInstrumentations=Sre});var Bw=E(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});W_.satisfies=void 0;var SA=(b(),N(v)),Uw=/^(?: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-]+)*))?$/,gre=/^(?<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-]+)*))?$/,Are={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Rre(t,e,n){if(!yre(t))return SA.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=bre(t);if(!r)return!1;let o=[],s=ww(r,e,o,n);return s&&!n?.includePrerelease?Nre(r,o):s}W_.satisfies=Rre;function yre(t){return typeof t=="string"&&Uw.test(t)}function ww(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(TA(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=zre(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!TA(t,s,n,r))return!1;return!0}return TA(t,e,n,r)}function TA(t,e,n,r){if(e=Ore(e,r),e.includes(" "))return ww(t,e,n,r);{let o=Cre(e);return n.push(o),Ire(t,o)}}function Ire(t,e){if(e.invalid)return!1;if(!e.version||EA(e.version))return!0;let n=vw(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=vw(r,o)}return Are[e.op]?.includes(n)}function Nre(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Ore(t,e){return t=t.trim(),t=Yre(t,e),t=$re(t),t=Wre(t,e),t=t.trim(),t}function rn(t){return!t||t.toLowerCase()==="x"||t==="*"}function bre(t){let e=t.match(Uw);if(!e){SA.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 Cre(t){if(!t)return{};let e=t.match(gre);if(!e)return SA.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 EA(t){return t==="*"||t==="x"||t==="X"}function xw(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Pre(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 Mre(t,e){if(EA(t)||EA(e))return 0;let[n,r]=Pre(xw(t),xw(e));return n>r?1:n<r?-1:0}function vw(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Mre(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var kw="[a-zA-Z0-9-]",Gw="0|[1-9]\\d*",xre=`\\d*[a-zA-Z-]${kw}*`,vre="((?:<|>)?=?)",Lw=`(?:${Gw}|${xre})`,Lre=`(?:-(${Lw}(?:\\.${Lw})*))`,Dw=`${kw}+`,Dre=`(?:\\+(${Dw}(?:\\.${Dw})*))`,hA=`${Gw}|x|X|\\*`,Il=`[v=\\s]*(${hA})(?:\\.(${hA})(?:\\.(${hA})(?:${Lre})?${Dre}?)?)?`,Ure=`^${vre}\\s*${Il}$`,wre=new RegExp(Ure),kre=`^\\s*(${Il})\\s+-\\s+(${Il})\\s*$`,Gre=new RegExp(kre),Bre="(?:~>?)",jre=`^${Bre}${Il}$`,Hre=new RegExp(jre),Vre="(?:\\^)",Fre=`^${Vre}${Il}$`,qre=new RegExp(Fre);function $re(t){let e=Hre;return t.replace(e,(n,r,o,s,i)=>{let a;return rn(r)?a="":rn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:rn(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 Yre(t,e){let n=qre,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return rn(s)?l="":rn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:rn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function Wre(t,e){let n=wre;return t.replace(n,(r,o,s,i,a,c)=>{let l=rn(s),p=l||rn(i),d=p||rn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function zre(t,e){let n=Gre;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(rn(s)?o="":rn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:rn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,rn(d)?p="":rn(_)?p=`<${+d+1}.0.0-0`:rn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var gA=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.massUnwrap=Mt.unwrap=Mt.massWrap=Mt.wrap=void 0;var on=console.error.bind(console);function Nl(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 Kre=(t,e,n)=>{if(!t||!t[e]){on("no original function "+String(e)+" to wrap");return}if(!n){on("no wrapper function"),on(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){on("original object and wrapper must be functions");return}let o=n(r,e);return Nl(o,"__original",r),Nl(o,"__unwrap",()=>{t[e]===o&&Nl(t,e,r)}),Nl(o,"__wrapped",!0),Nl(t,e,o),o};Mt.wrap=Kre;var Qre=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{on("must provide one or more modules to patch"),on(new Error().stack);return}if(!(e&&Array.isArray(e))){on("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Mt.wrap)(r,o,n)})})};Mt.massWrap=Qre;var Xre=(t,e)=>{if(!t||!t[e]){on("no function to unwrap."),on(new Error().stack);return}let n=t[e];if(!n.__unwrap)on("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Mt.unwrap=Xre;var Jre=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{on("must provide one or more modules to patch"),on(new Error().stack);return}if(!(e&&Array.isArray(e))){on("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Mt.unwrap)(n,r)})})};Mt.massUnwrap=Jre;function Ol(t){t&&t.logger&&(typeof t.logger!="function"?on("new logger isn't a function, not replacing"):on=t.logger)}Mt.default=Ol;Ol.wrap=Mt.wrap;Ol.massWrap=Mt.massWrap;Ol.unwrap=Mt.unwrap;Ol.massUnwrap=Mt.massUnwrap});var jw=E(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.InstrumentationAbstract=void 0;var AA=(b(),N(v)),Zre=mA(),z_=gA(),RA=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=AA.diag.createComponentLogger({namespace:e}),this._tracer=AA.trace.getTracer(e,n),this._meter=AA.metrics.getMeter(e,n),this._logger=Zre.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=z_.wrap;_unwrap=z_.unwrap;_massWrap=z_.massWrap;_massUnwrap=z_.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)}}};K_.InstrumentationAbstract=RA});var Vw=E((hve,Hw)=>{var Za=1e3,ec=Za*60,tc=ec*60,Ci=tc*24,eoe=Ci*7,toe=Ci*365.25;Hw.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return noe(t);if(n==="number"&&isFinite(t))return e.long?ooe(t):roe(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function noe(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*toe;case"weeks":case"week":case"w":return n*eoe;case"days":case"day":case"d":return n*Ci;case"hours":case"hour":case"hrs":case"hr":case"h":return n*tc;case"minutes":case"minute":case"mins":case"min":case"m":return n*ec;case"seconds":case"second":case"secs":case"sec":case"s":return n*Za;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function roe(t){var e=Math.abs(t);return e>=Ci?Math.round(t/Ci)+"d":e>=tc?Math.round(t/tc)+"h":e>=ec?Math.round(t/ec)+"m":e>=Za?Math.round(t/Za)+"s":t+"ms"}function ooe(t){var e=Math.abs(t);return e>=Ci?Q_(t,e,Ci,"day"):e>=tc?Q_(t,e,tc,"hour"):e>=ec?Q_(t,e,ec,"minute"):e>=Za?Q_(t,e,Za,"second"):t+" ms"}function Q_(t,e,n,r){var o=e>=n*1.5;return Math.round(t/n)+" "+r+(o?"s":"")}});var yA=E((Eve,Fw)=>{function soe(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Vw(),n.destroy=l,Object.keys(t).forEach(p=>{n[p]=t[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let d=0;for(let _=0;_<p.length;_++)d=(d<<5)-d+p.charCodeAt(_),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(p){let d,_=null,f,m;function T(...h){if(!T.enabled)return;let S=T,R=Number(new Date),I=R-(d||R);S.diff=I,S.prev=d,S.curr=R,d=R,h[0]=n.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let x=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(B,se)=>{if(B==="%%")return"%";x++;let ve=n.formatters[se];if(typeof ve=="function"){let nn=h[x];B=ve.call(S,nn),h.splice(x,1),x--}return B}),n.formatArgs.call(S,h),(S.log||n.log).apply(S,h)}return T.namespace=p,T.useColors=n.useColors(),T.color=n.selectColor(p),T.extend=r,T.destroy=n.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(f!==n.namespaces&&(f=n.namespaces,m=n.enabled(p)),m),set:h=>{_=h}}),typeof n.init=="function"&&n.init(T),T}function r(p,d){let _=n(this.namespace+(typeof d>"u"?":":d)+p);return _.log=this.log,_}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let d=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of d)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function s(p,d){let _=0,f=0,m=-1,T=0;for(;_<p.length;)if(f<d.length&&(d[f]===p[_]||d[f]==="*"))d[f]==="*"?(m=f,T=_,f++):(_++,f++);else if(m!==-1)f=m+1,T++,_=T;else return!1;for(;f<d.length&&d[f]==="*";)f++;return f===d.length}function i(){let p=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),p}function a(p){for(let d of n.skips)if(s(p,d))return!1;for(let d of n.names)if(s(p,d))return!0;return!1}function c(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}Fw.exports=soe});var qw=E((En,X_)=>{En.formatArgs=aoe;En.save=coe;En.load=uoe;En.useColors=ioe;En.storage=loe();En.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();En.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ioe(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function aoe(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+X_.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(r=n))}),t.splice(r,0,e)}En.log=console.debug||console.log||(()=>{});function coe(t){try{t?En.storage.setItem("debug",t):En.storage.removeItem("debug")}catch{}}function uoe(){let t;try{t=En.storage.getItem("debug")||En.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function loe(){try{return localStorage}catch{}}X_.exports=yA()(En);var{formatters:poe}=X_.exports;poe.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Yw=E((Sve,$w)=>{"use strict";$w.exports=(t,e=process.argv)=>{let n=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return r!==-1&&(o===-1||r<o)}});var Kw=E((gve,zw)=>{"use strict";var doe=U("os"),Ww=U("tty"),Qn=Yw(),{env:St}=process,os;Qn("no-color")||Qn("no-colors")||Qn("color=false")||Qn("color=never")?os=0:(Qn("color")||Qn("colors")||Qn("color=true")||Qn("color=always"))&&(os=1);"FORCE_COLOR"in St&&(St.FORCE_COLOR==="true"?os=1:St.FORCE_COLOR==="false"?os=0:os=St.FORCE_COLOR.length===0?1:Math.min(parseInt(St.FORCE_COLOR,10),3));function IA(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function NA(t,e){if(os===0)return 0;if(Qn("color=16m")||Qn("color=full")||Qn("color=truecolor"))return 3;if(Qn("color=256"))return 2;if(t&&!e&&os===void 0)return 0;let n=os||0;if(St.TERM==="dumb")return n;if(process.platform==="win32"){let r=doe.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in St)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in St)||St.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in St)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(St.TEAMCITY_VERSION)?1:0;if(St.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in St){let r=parseInt((St.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(St.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(St.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(St.TERM)||"COLORTERM"in St?1:n}function _oe(t){let e=NA(t,t&&t.isTTY);return IA(e)}zw.exports={supportsColor:_oe,stdout:IA(NA(!0,Ww.isatty(1))),stderr:IA(NA(!0,Ww.isatty(2)))}});var Xw=E((gt,Z_)=>{var foe=U("tty"),J_=U("util");gt.init=Aoe;gt.log=Eoe;gt.formatArgs=Toe;gt.save=Soe;gt.load=goe;gt.useColors=moe;gt.destroy=J_.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");gt.colors=[6,2,3,4,5,1];try{let t=Kw();t&&(t.stderr||t).level>=2&&(gt.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}gt.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),t[n]=r,t},{});function moe(){return"colors"in gt.inspectOpts?!!gt.inspectOpts.colors:foe.isatty(process.stderr.fd)}function Toe(t){let{namespace:e,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
3
|
+
`).join(`
|
|
4
|
+
`+s),t.push(o+"m+"+Z_.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=hoe()+e+" "+t[0]}function hoe(){return gt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Eoe(...t){return process.stderr.write(J_.formatWithOptions(gt.inspectOpts,...t)+`
|
|
5
|
+
`)}function Soe(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function goe(){return process.env.DEBUG}function Aoe(t){t.inspectOpts={};let e=Object.keys(gt.inspectOpts);for(let n=0;n<e.length;n++)t.inspectOpts[e[n]]=gt.inspectOpts[e[n]]}Z_.exports=yA()(gt);var{formatters:Qw}=Z_.exports;Qw.o=function(t){return this.inspectOpts.colors=this.useColors,J_.inspect(t,this.inspectOpts).split(`
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};Qw.O=function(t){return this.inspectOpts.colors=this.useColors,J_.inspect(t,this.inspectOpts)}});var Jw=E((Ave,OA)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?OA.exports=qw():OA.exports=Xw()});var ef=E((Rve,Zw)=>{"use strict";var bA=U("path").sep;Zw.exports=function(t){var e=t.split(bA),n=e.lastIndexOf("node_modules");if(n!==-1&&e[n+1]){for(var r=e[n+1][0]==="@",o=r?e[n+1]+"/"+e[n+2]:e[n+1],s=r?3:2,i="",a=n+s-1,c=0;c<=a;c++)c===a?i+=e[c]:i+=e[c]+bA;for(var l="",p=e.length-1,d=n+s;d<=p;d++)d===p?l+=e[d]:l+=e[d]+bA;return{name:o,basedir:i,path:l}}}});var Pi=E((yve,MA)=>{"use strict";var nc=U("path"),gr=U("module"),ze=Jw()("require-in-the-middle"),Roe=ef();MA.exports=bl;MA.exports.Hook=bl;var CA,tf;if(gr.isBuiltin)tf=gr.isBuiltin;else if(gr.builtinModules)tf=t=>t.startsWith("node:")?!0:(CA===void 0&&(CA=new Set(gr.builtinModules)),CA.has(t));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var yoe=/([/\\]index)?(\.js)?$/,PA=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(e,n){if(this._localCache.has(e))return!0;if(n)return!1;{let r=U.cache[e];return!!(r&&this._kRitmExports in r)}}get(e,n){let r=this._localCache.get(e);if(r!==void 0)return r;if(!n){let o=U.cache[e];return o&&o[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in U.cache?U.cache[e][this._kRitmExports]=n:(ze('non-core module is unexpectedly not in require.cache: "%s"',e),this._localCache.set(e,n))}};function bl(t,e,n){if(!(this instanceof bl))return new bl(t,e,n);if(typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null),typeof gr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof gr._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues",process.version);return}this._cache=new PA,this._unhooked=!1,this._origRequire=gr.prototype.require;let r=this,o=new Set,s=e?e.internals===!0:!1,i=Array.isArray(t);ze("registering require hook"),this._require=gr.prototype.require=function(c){return r._unhooked===!0?(ze("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):a.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(c){return r._unhooked===!0?(ze("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):a.call(this,arguments,!0)});function a(c,l){let p=c[0],d=tf(p),_;if(d){if(_=p,p.startsWith("node:")){let R=p.slice(5);tf(R)&&(_=R)}}else{if(l)return ze("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,c);try{_=gr._resolveFilename(p,this)}catch(R){return ze('Module._resolveFilename("%s") threw %j, calling original Module.require',p,R.message),r._origRequire.apply(this,c)}}let f,m;if(ze("processing %s module require('%s'): %s",d===!0?"core":"non-core",p,_),r._cache.has(_,d)===!0)return ze("returning already patched cached module: %s",_),r._cache.get(_,d);let T=o.has(_);T===!1&&o.add(_);let h=l?r._origGetBuiltinModule.apply(this,c):r._origRequire.apply(this,c);if(T===!0)return ze("module is in the process of being patched already - ignoring: %s",_),h;if(o.delete(_),d===!0){if(i===!0&&t.includes(_)===!1)return ze("ignoring core module not on whitelist: %s",_),h;f=_}else if(i===!0&&t.includes(_)){let R=nc.parse(_);f=R.name,m=R.dir}else{let R=Roe(_);if(R===void 0)return ze("could not parse filename: %s",_),h;f=R.name,m=R.basedir;let I=Ioe(R);ze("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",f,p,I,m);let x=!1;if(i){if(!p.startsWith(".")&&t.includes(p)&&(f=p,x=!0),!t.includes(f)&&!t.includes(I))return h;t.includes(I)&&I!==f&&(f=I,x=!0)}if(!x){let V;try{V=U.resolve(f,{paths:[m]})}catch{return ze("could not resolve module: %s",f),r._cache.set(_,h,d),h}if(V!==_)if(s===!0)f=f+nc.sep+nc.relative(m,_),ze("preparing to process require of internal file: %s",f);else return ze("ignoring require of non-main module file: %s",V),r._cache.set(_,h,d),h}}r._cache.set(_,h,d),ze("calling require hook: %s",f);let S=n(h,f,m);return r._cache.set(_,S,d),ze("returning module: %s",f),S}}bl.prototype.unhook=function(){this._unhooked=!0,this._require===gr.prototype.require?(gr.prototype.require=this._origRequire,ze("require unhook successful")):ze("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,ze("process.getBuiltinModule unhook successful")):ze("process.getBuiltinModule unhook unsuccessful"))};function Ioe(t){let e=nc.sep!=="/"?t.path.split(nc.sep).join("/"):t.path;return nc.posix.join(t.name,e).replace(yoe,"")}});var ek=E(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.ModuleNameTrie=ss.ModuleNameSeparator=void 0;ss.ModuleNameSeparator="/";var nf=class{hooks=[];children=new Map},xA=class{_trie=new nf;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ss.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new nf,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(ss.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))}};ss.ModuleNameTrie=xA});var nk=E(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.RequireInTheMiddleSingleton=void 0;var Noe=Pi(),tk=U("path"),vA=ek(),Ooe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),LA=class t{_moduleNameTrie=new vA.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new Noe.Hook(null,{internals:!0},(e,n,r)=>{let o=boe(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 Ooe?new t:this._instance=this._instance??new t}};rf.RequireInTheMiddleSingleton=LA;function boe(t){return tk.sep!==vA.ModuleNameSeparator?t.split(tk.sep).join(vA.ModuleNameSeparator):t}});var ak=E(Cl=>{var rk=[],DA=new WeakMap,ok=new WeakMap,sk=new Map,ik=[],Coe={set(t,e,n){let r=DA.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=ok.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=DA.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function Poe(t,e,n,r,o){sk.set(t,o),DA.set(e,n),ok.set(e,r);let s=new Proxy(e,Coe);rk.forEach(i=>i(t,s,o)),ik.push([t,s,o])}Cl.register=Poe;Cl.importHooks=rk;Cl.specifiers=sk;Cl.toHook=ik});var GA=E((Cve,oc)=>{var ck=U("path"),Moe=ef(),{fileURLToPath:xoe}=U("url"),{MessageChannel:voe}=U("worker_threads"),{isBuiltin:UA}=U("module");UA||(UA=()=>!0);var{importHooks:wA,specifiers:Loe,toHook:Doe}=ak();function uk(t){wA.push(t),Doe.forEach(([e,n,r])=>t(e,n,r))}function lk(t){let e=wA.indexOf(t);e>-1&&wA.splice(e,1)}function rc(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var kA;function Uoe(){let{port1:t,port2:e}=new voe,n=0,r;kA=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function Pl(t,e,n){if(!(this instanceof Pl))return new Pl(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;kA&&Array.isArray(t)&&kA(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);UA(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=xoe(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=Moe(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)rc(n,s,l,void 0);else if(d===o){if(!p)rc(n,s,o,p);else if(p.endsWith(Loe.get(a)))rc(n,s,o,p);else if(r){let _=o+ck.sep+ck.relative(p,l);rc(n,s,_,p)}}else d===i&&rc(n,s,i,p);else rc(n,s,o,p)},uk(this._iitmHook)}Pl.prototype.unhook=function(){lk(this._iitmHook)};oc.exports=Pl;oc.exports.Hook=Pl;oc.exports.addHook=uk;oc.exports.removeHook=lk;oc.exports.createAddHookMessageChannel=Uoe});var BA=E(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isWrapped=is.safeExecuteInTheMiddleAsync=is.safeExecuteInTheMiddle=void 0;function woe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}is.safeExecuteInTheMiddle=woe;async function koe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}is.safeExecuteInTheMiddleAsync=koe;function Goe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}is.isWrapped=Goe});var _k=E(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.InstrumentationBase=void 0;var Ml=U("path"),pk=U("util"),Boe=Bw(),jA=gA(),joe=jw(),Hoe=nk(),Voe=GA(),xl=(b(),N(v)),Foe=Pi(),qoe=U("fs"),$oe=BA(),HA=class extends joe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=Hoe.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,$oe.isWrapped)(e[n])&&this._unwrap(e,n),pk.types.isProxy(e)){let o=(0,jA.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,jA.wrap)(e,n,r)};_unwrap=(e,n)=>pk.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,jA.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{xl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){xl.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{xl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){xl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let e=globalThis.require;!e?.resolve||!e?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=e.resolve(r);e.cache[o]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,qoe.readFileSync)(Ml.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{xl.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 dk(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=Ml.normalize(r);return i.filter(l=>l.name===a&&dk(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),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&&Ml.isAbsolute(a)){let l=Ml.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Ml.isAbsolute(e.name)?new Foe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new Voe.Hook([e.name],{internals:!0},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}};of.InstrumentationBase=HA;function dk(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,Boe.satisfies)(e,r,{includePrerelease:n}))}});var fk=E(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.normalize=void 0;var Yoe=U("path");Object.defineProperty(sf,"normalize",{enumerable:!0,get:function(){return Yoe.normalize}})});var mk=E(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.normalize=sc.InstrumentationBase=void 0;var Woe=_k();Object.defineProperty(sc,"InstrumentationBase",{enumerable:!0,get:function(){return Woe.InstrumentationBase}});var zoe=fk();Object.defineProperty(sc,"normalize",{enumerable:!0,get:function(){return zoe.normalize}})});var VA=E(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.normalize=ic.InstrumentationBase=void 0;var Tk=mk();Object.defineProperty(ic,"InstrumentationBase",{enumerable:!0,get:function(){return Tk.InstrumentationBase}});Object.defineProperty(ic,"normalize",{enumerable:!0,get:function(){return Tk.normalize}})});var hk=E(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.InstrumentationNodeModuleDefinition=void 0;var FA=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};af.InstrumentationNodeModuleDefinition=FA});var Ek=E(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.InstrumentationNodeModuleFile=void 0;var Koe=VA(),qA=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,Koe.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};cf.InstrumentationNodeModuleFile=qA});var Sk=E(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.semconvStabilityFromStr=Mi.SemconvStability=void 0;var uf;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(uf=Mi.SemconvStability||(Mi.SemconvStability={}));function Qoe(t,e){let n=uf.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=uf.DUPLICATE;break}else o.toLowerCase()===t&&(n=uf.STABLE);return n}Mi.semconvStabilityFromStr=Qoe});var ne=E(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.semconvStabilityFromStr=tt.SemconvStability=tt.safeExecuteInTheMiddleAsync=tt.safeExecuteInTheMiddle=tt.isWrapped=tt.InstrumentationNodeModuleFile=tt.InstrumentationNodeModuleDefinition=tt.InstrumentationBase=tt.registerInstrumentations=void 0;var Xoe=Mw();Object.defineProperty(tt,"registerInstrumentations",{enumerable:!0,get:function(){return Xoe.registerInstrumentations}});var Joe=VA();Object.defineProperty(tt,"InstrumentationBase",{enumerable:!0,get:function(){return Joe.InstrumentationBase}});var Zoe=hk();Object.defineProperty(tt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return Zoe.InstrumentationNodeModuleDefinition}});var ese=Ek();Object.defineProperty(tt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return ese.InstrumentationNodeModuleFile}});var $A=BA();Object.defineProperty(tt,"isWrapped",{enumerable:!0,get:function(){return $A.isWrapped}});Object.defineProperty(tt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return $A.safeExecuteInTheMiddle}});Object.defineProperty(tt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return $A.safeExecuteInTheMiddleAsync}});var gk=Sk();Object.defineProperty(tt,"SemconvStability",{enumerable:!0,get:function(){return gk.SemconvStability}});Object.defineProperty(tt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return gk.semconvStabilityFromStr}})});var Ak=E(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.HTTP_FLAVOR_VALUE_HTTP_1_1=q.NET_TRANSPORT_VALUE_IP_UDP=q.NET_TRANSPORT_VALUE_IP_TCP=q.ATTR_NET_TRANSPORT=q.ATTR_NET_PEER_PORT=q.ATTR_NET_PEER_NAME=q.ATTR_NET_PEER_IP=q.ATTR_NET_HOST_PORT=q.ATTR_NET_HOST_NAME=q.ATTR_NET_HOST_IP=q.ATTR_HTTP_USER_AGENT=q.ATTR_HTTP_URL=q.ATTR_HTTP_TARGET=q.ATTR_HTTP_STATUS_CODE=q.ATTR_HTTP_SERVER_NAME=q.ATTR_HTTP_SCHEME=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH=q.ATTR_HTTP_METHOD=q.ATTR_HTTP_HOST=q.ATTR_HTTP_FLAVOR=q.ATTR_HTTP_CLIENT_IP=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=q.ATTR_USER_AGENT_SYNTHETIC_TYPE=void 0;q.ATTR_USER_AGENT_SYNTHETIC_TYPE="user_agent.synthetic.type";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT="bot";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST="test";q.ATTR_HTTP_CLIENT_IP="http.client_ip";q.ATTR_HTTP_FLAVOR="http.flavor";q.ATTR_HTTP_HOST="http.host";q.ATTR_HTTP_METHOD="http.method";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH="http.request_content_length";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED="http.response_content_length_uncompressed";q.ATTR_HTTP_SCHEME="http.scheme";q.ATTR_HTTP_SERVER_NAME="http.server_name";q.ATTR_HTTP_STATUS_CODE="http.status_code";q.ATTR_HTTP_TARGET="http.target";q.ATTR_HTTP_URL="http.url";q.ATTR_HTTP_USER_AGENT="http.user_agent";q.ATTR_NET_HOST_IP="net.host.ip";q.ATTR_NET_HOST_NAME="net.host.name";q.ATTR_NET_HOST_PORT="net.host.port";q.ATTR_NET_PEER_IP="net.peer.ip";q.ATTR_NET_PEER_NAME="net.peer.name";q.ATTR_NET_PEER_PORT="net.peer.port";q.ATTR_NET_TRANSPORT="net.transport";q.NET_TRANSPORT_VALUE_IP_TCP="ip_tcp";q.NET_TRANSPORT_VALUE_IP_UDP="ip_udp";q.HTTP_FLAVOR_VALUE_HTTP_1_1="1.1"});var Rk=E(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.AttributeNames=void 0;var tse;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(tse=vl.AttributeNames||(vl.AttributeNames={}))});var YA=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.DEFAULT_QUERY_STRINGS_TO_REDACT=$r.STR_REDACTED=$r.SYNTHETIC_BOT_NAMES=$r.SYNTHETIC_TEST_NAMES=void 0;$r.SYNTHETIC_TEST_NAMES=["alwayson"];$r.SYNTHETIC_BOT_NAMES=["googlebot","bingbot"];$r.STR_REDACTED="REDACTED";$r.DEFAULT_QUERY_STRINGS_TO_REDACT=["sig","Signature","AWSAccessKeyId","X-Goog-Signature"]});var Ik=E((Hve,yk)=>{"use strict";var nse=U("util");function WA(t,e){Error.captureStackTrace(this,WA),this.name=this.constructor.name,this.message=t,this.input=e}nse.inherits(WA,Error);yk.exports=WA});var Ok=E((Vve,Nk)=>{"use strict";function rse(t){return t===34||t===40||t===41||t===44||t===47||t>=58&&t<=64||t>=91&&t<=93||t===123||t===125}function ose(t){return t===33||t>=35&&t<=39||t===42||t===43||t===45||t===46||t>=48&&t<=57||t>=65&&t<=90||t>=94&&t<=122||t===124||t===126}function sse(t){return t>=32&&t<=126}function ise(t){return t>=128&&t<=255}Nk.exports={isDelimiter:rse,isTokenChar:ose,isExtended:ise,isPrint:sse}});var xk=E((Fve,Mk)=>{"use strict";var ase=U("util"),ac=Ik(),lf=Ok(),cse=lf.isDelimiter,bk=lf.isTokenChar,Ck=lf.isExtended,use=lf.isPrint;function Pk(t){return t.replace(/\\(.)/g,"$1")}function Ll(t,e){return ase.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function lse(t){for(var e=!1,n=!1,r=!1,o={},s=[],i=-1,a=-1,c,l,p=0;p<t.length;p++)if(l=t.charCodeAt(p),c===void 0){if(p!==0&&i===-1&&(l===32||l===9))continue;if(bk(l))i===-1&&(i=p);else if(l===61&&i!==-1)c=t.slice(i,p).toLowerCase(),i=-1;else throw new ac(Ll(t,p),t)}else if(n&&(l===9||use(l)||Ck(l)))n=!1;else if(bk(l)){if(a!==-1)throw new ac(Ll(t,p),t);i===-1&&(i=p)}else if(cse(l)||Ck(l))if(r)l===34?(r=!1,a=p):l===92?(i===-1&&(i=p),n=e=!0):i===-1&&(i=p);else if(l===34&&t.charCodeAt(p-1)===61)r=!0;else if((l===44||l===59)&&(i!==-1||a!==-1))i!==-1?(a===-1&&(a=p),o[c]=e?Pk(t.slice(i,a)):t.slice(i,a)):o[c]="",l===44&&(s.push(o),o={}),c=void 0,i=a=-1;else throw new ac(Ll(t,p),t);else if(l===32||l===9){if(a!==-1)continue;if(r)i===-1&&(i=p);else if(i!==-1)a=p;else throw new ac(Ll(t,p),t)}else throw new ac(Ll(t,p),t);if(c===void 0||r||i===-1&&a===-1||l===32||l===9)throw new ac("Unexpected end of input",t);return i!==-1?(a===-1&&(a=p),o[c]=e?Pk(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}Mk.exports=lse});var jk=E($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.headerCapture=$.getIncomingStableRequestMetricAttributesOnResponse=$.getIncomingRequestMetricAttributesOnResponse=$.getIncomingRequestAttributesOnResponse=$.getIncomingRequestMetricAttributes=$.getIncomingRequestAttributes=$.getRemoteClientAddress=$.getOutgoingStableRequestMetricAttributesOnResponse=$.getOutgoingRequestMetricAttributesOnResponse=$.getOutgoingRequestAttributesOnResponse=$.setAttributesFromHttpKind=$.getOutgoingRequestMetricAttributes=$.getOutgoingRequestAttributes=$.extractHostnameAndPort=$.isValidOptionsType=$.getRequestInfo=$.isCompressed=$.setResponseContentLengthAttribute=$.setRequestContentLengthAttribute=$.setSpanWithError=$.satisfiesPattern=$.parseResponseStatus=$.getAbsoluteUrl=void 0;var Dl=(b(),N(v)),ae=(le(),N(Ae)),F=Ak(),vk=he(),Un=ne(),pse=U("url"),df=Rk(),Lk=YA(),pf=YA(),dse=xk(),_se=(t,e,n="http:",r=Array.from(pf.DEFAULT_QUERY_STRINGS_TO_REDACT))=>{let o=t||{},s=o.protocol||n,i=(o.port||"").toString(),a=o.path||"/",c=o.host||o.hostname||e.host||"localhost";if(c.indexOf(":")===-1&&i&&i!=="80"&&i!=="443"&&(c+=`:${i}`),a.includes("?"))try{let p=new URL(a,"http://localhost"),d=r||[];for(let _ of d)p.searchParams.get(_)&&p.searchParams.set(_,pf.STR_REDACTED);a=`${p.pathname}${p.search}`}catch{}let l=o.auth?`${pf.STR_REDACTED}:${pf.STR_REDACTED}@`:"";return`${s}//${l}${c}${a}`};$.getAbsoluteUrl=_se;var fse=(t,e)=>{let n=t===Dl.SpanKind.CLIENT?400:500;return e&&e>=100&&e<n?Dl.SpanStatusCode.UNSET:Dl.SpanStatusCode.ERROR};$.parseResponseStatus=fse;var mse=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")};$.satisfiesPattern=mse;var Tse=(t,e,n)=>{let r=e.message;n&Un.SemconvStability.OLD&&(t.setAttribute(df.AttributeNames.HTTP_ERROR_NAME,e.name),t.setAttribute(df.AttributeNames.HTTP_ERROR_MESSAGE,r)),n&Un.SemconvStability.STABLE&&t.setAttribute(ae.ATTR_ERROR_TYPE,e.name),t.setStatus({code:Dl.SpanStatusCode.ERROR,message:r}),t.recordException(e)};$.setSpanWithError=Tse;var hse=(t,e)=>{let n=Uk(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[F.ATTR_HTTP_REQUEST_CONTENT_LENGTH]=n:e[F.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setRequestContentLengthAttribute=hse;var Ese=(t,e)=>{let n=Uk(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[F.ATTR_HTTP_RESPONSE_CONTENT_LENGTH]=n:e[F.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setResponseContentLengthAttribute=Ese;function Uk(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var Sse=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};$.isCompressed=Sse;function gse(t){let{hostname:e,pathname:n,port:r,username:o,password:s,search:i,protocol:a,hash:c,href:l,origin:p,host:d}=new URL(t),_={protocol:a,hostname:e&&e[0]==="["?e.slice(1,-1):e,hash:c,search:i,pathname:n,path:`${n||""}${i||""}`,href:l,origin:p,host:d};return r!==""&&(_.port=Number(r)),(o||s)&&(_.auth=`${decodeURIComponent(o)}:${decodeURIComponent(s)}`),_}var Ase=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=gse(e);s=c,r=c.pathname||"/"}catch(c){i=!0,t.verbose("Unable to parse URL provided to HTTP request, using fallback to determine path. Original error:",c),s={path:e},r=s.path||"/"}o=`${s.protocol||"http:"}//${s.host}`,n!==void 0&&Object.assign(s,n)}else if(e instanceof pse.URL)s={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,path:`${e.pathname||""}${e.search||""}`},e.port!==""&&(s.port=Number(e.port)),(e.username||e.password)&&(s.auth=`${e.username}:${e.password}`),r=e.pathname,o=e.origin,n!==void 0&&Object.assign(s,n);else{s=Object.assign({protocol:e.host?"http:":void 0},e);let c=s.host||(s.port!=null?`${s.hostname}${s.port}`:s.hostname);if(o=`${s.protocol||"http:"}//${c}`,r=e.pathname,!r&&s.path)try{r=new URL(s.path,o).pathname||"/"}catch{r="/"}}let a=s.method?s.method.toUpperCase():"GET";return{origin:o,pathname:r,method:a,optionsParsed:s,invalidUrl:i}};$.getRequestInfo=Ase;var Rse=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};$.isValidOptionsType=Rse;var yse=t=>{if(t.hostname&&t.port)return{hostname:t.hostname,port:t.port};let e=t.host?.match(/^([^:/ ]+)(:\d{1,5})?/)||null,n=t.hostname||(e===null?"localhost":e[1]),r=t.port;return r||(e&&e[2]?r=e[2].substring(1):r=t.protocol==="https:"?"443":"80"),{hostname:n,port:r}};$.extractHostnameAndPort=yse;var Ise=(t,e,n,r)=>{let o=e.hostname,s=e.port,i=t.method??"GET",a=Gk(i),c=t.headers||{},l=c["user-agent"],p=(0,$.getAbsoluteUrl)(t,c,`${e.component}:`,e.redactedQueryParams),d={[F.ATTR_HTTP_URL]:p,[F.ATTR_HTTP_METHOD]:i,[F.ATTR_HTTP_TARGET]:t.path||"/",[F.ATTR_NET_PEER_NAME]:o,[F.ATTR_HTTP_HOST]:c.host??`${o}:${s}`},_={[ae.ATTR_HTTP_REQUEST_METHOD]:a,[ae.ATTR_SERVER_ADDRESS]:o,[ae.ATTR_SERVER_PORT]:Number(s),[ae.ATTR_URL_FULL]:p,[ae.ATTR_USER_AGENT_ORIGINAL]:l};switch(i!==a&&(_[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=i),r&&l&&(_[F.ATTR_USER_AGENT_SYNTHETIC_TYPE]=wk(l)),l!==void 0&&(d[F.ATTR_HTTP_USER_AGENT]=l),n){case Un.SemconvStability.STABLE:return Object.assign(_,e.hookAttributes);case Un.SemconvStability.OLD:return Object.assign(d,e.hookAttributes)}return Object.assign(d,_,e.hookAttributes)};$.getOutgoingRequestAttributes=Ise;var Nse=t=>{let e={};return e[F.ATTR_HTTP_METHOD]=t[F.ATTR_HTTP_METHOD],e[F.ATTR_NET_PEER_NAME]=t[F.ATTR_NET_PEER_NAME],e};$.getOutgoingRequestMetricAttributes=Nse;var Ose=(t,e)=>{t&&(e[F.ATTR_HTTP_FLAVOR]=t,t.toUpperCase()!=="QUIC"?e[F.ATTR_NET_TRANSPORT]=F.NET_TRANSPORT_VALUE_IP_TCP:e[F.ATTR_NET_TRANSPORT]=F.NET_TRANSPORT_VALUE_IP_UDP)};$.setAttributesFromHttpKind=Ose;var wk=t=>{let e=String(t).toLowerCase();for(let n of Lk.SYNTHETIC_TEST_NAMES)if(e.includes(n))return F.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST;for(let n of Lk.SYNTHETIC_BOT_NAMES)if(e.includes(n))return F.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT},bse=(t,e)=>{let{statusCode:n,statusMessage:r,httpVersion:o,socket:s}=t,i={},a={};if(n!=null&&(a[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=n),s){let{remoteAddress:c,remotePort:l}=s;i[F.ATTR_NET_PEER_IP]=c,i[F.ATTR_NET_PEER_PORT]=l,a[ae.ATTR_NETWORK_PEER_ADDRESS]=c,a[ae.ATTR_NETWORK_PEER_PORT]=l,a[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t.httpVersion}switch((0,$.setResponseContentLengthAttribute)(t,i),n&&(i[F.ATTR_HTTP_STATUS_CODE]=n,i[df.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,$.setAttributesFromHttpKind)(o,i),e){case Un.SemconvStability.STABLE:return a;case Un.SemconvStability.OLD:return i}return Object.assign(i,a)};$.getOutgoingRequestAttributesOnResponse=bse;var Cse=t=>{let e={};return e[F.ATTR_NET_PEER_PORT]=t[F.ATTR_NET_PEER_PORT],e[F.ATTR_HTTP_STATUS_CODE]=t[F.ATTR_HTTP_STATUS_CODE],e[F.ATTR_HTTP_FLAVOR]=t[F.ATTR_HTTP_FLAVOR],e};$.getOutgoingRequestMetricAttributesOnResponse=Cse;var Pse=t=>{let e={};return t[ae.ATTR_NETWORK_PROTOCOL_VERSION]&&(e[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t[ae.ATTR_NETWORK_PROTOCOL_VERSION]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getOutgoingStableRequestMetricAttributesOnResponse=Pse;function as(t,e){let n=t.split(":");if(n.length===1)return e==="http"?{host:n[0],port:"80"}:e==="https"?{host:n[0],port:"443"}:{host:n[0]};if(n.length===2)return{host:n[0],port:n[1]};if(n[0].startsWith("[")){if(n[n.length-1].endsWith("]")){if(e==="http")return{host:t,port:"80"};if(e==="https")return{host:t,port:"443"}}else if(n[n.length-2].endsWith("]"))return{host:n.slice(0,-1).join(":"),port:n[n.length-1]}}return{host:t}}function Mse(t,e){let n=t.headers.forwarded;if(n){for(let s of Bk(n))if(s.host)return as(s.host,s.proto)}let r=t.headers["x-forwarded-host"];if(typeof r=="string")return typeof t.headers["x-forwarded-proto"]=="string"?as(r,t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?as(r,t.headers["x-forwarded-proto"][0]):as(r);if(Array.isArray(r)&&typeof r[0]=="string"&&r[0].length>0)return typeof t.headers["x-forwarded-proto"]=="string"?as(r[0],t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?as(r[0],t.headers["x-forwarded-proto"][0]):as(r[0]);let o=t.headers.host;return typeof o=="string"&&o.length>0?as(o,e):null}function kk(t){let e=t.headers.forwarded;if(e){for(let o of Bk(e))if(o.for)return Dk(o.for)}let n=t.headers["x-forwarded-for"];if(n){let o;if(typeof n=="string"?o=n:Array.isArray(n)&&(o=n[0]),typeof o=="string")return o=o.split(",")[0].trim(),Dk(o)}let r=t.socket.remoteAddress;return r||null}$.getRemoteClientAddress=kk;function Dk(t){try{let{hostname:e}=new URL(`http://${t}`);return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}catch{return t}}function xse(t,e,n){try{if(e.headers.host)return new URL(e.url??"/",`${t}://${e.headers.host}`);{let r=new URL(e.url??"/",`${t}://localhost`);return{pathname:r.pathname,search:r.search,toString:function(){return r.pathname+r.search}}}}catch(r){return n.verbose("Unable to get URL from request",r),{}}}var vse=(t,e,n)=>{let{component:r,enableSyntheticSourceDetection:o,hookAttributes:s,semconvStability:i,serverName:a}=e,{headers:c,httpVersion:l,method:p}=t,{host:d,"user-agent":_,"x-forwarded-for":f}=c,m=xse(r,t,n),T,h;if(i!==Un.SemconvStability.OLD){let S=Gk(p),R=Mse(t,r),I=kk(t);T={[ae.ATTR_HTTP_REQUEST_METHOD]:S,[ae.ATTR_URL_SCHEME]:r,[ae.ATTR_SERVER_ADDRESS]:R?.host,[ae.ATTR_NETWORK_PEER_ADDRESS]:t.socket.remoteAddress,[ae.ATTR_NETWORK_PEER_PORT]:t.socket.remotePort,[ae.ATTR_NETWORK_PROTOCOL_VERSION]:t.httpVersion,[ae.ATTR_USER_AGENT_ORIGINAL]:_},m.pathname!=null&&(T[ae.ATTR_URL_PATH]=m.pathname),m.search&&(T[ae.ATTR_URL_QUERY]=m.search.slice(1)),I!=null&&(T[ae.ATTR_CLIENT_ADDRESS]=I),R?.port!=null&&(T[ae.ATTR_SERVER_PORT]=Number(R.port)),p!==S&&(T[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=p),o&&_&&(T[F.ATTR_USER_AGENT_SYNTHETIC_TYPE]=wk(_))}if(i!==Un.SemconvStability.STABLE){let S=d?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost";h={[F.ATTR_HTTP_URL]:m.toString(),[F.ATTR_HTTP_HOST]:d,[F.ATTR_NET_HOST_NAME]:S,[F.ATTR_HTTP_METHOD]:p,[F.ATTR_HTTP_SCHEME]:r},typeof f=="string"&&(h[F.ATTR_HTTP_CLIENT_IP]=f.split(",")[0]),typeof a=="string"&&(h[F.ATTR_HTTP_SERVER_NAME]=a),m.pathname&&(h[F.ATTR_HTTP_TARGET]=m.pathname+m.search||"/"),_!==void 0&&(h[F.ATTR_HTTP_USER_AGENT]=_),(0,$.setRequestContentLengthAttribute)(t,h),(0,$.setAttributesFromHttpKind)(l,h)}switch(i){case Un.SemconvStability.STABLE:return Object.assign(T,s);case Un.SemconvStability.OLD:return Object.assign(h,s);default:return Object.assign(h,T,s)}};$.getIncomingRequestAttributes=vse;var Lse=t=>{let e={};return e[F.ATTR_HTTP_SCHEME]=t[F.ATTR_HTTP_SCHEME],e[F.ATTR_HTTP_METHOD]=t[F.ATTR_HTTP_METHOD],e[F.ATTR_NET_HOST_NAME]=t[F.ATTR_NET_HOST_NAME],e[F.ATTR_HTTP_FLAVOR]=t[F.ATTR_HTTP_FLAVOR],e};$.getIncomingRequestMetricAttributes=Lse;var Dse=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,vk.getRPCMetadata)(Dl.context.active()),c={};if(r){let{localAddress:l,localPort:p,remoteAddress:d,remotePort:_}=r;c[F.ATTR_NET_HOST_IP]=l,c[F.ATTR_NET_HOST_PORT]=p,c[F.ATTR_NET_PEER_IP]=d,c[F.ATTR_NET_PEER_PORT]=_}switch(c[F.ATTR_HTTP_STATUS_CODE]=o,c[df.AttributeNames.HTTP_STATUS_TEXT]=(s||"").toUpperCase(),a?.type===vk.RPCType.HTTP&&a.route!==void 0&&(c[ae.ATTR_HTTP_ROUTE]=a.route,i[ae.ATTR_HTTP_ROUTE]=a.route),n){case Un.SemconvStability.STABLE:return i;case Un.SemconvStability.OLD:return c}return Object.assign(c,i)};$.getIncomingRequestAttributesOnResponse=Dse;var Use=t=>{let e={};return e[F.ATTR_HTTP_STATUS_CODE]=t[F.ATTR_HTTP_STATUS_CODE],e[F.ATTR_NET_HOST_PORT]=t[F.ATTR_NET_HOST_PORT],t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),e};$.getIncomingRequestMetricAttributesOnResponse=Use;var wse=t=>{let e={};return t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getIncomingStableRequestMetricAttributesOnResponse=wse;function kse(t,e,n){let r=new Map;for(let o=0,s=e.length;o<s;o++){let i=e[o].toLowerCase();n&Un.SemconvStability.STABLE?r.set(i,i):r.set(i,i.replaceAll("-","_"))}return o=>{let s={};for(let i of r.keys()){let a=o(i);if(a===void 0)continue;let c=r.get(i),l=`http.${t}.header.${c}`;typeof a=="string"?s[l]=[a]:Array.isArray(a)?s[l]=a:s[l]=[a]}return s}}$.headerCapture=kse;var Gse=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","QUERY"]);function Gk(t){if(t==null)return"GET";let e=t.toUpperCase();return Gse.has(e)?e:"_OTHER"}function Bk(t){try{return dse(t)}catch{return[]}}});var Hk=E(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.HttpInstrumentation=void 0;var oe=(b(),N(v)),cs=he(),Bse=U("url"),jse=Sw(),At=ne(),zA=U("events"),Le=(le(),N(Ae)),Ke=jk(),KA=class extends At.InstrumentationBase{_spanNotEnded=new WeakSet;_headerCapture;_httpPatched=!1;_httpsPatched=!1;_semconvStability=At.SemconvStability.OLD;constructor(e={}){super("@opentelemetry/instrumentation-http",jse.VERSION,e),this._semconvStability=(0,At.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._headerCapture=this._createHeaderCapture(this._semconvStability)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:"Duration of HTTP server requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}}),this._stableHttpClientDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Duration of HTTP client requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}_recordServerDuration(e,n,r){this._semconvStability&At.SemconvStability.OLD&&this._oldHttpServerDurationHistogram.record(e,n),this._semconvStability&At.SemconvStability.STABLE&&this._stableHttpServerDurationHistogram.record(e/1e3,r)}_recordClientDuration(e,n,r){this._semconvStability&At.SemconvStability.OLD&&this._oldHttpClientDurationHistogram.record(e,n),this._semconvStability&At.SemconvStability.STABLE&&this._stableHttpClientDurationHistogram.record(e/1e3,r)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture(this._semconvStability)}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new At.InstrumentationNodeModuleDefinition("http",["*"],e=>{if(this._httpPatched)return e;this._httpPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchOutgoingRequestFunction("http")),o=this._wrap(e,"get",this._getPatchOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),e},e=>{this._httpPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new At.InstrumentationNodeModuleDefinition("https",["*"],e=>{if(this._httpsPatched)return e;this._httpsPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchHttpsOutgoingRequestFunction("https")),o=this._wrap(e,"get",this._getPatchHttpsOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),e},e=>{this._httpsPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(e){return n=>this._incomingRequestFunction(e,n)}_getPatchOutgoingRequestFunction(e){return n=>this._outgoingRequestFunction(e,n)}_getPatchOutgoingGetFunction(e){return n=>function(o,...s){let i=e(o,...s);return i.end(),i}}_getPatchHttpsOutgoingRequestFunction(e){return n=>{let r=this;return function(s,...i){return e==="https"&&typeof s=="object"&&s?.constructor?.name!=="URL"&&(s=Object.assign({},s),r._setDefaultOptions(s)),r._getPatchOutgoingRequestFunction(e)(n)(s,...i)}}}_setDefaultOptions(e){e.protocol=e.protocol||"https:",e.port=e.port||443}_getPatchHttpsOutgoingGetFunction(e){return n=>{let r=this;return function(s,...i){return r._getPatchOutgoingGetFunction(e)(n)(s,...i)}}}_traceClientRequest(e,n,r,o,s){this.getConfig().requestHook&&this._callRequestHook(n,e);let i=!1;return e.prependListener("response",a=>{this._diag.debug("outgoingRequest on response()"),e.listenerCount("response")<=1&&a.resume();let c=(0,Ke.getOutgoingRequestAttributesOnResponse)(a,this._semconvStability);n.setAttributes(c),o=Object.assign(o,(0,Ke.getOutgoingRequestMetricAttributesOnResponse)(c)),s=Object.assign(s,(0,Ke.getOutgoingStableRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(n,a),n.setAttributes(this._headerCapture.client.captureRequestHeaders(p=>e.getHeader(p))),n.setAttributes(this._headerCapture.client.captureResponseHeaders(p=>a.headers[p])),oe.context.bind(oe.context.active(),a);let l=()=>{if(this._diag.debug("outgoingRequest on end()"),i)return;i=!0;let p;a.aborted&&!a.complete?p={code:oe.SpanStatusCode.ERROR}:p={code:(0,Ke.parseResponseStatus)(oe.SpanKind.CLIENT,a.statusCode)},n.setStatus(p),this.getConfig().applyCustomAttributesOnSpan&&(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,a),()=>{},!0),this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s)};a.on("end",l),a.on(zA.errorMonitor,p=>{this._diag.debug("outgoingRequest on error()",p),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,p))})}),e.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(e.aborted||i)&&(i=!0,this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s))}),e.on(zA.errorMonitor,a=>{this._diag.debug("outgoingRequest on request error()",a),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,a))}),this._diag.debug("http.ClientRequest return request"),e}_incomingRequestFunction(e,n){let r=this;return function(s,...i){if(s!=="request")return n.apply(this,[s,...i]);let a=i[0],c=i[1],l=a.method||"GET";if(r._diag.debug(`${e} instrumentation incomingRequest`),(0,At.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreIncomingRequestHook?.(a),I=>{I!=null&&r._diag.error("caught ignoreIncomingRequestHook error: ",I)},!0))return oe.context.with((0,cs.suppressTracing)(oe.context.active()),()=>(oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),n.apply(this,[s,...i])));let p=a.headers,d=(0,Ke.getIncomingRequestAttributes)(a,{component:e,serverName:r.getConfig().serverName,hookAttributes:r._callStartSpanHook(a,r.getConfig().startIncomingSpanHook),semconvStability:r._semconvStability,enableSyntheticSourceDetection:r.getConfig().enableSyntheticSourceDetection||!1},r._diag);Object.assign(d,r._headerCapture.server.captureRequestHeaders(I=>a.headers[I]));let _={kind:oe.SpanKind.SERVER,attributes:d},f=(0,cs.hrTime)(),m=(0,Ke.getIncomingRequestMetricAttributes)(d),T={[Le.ATTR_HTTP_REQUEST_METHOD]:d[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_URL_SCHEME]:d[Le.ATTR_URL_SCHEME]};d[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(T[Le.ATTR_NETWORK_PROTOCOL_VERSION]=d[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let h=oe.propagation.extract(oe.ROOT_CONTEXT,p),S=r._startHttpSpan(l,_,h),R={type:cs.RPCType.HTTP,span:S};return oe.context.with((0,cs.setRPCMetadata)(oe.trace.setSpan(h,S),R),()=>{oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),r.getConfig().requestHook&&r._callRequestHook(S,a),r.getConfig().responseHook&&r._callResponseHook(S,c);let I=!1;return c.on("close",()=>{I||r._onServerResponseFinish(a,c,S,m,T,f)}),c.on(zA.errorMonitor,x=>{I=!0,r._onServerResponseError(S,m,T,f,x)}),(0,At.safeExecuteInTheMiddle)(()=>n.apply(this,[s,...i]),x=>{if(x)throw r._onServerResponseError(S,m,T,f,x),x})})}}_outgoingRequestFunction(e,n){let r=this;return function(s,...i){if(!(0,Ke.isValidOptionsType)(s))return n.apply(this,[s,...i]);let a=typeof i[0]=="object"&&(typeof s=="string"||s instanceof Bse.URL)?i.shift():void 0,{method:c,invalidUrl:l,optionsParsed:p}=(0,Ke.getRequestInfo)(r._diag,s,a);if((0,At.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreOutgoingRequestHook?.(p),V=>{V!=null&&r._diag.error("caught ignoreOutgoingRequestHook error: ",V)},!0))return n.apply(this,[p,...i]);let{hostname:d,port:_}=(0,Ke.extractHostnameAndPort)(p),f=(0,Ke.getOutgoingRequestAttributes)(p,{component:e,port:_,hostname:d,hookAttributes:r._callStartSpanHook(p,r.getConfig().startOutgoingSpanHook),redactedQueryParams:r.getConfig().redactedQueryParams},r._semconvStability,r.getConfig().enableSyntheticSourceDetection||!1),m=(0,cs.hrTime)(),T=(0,Ke.getOutgoingRequestMetricAttributes)(f),h={[Le.ATTR_HTTP_REQUEST_METHOD]:f[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_SERVER_ADDRESS]:f[Le.ATTR_SERVER_ADDRESS],[Le.ATTR_SERVER_PORT]:f[Le.ATTR_SERVER_PORT]};f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(h[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]=f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]),f[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(h[Le.ATTR_NETWORK_PROTOCOL_VERSION]=f[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let S={kind:oe.SpanKind.CLIENT,attributes:f},R=r._startHttpSpan(c,S),I=oe.context.active(),x=oe.trace.setSpan(I,R);return p.headers?p.headers=Object.assign({},p.headers):p.headers={},oe.propagation.inject(x,p.headers),oe.context.with(x,()=>{let V=i[i.length-1];typeof V=="function"&&(i[i.length-1]=oe.context.bind(I,V));let B=(0,At.safeExecuteInTheMiddle)(()=>l?n.apply(this,[s,...i]):n.apply(this,[p,...i]),se=>{if(se)throw r._onOutgoingRequestError(R,T,h,m,se),se});return r._diag.debug(`${e} instrumentation outgoingRequest`),oe.context.bind(I,B),r._traceClientRequest(B,R,m,T,h)})}}_onServerResponseFinish(e,n,r,o,s,i){let a=(0,Ke.getIncomingRequestAttributesOnResponse)(e,n,this._semconvStability);o=Object.assign(o,(0,Ke.getIncomingRequestMetricAttributesOnResponse)(a)),s=Object.assign(s,(0,Ke.getIncomingStableRequestMetricAttributesOnResponse)(a)),r.setAttributes(this._headerCapture.server.captureResponseHeaders(l=>n.getHeader(l))),r.setAttributes(a).setStatus({code:(0,Ke.parseResponseStatus)(oe.SpanKind.SERVER,n.statusCode)});let c=a[Le.ATTR_HTTP_ROUTE];c&&r.updateName(`${e.method||"GET"} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,e,n),()=>{},!0),this._closeHttpSpan(r,oe.SpanKind.SERVER,i,o,s)}_onOutgoingRequestError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.CLIENT,o,n,r)}_onServerResponseError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.SERVER,o,n,r)}_startHttpSpan(e,n,r=oe.context.active()){let o=n.kind===oe.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,i=oe.trace.getSpan(r);return o===!0&&(!i||!oe.trace.isSpanContextValid(i.spanContext()))?s=oe.trace.wrapSpanContext(oe.INVALID_SPAN_CONTEXT):o===!0&&i?.spanContext().isRemote?s=i:s=this.tracer.startSpan(e,n,r),this._spanNotEnded.add(s),s}_closeHttpSpan(e,n,r,o,s){if(!this._spanNotEnded.has(e))return;e.end(),this._spanNotEnded.delete(e);let i=(0,cs.hrTimeToMilliseconds)((0,cs.hrTimeDuration)(r,(0,cs.hrTime)()));n===oe.SpanKind.SERVER?this._recordServerDuration(i,o,s):n===oe.SpanKind.CLIENT&&this._recordClientDuration(i,o,s)}_callResponseHook(e,n){(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,n),()=>{},!0)}_callRequestHook(e,n){(0,At.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,n),()=>{},!0)}_callStartSpanHook(e,n){if(typeof n=="function")return(0,At.safeExecuteInTheMiddle)(()=>n(e),()=>{},!0)}_createHeaderCapture(e){let n=this.getConfig();return{client:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.client?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.client?.responseHeaders??[],e)},server:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.server?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.server?.responseHeaders??[],e)}}}};_f.HttpInstrumentation=KA});var Vk=E(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.HttpInstrumentation=void 0;var Hse=Hk();Object.defineProperty(ff,"HttpInstrumentation",{enumerable:!0,get:function(){return Hse.HttpInstrumentation}})});var zy=E(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});Om.AbstractAsyncHooksContextManager=void 0;var Rle=U("events"),yle=["addListener","on","once","prependListener","prependOnceListener"],Wy=class{bind(e,n){return n instanceof Rle.EventEmitter?this._bindEventEmitter(e,n):typeof n=="function"?this._bindFunction(e,n):n}_bindFunction(e,n){let r=this,o=function(...s){return r.with(e,()=>n.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(e,n){return this._getPatchMap(n)!==void 0||(this._createPatchMap(n),yle.forEach(o=>{n[o]!==void 0&&(n[o]=this._patchAddListener(n,n[o],e))}),typeof n.removeListener=="function"&&(n.removeListener=this._patchRemoveListener(n,n.removeListener)),typeof n.off=="function"&&(n.off=this._patchRemoveListener(n,n.off)),typeof n.removeAllListeners=="function"&&(n.removeAllListeners=this._patchRemoveAllListeners(n,n.removeAllListeners))),n}_patchRemoveListener(e,n){let r=this;return function(o,s){let i=r._getPatchMap(e)?.[o];if(i===void 0)return n.call(this,o,s);let a=i.get(s);return n.call(this,o,a||s)}}_patchRemoveAllListeners(e,n){let r=this;return function(o){let s=r._getPatchMap(e);return s!==void 0&&(arguments.length===0?r._createPatchMap(e):s[o]!==void 0&&delete s[o]),n.apply(this,arguments)}}_patchAddListener(e,n,r){let o=this;return function(s,i){if(o._wrapped)return n.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let l=o.bind(r,i);c.set(i,l),o._wrapped=!0;try{return n.call(this,s,l)}finally{o._wrapped=!1}}}_createPatchMap(e){let n=Object.create(null);return e[this._kOtListeners]=n,n}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};Om.AbstractAsyncHooksContextManager=Wy});var Yj=E(bm=>{"use strict";Object.defineProperty(bm,"__esModule",{value:!0});bm.AsyncHooksContextManager=void 0;var Ile=(b(),N(v)),Nle=U("async_hooks"),Ole=zy(),Ky=class extends Ole.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=Nle.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??Ile.ROOT_CONTEXT}with(e,n,r,...o){this._enterContext(e);try{return n.call(r,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,n){if(n==="TIMERWRAP")return;let r=this._stack[this._stack.length-1];r!==void 0&&this._contexts.set(e,r)}_destroy(e){this._contexts.delete(e)}_before(e){let n=this._contexts.get(e);n!==void 0&&this._enterContext(n)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};bm.AsyncHooksContextManager=Ky});var Wj=E(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});Cm.AsyncLocalStorageContextManager=void 0;var ble=(b(),N(v)),Cle=U("async_hooks"),Ple=zy(),Qy=class extends Ple.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new Cle.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??ble.ROOT_CONTEXT}with(e,n,r,...o){let s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Cm.AsyncLocalStorageContextManager=Qy});var zj=E(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.AsyncLocalStorageContextManager=Hc.AsyncHooksContextManager=void 0;var Mle=Yj();Object.defineProperty(Hc,"AsyncHooksContextManager",{enumerable:!0,get:function(){return Mle.AsyncHooksContextManager}});var xle=Wj();Object.defineProperty(Hc,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return xle.AsyncLocalStorageContextManager}})});var Xy=E(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc._clearDefaultServiceNameCache=Vc.defaultServiceName=void 0;var Rp;function vle(){if(Rp===void 0)try{let t=globalThis.process.argv0;Rp=t?`unknown_service:${t}`:"unknown_service"}catch{Rp="unknown_service"}return Rp}Vc.defaultServiceName=vle;function Lle(){Rp=void 0}Vc._clearDefaultServiceNameCache=Lle});var Kj=E(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.isPromiseLike=void 0;var Dle=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";Pm.isPromiseLike=Dle});var eI=E(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.defaultResource=Jr.emptyResource=Jr.resourceFromDetectedResource=Jr.resourceFromAttributes=void 0;var Ip=(b(),N(v)),Jy=he(),Ji=(le(),N(Ae)),Ule=Xy(),yp=Kj(),Mm=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,n){let r=new t({},n);return r._rawAttributes=Qj(e),r._asyncAttributesPending=e.filter(([o,s])=>(0,yp.isPromiseLike)(s)).length>0,r}constructor(e,n){let r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([o,s])=>((0,yp.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=Qj(this._rawAttributes),this._schemaUrl=Ble(n?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,(0,yp.isPromiseLike)(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Ip.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,yp.isPromiseLike)(r)){Ip.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let n=jle(this,e),r=n?{schemaUrl:n}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r)}};function Zy(t,e){return Mm.FromAttributeList(Object.entries(t),e)}Jr.resourceFromAttributes=Zy;function wle(t,e){return new Mm(t,e)}Jr.resourceFromDetectedResource=wle;function kle(){return Zy({})}Jr.emptyResource=kle;function Gle(){return Zy({[Ji.ATTR_SERVICE_NAME]:(0,Ule.defaultServiceName)(),[Ji.ATTR_TELEMETRY_SDK_LANGUAGE]:Jy.SDK_INFO[Ji.ATTR_TELEMETRY_SDK_LANGUAGE],[Ji.ATTR_TELEMETRY_SDK_NAME]:Jy.SDK_INFO[Ji.ATTR_TELEMETRY_SDK_NAME],[Ji.ATTR_TELEMETRY_SDK_VERSION]:Jy.SDK_INFO[Ji.ATTR_TELEMETRY_SDK_VERSION]})}Jr.defaultResource=Gle;function Qj(t){return t.map(([e,n])=>(0,yp.isPromiseLike)(n)?[e,n.catch(r=>{Ip.diag.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}function Ble(t){if(typeof t=="string"||t===void 0)return t;Ip.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function jle(t,e){let n=t?.schemaUrl,r=e?.schemaUrl,o=n===void 0||n==="",s=r===void 0||r==="";if(o)return r;if(s||n===r)return n;Ip.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',n,r)}});var Jj=E(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.detectResources=void 0;var Xj=(b(),N(v)),tI=eI(),Hle=(t={})=>(t.detectors||[]).map(n=>{try{let r=(0,tI.resourceFromDetectedResource)(n.detect(t));return Xj.diag.debug(`${n.constructor.name} found resource.`,r),r}catch(r){return Xj.diag.debug(`${n.constructor.name} failed: ${r.message}`),(0,tI.emptyResource)()}}).reduce((n,r)=>n.merge(r),(0,tI.emptyResource)());xm.detectResources=Hle});var eH=E(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});vm.envDetector=void 0;var Vle=(b(),N(v)),Fle=(le(),N(Ae)),Zj=he(),nI=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){let n={},r=(0,Zj.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,Zj.getStringFromEnv)("OTEL_SERVICE_NAME");if(r)try{let s=this._parseResourceAttributes(r);Object.assign(n,s)}catch(s){Vle.diag.debug(`EnvDetector failed: ${s instanceof Error?s.message:s}`)}return o&&(n[Fle.ATTR_SERVICE_NAME]=o),{attributes:n}}_parseResourceAttributes(e){if(!e)return{};let n={},r=e.split(this._COMMA_SEPARATOR);for(let o of r){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER);if(s.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${o}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[i,a]=s,c=i.trim(),l=a.trim();if(c.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${o}".`);let p,d;try{p=decodeURIComponent(c),d=decodeURIComponent(l)}catch(_){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${o}": ${_ instanceof Error?_.message:_}`)}if(p.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${p}".`);if(d.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${p}".`);n[p]=d}return n}};vm.envDetector=new nI});var Np=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.ATTR_WEBENGINE_VERSION=L.ATTR_WEBENGINE_NAME=L.ATTR_WEBENGINE_DESCRIPTION=L.ATTR_SERVICE_NAMESPACE=L.ATTR_SERVICE_INSTANCE_ID=L.ATTR_PROCESS_RUNTIME_VERSION=L.ATTR_PROCESS_RUNTIME_NAME=L.ATTR_PROCESS_RUNTIME_DESCRIPTION=L.ATTR_PROCESS_PID=L.ATTR_PROCESS_OWNER=L.ATTR_PROCESS_EXECUTABLE_PATH=L.ATTR_PROCESS_EXECUTABLE_NAME=L.ATTR_PROCESS_COMMAND_ARGS=L.ATTR_PROCESS_COMMAND=L.ATTR_OS_VERSION=L.ATTR_OS_TYPE=L.ATTR_K8S_POD_NAME=L.ATTR_K8S_NAMESPACE_NAME=L.ATTR_K8S_DEPLOYMENT_NAME=L.ATTR_K8S_CLUSTER_NAME=L.ATTR_HOST_TYPE=L.ATTR_HOST_NAME=L.ATTR_HOST_IMAGE_VERSION=L.ATTR_HOST_IMAGE_NAME=L.ATTR_HOST_IMAGE_ID=L.ATTR_HOST_ID=L.ATTR_HOST_ARCH=L.ATTR_CONTAINER_NAME=L.ATTR_CONTAINER_IMAGE_TAGS=L.ATTR_CONTAINER_IMAGE_NAME=L.ATTR_CONTAINER_ID=L.ATTR_CLOUD_REGION=L.ATTR_CLOUD_PROVIDER=L.ATTR_CLOUD_AVAILABILITY_ZONE=L.ATTR_CLOUD_ACCOUNT_ID=void 0;L.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";L.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";L.ATTR_CLOUD_PROVIDER="cloud.provider";L.ATTR_CLOUD_REGION="cloud.region";L.ATTR_CONTAINER_ID="container.id";L.ATTR_CONTAINER_IMAGE_NAME="container.image.name";L.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";L.ATTR_CONTAINER_NAME="container.name";L.ATTR_HOST_ARCH="host.arch";L.ATTR_HOST_ID="host.id";L.ATTR_HOST_IMAGE_ID="host.image.id";L.ATTR_HOST_IMAGE_NAME="host.image.name";L.ATTR_HOST_IMAGE_VERSION="host.image.version";L.ATTR_HOST_NAME="host.name";L.ATTR_HOST_TYPE="host.type";L.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";L.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";L.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";L.ATTR_K8S_POD_NAME="k8s.pod.name";L.ATTR_OS_TYPE="os.type";L.ATTR_OS_VERSION="os.version";L.ATTR_PROCESS_COMMAND="process.command";L.ATTR_PROCESS_COMMAND_ARGS="process.command_args";L.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";L.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";L.ATTR_PROCESS_OWNER="process.owner";L.ATTR_PROCESS_PID="process.pid";L.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";L.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";L.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";L.ATTR_SERVICE_INSTANCE_ID="service.instance.id";L.ATTR_SERVICE_NAMESPACE="service.namespace";L.ATTR_WEBENGINE_DESCRIPTION="webengine.description";L.ATTR_WEBENGINE_NAME="webengine.name";L.ATTR_WEBENGINE_VERSION="webengine.version"});var Dm=E(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});Lm.execAsync=void 0;var qle=U("child_process"),$le=U("util");Lm.execAsync=$le.promisify(qle.exec)});var tH=E(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.getMachineId=void 0;var Yle=Dm(),Wle=(b(),N(v));async function zle(){try{let e=(await(0,Yle.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
7
|
+
`).find(r=>r.includes("IOPlatformUUID"));if(!e)return;let n=e.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){Wle.diag.debug(`error reading machine id: ${t}`)}}Um.getMachineId=zle});var nH=E(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.getMachineId=void 0;var Kle=U("fs"),Qle=(b(),N(v));async function Xle(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await Kle.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){Qle.diag.debug(`error reading machine id: ${n}`)}}wm.getMachineId=Xle});var oH=E(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.getMachineId=void 0;var Jle=U("fs"),Zle=Dm(),rH=(b(),N(v));async function epe(){try{return(await Jle.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){rH.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,Zle.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){rH.diag.debug(`error reading machine id: ${t}`)}}km.getMachineId=epe});var iH=E(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.getMachineId=void 0;var sH=U("process"),tpe=Dm(),npe=(b(),N(v));async function rpe(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";sH.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in sH.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,tpe.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){npe.diag.debug(`error reading machine id: ${n}`)}}Gm.getMachineId=rpe});var aH=E(Bm=>{"use strict";Object.defineProperty(Bm,"__esModule",{value:!0});Bm.getMachineId=void 0;var ope=(b(),N(v));async function spe(){ope.diag.debug("could not read machine-id: unsupported platform")}Bm.getMachineId=spe});var cH=E(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.getMachineId=void 0;var ipe=U("process"),Zi;async function ape(){if(!Zi)switch(ipe.platform){case"darwin":Zi=(await Promise.resolve().then(()=>K(tH()))).getMachineId;break;case"linux":Zi=(await Promise.resolve().then(()=>K(nH()))).getMachineId;break;case"freebsd":Zi=(await Promise.resolve().then(()=>K(oH()))).getMachineId;break;case"win32":Zi=(await Promise.resolve().then(()=>K(iH()))).getMachineId;break;default:Zi=(await Promise.resolve().then(()=>K(aH()))).getMachineId;break}return Zi()}jm.getMachineId=ape});var rI=E(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.normalizeType=Fc.normalizeArch=void 0;var cpe=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Fc.normalizeArch=cpe;var upe=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Fc.normalizeType=upe});var lH=E(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.hostDetector=void 0;var oI=Np(),uH=U("os"),lpe=cH(),ppe=rI(),sI=class{detect(e){return{attributes:{[oI.ATTR_HOST_NAME]:(0,uH.hostname)(),[oI.ATTR_HOST_ARCH]:(0,ppe.normalizeArch)((0,uH.arch)()),[oI.ATTR_HOST_ID]:(0,lpe.getMachineId)()}}}};Hm.hostDetector=new sI});var _H=E(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.osDetector=void 0;var pH=Np(),dH=U("os"),dpe=rI(),iI=class{detect(e){return{attributes:{[pH.ATTR_OS_TYPE]:(0,dpe.normalizeType)((0,dH.platform)()),[pH.ATTR_OS_VERSION]:(0,dH.release)()}}}};Vm.osDetector=new iI});var fH=E(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.processDetector=void 0;var _pe=(b(),N(v)),Go=Np(),fpe=U("os"),aI=class{detect(e){let n={[Go.ATTR_PROCESS_PID]:process.pid,[Go.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[Go.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[Go.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[Go.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[Go.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[Go.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(n[Go.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let r=fpe.userInfo();n[Go.ATTR_PROCESS_OWNER]=r.username}catch(r){_pe.diag.debug(`error obtaining process owner: ${r}`)}return{attributes:n}}};Fm.processDetector=new aI});var mH=E(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.serviceInstanceIdDetector=void 0;var mpe=Np(),Tpe=U("crypto"),cI=class{detect(e){return{attributes:{[mpe.ATTR_SERVICE_INSTANCE_ID]:(0,Tpe.randomUUID)()}}}};qm.serviceInstanceIdDetector=new cI});var TH=E(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.serviceInstanceIdDetector=Zr.processDetector=Zr.osDetector=Zr.hostDetector=void 0;var hpe=lH();Object.defineProperty(Zr,"hostDetector",{enumerable:!0,get:function(){return hpe.hostDetector}});var Epe=_H();Object.defineProperty(Zr,"osDetector",{enumerable:!0,get:function(){return Epe.osDetector}});var Spe=fH();Object.defineProperty(Zr,"processDetector",{enumerable:!0,get:function(){return Spe.processDetector}});var gpe=mH();Object.defineProperty(Zr,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return gpe.serviceInstanceIdDetector}})});var hH=E(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.serviceInstanceIdDetector=eo.processDetector=eo.osDetector=eo.hostDetector=void 0;var $m=TH();Object.defineProperty(eo,"hostDetector",{enumerable:!0,get:function(){return $m.hostDetector}});Object.defineProperty(eo,"osDetector",{enumerable:!0,get:function(){return $m.osDetector}});Object.defineProperty(eo,"processDetector",{enumerable:!0,get:function(){return $m.processDetector}});Object.defineProperty(eo,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return $m.serviceInstanceIdDetector}})});var EH=E(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.noopDetector=qc.NoopDetector=void 0;var Ym=class{detect(){return{attributes:{}}}};qc.NoopDetector=Ym;qc.noopDetector=new Ym});var SH=E(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.noopDetector=yn.serviceInstanceIdDetector=yn.processDetector=yn.osDetector=yn.hostDetector=yn.envDetector=void 0;var Ape=eH();Object.defineProperty(yn,"envDetector",{enumerable:!0,get:function(){return Ape.envDetector}});var Wm=hH();Object.defineProperty(yn,"hostDetector",{enumerable:!0,get:function(){return Wm.hostDetector}});Object.defineProperty(yn,"osDetector",{enumerable:!0,get:function(){return Wm.osDetector}});Object.defineProperty(yn,"processDetector",{enumerable:!0,get:function(){return Wm.processDetector}});Object.defineProperty(yn,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Wm.serviceInstanceIdDetector}});var Rpe=EH();Object.defineProperty(yn,"noopDetector",{enumerable:!0,get:function(){return Rpe.noopDetector}})});var lI=E(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.defaultServiceName=Ve.emptyResource=Ve.defaultResource=Ve.resourceFromAttributes=Ve.serviceInstanceIdDetector=Ve.processDetector=Ve.osDetector=Ve.hostDetector=Ve.envDetector=Ve.detectResources=void 0;var ype=Jj();Object.defineProperty(Ve,"detectResources",{enumerable:!0,get:function(){return ype.detectResources}});var Op=SH();Object.defineProperty(Ve,"envDetector",{enumerable:!0,get:function(){return Op.envDetector}});Object.defineProperty(Ve,"hostDetector",{enumerable:!0,get:function(){return Op.hostDetector}});Object.defineProperty(Ve,"osDetector",{enumerable:!0,get:function(){return Op.osDetector}});Object.defineProperty(Ve,"processDetector",{enumerable:!0,get:function(){return Op.processDetector}});Object.defineProperty(Ve,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Op.serviceInstanceIdDetector}});var uI=eI();Object.defineProperty(Ve,"resourceFromAttributes",{enumerable:!0,get:function(){return uI.resourceFromAttributes}});Object.defineProperty(Ve,"defaultResource",{enumerable:!0,get:function(){return uI.defaultResource}});Object.defineProperty(Ve,"emptyResource",{enumerable:!0,get:function(){return uI.emptyResource}});var Ipe=Xy();Object.defineProperty(Ve,"defaultServiceName",{enumerable:!0,get:function(){return Ipe.defaultServiceName}})});var gH=E(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.ExceptionEventName=void 0;zm.ExceptionEventName="exception"});var AH=E(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.SpanImpl=void 0;var Ut=(b(),N(v)),wt=he(),ea=(le(),N(Ae)),Npe=gH(),pI=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Ut.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let n=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=wt.otperformance.now(),this._performanceOffset=n-(this._performanceStartTime+wt.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let r of e.links)this.addLink(r);this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return Ut.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,wt.isAttributeValue)(n))return Ut.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:r}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&o?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),o&&this._attributesCount++,this)}setAttributes(e){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.setAttribute(n,e[n]);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return Ut.diag.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&Ut.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,wt.isTimeInput)(n)&&((0,wt.isTimeInput)(r)||(r=n),n=void 0);let s=(0,wt.sanitizeAttributes)(n),{attributePerEventCountLimit:i}=this._spanLimits,a={},c=0,l=0;for(let p in s){if(!Object.prototype.hasOwnProperty.call(s,p))continue;let d=s[p];if(i!==void 0&&l>=i){c++;continue}a[p]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(r),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:n}=this._spanLimits;if(n===0)return this._droppedLinksCount++,this;n!==void 0&&this.links.length>=n&&(this._droppedLinksCount===0&&Ut.diag.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,o=(0,wt.sanitizeAttributes)(e.attributes),s={},i=0,a=0;for(let l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;let p=o[l];if(r!==void 0&&a>=r){i++;continue}s[l]=this._truncateToSize(p),a++}let c={context:e.context};return a>0&&(c.attributes=s),i>0&&(c.droppedAttributesCount=i),this.links.push(c),this}addLinks(e){for(let n of e)this.addLink(n);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===Ut.SpanStatusCode.UNSET)return this;if(this.status.code===Ut.SpanStatusCode.OK)return this;let n={code:e.code};return e.code===Ut.SpanStatusCode.ERROR&&(typeof e.message=="string"?n.message=e.message:e.message!=null&&Ut.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=n,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){Ut.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,wt.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(Ut.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&Ut.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&Ut.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=wt.otperformance.now())return(0,wt.hrTime)(e+this._performanceOffset);if(typeof e=="number")return(0,wt.millisToHrTime)(e);if(e instanceof Date)return(0,wt.millisToHrTime)(e.getTime());if((0,wt.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,wt.millisToHrTime)(Date.now());let n=wt.otperformance.now()-this._performanceStartTime;return(0,wt.addHrTimes)(this.startTime,(0,wt.millisToHrTime)(n))}isRecording(){return this._ended===!1}recordException(e,n){let r={};typeof e=="string"?r[ea.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[ea.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[ea.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[ea.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[ea.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[ea.ATTR_EXCEPTION_TYPE]||r[ea.ATTR_EXCEPTION_MESSAGE]?this.addEvent(Npe.ExceptionEventName,r,n):Ut.diag.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Ut.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){let n=this._attributeValueLengthLimit;return n<=0?(Ut.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}};Km.SpanImpl=pI});var $c=E(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.SamplingDecision=void 0;var Ope;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Ope=bp.SamplingDecision||(bp.SamplingDecision={}))});var Xm=E(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.AlwaysOffSampler=void 0;var bpe=$c(),dI=class{shouldSample(){return{decision:bpe.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};Qm.AlwaysOffSampler=dI});var Zm=E(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.AlwaysOnSampler=void 0;var Cpe=$c(),_I=class{shouldSample(){return{decision:Cpe.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};Jm.AlwaysOnSampler=_I});var TI=E(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});tT.ParentBasedSampler=void 0;var eT=(b(),N(v)),Ppe=he(),RH=Xm(),fI=Zm(),mI=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||((0,Ppe.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new fI.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new fI.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new RH.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new fI.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new RH.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=eT.trace.getSpanContext(e);return!a||!(0,eT.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&eT.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&eT.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,n,r,o,s,i):this._localParentNotSampled.shouldSample(e,n,r,o,s,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};tT.ParentBasedSampler=mI});var EI=E(nT=>{"use strict";Object.defineProperty(nT,"__esModule",{value:!0});nT.TraceIdRatioBasedSampler=void 0;var Mpe=(b(),N(v)),yH=$c(),hI=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,Mpe.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?yH.SamplingDecision.RECORD_AND_SAMPLED:yH.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){let o=r*8,s=parseInt(e.slice(o,o+8),16);n=(n^s)>>>0}return n}};nT.TraceIdRatioBasedSampler=hI});var AI=E(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.buildSamplerFromEnv=Yc.loadDefaultConfig=void 0;var gI=(b(),N(v)),to=he(),IH=Xm(),SI=Zm(),rT=TI(),NH=EI(),no;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(no||(no={}));var oT=1;function xpe(){return{sampler:bH(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,to.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,to.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,to.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,to.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,to.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,to.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,to.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,to.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}Yc.loadDefaultConfig=xpe;function bH(){let t=(0,to.getStringFromEnv)("OTEL_TRACES_SAMPLER")??no.ParentBasedAlwaysOn;switch(t){case no.AlwaysOn:return new SI.AlwaysOnSampler;case no.AlwaysOff:return new IH.AlwaysOffSampler;case no.ParentBasedAlwaysOn:return new rT.ParentBasedSampler({root:new SI.AlwaysOnSampler});case no.ParentBasedAlwaysOff:return new rT.ParentBasedSampler({root:new IH.AlwaysOffSampler});case no.TraceIdRatio:return new NH.TraceIdRatioBasedSampler(OH());case no.ParentBasedTraceIdRatio:return new rT.ParentBasedSampler({root:new NH.TraceIdRatioBasedSampler(OH())});default:return gI.diag.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${no.ParentBasedAlwaysOn}".`),new rT.ParentBasedSampler({root:new SI.AlwaysOnSampler})}}Yc.buildSamplerFromEnv=bH;function OH(){let t=(0,to.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");return t==null?(gI.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${oT}.`),oT):t<0||t>1?(gI.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${oT}.`),oT):t}});var RI=E(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.reconfigureLimits=or.mergeConfig=or.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=or.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var CH=AI(),sT=he();or.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;or.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function vpe(t){let e={sampler:(0,CH.buildSamplerFromEnv)()},n=(0,CH.loadDefaultConfig)(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}or.mergeConfig=vpe;function Lpe(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??(0,sT.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,sT.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??or.DEFAULT_ATTRIBUTE_COUNT_LIMIT,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??(0,sT.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,sT.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??or.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},t,{spanLimits:e})}or.reconfigureLimits=Lpe});var PH=E(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});iT.BatchSpanProcessorBase=void 0;var Wc=(b(),N(v)),Bo=he(),yI=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:(0,Bo.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:(0,Bo.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:(0,Bo.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:(0,Bo.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Bo.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Wc.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,n){}onEnd(e){this._shutdownOnce.isCalled||e.spanContext().traceFlags&Wc.TraceFlags.SAMPLED&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&Wc.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(Wc.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{let r=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,i=o;s<i;s++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{let r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);Wc.context.with((0,Bo.suppressTracing)(Wc.context.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(o,a=>{clearTimeout(r),a.code===Bo.ExportResultCode.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))}),i=null;for(let a=0,c=o.length;a<c;a++){let l=o[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?s():Promise.all(i).then(s,a=>{(0,Bo.globalErrorHandler)(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,Bo.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};iT.BatchSpanProcessorBase=yI});var MH=E(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.BatchSpanProcessor=void 0;var Dpe=PH(),II=class extends Dpe.BatchSpanProcessorBase{onShutdown(){}};aT.BatchSpanProcessor=II});var LH=E(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});uT.RandomIdGenerator=void 0;var Upe=8,vH=16,NI=class{generateTraceId=xH(vH);generateSpanId=xH(Upe)};uT.RandomIdGenerator=NI;var cT=Buffer.allocUnsafe(vH);function xH(t){return function(){for(let n=0;n<t/4;n++)cT.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(cT[n]>0);n++)n===t-1&&(cT[t-1]=1);return cT.toString("hex",0,t)}}});var DH=E(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.RandomIdGenerator=zc.BatchSpanProcessor=void 0;var wpe=MH();Object.defineProperty(zc,"BatchSpanProcessor",{enumerable:!0,get:function(){return wpe.BatchSpanProcessor}});var kpe=LH();Object.defineProperty(zc,"RandomIdGenerator",{enumerable:!0,get:function(){return kpe.RandomIdGenerator}})});var OI=E(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.RandomIdGenerator=Kc.BatchSpanProcessor=void 0;var UH=DH();Object.defineProperty(Kc,"BatchSpanProcessor",{enumerable:!0,get:function(){return UH.BatchSpanProcessor}});Object.defineProperty(Kc,"RandomIdGenerator",{enumerable:!0,get:function(){return UH.RandomIdGenerator}})});var wH=E(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.METRIC_OTEL_SDK_SPAN_STARTED=ro.METRIC_OTEL_SDK_SPAN_LIVE=ro.ATTR_OTEL_SPAN_SAMPLING_RESULT=ro.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;ro.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";ro.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";ro.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";ro.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var kH=E(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});pT.TracerMetrics=void 0;var lT=$c(),Cp=wH(),bI=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Cp.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(Cp.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,n){let r=Bpe(n);if(this.startedSpans.add(1,{[Cp.ATTR_OTEL_SPAN_PARENT_ORIGIN]:Gpe(e),[Cp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r}),n===lT.SamplingDecision.NOT_RECORD)return()=>{};let o={[Cp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};pT.TracerMetrics=bI;function Gpe(t){return t?t.isRemote?"remote":"local":"none"}function Bpe(t){switch(t){case lT.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case lT.SamplingDecision.RECORD:return"RECORD_ONLY";case lT.SamplingDecision.NOT_RECORD:return"DROP"}}});var GH=E(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});dT.VERSION=void 0;dT.VERSION="2.6.1"});var BH=E(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});fT.Tracer=void 0;var Nt=(b(),N(v)),_T=he(),jpe=AH(),Hpe=RI(),Vpe=OI(),Fpe=kH(),qpe=GH(),CI=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,n,r,o){let s=(0,Hpe.mergeConfig)(n);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=n.idGenerator||new Vpe.RandomIdGenerator,this._resource=r,this._spanProcessor=o,this.instrumentationScope=e;let i=s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace",qpe.VERSION):Nt.createNoopMeter();this._tracerMetrics=new Fpe.TracerMetrics(i)}startSpan(e,n={},r=Nt.context.active()){n.root&&(r=Nt.trace.deleteSpan(r));let o=Nt.trace.getSpan(r);if((0,_T.isTracingSuppressed)(r))return Nt.diag.debug("Instrumentation suppressed, returning Noop Span"),Nt.trace.wrapSpanContext(Nt.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),i=this._idGenerator.generateSpanId(),a,c,l;!s||!Nt.trace.isSpanContextValid(s)?c=this._idGenerator.generateTraceId():(c=s.traceId,l=s.traceState,a=s);let p=n.kind??Nt.SpanKind.INTERNAL,d=(n.links??[]).map(I=>({context:I.context,attributes:(0,_T.sanitizeAttributes)(I.attributes)})),_=(0,_T.sanitizeAttributes)(n.attributes),f=this._sampler.shouldSample(r,c,e,p,_,d),m=this._tracerMetrics.startSpan(s,f.decision);l=f.traceState??l;let T=f.decision===Nt.SamplingDecision.RECORD_AND_SAMPLED?Nt.TraceFlags.SAMPLED:Nt.TraceFlags.NONE,h={traceId:c,spanId:i,traceFlags:T,traceState:l};if(f.decision===Nt.SamplingDecision.NOT_RECORD)return Nt.diag.debug("Recording is off, propagating context in a non-recording span"),Nt.trace.wrapSpanContext(h);let S=(0,_T.sanitizeAttributes)(Object.assign(_,f.attributes));return new jpe.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:h,name:e,kind:p,links:d,parentSpanContext:a,attributes:S,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Nt.context.active(),l=this.startSpan(e,s,c),p=Nt.trace.setSpan(c,l);return Nt.context.with(p,a,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};fT.Tracer=CI});var jH=E(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});mT.MultiSpanProcessor=void 0;var $pe=he(),PI=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{(0,$pe.globalErrorHandler)(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(let r of this._spanProcessors)r.onStart(e,n)}onEnding(e){for(let n of this._spanProcessors)n.onEnding&&n.onEnding(e)}onEnd(e){for(let n of this._spanProcessors)n.onEnd(e)}shutdown(){let e=[];for(let n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}};mT.MultiSpanProcessor=PI});var HH=E(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.BasicTracerProvider=ta.ForceFlushState=void 0;var Ype=he(),Wpe=lI(),zpe=BH(),Kpe=AI(),Qpe=jH(),Xpe=RI(),Qc;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(Qc=ta.ForceFlushState||(ta.ForceFlushState={}));var MI=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let n=(0,Ype.merge)({},(0,Kpe.loadDefaultConfig)(),(0,Xpe.reconfigureLimits)(e));this._resource=n.resource??(0,Wpe.defaultResource)(),this._config=Object.assign({},n,{resource:this._resource});let r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new Qpe.MultiSpanProcessor(r)}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new zpe.Tracer({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(o=>{let s,i=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${e} ms`)),s=Qc.timeout},e);r.forceFlush().then(()=>{clearTimeout(i),s!==Qc.timeout&&(s=Qc.resolved,o(s))}).catch(a=>{clearTimeout(i),s=Qc.error,o(a)})}));return new Promise((r,o)=>{Promise.all(n).then(s=>{let i=s.filter(a=>a!==Qc.resolved);i.length>0?o(i):r()}).catch(s=>o([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};ta.BasicTracerProvider=MI});var VH=E(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.ConsoleSpanExporter=void 0;var xI=he(),vI=class{export(e,n){return this._sendSpans(e,n)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,xI.hrTimeToMicroseconds)(e.startTime),duration:(0,xI.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let r of e)console.dir(this._exportInfo(r),{depth:3});if(n)return n({code:xI.ExportResultCode.SUCCESS})}};TT.ConsoleSpanExporter=vI});var qH=E(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.InMemorySpanExporter=void 0;var FH=he(),LI=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:FH.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:FH.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};hT.InMemorySpanExporter=LI});var $H=E(ST=>{"use strict";Object.defineProperty(ST,"__esModule",{value:!0});ST.SimpleSpanProcessor=void 0;var Jpe=(b(),N(v)),ET=he(),DI=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new ET.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,n){}onEnd(e){if(this._shutdownOnce.isCalled||!(e.spanContext().traceFlags&Jpe.TraceFlags.SAMPLED))return;let n=this._doExport(e).catch(r=>(0,ET.globalErrorHandler)(r));this._pendingExports.add(n),n.finally(()=>this._pendingExports.delete(n))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let n=await ET.internal._export(this._exporter,[e]);if(n.code!==ET.ExportResultCode.SUCCESS)throw n.error??new Error(`SimpleSpanProcessor: span export failed (status ${n})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};ST.SimpleSpanProcessor=DI});var YH=E(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});gT.NoopSpanProcessor=void 0;var UI=class{onStart(e,n){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};gT.NoopSpanProcessor=UI});var wI=E(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.SamplingDecision=Ce.TraceIdRatioBasedSampler=Ce.ParentBasedSampler=Ce.AlwaysOnSampler=Ce.AlwaysOffSampler=Ce.NoopSpanProcessor=Ce.SimpleSpanProcessor=Ce.InMemorySpanExporter=Ce.ConsoleSpanExporter=Ce.RandomIdGenerator=Ce.BatchSpanProcessor=Ce.BasicTracerProvider=void 0;var Zpe=HH();Object.defineProperty(Ce,"BasicTracerProvider",{enumerable:!0,get:function(){return Zpe.BasicTracerProvider}});var WH=OI();Object.defineProperty(Ce,"BatchSpanProcessor",{enumerable:!0,get:function(){return WH.BatchSpanProcessor}});Object.defineProperty(Ce,"RandomIdGenerator",{enumerable:!0,get:function(){return WH.RandomIdGenerator}});var ede=VH();Object.defineProperty(Ce,"ConsoleSpanExporter",{enumerable:!0,get:function(){return ede.ConsoleSpanExporter}});var tde=qH();Object.defineProperty(Ce,"InMemorySpanExporter",{enumerable:!0,get:function(){return tde.InMemorySpanExporter}});var nde=$H();Object.defineProperty(Ce,"SimpleSpanProcessor",{enumerable:!0,get:function(){return nde.SimpleSpanProcessor}});var rde=YH();Object.defineProperty(Ce,"NoopSpanProcessor",{enumerable:!0,get:function(){return rde.NoopSpanProcessor}});var ode=Xm();Object.defineProperty(Ce,"AlwaysOffSampler",{enumerable:!0,get:function(){return ode.AlwaysOffSampler}});var sde=Zm();Object.defineProperty(Ce,"AlwaysOnSampler",{enumerable:!0,get:function(){return sde.AlwaysOnSampler}});var ide=TI();Object.defineProperty(Ce,"ParentBasedSampler",{enumerable:!0,get:function(){return ide.ParentBasedSampler}});var ade=EI();Object.defineProperty(Ce,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return ade.TraceIdRatioBasedSampler}});var cde=$c();Object.defineProperty(Ce,"SamplingDecision",{enumerable:!0,get:function(){return cde.SamplingDecision}})});var gF=E(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.PACKAGE_NAME=tu.PACKAGE_VERSION=void 0;tu.PACKAGE_VERSION="0.24.0";tu.PACKAGE_NAME="@opentelemetry/instrumentation-undici"});var RF=E(UT=>{"use strict";Object.defineProperty(UT,"__esModule",{value:!0});UT.UndiciInstrumentation=void 0;var lN=U("diagnostics_channel"),xfe=U("url"),kp=ne(),Vn=(b(),N(v)),DT=he(),ot=(le(),N(Ae)),AF=gF(),pN=class extends kp.InstrumentationBase{_recordFromReq=new WeakMap;constructor(e={}){super(AF.PACKAGE_NAME,AF.PACKAGE_VERSION,e)}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs.length=0}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this.subscribeToChannel("undici:request:create",this.onRequestCreated.bind(this)),this.subscribeToChannel("undici:client:sendHeaders",this.onRequestHeaders.bind(this)),this.subscribeToChannel("undici:request:headers",this.onResponseHeaders.bind(this)),this.subscribeToChannel("undici:request:trailers",this.onDone.bind(this)),this.subscribeToChannel("undici:request:error",this.onError.bind(this)))}_updateMetricInstruments(){this._httpClientDurationHistogram=this.meter.createHistogram(ot.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Measures the duration of outbound HTTP requests.",unit:"s",valueType:Vn.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,n){let[r,o]=process.version.replace("v","").split(".").map(a=>Number(a)),s=r>18||r===18&&o>=19,i;if(s)lN.subscribe?.(e,n),i=()=>lN.unsubscribe?.(e,n);else{let a=lN.channel(e);a.subscribe(n),i=()=>a.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:i})}parseRequestHeaders(e){let n=new Map;if(Array.isArray(e.headers))for(let r=0;r<e.headers.length;r+=2){let o=e.headers[r],s=e.headers[r+1];typeof o=="string"&&n.set(o.toLowerCase(),s)}else if(typeof e.headers=="string"){let r=e.headers.split(`\r
|
|
8
|
+
`);for(let o of r){if(!o)continue;let s=o.indexOf(":");if(s===-1)continue;let i=o.substring(0,s).toLowerCase(),a=o.substring(s+1).trim(),c=n.get(i);c&&Array.isArray(c)?c.push(a):c?n.set(i,[c,a]):n.set(i,a)}}return n}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0,kp.safeExecuteInTheMiddle)(()=>!r||e.method==="CONNECT"||n.ignoreRequestHook?.(e),B=>B&&this._diag.error("caught ignoreRequestHook error: ",B),!0))return;let s=(0,DT.hrTime)(),i;try{i=new xfe.URL(e.path,e.origin)}catch(B){this._diag.warn("could not determine url.full:",B);return}let a=i.protocol.replace(":",""),c=this.getRequestMethod(e.method),l={[ot.ATTR_HTTP_REQUEST_METHOD]:c,[ot.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]:e.method,[ot.ATTR_URL_FULL]:i.toString(),[ot.ATTR_URL_PATH]:i.pathname,[ot.ATTR_URL_QUERY]:i.search,[ot.ATTR_URL_SCHEME]:a},p={https:"443",http:"80"},d=i.hostname,_=i.port||p[a];l[ot.ATTR_SERVER_ADDRESS]=d,_&&!isNaN(Number(_))&&(l[ot.ATTR_SERVER_PORT]=Number(_));let m=this.parseRequestHeaders(e).get("user-agent");if(m){let B=Array.isArray(m)?m[m.length-1]:m;l[ot.ATTR_USER_AGENT_ORIGINAL]=B}let T=(0,kp.safeExecuteInTheMiddle)(()=>n.startSpanHook?.(e),B=>B&&this._diag.error("caught startSpanHook error: ",B),!0);T&&Object.entries(T).forEach(([B,se])=>{l[B]=se});let h=Vn.context.active(),S=Vn.trace.getSpan(h),R;n.requireParentforSpans&&(!S||!Vn.trace.isSpanContextValid(S.spanContext()))?R=Vn.trace.wrapSpanContext(Vn.INVALID_SPAN_CONTEXT):R=this.tracer.startSpan(c==="_OTHER"?"HTTP":c,{kind:Vn.SpanKind.CLIENT,attributes:l},h),(0,kp.safeExecuteInTheMiddle)(()=>n.requestHook?.(R,e),B=>B&&this._diag.error("caught requestHook error: ",B),!0);let I=Vn.trace.setSpan(Vn.context.active(),R),x={};Vn.propagation.inject(I,x);let V=Object.entries(x);for(let B=0;B<V.length;B++){let[se,ve]=V[B];typeof e.addHeader=="function"?e.addHeader(se,ve):typeof e.headers=="string"?e.headers+=`${se}: ${ve}\r
|
|
9
|
+
`:Array.isArray(e.headers)&&e.headers.push(se,ve)}this._recordFromReq.set(e,{span:R,attributes:l,startTime:s})}onRequestHeaders({request:e,socket:n}){let r=this._recordFromReq.get(e);if(!r)return;let o=this.getConfig(),{span:s}=r,{remoteAddress:i,remotePort:a}=n,c={[ot.ATTR_NETWORK_PEER_ADDRESS]:i,[ot.ATTR_NETWORK_PEER_PORT]:a};if(o.headersToSpanAttributes?.requestHeaders){let l=new Set(o.headersToSpanAttributes.requestHeaders.map(d=>d.toLowerCase())),p=this.parseRequestHeaders(e);for(let[d,_]of p.entries())if(l.has(d)){let f=Array.isArray(_)?_:[_];c[`http.request.header.${d}`]=f}}s.setAttributes(c)}onResponseHeaders({request:e,response:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s}=r,i={[ot.ATTR_HTTP_RESPONSE_STATUS_CODE]:n.statusCode},a=this.getConfig();if((0,kp.safeExecuteInTheMiddle)(()=>a.responseHook?.(o,{request:e,response:n}),c=>c&&this._diag.error("caught responseHook error: ",c),!0),a.headersToSpanAttributes?.responseHeaders){let c=new Set;a.headersToSpanAttributes?.responseHeaders.forEach(l=>c.add(l.toLowerCase()));for(let l=0;l<n.headers.length;l=l+2){let p=n.headers[l].toString().toLowerCase(),d=n.headers[l+1];if(c.has(p)){let _=`http.response.header.${p}`;Object.hasOwn(i,_)?i[_].push(d.toString()):i[_]=[d.toString()]}}}o.setAttributes(i),o.setStatus({code:n.statusCode>=400?Vn.SpanStatusCode.ERROR:Vn.SpanStatusCode.UNSET}),r.attributes=Object.assign(s,i)}onDone({request:e}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:o,startTime:s}=n;r.end(),this._recordFromReq.delete(e),this.recordRequestDuration(o,s)}onError({request:e,error:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s,startTime:i}=r;o.recordException(n),o.setStatus({code:Vn.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[ot.ATTR_ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[ot.ATTR_HTTP_RESPONSE_STATUS_CODE,ot.ATTR_HTTP_REQUEST_METHOD,ot.ATTR_SERVER_ADDRESS,ot.ATTR_SERVER_PORT,ot.ATTR_URL_SCHEME,ot.ATTR_ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,DT.hrTimeToMilliseconds)((0,DT.hrTimeDuration)(n,(0,DT.hrTime)()))/1e3;this._httpClientDurationHistogram.record(s,r)}getRequestMethod(e){let n={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};UT.UndiciInstrumentation=pN});var yF=E(wT=>{"use strict";Object.defineProperty(wT,"__esModule",{value:!0});wT.UndiciInstrumentation=void 0;var vfe=RF();Object.defineProperty(wT,"UndiciInstrumentation",{enumerable:!0,get:function(){return vfe.UndiciInstrumentation}})});var kT=E(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});Gp.ExpressLayerType=void 0;var Gfe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Gfe=Gp.ExpressLayerType||(Gp.ExpressLayerType={}))});var GT=E(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});Bp.AttributeNames=void 0;var Bfe;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(Bfe=Bp.AttributeNames||(Bp.AttributeNames={}))});var dN=E(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu._LAYERS_STORE_PROPERTY=nu.kLayerPatched=void 0;nu.kLayerPatched=Symbol("express-layer-patched");nu._LAYERS_STORE_PROPERTY="__ot_middlewares"});var MF=E(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getActualMatchedRoute=st.getConstructedRoute=st.getLayerPath=st.asErrorAndMessage=st.isLayerIgnored=st.getLayerMetadata=st.getRouterPath=st.storeLayerPath=void 0;var _N=kT(),ru=GT(),na=dN(),jfe=(t,e)=>(Array.isArray(t[na._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,na._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e===void 0?{isLayerPathStored:!1}:(t[na._LAYERS_STORE_PROPERTY].push(e),{isLayerPathStored:!0}));st.storeLayerPath=jfe;var Hfe=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?(0,st.getRouterPath)(t,n):t};st.getRouterPath=Hfe;var Vfe=(t,e,n)=>{if(e.name==="router"){let r=(0,st.getRouterPath)("",e),o=r||n||t||"/";return{attributes:{[ru.AttributeNames.EXPRESS_NAME]:o,[ru.AttributeNames.EXPRESS_TYPE]:_N.ExpressLayerType.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[ru.AttributeNames.EXPRESS_NAME]:(t||n)??"request handler",[ru.AttributeNames.EXPRESS_TYPE]:_N.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[ru.AttributeNames.EXPRESS_NAME]:e.name,[ru.AttributeNames.EXPRESS_TYPE]:_N.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};st.getLayerMetadata=Vfe;var Ffe=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")},qfe=(t,e,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(e))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let r of n.ignoreLayers)if(Ffe(t,r))return!0}catch{}return!1};st.isLayerIgnored=qfe;var $fe=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];st.asErrorAndMessage=$fe;var Yfe=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>CF(n)||"").join(","):CF(e)};st.getLayerPath=Yfe;var CF=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};function PF(t){let n=(Array.isArray(t[na._LAYERS_STORE_PROPERTY])?t[na._LAYERS_STORE_PROPERTY]:[]).filter(r=>r!=="/"&&r!=="/*");return n.length===1&&n[0]==="*"?"*":n.join("").replace(/\/{2,}/g,"/")}st.getConstructedRoute=PF;function Wfe(t){let e=Array.isArray(t[na._LAYERS_STORE_PROPERTY])?t[na._LAYERS_STORE_PROPERTY]:[];if(e.length===0)return;if(e.every(s=>s==="/"))return t.originalUrl==="/"?"/":void 0;let n=PF(t);if(n==="*"||n.includes("/")&&(n.includes(",")||n.includes("\\")||n.includes("*")||n.includes("[")))return n;let r=n.startsWith("/")?n:`/${n}`;return r.length>0&&(t.originalUrl===r||t.originalUrl.startsWith(r)||zfe(r))?r:void 0}st.getActualMatchedRoute=Wfe;function zfe(t){return t.includes(":")||t.includes("*")}});var xF=E(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.PACKAGE_NAME=ou.PACKAGE_VERSION=void 0;ou.PACKAGE_VERSION="0.62.0";ou.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var wF=E(jT=>{"use strict";Object.defineProperty(jT,"__esModule",{value:!0});jT.ExpressInstrumentation=void 0;var vF=he(),In=(b(),N(v)),LF=kT(),DF=GT(),io=MF(),UF=xF(),su=ne(),Kfe=(le(),N(Ae)),BT=dN(),fN=class extends su.InstrumentationBase{constructor(e={}){super(UF.PACKAGE_NAME,UF.PACKAGE_VERSION,e)}init(){return[new su.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <6"],e=>{let n=typeof e?.Router?.prototype?.route=="function",r=n?e.Router.prototype:e.Router;return(0,su.isWrapped)(r.route)&&this._unwrap(r,"route"),this._wrap(r,"route",this._getRoutePatch()),(0,su.isWrapped)(r.use)&&this._unwrap(r,"use"),this._wrap(r,"use",this._getRouterUsePatch()),(0,su.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch(n)),e},e=>{if(e===void 0)return;let r=typeof e?.Router?.prototype?.route=="function"?e.Router.prototype:e.Router;this._unwrap(r,"route"),this._unwrap(r,"use"),this._unwrap(e.application,"use")})]}_getRoutePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,io.getLayerPath)(o)),s}}}_getRouterUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,io.getLayerPath)(o)),s}}}_getAppUsePatch(e){let n=this;return function(r){return function(...s){let i=e?this.router:this._router,a=r.apply(this,s);if(i){let c=i.stack[i.stack.length-1];n._applyPatch(c,(0,io.getLayerPath)(s))}return a}}}_applyPatch(e,n){let r=this;e[BT.kLayerPatched]!==!0&&(e[BT.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){let{isLayerPathStored:c}=(0,io.storeLayerPath)(i,n),l=(0,io.getConstructedRoute)(i),p=(0,io.getActualMatchedRoute)(i),d={[Kfe.ATTR_HTTP_ROUTE]:p},_=(0,io.getLayerMetadata)(l,e,n),f=_.attributes[DF.AttributeNames.EXPRESS_TYPE],m=(0,vF.getRPCMetadata)(In.context.active());if(m?.type===vF.RPCType.HTTP&&(m.route=p),(0,io.isLayerIgnored)(_.name,f,r.getConfig()))return f===LF.ExpressLayerType.MIDDLEWARE&&i[BT._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(In.trace.getSpan(In.context.active())===void 0)return o.apply(this,arguments);let T=r._getSpanName({request:i,layerType:f,route:l},_.name),h=r.tracer.startSpan(T,{attributes:Object.assign(d,_.attributes)}),S=In.context.active(),R=In.trace.setSpan(S,h),{requestHook:I}=r.getConfig();I&&(0,su.safeExecuteInTheMiddle)(()=>I(h,{request:i,layerType:f,route:l}),ve=>{ve&&In.diag.error("express instrumentation: request hook failed",ve)},!0);let x=!1;_.attributes[DF.AttributeNames.EXPRESS_TYPE]===LF.ExpressLayerType.ROUTER&&(h.end(),x=!0,R=S);let V=()=>{x===!1&&(x=!0,h.end())},B=Array.from(arguments),se=B.findIndex(ve=>typeof ve=="function");se>=0&&(arguments[se]=function(){let ve=arguments[0],nn=![void 0,null,"route","router"].includes(ve);if(!x&&nn){let[ka,Ga]=(0,io.asErrorAndMessage)(ve);h.recordException(ka),h.setStatus({code:In.SpanStatusCode.ERROR,message:Ga})}x===!1&&(x=!0,i.res?.removeListener("finish",V),h.end()),!(i.route&&nn)&&c&&i[BT._LAYERS_STORE_PROPERTY].pop();let Ao=B[se],es=In.context.active(),Ti=In.trace.getSpan(S),ht=Ti?In.trace.setSpan(es,Ti):es;return In.context.bind(ht,Ao).apply(this,arguments)});try{return In.context.bind(R,o).apply(this,arguments)}catch(ve){let[nn,Ao]=(0,io.asErrorAndMessage)(ve);throw h.recordException(nn),h.setStatus({code:In.SpanStatusCode.ERROR,message:Ao}),ve}finally{x||a.once("finish",V)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){let{spanNameHook:r}=this.getConfig();if(!(r instanceof Function))return n;try{return r(e,n)??n}catch(o){return In.diag.error("express instrumentation: error calling span name rewrite hook",o),n}}};jT.ExpressInstrumentation=fN});var kF=E(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.AttributeNames=ws.ExpressLayerType=ws.ExpressInstrumentation=void 0;var Qfe=wF();Object.defineProperty(ws,"ExpressInstrumentation",{enumerable:!0,get:function(){return Qfe.ExpressInstrumentation}});var Xfe=kT();Object.defineProperty(ws,"ExpressLayerType",{enumerable:!0,get:function(){return Xfe.ExpressLayerType}});var Jfe=GT();Object.defineProperty(ws,"AttributeNames",{enumerable:!0,get:function(){return Jfe.AttributeNames}})});var VF=E(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.SeverityNumber=void 0;var nme;(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"})(nme=jp.SeverityNumber||(jp.SeverityNumber={}))});var FT=E(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.NOOP_LOGGER=iu.NoopLogger=void 0;var VT=class{emit(e){}};iu.NoopLogger=VT;iu.NOOP_LOGGER=new VT});var FF=E(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.API_BACKWARDS_COMPATIBILITY_VERSION=ao.makeGetter=ao._global=ao.GLOBAL_LOGS_API_KEY=void 0;ao.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");ao._global=globalThis;function rme(t,e,n){return r=>r===t?e:n}ao.makeGetter=rme;ao.API_BACKWARDS_COMPATIBILITY_VERSION=1});var mN=E(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.NOOP_LOGGER_PROVIDER=au.NoopLoggerProvider=void 0;var ome=FT(),qT=class{getLogger(e,n,r){return new ome.NoopLogger}};au.NoopLoggerProvider=qT;au.NOOP_LOGGER_PROVIDER=new qT});var qF=E($T=>{"use strict";Object.defineProperty($T,"__esModule",{value:!0});$T.ProxyLogger=void 0;var sme=FT(),TN=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):sme.NOOP_LOGGER}};$T.ProxyLogger=TN});var $F=E(YT=>{"use strict";Object.defineProperty(YT,"__esModule",{value:!0});YT.ProxyLoggerProvider=void 0;var ime=mN(),ame=qF(),hN=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new ame.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:ime.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)}};YT.ProxyLoggerProvider=hN});var WF=E(WT=>{"use strict";Object.defineProperty(WT,"__esModule",{value:!0});WT.LogsAPI=void 0;var sr=FF(),cme=mN(),YF=$F(),EN=class t{constructor(){this._proxyLoggerProvider=new YF.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return sr._global[sr.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(sr._global[sr.GLOBAL_LOGS_API_KEY]=(0,sr.makeGetter)(sr.API_BACKWARDS_COMPATIBILITY_VERSION,e,cme.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=sr._global[sr.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(sr._global,sr.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete sr._global[sr.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new YF.ProxyLoggerProvider}};WT.LogsAPI=EN});var SN=E(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.logs=co.NoopLogger=co.NOOP_LOGGER=co.SeverityNumber=void 0;var ume=VF();Object.defineProperty(co,"SeverityNumber",{enumerable:!0,get:function(){return ume.SeverityNumber}});var zF=FT();Object.defineProperty(co,"NOOP_LOGGER",{enumerable:!0,get:function(){return zF.NOOP_LOGGER}});Object.defineProperty(co,"NoopLogger",{enumerable:!0,get:function(){return zF.NoopLogger}});var lme=WF();co.logs=lme.LogsAPI.getInstance()});var KF=E(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.disableInstrumentations=cu.enableInstrumentations=void 0;function pme(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()}}cu.enableInstrumentations=pme;function dme(t){t.forEach(e=>e.disable())}cu.disableInstrumentations=dme});var JF=E(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});zT.registerInstrumentations=void 0;var QF=(b(),N(v)),_me=SN(),XF=KF();function fme(t){let e=t.tracerProvider||QF.trace.getTracerProvider(),n=t.meterProvider||QF.metrics.getMeterProvider(),r=t.loggerProvider||_me.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,XF.enableInstrumentations)(o,e,n,r),()=>{(0,XF.disableInstrumentations)(o)}}zT.registerInstrumentations=fme});var aq=E(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0});KT.satisfies=void 0;var yN=(b(),N(v)),rq=/^(?: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-]+)*))?$/,mme=/^(?<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-]+)*))?$/,Tme={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function hme(t,e,n){if(!Eme(t))return yN.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Rme(t);if(!r)return!1;let o=[],s=oq(r,e,o,n);return s&&!n?.includePrerelease?gme(r,o):s}KT.satisfies=hme;function Eme(t){return typeof t=="string"&&rq.test(t)}function oq(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(gN(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=Fme(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!gN(t,s,n,r))return!1;return!0}return gN(t,e,n,r)}function gN(t,e,n,r){if(e=Ame(e,r),e.includes(" "))return oq(t,e,n,r);{let o=yme(e);return n.push(o),Sme(t,o)}}function Sme(t,e){if(e.invalid)return!1;if(!e.version||RN(e.version))return!0;let n=eq(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=eq(r,o)}return Tme[e.op]?.includes(n)}function gme(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function Ame(t,e){return t=t.trim(),t=Hme(t,e),t=jme(t),t=Vme(t,e),t=t.trim(),t}function pn(t){return!t||t.toLowerCase()==="x"||t==="*"}function Rme(t){let e=t.match(rq);if(!e){yN.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 yme(t){if(!t)return{};let e=t.match(mme);if(!e)return yN.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 RN(t){return t==="*"||t==="x"||t==="X"}function ZF(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Ime(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 Nme(t,e){if(RN(t)||RN(e))return 0;let[n,r]=Ime(ZF(t),ZF(e));return n>r?1:n<r?-1:0}function eq(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Nme(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var sq="[a-zA-Z0-9-]",iq="0|[1-9]\\d*",Ome=`\\d*[a-zA-Z-]${sq}*`,bme="((?:<|>)?=?)",tq=`(?:${iq}|${Ome})`,Cme=`(?:-(${tq}(?:\\.${tq})*))`,nq=`${sq}+`,Pme=`(?:\\+(${nq}(?:\\.${nq})*))`,AN=`${iq}|x|X|\\*`,Hp=`[v=\\s]*(${AN})(?:\\.(${AN})(?:\\.(${AN})(?:${Cme})?${Pme}?)?)?`,Mme=`^${bme}\\s*${Hp}$`,xme=new RegExp(Mme),vme=`^\\s*(${Hp})\\s+-\\s+(${Hp})\\s*$`,Lme=new RegExp(vme),Dme="(?:~>?)",Ume=`^${Dme}${Hp}$`,wme=new RegExp(Ume),kme="(?:\\^)",Gme=`^${kme}${Hp}$`,Bme=new RegExp(Gme);function jme(t){let e=wme;return t.replace(e,(n,r,o,s,i)=>{let a;return pn(r)?a="":pn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:pn(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 Hme(t,e){let n=Bme,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return pn(s)?l="":pn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:pn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function Vme(t,e){let n=xme;return t.replace(n,(r,o,s,i,a,c)=>{let l=pn(s),p=l||pn(i),d=p||pn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function Fme(t,e){let n=Lme;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(pn(s)?o="":pn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:pn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,pn(d)?p="":pn(_)?p=`<${+d+1}.0.0-0`:pn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var IN=E(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.massUnwrap=kt.unwrap=kt.massWrap=kt.wrap=void 0;var dn=console.error.bind(console);function Vp(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 qme=(t,e,n)=>{if(!t||!t[e]){dn("no original function "+String(e)+" to wrap");return}if(!n){dn("no wrapper function"),dn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){dn("original object and wrapper must be functions");return}let o=n(r,e);return Vp(o,"__original",r),Vp(o,"__unwrap",()=>{t[e]===o&&Vp(t,e,r)}),Vp(o,"__wrapped",!0),Vp(t,e,o),o};kt.wrap=qme;var $me=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{dn("must provide one or more modules to patch"),dn(new Error().stack);return}if(!(e&&Array.isArray(e))){dn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,kt.wrap)(r,o,n)})})};kt.massWrap=$me;var Yme=(t,e)=>{if(!t||!t[e]){dn("no function to unwrap."),dn(new Error().stack);return}let n=t[e];if(!n.__unwrap)dn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};kt.unwrap=Yme;var Wme=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{dn("must provide one or more modules to patch"),dn(new Error().stack);return}if(!(e&&Array.isArray(e))){dn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,kt.unwrap)(n,r)})})};kt.massUnwrap=Wme;function Fp(t){t&&t.logger&&(typeof t.logger!="function"?dn("new logger isn't a function, not replacing"):dn=t.logger)}kt.default=Fp;Fp.wrap=kt.wrap;Fp.massWrap=kt.massWrap;Fp.unwrap=kt.unwrap;Fp.massUnwrap=kt.massUnwrap});var cq=E(XT=>{"use strict";Object.defineProperty(XT,"__esModule",{value:!0});XT.InstrumentationAbstract=void 0;var NN=(b(),N(v)),zme=SN(),QT=IN(),ON=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=NN.diag.createComponentLogger({namespace:e}),this._tracer=NN.trace.getTracer(e,n),this._meter=NN.metrics.getMeter(e,n),this._logger=zme.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=QT.wrap;_unwrap=QT.unwrap;_massWrap=QT.massWrap;_massUnwrap=QT.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)}}};XT.InstrumentationAbstract=ON});var uq=E(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.ModuleNameTrie=ks.ModuleNameSeparator=void 0;ks.ModuleNameSeparator="/";var JT=class{hooks=[];children=new Map},bN=class{_trie=new JT;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ks.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new JT,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(ks.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))}};ks.ModuleNameTrie=bN});var pq=E(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});ZT.RequireInTheMiddleSingleton=void 0;var Kme=Pi(),lq=U("path"),CN=uq(),Qme=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),PN=class t{_moduleNameTrie=new CN.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new Kme.Hook(null,{internals:!0},(e,n,r)=>{let o=Xme(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 Qme?new t:this._instance=this._instance??new t}};ZT.RequireInTheMiddleSingleton=PN;function Xme(t){return lq.sep!==CN.ModuleNameSeparator?t.split(lq.sep).join(CN.ModuleNameSeparator):t}});var Tq=E(qp=>{var dq=[],MN=new WeakMap,_q=new WeakMap,fq=new Map,mq=[],Jme={set(t,e,n){let r=MN.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=_q.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=MN.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function Zme(t,e,n,r,o){fq.set(t,o),MN.set(e,n),_q.set(e,r);let s=new Proxy(e,Jme);dq.forEach(i=>i(t,s,o)),mq.push([t,s,o])}qp.register=Zme;qp.importHooks=dq;qp.specifiers=fq;qp.toHook=mq});var DN=E((WYe,lu)=>{var hq=U("path"),eTe=ef(),{fileURLToPath:tTe}=U("url"),{MessageChannel:nTe}=U("worker_threads"),{isBuiltin:xN}=U("module");xN||(xN=()=>!0);var{importHooks:vN,specifiers:rTe,toHook:oTe}=Tq();function Eq(t){vN.push(t),oTe.forEach(([e,n,r])=>t(e,n,r))}function Sq(t){let e=vN.indexOf(t);e>-1&&vN.splice(e,1)}function uu(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var LN;function sTe(){let{port1:t,port2:e}=new nTe,n=0,r;LN=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function $p(t,e,n){if(!(this instanceof $p))return new $p(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;LN&&Array.isArray(t)&&LN(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);xN(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=tTe(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=eTe(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)uu(n,s,l,void 0);else if(d===o){if(!p)uu(n,s,o,p);else if(p.endsWith(rTe.get(a)))uu(n,s,o,p);else if(r){let _=o+hq.sep+hq.relative(p,l);uu(n,s,_,p)}}else d===i&&uu(n,s,i,p);else uu(n,s,o,p)},Eq(this._iitmHook)}$p.prototype.unhook=function(){Sq(this._iitmHook)};lu.exports=$p;lu.exports.Hook=$p;lu.exports.addHook=Eq;lu.exports.removeHook=Sq;lu.exports.createAddHookMessageChannel=sTe});var UN=E(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.isWrapped=Gs.safeExecuteInTheMiddleAsync=Gs.safeExecuteInTheMiddle=void 0;function iTe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Gs.safeExecuteInTheMiddle=iTe;async function aTe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}Gs.safeExecuteInTheMiddleAsync=aTe;function cTe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Gs.isWrapped=cTe});var Rq=E(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.InstrumentationBase=void 0;var Yp=U("path"),gq=U("util"),uTe=aq(),wN=IN(),lTe=cq(),pTe=pq(),dTe=DN(),Wp=(b(),N(v)),_Te=Pi(),fTe=U("fs"),mTe=UN(),kN=class extends lTe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=pTe.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,mTe.isWrapped)(e[n])&&this._unwrap(e,n),gq.types.isProxy(e)){let o=(0,wN.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,wN.wrap)(e,n,r)};_unwrap=(e,n)=>gq.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,wN.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Wp.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Wp.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{Wp.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Wp.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=U.resolve(n);U.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,fTe.readFileSync)(Yp.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Wp.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 Aq(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=Yp.normalize(r);return i.filter(l=>l.name===a&&Aq(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),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&&Yp.isAbsolute(a)){let l=Yp.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Yp.isAbsolute(e.name)?new _Te.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new dTe.Hook([e.name],{internals:!0},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}};eh.InstrumentationBase=kN;function Aq(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,uTe.satisfies)(e,r,{includePrerelease:n}))}});var yq=E(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.normalize=void 0;var TTe=U("path");Object.defineProperty(th,"normalize",{enumerable:!0,get:function(){return TTe.normalize}})});var Iq=E(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.normalize=pu.InstrumentationBase=void 0;var hTe=Rq();Object.defineProperty(pu,"InstrumentationBase",{enumerable:!0,get:function(){return hTe.InstrumentationBase}});var ETe=yq();Object.defineProperty(pu,"normalize",{enumerable:!0,get:function(){return ETe.normalize}})});var GN=E(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.normalize=du.InstrumentationBase=void 0;var Nq=Iq();Object.defineProperty(du,"InstrumentationBase",{enumerable:!0,get:function(){return Nq.InstrumentationBase}});Object.defineProperty(du,"normalize",{enumerable:!0,get:function(){return Nq.normalize}})});var Oq=E(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.InstrumentationNodeModuleDefinition=void 0;var BN=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};nh.InstrumentationNodeModuleDefinition=BN});var bq=E(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.InstrumentationNodeModuleFile=void 0;var STe=GN(),jN=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,STe.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};rh.InstrumentationNodeModuleFile=jN});var Cq=E(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.semconvStabilityFromStr=ra.SemconvStability=void 0;var oh;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(oh=ra.SemconvStability||(ra.SemconvStability={}));function gTe(t,e){let n=oh.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=oh.DUPLICATE;break}else o.toLowerCase()===t&&(n=oh.STABLE);return n}ra.semconvStabilityFromStr=gTe});var Mq=E(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.semconvStabilityFromStr=it.SemconvStability=it.safeExecuteInTheMiddleAsync=it.safeExecuteInTheMiddle=it.isWrapped=it.InstrumentationNodeModuleFile=it.InstrumentationNodeModuleDefinition=it.InstrumentationBase=it.registerInstrumentations=void 0;var ATe=JF();Object.defineProperty(it,"registerInstrumentations",{enumerable:!0,get:function(){return ATe.registerInstrumentations}});var RTe=GN();Object.defineProperty(it,"InstrumentationBase",{enumerable:!0,get:function(){return RTe.InstrumentationBase}});var yTe=Oq();Object.defineProperty(it,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return yTe.InstrumentationNodeModuleDefinition}});var ITe=bq();Object.defineProperty(it,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return ITe.InstrumentationNodeModuleFile}});var HN=UN();Object.defineProperty(it,"isWrapped",{enumerable:!0,get:function(){return HN.isWrapped}});Object.defineProperty(it,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return HN.safeExecuteInTheMiddle}});Object.defineProperty(it,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return HN.safeExecuteInTheMiddleAsync}});var Pq=Cq();Object.defineProperty(it,"SemconvStability",{enumerable:!0,get:function(){return Pq.SemconvStability}});Object.defineProperty(it,"semconvStabilityFromStr",{enumerable:!0,get:function(){return Pq.semconvStabilityFromStr}})});var xq=E((oWe,NTe)=>{NTe.exports={name:"@fastify/otel",version:"0.18.0",description:"Official Fastify OpenTelemetry Instrumentation",main:"index.js",type:"commonjs",types:"types/index.d.ts",scripts:{lint:"eslint","lint:fix":"eslint --fix",test:"npm run test:all && npm run test:typescript","test:unit":"c8 --100 node --test","test:all":"npm run test:v4 && npm run test:v5","test:v4":"cross-env FASTIFY_VERSION=fastifyv4 npm run test:unit","test:v5":"cross-env FASTIFY_VERSION=fastify npm run test:unit","test:coverage":"c8 node --test && c8 report --reporter=html","test:typescript":"tsd"},repository:{type:"git",url:"git+https://github.com/fastify/otel.git"},keywords:["plugin","helper","fastify","instrumentation","otel","opentelemetry"],author:"Carlos Fuentes - @metcoder95 (https://metcoder.dev)",license:"MIT",bugs:{url:"https://github.com/fastify/otel/issues"},homepage:"https://github.com/fastify/otel#readme",funding:[{type:"github",url:"https://github.com/sponsors/fastify"},{type:"opencollective",url:"https://opencollective.com/fastify"}],devDependencies:{"@fastify/type-provider-typebox":"^6.1.0","@opentelemetry/context-async-hooks":"^2.0.0","@opentelemetry/contrib-test-utils":"^0.59.0","@opentelemetry/instrumentation-http":"^0.212.0","@opentelemetry/propagator-jaeger":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.2.0","@types/node":"^25.0.3",c8:"^11.0.0","cross-env":"^10.0.0",eslint:"^9.16.0",fastify:"^5.1.0","fastify-plugin":"^5.1.0",fastifyv4:"npm:fastify@^4.0.0",neostandard:"^0.12.0",tsd:"^0.33.0"},dependencies:{"@opentelemetry/core":"^2.0.0","@opentelemetry/instrumentation":"^0.212.0","@opentelemetry/semantic-conventions":"^1.28.0",minimatch:"^10.2.4"},peerDependencies:{"@opentelemetry/api":"^1.9.0"},tsd:{directory:"types"}}});var Lq=E(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.range=oa.balanced=void 0;var OTe=(t,e,n)=>{let r=t instanceof RegExp?vq(t,n):t,o=e instanceof RegExp?vq(e,n):e,s=r!==null&&o!=null&&(0,oa.range)(r,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+o.length)}};oa.balanced=OTe;var vq=(t,e)=>{let n=e.match(t);return n?n[0]:null},bTe=(t,e,n)=>{let r,o,s,i,a,c=n.indexOf(t),l=n.indexOf(e,c+1),p=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;p>=0&&!a;){if(p===c)r.push(p),c=n.indexOf(t,p+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else o=r.pop(),o!==void 0&&o<s&&(s=o,i=l),l=n.indexOf(e,p+1);p=c<l&&c>=0?c:l}r.length&&i!==void 0&&(a=[s,i])}return a};oa.range=bTe});var jq=E(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.EXPANSION_MAX=void 0;_u.expand=jTe;var Dq=Lq(),Uq="\0SLASH"+Math.random()+"\0",wq="\0OPEN"+Math.random()+"\0",FN="\0CLOSE"+Math.random()+"\0",kq="\0COMMA"+Math.random()+"\0",Gq="\0PERIOD"+Math.random()+"\0",CTe=new RegExp(Uq,"g"),PTe=new RegExp(wq,"g"),MTe=new RegExp(FN,"g"),xTe=new RegExp(kq,"g"),vTe=new RegExp(Gq,"g"),LTe=/\\\\/g,DTe=/\\{/g,UTe=/\\}/g,wTe=/\\,/g,kTe=/\\\./g;_u.EXPANSION_MAX=1e5;function VN(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function GTe(t){return t.replace(LTe,Uq).replace(DTe,wq).replace(UTe,FN).replace(wTe,kq).replace(kTe,Gq)}function BTe(t){return t.replace(CTe,"\\").replace(PTe,"{").replace(MTe,"}").replace(xTe,",").replace(vTe,".")}function Bq(t){if(!t)return[""];let e=[],n=(0,Dq.balanced)("{","}",t);if(!n)return t.split(",");let{pre:r,body:o,post:s}=n,i=r.split(",");i[i.length-1]+="{"+o+"}";let a=Bq(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function jTe(t,e={}){if(!t)return[];let{max:n=_u.EXPANSION_MAX}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),zp(GTe(t),n,!0).map(BTe)}function HTe(t){return"{"+t+"}"}function VTe(t){return/^-?0\d/.test(t)}function FTe(t,e){return t<=e}function qTe(t,e){return t>=e}function zp(t,e,n){let r=[],o=(0,Dq.balanced)("{","}",t);if(!o)return[t];let s=o.pre,i=o.post.length?zp(o.post,e,!1):[""];if(/\$$/.test(o.pre))for(let a=0;a<i.length&&a<e;a++){let c=s+"{"+o.body+"}"+i[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),l=a||c,p=o.body.indexOf(",")>=0;if(!l&&!p)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+FN+o.post,zp(t,e,!0)):[t];let d;if(l)d=o.body.split(/\.\./);else if(d=Bq(o.body),d.length===1&&d[0]!==void 0&&(d=zp(d[0],e,!1).map(HTe),d.length===1))return i.map(f=>o.pre+d[0]+f);let _;if(l&&d[0]!==void 0&&d[1]!==void 0){let f=VN(d[0]),m=VN(d[1]),T=Math.max(d[0].length,d[1].length),h=d.length===3&&d[2]!==void 0?Math.abs(VN(d[2])):1,S=FTe;m<f&&(h*=-1,S=qTe);let I=d.some(VTe);_=[];for(let x=f;S(x,m);x+=h){let V;if(c)V=String.fromCharCode(x),V==="\\"&&(V="");else if(V=String(x),I){let B=T-V.length;if(B>0){let se=new Array(B+1).join("0");x<0?V="-"+se+V.slice(1):V=se+V}}_.push(V)}}else{_=[];for(let f=0;f<d.length;f++)_.push.apply(_,zp(d[f],e,!1))}for(let f=0;f<_.length;f++)for(let m=0;m<i.length&&r.length<e;m++){let T=s+_[f]+i[m];(!n||l||T)&&r.push(T)}}return r}});var Hq=E(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.assertValidPattern=void 0;var $Te=1024*64,YTe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>$Te)throw new TypeError("pattern is too long")};sh.assertValidPattern=YTe});var Fq=E(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.parseClass=void 0;var WTe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Kp=t=>t.replace(/[[\]\\-]/g,"\\$&"),zTe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Vq=t=>t.join(""),KTe=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],o=[],s=n+1,i=!1,a=!1,c=!1,l=!1,p=n,d="";e:for(;s<t.length;){let T=t.charAt(s);if((T==="!"||T==="^")&&s===n+1){l=!0,s++;continue}if(T==="]"&&i&&!c){p=s+1;break}if(i=!0,T==="\\"&&!c){c=!0,s++;continue}if(T==="["&&!c){for(let[h,[S,R,I]]of Object.entries(WTe))if(t.startsWith(h,s)){if(d)return["$.",!1,t.length-n,!0];s+=h.length,I?o.push(S):r.push(S),a=a||R;continue e}}if(c=!1,d){T>d?r.push(Kp(d)+"-"+Kp(T)):T===d&&r.push(Kp(T)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(Kp(T+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=T,s+=2;continue}r.push(Kp(T)),s++}if(p<s)return["",!1,0,!1];if(!r.length&&!o.length)return["$.",!1,t.length-n,!0];if(o.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let T=r[0].length===2?r[0].slice(-1):r[0];return[zTe(T),!1,p-n,!1]}let _="["+(l?"^":"")+Vq(r)+"]",f="["+(l?"":"^")+Vq(o)+"]";return[r.length&&o.length?"("+_+"|"+f+")":r.length?_:f,a,p-n,!0]};ih.parseClass=KTe});var ch=E(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.unescape=void 0;var QTe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");ah.unescape=QTe});var YN=E(dh=>{"use strict";var Nn;Object.defineProperty(dh,"__esModule",{value:!0});dh.AST=void 0;var XTe=Fq(),uh=ch(),JTe=new Set(["!","?","+","*","@"]),qN=t=>JTe.has(t),qq=t=>qN(t.type),ZTe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),ehe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),the=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),$q=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),nhe="(?!(?:^|/)\\.\\.?(?:$|/))",lh="(?!\\.)",rhe=new Set(["[","."]),ohe=new Set(["..","."]),she=new Set("().*{}+?[]^$\\!"),ihe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$N="[^/]",Yq=$N+"*?",Wq=$N+"+?",ahe=0,ph=class{type;#n;#r;#o=!1;#e=[];#t;#a;#u;#c=!1;#s;#i;#l=!1;id=++ahe;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,n,r={}){this.type=e,e&&(this.#r=!0),this.#t=n,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#i!==void 0?this.#i:this.type?this.#i=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#i=this.#e.map(e=>String(e)).join("")}#h(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let n=e,r=n.#t;for(;r;){for(let o=n.#a+1;!r.type&&o<r.#e.length;o++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#e[o])}n=r,r=n.#t}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof Nn&&n.#t===this))throw new Error("invalid part: "+n);this.#e.push(n)}}toJSON(){let e=this.type===null?this.#e.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#e.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let n=0;n<this.#a;n++){let r=e.#e[n];if(!(r instanceof Nn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new Nn(this.type,e);for(let r of this.#e)n.copyIn(r);return n}static#p(e,n,r,o,s){let i=o.maxExtglobRecursion??2,a=!1,c=!1,l=-1,p=!1;if(n.type===null){let T=r,h="";for(;T<e.length;){let S=e.charAt(T++);if(a||S==="\\"){a=!a,h+=S;continue}if(c){T===l+1?(S==="^"||S==="!")&&(p=!0):S==="]"&&!(T===l+2&&p)&&(c=!1),h+=S;continue}else if(S==="["){c=!0,l=T,p=!1,h+=S;continue}if(!o.noext&&qN(S)&&e.charAt(T)==="("&&s<=i){n.push(h),h="";let I=new Nn(S,n);T=Nn.#p(e,I,T,o,s+1),n.push(I);continue}h+=S}return n.push(h),T}let d=r+1,_=new Nn(null,n),f=[],m="";for(;d<e.length;){let T=e.charAt(d++);if(a||T==="\\"){a=!a,m+=T;continue}if(c){d===l+1?(T==="^"||T==="!")&&(p=!0):T==="]"&&!(d===l+2&&p)&&(c=!1),m+=T;continue}else if(T==="["){c=!0,l=d,p=!1,m+=T;continue}if(!o.noext&&qN(T)&&e.charAt(d)==="("&&(s<=i||n&&n.#d(T))){let S=n&&n.#d(T)?0:1;_.push(m),m="";let R=new Nn(T,_);_.push(R),d=Nn.#p(e,R,d,o,s+S);continue}if(T==="|"){_.push(m),m="",f.push(_),_=new Nn(null,n);continue}if(T===")")return m===""&&n.#e.length===0&&(n.#l=!0),_.push(m),m="",n.push(...f,_),d;m+=T}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],d}#E(e){return this.#f(e,ehe)}#f(e,n=ZTe){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#d(r.type,n)}#d(e,n=the){return!!n.get(this.type)?.includes(e)}#S(e,n){let r=e.#e[0],o=new Nn(null,r,this.options);o.#e.push(""),r.push(o),this.#m(e,n)}#m(e,n){let r=e.#e[0];this.#e.splice(n,1,...r.#e);for(let o of r.#e)typeof o=="object"&&(o.#t=this);this.#i=void 0}#g(e){return!!$q.get(this.type)?.has(e)}#A(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type)}#R(e){let n=$q.get(this.type),r=e.#e[0],o=n?.get(r.type);if(!o)return!1;this.#e=r.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=o,this.#i=void 0,this.#l=!1}static fromGlob(e,n={}){let r=new Nn(null,void 0,n);return Nn.#p(e,r,0,n,0),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[n,r,o,s]=this.toRegExpSource();if(!(o||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#s}toRegExpSource(e){let n=e??!!this.#s.dot;if(this.#n===this&&(this.#_(),this.#h()),!qq(this)){let c=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),l=this.#e.map(f=>{let[m,T,h,S]=typeof f=="string"?Nn.#y(f,this.#r,c):f.toRegExpSource(e);return this.#r=this.#r||h,this.#o=this.#o||S,m}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&ohe.has(this.#e[0]))){let m=rhe,T=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),h=!n&&!e&&m.has(l.charAt(0));p=T?nhe:h?lh:""}let d="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(d="(?:$|\\/)"),[p+l+d,(0,uh.unescape)(l),this.#r=!!this.#r,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#T(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#e=[c],l.type=null,l.#r=void 0,[c,(0,uh.unescape)(this.toString()),!1,!1]}let i=!r||e||n||!lh?"":this.#T(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!n?lh:"")+Wq;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?lh:"")+Yq+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,(0,uh.unescape)(s),this.#r=!!this.#r,this.#o]}#_(){if(qq(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#e.length;r++){let o=this.#e[r];typeof o=="object"&&(o.#_(),this.#f(o)?(n=!1,this.#m(o,r)):this.#E(o)?(n=!1,this.#S(o,r)):this.#A(o)&&(n=!1,this.#R(o)))}}while(!n&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#_();this.#i=void 0}#T(e){return this.#e.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,s,i]=n.toRegExpSource(e);return this.#o=this.#o||i,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#y(e,n,r=!1){let o=!1,s="",i=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(o){o=!1,s+=(she.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?Wq:Yq,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(l==="["){let[p,d,_,f]=(0,XTe.parseClass)(e,c);if(_){s+=p,i=i||d,c+=_-1,n=n||f;continue}}if(l==="?"){s+=$N,n=!0;continue}s+=ihe(l)}return[s,(0,uh.unescape)(e),!!n,i]}};dh.AST=ph;Nn=ph});var WN=E(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.escape=void 0;var che=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");_h.escape=che});var e$=E(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var uhe=jq(),fh=Hq(),Qq=YN(),lhe=WN(),phe=ch(),dhe=(t,e,n={})=>((0,fh.assertValidPattern)(e),!n.nocomment&&e.charAt(0)==="#"?!1:new sa(e,n).match(t));k.minimatch=dhe;var _he=/^\*+([^+@!?\*\[\(]*)$/,fhe=t=>e=>!e.startsWith(".")&&e.endsWith(t),mhe=t=>e=>e.endsWith(t),The=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),hhe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Ehe=/^\*+\.\*+$/,She=t=>!t.startsWith(".")&&t.includes("."),ghe=t=>t!=="."&&t!==".."&&t.includes("."),Ahe=/^\.\*+$/,Rhe=t=>t!=="."&&t!==".."&&t.startsWith("."),yhe=/^\*+$/,Ihe=t=>t.length!==0&&!t.startsWith("."),Nhe=t=>t.length!==0&&t!=="."&&t!=="..",Ohe=/^\?+([^+@!?\*\[\(]*)?$/,bhe=([t,e=""])=>{let n=Xq([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},Che=([t,e=""])=>{let n=Jq([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},Phe=([t,e=""])=>{let n=Jq([t]);return e?r=>n(r)&&r.endsWith(e):n},Mhe=([t,e=""])=>{let n=Xq([t]);return e?r=>n(r)&&r.endsWith(e):n},Xq=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},Jq=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},Zq=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",zq={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=Zq==="win32"?zq.win32.sep:zq.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var xhe="[^/]",vhe=xhe+"*?",Lhe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Dhe="(?:(?!(?:\\/|^)\\.).)*?",Uhe=(t,e={})=>n=>(0,k.minimatch)(n,t,e);k.filter=Uhe;k.minimatch.filter=k.filter;var ir=(t,e={})=>Object.assign({},t,e),whe=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return k.minimatch;let e=k.minimatch;return Object.assign((r,o,s={})=>e(r,o,ir(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,ir(t,s))}static defaults(o){return e.defaults(ir(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,ir(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,ir(t,s))}},unescape:(r,o={})=>e.unescape(r,ir(t,o)),escape:(r,o={})=>e.escape(r,ir(t,o)),filter:(r,o={})=>e.filter(r,ir(t,o)),defaults:r=>e.defaults(ir(t,r)),makeRe:(r,o={})=>e.makeRe(r,ir(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,ir(t,o)),match:(r,o,s={})=>e.match(r,o,ir(t,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=whe;k.minimatch.defaults=k.defaults;var khe=(t,e={})=>((0,fh.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,uhe.expand)(t,{max:e.braceExpandMax}));k.braceExpand=khe;k.minimatch.braceExpand=k.braceExpand;var Ghe=(t,e={})=>new sa(t,e).makeRe();k.makeRe=Ghe;k.minimatch.makeRe=k.makeRe;var Bhe=(t,e,n={})=>{let r=new sa(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};k.match=Bhe;k.minimatch.match=k.match;var Kq=/[?*]|[+@!]\(.*?\)|\[|\]/,jhe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sa=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){(0,fh.assertValidPattern)(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||Zq,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!Kq.test(s[2]))&&!Kq.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let i=this.set[s];i[0]===""&&i[1]===""&&this.globParts[s][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let o=0;o<e[r].length;o++)e[r][o]==="**"&&(e[r][o]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let o=r;for(;n[o+1]==="**";)o++;o!==r&&n.splice(r,o-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,o)=>{let s=r[r.length-1];return o==="**"&&s==="**"?r:o===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(o),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let s=e[o];o===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let o=e[r-1];o&&o!=="."&&o!==".."&&o!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let o=-1;for(;(o=r.indexOf("**",o+1))!==-1;){let i=o;for(;r[i+1]==="**";)i++;i>o&&r.splice(o+1,i-o);let a=r[o+1],c=r[o+2],l=r[o+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(o,1);let p=r.slice(0);p[o]="**",e.push(p),o--}if(!this.preserveMultipleSlashes){for(let i=1;i<r.length-1;i++){let a=r[i];i===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(i,1),i--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let i=r[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let o=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(o){e[n]=[],e[r]=o;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let o=0,s=0,i=[],a="";for(;o<e.length&&s<n.length;)if(e[o]===n[s])i.push(a==="b"?n[s]:e[o]),o++,s++;else if(r&&e[o]==="**"&&n[s]===e[o+1])i.push(e[o]),o++;else if(r&&n[s]==="**"&&e[o]===n[s+1])i.push(n[s]),s++;else if(e[o]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",i.push(e[o]),o++,s++}else if(n[s]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(a==="a")return!1;a="b",i.push(n[s]),o++,s++}else return!1;return e.length===n.length&&i}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let o=0;o<e.length&&e.charAt(o)==="!";o++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let o=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),p=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,_=p?3:l?0:void 0;if(typeof d=="number"&&typeof _=="number"){let[f,m]=[e[d],n[_]];f.toLowerCase()===m.toLowerCase()&&(n[_]=f,s=_,o=d)}}let{optimizationLevel:i=1}=this.options;return i>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(k.GLOBSTAR)?this.#n(e,n,r,o,s):this.#o(e,n,r,o,s)}#n(e,n,r,o,s){let i=n.indexOf(k.GLOBSTAR,s),a=n.lastIndexOf(k.GLOBSTAR),[c,l,p]=r?[n.slice(s,i),n.slice(i+1),[]]:[n.slice(s,i),n.slice(i+1,a),n.slice(a+1)];if(c.length){let R=e.slice(o,o+c.length);if(!this.#o(R,c,r,0,0))return!1;o+=c.length,s+=c.length}let d=0;if(p.length){if(p.length+o>e.length)return!1;let R=e.length-p.length;if(this.#o(e,p,r,R,0))d=p.length;else{if(e[e.length-1]!==""||o+p.length===e.length||(R--,!this.#o(e,p,r,R,0)))return!1;d=p.length+1}}if(!l.length){let R=!!d;for(let I=o;I<e.length-d;I++){let x=String(e[I]);if(R=!0,x==="."||x===".."||!this.options.dot&&x.startsWith("."))return!1}return r||R}let _=[[[],0]],f=_[0],m=0,T=[0];for(let R of l)R===k.GLOBSTAR?(T.push(m),f=[[],0],_.push(f)):(f[0].push(R),m++);let h=_.length-1,S=e.length-d;for(let R of _)R[1]=S-(T[h--]+R[0].length);return!!this.#r(e,_,o,0,r,0,!!d)}#r(e,n,r,o,s,i,a){let c=n[o];if(!c){for(let d=r;d<e.length;d++){a=!0;let _=e[d];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return a}let[l,p]=c;for(;r<=p;){if(this.#o(e.slice(0,r+l.length),l,s,r,0)&&i<this.maxGlobstarRecursion){let f=this.#r(e,n,r+l.length,o+1,s,i+1,a);if(f!==!1)return f}let _=e[r];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1;r++}return s||null}#o(e,n,r,o,s){let i,a,c,l;for(i=o,a=s,l=e.length,c=n.length;i<l&&a<c;i++,a++){this.debug("matchOne loop");let p=n[a],d=e[i];if(this.debug(n,p,d),p===!1||p===k.GLOBSTAR)return!1;let _;if(typeof p=="string"?(_=d===p,this.debug("string match",p,d,_)):(_=p.test(d),this.debug("pattern match",p,d,_)),!_)return!1}if(i===l&&a===c)return!0;if(i===l)return r;if(a===c)return i===l-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,fh.assertValidPattern)(e);let n=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let r,o=null;(r=e.match(yhe))?o=n.dot?Nhe:Ihe:(r=e.match(_he))?o=(n.nocase?n.dot?hhe:The:n.dot?mhe:fhe)(r[1]):(r=e.match(Ohe))?o=(n.nocase?n.dot?Che:bhe:n.dot?Phe:Mhe)(r):(r=e.match(Ehe))?o=n.dot?ghe:She:(r=e.match(Ahe))&&(o=Rhe);let s=Qq.AST.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?vhe:n.dot?Lhe:Dhe,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let _ of d.flags.split(""))o.add(_);return typeof d=="string"?jhe(d):d===k.GLOBSTAR?k.GLOBSTAR:d._src});l.forEach((d,_)=>{let f=l[_+1],m=l[_-1];d!==k.GLOBSTAR||m===k.GLOBSTAR||(m===void 0?f!==void 0&&f!==k.GLOBSTAR?l[_+1]="(?:\\/|"+r+"\\/)?"+f:l[_]=r:f===void 0?l[_-1]=m+"(?:\\/|\\/"+r+")?":f!==k.GLOBSTAR&&(l[_-1]=m+"(?:\\/|\\/"+r+"\\/)"+f,l[_+1]=k.GLOBSTAR))});let p=l.filter(d=>d!==k.GLOBSTAR);if(this.partial&&p.length>=1){let d=[];for(let _=1;_<=p.length;_++)d.push(p.slice(0,_).join("/"));return"(?:"+d.join("|")+")"}return p.join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.partial&&(s="^(?:\\/|"+i+s.slice(1,-1)+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],l=o;if(r.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=sa;var Hhe=YN();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return Hhe.AST}});var Vhe=WN();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return Vhe.escape}});var Fhe=ch();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return Fhe.unescape}});k.minimatch.AST=Qq.AST;k.minimatch.Minimatch=sa;k.minimatch.escape=lhe.escape;k.minimatch.unescape=phe.unescape});var a$=E((mWe,QN)=>{"use strict";var t$=U("node:diagnostics_channel"),{context:mh,trace:zN,SpanStatusCode:Th,propagation:KN,diag:qhe}=(b(),N(v)),{getRPCMetadata:$he,RPCType:Yhe}=he(),{ATTR_HTTP_ROUTE:hh,ATTR_HTTP_RESPONSE_STATUS_CODE:n$,ATTR_HTTP_REQUEST_METHOD:Whe,ATTR_URL_PATH:zhe}=(le(),N(Ae)),{InstrumentationBase:Khe}=Mq(),{version:Qhe,name:r$}=xq(),Xhe=">=4.0.0 <6",o$=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Me={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},Bs={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},Ho="anonymous",js=Symbol("fastify otel instance"),Hs=Symbol("fastify otel request spans"),Qp=Symbol("fastify otel request context"),s$=Symbol("fastify otel addhook original"),i$=Symbol("fastify otel setnotfound original"),Xp=Symbol("fastify otel ignore path"),Jp=Symbol("fastify otel record exceptions"),Eh=class extends Khe{logger=null;_requestHook=null;_lifecycleHook=null;constructor(e){if(super(r$,Qhe,e),this.logger=qhe.createComponentLogger({namespace:r$}),this[Xp]=null,this[Jp]=!0,e?.recordExceptions!=null){if(typeof e.recordExceptions!="boolean")throw new TypeError("recordExceptions must be a boolean");this[Jp]=e.recordExceptions}if(typeof e?.requestHook=="function"&&(this._requestHook=e.requestHook),typeof e?.lifecycleHook=="function"&&(this._lifecycleHook=e.lifecycleHook),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=null;this[Xp]=o=>typeof n=="function"?n(o):(r==null&&(r=e$().minimatch),r(o.url,n))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=e=>{this.plugin()(e.fastify,void 0,()=>{});let n=(r,o,s)=>{s()};n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",e.fastify.register(n)},t$.subscribe("fastify.initialization",this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&(t$.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:Xhe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate(js,e),r.decorate(s$,r.addHook),r.decorate(i$,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let f=this[Qp],m=this[Hs];return{enabled:this.routeOptions.config?.otel!==!1,span:m,tracer:e.tracer,context:f,inject:(T,h)=>KN.inject(f,T,h),extract:(T,h)=>KN.extract(f,T,h)}}),r.decorateRequest(Hs,null),r.decorateRequest(Qp,null),r.addHook("onRoute",function(f){if(e[Xp]?.(f)===!0){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it matches the ignore path`);return}if(f.config?.otel===!1){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it is disabled`);return}for(let m of o$)if(f[m]!=null){let T=f[m];if(typeof T=="function")f[m]=d(T,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:Bs.ROUTE,[hh]:f.url,[Me.HOOK_CALLBACK_NAME]:T.name?.length>0?T.name:Ho});else if(Array.isArray(T)){let h=[];for(let S of T)h.push(d(S,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:Bs.ROUTE,[hh]:f.url,[Me.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:Ho}));f[m]=h}}f.onSend!=null?f.onSend=Array.isArray(f.onSend)?[...f.onSend,i]:[f.onSend,i]:f.onSend=i,f.onError!=null?f.onError=Array.isArray(f.onError)?[...f.onError,a]:[f.onError,a]:f.onError=a,f.handler=d(f.handler,"handler",{[Me.HOOK_NAME]:`${this.pluginName} - route-handler`,[Me.FASTIFY_TYPE]:Bs.HANDLER,[hh]:f.url,[Me.HOOK_CALLBACK_NAME]:f.handler.name.length>0?f.handler.name:Ho})}),r.addHook("onRequest",function(f,m,T){if(this[js].isEnabled()===!1||f.routeOptions.config?.otel===!1)return T();if(this[js][Xp]?.({url:f.url,method:f.method})===!0)return this[js].logger.debug(`Ignoring request ${f.method} ${f.url} because it matches the ignore path`),T();let h=mh.active();zN.getSpan(h)==null&&(h=KN.extract(h,f.headers));let S=$he(h);f.routeOptions.url!=null&&S?.type===Yhe.HTTP&&(S.route=f.routeOptions.url);let R={[Me.ROOT]:"@fastify/otel",[Whe]:f.method,[zhe]:f.url};f.routeOptions.url!=null&&(R[hh]=f.routeOptions.url);let I=this[js].tracer.startSpan("request",{attributes:R},h);try{this[js]._requestHook?.(I,f)}catch(x){this[js].logger.error({err:x},"requestHook threw")}f[Qp]=zN.setSpan(h,I),f[Hs]=I,mh.with(f[Qp],()=>{T()})}),r.addHook("onResponse",function(f,m,T){let h=f[Hs];h!=null&&(h.setAttributes({[n$]:m.statusCode}),h.end()),f[Hs]=null,T()}),r.addHook=c,r.setNotFoundHandler=l,s();function i(_,f,m,T){let h=_[Hs];h!=null&&(f.statusCode>=500&&h.setStatus({code:Th.ERROR}),h.setAttributes({[n$]:f.statusCode}),h.end()),_[Hs]=null,T(null,m)}function a(_,f,m,T){let h=_[Hs];h!=null&&(h.setStatus({code:Th.ERROR,message:m.message}),e[Jp]!==!1&&h.recordException(m)),T()}function c(_,f){let m=this[s$];return o$.includes(_)?m.call(this,_,d(f,_,{[Me.HOOK_NAME]:`${this.pluginName} - ${_}`,[Me.FASTIFY_TYPE]:Bs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:Ho})):m.call(this,_,f)}function l(_,f){let m=this[i$];typeof _=="function"?(f=d(_,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:Bs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:Ho}),m.call(this,f)):(_.preValidation!=null&&(_.preValidation=d(_.preValidation,"notFoundHandler - preValidation",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Me.FASTIFY_TYPE]:Bs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:Ho})),_.preHandler!=null&&(_.preHandler=d(_.preHandler,"notFoundHandler - preHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Me.FASTIFY_TYPE]:Bs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:Ho})),f=d(f,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:Bs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:Ho}),m.call(this,_,f))}function p(_){for(let f of _)if(f?.routeOptions&&f.url&&f.method)return f;return null}function d(_,f,m={}){return function(...h){let S=this[js],R=p(h);if(R===null)return S.logger.debug(`Ignoring route instrumentation because ${f} was called without a Fastify request argument`),_.call(this,...h);if(S.isEnabled()===!1||R.routeOptions.config?.otel===!1)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it is disabled`),_.call(this,...h);if(S[Xp]?.({url:R.url,method:R.method})===!0)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it matches the ignore path`),_.call(this,...h);let I=R[Qp]??mh.active(),x=_.name?.length>0?_.name:this.pluginName??Ho,V=S.tracer.startSpan(`${f} - ${x}`,{attributes:m},I);if(S._lifecycleHook!=null)try{S._lifecycleHook(V,{hookName:f,request:R,handler:x})}catch(B){S.logger.error({err:B},"Execution of lifecycleHook failed")}return mh.with(zN.setSpan(I,V),function(){try{let B=_.call(this,...h);return typeof B?.then=="function"?B.then(se=>(V.end(),se),se=>(V.setStatus({code:Th.ERROR,message:se.message}),S[Jp]!==!1&&V.recordException(se),V.end(),Promise.reject(se))):(V.end(),B)}catch(B){throw V.setStatus({code:Th.ERROR,message:B.message}),S[Jp]!==!1&&V.recordException(B),V.end(),B}},this)}}}}};QN.exports=Eh;QN.exports.FastifyOtelInstrumentation=Eh});var ZN=E(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.SpanNames=xr.TokenKind=xr.AllowedOperationTypes=void 0;var iEe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(iEe=xr.AllowedOperationTypes||(xr.AllowedOperationTypes={}));var aEe;(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"})(aEe=xr.TokenKind||(xr.TokenKind={}));var cEe;(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"})(cEe=xr.SpanNames||(xr.SpanNames={}))});var eO=E(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.AttributeNames=void 0;var uEe;(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.PARENT_NAME="graphql.parent.name",t.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(uEe=nd.AttributeNames||(nd.AttributeNames={}))});var yh=E(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.OTEL_GRAPHQL_DATA_SYMBOL=fu.OTEL_PATCHED_SYMBOL=void 0;fu.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");fu.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var S$=E(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.OPERATION_NOT_SUPPORTED=void 0;var UWe=yh();Ih.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var L$=E(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.wrapFieldResolver=mt.wrapFields=mt.getSourceFromLocation=mt.getOperation=mt.endSpan=mt.addSpanSource=mt.addInputVariableAttributes=mt.isPromise=void 0;var mu=(b(),N(v)),Vs=ZN(),aa=eO(),Fo=yh(),g$=Object.values(Vs.AllowedOperationTypes),lEe=t=>typeof t?.then=="function";mt.isPromise=lEe;var pEe=t=>typeof t=="object"&&t!==null;function tO(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{tO(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{tO(t,`${e}.${r}`,o)}):t.setAttribute(`${aa.AttributeNames.VARIABLES}${String(e)}`,n)}function dEe(t,e){Object.entries(e).forEach(([n,r])=>{tO(t,n,r)})}mt.addInputVariableAttributes=dEe;function I$(t,e,n,r,o){let s=P$(e,n,r,o);t.setAttribute(aa.AttributeNames.SOURCE,s)}mt.addSpanSource=I$;function _Ee(t,e,n,r,o){let s=N$(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?b$(n):O$(n,o);return s={span:fEe(t,e,n,r,o,a)},hEe(n,o,s),{field:s,spanAdded:!0}}function fEe(t,e,n,r,o,s){let i={[aa.AttributeNames.FIELD_NAME]:r.fieldName,[aa.AttributeNames.FIELD_PATH]:o.join("."),[aa.AttributeNames.FIELD_TYPE]:r.returnType.toString(),[aa.AttributeNames.PARENT_NAME]:r.parentType.name},a=t.startSpan(`${Vs.SpanNames.RESOLVE} ${i[aa.AttributeNames.FIELD_PATH]}`,{attributes:i},s?mu.trace.setSpan(mu.context.active(),s):void 0),c=n[Fo.OTEL_GRAPHQL_DATA_SYMBOL].source,l=r.fieldNodes.find(p=>p.kind==="Field");return l&&I$(a,c.loc,e().allowValues,l.loc?.start,l.loc?.end),a}function mEe(t,e){e&&t.recordException(e),t.end()}mt.endSpan=mEe;function TEe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>g$.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>g$.indexOf(n?.operation)!==-1)}mt.getOperation=TEe;function hEe(t,e,n){return t[Fo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function N$(t,e){return t[Fo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function O$(t,e){for(let n=e.length-1;n>0;n--){let r=N$(t,e.slice(0,n));if(r)return r.span}return b$(t)}function b$(t){return t[Fo.OTEL_GRAPHQL_DATA_SYMBOL].span}function EEe(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 SEe(t){return C$(`
|
|
10
|
+
`,t)}function A$(t){return C$(" ",t)}function C$(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var gEe=[Vs.TokenKind.FLOAT,Vs.TokenKind.STRING,Vs.TokenKind.INT,Vs.TokenKind.BLOCK_STRING];function P$(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 l=a.value||a.kind,p="";!e&&gEe.indexOf(a.kind)>=0&&(l="*"),a.kind===Vs.TokenKind.STRING&&(l=`"${l}"`),a.kind===Vs.TokenKind.EOF&&(l=""),a.line>c?(o+=SEe(a.line-c),c=a.line,p=A$(a.column-1)):a.line===a.prev?.line&&(p=A$(a.start-(a.prev?.end||0))),o+=p+l,a&&(a=a.next)}}return o}mt.getSourceFromLocation=P$;function M$(t,e,n){if(!t||t[Fo.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[Fo.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=v$(e,n,s.resolve)),s.type)){let i=x$(s.type);for(let a of i)M$(a,e,n)}})}mt.wrapFields=M$;function x$(t){return"ofType"in t?x$(t.ofType):AEe(t)?t.getTypes():REe(t)?[t]:[]}function AEe(t){return"getTypes"in t&&typeof t.getTypes=="function"}function REe(t){return"getFields"in t&&typeof t.getFields=="function"}var R$=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:mu.SpanStatusCode.ERROR,message:e.message}),t.end())},y$=(t,e)=>{e&&t.end()};function v$(t,e,n,r=!1){if(o[Fo.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let l=e();if(l.ignoreTrivialResolveSpans&&r&&(pEe(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[Fo.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let p=EEe(l.mergeItems,c&&c.path),d=p.filter(m=>typeof m=="string").length,_,f=!1;if(l.depth>=0&&l.depth<d)_=O$(a,p);else{let{field:m,spanAdded:T}=_Ee(t,e,a,c,p);_=m.span,f=T}return mu.context.with(mu.trace.setSpan(mu.context.active(),_),()=>{try{let m=n.call(this,s,i,a,c);return(0,mt.isPromise)(m)?m.then(T=>(y$(_,f),T),T=>{throw R$(_,T,f),T}):(y$(_,f),m)}catch(m){throw R$(_,m,f),m}})}return o[Fo.OTEL_PATCHED_SYMBOL]=!0,o}mt.wrapFieldResolver=v$});var D$=E(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.PACKAGE_NAME=Tu.PACKAGE_VERSION=void 0;Tu.PACKAGE_VERSION="0.62.0";Tu.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var k$=E(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.GraphQLInstrumentation=void 0;var qo=(b(),N(v)),ar=ne(),rd=ZN(),Nh=eO(),nO=yh(),yEe=S$(),Kt=L$(),U$=D$(),w$={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},Oh=[">=14.0.0 <17"],rO=class extends ar.InstrumentationBase{constructor(e={}){super(U$.PACKAGE_NAME,U$.PACKAGE_VERSION,{...w$,...e})}setConfig(e={}){super.setConfig({...w$,...e})}init(){let e=new ar.InstrumentationNodeModuleDefinition("graphql",Oh);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new ar.InstrumentationNodeModuleFile("graphql/execution/execute.js",Oh,e=>((0,ar.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 ar.InstrumentationNodeModuleFile("graphql/language/parser.js",Oh,e=>((0,ar.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new ar.InstrumentationNodeModuleFile("graphql/validation/validate.js",Oh,e=>((0,ar.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 l=arguments;i=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],e)}else{let l=arguments[0];i=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,e)}let a=(0,Kt.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[nO.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[nO.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},qo.context.with(qo.trace.setSpan(qo.context.active(),c),()=>(0,ar.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(l,p)=>{n._handleExecutionResult(c,l,p)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,Kt.endSpan)(e,n);return}if((0,Kt.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,Kt.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,Kt.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,Kt.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,ar.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,Kt.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,l){return e._validate(this,r,s,i,a,l,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(rd.SpanNames.PARSE);return qo.context.with(qo.trace.setSpan(qo.context.active(),i),()=>(0,ar.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,Kt.getOperation)(c)?c.loc&&(0,Kt.addSpanSource)(i,c.loc,s.allowValues):i.updateName(rd.SpanNames.SCHEMA_PARSE)),(0,Kt.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(rd.SpanNames.VALIDATE,{});return qo.context.with(qo.trace.setSpan(qo.context.active(),c),()=>(0,ar.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(l,p)=>{o.loc||c.updateName(rd.SpanNames.SCHEMA_VALIDATE),p&&p.length&&c.recordException({name:Nh.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(p)}),(0,Kt.endSpan)(c,l)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(rd.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(Nh.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(Nh.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=yEe.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(Nh.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,Kt.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,Kt.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,l){if(o||(o={}),o[nO.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 p=a==null,d=a??l;return a=(0,Kt.wrapFieldResolver)(this.tracer,()=>this.getConfig(),d,p),e&&((0,Kt.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,Kt.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};bh.GraphQLInstrumentation=rO});var G$=E(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.GraphQLInstrumentation=void 0;var IEe=k$();Object.defineProperty(Ch,"GraphQLInstrumentation",{enumerable:!0,get:function(){return IEe.GraphQLInstrumentation}})});var q$=E(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.EVENT_LISTENERS_SET=void 0;Ph.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var $$=E(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.bufferTextMapGetter=void 0;Mh.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 Y$=E(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.METRIC_MESSAGING_PROCESS_DURATION=_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=_e.MESSAGING_SYSTEM_VALUE_KAFKA=_e.MESSAGING_OPERATION_TYPE_VALUE_SEND=_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=_e.ATTR_MESSAGING_SYSTEM=_e.ATTR_MESSAGING_OPERATION_TYPE=_e.ATTR_MESSAGING_OPERATION_NAME=_e.ATTR_MESSAGING_KAFKA_OFFSET=_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=_e.ATTR_MESSAGING_DESTINATION_NAME=_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";_e.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";_e.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";_e.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";_e.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";_e.ATTR_MESSAGING_SYSTEM="messaging.system";_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";_e.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";_e.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";_e.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var W$=E(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.PACKAGE_NAME=hu.PACKAGE_VERSION=void 0;hu.PACKAGE_VERSION="0.23.0";hu.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var Z$=E(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.KafkaJsInstrumentation=void 0;var ye=(b(),N(v)),cr=ne(),Eu=(le(),N(Ae)),z$=q$(),K$=$$(),G=Y$(),Q$=W$();function xh(t,e,n){return r=>{t.add(e,{...n,...r?{[Eu.ATTR_ERROR_TYPE]:r}:{}})}}function X$(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[Eu.ATTR_ERROR_TYPE]:r}:{}})}}var J$=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],oO=class extends cr.InstrumentationBase{constructor(e={}){super(Q$.PACKAGE_NAME,Q$.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(G.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:J$}}),this._sentMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(G.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:J$}})}init(){let e=r=>{(0,cr.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,cr.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new cr.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,cr.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[z$.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[z$.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[n,r]=e.payload.broker.split(":");this._clientDuration.record(e.payload.duration/1e3,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[Eu.ATTR_SERVER_ADDRESS]:n,[Eu.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,cr.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,cr.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,cr.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,cr.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,cr.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=ye.propagation.extract(ye.ROOT_CONTEXT,s.message.headers,K$.bufferTextMapGetter),a=e._startConsumerSpan({topic:s.topic,message:s.message,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:i,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}}),c=[X$(e._processDuration,Date.now(),{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}),xh(e._consumedMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)})],l=ye.context.with(ye.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c,l)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan({topic:s.batch.topic,message:void 0,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:ye.ROOT_CONTEXT,attributes:{[G.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return ye.context.with(ye.trace.setSpan(ye.context.active(),i),()=>{let a=Date.now(),c=[],l=[xh(n._consumedMessages,s.batch.messages.length,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)})];s.batch.messages.forEach(d=>{let _=ye.propagation.extract(ye.ROOT_CONTEXT,d.headers,K$.bufferTextMapGetter),f=ye.trace.getSpan(_)?.spanContext(),m;f&&(m={context:f}),c.push(n._startConsumerSpan({topic:s.batch.topic,message:d,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:m,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}})),l.push(X$(n._processDuration,a,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}))});let p=e.apply(this,o);return c.unshift(i),n._endSpansOnPromise(c,l,p)})}}}_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(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendPatch()(c).apply(this,f).catch(T=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:T?.message}),s.recordException(T),T}))};let l=a.sendBatch;a.sendBatch=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendBatchPatch()(l).apply(this,f).catch(T=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:T?.message}),s.recordException(T),T}))};let p=a.commit;a.commit=function(...f){let m=p.apply(this,f).then(()=>{s.setStatus({code:ye.SpanStatusCode.OK})});return e._endSpansOnPromise([s],[],m)};let d=a.abort;a.abort=function(...f){let m=d.apply(this,f);return e._endSpansOnPromise([s],[],m)}}).catch(a=>{s.setStatus({code:ye.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(p=>{p.messages.forEach(d=>{a.push(e._startProducerSpan(p.topic,d)),c.push(xh(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...d.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(d.partition)}:{}}))})});let l=n.apply(this,o);return e._endSpansOnPromise(a,c,l)}}_getSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(l=>e._startProducerSpan(s.topic,l)),a=s.messages.map(l=>xh(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,...l.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(l.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=Eu.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(Eu.ATTR_ERROR_TYPE,i),a.setStatus({code:ye.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===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?"poll":r,c=this.tracer.startSpan(`${a} ${e}`,{kind:r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?ye.SpanKind.CLIENT:ye.SpanKind.CONSUMER,attributes:{...i,[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_OPERATION_TYPE]:r,[G.ATTR_MESSAGING_OPERATION_NAME]:a,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n?.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n?.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_KAFKA_OFFSET]:n?.offset},links:s?[s]:[]},o),{consumerHook:l}=this.getConfig();return l&&n&&(0,cr.safeExecuteInTheMiddle)(()=>l(c,{topic:e,message:n}),p=>{p&&this._diag.error("consumerHook error",p)},!0),c}_startProducerSpan(e,n){let r=this.tracer.startSpan(`send ${e}`,{kind:ye.SpanKind.PRODUCER,attributes:{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:n.partition!==void 0?String(n.partition):void 0,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_OPERATION_TYPE]:G.MESSAGING_OPERATION_TYPE_VALUE_SEND}});n.headers=n.headers??{},ye.propagation.inject(ye.trace.setSpan(ye.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,cr.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};vh.KafkaJsInstrumentation=oO});var eY=E(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.KafkaJsInstrumentation=void 0;var bEe=Z$();Object.defineProperty(Lh,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return bEe.KafkaJsInstrumentation}})});var sY=E(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.PACKAGE_NAME=Su.PACKAGE_VERSION=void 0;Su.PACKAGE_VERSION="0.58.0";Su.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var uY=E(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.LruMemoizerInstrumentation=void 0;var iY=(b(),N(v)),aY=ne(),cY=sY(),sO=class extends aY.InstrumentationBase{constructor(e={}){super(cY.PACKAGE_NAME,cY.PACKAGE_VERSION,e)}init(){return[new aY.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <4"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?iY.context.bind(iY.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};Dh.LruMemoizerInstrumentation=sO});var lY=E(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.LruMemoizerInstrumentation=void 0;var PEe=uY();Object.defineProperty(Uh,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return PEe.LruMemoizerInstrumentation}})});var mY=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.METRIC_DB_CLIENT_CONNECTIONS_USAGE=De.DB_SYSTEM_VALUE_MONGODB=De.DB_SYSTEM_NAME_VALUE_MONGODB=De.ATTR_NET_PEER_PORT=De.ATTR_NET_PEER_NAME=De.ATTR_DB_SYSTEM=De.ATTR_DB_STATEMENT=De.ATTR_DB_OPERATION=De.ATTR_DB_NAME=De.ATTR_DB_MONGODB_COLLECTION=De.ATTR_DB_CONNECTION_STRING=void 0;De.ATTR_DB_CONNECTION_STRING="db.connection_string";De.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";De.ATTR_DB_NAME="db.name";De.ATTR_DB_OPERATION="db.operation";De.ATTR_DB_STATEMENT="db.statement";De.ATTR_DB_SYSTEM="db.system";De.ATTR_NET_PEER_NAME="net.peer.name";De.ATTR_NET_PEER_PORT="net.peer.port";De.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";De.DB_SYSTEM_VALUE_MONGODB="mongodb";De.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var TY=E(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.MongodbCommandType=void 0;var xEe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(xEe=od.MongodbCommandType||(od.MongodbCommandType={}))});var hY=E(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.PACKAGE_NAME=gu.PACKAGE_VERSION=void 0;gu.PACKAGE_VERSION="0.67.0";gu.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var gY=E(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.MongoDBInstrumentation=void 0;var we=(b(),N(v)),fe=ne(),$o=(le(),N(Ae)),Fn=mY(),ca=TY(),EY=hY(),SY={requireParentSpan:!0},iO=class t extends fe.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(EY.PACKAGE_NAME,EY.PACKAGE_VERSION,{...SY,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,fe.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,fe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...SY,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter(Fn.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:l}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:p,v4UnpatchSessions:d}=this._getV4SessionsPatches();return[new fe.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new fe.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,l),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new fe.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],p,d)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,fe.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,fe.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,fe.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,fe.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,fe.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,fe.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,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,fe.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,fe.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,fe.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=we.context.bind(we.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,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,fe.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,l){let p=we.trace.getSpan(we.context.active()),d=n._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,l);let f=n._getV3SpanAttributes(i,s,a[0],e),m=n._spanNameFromAttrs(f),T=n.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),h=n._patchEnd(T,_);return typeof c=="function"?r.call(this,s,i,a,h):r.call(this,s,i,a,c,h)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let l=we.trace.getSpan(we.context.active()),p=e._checkSkipInstrumentation(l),d=typeof a=="function"?a:c;if(p||typeof d!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let _=t._getCommandType(i),f=_===ca.MongodbCommandType.UNKNOWN?void 0:_,m=e._getV3SpanAttributes(s,o,i,f),T=e._spanNameFromAttrs(m),h=e.tracer.startSpan(T,{kind:we.SpanKind.CLIENT,attributes:m}),S=e._patchEnd(h,d);return typeof a=="function"?n.call(this,o,s,i,S):n.call(this,o,s,i,a,S)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=we.trace.getSpan(we.context.active()),l=e._checkSkipInstrumentation(c),p=a,d=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let _;if(!l){let m=e._getV4SpanAttributes(this,o,s,d),T=e._spanNameFromAttrs(m);_=e.tracer.startSpan(T,{kind:we.SpanKind.CLIENT,attributes:m})}let f=e._patchEnd(_,p,this.id,d);return n.call(this,o,s,i,f)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=we.trace.getSpan(we.context.active()),c=e._checkSkipInstrumentation(a),l=Object.keys(i)[0],p=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let d;if(!c){let m=e._getV4SpanAttributes(this,s,i,l),T=e._spanNameFromAttrs(m);d=e.tracer.startSpan(T,{kind:we.SpanKind.CLIENT,attributes:m})}let _=e._patchEnd(d,p,this.id,l),f=n.apply(this,o);return f.then(m=>_(null,m),m=>_(m)),f}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i,"find"),m=e._spanNameFromAttrs(f),T=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),h=e._patchEnd(T,_);return typeof c=="function"?n.call(this,o,s,i,a,h):n.call(this,o,s,i,a,c,h)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i.cmd,"getMore"),m=e._spanNameFromAttrs(f),T=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),h=e._patchEnd(T,_);return typeof c=="function"?n.call(this,o,s,i,a,h):n.call(this,o,s,i,a,c,h)}}static _getCommandType(e){return e.createIndexes!==void 0?ca.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?ca.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?ca.MongodbCommandType.IS_MASTER:e.count!==void 0?ca.MongodbCommandType.COUNT:e.aggregate!==void 0?ca.MongodbCommandType.AGGREGATE:ca.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 p=n.description?.address;if(p){let d=p.split(":");s=d[0],i=d[1]}}let[a,c]=e.toString().split("."),l=r?.query??r?.q??r;return this._getSpanAttributes(a,c,s,i,l,o)}_getSpanAttributes(e,n,r,o,s,i){let a={};if(this._dbSemconvStability&fe.SemconvStability.OLD&&(a[Fn.ATTR_DB_SYSTEM]=Fn.DB_SYSTEM_VALUE_MONGODB,a[Fn.ATTR_DB_NAME]=e,a[Fn.ATTR_DB_MONGODB_COLLECTION]=n,a[Fn.ATTR_DB_OPERATION]=i,a[Fn.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[$o.ATTR_DB_SYSTEM_NAME]=Fn.DB_SYSTEM_NAME_VALUE_MONGODB,a[$o.ATTR_DB_NAMESPACE]=e,a[$o.ATTR_DB_OPERATION_NAME]=i,a[$o.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&fe.SemconvStability.OLD&&(a[Fn.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[$o.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&fe.SemconvStability.OLD&&(a[Fn.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[$o.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),l=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,fe.safeExecuteInTheMiddle)(()=>{let p=l(s);this._dbSemconvStability&fe.SemconvStability.OLD&&(a[Fn.ATTR_DB_STATEMENT]=p),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[$o.ATTR_DB_QUERY_TEXT]=p)},p=>{p&&this._diag.error("Error running dbStatementSerializer hook",p)},!0)}return a}_spanNameFromAttrs(e){let n;return this._dbSemconvStability&fe.SemconvStability.STABLE?n=[e[$o.ATTR_DB_OPERATION_NAME],e[$o.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||Fn.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[Fn.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,fe.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=we.context.active(),i=this,a=!1;return function(...l){if(!a){a=!0;let p=l[0];if(e){if(p instanceof Error)e.setStatus({code:we.SpanStatusCode.ERROR,message:p.message});else{let d=l[1];i._handleExecutionResult(e,d)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return we.context.with(s,()=>n.apply(this,l))}}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}};wh.MongoDBInstrumentation=iO});var AY=E(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.MongodbCommandType=void 0;var vEe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(vEe=sd.MongodbCommandType||(sd.MongodbCommandType={}))});var RY=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.MongodbCommandType=Au.MongoDBInstrumentation=void 0;var LEe=gY();Object.defineProperty(Au,"MongoDBInstrumentation",{enumerable:!0,get:function(){return LEe.MongoDBInstrumentation}});var DEe=AY();Object.defineProperty(Au,"MongodbCommandType",{enumerable:!0,get:function(){return DEe.MongodbCommandType}})});var cO=E(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.DB_SYSTEM_NAME_VALUE_MONGODB=at.ATTR_NET_PEER_PORT=at.ATTR_NET_PEER_NAME=at.ATTR_DB_USER=at.ATTR_DB_SYSTEM=at.ATTR_DB_STATEMENT=at.ATTR_DB_OPERATION=at.ATTR_DB_NAME=at.ATTR_DB_MONGODB_COLLECTION=void 0;at.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";at.ATTR_DB_NAME="db.name";at.ATTR_DB_OPERATION="db.operation";at.ATTR_DB_STATEMENT="db.statement";at.ATTR_DB_SYSTEM="db.system";at.ATTR_DB_USER="db.user";at.ATTR_NET_PEER_NAME="net.peer.name";at.ATTR_NET_PEER_PORT="net.peer.port";at.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var PY=E(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.handleCallbackResponse=Fs.handlePromiseResponse=Fs.getAttributesFromCollection=void 0;var bY=(b(),N(v)),ad=ne(),id=cO(),kh=(le(),N(Ae));function jEe(t,e,n){let r={};return e&ad.SemconvStability.OLD&&(r[id.ATTR_DB_MONGODB_COLLECTION]=t.name,r[id.ATTR_DB_NAME]=t.conn.name,r[id.ATTR_DB_USER]=t.conn.user),e&ad.SemconvStability.STABLE&&(r[kh.ATTR_DB_COLLECTION_NAME]=t.name,r[kh.ATTR_DB_NAMESPACE]=t.conn.name),n&ad.SemconvStability.OLD&&(r[id.ATTR_NET_PEER_NAME]=t.conn.host,r[id.ATTR_NET_PEER_PORT]=t.conn.port),n&ad.SemconvStability.STABLE&&(r[kh.ATTR_SERVER_ADDRESS]=t.conn.host,r[kh.ATTR_SERVER_PORT]=t.conn.port),r}Fs.getAttributesFromCollection=jEe;function CY(t,e={}){t.recordException(e),t.setStatus({code:bY.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
|
|
11
|
+
Mongoose Error Code: ${e.code}`:""}`})}function uO(t,e,n,r=void 0){n&&(0,ad.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&bY.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function HEe(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(uO(e,o,n,r),o)).catch(o=>{throw CY(e,o),o}).finally(()=>e.end()):(uO(e,t,n,r),e.end(),t)}Fs.handlePromiseResponse=HEe;function VEe(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,l)=>(c?CY(r,c):uO(r,l,s,i),r.end(),t(c,l)),e.apply(n,o)}Fs.handleCallbackResponse=VEe});var MY=E(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.PACKAGE_NAME=Ru.PACKAGE_VERSION=void 0;Ru.PACKAGE_VERSION="0.60.0";Ru.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var UY=E(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.MongooseInstrumentation=On._ALREADY_INSTRUMENTED=On._STORED_PARENT_SPAN=void 0;var Tt=(b(),N(v)),FEe=he(),lO=PY(),Gt=ne(),xY=MY(),qs=cO(),ua=(le(),N(Ae)),Gh=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],qEe=["remove","count","findOneAndRemove",...Gh],$Ee=["count","findOneAndRemove",...Gh],YEe=[...Gh];function vY(t){return t?t.startsWith("6.")||t.startsWith("5.")?qEe:t.startsWith("7.")?$Ee:YEe:Gh}function LY(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function DY(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}On._STORED_PARENT_SPAN=Symbol("stored-parent-span");On._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var pO=class extends Gt.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(xY.PACKAGE_NAME,xY.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Gt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Gt.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new Gt.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <10"],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,LY(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),DY(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)),vY(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=vY(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,LY(n)&&this._unwrap(r.Model.prototype,"remove"),DY(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&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[On._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&Gt.SemconvStability.OLD&&(a[qs.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&Gt.SemconvStability.STABLE&&(a[ua.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[On._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[On._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&Gt.SemconvStability.OLD&&(a[qs.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&Gt.SemconvStability.STABLE&&(a[ua.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let l={},{dbStatementSerializer:p}=r.getConfig();if(p){let _=p(e,c);r._dbSemconvStability&Gt.SemconvStability.OLD&&(l[qs.ATTR_DB_STATEMENT]=_),r._dbSemconvStability&Gt.SemconvStability.STABLE&&(l[ua.ATTR_DB_QUERY_TEXT]=_)}let d=r._startSpan(this.constructor.collection,this.constructor.modelName,e,l);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(d,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let l=c,p=i,d=a;typeof i=="function"?(l=i,p=void 0,d=void 0):typeof a=="function"&&(l=a,d=void 0);let _={},f=r.getConfig().dbStatementSerializer;if(f){let h=f(e,{condition:{_id:this._id},updates:p,options:d});r._dbSemconvStability&Gt.SemconvStability.OLD&&(_[qs.ATTR_DB_STATEMENT]=h),r._dbSemconvStability&Gt.SemconvStability.STABLE&&(_[ua.ATTR_DB_QUERY_TEXT]=h)}let m=r._startSpan(this.constructor.collection,this.constructor.modelName,e,_),T=r._handleResponse(m,o,this,arguments,l,n);return T&&typeof T=="object"&&(T[On._ALREADY_INSTRUMENTED]=!0),T}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let l={};switch(e){case"insertMany":l.documents=i;break;case"bulkWrite":l.operations=i;break;default:l.document=i;break}a!==void 0&&(l.options=a);let p={},{dbStatementSerializer:d}=r.getConfig();if(d){let f=d(e,l);r._dbSemconvStability&Gt.SemconvStability.OLD&&(p[qs.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&Gt.SemconvStability.STABLE&&(p[ua.ATTR_DB_QUERY_TEXT]=f)}let _=r._startSpan(this.collection,this.modelName,e,p);return r._handleResponse(_,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=Tt.trace.getSpan(Tt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[On._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[On._STORED_PARENT_SPAN]=Tt.trace.getSpan(Tt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,lO.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&Gt.SemconvStability.OLD&&(i[qs.ATTR_DB_OPERATION]=r,i[qs.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&Gt.SemconvStability.STABLE&&(i[ua.ATTR_DB_OPERATION_NAME]=r,i[ua.ATTR_DB_SYSTEM_NAME]=qs.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&Gt.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Tt.SpanKind.CLIENT,attributes:i},s?Tt.trace.setSpan(Tt.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,lO.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,lO.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Tt.context.with((0,FEe.suppressTracing)(Tt.context.active()),e):e()}};On.MongooseInstrumentation=pO});var wY=E(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.MongooseInstrumentation=void 0;var WEe=UY();Object.defineProperty(Bh,"MongooseInstrumentation",{enumerable:!0,get:function(){return WEe.MongooseInstrumentation}})});var HY=E(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE=ct.DB_SYSTEM_VALUE_MYSQL=ct.ATTR_NET_PEER_PORT=ct.ATTR_NET_PEER_NAME=ct.ATTR_DB_USER=ct.ATTR_DB_SYSTEM=ct.ATTR_DB_STATEMENT=ct.ATTR_DB_NAME=ct.ATTR_DB_CONNECTION_STRING=void 0;ct.ATTR_DB_CONNECTION_STRING="db.connection_string";ct.ATTR_DB_NAME="db.name";ct.ATTR_DB_STATEMENT="db.statement";ct.ATTR_DB_SYSTEM="db.system";ct.ATTR_DB_USER="db.user";ct.ATTR_NET_PEER_NAME="net.peer.name";ct.ATTR_NET_PEER_PORT="net.peer.port";ct.DB_SYSTEM_VALUE_MYSQL="mysql";ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var VY=E(cd=>{"use strict";Object.defineProperty(cd,"__esModule",{value:!0});cd.AttributeNames=void 0;var KEe;(function(t){t.MYSQL_VALUES="db.mysql.values"})(KEe=cd.AttributeNames||(cd.AttributeNames={}))});var FY=E(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.getPoolNameOld=Qt.arrayStringifyHelper=Qt.getSpanName=Qt.getDbValues=Qt.getDbQueryText=Qt.getJDBCString=Qt.getConfig=void 0;function QEe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}Qt.getConfig=QEe;function XEe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}Qt.getJDBCString=XEe;function JEe(t){return typeof t=="string"?t:t.sql}Qt.getDbQueryText=JEe;function ZEe(t,e){return dO(typeof t=="string"?e:e||t.values)}Qt.getDbValues=ZEe;function eSe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}Qt.getSpanName=eSe;function dO(t){return t?`[${t.toString()}]`:""}Qt.arrayStringifyHelper=dO;function tSe(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()}Qt.getPoolNameOld=tSe});var qY=E(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.PACKAGE_NAME=yu.PACKAGE_VERSION=void 0;yu.PACKAGE_VERSION="0.60.0";yu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var YY=E(jh=>{"use strict";Object.defineProperty(jh,"__esModule",{value:!0});jh.MySQLInstrumentation=void 0;var bn=(b(),N(v)),ur=ne(),Iu=(le(),N(Ae)),Yo=HY(),nSe=VY(),la=FY(),$Y=qY(),_O=class extends ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super($Y.PACKAGE_NAME,$Y.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Yo.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 ur.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,ur.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,ur.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,ur.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,l=(0,la.getPoolNameOld)(e);r._connCountAdd(-c,l,"used"),r._connCountAdd(-a,l,"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),l=a[c].pool;r._setPoolCallbacks(l,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=bn.context.active();return function(o,s){s&&((0,ur.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&bn.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:l,database:p,user:d}=(0,la.getConfig)(e.config),_=parseInt(l,10),f=(0,la.getDbQueryText)(o);r._dbSemconvStability&ur.SemconvStability.OLD&&(a[Yo.ATTR_DB_SYSTEM]=Yo.DB_SYSTEM_VALUE_MYSQL,a[Yo.ATTR_DB_CONNECTION_STRING]=(0,la.getJDBCString)(c,l,p),a[Yo.ATTR_DB_NAME]=p,a[Yo.ATTR_DB_USER]=d,a[Yo.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&ur.SemconvStability.STABLE&&(a[Iu.ATTR_DB_SYSTEM_NAME]=Iu.DB_SYSTEM_NAME_VALUE_MYSQL,a[Iu.ATTR_DB_NAMESPACE]=p,a[Iu.ATTR_DB_QUERY_TEXT]=f),r._netSemconvStability&ur.SemconvStability.OLD&&(a[Yo.ATTR_NET_PEER_NAME]=c,isNaN(_)||(a[Yo.ATTR_NET_PEER_PORT]=_)),r._netSemconvStability&ur.SemconvStability.STABLE&&(a[Iu.ATTR_SERVER_ADDRESS]=c,isNaN(_)||(a[Iu.ATTR_SERVER_PORT]=_));let m=r.tracer.startSpan((0,la.getSpanName)(o),{kind:bn.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let S;Array.isArray(s)?S=s:arguments[2]&&(S=[s]),m.setAttribute(nSe.AttributeNames.MYSQL_VALUES,(0,la.getDbValues)(o,S))}let T=Array.from(arguments).findIndex(S=>typeof S=="function"),h=bn.context.active();if(T===-1){let S=bn.context.with(bn.trace.setSpan(bn.context.active(),m),()=>n.apply(e,arguments));return bn.context.bind(h,S),S.on("error",R=>m.setStatus({code:bn.SpanStatusCode.ERROR,message:R.message})).on("end",()=>{m.end()})}else return r._wrap(arguments,T,r._patchCallbackQuery(m,h)),bn.context.with(bn.trace.setSpan(bn.context.active(),m),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:bn.SpanStatusCode.ERROR,message:o.message}),e.end(),bn.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,la.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")})}};jh.MySQLInstrumentation=_O});var WY=E(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.MySQLInstrumentation=void 0;var rSe=YY();Object.defineProperty(Hh,"MySQLInstrumentation",{enumerable:!0,get:function(){return rSe.MySQLInstrumentation}})});var fO=E(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});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"});var TO=E(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.addSqlCommenterComment=void 0;var mO=(b(),N(v)),sSe=he();function iSe(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function aSe(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function cSe(t,e){if(typeof e!="string"||e.length===0||iSe(e))return e;let n=new sSe.W3CTraceContextPropagator,r={};n.inject(mO.trace.setSpan(mO.ROOT_CONTEXT,t),r,mO.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=aSe(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}Vh.addSqlCommenterComment=cSe});var JY=E(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.getConnectionPrototypeToInstrument=lr.once=lr.getSpanName=lr.getQueryText=lr.getConnectionAttributes=void 0;var ud=fO(),Fh=ne(),hO=(le(),N(Ae));function uSe(t,e,n){let{host:r,port:o,database:s,user:i}=lSe(t),a={};e&Fh.SemconvStability.OLD&&(a[ud.ATTR_DB_CONNECTION_STRING]=pSe(r,o,s),a[ud.ATTR_DB_NAME]=s,a[ud.ATTR_DB_USER]=i),e&Fh.SemconvStability.STABLE&&(a[hO.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&Fh.SemconvStability.OLD&&(a[ud.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[ud.ATTR_NET_PEER_PORT]=c)),n&Fh.SemconvStability.STABLE&&(a[hO.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[hO.ATTR_SERVER_PORT]=c)),a}lr.getConnectionAttributes=uSe;function lSe(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function pSe(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function dSe(t,e,n,r=!1,o=_Se){let[s,i]=typeof t=="string"?[t,n]:[t.sql,fSe(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"}}lr.getQueryText=dSe;function _Se(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function fSe(t){return"values"in t}function mSe(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}lr.getSpanName=mSe;var TSe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};lr.once=TSe;function hSe(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}lr.getConnectionPrototypeToInstrument=hSe});var ZY=E(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.PACKAGE_NAME=Nu.PACKAGE_VERSION=void 0;Nu.PACKAGE_VERSION="0.60.0";Nu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var rW=E(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.MySQL2Instrumentation=void 0;var eW=(b(),N(v)),vr=ne(),EO=fO(),tW=TO(),Ou=JY(),nW=ZY(),SO=(le(),N(Ae)),gO=[">=1.4.2 <4"],AO=class extends vr.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(nW.PACKAGE_NAME,nW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,vr.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,vr.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,vr.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,vr.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 vr.InstrumentationNodeModuleDefinition("mysql2",gO,s=>(n(s),s),()=>{},[new vr.InstrumentationNodeModuleFile("mysql2/promise.js",gO,s=>(n(s),s),()=>{}),new vr.InstrumentationNodeModuleFile("mysql2/lib/connection.js",gO,s=>{let i=(0,Ou.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,Ou.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:l,maskStatementHook:p,responseHook:d}=o.getConfig(),_=(0,Ou.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),f=(0,Ou.getQueryText)(s,e,c,l,p);o._dbSemconvStability&vr.SemconvStability.OLD&&(_[EO.ATTR_DB_SYSTEM]=EO.DB_SYSTEM_VALUE_MYSQL,_[EO.ATTR_DB_STATEMENT]=f),o._dbSemconvStability&vr.SemconvStability.STABLE&&(_[SO.ATTR_DB_SYSTEM_NAME]=SO.DB_SYSTEM_NAME_VALUE_MYSQL,_[SO.ATTR_DB_QUERY_TEXT]=f);let m=o.tracer.startSpan((0,Ou.getSpanName)(s),{kind:eW.SpanKind.CLIENT,attributes:_});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,tW.addSqlCommenterComment)(m,s):Object.assign(s,{sql:(0,tW.addSqlCommenterComment)(m,s.sql)}));let T=(0,Ou.once)((h,S)=>{h?m.setStatus({code:eW.SpanStatusCode.ERROR,message:h.message}):typeof d=="function"&&(0,vr.safeExecuteInTheMiddle)(()=>{d(m,{queryResults:S})},R=>{R&&o._diag.warn("Failed executing responseHook",R)},!0),m.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(T));let h=r.apply(this,arguments);return h.once("error",S=>{T(S)}).once("result",S=>{T(void 0,S)}),h}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(T)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(T)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};qh.MySQL2Instrumentation=AO});var oW=E($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.MySQL2Instrumentation=void 0;var ESe=rW();Object.defineProperty($h,"MySQL2Instrumentation",{enumerable:!0,get:function(){return ESe.MySQL2Instrumentation}})});var uW=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.DB_SYSTEM_VALUE_REDIS=Xt.DB_SYSTEM_NAME_VALUE_REDIS=Xt.ATTR_NET_PEER_PORT=Xt.ATTR_NET_PEER_NAME=Xt.ATTR_DB_SYSTEM=Xt.ATTR_DB_STATEMENT=Xt.ATTR_DB_CONNECTION_STRING=void 0;Xt.ATTR_DB_CONNECTION_STRING="db.connection_string";Xt.ATTR_DB_STATEMENT="db.statement";Xt.ATTR_DB_SYSTEM="db.system";Xt.ATTR_NET_PEER_NAME="net.peer.name";Xt.ATTR_NET_PEER_PORT="net.peer.port";Xt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Xt.DB_SYSTEM_VALUE_REDIS="redis"});var lW=E(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.endSpan=void 0;var gSe=(b(),N(v)),ASe=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:gSe.SpanStatusCode.ERROR,message:e.message})),t.end()};Yh.endSpan=ASe});var zh=E(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.defaultDbStatementSerializer=void 0;var RSe=[{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}],ySe=(t,e)=>{if(Array.isArray(e)&&e.length){let n=RSe.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};Wh.defaultDbStatementSerializer=ySe});var pW=E(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.PACKAGE_NAME=bu.PACKAGE_VERSION=void 0;bu.PACKAGE_VERSION="0.62.0";bu.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var mW=E(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.IORedisInstrumentation=void 0;var $s=(b(),N(v)),Cn=ne(),Ys=(le(),N(Ae)),Pn=uW(),dW=ne(),ld=lW(),ISe=zh(),_W=pW(),fW={requireParentSpan:!0},RO=class extends Cn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(_W.PACKAGE_NAME,_W.PACKAGE_VERSION,{...fW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Cn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Cn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...fW,...e})}init(){return[new Cn.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Cn.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Cn.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||ISe.defaultDbStatementSerializer,a=$s.trace.getSpan($s.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:l,port:p}=this.options,d=i(o.name,o.args);r._dbSemconvStability&Cn.SemconvStability.OLD&&(c[Pn.ATTR_DB_SYSTEM]=Pn.DB_SYSTEM_VALUE_REDIS,c[Pn.ATTR_DB_STATEMENT]=d,c[Pn.ATTR_DB_CONNECTION_STRING]=`redis://${l}:${p}`),r._dbSemconvStability&Cn.SemconvStability.STABLE&&(c[Ys.ATTR_DB_SYSTEM_NAME]=Pn.DB_SYSTEM_NAME_VALUE_REDIS,c[Ys.ATTR_DB_QUERY_TEXT]=d),r._netSemconvStability&Cn.SemconvStability.OLD&&(c[Pn.ATTR_NET_PEER_NAME]=l,c[Pn.ATTR_NET_PEER_PORT]=p),r._netSemconvStability&Cn.SemconvStability.STABLE&&(c[Ys.ATTR_SERVER_ADDRESS]=l,c[Ys.ATTR_SERVER_PORT]=p);let _=r.tracer.startSpan(o.name,{kind:$s.SpanKind.CLIENT,attributes:c}),{requestHook:f}=s;f&&(0,dW.safeExecuteInTheMiddle)(()=>f(_,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),m=>{m&&$s.diag.error("ioredis instrumentation: request hook failed",m)},!0);try{let m=e.apply(this,arguments),T=o.resolve;o.resolve=function(S){(0,dW.safeExecuteInTheMiddle)(()=>s.responseHook?.(_,o.name,o.args,S),R=>{R&&$s.diag.error("ioredis instrumentation: response hook failed",R)},!0),(0,ld.endSpan)(_,null),T(S)};let h=o.reject;return o.reject=function(S){(0,ld.endSpan)(_,S),h(S)},m}catch(m){throw(0,ld.endSpan)(_,m),m}}}_traceConnection(e){let n=this;return function(){let r=$s.trace.getSpan($s.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&Cn.SemconvStability.OLD&&(o[Pn.ATTR_DB_SYSTEM]=Pn.DB_SYSTEM_VALUE_REDIS,o[Pn.ATTR_DB_STATEMENT]="connect",o[Pn.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Cn.SemconvStability.STABLE&&(o[Ys.ATTR_DB_SYSTEM_NAME]=Pn.DB_SYSTEM_NAME_VALUE_REDIS,o[Ys.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Cn.SemconvStability.OLD&&(o[Pn.ATTR_NET_PEER_NAME]=s,o[Pn.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Cn.SemconvStability.STABLE&&(o[Ys.ATTR_SERVER_ADDRESS]=s,o[Ys.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:$s.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,ld.endSpan)(a,null),c}catch(c){throw(0,ld.endSpan)(a,c),c}}}};Kh.IORedisInstrumentation=RO});var TW=E(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.IORedisInstrumentation=void 0;var NSe=mW();Object.defineProperty(Qh,"IORedisInstrumentation",{enumerable:!0,get:function(){return NSe.IORedisInstrumentation}})});var Xh=E(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.PACKAGE_NAME=Cu.PACKAGE_VERSION=void 0;Cu.PACKAGE_VERSION="0.62.0";Cu.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var hW=E(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.getTracedCreateStreamTrace=Ws.getTracedCreateClient=Ws.endSpan=void 0;var pd=(b(),N(v)),OSe=(t,e)=>{e&&t.setStatus({code:pd.SpanStatusCode.ERROR,message:e.message}),t.end()};Ws.endSpan=OSe;var bSe=t=>function(){let n=t.apply(this,arguments);return pd.context.bind(pd.context.active(),n)};Ws.getTracedCreateClient=bSe;var CSe=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){pd.context.bind(pd.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Ws.getTracedCreateStreamTrace=CSe});var Jh=E(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.DB_SYSTEM_VALUE_REDIS=Jt.DB_SYSTEM_NAME_VALUE_REDIS=Jt.ATTR_NET_PEER_PORT=Jt.ATTR_NET_PEER_NAME=Jt.ATTR_DB_SYSTEM=Jt.ATTR_DB_STATEMENT=Jt.ATTR_DB_CONNECTION_STRING=void 0;Jt.ATTR_DB_CONNECTION_STRING="db.connection_string";Jt.ATTR_DB_STATEMENT="db.statement";Jt.ATTR_DB_SYSTEM="db.system";Jt.ATTR_NET_PEER_NAME="net.peer.name";Jt.ATTR_NET_PEER_PORT="net.peer.port";Jt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Jt.DB_SYSTEM_VALUE_REDIS="redis"});var SW=E(eE=>{"use strict";Object.defineProperty(eE,"__esModule",{value:!0});eE.RedisInstrumentationV2_V3=void 0;var qn=ne(),Zh=hW(),EW=Xh(),dd=(b(),N(v)),_d=(le(),N(Ae)),pa=Jh(),PSe=zh(),yO=class t extends qn.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(EW.PACKAGE_NAME,EW.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,qn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,qn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new qn.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,qn.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,qn.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,qn.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=dd.trace.getSpan(dd.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||PSe.defaultDbStatementSerializer,l={};e._semconvStability&qn.SemconvStability.OLD&&Object.assign(l,{[pa.ATTR_DB_SYSTEM]:pa.DB_SYSTEM_VALUE_REDIS,[pa.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&qn.SemconvStability.STABLE&&Object.assign(l,{[_d.ATTR_DB_SYSTEM_NAME]:pa.DB_SYSTEM_NAME_VALUE_REDIS,[_d.ATTR_DB_OPERATION_NAME]:s.command,[_d.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let p=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:dd.SpanKind.CLIENT,attributes:l});if(this.connection_options){let _={};e._semconvStability&qn.SemconvStability.OLD&&Object.assign(_,{[pa.ATTR_NET_PEER_NAME]:this.connection_options.host,[pa.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&qn.SemconvStability.STABLE&&Object.assign(_,{[_d.ATTR_SERVER_ADDRESS]:this.connection_options.host,[_d.ATTR_SERVER_PORT]:this.connection_options.port}),p.setAttributes(_)}this.address&&e._semconvStability&qn.SemconvStability.OLD&&p.setAttribute(pa.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let d=arguments[0].callback;if(d){let _=dd.context.active();arguments[0].callback=function(m,T){if(i?.responseHook){let h=i.responseHook;(0,qn.safeExecuteInTheMiddle)(()=>{h(p,s.command,s.args,T)},S=>{S&&e._diag.error("Error executing responseHook",S)},!0)}return(0,Zh.endSpan)(p,m),dd.context.with(_,d,this,...arguments)}}try{return r.apply(this,arguments)}catch(_){throw(0,Zh.endSpan)(p,_),_}}}}_getPatchCreateClient(){return function(n){return(0,Zh.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,Zh.getTracedCreateStreamTrace)(n)}}};eE.RedisInstrumentationV2_V3=yO});var AW=E(tE=>{"use strict";Object.defineProperty(tE,"__esModule",{value:!0});tE.getClientAttributes=void 0;var IO=(le(),N(Ae)),Pu=Jh(),gW=ne();function MSe(t,e,n){let r={};return n&gW.SemconvStability.OLD&&Object.assign(r,{[Pu.ATTR_DB_SYSTEM]:Pu.DB_SYSTEM_VALUE_REDIS,[Pu.ATTR_NET_PEER_NAME]:e?.socket?.host,[Pu.ATTR_NET_PEER_PORT]:e?.socket?.port,[Pu.ATTR_DB_CONNECTION_STRING]:xSe(t,e?.url)}),n&gW.SemconvStability.STABLE&&Object.assign(r,{[IO.ATTR_DB_SYSTEM_NAME]:Pu.DB_SYSTEM_NAME_VALUE_REDIS,[IO.ATTR_SERVER_ADDRESS]:e?.socket?.host,[IO.ATTR_SERVER_PORT]:e?.socket?.port}),r}tE.getClientAttributes=MSe;function xSe(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 NW=E(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.RedisInstrumentationV4_V5=void 0;var pr=(b(),N(v)),xe=ne(),RW=AW(),vSe=zh(),yW=Xh(),NO=(le(),N(Ae)),LSe=Jh(),fd=Symbol("opentelemetry.instrumentation.redis.open_spans"),IW=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),OO=class t extends xe.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(yW.PACKAGE_NAME,yW.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.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 xe.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,xe.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,xe.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,xe.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,xe.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,xe.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,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new xe.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,l){let p=e(c,l).args;return n._traceClientCommand(a,this,arguments,p)},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[fd];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[fd];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let l=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,l,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[IW]=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,RW.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:pr.SpanKind.CLIENT,attributes:i});return pr.context.with(pr.trace.setSpan(pr.context.active(),a),()=>r.apply(this)).then(l=>(a.end(),l)).catch(l=>(a.recordException(l),a.setStatus({code:pr.SpanStatusCode.ERROR,message:l.message}),a.end(),Promise.reject(l)))}}}_traceClientCommand(e,n,r,o){if(pr.trace.getSpan(pr.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[IW],a=o[0],c=o.slice(1),l=this.getConfig().dbStatementSerializer||vSe.defaultDbStatementSerializer,p=(0,RW.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&xe.SemconvStability.STABLE&&(p[NO.ATTR_DB_OPERATION_NAME]=a);try{let f=l(a,c);f!=null&&(this._semconvStability&xe.SemconvStability.OLD&&(p[LSe.ATTR_DB_STATEMENT]=f),this._semconvStability&xe.SemconvStability.STABLE&&(p[NO.ATTR_DB_QUERY_TEXT]=f))}catch(f){this._diag.error("dbStatementSerializer throw an exception",f,{commandName:a})}let d=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:pr.SpanKind.CLIENT,attributes:p}),_=pr.context.with(pr.trace.setSpan(pr.context.active(),d),()=>e.apply(n,r));if(typeof _?.then=="function")_.then(f=>{this._endSpanWithResponse(d,a,c,f,void 0)},f=>{this._endSpanWithResponse(d,a,c,null,f)});else{let f=_;f[fd]=f[fd]||[],f[fd].push({span:d,commandName:a,commandArgs:c})}return _}_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:l}=e[a],p=n[a],[d,_]=p instanceof Error?[null,p]:[p,void 0];this._semconvStability&xe.SemconvStability.STABLE&&c.setAttribute(NO.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],l,d,_)}}_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:pr.SpanStatusCode.ERROR,message:s?.message})),e.end()}};nE.RedisInstrumentationV4_V5=OO});var CW=E(rE=>{"use strict";Object.defineProperty(rE,"__esModule",{value:!0});rE.RedisInstrumentation=void 0;var DSe=ne(),OW=Xh(),USe=SW(),wSe=NW(),bW={requireParentSpan:!1},bO=class extends DSe.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...bW,...e};super(OW.PACKAGE_NAME,OW.PACKAGE_VERSION,n),this.instrumentationV2_V3=new USe.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new wSe.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...bW,...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())}};rE.RedisInstrumentation=bO});var PW=E(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});oE.RedisInstrumentation=void 0;var kSe=CW();Object.defineProperty(oE,"RedisInstrumentation",{enumerable:!0,get:function(){return kSe.RedisInstrumentation}})});var BW=E(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.EVENT_LISTENERS_SET=void 0;iE.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var MO=E(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.AttributeNames=void 0;var qSe;(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"})(qSe=hd.AttributeNames||(hd.AttributeNames={}))});var xO=E(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=Se.METRIC_DB_CLIENT_CONNECTION_COUNT=Se.DB_SYSTEM_VALUE_POSTGRESQL=Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED=Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=Se.ATTR_NET_PEER_PORT=Se.ATTR_NET_PEER_NAME=Se.ATTR_DB_USER=Se.ATTR_DB_SYSTEM=Se.ATTR_DB_STATEMENT=Se.ATTR_DB_NAME=Se.ATTR_DB_CONNECTION_STRING=Se.ATTR_DB_CLIENT_CONNECTION_STATE=Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";Se.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";Se.ATTR_DB_CONNECTION_STRING="db.connection_string";Se.ATTR_DB_NAME="db.name";Se.ATTR_DB_STATEMENT="db.statement";Se.ATTR_DB_SYSTEM="db.system";Se.ATTR_DB_USER="db.user";Se.ATTR_NET_PEER_NAME="net.peer.name";Se.ATTR_NET_PEER_PORT="net.peer.port";Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";Se.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";Se.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var vO=E(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.SpanNames=void 0;var $Se;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})($Se=Ed.SpanNames||(Ed.SpanNames={}))});var YW=E(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.sanitizedErrorMessage=me.isObjectWithTextString=me.getErrorMessage=me.patchClientConnectCallback=me.patchCallbackPGPool=me.updateCounter=me.getPoolName=me.patchCallback=me.handleExecutionResult=me.handleConfigQuery=me.shouldSkipInstrumentation=me.getSemanticAttributesFromPoolConnection=me.getSemanticAttributesFromConnection=me.getConnectionString=me.parseAndMaskConnectionString=me.parseNormalizedOperationName=me.getQuerySpanName=void 0;var zs=(b(),N(v)),aE=MO(),dr=(le(),N(Ae)),Fe=xO(),da=ne(),jW=vO();function HW(t,e){if(!e)return jW.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:VW(e.text);return`${jW.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}me.getQuerySpanName=HW;function VW(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}me.parseNormalizedOperationName=VW;function FW(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}me.parseAndMaskConnectionString=FW;function LO(t){if("connectionString"in t&&t.connectionString)return FW(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}me.getConnectionString=LO;function cE(t){if(Number.isInteger(t))return t}function qW(t,e){let n={};return e&da.SemconvStability.OLD&&(n={...n,[Fe.ATTR_DB_SYSTEM]:Fe.DB_SYSTEM_VALUE_POSTGRESQL,[Fe.ATTR_DB_NAME]:t.database,[Fe.ATTR_DB_CONNECTION_STRING]:LO(t),[Fe.ATTR_DB_USER]:t.user,[Fe.ATTR_NET_PEER_NAME]:t.host,[Fe.ATTR_NET_PEER_PORT]:cE(t.port)}),e&da.SemconvStability.STABLE&&(n={...n,[dr.ATTR_DB_SYSTEM_NAME]:dr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[dr.ATTR_DB_NAMESPACE]:t.namespace,[dr.ATTR_SERVER_ADDRESS]:t.host,[dr.ATTR_SERVER_PORT]:cE(t.port)}),n}me.getSemanticAttributesFromConnection=qW;function YSe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[aE.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[aE.AttributeNames.MAX_CLIENT]:t.maxClient};return e&da.SemconvStability.OLD&&(r={...r,[Fe.ATTR_DB_SYSTEM]:Fe.DB_SYSTEM_VALUE_POSTGRESQL,[Fe.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Fe.ATTR_DB_CONNECTION_STRING]:LO(t),[Fe.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Fe.ATTR_NET_PEER_PORT]:Number(n?.port)||cE(t.port),[Fe.ATTR_DB_USER]:n?.username??t.user}),e&da.SemconvStability.STABLE&&(r={...r,[dr.ATTR_DB_SYSTEM_NAME]:dr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[dr.ATTR_DB_NAMESPACE]:t.namespace,[dr.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[dr.ATTR_SERVER_PORT]:Number(n?.port)||cE(t.port)}),r}me.getSemanticAttributesFromPoolConnection=YSe;function WSe(t){return t.requireParentSpan===!0&&zs.trace.getSpan(zs.context.active())===void 0}me.shouldSkipInstrumentation=WSe;function zSe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=HW(s,r),a=t.startSpan(i,{kind:zs.SpanKind.CLIENT,attributes:qW(o,n)});if(!r)return a;if(r.text&&(n&da.SemconvStability.OLD&&a.setAttribute(Fe.ATTR_DB_STATEMENT,r.text),n&da.SemconvStability.STABLE&&a.setAttribute(dr.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(l=>l==null?"null":l instanceof Buffer?l.toString():typeof l=="object"?typeof l.toPostgres=="function"?l.toPostgres():JSON.stringify(l):l.toString());a.setAttribute(aE.AttributeNames.PG_VALUES,c)}catch(c){zs.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(aE.AttributeNames.PG_PLAN,r.name),a}me.handleConfigQuery=zSe;function $W(t,e,n){typeof t.responseHook=="function"&&(0,da.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&zs.diag.error("Error running response hook",r)},!0)}me.handleExecutionResult=$W;function KSe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[dr.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(uE(i)),e.setStatus({code:zs.SpanStatusCode.ERROR,message:i.message})):$W(t,e,a),o(),e.end(),n.call(this,i,a)}}me.patchCallback=KSe;function QSe(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()}me.getPoolName=QSe;function XSe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Fe.ATTR_DB_CLIENT_CONNECTION_STATE]:Fe.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Fe.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Fe.ATTR_DB_CLIENT_CONNECTION_STATE]:Fe.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Fe.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Fe.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}me.updateCounter=XSe;function JSe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(uE(r)),t.setStatus({code:zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}me.patchCallbackPGPool=JSe;function ZSe(t,e){return function(r){r&&(r instanceof Error&&t.recordException(uE(r)),t.setStatus({code:zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}me.patchClientConnectCallback=ZSe;function ege(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}me.getErrorMessage=ege;function tge(t){return typeof t=="object"&&typeof t?.text=="string"}me.isObjectWithTextString=tge;function uE(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}me.sanitizedErrorMessage=uE});var WW=E(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.PACKAGE_NAME=Mu.PACKAGE_VERSION=void 0;Mu.PACKAGE_VERSION="0.66.0";Mu.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var ZW=E(pE=>{"use strict";Object.defineProperty(pE,"__esModule",{value:!0});pE.PgInstrumentation=void 0;var _n=ne(),Ie=(b(),N(v)),zW=BW(),ke=YW(),KW=TO(),QW=WW(),XW=vO(),lE=he(),Lr=(le(),N(Ae)),Sd=xO();function xu(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var DO=class extends _n.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(QW.PACKAGE_NAME,QW.PACKAGE_VERSION,e),this._semconvStability=(0,_n.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(Lr.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ie.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(Sd.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(Sd.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 _n.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new _n.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new _n.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=xu(a);return this._patchPgClient(c.Client),a},a=>{let c=xu(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new _n.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=xu(a);return(0,_n.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=xu(a);(0,_n.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=xu(e);return(0,_n.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,_n.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=xu(e);return(0,_n.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,_n.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(XW.SpanNames.CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchClientConnectCallback(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return JW(i,a)}}recordOperationDuration(e,n){let r={},o=[Lr.ATTR_DB_NAMESPACE,Lr.ATTR_ERROR_TYPE,Lr.ATTR_SERVER_PORT,Lr.ATTR_SERVER_ADDRESS,Lr.ATTR_DB_OPERATION_NAME];this._semconvStability&_n.SemconvStability.OLD&&o.push(Sd.ATTR_DB_SYSTEM),this._semconvStability&_n.SemconvStability.STABLE&&o.push(Lr.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,lE.hrTimeToMilliseconds)((0,lE.hrTimeDuration)(n,(0,lE.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ke.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,lE.hrTime)(),i=o[0],a=typeof i=="string",c=ke.isObjectWithTextString(i),l=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,p={[Sd.ATTR_DB_SYSTEM]:Sd.DB_SYSTEM_VALUE_POSTGRESQL,[Lr.ATTR_DB_NAMESPACE]:this.database,[Lr.ATTR_SERVER_PORT]:this.connectionParameters.port,[Lr.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};l?.text&&(p[Lr.ATTR_DB_OPERATION_NAME]=ke.parseNormalizedOperationName(l?.text));let d=()=>{e.recordOperationDuration(p,s)},_=e.getConfig(),f=ke.handleConfigQuery.call(this,e.tracer,_,e._semconvStability,l);if(_.addSqlCommenterCommentToQueries&&(a?o[0]=(0,KW.addSqlCommenterComment)(f,i):c&&!("name"in i)&&(o[0]={...i,text:(0,KW.addSqlCommenterComment)(f,i.text)})),o.length>0){let h=Ie.trace.getSpan(Ie.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ke.patchCallback(_,f,o[o.length-1],p,d),h&&(o[o.length-1]=Ie.context.bind(Ie.context.active(),o[o.length-1]));else if(typeof l?.callback=="function"){let S=ke.patchCallback(e.getConfig(),f,l.callback,p,d);h&&(S=Ie.context.bind(Ie.context.active(),S)),o[0].callback=S}}let{requestHook:m}=_;typeof m=="function"&&l&&(0,_n.safeExecuteInTheMiddle)(()=>{let{database:h,host:S,port:R,user:I}=this.connectionParameters;m(f,{connection:{database:h,host:S,port:R,user:I},query:{text:l.text,values:l.values,name:l.name}})},h=>{h&&e._diag.error("Error running query hook",h)},!0);let T;try{T=n.apply(this,o)}catch(h){throw h instanceof Error&&f.recordException(ke.sanitizedErrorMessage(h)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(h)}),f.end(),h}return T instanceof Promise?T.then(h=>new Promise(S=>{ke.handleExecutionResult(e.getConfig(),f,h),d(),f.end(),S(h)})).catch(h=>new Promise((S,R)=>{h instanceof Error&&f.recordException(ke.sanitizedErrorMessage(h)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:h.message}),d(),f.end(),R(h)})):T})}_setPoolConnectEventListeners(e){if(e[zW.EVENT_LISTENERS_SET])return;let n=ke.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[zW.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(XW.SpanNames.POOL_CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchCallbackPGPool(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return JW(i,a)}}};pE.PgInstrumentation=DO;function JW(t,e){if(!(e instanceof Promise))return e;let n=e;return Ie.context.bind(Ie.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ke.sanitizedErrorMessage(r)),t.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var ez=E(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.AttributeNames=vu.PgInstrumentation=void 0;var nge=ZW();Object.defineProperty(vu,"PgInstrumentation",{enumerable:!0,get:function(){return nge.PgInstrumentation}});var rge=MO();Object.defineProperty(vu,"AttributeNames",{enumerable:!0,get:function(){return rge.AttributeNames}})});var cz=E(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.SeverityNumber=void 0;var cge;(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"})(cge=gd.SeverityNumber||(gd.SeverityNumber={}))});var _E=E(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.NOOP_LOGGER=Lu.NoopLogger=void 0;var dE=class{emit(e){}};Lu.NoopLogger=dE;Lu.NOOP_LOGGER=new dE});var mE=E(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.NOOP_LOGGER_PROVIDER=Du.NoopLoggerProvider=void 0;var uge=_E(),fE=class{getLogger(e,n,r){return new uge.NoopLogger}};Du.NoopLoggerProvider=fE;Du.NOOP_LOGGER_PROVIDER=new fE});var GO=E(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.ProxyLogger=void 0;var lge=_E(),kO=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):lge.NOOP_LOGGER}};TE.ProxyLogger=kO});var jO=E(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.ProxyLoggerProvider=void 0;var pge=mE(),dge=GO(),BO=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new dge.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:pge.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)}};hE.ProxyLoggerProvider=BO});var uz=E(EE=>{"use strict";Object.defineProperty(EE,"__esModule",{value:!0});EE._globalThis=void 0;EE._globalThis=typeof globalThis=="object"?globalThis:global});var lz=E(SE=>{"use strict";Object.defineProperty(SE,"__esModule",{value:!0});SE._globalThis=void 0;var _ge=uz();Object.defineProperty(SE,"_globalThis",{enumerable:!0,get:function(){return _ge._globalThis}})});var pz=E(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE._globalThis=void 0;var fge=lz();Object.defineProperty(gE,"_globalThis",{enumerable:!0,get:function(){return fge._globalThis}})});var dz=E(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.API_BACKWARDS_COMPATIBILITY_VERSION=uo.makeGetter=uo._global=uo.GLOBAL_LOGS_API_KEY=void 0;var mge=pz();uo.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");uo._global=mge._globalThis;function Tge(t,e,n){return r=>r===t?e:n}uo.makeGetter=Tge;uo.API_BACKWARDS_COMPATIBILITY_VERSION=1});var fz=E(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.LogsAPI=void 0;var _r=dz(),hge=mE(),_z=jO(),HO=class t{constructor(){this._proxyLoggerProvider=new _z.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return _r._global[_r.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(_r._global[_r.GLOBAL_LOGS_API_KEY]=(0,_r.makeGetter)(_r.API_BACKWARDS_COMPATIBILITY_VERSION,e,hge.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=_r._global[_r.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(_r._global,_r.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete _r._global[_r.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new _z.ProxyLoggerProvider}};AE.LogsAPI=HO});var VO=E(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.logs=Ct.ProxyLoggerProvider=Ct.ProxyLogger=Ct.NoopLoggerProvider=Ct.NOOP_LOGGER_PROVIDER=Ct.NoopLogger=Ct.NOOP_LOGGER=Ct.SeverityNumber=void 0;var Ege=cz();Object.defineProperty(Ct,"SeverityNumber",{enumerable:!0,get:function(){return Ege.SeverityNumber}});var mz=_E();Object.defineProperty(Ct,"NOOP_LOGGER",{enumerable:!0,get:function(){return mz.NOOP_LOGGER}});Object.defineProperty(Ct,"NoopLogger",{enumerable:!0,get:function(){return mz.NoopLogger}});var Tz=mE();Object.defineProperty(Ct,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return Tz.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Ct,"NoopLoggerProvider",{enumerable:!0,get:function(){return Tz.NoopLoggerProvider}});var Sge=GO();Object.defineProperty(Ct,"ProxyLogger",{enumerable:!0,get:function(){return Sge.ProxyLogger}});var gge=jO();Object.defineProperty(Ct,"ProxyLoggerProvider",{enumerable:!0,get:function(){return gge.ProxyLoggerProvider}});var Age=fz();Ct.logs=Age.LogsAPI.getInstance()});var hz=E(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.disableInstrumentations=Uu.enableInstrumentations=void 0;function Rge(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()}}Uu.enableInstrumentations=Rge;function yge(t){t.forEach(e=>e.disable())}Uu.disableInstrumentations=yge});var gz=E(RE=>{"use strict";Object.defineProperty(RE,"__esModule",{value:!0});RE.registerInstrumentations=void 0;var Ez=(b(),N(v)),Ige=VO(),Sz=hz();function Nge(t){let e=t.tracerProvider||Ez.trace.getTracerProvider(),n=t.meterProvider||Ez.metrics.getMeterProvider(),r=t.loggerProvider||Ige.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,Sz.enableInstrumentations)(o,e,n,r),()=>{(0,Sz.disableInstrumentations)(o)}}RE.registerInstrumentations=Nge});var Pz=E(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.satisfies=void 0;var YO=(b(),N(v)),Nz=/^(?: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-]+)*))?$/,Oge=/^(?<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-]+)*))?$/,bge={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Cge(t,e,n){if(!Pge(t))return YO.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Lge(t);if(!r)return!1;let o=[],s=Oz(r,e,o,n);return s&&!n?.includePrerelease?xge(r,o):s}yE.satisfies=Cge;function Pge(t){return typeof t=="string"&&Nz.test(t)}function Oz(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(FO(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=eAe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!FO(t,s,n,r))return!1;return!0}return FO(t,e,n,r)}function FO(t,e,n,r){if(e=vge(e,r),e.includes(" "))return Oz(t,e,n,r);{let o=Dge(e);return n.push(o),Mge(t,o)}}function Mge(t,e){if(e.invalid)return!1;if(!e.version||$O(e.version))return!0;let n=Rz(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=Rz(r,o)}return bge[e.op]?.includes(n)}function xge(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function vge(t,e){return t=t.trim(),t=Jge(t,e),t=Xge(t),t=Zge(t,e),t=t.trim(),t}function fn(t){return!t||t.toLowerCase()==="x"||t==="*"}function Lge(t){let e=t.match(Nz);if(!e){YO.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 Dge(t){if(!t)return{};let e=t.match(Oge);if(!e)return YO.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 $O(t){return t==="*"||t==="x"||t==="X"}function Az(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Uge(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 wge(t,e){if($O(t)||$O(e))return 0;let[n,r]=Uge(Az(t),Az(e));return n>r?1:n<r?-1:0}function Rz(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=wge(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var bz="[a-zA-Z0-9-]",Cz="0|[1-9]\\d*",kge=`\\d*[a-zA-Z-]${bz}*`,Gge="((?:<|>)?=?)",yz=`(?:${Cz}|${kge})`,Bge=`(?:-(${yz}(?:\\.${yz})*))`,Iz=`${bz}+`,jge=`(?:\\+(${Iz}(?:\\.${Iz})*))`,qO=`${Cz}|x|X|\\*`,Ad=`[v=\\s]*(${qO})(?:\\.(${qO})(?:\\.(${qO})(?:${Bge})?${jge}?)?)?`,Hge=`^${Gge}\\s*${Ad}$`,Vge=new RegExp(Hge),Fge=`^\\s*(${Ad})\\s+-\\s+(${Ad})\\s*$`,qge=new RegExp(Fge),$ge="(?:~>?)",Yge=`^${$ge}${Ad}$`,Wge=new RegExp(Yge),zge="(?:\\^)",Kge=`^${zge}${Ad}$`,Qge=new RegExp(Kge);function Xge(t){let e=Wge;return t.replace(e,(n,r,o,s,i)=>{let a;return fn(r)?a="":fn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:fn(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 Jge(t,e){let n=Qge,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return fn(s)?l="":fn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:fn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function Zge(t,e){let n=Vge;return t.replace(n,(r,o,s,i,a,c)=>{let l=fn(s),p=l||fn(i),d=p||fn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function eAe(t,e){let n=qge;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(fn(s)?o="":fn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:fn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,fn(d)?p="":fn(_)?p=`<${+d+1}.0.0-0`:fn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var WO=E(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.massUnwrap=Bt.unwrap=Bt.massWrap=Bt.wrap=void 0;var mn=console.error.bind(console);function Rd(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 tAe=(t,e,n)=>{if(!t||!t[e]){mn("no original function "+String(e)+" to wrap");return}if(!n){mn("no wrapper function"),mn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){mn("original object and wrapper must be functions");return}let o=n(r,e);return Rd(o,"__original",r),Rd(o,"__unwrap",()=>{t[e]===o&&Rd(t,e,r)}),Rd(o,"__wrapped",!0),Rd(t,e,o),o};Bt.wrap=tAe;var nAe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{mn("must provide one or more modules to patch"),mn(new Error().stack);return}if(!(e&&Array.isArray(e))){mn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Bt.wrap)(r,o,n)})})};Bt.massWrap=nAe;var rAe=(t,e)=>{if(!t||!t[e]){mn("no function to unwrap."),mn(new Error().stack);return}let n=t[e];if(!n.__unwrap)mn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Bt.unwrap=rAe;var oAe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{mn("must provide one or more modules to patch"),mn(new Error().stack);return}if(!(e&&Array.isArray(e))){mn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Bt.unwrap)(n,r)})})};Bt.massUnwrap=oAe;function yd(t){t&&t.logger&&(typeof t.logger!="function"?mn("new logger isn't a function, not replacing"):mn=t.logger)}Bt.default=yd;yd.wrap=Bt.wrap;yd.massWrap=Bt.massWrap;yd.unwrap=Bt.unwrap;yd.massUnwrap=Bt.massUnwrap});var Mz=E(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.InstrumentationAbstract=void 0;var zO=(b(),N(v)),sAe=VO(),IE=WO(),KO=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=zO.diag.createComponentLogger({namespace:e}),this._tracer=zO.trace.getTracer(e,n),this._meter=zO.metrics.getMeter(e,n),this._logger=sAe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=IE.wrap;_unwrap=IE.unwrap;_massWrap=IE.massWrap;_massUnwrap=IE.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)}}};NE.InstrumentationAbstract=KO});var xz=E(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.ModuleNameTrie=Qs.ModuleNameSeparator=void 0;Qs.ModuleNameSeparator="/";var OE=class{hooks=[];children=new Map},QO=class{_trie=new OE;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Qs.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new OE,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(Qs.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))}};Qs.ModuleNameTrie=QO});var Lz=E(bE=>{"use strict";Object.defineProperty(bE,"__esModule",{value:!0});bE.RequireInTheMiddleSingleton=void 0;var iAe=Pi(),vz=U("path"),XO=xz(),aAe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),JO=class t{_moduleNameTrie=new XO.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new iAe.Hook(null,{internals:!0},(e,n,r)=>{let o=cAe(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 aAe?new t:this._instance=this._instance??new t}};bE.RequireInTheMiddleSingleton=JO;function cAe(t){return vz.sep!==XO.ModuleNameSeparator?t.split(vz.sep).join(XO.ModuleNameSeparator):t}});var ZO=E(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.isWrapped=Xs.safeExecuteInTheMiddleAsync=Xs.safeExecuteInTheMiddle=void 0;function uAe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Xs.safeExecuteInTheMiddle=uAe;async function lAe(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}}Xs.safeExecuteInTheMiddleAsync=lAe;function pAe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Xs.isWrapped=pAe});var wz=E(CE=>{"use strict";Object.defineProperty(CE,"__esModule",{value:!0});CE.InstrumentationBase=void 0;var Id=U("path"),Dz=U("util"),dAe=Pz(),eb=WO(),_Ae=Mz(),fAe=Lz(),mAe=DN(),Nd=(b(),N(v)),TAe=Pi(),hAe=U("fs"),EAe=ZO(),tb=class extends _Ae.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=fAe.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,EAe.isWrapped)(e[n])&&this._unwrap(e,n),Dz.types.isProxy(e)){let o=(0,eb.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,eb.wrap)(e,n,r)};_unwrap=(e,n)=>Dz.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,eb.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Nd.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{Nd.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Nd.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=U.resolve(n);U.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,hAe.readFileSync)(Id.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Nd.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 Uz(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=Id.normalize(r);return i.filter(l=>l.name===a).filter(l=>Uz(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),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&&Id.isAbsolute(a)){let l=Id.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Id.isAbsolute(e.name)?new TAe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new mAe.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}};CE.InstrumentationBase=tb;function Uz(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,dAe.satisfies)(e,r,{includePrerelease:n}))}});var kz=E(PE=>{"use strict";Object.defineProperty(PE,"__esModule",{value:!0});PE.normalize=void 0;var SAe=U("path");Object.defineProperty(PE,"normalize",{enumerable:!0,get:function(){return SAe.normalize}})});var Gz=E(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.normalize=wu.InstrumentationBase=void 0;var gAe=wz();Object.defineProperty(wu,"InstrumentationBase",{enumerable:!0,get:function(){return gAe.InstrumentationBase}});var AAe=kz();Object.defineProperty(wu,"normalize",{enumerable:!0,get:function(){return AAe.normalize}})});var nb=E(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.normalize=ku.InstrumentationBase=void 0;var Bz=Gz();Object.defineProperty(ku,"InstrumentationBase",{enumerable:!0,get:function(){return Bz.InstrumentationBase}});Object.defineProperty(ku,"normalize",{enumerable:!0,get:function(){return Bz.normalize}})});var jz=E(ME=>{"use strict";Object.defineProperty(ME,"__esModule",{value:!0});ME.InstrumentationNodeModuleDefinition=void 0;var rb=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||[]}};ME.InstrumentationNodeModuleDefinition=rb});var Hz=E(xE=>{"use strict";Object.defineProperty(xE,"__esModule",{value:!0});xE.InstrumentationNodeModuleFile=void 0;var RAe=nb(),ob=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,RAe.normalize)(e)}};xE.InstrumentationNodeModuleFile=ob});var Vz=E(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.semconvStabilityFromStr=_a.SemconvStability=void 0;var vE;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(vE=_a.SemconvStability||(_a.SemconvStability={}));function yAe(t,e){let n=vE.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=vE.DUPLICATE;break}else o.toLowerCase()===t&&(n=vE.STABLE);return n}_a.semconvStabilityFromStr=yAe});var qz=E(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.semconvStabilityFromStr=ut.SemconvStability=ut.safeExecuteInTheMiddleAsync=ut.safeExecuteInTheMiddle=ut.isWrapped=ut.InstrumentationNodeModuleFile=ut.InstrumentationNodeModuleDefinition=ut.InstrumentationBase=ut.registerInstrumentations=void 0;var IAe=gz();Object.defineProperty(ut,"registerInstrumentations",{enumerable:!0,get:function(){return IAe.registerInstrumentations}});var NAe=nb();Object.defineProperty(ut,"InstrumentationBase",{enumerable:!0,get:function(){return NAe.InstrumentationBase}});var OAe=jz();Object.defineProperty(ut,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return OAe.InstrumentationNodeModuleDefinition}});var bAe=Hz();Object.defineProperty(ut,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return bAe.InstrumentationNodeModuleFile}});var sb=ZO();Object.defineProperty(ut,"isWrapped",{enumerable:!0,get:function(){return sb.isWrapped}});Object.defineProperty(ut,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return sb.safeExecuteInTheMiddle}});Object.defineProperty(ut,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return sb.safeExecuteInTheMiddleAsync}});var Fz=Vz();Object.defineProperty(ut,"SemconvStability",{enumerable:!0,get:function(){return Fz.SemconvStability}});Object.defineProperty(ut,"semconvStabilityFromStr",{enumerable:!0,get:function(){return Fz.semconvStabilityFromStr}})});var eK=E(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.PACKAGE_NAME=Bu.PACKAGE_VERSION=void 0;Bu.PACKAGE_VERSION="0.60.0";Bu.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var ub=E(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.HapiLifecycleMethodNames=lo.HapiLayerType=lo.handlerPatched=lo.HapiComponentName=void 0;lo.HapiComponentName="@hapi/hapi";lo.handlerPatched=Symbol("hapi-handler-patched");lo.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};lo.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var tK=E(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.ATTR_HTTP_METHOD=void 0;DE.ATTR_HTTP_METHOD="http.method"});var lb=E(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.AttributeNames=void 0;var FAe;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(FAe=Od.AttributeNames||(Od.AttributeNames={}))});var oK=E(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.getPluginFromInput=lt.getExtMetadata=lt.getRouteMetadata=lt.isPatchableExtMethod=lt.isDirectExtInput=lt.isLifecycleExtEventObj=lt.isLifecycleExtType=lt.getPluginName=void 0;var nK=(le(),N(Ae)),qAe=tK(),bd=ub(),Js=lb(),rK=ne();function $Ae(t){return t.name?t.name:t.pkg.name}lt.getPluginName=$Ae;var YAe=t=>typeof t=="string"&&bd.HapiLifecycleMethodNames.has(t);lt.isLifecycleExtType=YAe;var WAe=t=>{let e=t?.type;return e!==void 0&&(0,lt.isLifecycleExtType)(e)};lt.isLifecycleExtEventObj=WAe;var zAe=t=>Array.isArray(t)&&t.length<=3&&(0,lt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";lt.isDirectExtInput=zAe;var KAe=t=>!Array.isArray(t);lt.isPatchableExtMethod=KAe;var QAe=(t,e,n)=>{let r={[nK.ATTR_HTTP_ROUTE]:t.path};e&rK.SemconvStability.OLD&&(r[qAe.ATTR_HTTP_METHOD]=t.method),e&rK.SemconvStability.STABLE&&(r[nK.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[Js.AttributeNames.HAPI_TYPE]=bd.HapiLayerType.PLUGIN,r[Js.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[Js.AttributeNames.HAPI_TYPE]=bd.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};lt.getRouteMetadata=QAe;var XAe=(t,e,n)=>{let r=`ext - ${t}`;return n&&n!=="method"&&(r=`ext - ${t} - ${n}`),e?{attributes:{[Js.AttributeNames.EXT_TYPE]:t,[Js.AttributeNames.HAPI_TYPE]:bd.HapiLayerType.EXT,[Js.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ${r}`}:{attributes:{[Js.AttributeNames.EXT_TYPE]:t,[Js.AttributeNames.HAPI_TYPE]:bd.HapiLayerType.EXT},name:r}};lt.getExtMetadata=XAe;var JAe=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;lt.getPluginFromInput=JAe});var aK=E(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.HapiInstrumentation=void 0;var $n=(b(),N(v)),sK=he(),Cd=ne(),iK=eK(),Pd=ub(),Wo=oK(),pb=class extends Cd.InstrumentationBase{_semconvStability;constructor(e={}){super(iK.PACKAGE_NAME,iK.PACKAGE_VERSION,e),this._semconvStability=(0,Cd.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new Cd.InstrumentationNodeModuleDefinition(Pd.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Cd.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,Cd.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,Wo.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Wo.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,Wo.isLifecycleExtType)(c.type)){let l=c,p=r._wrapExtMethods(l.method,c.type,n);l.method=p,i[a]=l}}return e.apply(this,s)}else if((0,Wo.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,Wo.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,Wo.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),s._wrap(a,"ext",l=>n._getServerExtPatch.bind(n)(l,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,Wo.isPatchableExtMethod)(e))return e[Pd.handlerPatched]===!0?e:(e[Pd.handlerPatched]=!0,async function(...i){if($n.trace.getSpan($n.context.active())===void 0)return await e.apply(this,i);let a=(0,Wo.getExtMetadata)(n,r,e.name),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await $n.context.with($n.trace.setSpan($n.context.active(),c),e,void 0,...i)}catch(l){throw c.recordException(l),c.setStatus({code:$n.SpanStatusCode.ERROR,message:l.message}),l}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[Pd.handlerPatched]===!0)return e;e[Pd.handlerPatched]=!0;let o=s=>async function(...i){if($n.trace.getSpan($n.context.active())===void 0)return await s.call(this,...i);let a=(0,sK.getRPCMetadata)($n.context.active());a?.type===sK.RPCType.HTTP&&(a.route=e.path);let c=(0,Wo.getRouteMetadata)(e,r._semconvStability,n),l=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await $n.context.with($n.trace.setSpan($n.context.active(),l),()=>s.call(this,...i))}catch(p){throw l.recordException(p),l.setStatus({code:$n.SpanStatusCode.ERROR,message:p.message}),p}finally{l.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}};UE.HapiInstrumentation=pb});var cK=E(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.AttributeNames=ju.HapiInstrumentation=void 0;var ZAe=aK();Object.defineProperty(ju,"HapiInstrumentation",{enumerable:!0,get:function(){return ZAe.HapiInstrumentation}});var eRe=lb();Object.defineProperty(ju,"AttributeNames",{enumerable:!0,get:function(){return eRe.AttributeNames}})});var GE=E(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.KoaLayerType=void 0;var iRe;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(iRe=xd.KoaLayerType||(xd.KoaLayerType={}))});var TK=E(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.PACKAGE_NAME=Hu.PACKAGE_VERSION=void 0;Hu.PACKAGE_VERSION="0.62.0";Hu.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var db=E(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.AttributeNames=void 0;var aRe;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(aRe=vd.AttributeNames||(vd.AttributeNames={}))});var EK=E(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.isLayerIgnored=Vu.getMiddlewareMetadata=void 0;var hK=GE(),BE=db(),cRe=(le(),N(Ae)),uRe=(t,e,n,r)=>n?{attributes:{[BE.AttributeNames.KOA_NAME]:r?.toString(),[BE.AttributeNames.KOA_TYPE]:hK.KoaLayerType.ROUTER,[cRe.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[BE.AttributeNames.KOA_NAME]:e.name??"middleware",[BE.AttributeNames.KOA_TYPE]:hK.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Vu.getMiddlewareMetadata=uRe;var lRe=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Vu.isLayerIgnored=lRe});var SK=E(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});jE.kLayerPatched=void 0;jE.kLayerPatched=Symbol("koa-layer-patched")});var NK=E(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.KoaInstrumentation=void 0;var po=(b(),N(v)),Ld=ne(),gK=GE(),AK=TK(),RK=EK(),yK=he(),IK=SK(),_b=class extends Ld.InstrumentationBase{constructor(e={}){super(AK.PACKAGE_NAME,AK.PACKAGE_VERSION,e)}init(){return new Ld.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Ld.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,Ld.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){po.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?gK.KoaLayerType.ROUTER:gK.KoaLayerType.MIDDLEWARE;return e[IK.kLayerPatched]===!0||(0,RK.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(po.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[IK.kLayerPatched]=!0,po.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(po.trace.getSpan(po.context.active())===void 0)return e(s,i);let c=(0,RK.getMiddlewareMetadata)(s,e,n,r),l=this.tracer.startSpan(c.name,{attributes:c.attributes}),p=(0,yK.getRPCMetadata)(po.context.active());p?.type===yK.RPCType.HTTP&&s._matchedRoute&&(p.route=s._matchedRoute.toString());let{requestHook:d}=this.getConfig();d&&(0,Ld.safeExecuteInTheMiddle)(()=>d(l,{context:s,middlewareLayer:e,layerType:o}),f=>{f&&po.diag.error("koa instrumentation: request hook failed",f)},!0);let _=po.trace.setSpan(po.context.active(),l);return po.context.with(_,async()=>{try{return await e(s,i)}catch(f){throw l.recordException(f),f}finally{l.end()}})})}};HE.KoaInstrumentation=_b});var OK=E(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.KoaLayerType=ei.AttributeNames=ei.KoaInstrumentation=void 0;var pRe=NK();Object.defineProperty(ei,"KoaInstrumentation",{enumerable:!0,get:function(){return pRe.KoaInstrumentation}});var dRe=db();Object.defineProperty(ei,"AttributeNames",{enumerable:!0,get:function(){return dRe.AttributeNames}});var _Re=GE();Object.defineProperty(ei,"KoaLayerType",{enumerable:!0,get:function(){return _Re.KoaLayerType}})});var fb=E(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.ConnectNames=Dr.ConnectTypes=Dr.AttributeNames=void 0;var mRe;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(mRe=Dr.AttributeNames||(Dr.AttributeNames={}));var TRe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(TRe=Dr.ConnectTypes||(Dr.ConnectTypes={}));var hRe;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(hRe=Dr.ConnectNames||(Dr.ConnectNames={}))});var xK=E(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.PACKAGE_NAME=Fu.PACKAGE_VERSION=void 0;Fu.PACKAGE_VERSION="0.57.0";Fu.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var vK=E(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE._LAYERS_STORE_PROPERTY=void 0;VE._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var LK=E(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.generateRoute=ni.replaceCurrentStackRoute=ni.addNewStackLayer=void 0;var ERe=(b(),N(v)),ti=vK(),SRe=t=>{Array.isArray(t[ti._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ti._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ti._LAYERS_STORE_PROPERTY].push("/");let e=t[ti._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ti._LAYERS_STORE_PROPERTY].length?t[ti._LAYERS_STORE_PROPERTY].pop():ERe.diag.warn("Connect: Trying to pop the stack multiple time")}};ni.addNewStackLayer=SRe;var gRe=(t,e)=>{e&&t[ti._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ni.replaceCurrentStackRoute=gRe;var ARe=t=>t[ti._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ni.generateRoute=ARe});var wK=E(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.ConnectInstrumentation=ri.ANONYMOUS_NAME=void 0;var RRe=(b(),N(v)),DK=he(),qu=fb(),UK=xK(),FE=ne(),yRe=(le(),N(Ae)),mb=LK();ri.ANONYMOUS_NAME="anonymous";var Tb=class extends FE.InstrumentationBase{constructor(e={}){super(UK.PACKAGE_NAME,UK.PACKAGE_VERSION,e)}init(){return[new FE.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,FE.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,FE.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=qu.ConnectTypes.REQUEST_HANDLER,s=qu.ConnectNames.REQUEST_HANDLER,o=e):(r=qu.ConnectTypes.MIDDLEWARE,s=qu.ConnectNames.MIDDLEWARE,o=n.name||ri.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[yRe.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[qu.AttributeNames.CONNECT_TYPE]:r,[qu.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],l=arguments[i],p=arguments[a],d=arguments[c];(0,mb.replaceCurrentStackRoute)(l,e);let _=(0,DK.getRPCMetadata)(RRe.context.active());e&&_?.type===DK.RPCType.HTTP&&(_.route=(0,mb.generateRoute)(l));let f="";e?f=`request handler - ${e}`:f=`middleware - ${n.name||ri.ANONYMOUS_NAME}`;let m=r._startSpan(e,n);r._diag.debug("start span",f);let T=!1;function h(){T?r._diag.debug(`span ${m.name} - already finished`):(T=!0,r._diag.debug(`finishing span ${m.name}`),m.end()),p.removeListener("close",h)}return p.addListener("close",h),arguments[c]=r._patchNext(d,h),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,mb.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)}}};ri.ConnectInstrumentation=Tb});var GK=E(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.ConnectTypes=fr.ConnectNames=fr.AttributeNames=fr.ANONYMOUS_NAME=fr.ConnectInstrumentation=void 0;var kK=wK();Object.defineProperty(fr,"ConnectInstrumentation",{enumerable:!0,get:function(){return kK.ConnectInstrumentation}});Object.defineProperty(fr,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return kK.ANONYMOUS_NAME}});var hb=fb();Object.defineProperty(fr,"AttributeNames",{enumerable:!0,get:function(){return hb.AttributeNames}});Object.defineProperty(fr,"ConnectNames",{enumerable:!0,get:function(){return hb.ConnectNames}});Object.defineProperty(fr,"ConnectTypes",{enumerable:!0,get:function(){return hb.ConnectTypes}})});var FK=E(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.DB_SYSTEM_VALUE_MSSQL=Pt.ATTR_NET_PEER_PORT=Pt.ATTR_NET_PEER_NAME=Pt.ATTR_DB_USER=Pt.ATTR_DB_SYSTEM=Pt.ATTR_DB_STATEMENT=Pt.ATTR_DB_SQL_TABLE=Pt.ATTR_DB_NAME=void 0;Pt.ATTR_DB_NAME="db.name";Pt.ATTR_DB_SQL_TABLE="db.sql.table";Pt.ATTR_DB_STATEMENT="db.statement";Pt.ATTR_DB_SYSTEM="db.system";Pt.ATTR_DB_USER="db.user";Pt.ATTR_NET_PEER_NAME="net.peer.name";Pt.ATTR_NET_PEER_PORT="net.peer.port";Pt.DB_SYSTEM_VALUE_MSSQL="mssql"});var qK=E($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.once=$u.getSpanName=void 0;function NRe(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}$u.getSpanName=NRe;var ORe=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};$u.once=ORe});var $K=E(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.PACKAGE_NAME=Yu.PACKAGE_VERSION=void 0;Yu.PACKAGE_VERSION="0.33.0";Yu.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var QK=E(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.TediousInstrumentation=si.INJECTED_CTX=void 0;var Wu=(b(),N(v)),bRe=U("events"),_o=ne(),fa=(le(),N(Ae)),oi=FK(),YK=qK(),WK=$K(),KK=Symbol("opentelemetry.instrumentation-tedious.current-database");si.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var zK=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function qE(t){Object.defineProperty(this,KK,{value:t,writable:!0})}var Eb=class t extends _o.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(WK.PACKAGE_NAME,WK.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,_o.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,_o.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new _o.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of zK)(0,_o.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,_o.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 zK)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return qE.call(this,this.config?.options?.database),this.removeListener("databaseChange",qE),this.on("databaseChange",qE),this.once("end",()=>{this.removeListener("databaseChange",qE)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||Wu.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,si.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?.[si.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof bRe.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,l=()=>c++,p=()=>a++,d=this[KK],_=(x=>x.sqlTextOrProcedure==="sp_prepare"&&x.parametersByName?.stmt?.value?x.parametersByName.stmt.value:x.sqlTextOrProcedure)(i),f={};o._dbSemconvStability&_o.SemconvStability.OLD&&(f[oi.ATTR_DB_SYSTEM]=oi.DB_SYSTEM_VALUE_MSSQL,f[oi.ATTR_DB_NAME]=d,f[oi.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,f[oi.ATTR_DB_STATEMENT]=_,f[oi.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&_o.SemconvStability.STABLE&&(f[fa.ATTR_DB_NAMESPACE]=d,f[fa.ATTR_DB_SYSTEM_NAME]=fa.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,f[fa.ATTR_DB_QUERY_TEXT]=_,f[fa.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&_o.SemconvStability.OLD&&(f[oi.ATTR_NET_PEER_NAME]=this.config?.server,f[oi.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&_o.SemconvStability.STABLE&&(f[fa.ATTR_SERVER_ADDRESS]=this.config?.server,f[fa.ATTR_SERVER_PORT]=this.config?.options?.port);let m=o.tracer.startSpan((0,YK.getSpanName)(e,d,_,i.table),{kind:Wu.SpanKind.CLIENT,attributes:f}),T=(0,YK.once)(x=>{i.removeListener("done",l),i.removeListener("doneInProc",l),i.removeListener("doneProc",p),i.removeListener("error",T),this.removeListener("end",T),m.setAttribute("tedious.procedure_count",a),m.setAttribute("tedious.statement_count",c),x&&m.setStatus({code:Wu.SpanStatusCode.ERROR,message:x.message}),m.end()});i.on("done",l),i.on("doneInProc",l),i.on("doneProc",p),i.once("error",T),this.on("end",T),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(T)):o._diag.error("Expected request.callback to be a function");let h=()=>Wu.context.with(Wu.trace.setSpan(Wu.context.active(),m),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return h();let I=o._buildTraceparent(m);o._injectContextInfo(this,n,I).finally(h)}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)}}};si.TediousInstrumentation=Eb});var XK=E($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.TediousInstrumentation=void 0;var CRe=QK();Object.defineProperty($E,"TediousInstrumentation",{enumerable:!0,get:function(){return CRe.TediousInstrumentation}})});var n2=E(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.PACKAGE_NAME=zu.PACKAGE_VERSION=void 0;zu.PACKAGE_VERSION="0.57.0";zu.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var o2=E(YE=>{"use strict";Object.defineProperty(YE,"__esModule",{value:!0});YE.GenericPoolInstrumentation=void 0;var Ku=(b(),N(v)),ma=ne(),r2=n2(),Sb="generic-pool",gb=class extends ma.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(r2.PACKAGE_NAME,r2.PACKAGE_VERSION,e)}init(){return[new ma.InstrumentationNodeModuleDefinition(Sb,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,ma.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 ma.InstrumentationNodeModuleDefinition(Sb,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,ma.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 ma.InstrumentationNodeModuleDefinition(Sb,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,ma.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=Ku.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return Ku.context.with(Ku.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=Ku.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return Ku.context.with(Ku.trace.setSpan(i,a),()=>{e.call(this,(c,l)=>{if(a.end(),o)return o(c,l)},s)})}}};YE.GenericPoolInstrumentation=gb});var s2=E(WE=>{"use strict";Object.defineProperty(WE,"__esModule",{value:!0});WE.GenericPoolInstrumentation=void 0;var xRe=o2();Object.defineProperty(WE,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return xRe.GenericPoolInstrumentation}})});var Ab=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.ATTR_NET_PEER_PORT=fo.ATTR_NET_PEER_NAME=fo.ATTR_MESSAGING_SYSTEM=fo.ATTR_MESSAGING_OPERATION=void 0;fo.ATTR_MESSAGING_OPERATION="messaging.operation";fo.ATTR_MESSAGING_SYSTEM="messaging.system";fo.ATTR_NET_PEER_NAME="net.peer.name";fo.ATTR_NET_PEER_PORT="net.peer.port"});var Rb=E(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.ATTR_MESSAGING_CONVERSATION_ID=qe.OLD_ATTR_MESSAGING_MESSAGE_ID=qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=qe.ATTR_MESSAGING_URL=qe.ATTR_MESSAGING_PROTOCOL_VERSION=qe.ATTR_MESSAGING_PROTOCOL=qe.MESSAGING_OPERATION_VALUE_PROCESS=qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=qe.ATTR_MESSAGING_DESTINATION_KIND=qe.ATTR_MESSAGING_DESTINATION=void 0;qe.ATTR_MESSAGING_DESTINATION="messaging.destination";qe.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";qe.MESSAGING_OPERATION_VALUE_PROCESS="process";qe.ATTR_MESSAGING_PROTOCOL="messaging.protocol";qe.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";qe.ATTR_MESSAGING_URL="messaging.url";qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";qe.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";qe.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var yb=E(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.DEFAULT_CONFIG=Ta.EndOperation=void 0;var LRe;(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"})(LRe=Ta.EndOperation||(Ta.EndOperation={}));Ta.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var _2=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.isConfirmChannelTracing=$e.unmarkConfirmChannelTracing=$e.markConfirmChannelTracing=$e.getConnectionAttributesFromUrl=$e.getConnectionAttributesFromServer=$e.normalizeExchange=$e.CONNECTION_ATTRIBUTES=$e.CHANNEL_CONSUME_TIMEOUT_TIMER=$e.CHANNEL_SPANS_NOT_ENDED=$e.MESSAGE_STORED_SPAN=void 0;var Ib=(b(),N(v)),ii=ne(),zE=(le(),N(Ae)),Dd=Ab(),KE=Rb();$e.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");$e.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");$e.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");$e.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var Nb=(0,Ib.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),DRe=t=>t!==""?t:"<default>";$e.normalizeExchange=DRe;var URe=t=>t.replace(/:[^:@/]*@/,":***@"),l2=(t,e)=>t||(e==="AMQP"?5672:5671),p2=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},d2=t=>t||"localhost",mo=(t,e,n,r)=>n?{[e]:n}:(Ib.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),wRe=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Dd.ATTR_MESSAGING_SYSTEM]:e}:{}};$e.getConnectionAttributesFromServer=wRe;var kRe=(t,e)=>{let n={[KE.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=p2(r?.protocol);Object.assign(n,{...mo(t,KE.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=d2(r?.hostname);e&ii.SemconvStability.OLD&&Object.assign(n,{...mo(t,Dd.ATTR_NET_PEER_NAME,s,"hostname")}),e&ii.SemconvStability.STABLE&&Object.assign(n,{...mo(t,zE.ATTR_SERVER_ADDRESS,s,"hostname")});let i=l2(r.port,o);e&ii.SemconvStability.OLD&&Object.assign(n,mo(t,Dd.ATTR_NET_PEER_PORT,i,"port")),e&ii.SemconvStability.STABLE&&Object.assign(n,mo(t,zE.ATTR_SERVER_PORT,i,"port"))}else{let r=URe(t);n[KE.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=p2(o.protocol);Object.assign(n,{...mo(r,KE.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=d2(o.hostname);e&ii.SemconvStability.OLD&&Object.assign(n,{...mo(r,Dd.ATTR_NET_PEER_NAME,i,"hostname")}),e&ii.SemconvStability.STABLE&&Object.assign(n,{...mo(r,zE.ATTR_SERVER_ADDRESS,i,"hostname")});let a=l2(o.port?parseInt(o.port):void 0,s);e&ii.SemconvStability.OLD&&Object.assign(n,mo(r,Dd.ATTR_NET_PEER_PORT,a,"port")),e&ii.SemconvStability.STABLE&&Object.assign(n,mo(r,zE.ATTR_SERVER_PORT,a,"port"))}catch(o){Ib.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};$e.getConnectionAttributesFromUrl=kRe;var GRe=t=>t.setValue(Nb,!0);$e.markConfirmChannelTracing=GRe;var BRe=t=>t.deleteValue(Nb);$e.unmarkConfirmChannelTracing=BRe;var jRe=t=>t.getValue(Nb)===!0;$e.isConfirmChannelTracing=jRe});var f2=E(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.PACKAGE_NAME=Qu.PACKAGE_VERSION=void 0;Qu.PACKAGE_VERSION="0.61.0";Qu.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var T2=E(JE=>{"use strict";Object.defineProperty(JE,"__esModule",{value:!0});JE.AmqplibInstrumentation=void 0;var Ge=(b(),N(v)),QE=he(),Ee=ne(),HRe=Ab(),Yn=Rb(),Tn=yb(),Ye=_2(),m2=f2(),XE=[">=0.5.5 <1"],Ob=class extends Ee.InstrumentationBase{_netSemconvStability;constructor(e={}){super(m2.PACKAGE_NAME,m2.PACKAGE_VERSION,{...Tn.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ee.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...Tn.DEFAULT_CONFIG,...e})}init(){let e=new Ee.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",XE,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ee.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",XE,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ee.InstrumentationNodeModuleFile("amqplib/lib/connect.js",XE,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Ee.InstrumentationNodeModuleDefinition("amqplib",XE,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Ee.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Ee.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Ee.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,Tn.EndOperation.Ack)),(0,Ee.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,Tn.EndOperation.Nack)),(0,Ee.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,Tn.EndOperation.Reject)),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,Tn.EndOperation.AckAll)),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,Tn.EndOperation.NackAll)),(0,Ee.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Ee.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Ee.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Ee.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Ee.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Ee.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Ee.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Ee.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 l=(0,Ye.getConnectionAttributesFromUrl)(o,n._netSemconvStability),p=(0,Ye.getConnectionAttributesFromServer)(c);c[Ye.CONNECTION_ATTRIBUTES]={...l,...p}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,Tn.EndOperation.ChannelClosed,void 0);let s=this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,Tn.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 l=this,p=n===Tn.EndOperation.Reject?a:c,d=l[Ye.CHANNEL_SPANS_NOT_ENDED]??[],_=d.findIndex(f=>f.msg===i);if(_<0)o.endConsumerSpan(i,e,n,p);else if(n!==Tn.EndOperation.Reject&&a){for(let f=0;f<=_;f++)o.endConsumerSpan(d[f].msg,e,n,p);d.splice(0,_+1)}else o.endConsumerSpan(i,e,n,p),d.splice(_,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,Ye.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:p}=r.getConfig();if(p){let d=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},p);d.unref(),c[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=d}c[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}let l=function(p){if(!p)return i.call(this,p);let d=p.properties.headers??{},_=Ge.propagation.extract(Ge.ROOT_CONTEXT,d),f=p.fields?.exchange,m;if(r._config.useLinksForConsume){let R=_?Ge.trace.getSpan(_)?.spanContext():void 0;_=void 0,R&&(m=[{context:R}])}let T=r.tracer.startSpan(`${s} process`,{kind:Ge.SpanKind.CONSUMER,attributes:{...c?.connection?.[Ye.CONNECTION_ATTRIBUTES],[Yn.ATTR_MESSAGING_DESTINATION]:f,[Yn.ATTR_MESSAGING_DESTINATION_KIND]:Yn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Yn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p.fields?.routingKey,[HRe.ATTR_MESSAGING_OPERATION]:Yn.MESSAGING_OPERATION_VALUE_PROCESS,[Yn.OLD_ATTR_MESSAGING_MESSAGE_ID]:p?.properties.messageId,[Yn.ATTR_MESSAGING_CONVERSATION_ID]:p?.properties.correlationId},links:m},_),{consumeHook:h}=r.getConfig();h&&(0,Ee.safeExecuteInTheMiddle)(()=>h(T,{moduleVersion:e,msg:p}),R=>{R&&Ge.diag.error("amqplib instrumentation: consumerHook error",R)},!0),a?.noAck||(c[Ye.CHANNEL_SPANS_NOT_ENDED].push({msg:p,timeOfConsume:(0,QE.hrTime)()}),p[Ye.MESSAGE_STORED_SPAN]=T);let S=_||Ge.ROOT_CONTEXT;Ge.context.with(Ge.trace.setSpan(S,T),()=>{i.call(this,p)}),a?.noAck&&(r.callConsumeEndHook(T,p,!1,Tn.EndOperation.AutoAck),T.end())};return arguments[1]=l,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,l){let p=this,{span:d,modifiedOptions:_}=r.createPublishSpan(r,s,i,p,c),{publishHook:f}=r.getConfig();f&&(0,Ee.safeExecuteInTheMiddle)(()=>f(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!0}),S=>{S&&Ge.diag.error("amqplib instrumentation: publishHook error",S)},!0);let m=function(S,R){try{l?.call(this,S,R)}finally{let{publishConfirmHook:I}=r.getConfig();I&&(0,Ee.safeExecuteInTheMiddle)(()=>I(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:S}),x=>{x&&Ge.diag.error("amqplib instrumentation: publishConfirmHook error",x)},!0),S&&d.setStatus({code:Ge.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),d.end()}},T=(0,Ye.markConfirmChannelTracing)(Ge.context.active()),h=[...arguments];return h[3]=_,h[4]=Ge.context.bind((0,Ye.unmarkConfirmChannelTracing)(Ge.trace.setSpan(T,d)),m),Ge.context.with(T,n.bind(this,...h))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,Ye.isConfirmChannelTracing)(Ge.context.active()))return n.apply(this,arguments);{let l=this,{span:p,modifiedOptions:d}=r.createPublishSpan(r,s,i,l,c),{publishHook:_}=r.getConfig();_&&(0,Ee.safeExecuteInTheMiddle)(()=>_(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:d,isConfirmChannel:!1}),T=>{T&&Ge.diag.error("amqplib instrumentation: publishHook error",T)},!0);let f=[...arguments];f[3]=d;let m=n.apply(this,f);return p.end(),m}}}createPublishSpan(e,n,r,o,s){let i=(0,Ye.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:Ge.SpanKind.PRODUCER,attributes:{...o.connection[Ye.CONNECTION_ATTRIBUTES],[Yn.ATTR_MESSAGING_DESTINATION]:n,[Yn.ATTR_MESSAGING_DESTINATION_KIND]:Yn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[Yn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[Yn.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[Yn.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},Ge.propagation.inject(Ge.trace.setSpan(Ge.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[Ye.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:Ge.SpanStatusCode.ERROR,message:r!==Tn.EndOperation.ChannelClosed&&r!==Tn.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[Ye.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[Ye.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Ee.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&Ge.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,QE.hrTime)(),r=e[Ye.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,QE.hrTimeDuration)(i.timeOfConsume,n);if((0,QE.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,Tn.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};JE.AmqplibInstrumentation=Ob});var E2=E(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.EndOperation=ai.DEFAULT_CONFIG=ai.AmqplibInstrumentation=void 0;var VRe=T2();Object.defineProperty(ai,"AmqplibInstrumentation",{enumerable:!0,get:function(){return VRe.AmqplibInstrumentation}});var h2=yb();Object.defineProperty(ai,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return h2.DEFAULT_CONFIG}});Object.defineProperty(ai,"EndOperation",{enumerable:!0,get:function(){return h2.EndOperation}})});b();var EF=K(Vk(),1);var C=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var J=globalThis;var pe="10.47.0";function sn(){return us(J),J}function us(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||pe,e[pe]=e[pe]||{}}function Ar(t,e,n=J){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[pe]=r[pe]||{};return o[t]||(o[t]=e())}var Ul=["debug","info","warn","error","log","assert","trace"],Vse="Sentry Logger ",cc={};function Qe(t){if(!("console"in J))return t();let e=J.console,n={},r=Object.keys(cc);r.forEach(o=>{let s=cc[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function Fse(){XA().enabled=!0}function qse(){XA().enabled=!1}function Fk(){return XA().enabled}function $se(...t){QA("log",...t)}function Yse(...t){QA("warn",...t)}function Wse(...t){QA("error",...t)}function QA(t,...e){C&&Fk()&&Qe(()=>{J.console[t](`${Vse}[${t}]:`,...e)})}function XA(){return C?Ar("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:Fse,disable:qse,isEnabled:Fk,log:$se,warn:Yse,error:Wse};var Tf="?",qk=/\(error: (.*)\)/,$k=/captureMessage|captureException/;function hf(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
|
|
12
|
+
`);for(let a=r;a<i.length;a++){let c=i[a];c.length>1024&&(c=c.slice(0,1024));let l=qk.test(c)?c.replace(qk,"$1"):c;if(!l.match(/\S*Error: /)){for(let p of e){let d=p(l);if(d){s.push(d);break}}if(s.length>=50+o)break}}return Yk(s.slice(o))}}function ZA(t){return Array.isArray(t)?hf(...t):t}function Yk(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(mf(e).function||"")&&e.pop(),e.reverse(),$k.test(mf(e).function||"")&&(e.pop(),$k.test(mf(e).function||"")&&e.pop()),e.slice(0,50).map(n=>({...n,filename:n.filename||mf(e).filename,function:n.function||Tf}))}function mf(t){return t[t.length-1]||{}}var JA="<anonymous>";function wl(t){try{return!t||typeof t!="function"?JA:t.name||JA}catch{return JA}}function Ef(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function Wk(t){let e=t?.startsWith("file://")?t.slice(7):t;return e?.match(/\/[A-Z]:/)&&(e=e.slice(1)),e}var Sf={},zk={};function uc(t,e){Sf[t]=Sf[t]||[],Sf[t].push(e)}function lc(t,e){if(!zk[t]){zk[t]=!0;try{e()}catch(n){C&&g.error(`Error while instrumenting ${t}`,n)}}}function pc(t,e){let n=t&&Sf[t];if(n)for(let r of n)try{r(e)}catch(o){C&&g.error(`Error while triggering instrumentation handler.
|
|
13
|
+
Type: ${t}
|
|
14
|
+
Name: ${wl(r)}
|
|
15
|
+
Error:`,o)}}var eR=null;function Kk(t){let e="error";uc(e,t),lc(e,zse)}function zse(){eR=J.onerror,J.onerror=function(t,e,n,r,o){return pc("error",{column:r,error:o,line:n,msg:t,url:e}),eR?eR.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}var tR=null;function Qk(t){let e="unhandledrejection";uc(e,t),lc(e,Kse)}function Kse(){tR=J.onunhandledrejection,J.onunhandledrejection=function(t){return pc("unhandledrejection",t),tR?tR.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var Xk=Object.prototype.toString;function Yr(t){switch(Xk.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Wr(t,Error)}}function gf(t,e){return Xk.call(t)===`[object ${e}]`}function nR(t){return gf(t,"ErrorEvent")}function ls(t){return gf(t,"String")}function dc(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function kl(t){return t===null||dc(t)||typeof t!="object"&&typeof t!="function"}function bo(t){return gf(t,"Object")}function rR(t){return typeof Event<"u"&&Wr(t,Event)}function oR(t){return typeof Element<"u"&&Wr(t,Element)}function sR(t){return gf(t,"RegExp")}function xt(t){return!!(t?.then&&typeof t.then=="function")}function iR(t){return bo(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Wr(t,e){try{return t instanceof e}catch{return!1}}function Gl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}var Qse=J,Xse=80;function Jk(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,l,p=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||Xse;for(;n&&s++<r&&(l=Jse(n,p),!(l==="html"||s>1&&i+o.length*c+l.length>=d));)o.push(l),i+=l.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function Jse(t,e){let n=t,r=[];if(!n?.tagName)return"";if(Qse.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let o=e?.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(o?.length)o.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let s=n.className;if(s&&ls(s)){let i=s.split(/\s+/);for(let a of i)r.push(`.${a}`)}}for(let s of["aria-label","type","name","title","alt"]){let i=n.getAttribute(s);i&&r.push(`[${s}="${i}"]`)}return r.join("")}function aR(t,e,n){if(!(e in t))return;let r=t[e];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&tG(o,r);try{t[e]=o}catch{C&&g.log(`Failed to replace method "${e}" in object`,t)}}function nt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{C&&g.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function tG(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,nt(t,"__sentry_original__",e)}catch{}}function cR(t){return t.__sentry_original__}function Af(t){if(Yr(t))return{message:t.message,name:t.name,stack:t.stack,...eG(t)};if(rR(t)){let e={type:t.type,target:Zk(t.target),currentTarget:Zk(t.currentTarget),...eG(t)};return typeof CustomEvent<"u"&&Wr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Zk(t){try{return oR(t)?Jk(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function eG(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function uR(t){let e=Object.keys(Af(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}var _c;function xi(t){if(_c!==void 0)return _c?_c(t):t();let e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(_c=n[e],_c(t)):(_c=null,t())}function Rt(){return xi(()=>Math.random())}function Xn(){return xi(()=>Date.now())}function ps(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function lR(t,e){let n=t,r=n.length;if(r<=150)return n;e>r&&(e=r);let o=Math.max(e-60,0);o<5&&(o=0);let s=Math.min(o+140,r);return s>r-5&&(s=r),s===r&&(o=Math.max(s-140,0)),n=n.slice(o,s),o>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function pR(t,e){if(!Array.isArray(t))return"";let n=[];for(let r=0;r<t.length;r++){let o=t[r];try{Gl(o)?n.push(Ef(o)):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Co(t,e,n=!1){return ls(t)?sR(e)?e.test(t):ls(e)?n?t===e:t.includes(e):!1:!1}function ds(t,e=[],n=!1){return e.some(r=>Co(t,r,n))}function Zse(){let t=J;return t.crypto||t.msCrypto}var dR;function eie(){return Rt()*16}function dt(t=Zse()){try{if(t?.randomUUID)return xi(()=>t.randomUUID()).replace(/-/g,"")}catch{}return dR||(dR="10000000100040008000"+1e11),dR.replace(/[018]/g,e=>(e^(eie()&15)>>e/4).toString(16))}function nG(t){return t.exception?.values?.[0]}function _s(t){let{message:e,event_id:n}=t;if(e)return e;let r=nG(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function fR(t,e,n){let r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function fc(t,e){let n=nG(t);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){let s={...o?.data,...e.data};n.mechanism.data=s}}var tie=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function _R(t){return parseInt(t||"",10)}function mR(t){let e=t.match(tie)||[],n=_R(e[1]),r=_R(e[2]),o=_R(e[3]);return{buildmetadata:e[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:e[4]}}function Rf(t){if(rG(t))return!0;try{nt(t,"__sentry_captured__",!0)}catch{}return!1}function rG(t){try{return t.__sentry_captured__}catch{}}var sG=1e3;function Po(){return Xn()/sG}function nie(){let{performance:t}=J;if(!t?.now||!t.timeOrigin)return Po;let e=t.timeOrigin;return()=>(e+xi(()=>t.now()))/sG}var oG;function fs(){return(oG??(oG=nie()))()}function iG(t){let e=fs(),n={sid:dt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>rie(n)};return t&&Mo(n,t),n}function Mo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||fs(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:dt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function aG(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),Mo(t,n)}function rie(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function ms(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;let r={...t};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=ms(r[o],e[o],n-1));return r}function Wt(){return dt()}function zt(){return dt().substring(16)}var TR="_sentrySpan";function vi(t,e){e?nt(t,TR,e):delete t[TR]}function Li(t){return t[TR]}var oie=100,Sn=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Wt(),sampleRand:Rt()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,vi(e,Li(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Mo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,r=n instanceof t?n.getScopeData():bo(n)?e:void 0,{tags:o,attributes:s,extra:i,user:a,contexts:c,level:l,fingerprint:p=[],propagationContext:d,conversationId:_}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),_&&(this._conversationId=_),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,vi(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Wt(),sampleRand:Rt()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:oie;if(r<=0)return this;let o={timestamp:Po(),...e,message:e.message?ps(e.message,2048):e.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Li(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ms(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n?.event_id||dt();if(!this._client)return C&&g.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){let o=r?.event_id||dt();if(!this._client)return C&&g.warn("No client configured on scope - will not capture message!"),o;let s=r?.syntheticException??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=e.event_id||n?.event_id||dt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(C&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function mc(){return Ar("defaultCurrentScope",()=>new Sn)}function Jn(){return Ar("defaultIsolationScope",()=>new Sn)}var cG=t=>t instanceof Promise&&!t[uG],uG=Symbol("chained PromiseLike"),yf=(t,e,n)=>{let r=t.then(o=>(e(o),o),o=>{throw n(o),o});return cG(r)&&cG(t)?r:sie(t,r)},sie=(t,e)=>{let n=!1;for(let r in t){if(r in e)continue;n=!0;let o=t[r];typeof o=="function"?Object.defineProperty(e,r,{value:(...s)=>o.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=o}return n&&Object.assign(e,{[uG]:!0}),e};var hR=class{constructor(e,n){let r;e?r=e:r=new Sn;let o;n?o=n:o=new Sn,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){let n=this._pushScope(),r;try{r=e(n)}catch(o){throw this._popScope(),o}return xt(r)?yf(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Tc(){let t=sn(),e=us(t);return e.stack=e.stack||new hR(mc(),Jn())}function iie(t){return Tc().withScope(t)}function aie(t,e){let n=Tc();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function lG(t){return Tc().withScope(()=>t(Tc().getIsolationScope()))}function pG(){return{withIsolationScope:lG,withScope:iie,withSetScope:aie,withSetIsolationScope:(t,e)=>lG(e),getCurrentScope:()=>Tc().getScope(),getIsolationScope:()=>Tc().getIsolationScope()}}function ER(t){let e=sn(),n=us(e);n.acs=t}function Rr(t){let e=us(t);return e.acs?e.acs:pG()}var dG;function _G(){return dG?.()}function SR(){return dG!==void 0}function Te(){let t=sn();return Rr(t).getCurrentScope()}function ue(){let t=sn();return Rr(t).getIsolationScope()}function If(){return Ar("globalScope",()=>new Sn)}function wn(...t){let e=sn(),n=Rr(e);if(t.length===2){let[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function Bl(...t){let e=sn(),n=Rr(e);if(t.length===2){let[r,o]=t;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(t[0])}function H(){return Te().getClient()}function Di(t){let e=_G();if(e)return{trace_id:e.traceId,span_id:e.spanId};let n=t.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:s}=n,i={trace_id:r,span_id:s||zt()};return o&&(i.parent_span_id=o),i}var Ue="sentry.source",yr="sentry.sample_rate",gR="sentry.previous_trace_sample_rate",ee="sentry.op",W="sentry.origin";var AR="sentry.measurement_unit",RR="sentry.measurement_value",Zn="sentry.custom_span_name",hc="sentry.profile_id",Ec="sentry.exclusive_time",yR="cache.hit",IR="cache.key",NR="cache.item_size",OR="http.request.method",Ts="url.full";var bR="gen_ai.conversation.id";function xo(t){if(t<400&&t>=100)return{code:1};if(t>=400&&t<500)switch(t){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}var fG="_sentryScope",mG="_sentryIsolationScope";function cie(t){try{let e=J.WeakRef;if(typeof e=="function")return new e(t)}catch{}return t}function uie(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function jl(t,e,n){t&&(nt(t,mG,cie(n)),nt(t,fG,e))}function Ir(t){let e=t;return{scope:e[fG],isolationScope:uie(e[mG])}}var zr="sentry-";var hG=8192;function vo(t){let e=wi(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.startsWith(zr)){let i=o.slice(zr.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Ui(t){if(!t)return;let e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${zr}${r}`]=o),n),{});return Nf(e)}function wi(t){if(!(!t||!ls(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let r=TG(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):TG(t)}function TG(t){return t.split(",").map(e=>{let n=e.indexOf("=");if(n===-1)return[];let r=e.slice(0,n),o=e.slice(n+1);return[r,o].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function Nf(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{let s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>hG?(C&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}var lie=/^o(\d+)\./,pie=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function die(t){return t==="http"||t==="https"}function kn(t,e=!1){let{host:n,path:r,pass:o,port:s,projectId:i,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${i}`}function _ie(t){let e=pie.exec(t);if(!e){Qe(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s="",i="",a=""]=e.slice(1),c="",l=a,p=l.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),l=p.pop()),l){let d=l.match(/^\d+/);d&&(l=d[0])}return EG({host:s,pass:o,path:c,projectId:l,port:i,protocol:n,publicKey:r})}function EG(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function fie(t){if(!C)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(g.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?die(r)?e&&isNaN(parseInt(e,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function mie(t){return t.match(lie)?.[1]}function Of(t){let e=t.getOptions(),{host:n}=t.getDsn()||{},r;return e.orgId?r=String(e.orgId):n&&(r=mie(n)),r}function SG(t){let e=typeof t=="string"?_ie(t):EG(t);if(!(!e||!fie(e)))return e}function Gn(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var bf=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function gG(t){if(!t)return;let e=t.match(bf);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Hl(t,e){let n=gG(t),r=vo(e);if(!n?.traceId)return{traceId:Wt(),sampleRand:Rt()};let o=Tie(n,r);r&&(r.sample_rand=o.toString());let{traceId:s,parentSpanId:i,parentSampled:a}=n;return{traceId:s,parentSpanId:i,sampled:a,dsc:r||{},sampleRand:o}}function hs(t=Wt(),e=zt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function Es(t=Wt(),e=zt(),n){return`00-${t}-${e}-${n?"01":"00"}`}function Tie(t,e){let n=Gn(e?.sample_rand);if(n!==void 0)return n;let r=Gn(e?.sample_rate);return r&&t?.parentSampled!==void 0?t.parentSampled?Rt()*r:r+Rt()*(1-r):Rt()}function CR(t,e){let n=Of(t);return e&&n&&e!==n?(g.log(`Won't continue trace because org IDs don't match (incoming baggage: ${e}, SDK options: ${n})`),!1):(t.getOptions().strictTraceContinuation||!1)&&(e&&!n||!e&&n)?(g.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${e}, Sentry client: ${n})`),!1):!0}var Pf=0,Mf=1,AG=!1;function yG(t){let{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,origin:a,links:c}=Y(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:o,status:i,origin:a,links:c}}function Ss(t){let{spanId:e,traceId:n,isRemote:r}=t.spanContext(),o=r?e:Y(t).parent_span_id,s=Ir(t).scope,i=r?s?.getPropagationContext().propagationSpanId||zt():e;return{parent_span_id:o,span_id:i,trace_id:n}}function xf(t){let{traceId:e,spanId:n}=t.spanContext(),r=Nr(t);return hs(e,n,r)}function IG(t){let{traceId:e,spanId:n}=t.spanContext(),r=Nr(t);return Es(e,n,r)}function ki(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...o},attributes:s})=>({span_id:e,trace_id:n,sampled:r===Mf,attributes:s,...o}))}function gn(t){return typeof t=="number"?RG(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?RG(t.getTime()):fs()}function RG(t){return t>9999999999?t/1e3:t}function Y(t){if(Sie(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(Eie(t)){let{attributes:r,startTime:o,name:s,endTime:i,status:a,links:c}=t,l="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:l,start_timestamp:gn(o),timestamp:gn(i)||void 0,status:Gi(a),op:r[ee],origin:r[W],links:ki(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Eie(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Sie(t){return typeof t.getSpanJSON=="function"}function Nr(t){let{traceFlags:e}=t.spanContext();return e===Mf}function Gi(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"internal_error"}var Vl="_sentryChildSpans",PR="_sentryRootSpan";function Sc(t,e){let n=t[PR]||t;nt(e,PR,n),t[Vl]?t[Vl].add(e):nt(t,Vl,new Set([e]))}function vf(t){let e=new Set;function n(r){if(!e.has(r)&&Nr(r)){e.add(r);let o=r[Vl]?Array.from(r[Vl]):[];for(let s of o)n(s)}}return n(t),Array.from(e)}function je(t){return t[PR]||t}function er(){let t=sn(),e=Rr(t);return e.getActiveSpan?e.getActiveSpan():Li(Te())}function Fl(){AG||(Qe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),AG=!0)}var NG=!1;function OG(){if(NG)return;function t(){let e=er(),n=e&&je(e);if(n){let r="internal_error";C&&g.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}t.tag="sentry_tracingErrorCallback",NG=!0,Kk(t),Qk(t)}function Xe(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||H()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function bG(t){g.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function ql(t,e){if(!e?.length||!t.description)return!1;for(let n of e){if(gie(n)){if(Co(t.description,n))return C&&bG(t),!0;continue}if(!n.name&&!n.op)continue;let r=n.name?Co(t.description,n.name):!0,o=n.op?t.op&&Co(t.op,n.op):!0;if(r&&o)return C&&bG(t),!0}return!1}function CG(t,e){let n=e.parent_span_id,r=e.span_id;if(n)for(let o of t)o.parent_span_id===r&&(o.parent_span_id=n)}function gie(t){return typeof t=="string"||t instanceof RegExp}var gc="production";var PG="_frozenDsc";function Lf(t,e){nt(t,PG,e)}function MR(t,e){let n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o={environment:n.environment||gc,release:n.release,public_key:r,trace_id:t,org_id:Of(e)};return e.emit("createDsc",o),o}function Kr(t,e){let n=e.getPropagationContext();return n.dsc||MR(n.traceId,t)}function Je(t){let e=H();if(!e)return{};let n=je(t),r=Y(n),o=r.data,s=n.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[yr]??o[gR];function a(m){return(typeof i=="number"||typeof i=="string")&&(m.sample_rate=`${i}`),m}let c=n[PG];if(c)return a(c);let l=s?.get("sentry.dsc"),p=l&&vo(l);if(p)return a(p);let d=MR(t.spanContext().traceId,e),_=o[Ue],f=r.description;return _!=="url"&&f&&(d.transaction=f),Xe()&&(d.sampled=String(Nr(n)),d.sample_rand=s?.get("sentry.sample_rand")??Ir(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}var gs=class{constructor(e={}){this._traceId=e.traceId||Wt(),this._spanId=e.spanId||zt()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Pf}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};function Or(t,e=100,n=1/0){try{return xR("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function vR(t,e=3,n=100*1024){let r=Or(t,e);return Iie(r)>n?vR(t,e-1,n):r}function xR(t,e,n=1/0,r=1/0,o=Nie()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=Aie(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let l=e;if(l&&typeof l.toJSON=="function")try{let f=l.toJSON();return xR("",f,c-1,r,o)}catch{}let p=Array.isArray(e)?[]:{},d=0,_=Af(e);for(let f in _){if(!Object.prototype.hasOwnProperty.call(_,f))continue;if(d>=r){p[f]="[MaxProperties ~]";break}let m=_[f];p[f]=xR(f,m,c-1,r,o),d++}return i(e),p}function Aie(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Gl(e))return Ef(e);if(iR(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${wl(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=Rie(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Rie(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function yie(t){return~-encodeURI(t).split(/%..|./).length}function Iie(t){return yie(JSON.stringify(t))}function Nie(){let t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function an(t,e=[]){return[t,e]}function DR(t,e){let[n,r]=t;return[n,[...r,e]]}function $l(t,e){let n=t[1];for(let r of n){let o=r[0].type;if(e(r,o))return!0}return!1}function UR(t,e){return $l(t,(n,r)=>e.includes(r))}function LR(t){let e=us(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Yl(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[LR(r),s]:r.push(typeof s=="string"?LR(s):s)}for(let s of n){let[i,a]=s;if(o(`
|
|
16
|
+
${JSON.stringify(i)}
|
|
17
|
+
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Or(a))}o(c)}}return typeof r=="string"?r:Oie(r)}function Oie(t){let e=t.reduce((o,s)=>o+s.length,0),n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.length;return n}function wR(t){return[{type:"span"},t]}function kR(t){let e=typeof t.data=="string"?LR(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var MG={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function bie(t){return t in MG}function Df(t){return bie(t)?MG[t]:t}function Uf(t){if(!t?.sdk)return;let{name:e,version:n}=t.sdk;return{name:e,version:n}}function GR(t,e,n,r){let o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:kn(r)},...o&&{trace:o}}}function Cie(t,e){if(!e)return t;let n=t.sdk||{};return t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0},t}function xG(t,e,n,r){let o=Uf(n),s={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:kn(e)}},i="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return an(s,[i])}function vG(t,e,n,r){let o=Uf(n),s=t.type&&t.type!=="replay_event"?t.type:"event";Cie(t,n?.sdk);let i=GR(t,o,r,e);return delete t.sdkProcessingMetadata,an(i,[[{type:s},t]])}function LG(t,e){function n(f){return!!f.trace_id&&!!f.public_key}let r=Je(t[0]),o=e?.getDsn(),s=e?.getOptions().tunnel,i={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&o&&{dsn:kn(o)}},{beforeSendSpan:a,ignoreSpans:c}=e?.getOptions()||{},l=c?.length?t.filter(f=>!ql(Y(f),c)):t,p=t.length-l.length;p&&e?.recordDroppedEvent("before_send","span",p);let d=a?f=>{let m=Y(f),T=a(m);return T||(Fl(),m)}:Y,_=[];for(let f of l){let m=d(f);m&&_.push(wR(m))}return an(i,_)}function Wl(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Y(t),{spanId:o}=t.spanContext(),s=Nr(t),i=je(t),a=i===t,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${a?"root ":""}span`,l=[`op: ${n}`,`name: ${e}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!a){let{op:p,description:d}=Y(i);l.push(`root ID: ${i.spanContext().spanId}`),p&&l.push(`root op: ${p}`),d&&l.push(`root description: ${d}`)}g.log(`${c}
|
|
18
|
+
${l.join(`
|
|
19
|
+
`)}`)}function zl(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >"}=Y(t),{spanId:r}=t.spanContext(),s=je(t)===t,i=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;g.log(i)}function Bi(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let r=n.attributes||{},o=r[AR],s=r[RR];typeof o=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:o})}),e}var DG=1e3,Ac=class{constructor(e={}){this._traceId=e.traceId||Wt(),this._spanId=e.spanId||zt(),this._startTime=e.startTimestamp||fs(),this._links=e.links,this._attributes={},this.setAttributes({[W]:"manual",[ee]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){let{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?Mf:Pf}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=gn(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Ue,"custom"),this}end(e){this._endTime||(this._endTime=gn(e),zl(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[ee],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Gi(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[W],profile_id:this._attributes[hc],exclusive_time:this._attributes[Ec],measurements:Bi(this._events),is_segment:this._isStandaloneSpan&&je(this)===this||void 0,segment_id:this._isStandaloneSpan?je(this).spanContext().spanId:void 0,links:ki(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){C&&g.log("[Tracing] Adding an event to span:",e);let o=UG(n)?n:r||fs(),s=UG(n)?{}:n||{},i={name:e,time:gn(o),attributes:s};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=H();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===je(this)))return;if(this._isStandaloneSpan){this._sampled?Mie(LG([this],e)):(C&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}let r=this._convertSpanToTransaction();r&&(Ir(this).scope||Te()).captureEvent(r)}_convertSpanToTransaction(){if(!wG(Y(this)))return;this._name||(C&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:e,isolationScope:n}=Ir(this),r=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let s=vf(this).filter(p=>p!==this&&!Pie(p)).map(p=>Y(p)).filter(wG),i=this._attributes[Ue];delete this._attributes[Zn],s.forEach(p=>{delete p.data[Zn]});let a={contexts:{trace:yG(this)},spans:s.length>DG?s.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,DG):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Je(this)},request:r,...i&&{transaction_info:{source:i}}},c=Bi(this._events);return c&&Object.keys(c).length&&(C&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}};function UG(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function wG(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function Pie(t){return t instanceof Ac&&t.isStandaloneSpan()}function Mie(t){let e=H();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function br(t,e,n=()=>{},r=()=>{}){let o;try{o=t()}catch(s){throw e(s),n(),s}return xie(o,e,n,r)}function xie(t,e,n,r){return xt(t)?yf(t,o=>{n(),r(o)},o=>{e(o),n()}):(n(),r(t),t)}function Kl(t,e,n){if(!Xe(t))return[!1];let r,o;typeof t.tracesSampler=="function"?(o=t.tracesSampler({...e,inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a}),r=!0):e.parentSampled!==void 0?o=e.parentSampled:typeof t.tracesSampleRate<"u"&&(o=t.tracesSampleRate,r=!0);let s=Gn(o);if(s===void 0)return C&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!s)return C&&g.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];let i=n<s;return i||C&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[i,s,r]}var wf="__SENTRY_SUPPRESS_TRACING__";function Cr(t,e){let n=Ql();if(n.startSpan)return n.startSpan(t,e);let r=jR(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return wn(a,()=>GG(s)(()=>{let l=Te(),p=HR(l,s),_=t.onlyIfParent&&!p?new gs:BR({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return vi(l,_),br(()=>e(_),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})},()=>{_.end()})}))}function yt(t,e){let n=Ql();if(n.startSpanManual)return n.startSpanManual(t,e);let r=jR(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return wn(a,()=>GG(s)(()=>{let l=Te(),p=HR(l,s),_=t.onlyIfParent&&!p?new gs:BR({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return vi(l,_),br(()=>e(_,()=>_.end()),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})})}))}function kf(t){let e=Ql();if(e.startInactiveSpan)return e.startInactiveSpan(t);let n=jR(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?i=>wn(t.scope,i):o!==void 0?i=>Rc(o,i):i=>i())(()=>{let i=Te(),a=HR(i,o);return t.onlyIfParent&&!a?new gs:BR({parentSpan:a,spanArguments:n,forceTransaction:r,scope:i})})}function Rc(t,e){let n=Ql();return n.withActiveSpan?n.withActiveSpan(t,e):wn(r=>(vi(r,t||void 0),e(r)))}function yc(t){let e=Ql();return e.suppressTracing?e.suppressTracing(t):wn(n=>{n.setSDKProcessingMetadata({[wf]:!0});let r=t();return n.setSDKProcessingMetadata({[wf]:void 0}),r})}function BR({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!Xe()){let i=new gs;if(n||!t){let a={sampled:"false",sample_rate:"0",transaction:e.name,...Je(i)};Lf(i,a)}return i}let o=ue(),s;if(t&&!n)s=vie(t,r,e),Sc(t,s);else if(t){let i=Je(t),{traceId:a,spanId:c}=t.spanContext(),l=Nr(t);s=kG({traceId:a,parentSpanId:c,...e},r,l),Lf(s,i)}else{let{traceId:i,dsc:a,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};s=kG({traceId:i,parentSpanId:c,...e},r,l),a&&Lf(s,a)}return Wl(s),jl(s,r,o),s}function jR(t){let n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){let r={...n};return r.startTimestamp=gn(t.startTime),delete r.startTime,r}return n}function Ql(){let t=sn();return Rr(t)}function kG(t,e,n){let r=H(),o=r?.getOptions()||{},{name:s=""}=t,i={spanAttributes:{...t.attributes},spanName:s,parentSampled:n};r?.emit("beforeSampling",i,{decision:!1});let a=i.parentSampled??n,c=i.spanAttributes,l=e.getPropagationContext(),[p,d,_]=e.getScopeData().sdkProcessingMetadata[wf]?[!1]:Kl(o,{name:s,parentSampled:a,attributes:c,parentSampleRate:Gn(l.dsc?.sample_rate)},l.sampleRand),f=new Ac({...t,attributes:{[Ue]:"custom",[yr]:d!==void 0&&_?d:void 0,...c},sampled:p});return!p&&r&&(C&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",f),f}function vie(t,e,n){let{spanId:r,traceId:o}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[wf]?!1:Nr(t),i=s?new Ac({...n,parentSpanId:r,traceId:o,sampled:s}):new gs({traceId:o});Sc(t,i);let a=H();return a&&(a.emit("spanStart",i),n.endTimestamp&&a.emit("spanEnd",i)),i}function HR(t,e){if(e)return e;if(e===null)return;let n=Li(t);if(!n)return;let r=H();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?je(n):n}function GG(t){return t!==void 0?e=>Rc(t,e):e=>e()}var VR=0,BG=1,jG=2;function Lo(t){return new Gf(e=>{e(t)})}function Ic(t){return new Gf((e,n)=>{n(t)})}var Gf=class t{constructor(e){this._state=VR,this._handlers=[],this._runExecutor(e)}then(e,n){return new t((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}_executeHandlers(){if(this._state===VR)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===BG&&n[1](this._value),this._state===jG&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,i)=>{if(this._state===VR){if(xt(i)){i.then(r,o);return}this._state=s,this._value=i,this._executeHandlers()}},r=s=>{n(BG,s)},o=s=>{n(jG,s)};try{e(r,o)}catch(s){o(s)}}};function HG(t,e,n,r=0){try{let o=FR(e,n,t,r);return xt(o)?o:Lo(o)}catch(o){return Ic(o)}}function FR(t,e,n,r){let o=n[r];if(!t||!o)return t;let s=o({...t},e);return C&&s===null&&g.log(`Event processor "${o.id||"?"}" dropped event`),xt(s)?s.then(i=>FR(i,e,n,r+1)):FR(s,e,n,r+1)}var ji,VG,FG,As;function qG(t){let e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};let r=e?Object.keys(e):[],o=n?Object.keys(n):[];if(As&&r.length===VG&&o.length===FG)return As;VG=r.length,FG=o.length,As={},ji||(ji={});let s=(i,a)=>{for(let c of i){let l=a[c],p=ji?.[c];if(p&&As&&l)As[p[0]]=l,ji&&(ji[c]=[p[0],l]);else if(l){let d=t(c);for(let _=d.length-1;_>=0;_--){let m=d[_]?.filename;if(m&&As&&ji){As[m]=l,ji[c]=[m,l];break}}}}};return e&&s(r,e),n&&s(o,n),As}function YG(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;Lie(t,e),r&&wie(t,r),kie(t,n),Die(t,o),Uie(t,s)}function $G(t,e){let{extra:n,tags:r,attributes:o,user:s,contexts:i,level:a,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:_,propagationContext:f,transactionName:m,span:T}=e;Xl(t,"extra",n),Xl(t,"tags",r),Xl(t,"attributes",o),Xl(t,"user",s),Xl(t,"contexts",i),t.sdkProcessingMetadata=ms(t.sdkProcessingMetadata,c,2),a&&(t.level=a),m&&(t.transactionName=m),T&&(t.span=T),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),_.length&&(t.attachments=[...t.attachments,..._]),t.propagationContext={...t.propagationContext,...f}}function Xl(t,e,n){t[e]=ms(t[e],n,1)}function Bf(t,e){let n=If().getScopeData();return t&&$G(n,t.getScopeData()),e&&$G(n,e.getScopeData()),n}function Lie(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(o).length&&(t.user={...o,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),i&&(t.level=i),a&&t.type!=="transaction"&&(t.transaction=a)}function Die(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Uie(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function wie(t,e){t.contexts={trace:Ss(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Je(e),...t.sdkProcessingMetadata};let n=je(e),r=Y(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function kie(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function WG(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||dt(),timestamp:e.timestamp||Po()},l=n.integrations||t.integrations.map(S=>S.name);Gie(c,t),Hie(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Bie(c,t.stackParser);let p=Fie(r,n.captureContext);n.mechanism&&fc(c,n.mechanism);let d=o?o.getEventProcessors():[],_=Bf(s,p),f=[...n.attachments||[],..._.attachments];f.length&&(n.attachments=f),YG(c,_);let m=[...d,..._.eventProcessors];return(n.data&&n.data.__sentry__===!0?Lo(c):HG(m,c,n)).then(S=>(S&&jie(S),typeof i=="number"&&i>0?Vie(S,i,a):S))}function Gie(t,e){let{environment:n,release:r,dist:o,maxValueLength:s}=e;t.environment=t.environment||n||gc,!t.release&&r&&(t.release=r),!t.dist&&o&&(t.dist=o);let i=t.request;i?.url&&s&&(i.url=ps(i.url,s)),s&&t.exception?.values?.forEach(a=>{a.value&&(a.value=ps(a.value,s))})}function Bie(t,e){let n=qG(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function jie(t){let e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function Hie(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Vie(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Or(o.data,e,n)}}))},...t.user&&{user:Or(t.user,e,n)},...t.contexts&&{contexts:Or(t.contexts,e,n)},...t.extra&&{extra:Or(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Or(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Or(o.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Or(t.contexts.flags,3,n)),r}function Fie(t,e){if(!e)return t;let n=t?t.clone():new Sn;return n.update(e),n}function zG(t){if(t)return qie(t)?{captureContext:t}:Yie(t)?{captureContext:t}:t}function qie(t){return t instanceof Sn||typeof t=="function"}var $ie=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Yie(t){return Object.keys(t).some(e=>$ie.includes(e))}function te(t,e){return Te().captureException(t,zG(e))}function jf(t,e){return Te().captureEvent(t,e)}function Hf(t,e){ue().setTag(t,e)}async function Vf(t){let e=H();return e?e.flush(t):(C&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function Ff(t){let e=H();return e?e.close(t):(C&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function qf(){let t=H();return t?.getOptions().enabled!==!1&&!!t?.getTransport()}function $f(t){let e=ue(),{user:n}=Bf(e,Te()),{userAgent:r}=J.navigator||{},o=iG({user:n,...r&&{userAgent:r},...t}),s=e.getSession();return s?.status==="ok"&&Mo(s,{status:"exited"}),Jl(),e.setSession(o),o}function Jl(){let t=ue(),n=Te().getSession()||t.getSession();n&&aG(n),Wie(),t.setSession()}function Wie(){let t=ue(),e=H(),n=t.getSession();n&&e&&e.captureSession(n)}var zie="7";function Kie(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function Qie(t){return`${Kie(t)}${t.projectId}/envelope/`}function Xie(t,e){let n={sentry_version:zie};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function KG(t,e,n){return e||`${Qie(t)}?${Xie(t,n)}`}var qR=[];function Jie(t){let e={};return t.forEach(n=>{let{name:r}=n,o=e[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function $R(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){let o=n(e);r=Array.isArray(o)?o:[o]}else r=e;return Jie(r)}function QG(t,e){let n={};return e.forEach(r=>{r&&WR(t,r,n)}),n}function YR(t,e){for(let n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function WR(t,e,n){if(n[e.name]){C&&g.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!qR.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),qR.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,s)=>r(o,s,t))}if(typeof e.processEvent=="function"){let r=e.processEvent.bind(e),o=Object.assign((s,i)=>r(s,i,t),{id:e.name});t.addEventProcessor(o)}C&&g.log(`Integration installed: ${e.name}`)}function XG(t,e){return e?wn(e,()=>{let n=er(),r=n?Ss(n):Di(e);return[n?Je(n):Kr(t,e),r]}):[void 0,void 0]}function Zie(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function JG(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=kn(r)),an(o,[Zie(t)])}function Nc(t,e){let n=e??eae(t)??[];if(n.length===0)return;let r=t.getOptions(),o=JG(n,r._metadata,r.tunnel,t.getDsn());ZG().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function eae(t){return ZG().get(t)}function ZG(){return Ar("clientToLogBufferMap",()=>new WeakMap)}function tae(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function eB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=kn(r)),an(o,[tae(t)])}function tB(t,e){let n=e??nae(t)??[];if(n.length===0)return;let r=t.getOptions(),o=eB(n,r._metadata,r.tunnel,t.getDsn());nB().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(o)}function nae(t){return nB().get(t)}function nB(){return Ar("clientToMetricBufferMap",()=>new WeakMap)}function Yf(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}var Zl=Symbol.for("SentryBufferFullError");function Oc(t=100){let e=new Set;function n(){return e.size<t}function r(i){e.delete(i)}function o(i){if(!n())return Ic(Zl);let a=i();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function s(i){if(!e.size)return Lo(!0);let a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!i)return a;let c=[a,new Promise(l=>Yf(setTimeout(()=>l(!1),i)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:o,drain:s}}var rae=60*1e3;function oae(t,e=Xn()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?rae:r-e}function sae(t,e){return t[e]||t.all||0}function rB(t,e,n=Xn()){return sae(t,e)>n}function oB(t,{statusCode:e,headers:n},r=Xn()){let o={...t},s=n?.["x-sentry-rate-limits"],i=n?.["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,l,,,p]=a.split(":",5),d=parseInt(c,10),_=(isNaN(d)?60:d)*1e3;if(!l)o.all=r+_;else for(let f of l.split(";"))f==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[f]=r+_):o[f]=r+_}else i?o.all=r+oae(i,r):e===429&&(o.all=r+60*1e3);return o}var ep=64;function tp(t,e,n=Oc(t.bufferSize||ep)){let r={},o=i=>n.drain(i);function s(i){let a=[];if($l(i,(d,_)=>{let f=Df(_);rB(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});let c=an(i[0],a),l=d=>{if(UR(c,["client_report"])){C&&g.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}$l(c,(_,f)=>{t.recordDroppedEvent(d,Df(f))})},p=()=>e({body:Yl(c)}).then(d=>d.statusCode===413?(C&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),d):(C&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&g.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=oB(r,d),d),d=>{throw l("network_error"),C&&g.error("Encountered error running transport request:",d),d});return n.add(p).then(d=>d,d=>{if(d===Zl)return C&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:o}}function sB(t,e,n){let r=[{type:"client_report"},{timestamp:n||Po(),discarded_events:t}];return an(e?{dsn:e}:{},[r])}function Wf(t){let e=[];t.message&&e.push(t.message);try{let n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function iB(t){let{trace_id:e,parent_span_id:n,span_id:r,status:o,origin:s,data:i,op:a}=t.contexts?.trace??{};return{data:i??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:o,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:i?.[hc],exclusive_time:i?.[Ec],measurements:t.measurements,is_segment:!0}}function aB(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[hc]:t.profile_id},...t.exclusive_time&&{[Ec]:t.exclusive_time}}}},measurements:t.measurements}}var cB="Not capturing exception because it's already been captured.",uB="Discarded session because of missing or non-string release",mB=Symbol.for("SentryInternalError"),TB=Symbol.for("SentryDoNotSendEventError"),iae=5e3;function zf(t){return{message:t,[mB]:!0}}function zR(t){return{message:t,[TB]:!0}}function lB(t){return!!t&&typeof t=="object"&&mB in t}function pB(t){return!!t&&typeof t=="object"&&TB in t}function dB(t,e,n,r,o){let s=0,i,a=!1;t.on(n,()=>{s=0,clearTimeout(i),a=!1}),t.on(e,c=>{s+=r(c),s>=8e5?o(t):a||(a=!0,i=Yf(setTimeout(()=>{o(t)},iae)))}),t.on("flush",()=>{o(t)})}var Kf=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Oc(e.transportOptions?.bufferSize??ep),e.dsn?this._dsn=SG(e.dsn):C&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=KG(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&dB(this,"afterCaptureLog","flushLogs",lae,Nc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&dB(this,"afterCaptureMetric","flushMetrics",uae,tB)}captureException(e,n,r){let o=dt();if(Rf(e))return C&&g.log(cB),o;let s={event_id:o,...n};return this._process(()=>this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r)).then(i=>i),"error"),s.event_id}captureMessage(e,n,r,o){let s={event_id:dt(),...r},i=dc(e)?e:String(e),a=kl(e),c=a?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(()=>c.then(l=>this._captureEvent(l,s,o)),a?"unknown":"error"),s.event_id}captureEvent(e,n,r){let o=dt();if(n?.originalException&&Rf(n.originalException))return C&&g.log(cB),o;let s={event_id:o,...n},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,c=i.capturedSpanIsolationScope,l=_B(e.type);return this._process(()=>this._captureEvent(e,s,a||r,c),l),s.event_id}captureSession(e){this.sendSession(e),Mo(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let n=this._transport;if(!n)return!0;this.emit("flush");let r=await this._isClientDoneProcessing(e),o=await n.flush(e);return r&&o}async close(e){Nc(this);let n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let n=this._integrations[e.name];WR(this,e,this._integrations),n||YR(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=vG(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of n.attachments||[])r=DR(r,kR(o));this.sendEnvelope(r).then(o=>this.emit("afterSendEvent",e,o))}sendSession(e){let{release:n,environment:r=gc}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){C&&g.warn(uB);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){C&&g.warn(uB);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=xG(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){let o=`${e}:${n}`;C&&g.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(e,n){let r=this._hooks[e]=this._hooks[e]||new Set,o=(...s)=>n(...s);return r.add(o),()=>{r.delete(o)}}emit(e,...n){let r=this._hooks[e];r&&r.forEach(o=>o(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return C&&g.error("Error while sending envelope:",n),{}}return C&&g.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=QG(this,e),YR(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",o=!1,s=n.exception?.values;if(s){o=!0,r=!1;for(let c of s)if(c.mechanism?.handled===!1){r=!0;break}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(Mo(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,o){let s=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&i?.length&&(n.integrations=i),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),WG(s,e,n,r,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...Di(r)},...a.contexts};let c=Kr(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=Te(),o=ue()){return C&&KR(e)&&g.log(`Captured error event \`${Wf(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,o).then(s=>s.event_id,s=>{C&&(pB(s)?g.log(s.message):lB(s)?g.warn(s.message):g.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=hB(e),c=KR(e),p=`before send for type \`${e.type||"error"}\``,d=typeof i>"u"?void 0:Gn(i);if(c&&typeof d=="number"&&Rt()>d)return this.recordDroppedEvent("sample_rate","error"),Ic(zR(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));let _=_B(e.type);return this._prepareEvent(e,n,r,o).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",_),zR("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return f;let T=cae(this,s,f,n);return aae(T,p)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",_),a){let S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw zR(`${p} returned \`null\`, will not send event.`)}let m=r.getSession()||o.getSession();if(c&&m&&this._updateSessionFromEvent(m,f),a){let h=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,S=f.spans?f.spans.length:0,R=h-S;R>0&&this.recordDroppedEvent("before_send","span",R)}let T=f.transaction_info;if(a&&T&&f.transaction!==e.transaction){let h="custom";f.transaction_info={...T,source:h}}return this.sendEvent(f,n),f}).then(null,f=>{throw pB(f)||lB(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),zf(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
20
|
+
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===Zl&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{let[o,s]=n.split(":");return{reason:o,category:s,quantity:r}})}_flushOutcomes(){C&&g.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){C&&g.log("No outcomes to send");return}if(!this._dsn){C&&g.log("No dsn provided, will not send outcomes");return}C&&g.log("Sending outcomes:",e);let n=sB(e,this._options.tunnel&&kn(this._dsn));this.sendEnvelope(n)}};function _B(t){return t==="replay_event"?"replay":t||"error"}function aae(t,e){let n=`${e} must return \`null\` or a valid event.`;if(xt(t))return t.then(r=>{if(!bo(r)&&r!==null)throw zf(n);return r},r=>{throw zf(`${e} rejected with ${r}`)});if(!bo(t)&&t!==null)throw zf(n);return t}function cae(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i,ignoreSpans:a}=e,c=n;if(KR(c)&&o)return o(c,r);if(hB(c)){if(i||a){let l=iB(c);if(a?.length&&ql(l,a))return null;if(i){let p=i(l);p?c=ms(n,aB(p)):Fl()}if(c.spans){let p=[],d=c.spans;for(let f of d){if(a?.length&&ql(f,a)){CG(d,f);continue}if(i){let m=i(f);m?p.push(m):(Fl(),p.push(f))}else p.push(f)}let _=c.spans.length-p.length;_&&t.recordDroppedEvent("before_send","span",_),c.spans=p}}if(s){if(c.spans){let l=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return s(c,r)}}return c}function KR(t){return t.type===void 0}function hB(t){return t.type==="transaction"}function uae(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+EB(t.attributes)}function lae(t){let e=0;return t.message&&(e+=t.message.length*2),e+EB(t.attributes)}function EB(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*fB(n[0]):kl(n)?e+=fB(n):e+=100}),e}function fB(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function SB(t,e,n,r,o){let s={sent_at:new Date().toISOString()};n?.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(s.dsn=kn(o)),e&&(s.trace=e);let i=pae(t);return an(s,[i])}function pae(t){return[{type:"check_in"},t]}function gB(t){let e=t._metadata?.sdk,n=e?.name&&e?.version?`${e?.name}/${e?.version}`:void 0;t.transportOptions={...t.transportOptions,headers:{...n&&{"user-agent":n},...t.transportOptions?.headers}}}function AB(t,e){return t(e.stack||"",1)}function dae(t){return Yr(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function _ae(t){return dae(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function QR(t,e){let n={type:e.name||e.constructor.name,value:_ae(e)},r=AB(t,e);return r.length&&(n.stacktrace={frames:r}),n}function fae(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function mae(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message '${t.message}'`),r}else if("message"in t&&typeof t.message=="string")return t.message;let e=uR(t);if(nR(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=Tae(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function Tae(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function hae(t,e,n,r){if(Yr(n))return[n,void 0];if(e.synthetic=!0,bo(n)){let s=t?.getOptions().normalizeDepth,i={__serialized__:vR(n,s)},a=fae(n);if(a)return[a,i];let c=mae(n),l=r?.syntheticException||new Error(c);return l.message=c,[l,i]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function RB(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=hae(t,s,n,r),c={exception:{values:[QR(e,i)]}};return a&&(c.extra=a),fR(c,void 0,void 0),fc(c,s),{...c,event_id:r?.event_id}}function yB(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=AB(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]},fc(s,{synthetic:!0}))}if(dc(e)){let{__sentry_template_string__:i,__sentry_template_values__:a}=e;return s.logentry={message:i,params:a},s}return s.message=e,s}var np=class extends Kf{constructor(e){OG(),gB(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,n){let r=RB(this,this._options.stackParser,e,n);return r.level="error",Lo(r)}eventFromMessage(e,n="info",r){return Lo(yB(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return IB(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&IB(n),super.captureEvent(e,n,r)}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:dt();if(!this._isEnabled())return C&&g.warn("SDK not enabled, will not capture check-in."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,l={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(l.duration=e.duration),n&&(l.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[p,d]=XG(this,r);d&&(l.contexts={trace:d});let _=SB(l,p,this.getSdkMetadata(),c,this.getDsn());return C&&g.log("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(_),o}dispose(){C&&g.log("Disposing client...");for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Oc(ep)}_prepareEvent(e,n,r,o){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,n,r,o)}_setUpMetricsProcessing(){this.on("processMetric",e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function IB(t){let e=ue().getScopeData().sdkProcessingMetadata.requestSession;if(e){let n=t?.mechanism?.handled??!0;n&&e.status!=="crashed"?e.status="errored":n||(e.status="crashed")}}var XR=new Set;function JR(t){t.forEach(e=>{XR.add(e),C&&g.log(`AI provider "${e}" wrapping will be skipped`)})}function Hi(t){return XR.has(t)}function ZR(){XR.clear(),C&&g.log("Cleared AI provider skip registrations")}var Eae=new Set(["false","f","n","no","off","0"]),Sae=new Set(["true","t","y","yes","on","1"]);function bc(t,e){let n=String(t).toLowerCase();return Eae.has(n)?!1:Sae.has(n)?!0:e?.strict?null:!!t}var gae="thismessage:/";function ey(t){return"isRelative"in t}function rp(t,e){let n=t.indexOf("://")<=0&&t.indexOf("//")!==0,r=e??(n?gae:void 0);try{if("canParse"in URL&&!URL.canParse(t,r))return;let o=new URL(t,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function NB(t){if(ey(t))return t.pathname;let e=new URL(t);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function Aae(t,e,n,r){let o=n?.method?.toUpperCase()??"GET",s=r||(t?e==="client"?NB(t):t.pathname:"/");return`${o} ${s}`}function ty(t,e,n,r,o){let s={[W]:n,[Ue]:"url"};return o&&(s[e==="server"?"http.route":"url.template"]=o,s[Ue]="route"),r?.method&&(s[OR]=r.method.toUpperCase()),t&&(t.search&&(s["url.query"]=t.search),t.hash&&(s["url.fragment"]=t.hash),t.pathname&&(s["url.path"]=t.pathname,t.pathname==="/"&&(s[Ue]="route")),ey(t)||(s[Ts]=t.href,t.port&&(s["url.port"]=t.port),t.protocol&&(s["url.scheme"]=t.protocol),t.hostname&&(s[e==="server"?"server.address":"url.domain"]=t.hostname))),[Aae(t,e,r,o),s]}function Rs(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Do(t){return t.split(/[?#]/,1)[0]}function ys(t){let{protocol:e,host:n,path:r}=t,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${e?`${e}://`:""}${o}${r}`}function Cc(t,e=!0){if(t.startsWith("data:")){let n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=t.includes(";base64,"),s=t.indexOf(","),i="";if(e&&s!==-1){let a=t.slice(s+1);i=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${o?",base64":""}${i?`,${i}`:""}`}return t}function Vi(t,e,n=[e],r="npm"){let o=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${e}`,o.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:pe})),o.version=pe)}function Pc(t={}){let e=t.client||H();if(!qf()||!e)return{};let n=sn(),r=Rr(n);if(r.getTraceData)return r.getTraceData(t);let o=t.scope||Te(),s=t.span||er();if(!s&&SR())return{};let i=s?xf(s):Rae(o),a=s?Je(s):Kr(e,o),c=Ui(a);if(!bf.test(i))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let p={"sentry-trace":i,baggage:c};return t.propagateTraceparent&&(p.traceparent=s?IG(s):yae(o)),p}function Rae(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return hs(e,r,n)}function yae(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Es(e,r,n)}var OB="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Fi(t,e,n){if(typeof t!="string"||!e)return!0;let r=n?.get(t);if(r!==void 0)return C&&!r&&g.log(OB,t),r;let o=ds(t,e);return n?.set(t,o),C&&!o&&g.log(OB,t),o}function ny(t,e,n){let r,o,s,i=n?.maxWait?Math.max(n.maxWait,e):0,a=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=t(),r}function l(){o!==void 0&&clearTimeout(o),s!==void 0&&clearTimeout(s),o=s=void 0}function p(){return o!==void 0||s!==void 0?c():r}function d(){return o&&clearTimeout(o),o=a(c,e),i&&s===void 0&&(s=a(c,i)),r}return d.cancel=l,d.flush=p,d}function MB(t){let e=Object.create(null);try{Object.entries(t).forEach(([n,r])=>{typeof r=="string"&&(e[n]=r)})}catch{}return e}function op(t){let e=t.headers||{},r=(typeof e["x-forwarded-host"]=="string"?e["x-forwarded-host"]:void 0)||(typeof e.host=="string"?e.host:void 0),s=(typeof e["x-forwarded-proto"]=="string"?e["x-forwarded-proto"]:void 0)||t.protocol||(t.socket?.encrypted?"https":"http"),i=t.url||"",a=Iae({url:i,host:r,protocol:s}),c=t.body||void 0,l=t.cookies;return{url:a,method:t.method,query_string:xB(i),headers:MB(e),cookies:l,data:c}}function Iae({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}var bB=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","set-cookie","cookie"],Nae=["x-forwarded-","-user"];function Qf(t,e=!1,n="request"){let r={};try{Object.entries(t).forEach(([o,s])=>{if(s==null)return;let i=o.toLowerCase();if((i==="cookie"||i==="set-cookie")&&typeof s=="string"&&s!==""){let c=i==="set-cookie",l=s.indexOf(";"),p=c&&l!==-1?s.substring(0,l):s,d=c?[p]:p.split("; ");for(let _ of d){let f=_.indexOf("="),m=f!==-1?_.substring(0,f):_,T=f!==-1?_.substring(f+1):"",h=m.toLowerCase();PB(r,i,h,T,e,n)}}else PB(r,i,"",s,e,n)})}catch{}return r}function CB(t){return t.replace(/-/g,"_")}function PB(t,e,n,r,o,s){let i=Oae(n||e,r,o);if(i==null)return;let a=`http.${s}.header.${CB(e)}${n?`.${CB(n)}`:""}`;t[a]=i}function Oae(t,e,n){if(n?bB.some(o=>t.includes(o)):[...Nae,...bB].some(o=>t.includes(o)))return"[Filtered]";if(Array.isArray(e))return e.map(o=>o!=null?String(o):o).join(";");if(typeof e=="string")return e}function xB(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var bae=100;function tr(t,e){let n=H(),r=ue();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=bae}=n.getOptions();if(s<=0)return;let a={timestamp:Po(),...t},c=o?Qe(()=>o(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}var vB,Cae="FunctionToString",LB=new WeakMap,Pae=()=>({name:Cae,setupOnce(){vB=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=cR(this),n=LB.has(H())&&e!==void 0?e:this;return vB.apply(n,t)}}catch{}},setup(t){LB.set(t,!0)}}),Xf=Pae;var Mae=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],xae="EventFilters",ry=(t={})=>{let e;return{name:xae,setup(n){let r=n.getOptions();e=DB(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=DB(t,s)}return vae(n,e)?null:n}}},Zf=(t={})=>({...ry(t),name:"InboundFilters"});function DB(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Mae],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function vae(t,e){if(t.type){if(t.type==="transaction"&&Dae(t,e.ignoreTransactions))return C&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
21
|
+
Event: ${_s(t)}`),!0}else{if(Lae(t,e.ignoreErrors))return C&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
22
|
+
Event: ${_s(t)}`),!0;if(Gae(t))return C&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
23
|
+
Event: ${_s(t)}`),!0;if(Uae(t,e.denyUrls))return C&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
24
|
+
Event: ${_s(t)}.
|
|
25
|
+
Url: ${Jf(t)}`),!0;if(!wae(t,e.allowUrls))return C&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
26
|
+
Event: ${_s(t)}.
|
|
27
|
+
Url: ${Jf(t)}`),!0}return!1}function Lae(t,e){return e?.length?Wf(t).some(n=>ds(n,e)):!1}function Dae(t,e){if(!e?.length)return!1;let n=t.transaction;return n?ds(n,e):!1}function Uae(t,e){if(!e?.length)return!1;let n=Jf(t);return n?ds(n,e):!1}function wae(t,e){if(!e?.length)return!0;let n=Jf(t);return n?ds(n,e):!0}function kae(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Jf(t){try{let n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?kae(n):null}catch{return C&&g.error(`Cannot extract url for event ${_s(t)}`),null}}function Gae(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function kB(t,e,n,r,o,s){if(!o.exception?.values||!s||!Wr(s.originalException,Error))return;let i=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;i&&(o.exception.values=oy(t,e,r,s.originalException,n,o.exception.values,i,0))}function oy(t,e,n,r,o,s,i,a){if(s.length>=n+1)return s;let c=[...s];if(Wr(r[o],Error)){UB(i,a,r);let l=t(e,r[o]),p=c.length;wB(l,o,p,a),c=oy(t,e,n,r[o],o,[l,...c],l,p)}return GB(r)&&r.errors.forEach((l,p)=>{if(Wr(l,Error)){UB(i,a,r);let d=t(e,l),_=c.length;wB(d,`errors[${p}]`,_,a),c=oy(t,e,n,l,o,[d,...c],d,_)}}),c}function GB(t){return Array.isArray(t.errors)}function UB(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...GB(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function wB(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}var Bae="cause",jae=5,Hae="LinkedErrors",Vae=(t={})=>{let e=t.limit||jae,n=t.key||Bae;return{name:Hae,preprocessEvent(r,o,s){let i=s.getOptions();kB(QR,i.stackParser,n,e,r,o)}}},em=Vae;function BB(t){let e={},n=0;for(;n<t.length;){let r=t.indexOf("=",n);if(r===-1)break;let o=t.indexOf(";",n);if(o===-1)o=t.length;else if(o<r){n=t.lastIndexOf(";",r-1)+1;continue}let s=t.slice(n,r).trim();if(e[s]===void 0){let i=t.slice(r+1,o).trim();i.charCodeAt(0)===34&&(i=i.slice(1,-1));try{e[s]=i.indexOf("%")!==-1?decodeURIComponent(i):i}catch{e[s]=i}}n=o+1}return e}var sy=["X-Client-IP","X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP","Fastly-Client-Ip","True-Client-Ip","X-Real-IP","X-Cluster-Client-IP","X-Forwarded","Forwarded-For","Forwarded","X-Vercel-Forwarded-For"];function jB(t){let e={};for(let s of Object.keys(t))e[s.toLowerCase()]=t[s];return sy.map(s=>{let i=e[s.toLowerCase()],a=Array.isArray(i)?i.join(";"):i;return s==="Forwarded"?Fae(a):a?.split(",").map(c=>c.trim())}).reduce((s,i)=>i?s.concat(i):s,[]).find(s=>s!==null&&qae(s))||null}function Fae(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function qae(t){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(t)}var $ae={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},Yae="RequestData",Wae=(t={})=>{let e={...$ae,...t.include};return{name:Yae,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&zae(n,i,{ipAddress:a},c),n}}},tm=Wae;function zae(t,e,n,r){if(t.request={...t.request,...Kae(e,r)},r.ip){let o=e.headers&&jB(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function Kae(t,e){let n={},r={...t.headers};if(e.headers&&(n.headers=r,e.cookies||delete r.cookie,e.ip||sy.forEach(o=>{delete r[o]})),n.method=t.method,e.url&&(n.url=t.url),e.cookies){let o=t.cookies||(r?.cookie?BB(r.cookie):void 0);n.cookies=o||{}}return e.query_string&&(n.query_string=t.query_string),e.data&&(n.data=t.data),n}function HB(t){let e="console";uc(e,t),lc(e,Qae)}function Qae(){"console"in J&&Ul.forEach(function(t){t in J.console&&aR(J.console,t,function(e){return cc[t]=e,function(...n){pc("console",{args:n,level:t}),cc[t]?.apply(J.console,n)}})})}function VB(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var Xae=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Jae(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=Xae.exec(e);return n?n.slice(1):[]}function iy(t){let e=Jae(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var Zae=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,nm=Symbol("sentryPostgresConnectionContext"),ay=Symbol.for("sentry.instrumented.postgresjs"),ece=Symbol.for("sentry.query.from.instrumented.sql");function uy(t,e){return!t||typeof t!="function"?(C&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),t):cy(t,{requireParentSpan:!0,...e})}function cy(t,e,n){if(t[ay])return t;let r=new Proxy(t,{apply(o,s,i){let a=Reflect.apply(o,s,i);return a&&typeof a=="object"&&"handle"in a&&qB(a,r,e),a},get(o,s){let i=o[s];return typeof s!="string"||typeof i!="function"?i:s==="unsafe"||s==="file"?tce(i,o,r,e):s==="begin"||s==="reserve"?nce(i,o,r,e):i}});return n?r[nm]=n:ace(t,r),t[ay]=!0,r[ay]=!0,r}function tce(t,e,n,r){return function(...o){let s=Reflect.apply(t,e,o);return s&&typeof s=="object"&&"handle"in s&&qB(s,n,r),s}}function nce(t,e,n,r){return function(...o){let s=n[nm];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(t,e,o);return p&&typeof p.then=="function"?p.then(d=>cy(d,r,s)):p}let a=o.length===1?o[0]:o[1],c=function(p){let d=cy(p,r,s);return a(d)},l=o.length===1?[c]:[o[0],c];return Reflect.apply(t,e,l)}}function qB(t,e,n){if(t.handle?.__sentryWrapped)return;t[ece]=!0;let r=t.handle,o=async function(...s){if(!rce(n))return r.apply(this,s);let i=oce(t.strings),a=sce(i);return yt({name:a||"postgresjs.query",op:"db"},c=>{c.setAttribute(W,"auto.db.postgresjs"),c.setAttributes({"db.system.name":"postgres","db.query.text":a});let l=e?e[nm]:void 0;if(ice(c,l),n.requestHook)try{n.requestHook(c,a,l)}catch(d){c.setAttribute("sentry.hook.error","requestHook failed"),C&&g.error("Error in requestHook for PostgresJs instrumentation:",d)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(d,_,f)=>{try{FB(c,a,f?.[0]?.command),c.end()}catch(m){C&&g.error("Error ending span in resolve callback:",m)}return Reflect.apply(d,_,f)}}),p.reject=new Proxy(p.reject,{apply:(d,_,f)=>{try{c.setStatus({code:2,message:f?.[0]?.message||"unknown_error"}),c.setAttribute("db.response.status_code",f?.[0]?.code||"unknown"),c.setAttribute("error.type",f?.[0]?.name||"unknown"),FB(c,a),c.end()}catch(m){C&&g.error("Error ending span in reject callback:",m)}return Reflect.apply(d,_,f)}});try{return r.apply(this,s)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})};o.__sentryWrapped=!0,t.handle=o}function rce(t){return er()!==void 0||!t.requireParentSpan}function oce(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((e,n,r)=>r===0?n:`${e}$${r}${n}`,"")}function sce(t){return t?t.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"}function ice(t,e){if(e&&(e.ATTR_DB_NAMESPACE&&t.setAttribute("db.namespace",e.ATTR_DB_NAMESPACE),e.ATTR_SERVER_ADDRESS&&t.setAttribute("server.address",e.ATTR_SERVER_ADDRESS),e.ATTR_SERVER_PORT!==void 0)){let n=parseInt(e.ATTR_SERVER_PORT,10);isNaN(n)||t.setAttribute("server.port",n)}}function FB(t,e,n){if(n){t.setAttribute("db.operation.name",n);return}let r=e?.match(Zae);r?.[1]&&t.setAttribute("db.operation.name",r[1].toUpperCase())}function ace(t,e){let n=t;if(!n.options||typeof n.options!="object")return;let r=n.options,o=r.host?.[0]||"localhost",s=r.port?.[0]||5432,i={ATTR_DB_NAMESPACE:typeof r.database=="string"&&r.database!==""?r.database:void 0,ATTR_SERVER_ADDRESS:o,ATTR_SERVER_PORT:String(s)};e[nm]=i}var cce="Console",rm=(t={})=>{let e=new Set(t.levels||Ul);return{name:cce,setup(n){HB(({args:r,level:o})=>{H()!==n||!e.has(o)||uce(o,r)})}}};function uce(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:VB(t),message:$B(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${$B(r)}`:"Assertion failed",n.data.arguments=r}else return;tr(n,{input:e,level:t})}function $B(t){return"util"in J&&typeof J.util.format=="function"?J.util.format(...t):pR(t," ")}var lce="ConversationId",pce=()=>({name:lce,setup(t){t.on("spanStart",e=>{let n=Te().getScopeData(),r=ue().getScopeData(),o=n.conversationId||r.conversationId;o&&e.setAttribute(bR,o)})}}),ly=pce;var YB="gen_ai.prompt",Is="gen_ai.system",He="gen_ai.request.model",Mc="gen_ai.request.stream",Ns="gen_ai.request.temperature",xc="gen_ai.request.max_tokens",Os="gen_ai.request.frequency_penalty",vc="gen_ai.request.presence_penalty",bs="gen_ai.request.top_p",om="gen_ai.request.top_k",WB="gen_ai.request.encoding_format",zB="gen_ai.request.dimensions",An="gen_ai.response.finish_reasons",_t="gen_ai.response.model",nr="gen_ai.response.id",KB="gen_ai.response.stop_reason",Pe="gen_ai.usage.input_tokens",Ze="gen_ai.usage.output_tokens",cn="gen_ai.usage.total_tokens",vt="gen_ai.operation.name",un="sentry.sdk_meta.gen_ai.input.messages.original_length",Lt="gen_ai.input.messages",QB="gen_ai.output.messages",Bn="gen_ai.system_instructions",rt="gen_ai.response.text",Qr="gen_ai.request.available_tools",qi="gen_ai.response.streaming",It="gen_ai.response.tool_calls",py="gen_ai.agent.name",XB="gen_ai.pipeline.name",sp="gen_ai.conversation.id",JB="gen_ai.usage.cache_creation_input_tokens",ZB="gen_ai.usage.cache_read_input_tokens",dy="gen_ai.usage.input_tokens.cache_write",Cs="gen_ai.usage.input_tokens.cached",sm="gen_ai.invoke_agent",e1="gen_ai.generate_text",t1="gen_ai.stream_text",n1="gen_ai.generate_object",r1="gen_ai.stream_object",Lc="gen_ai.embeddings.input",o1="gen_ai.embeddings",s1="gen_ai.embeddings",i1="gen_ai.rerank",a1="gen_ai.execute_tool",$i="gen_ai.tool.name",_y="gen_ai.tool.call.id",fy="gen_ai.tool.type",im="gen_ai.tool.input",am="gen_ai.tool.output",c1="gen_ai.tool.description",my="openai.response.id",Ty="openai.response.model",hy="openai.response.timestamp",u1="openai.usage.completion_tokens",l1="openai.usage.prompt_tokens",Ey="anthropic.response.timestamp";var ip=new Map,Sy=new Set(["ai.generateText","ai.streamText","ai.generateObject","ai.streamObject"]),gy=new Set(["ai.generateText.doGenerate","ai.streamText.doStream","ai.generateObject.doGenerate","ai.streamObject.doStream"]),p1=new Set(["ai.embed.doEmbed","ai.embedMany.doEmbed"]),d1=new Set(["ai.rerank.doRerank"]),_1={"ai.embed.doEmbed":"embeddings","ai.embedMany.doEmbed":"embeddings","ai.rerank.doRerank":"rerank"};function Ps(t){return!t||typeof t!="object"?!1:_ce(t)||m1(t)||dce(t)||T1(t)||h1(t)||fce(t)||mce(t)||Tce(t)||hce(t)||Ece(t)||Sce(t)||gce(t)}function dce(t){return"image_url"in t?typeof t.image_url=="string"?t.image_url.startsWith("data:"):f1(t):!1}function f1(t){return"image_url"in t&&!!t.image_url&&typeof t.image_url=="object"&&"url"in t.image_url&&typeof t.image_url.url=="string"&&t.image_url.url.startsWith("data:")}function _ce(t){return"type"in t&&typeof t.type=="string"&&"source"in t&&Ps(t.source)}function m1(t){return"inlineData"in t&&!!t.inlineData&&typeof t.inlineData=="object"&&"data"in t.inlineData&&typeof t.inlineData.data=="string"}function T1(t){return"type"in t&&t.type==="input_audio"&&"input_audio"in t&&!!t.input_audio&&typeof t.input_audio=="object"&&"data"in t.input_audio&&typeof t.input_audio.data=="string"}function h1(t){return"type"in t&&t.type==="file"&&"file"in t&&!!t.file&&typeof t.file=="object"&&"file_data"in t.file&&typeof t.file.file_data=="string"}function fce(t){return"media_type"in t&&typeof t.media_type=="string"&&"data"in t}function mce(t){return"type"in t&&t.type==="file"&&"mediaType"in t&&typeof t.mediaType=="string"&&"data"in t&&typeof t.data=="string"&&!t.data.startsWith("http://")&&!t.data.startsWith("https://")}function Tce(t){return"type"in t&&t.type==="image"&&"image"in t&&typeof t.image=="string"&&!t.image.startsWith("http://")&&!t.image.startsWith("https://")}function hce(t){return"type"in t&&(t.type==="blob"||t.type==="base64")}function Ece(t){return"b64_json"in t}function Sce(t){return"type"in t&&"result"in t&&t.type==="image_generation"}function gce(t){return"uri"in t&&typeof t.uri=="string"&&t.uri.startsWith("data:")}var ap="[Blob substitute]",Ace=["image_url","data","content","b64_json","result","uri","image"];function Yi(t){let e={...t};Ps(e.source)&&(e.source=Yi(e.source)),m1(t)&&(e.inlineData={...t.inlineData,data:ap}),f1(t)&&(e.image_url={...t.image_url,url:ap}),T1(t)&&(e.input_audio={...t.input_audio,data:ap}),h1(t)&&(e.file={...t.file,file_data:ap});for(let n of Ace)typeof e[n]=="string"&&(e[n]=ap);return e}var S1=2e4,cm=t=>new TextEncoder().encode(t).length,Ry=t=>cm(JSON.stringify(t));function um(t,e){if(cm(t)<=e)return t;let n=0,r=t.length,o="";for(;n<=r;){let s=Math.floor((n+r)/2),i=t.slice(0,s);cm(i)<=e?(o=i,n=s+1):r=s-1}return o}function Rce(t){return typeof t=="string"?t:"text"in t&&typeof t.text=="string"?t.text:""}function E1(t,e){return typeof t=="string"?e:{...t,text:e}}function yce(t){return t!==null&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function g1(t){return t!==null&&typeof t=="object"&&"content"in t&&Array.isArray(t.content)}function A1(t){return t!==null&&typeof t=="object"&&"parts"in t&&Array.isArray(t.parts)&&t.parts.length>0}function Ice(t,e){let n={...t,content:""},r=Ry(n),o=e-r;if(o<=0)return[];let s=um(t.content,o);return[{...t,content:s}]}function Nce(t){return"parts"in t&&Array.isArray(t.parts)?{key:"parts",items:t.parts}:"content"in t&&Array.isArray(t.content)?{key:"content",items:t.content}:{key:null,items:[]}}function Oce(t,e){let{key:n,items:r}=Nce(t);if(n===null||r.length===0)return[];let o=r.map(c=>E1(c,"")),s=Ry({...t,[n]:o}),i=e-s;if(i<=0)return[];let a=[];for(let c of r){let l=Rce(c),p=cm(l);if(p<=i)a.push(c),i-=p;else if(a.length===0){let d=um(l,i);d&&a.push(E1(c,d));break}else break}return a.length<=0?[]:[{...t,[n]:a}]}function bce(t,e){if(!t)return[];if(typeof t=="string"){let n=um(t,e);return n?[n]:[]}return typeof t!="object"?[]:yce(t)?Ice(t,e):g1(t)||A1(t)?Oce(t,e):[]}function Ay(t){return t.map(n=>{let r;return n&&typeof n=="object"&&(g1(n)?r={...n,content:Ay(n.content)}:"content"in n&&Ps(n.content)&&(r={...n,content:Yi(n.content)}),A1(n)&&(r={...r??n,parts:Ay(n.parts)}),Ps(r)?r=Yi(r):Ps(n)&&(r=Yi(n))),r??n})}function Cce(t,e){if(!Array.isArray(t)||t.length===0)return t;let n=e-2,r=t[t.length-1],o=Ay([r]),s=o[0];return Ry(s)<=n?o:bce(s,n)}function Ms(t){return Cce(t,S1)}function R1(t){return um(t,S1)}function Xr(t){let e=!!H()?.getOptions().sendDefaultPii;return{...t,recordInputs:t?.recordInputs??e,recordOutputs:t?.recordOutputs??e}}function Dc(t,e){return t?`${t}.${e}`:e}function cp(t,e,n,r,o){if(e!==void 0&&t.setAttributes({[Pe]:e}),n!==void 0&&t.setAttributes({[Ze]:n}),e!==void 0||n!==void 0||r!==void 0||o!==void 0){let s=(e??0)+(n??0)+(r??0)+(o??0);t.setAttributes({[cn]:s})}}function Wi(t){if(typeof t=="string")return R1(t);if(Array.isArray(t)){let e=Ms(t);return JSON.stringify(e)}return JSON.stringify(t)}function jn(t){if(!Array.isArray(t))return{systemInstructions:void 0,filteredMessages:t};let e=t.findIndex(i=>i&&typeof i=="object"&&"role"in i&&i.role==="system");if(e===-1)return{systemInstructions:void 0,filteredMessages:t};let n=t[e],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:t};let o=JSON.stringify([{type:"text",content:r}]),s=[...t.slice(0,e),...t.slice(e+1)];return{systemInstructions:o,filteredMessages:s}}async function Pce(t,e,n){let r=t.catch(i=>{throw te(i,{mechanism:{handled:!1,type:n}}),i}),o=await e,s=await r;return s&&typeof s=="object"&&"data"in s?{...s,data:o}:o}function Uc(t,e,n){return xt(t)?new Proxy(t,{get(r,o){let i=o in Promise.prototype||o===Symbol.toStringTag?e:r,a=Reflect.get(i,o);return o==="withResponse"&&typeof a=="function"?function(){let l=a.call(r);return Pce(l,e,n)}:typeof a=="function"?a.bind(i):a}}):e}var lm="operation.name",y1="ai.operationId",pm="ai.prompt",I1="ai.schema",N1="ai.response.object",yy="ai.values",Iy="ai.response.text",Ny="ai.response.toolCalls",O1="ai.response.finishReason",zi="ai.prompt.messages",wc="ai.prompt.tools",up="ai.model.id",b1="ai.response.providerMetadata",C1="ai.usage.cachedInputTokens",P1="ai.telemetry.functionId",M1="ai.usage.completionTokens",x1="ai.usage.promptTokens",v1="ai.usage.tokens",Oy="ai.toolCall.name",by="ai.toolCall.id",L1="ai.toolCall.args",D1="ai.toolCall.result";function w1(t,e){let n=t.parent_span_id;if(!n)return;let r=t.data[Pe],o=t.data[Ze];if(typeof r=="number"||typeof o=="number"){let s=e.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(s.inputTokens+=r),typeof o=="number"&&(s.outputTokens+=o),e.set(n,s)}}function Cy(t,e){let n=e.get(t.span_id);!n||!t.data||(n.inputTokens>0&&(t.data[Pe]=n.inputTokens),n.outputTokens>0&&(t.data[Ze]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(t.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function Mce(t){let e=new Map;for(let n of t){let r=n.data[Qr];if(typeof r=="string")try{let o=JSON.parse(r);for(let s of o)s.name&&s.description&&!e.has(s.name)&&e.set(s.name,s.description)}catch{}}return e}function k1(t,e){let n=Mce(t);for(let r of t){if(r.op==="gen_ai.execute_tool"){let o=r.data[$i];if(typeof o=="string"){let s=n.get(o);s&&(r.data[c1]=s)}}r.op==="gen_ai.invoke_agent"&&Cy(r,e)}}function Py(t){return ip.get(t)}function My(t){ip.delete(t)}function G1(t){let e=t.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(e)}function U1(t){return t.filter(e=>!!e&&typeof e=="object"&&"role"in e&&"content"in e)}function xce(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"){let{messages:n}=e,{prompt:r,system:o}=e,s=[];if(typeof o=="string"&&s.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return s.push(...U1(n)),s;if(Array.isArray(r))return s.push(...U1(r)),s;if(typeof r=="string"&&s.push({role:"user",content:r}),s.length>0)return s}}catch{}return[]}function B1(t,e){if(typeof e[pm]=="string"&&!e[Lt]&&!e[zi]){let n=e[pm],r=xce(n);if(r.length){let{systemInstructions:o,filteredMessages:s}=jn(r);o&&t.setAttribute(Bn,o);let i=Array.isArray(s)?s.length:0,a=Wi(s);t.setAttributes({[pm]:a,[Lt]:a,[un]:i})}}else if(typeof e[zi]=="string")try{let n=JSON.parse(e[zi]);if(Array.isArray(n)){let{systemInstructions:r,filteredMessages:o}=jn(n);r&&t.setAttribute(Bn,r);let s=Array.isArray(o)?o.length:0,i=Wi(o);t.setAttributes({[zi]:i,[Lt]:i,[un]:s})}}catch{}}function j1(t){switch(t){case"ai.generateText":case"ai.streamText":case"ai.generateObject":case"ai.streamObject":return sm;case"ai.generateText.doGenerate":return e1;case"ai.streamText.doStream":return t1;case"ai.generateObject.doGenerate":return n1;case"ai.streamObject.doStream":return r1;case"ai.embed.doEmbed":return o1;case"ai.embedMany.doEmbed":return s1;case"ai.rerank.doRerank":return i1;case"ai.toolCall":return a1;default:return t.startsWith("ai.stream")?"ai.run":void 0}}function vce(t){return Sy.has(t)?"invoke_agent":gy.has(t)?"generate_content":p1.has(t)?"embeddings":d1.has(t)?"rerank":t==="ai.toolCall"?"execute_tool":t}function Lce(t){let{data:e,description:n}=Y(t);if(n){if(e[Oy]&&e[by]&&n==="ai.toolCall"){Gce(t,e);return}!e[y1]&&!n.startsWith("ai.")||Bce(t,n,e)}}function Dce(t){if(t.type==="transaction"&&t.spans){let e=new Map;for(let r of t.spans)kce(r),w1(r,e);k1(t.spans,e);let n=t.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&Cy(n,e)}return t}function Uce(t){if(typeof t!="string")return"stop";switch(t){case"tool-calls":return"tool_call";case"stop":case"length":case"content_filter":case"error":return t;default:return t}}function wce(t){let e=t[Iy],n=t[Ny],r=t[O1];if(e==null&&n==null)return;let o=[];if(typeof e=="string"&&e.length>0&&o.push({type:"text",content:e}),n!=null)try{let s=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(s)){for(let i of s){let a=i.input??i.args;o.push({type:"tool_call",id:i.toolCallId,name:i.toolName,arguments:typeof a=="string"?a:JSON.stringify(a??{})})}delete t[Ny]}}catch{}if(o.length>0){let s={role:"assistant",parts:o,finish_reason:Uce(r)};t[QB]=JSON.stringify([s]),delete t[Iy]}}function kce(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){if(t.status&&t.status!=="ok"&&(t.status="internal_error"),Dt(e,M1,Ze),Dt(e,x1,Pe),Dt(e,C1,Cs),Dt(e,"ai.usage.inputTokens",Pe),Dt(e,"ai.usage.outputTokens",Ze),Dt(e,v1,Pe),Dt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),typeof e[Pe]=="number"&&typeof e[Cs]=="number"&&(e[Pe]=e[Pe]+e[Cs]),typeof e[Pe]=="number"){let r=typeof e[Ze]=="number"?e[Ze]:0;e[cn]=r+e[Pe]}if(e[wc]&&Array.isArray(e[wc])&&(e[wc]=G1(e[wc])),e[lm]){let r=vce(e[lm]);e[vt]=r,delete e[lm]}if(Dt(e,zi,Lt),wce(e),Dt(e,N1,"gen_ai.response.object"),Dt(e,wc,"gen_ai.request.available_tools"),Dt(e,L1,im),Dt(e,D1,am),Dt(e,I1,"gen_ai.request.schema"),Dt(e,up,He),Array.isArray(e[yy])){let r=e[yy].map(o=>{try{return JSON.parse(o)}catch{return o}});e[Lc]=r.length===1?r[0]:JSON.stringify(r)}jce(e);for(let r of Object.keys(e))r.startsWith("ai.")&&Dt(e,r,`vercel.${r}`)}}function Dt(t,e,n){t[e]!=null&&(t[n]=t[e],delete t[e])}function Gce(t,e){t.setAttribute(W,"auto.vercelai.otel"),t.setAttribute(ee,"gen_ai.execute_tool"),t.setAttribute(vt,"execute_tool"),Dt(e,Oy,$i),Dt(e,by,_y);let n=e[_y];typeof n=="string"&&ip.set(n,t.spanContext()),e[fy]||t.setAttribute(fy,"function");let r=e[$i];r&&t.updateName(`execute_tool ${r}`)}function Bce(t,e,n){t.setAttribute(W,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[P1];o&&typeof o=="string"&&t.setAttribute("gen_ai.function_id",o),B1(t,n),n[up]&&!n[_t]&&t.setAttribute(_t,n[up]),t.setAttribute("ai.streaming",e.includes("stream"));let s=j1(e);if(s&&t.setAttribute(ee,s),Sy.has(e)){o&&typeof o=="string"?t.updateName(`invoke_agent ${o}`):t.updateName("invoke_agent");return}let i=n[up];if(i){let a=gy.has(e)?"generate_content":_1[e];a&&t.updateName(`${a} ${i}`)}}function dm(t){t.on("spanStart",Lce),t.addEventProcessor(Object.assign(Dce,{id:"VercelAiEventProcessor"}))}function jce(t){let e=t[b1];if(e)try{let n=JSON.parse(e),r=n.openai??n.azure;if(r&&(Pr(t,Cs,r.cachedPromptTokens),Pr(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),Pr(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),Pr(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),t["gen_ai.conversation.id"]||Pr(t,"gen_ai.conversation.id",r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;Pr(t,Cs,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;Pr(t,dy,s)}n.bedrock?.usage&&(Pr(t,Cs,n.bedrock.usage.cacheReadInputTokens),Pr(t,dy,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(Pr(t,Cs,n.deepseek.promptCacheHitTokens),Pr(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens))}catch{}}function Pr(t,e,n){n!=null&&(t[e]=n)}var xs="OpenAI",H1={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},Hce=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],V1=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...Hce];function F1(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function q1(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function $1(t){if(t===null||typeof t!="object"||!("object"in t))return!1;let e=t;return e.object==="list"&&typeof e.model=="string"&&e.model.toLowerCase().includes("embedding")}function Y1(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="conversation"}function W1(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.startsWith("response.")}function z1(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion.chunk"}function K1(t,e,n){if(_m(t,e.id,e.model,e.created),e.usage&&lp(t,e.usage.prompt_tokens,e.usage.completion_tokens,e.usage.total_tokens),Array.isArray(e.choices)){let r=e.choices.map(o=>o.finish_reason).filter(o=>o!==null);if(r.length>0&&t.setAttributes({[An]:JSON.stringify(r)}),n){let o=e.choices.map(s=>s.message?.tool_calls).filter(s=>Array.isArray(s)&&s.length>0).flat();o.length>0&&t.setAttributes({[It]:JSON.stringify(o)})}}}function Q1(t,e,n){if(_m(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[An]:JSON.stringify([e.status])}),e.usage&&lp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens),n){let r=e;if(Array.isArray(r.output)&&r.output.length>0){let o=r.output.filter(s=>typeof s=="object"&&s!==null&&s.type==="function_call");o.length>0&&t.setAttributes({[It]:JSON.stringify(o)})}}}function X1(t,e){t.setAttributes({[Ty]:e.model,[_t]:e.model}),e.usage&&lp(t,e.usage.prompt_tokens,void 0,e.usage.total_tokens)}function J1(t,e){let{id:n,created_at:r}=e;t.setAttributes({[my]:n,[nr]:n,[sp]:n}),r&&t.setAttributes({[hy]:new Date(r*1e3).toISOString()})}function lp(t,e,n,r){e!==void 0&&t.setAttributes({[l1]:e,[Pe]:e}),n!==void 0&&t.setAttributes({[u1]:n,[Ze]:n}),r!==void 0&&t.setAttributes({[cn]:r})}function _m(t,e,n,r){t.setAttributes({[my]:e,[nr]:e}),t.setAttributes({[Ty]:n,[_t]:n}),t.setAttributes({[hy]:new Date(r*1e3).toISOString()})}function Vce(t){if("conversation"in t&&typeof t.conversation=="string")return t.conversation;if("previous_response_id"in t&&typeof t.previous_response_id=="string")return t.previous_response_id}function Z1(t){let e={[He]:t.model??"unknown"};"temperature"in t&&(e[Ns]=t.temperature),"top_p"in t&&(e[bs]=t.top_p),"frequency_penalty"in t&&(e[Os]=t.frequency_penalty),"presence_penalty"in t&&(e[vc]=t.presence_penalty),"stream"in t&&(e[Mc]=t.stream),"encoding_format"in t&&(e[WB]=t.encoding_format),"dimensions"in t&&(e[zB]=t.dimensions);let n=Vce(t);return n&&(e[sp]=n),e}function Fce(t,e){for(let n of t){let r=n.index;if(!(r===void 0||!n.function))if(!(r in e.chatCompletionToolCalls))e.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=e.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function qce(t,e,n){e.responseId=t.id??e.responseId,e.responseModel=t.model??e.responseModel,e.responseTimestamp=t.created??e.responseTimestamp,t.usage&&(e.promptTokens=t.usage.prompt_tokens,e.completionTokens=t.usage.completion_tokens,e.totalTokens=t.usage.total_tokens);for(let r of t.choices??[])n&&(r.delta?.content&&e.responseTexts.push(r.delta.content),r.delta?.tool_calls&&Fce(r.delta.tool_calls,e)),r.finish_reason&&e.finishReasons.push(r.finish_reason)}function $ce(t,e,n,r){if(!(t&&typeof t=="object")){e.eventTypes.push("unknown:non-object");return}if(t instanceof Error){r.setStatus({code:2,message:"internal_error"}),te(t,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in t))return;let o=t;if(!V1.includes(o.type)){e.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&e.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){e.responseTexts.push(o.delta);return}if("response"in o){let{response:s}=o;e.responseId=s.id??e.responseId,e.responseModel=s.model??e.responseModel,e.responseTimestamp=s.created_at??e.responseTimestamp,s.usage&&(e.promptTokens=s.usage.input_tokens,e.completionTokens=s.usage.output_tokens,e.totalTokens=s.usage.total_tokens),s.status&&e.finishReasons.push(s.status),n&&s.output_text&&e.responseTexts.push(s.output_text)}}async function*ej(t,e,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",responseTimestamp:0,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of t)z1(o)?qce(o,r,n):W1(o)&&$ce(o,r,n,e),yield o}finally{_m(e,r.responseId,r.responseModel,r.responseTimestamp),lp(e,r.promptTokens,r.completionTokens,r.totalTokens),e.setAttributes({[qi]:!0}),r.finishReasons.length&&e.setAttributes({[An]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length&&e.setAttributes({[rt]:r.responseTexts.join("")});let s=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];s.length>0&&e.setAttributes({[It]:JSON.stringify(s)}),e.end()}}function Yce(t){let e=Array.isArray(t.tools)?t.tools:[],r=t.web_search_options&&typeof t.web_search_options=="object"?[{type:"web_search_options",...t.web_search_options}]:[],o=[...e,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(s){C&&g.error("Failed to serialize OpenAI tools:",s);return}}function Wce(t,e){let n={[Is]:"openai",[vt]:e,[W]:"auto.ai.openai"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let r=t[0],o=Yce(r);o&&(n[Qr]=o),Object.assign(n,Z1(r))}else n[He]="unknown";return n}function zce(t,e,n){if(!e||typeof e!="object")return;let r=e;if(F1(r)){if(K1(t,r,n),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[rt]:JSON.stringify(o)})}}else q1(r)?(Q1(t,r,n),n&&r.output_text&&t.setAttributes({[rt]:r.output_text})):$1(r)?X1(t,r):Y1(r)&&J1(t,r)}function tj(t,e,n){if(n==="embeddings"&&"input"in e){let a=e.input;if(a==null||typeof a=="string"&&a.length===0||Array.isArray(a)&&a.length===0)return;t.setAttribute(Lc,typeof a=="string"?a:JSON.stringify(a));return}let r="input"in e?e.input:"messages"in e?e.messages:void 0;if(!r||Array.isArray(r)&&r.length===0)return;let{systemInstructions:o,filteredMessages:s}=jn(r);o&&t.setAttribute(Bn,o);let i=Wi(s);t.setAttribute(Lt,i),Array.isArray(s)?t.setAttribute(un,s.length):t.setAttribute(un,1)}function Kce(t,e,n,r,o){return function(...i){let a=n.operation,c=Wce(i,a),l=c[He]||"unknown",p=i[0],d=p&&typeof p=="object"&&p.stream===!0,_={name:`${a} ${l}`,op:`gen_ai.${a}`,attributes:c};if(d){let T,h=yt(_,S=>(T=t.apply(r,i),o.recordInputs&&p&&tj(S,p,a),(async()=>{try{let R=await T;return ej(R,S,o.recordOutputs??!1)}catch(R){throw S.setStatus({code:2,message:"internal_error"}),te(R,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:e}}}),S.end(),R}})()));return Uc(T,h,"auto.ai.openai")}let f,m=Cr(_,T=>(f=t.apply(r,i),o.recordInputs&&p&&tj(T,p,a),f.then(h=>(zce(T,h,o.recordOutputs),h),h=>{throw te(h,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:e}}}),h})));return Uc(f,m,"auto.ai.openai")}}function nj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Dc(e,String(o)),a=H1[i];return typeof s=="function"&&a?Kce(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?nj(s,i,n):s}})}function fm(t,e){return nj(t,"",Xr(e))}var vs="Anthropic_AI",rj={"messages.create":{operation:"chat"},"messages.stream":{operation:"chat",streaming:!0},"messages.countTokens":{operation:"chat"},"models.get":{operation:"models"},"completions.create":{operation:"chat"},"models.retrieve":{operation:"models"},"beta.messages.create":{operation:"chat"}};function oj(t,e){if(Array.isArray(e)&&e.length===0)return;let{systemInstructions:n,filteredMessages:r}=jn(e);n&&t.setAttributes({[Bn]:n});let o=Array.isArray(r)?r.length:1;t.setAttributes({[Lt]:Wi(r),[un]:o})}var Qce={invalid_request_error:"invalid_argument",authentication_error:"unauthenticated",permission_error:"permission_denied",not_found_error:"not_found",request_too_large:"failed_precondition",rate_limit_error:"resource_exhausted",api_error:"internal_error",overloaded_error:"unavailable"};function xy(t){return t&&Qce[t]||"internal_error"}function sj(t,e){e.error&&(t.setStatus({code:2,message:xy(e.error.type)}),te(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function ij(t){let{system:e,messages:n,input:r}=t,o=typeof e=="string"?[{role:"system",content:t.system}]:[],s=Array.isArray(r)?r:r!=null?[r]:void 0,i=Array.isArray(n)?n:n!=null?[n]:[],a=s??i;return[...o,...a]}function Xce(t,e){return"type"in t&&typeof t.type=="string"&&t.type==="error"?(e.setStatus({code:2,message:xy(t.error?.type)}),te(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function Jce(t,e){if(t.type==="message_delta"&&t.usage&&"output_tokens"in t.usage&&typeof t.usage.output_tokens=="number"&&(e.completionTokens=t.usage.output_tokens),t.message){let n=t.message;n.id&&(e.responseId=n.id),n.model&&(e.responseModel=n.model),n.stop_reason&&e.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(e.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(e.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(e.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function Zce(t,e){t.type!=="content_block_start"||typeof t.index!="number"||!t.content_block||(t.content_block.type==="tool_use"||t.content_block.type==="server_tool_use")&&(e.activeToolBlocks[t.index]={id:t.content_block.id,name:t.content_block.name,inputJsonParts:[]})}function eue(t,e,n){if(!(t.type!=="content_block_delta"||!t.delta)){if(typeof t.index=="number"&&"partial_json"in t.delta&&typeof t.delta.partial_json=="string"){let r=e.activeToolBlocks[t.index];r&&r.inputJsonParts.push(t.delta.partial_json)}n&&typeof t.delta.text=="string"&&e.responseTexts.push(t.delta.text)}}function tue(t,e){if(t.type!=="content_block_stop"||typeof t.index!="number")return;let n=e.activeToolBlocks[t.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}e.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete e.activeToolBlocks[t.index]}function aj(t,e,n,r){!(t&&typeof t=="object")||Xce(t,r)||(Jce(t,e),Zce(t,e),eue(t,e,n),tue(t,e))}function nue(t,e,n){e.isRecording()&&(t.responseId&&e.setAttributes({[nr]:t.responseId}),t.responseModel&&e.setAttributes({[_t]:t.responseModel}),cp(e,t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens),e.setAttributes({[qi]:!0}),t.finishReasons.length>0&&e.setAttributes({[An]:JSON.stringify(t.finishReasons)}),n&&t.responseTexts.length>0&&e.setAttributes({[rt]:t.responseTexts.join("")}),n&&t.toolCalls.length>0&&e.setAttributes({[It]:JSON.stringify(t.toolCalls)}),e.end())}async function*cj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of t)aj(o,r,n,e),yield o}finally{r.responseId&&e.setAttributes({[nr]:r.responseId}),r.responseModel&&e.setAttributes({[_t]:r.responseModel}),cp(e,r.promptTokens,r.completionTokens,r.cacheCreationInputTokens,r.cacheReadInputTokens),e.setAttributes({[qi]:!0}),r.finishReasons.length>0&&e.setAttributes({[An]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length>0&&e.setAttributes({[rt]:r.responseTexts.join("")}),n&&r.toolCalls.length>0&&e.setAttributes({[It]:JSON.stringify(r.toolCalls)}),e.end()}}function uj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return t.on("streamEvent",o=>{aj(o,r,n,e)}),t.on("message",()=>{nue(r,e,n)}),t.on("error",o=>{te(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end())}),t}function rue(t,e,n){let r={[Is]:"anthropic",[vt]:n,[W]:"auto.ai.anthropic"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let o=t[0];o.tools&&Array.isArray(o.tools)&&(r[Qr]=JSON.stringify(o.tools)),r[He]=o.model??"unknown","temperature"in o&&(r[Ns]=o.temperature),"top_p"in o&&(r[bs]=o.top_p),"stream"in o&&(r[Mc]=o.stream),"top_k"in o&&(r[om]=o.top_k),"frequency_penalty"in o&&(r[Os]=o.frequency_penalty),"max_tokens"in o&&(r[xc]=o.max_tokens)}else e==="models.retrieve"||e==="models.get"?r[He]=t[0]:r[He]="unknown";return r}function vy(t,e){let n=ij(e);oj(t,n),"prompt"in e&&t.setAttributes({[YB]:JSON.stringify(e.prompt)})}function oue(t,e){if("content"in e&&Array.isArray(e.content)){t.setAttributes({[rt]:e.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of e.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&t.setAttributes({[It]:JSON.stringify(n)})}"completion"in e&&t.setAttributes({[rt]:e.completion}),"input_tokens"in e&&t.setAttributes({[rt]:JSON.stringify(e.input_tokens)})}function sue(t,e){"id"in e&&"model"in e&&(t.setAttributes({[nr]:e.id,[_t]:e.model}),"created"in e&&typeof e.created=="number"&&t.setAttributes({[Ey]:new Date(e.created*1e3).toISOString()}),"created_at"in e&&typeof e.created_at=="number"&&t.setAttributes({[Ey]:new Date(e.created_at*1e3).toISOString()}),"usage"in e&&e.usage&&cp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.cache_creation_input_tokens,e.usage.cache_read_input_tokens))}function iue(t,e,n){if(!(!e||typeof e!="object")){if("type"in e&&e.type==="error"){sj(t,e);return}n&&oue(t,e),sue(t,e)}}function lj(t,e,n){throw te(t,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end()),t}function aue(t,e,n,r,o,s,i,a,c,l,p){let d=o[He]??"unknown",_={name:`${s} ${d}`,op:`gen_ai.${s}`,attributes:o};if(l&&!p){let f,m=yt(_,T=>(f=t.apply(n,r),c.recordInputs&&a&&vy(T,a),(async()=>{try{let h=await f;return cj(h,T,c.recordOutputs??!1)}catch(h){return lj(h,T,i)}})()));return Uc(f,m,"auto.ai.anthropic")}else return yt(_,f=>{try{c.recordInputs&&a&&vy(f,a);let m=e.apply(n,r);return uj(m,f,c.recordOutputs??!1)}catch(m){return lj(m,f,i)}})}function cue(t,e,n,r,o){return new Proxy(t,{apply(s,i,a){let c=n.operation,l=rue(a,e,c),p=l[He]??"unknown",d=typeof a[0]=="object"?a[0]:void 0,_=!!d?.stream,f=n.streaming===!0;if(_||f)return aue(t,s,r,a,l,c,e,d,o,_,f);let m,T=Cr({name:`${c} ${p}`,op:`gen_ai.${c}`,attributes:l},h=>(m=s.apply(r,a),o.recordInputs&&d&&vy(h,d),m.then(S=>(iue(h,S,o.recordOutputs),S),S=>{throw te(S,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:e}}}),S})));return Uc(m,T,"auto.ai.anthropic")}})}function pj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Dc(e,String(o)),a=rj[i];return typeof s=="function"&&a?cue(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?pj(s,i,n):s}})}function mm(t,e){return pj(t,"",Xr(e))}var Ls="Google_GenAI",dj={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{operation:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},_j="google_genai",Ly="chats.create",fj="chat";function uue(t,e){let n=t?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return e.setStatus({code:2,message:"internal_error"}),te(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function lue(t,e){typeof t.responseId=="string"&&(e.responseId=t.responseId),typeof t.modelVersion=="string"&&(e.responseModel=t.modelVersion);let n=t.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(e.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(e.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(e.totalTokens=n.totalTokenCount))}function pue(t,e,n){Array.isArray(t.functionCalls)&&e.toolCalls.push(...t.functionCalls);for(let r of t.candidates??[]){r?.finishReason&&!e.finishReasons.includes(r.finishReason)&&e.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&e.responseTexts.push(o.text),o.functionCall&&e.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function due(t,e,n,r){!t||uue(t,r)||(lue(t,e),pue(t,e,n))}async function*mj(t,e,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of t)due(o,r,n,e),yield o}finally{let o={[qi]:!0};r.responseId&&(o[nr]=r.responseId),r.responseModel&&(o[_t]=r.responseModel),r.promptTokens!==void 0&&(o[Pe]=r.promptTokens),r.completionTokens!==void 0&&(o[Ze]=r.completionTokens),r.totalTokens!==void 0&&(o[cn]=r.totalTokens),r.finishReasons.length&&(o[An]=JSON.stringify(r.finishReasons)),n&&r.responseTexts.length&&(o[rt]=r.responseTexts.join("")),n&&r.toolCalls.length&&(o[It]=JSON.stringify(r.toolCalls)),e.setAttributes(o),e.end()}}function kc(t,e="user"){return typeof t=="string"?[{role:e,content:t}]:Array.isArray(t)?t.flatMap(n=>kc(n,e)):typeof t!="object"||!t?[]:"role"in t&&typeof t.role=="string"?[t]:"parts"in t?[{...t,role:e}]:[{role:e,content:t}]}function Tj(t,e){if("model"in t&&typeof t.model=="string")return t.model;if(e&&typeof e=="object"){let n=e;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function _ue(t){let e={};return"temperature"in t&&typeof t.temperature=="number"&&(e[Ns]=t.temperature),"topP"in t&&typeof t.topP=="number"&&(e[bs]=t.topP),"topK"in t&&typeof t.topK=="number"&&(e[om]=t.topK),"maxOutputTokens"in t&&typeof t.maxOutputTokens=="number"&&(e[xc]=t.maxOutputTokens),"frequencyPenalty"in t&&typeof t.frequencyPenalty=="number"&&(e[Os]=t.frequencyPenalty),"presencePenalty"in t&&typeof t.presencePenalty=="number"&&(e[vc]=t.presencePenalty),e}function fue(t,e,n){let r={[Is]:_j,[vt]:t,[W]:"auto.ai.google_genai"};if(e){if(r[He]=Tj(e,n),"config"in e&&typeof e.config=="object"&&e.config){let o=e.config;if(Object.assign(r,_ue(o)),"tools"in o&&Array.isArray(o.tools)){let s=o.tools.flatMap(i=>i.functionDeclarations);r[Qr]=JSON.stringify(s)}}}else r[He]=Tj({},n);return r}function hj(t,e,n){if(n){let o=e.contents;o!=null&&t.setAttribute(Lc,typeof o=="string"?o:JSON.stringify(o));return}let r=[];if("config"in e&&e.config&&typeof e.config=="object"&&"systemInstruction"in e.config&&e.config.systemInstruction&&r.push(...kc(e.config.systemInstruction,"system")),"history"in e&&r.push(...kc(e.history,"user")),"contents"in e&&r.push(...kc(e.contents,"user")),"message"in e&&r.push(...kc(e.message,"user")),Array.isArray(r)&&r.length){let{systemInstructions:o,filteredMessages:s}=jn(r);o&&t.setAttribute(Bn,o);let i=Array.isArray(s)?s.length:0;t.setAttributes({[un]:i,[Lt]:JSON.stringify(Ms(s))})}}function mue(t,e,n){if(!(!e||typeof e!="object")){if(e.modelVersion&&t.setAttribute(_t,e.modelVersion),e.usageMetadata&&typeof e.usageMetadata=="object"){let r=e.usageMetadata;typeof r.promptTokenCount=="number"&&t.setAttributes({[Pe]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&t.setAttributes({[Ze]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&t.setAttributes({[cn]:r.totalTokenCount})}if(n&&Array.isArray(e.candidates)&&e.candidates.length>0){let r=e.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(s=>typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&t.setAttributes({[rt]:r.join("")})}if(n&&e.functionCalls){let r=e.functionCalls;Array.isArray(r)&&r.length>0&&t.setAttributes({[It]:JSON.stringify(r)})}}}function Ej(t,e,n,r,o){let s=e===Ly,i=n.operation==="embeddings";return new Proxy(t,{apply(a,c,l){let p=n.operation,d=l[0],_=fue(p,d,r),f=_[He]??"unknown";return n.streaming?yt({name:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},async m=>{try{o.recordInputs&&d&&hj(m,d,i);let T=await a.apply(r,l);return mj(T,m,!!o.recordOutputs)}catch(T){throw m.setStatus({code:2,message:"internal_error"}),te(T,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}}),m.end(),T}}):Cr({name:s?`${p} ${f} create`:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},m=>(o.recordInputs&&d&&hj(m,d,i),br(()=>a.apply(r,l),T=>{te(T,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}})},()=>{},T=>{!s&&!i&&mue(m,T,o.recordOutputs)})))}})}function Dy(t,e="",n){return new Proxy(t,{get:(r,o,s)=>{let i=Reflect.get(r,o,s),a=Dc(e,String(o)),c=dj[a];if(typeof i=="function"&&c){if(a===Ly){let l=Ej(i,a,c,r,n);return function(...d){let _=l(...d);return _&&typeof _=="object"?Dy(_,fj,n):_}}return Ej(i,a,c,r,n)}return typeof i=="function"?i.bind(r):i&&typeof i=="object"?Dy(i,a,n):i}})}function Tm(t,e){return Dy(t,"",Xr(e))}var hm="LangChain",Ki="auto.ai.langchain",Sj={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var rr=(t,e,n)=>{n!=null&&(t[e]=n)},Hn=(t,e,n)=>{let r=Number(n);Number.isNaN(r)||(t[e]=r)};function Uo(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Gc(t){if(Array.isArray(t))try{let e=t.map(n=>n&&typeof n=="object"&&Ps(n)?Yi(n):n);return JSON.stringify(e)}catch{return String(t)}return Uo(t)}function pp(t){let e=t.toLowerCase();return Sj[e]??e}function gj(t){return t.includes("System")?"system":t.includes("Human")?"user":t.includes("AI")||t.includes("Assistant")?"assistant":t.includes("Function")?"function":t.includes("Tool")?"tool":"user"}function Uy(t){if(!(!t||Array.isArray(t)))return t.invocation_params}function dp(t){return t.map(e=>{let n=e._getType;if(typeof n=="function"){let o=n.call(e);return{role:pp(o),content:Gc(e.content)}}if(e.lc===1&&e.kwargs){let o=e.id,s=Array.isArray(o)&&o.length>0?o[o.length-1]:"",i=typeof s=="string"?gj(s):"user";return{role:pp(i),content:Gc(e.kwargs?.content)}}if(e.type){let o=String(e.type).toLowerCase();return{role:pp(o),content:Gc(e.content)}}if(e.role)return{role:pp(String(e.role)),content:Gc(e.content)};let r=e.constructor?.name;return r&&r!=="Object"?{role:pp(gj(r)),content:Gc(e.content)}:{role:"user",content:Gc(e.content)}})}function Tue(t,e,n){let r={},o="kwargs"in t?t.kwargs:void 0,s=e?.temperature??n?.ls_temperature??o?.temperature;Hn(r,Ns,s);let i=e?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Hn(r,xc,i);let a=e?.top_p??o?.top_p;Hn(r,bs,a);let c=e?.frequency_penalty;Hn(r,Os,c);let l=e?.presence_penalty;return Hn(r,vc,l),e&&"stream"in e&&rr(r,Mc,!!e.stream),r}function Aj(t,e,n,r,o){return{[Is]:Uo(t??"langchain"),[vt]:"chat",[He]:Uo(e),[W]:Ki,...Tue(n,r,o)}}function Rj(t,e,n,r,o){let s=o?.ls_provider,i=r?.model??o?.ls_model_name??"unknown",a=Aj(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){rr(a,un,e.length);let c=e.map(l=>({role:"user",content:l}));rr(a,Lt,Uo(c))}return a}function yj(t,e,n,r,o){let s=o?.ls_provider??t.id?.[2],i=r?.model??o?.ls_model_name??"unknown",a=Aj(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){let c=dp(e.flat()),{systemInstructions:l,filteredMessages:p}=jn(c);l&&rr(a,Bn,l);let d=Array.isArray(p)?p.length:0;rr(a,un,d);let _=Ms(p);rr(a,Lt,Uo(_))}return a}function hue(t,e){let n=[],r=t.flat();for(let o of r){let s=o.message?.content;if(Array.isArray(s))for(let i of s){let a=i;a.type==="tool_use"&&n.push(a)}}n.length>0&&rr(e,It,Uo(n))}function Eue(t,e){if(!t)return;let n=t.tokenUsage,r=t.usage;if(n)Hn(e,Pe,n.promptTokens),Hn(e,Ze,n.completionTokens),Hn(e,cn,n.totalTokens);else if(r){Hn(e,Pe,r.input_tokens),Hn(e,Ze,r.output_tokens);let o=Number(r.input_tokens),s=Number(r.output_tokens),i=(Number.isNaN(o)?0:o)+(Number.isNaN(s)?0:s);i>0&&Hn(e,cn,i),r.cache_creation_input_tokens!==void 0&&Hn(e,JB,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&Hn(e,ZB,r.cache_read_input_tokens)}}function Ij(t,e){if(!t)return;let n={};if(Array.isArray(t.generations)){let l=t.generations.flat().map(p=>p.generationInfo?.finish_reason?p.generationInfo.finish_reason:p.generation_info?.finish_reason?p.generation_info.finish_reason:null).filter(p=>typeof p=="string");if(l.length>0&&rr(n,An,Uo(l)),hue(t.generations,n),e){let p=t.generations.flat().map(d=>d.text??d.message?.content).filter(d=>typeof d=="string");p.length>0&&rr(n,rt,Uo(p))}}Eue(t.llmOutput,n);let r=t.llmOutput,s=t.generations?.[0]?.[0]?.message,i=r?.model_name??r?.model??s?.response_metadata?.model_name;i&&rr(n,_t,i);let a=r?.id??s?.id;a&&rr(n,nr,a);let c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&rr(n,KB,Uo(c)),n}function Em(t={}){let{recordInputs:e,recordOutputs:n}=Xr(t),r=new Map,o=i=>{let a=r.get(i);a?.isRecording()&&(a.end(),r.delete(i))},s={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(i,a,c,l,p,d,_,f){let m=Uy(d),T=Rj(i,a,e,m,_),h=T[He],S=T[vt];yt({name:`${S} ${h}`,op:"gen_ai.chat",attributes:{...T,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleChatModelStart(i,a,c,l,p,d,_,f){let m=Uy(d),T=yj(i,a,e,m,_),h=T[He],S=T[vt];yt({name:`${S} ${h}`,op:"gen_ai.chat",attributes:{...T,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleLLMEnd(i,a,c,l,p){let d=r.get(a);if(d?.isRecording()){let _=Ij(i,n);_&&d.setAttributes(_),o(a)}},handleLLMError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${Ki}.llm_error_handler`}})},handleChainStart(i,a,c,l,p,d,_,f){let m=f||i.name||"unknown_chain",T={[W]:"auto.ai.langchain","langchain.chain.name":m};e&&(T["langchain.chain.inputs"]=JSON.stringify(a)),yt({name:`chain ${m}`,op:"gen_ai.invoke_agent",attributes:{...T,[ee]:"gen_ai.invoke_agent"}},h=>(r.set(c,h),h))},handleChainEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(i)}),o(a))},handleChainError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${Ki}.chain_error_handler`}})},handleToolStart(i,a,c,l){let p=i.name||"unknown_tool",d={[W]:Ki,[$i]:p};e&&(d[im]=a),yt({name:`execute_tool ${p}`,op:"gen_ai.execute_tool",attributes:{...d,[ee]:"gen_ai.execute_tool"}},_=>(r.set(c,_),_))},handleToolEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({[am]:JSON.stringify(i)}),o(a))},handleToolError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${Ki}.tool_error_handler`}})},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}var Sm="LangGraph",wy="auto.ai.langgraph";function Sue(t){if(!t||t.length===0)return null;let e=[];for(let n of t)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&e.push(...r)}return e.length>0?e:null}function gue(t){let e=t,n=0,r=0,o=0;if(e.usage_metadata&&typeof e.usage_metadata=="object"){let s=e.usage_metadata;return typeof s.input_tokens=="number"&&(n=s.input_tokens),typeof s.output_tokens=="number"&&(r=s.output_tokens),typeof s.total_tokens=="number"&&(o=s.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(e.response_metadata&&typeof e.response_metadata=="object"){let s=e.response_metadata;if(s.tokenUsage&&typeof s.tokenUsage=="object"){let i=s.tokenUsage;typeof i.promptTokens=="number"&&(n=i.promptTokens),typeof i.completionTokens=="number"&&(r=i.completionTokens),typeof i.totalTokens=="number"&&(o=i.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function Aue(t,e){let n=e;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&t.setAttribute(_t,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&t.setAttribute(An,[r.finish_reason])}}function Nj(t){if(!t.builder?.nodes?.tools?.runnable?.tools)return null;let e=t.builder?.nodes?.tools?.runnable?.tools;return!e||!Array.isArray(e)||e.length===0?null:e.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function Oj(t,e,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let s=e?.length??0,i=o.length>s?o.slice(s):[];if(i.length===0)return;let a=Sue(i);a&&t.setAttribute(It,JSON.stringify(a));let c=dp(i);t.setAttribute(rt,JSON.stringify(c));let l=0,p=0,d=0;for(let _ of i){let f=gue(_);l+=f.inputTokens,p+=f.outputTokens,d+=f.totalTokens,Aue(t,_)}l>0&&t.setAttribute(Pe,l),p>0&&t.setAttribute(Ze,p),d>0&&t.setAttribute(cn,d)}function ky(t,e){return new Proxy(t,{apply(n,r,o){return Cr({op:"gen_ai.create_agent",name:"create_agent",attributes:{[W]:wy,[ee]:"gen_ai.create_agent",[vt]:"create_agent"}},s=>{try{let i=Reflect.apply(n,r,o),a=o.length>0?o[0]:{};a?.name&&typeof a.name=="string"&&(s.setAttribute(py,a.name),s.updateName(`create_agent ${a.name}`));let c=i.invoke;return c&&typeof c=="function"&&(i.invoke=Rue(c.bind(i),i,a,e)),i}catch(i){throw s.setStatus({code:2,message:"internal_error"}),te(i,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),i}})}})}function Rue(t,e,n,r){return new Proxy(t,{apply(o,s,i){return Cr({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[W]:wy,[ee]:sm,[vt]:"invoke_agent"}},async a=>{try{let c=n?.name;c&&typeof c=="string"&&(a.setAttribute(XB,c),a.setAttribute(py,c),a.updateName(`invoke_agent ${c}`));let d=(i.length>1?i[1]:void 0)?.configurable?.thread_id;d&&typeof d=="string"&&a.setAttribute(sp,d);let _=Nj(e);_&&a.setAttribute(Qr,JSON.stringify(_));let f=r.recordInputs,m=r.recordOutputs,T=i.length>0?i[0]?.messages??[]:[];if(T&&f){let S=dp(T),{systemInstructions:R,filteredMessages:I}=jn(S);R&&a.setAttribute(Bn,R);let x=Ms(I),V=Array.isArray(I)?I.length:0;a.setAttributes({[Lt]:JSON.stringify(x),[un]:V})}let h=await Reflect.apply(o,s,i);return m&&Oj(a,T??null,h),h}catch(c){throw a.setStatus({code:2,message:"internal_error"}),te(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}})}function gm(t,e){return t.compile=ky(t.compile,Xr(e)),t}function _p(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function fp(t,e,n){let r=t[e];if(typeof r=="function"){try{t[e]=n}catch{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=n}catch{Object.defineProperty(t,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}function Cj(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&t!==void 0&&!t.includes("node_modules/")}function Pj(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let s=o.match(r);if(s)return{filename:`<data:${s[2]}>`,function:s[1]};let i=o.match(n);if(i){let a,c,l,p,d;if(i[1]){l=i[1];let T=l.lastIndexOf(".");if(l[T-1]==="."&&T--,T>0){a=l.slice(0,T),c=l.slice(T+1);let h=a.indexOf(".Module");h>0&&(l=l.slice(h+1),a=a.slice(0,h))}p=void 0}c&&(p=a,d=c),c==="<anonymous>"&&(d=void 0,l=void 0),l===void 0&&(d=d||Tf,l=p?`${p}.${d}`:d);let _=Wk(i[2]),f=i[5]==="native";!_&&i[5]&&!f&&(_=i[5]);let m=_?yue(_):void 0;return{filename:m??_,module:m&&t?.(m),function:l,lineno:bj(i[3]),colno:bj(i[4]),in_app:Cj(_||"",f)}}if(o.match(e))return{filename:o}}}function Gy(t){return[90,Pj(t)]}function bj(t){return parseInt(t||"",10)||void 0}function yue(t){try{return decodeURI(t)}catch{return}}var Rn=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let n=this._cache.get(e);if(n!==void 0)return this._cache.delete(e),this._cache.set(e,n),n}set(e,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(e,n)}remove(e){let n=this._cache.get(e);return n&&this._cache.delete(e),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(n=>e.push(n)),e}};var By=K(ne(),1),mp={};function w(t,e,n){return n?Yue(t,e,n):$ue(t,e)}function $ue(t,e){return Object.assign(n=>{let r=mp[t];if(r)return n&&r.setConfig(n),r;let o=e(n);return mp[t]=o,(0,By.registerInstrumentations)({instrumentations:[o]}),o},{id:t})}function Yue(t,e,n){return Object.assign(r=>{let o=n(r),s=mp[t];if(s)return s.setConfig(o),s;let i=new e(o);return mp[t]=i,(0,By.registerInstrumentations)({instrumentations:[i]}),i},{id:t})}function Tp(t){let e=!1,n=[];if(!Wue(t))e=!0;else{let o=t._wrap;t._wrap=(...s)=>(e=!0,n.forEach(i=>i()),n=[],o(...s))}return o=>{e?o():n.push(o)}}function Wue(t){return typeof t._wrap=="function"}b();import{subscribe as zue}from"node:diagnostics_channel";var re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Am="@sentry/instrumentation-http";function Mj(t,e,n,r){let o=0,s=[];re&&g.log(r,"Patching request.on");let i=new WeakMap,a=n==="small"?1e3:n==="medium"?1e4:1048576;try{t.on=new Proxy(t.on,{apply:(c,l,p)=>{let[d,_,...f]=p;if(d==="data"){re&&g.log(r,`Handling request.on("data") with maximum body size of ${a}b`);let m=new Proxy(_,{apply:(T,h,S)=>{try{let R=S[0],I=Buffer.from(R);o<a?(s.push(I),o+=I.byteLength):re&&g.log(r,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{re&&g.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(T,h,S)}});return i.set(_,m),Reflect.apply(c,l,[d,m,...f])}return Reflect.apply(c,l,p)}}),t.off=new Proxy(t.off,{apply:(c,l,p)=>{let[,d]=p,_=i.get(d);if(_){i.delete(d);let f=p.slice();return f[1]=_,Reflect.apply(c,l,f)}return Reflect.apply(c,l,p)}}),t.on("end",()=>{try{let c=Buffer.concat(s).toString("utf-8");if(c){let p=Buffer.byteLength(c,"utf-8")>a?`${Buffer.from(c).subarray(0,a-3).toString("utf-8")}...`:c;e.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(c){re&&g.error(r,"Error building captured request body",c)}})}catch(c){re&&g.error(r,"Error patching request to capture body",c)}}var xj=Ln("sentry_http_server_instrumented"),Hy="Http.Server",jy=new Map,vj=new WeakSet;function Lj(t,e){nt(t,"_startSpanCallback",new WeakRef(e))}var Kue=(t={})=>{let e={sessions:t.sessions??!0,sessionFlushingDelayMS:t.sessionFlushingDelayMS??6e4,maxRequestBodySize:t.maxRequestBodySize??"medium",ignoreRequestBody:t.ignoreRequestBody};return{name:Hy,setupOnce(){zue("http.server.request.start",r=>{Que(r.server,e)})},afterAllSetup(n){re&&n.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}},hp=Kue;function Que(t,{ignoreRequestBody:e,maxRequestBodySize:n,sessions:r,sessionFlushingDelayMS:o}){let s=t.emit;if(vj.has(s))return;let i=new Proxy(s,{apply(a,c,l){if(l[0]!=="request")return a.apply(c,l);let p=H();if(P.active().getValue(xj)||!p)return a.apply(c,l);re&&g.log(Hy,"Handling incoming request");let d=ue().clone(),_=l[1],f=l[2],m=op(_),T=_.ip||_.socket?.remoteAddress,h=_.url||"/";n!=="none"&&!e?.(h,_)&&Mj(_,d,n,Hy),d.setSDKProcessingMetadata({normalizedRequest:m,ipAddress:T});let S=(_.method||"GET").toUpperCase(),R=Do(h),I=`${S} ${R}`;return d.setTransactionName(I),r&&p&&Xue(p,{requestIsolationScope:d,response:f,sessionFlushingDelayMS:o??6e4}),Bl(d,()=>{let x={traceId:Wt(),sampleRand:Rt(),propagationSpanId:zt()};Te().setPropagationContext({...x}),d.setPropagationContext({...x});let V=Er.extract(P.active(),m.headers).setValue(xj,!0);return P.with(V,()=>{p.emit("httpServerRequest",_,f,m);let B=_._startSpanCallback?.deref();return B?B(()=>a.apply(c,l)):a.apply(c,l)})})}});vj.add(i),t.emit=i}function Xue(t,{requestIsolationScope:e,response:n,sessionFlushingDelayMS:r}){e.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=e.getScopeData().sdkProcessingMetadata.requestSession;if(t&&o){re&&g.log(`Recorded request session with status: ${o.status}`);let s=new Date;s.setSeconds(0,0);let i=s.toISOString(),a=jy.get(t),c=a?.[i]||{exited:0,crashed:0,errored:0};if(c[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,a)a[i]=c;else{re&&g.log("Opened new request session aggregate.");let l={[i]:c};jy.set(t,l);let p=()=>{clearTimeout(_),d(),jy.delete(t);let f=Object.entries(l).map(([m,T])=>({started:m,exited:T.exited,errored:T.errored,crashed:T.crashed}));t.sendSession({aggregates:f})},d=t.on("flush",()=>{re&&g.log("Sending request session aggregate due to client flush"),p()}),_=setTimeout(()=>{re&&g.log("Sending request session aggregate due to flushing schedule"),p()},r).unref()}}})}b();var wo=K(he(),1);le();import{errorMonitor as Jue}from"node:events";var Dj="Http.ServerSpans",Zue=(t={})=>{let e=t.ignoreStaticAssets??!0,n=t.ignoreIncomingRequests,r=t.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=t,{requestHook:s,responseHook:i,applyCustomAttributesOnSpan:a}=t.instrumentation??{};return{name:Dj,setup(c){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||c.on("httpServerRequest",(l,p,d)=>{let _=l,f=p;Lj(_,T=>{if(nle(_,{ignoreStaticAssets:e,ignoreIncomingRequests:n}))return re&&g.log(Dj,"Skipping span creation for incoming request",_.url),T();let h=d.url||_.url||"/",S=rp(h),R=_.headers,I=R["user-agent"],x=R["x-forwarded-for"],V=_.httpVersion,B=R.host,se=B?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",ve=c.tracer,nn=h.startsWith("https")?"https":"http",Ao=d.method||_.method?.toUpperCase()||"GET",es=S?S.pathname:Do(h),Ti=`${Ao} ${es}`,ht=ve.startSpan(Ti,{kind:Oe.SERVER,attributes:{[ee]:"http.server",[W]:"auto.http.otel.http","sentry.http.prefetch":ele(_)||void 0,"http.url":h,"http.method":d.method,"http.target":S?`${S.pathname}${S.search}`:es,"http.host":B,"net.host.name":se,"http.client_ip":typeof x=="string"?x.split(",")[0]:void 0,"http.user_agent":I,"http.scheme":nn,"http.flavor":V,"net.transport":V?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...rle(_),...Qf(d.headers||{},c.getOptions().sendDefaultPii??!1)}});s?.(ht,_),i?.(ht,f),a?.(ht,_,f),o?.(ht,_,f);let ka={type:wo.RPCType.HTTP,span:ht};return P.with((0,wo.setRPCMetadata)(X.setSpan(P.active(),ht),ka),()=>{P.bind(P.active(),_),P.bind(P.active(),f);let Ga=!1;function Xb(Fd){if(Ga)return;Ga=!0;let Jb=ile(_,f);ht.setAttributes(Jb),ht.setStatus(Fd),ht.end();let Zb=Jb["http.route"];Zb&&ue().setTransactionName(`${_.method?.toUpperCase()||"GET"} ${Zb}`)}return f.on("close",()=>{Xb(xo(f.statusCode))}),f.on(Jue,()=>{let Fd=xo(f.statusCode);Xb(Fd.code===2?Fd:{code:2})}),T()})})})},processEvent(c){if(c.type==="transaction"){let l=c.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"&&ale(l,r))return re&&g.log("Dropping transaction due to status code",l),null}return c},afterAllSetup(c){re&&(c.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),c.getIntegrationByName("Http.Server")||g.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}},Ep=Zue;function ele(t){return t.headers["next-router-prefetch"]==="1"}function tle(t){let e=Do(t);return!!(e.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||e.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function nle(t,{ignoreStaticAssets:e,ignoreIncomingRequests:n}){if((0,wo.isTracingSuppressed)(P.active()))return!0;let r=t.url,o=t.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||e&&o==="GET"&&tle(r)||n?.(r,t))}function rle(t){let e=ole(t.headers);return e==null?{}:sle(t.headers)?{"http.request_content_length":e}:{"http.request_content_length_uncompressed":e}}function ole(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}function sle(t){let e=t["content-encoding"];return!!e&&e!=="identity"}function ile(t,e){let{socket:n}=t,{statusCode:r,statusMessage:o}=e,s={[Io]:r,[Ri]:r,"http.status_text":o?.toUpperCase()},i=(0,wo.getRPCMetadata)(P.active());if(n){let{localAddress:a,localPort:c,remoteAddress:l,remotePort:p}=n;s[Pg]=a,s[Mg]=c,s[Cg]=l,s["net.peer.port"]=p}if(s[Ri]=r,s["http.status_text"]=(o||"").toUpperCase(),i?.type===wo.RPCType.HTTP&&i.route!==void 0){let a=i.route;s[No]=a}return s}function ale(t,e){return e.some(n=>{if(typeof n=="number")return n===t;let[r,o]=n;return t>=r&&t<=o})}b();var Gj=K(he(),1),gp=K(ne(),1);le();import{subscribe as Vy,unsubscribe as Fy}from"node:diagnostics_channel";import{errorMonitor as kj}from"node:events";function Sp(t,e){if(!t)return e;let n=wi(t),r=wi(e);if(!r)return t;let o={},s={};for(let[c,l]of Object.entries(r))c.startsWith(zr)?o[c]=l:s[c]=l;let i=Object.keys(o).length>0,a={};if(n)for(let[c,l]of Object.entries(n))i&&c.startsWith(zr)||(a[c]=l);Object.assign(a,o);for(let[c,l]of Object.entries(s))a[c]||(a[c]=l);return Nf(a)}var Bc="@sentry/instrumentation-http";function Uj(t,e){let n=cle(t),r=e?.statusCode,o=_p(r);tr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function Rm(t,e){let n=ym(t),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Fi(n,r,e)?Pc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s;if(!t.getHeader("sentry-trace")){if(i)try{t.setHeader("sentry-trace",i),re&&g.log(Bc,"Added sentry-trace header to outgoing request")}catch(p){re&&g.error(Bc,"Failed to add sentry-trace header to outgoing request:",Yr(p)?p.message:"Unknown error")}if(c&&!t.getHeader("traceparent"))try{t.setHeader("traceparent",c),re&&g.log(Bc,"Added traceparent header to outgoing request")}catch(p){re&&g.error(Bc,"Failed to add traceparent header to outgoing request:",Yr(p)?p.message:"Unknown error")}if(a){let p=t.getHeader("baggage"),d=Sp(p,a);if(d)try{t.setHeader("baggage",d),re&&g.log(Bc,"Added baggage header to outgoing request")}catch(_){re&&g.error(Bc,"Failed to add baggage header to outgoing request:",Yr(_)?_.message:"Unknown error")}}}}function cle(t){try{let e=t.getHeader("host")||t.host,n=new URL(t.path,`${t.protocol}//${e}`),r=Rs(n.toString()),o={url:ys(r),"http.method":t.method||"GET"};return r.search&&(o["http.query"]=r.search),r.hash&&(o["http.fragment"]=r.hash),o}catch{return{}}}function wj(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function ym(t){let e=t.getHeader("host")||t.host,n=t.protocol,r=t.path;return`${n}//${e}${r}`}var Qi=class extends gp.InstrumentationBase{constructor(e={}){super(Am,pe,e),this._propagationDecisionMap=new Rn(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,n=a=>{let c=a;this._onOutgoingRequestFinish(c.request,c.response)},r=a=>{let c=a;this._onOutgoingRequestFinish(c.request,void 0)},o=a=>{let c=a;this._onOutgoingRequestCreated(c.request)},s=a=>(e||(e=!0,Vy("http.client.response.finish",n),Vy("http.client.request.error",r),(this.getConfig().propagateTraceInOutgoingRequests||this.getConfig().createSpansForOutgoingRequests)&&Vy("http.client.request.created",o)),a),i=()=>{Fy("http.client.response.finish",n),Fy("http.client.request.error",r),Fy("http.client.request.created",o)};return[new gp.InstrumentationNodeModuleDefinition("http",["*"],s,i),new gp.InstrumentationNodeModuleDefinition("https",["*"],s,i)]}_startSpanForOutgoingRequest(e){let n=e.once,[r,o]=ule(e),s=kf({name:r,attributes:o,onlyIfParent:!0});this.getConfig().outgoingRequestHook?.(s,e);let i=new Proxy(n,{apply(l,p,d){let[_]=d;if(_!=="response")return l.apply(p,d);let f=P.active(),m=X.setSpan(f,s);return P.with(m,()=>l.apply(p,d))}});e.once=i;let a=!1,c=l=>{a||(a=!0,s.setStatus(l),s.end())};return e.prependListener("response",l=>{e.listenerCount("response")<=1&&l.resume(),P.bind(P.active(),l);let p=lle(l);s.setAttributes(p),this.getConfig().outgoingResponseHook?.(s,l),this.getConfig().outgoingRequestApplyCustomAttributes?.(s,e,l);let d=(_=!1)=>{this._diag.debug("outgoingRequest on end()");let f=_||typeof l.statusCode!="number"||l.aborted&&!l.complete?{code:Be.ERROR}:xo(l.statusCode);c(f)};l.on("end",()=>{d()}),l.on(kj,_=>{this._diag.debug("outgoingRequest on response error()",_),d(!0)})}),e.on("close",()=>{c({code:Be.UNSET})}),e.on(kj,l=>{this._diag.debug("outgoingRequest on request error()",l),c({code:Be.ERROR})}),s}_onOutgoingRequestFinish(e,n){re&&g.log(Am,"Handling finished outgoing request");let r=this.getConfig().breadcrumbs,o=typeof r>"u"?!0:r,s=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,s),o&&!s&&Uj(e,n)}_onOutgoingRequestCreated(e){re&&g.log(Am,"Handling outgoing request created");let n=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,n),n)return;let r=this.getConfig().createSpansForOutgoingRequests&&(this.getConfig().spans??!0),o=this.getConfig().propagateTraceInOutgoingRequests;if(r){let s=this._startSpanForOutgoingRequest(e);if(o&&s.isRecording()){let i=X.setSpan(P.active(),s);P.with(i,()=>{Rm(e,this._propagationDecisionMap)})}else o&&Rm(e,this._propagationDecisionMap)}else o&&Rm(e,this._propagationDecisionMap)}_shouldIgnoreOutgoingRequest(e){if((0,Gj.isTracingSuppressed)(P.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=wj(e),o=ym(e);return n(o,r)}};function ule(t){let e=ym(t),[n,r]=ty(rp(e),"client","auto.http.otel.http",t),o=t.getHeader("user-agent");return[n,{[ee]:"http.client","otel.kind":"CLIENT",[Jg]:o,[rs]:e,"http.url":e,"http.method":t.method,"http.target":t.path||"/","net.peer.name":t.host,"http.host":t.getHeader("host"),...r}]}function lle(t){let{statusCode:e,statusMessage:n,httpVersion:r,socket:o}=t,s=r.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp",i={[Io]:e,[Yg]:r,"http.flavor":r,[Wg]:s,"net.transport":s,"http.status_text":n?.toUpperCase(),"http.status_code":e,...ple(t)};if(o){let{remoteAddress:a,remotePort:c}=o;i[qg]=a,i[$g]=c,i["net.peer.ip"]=a,i["net.peer.port"]=c}return i}function ple(t){let e=dle(t.headers);return e==null?{}:_le(t.headers)?{[vg]:e}:{[Lg]:e}}function dle(t){let e=t["content-length"];if(typeof e=="number")return e;if(typeof e!="string")return;let n=parseInt(e,10);if(!isNaN(n))return n}function _le(t){let e=t["content-encoding"];return!!e&&e!=="identity"}var Bj="Http",fle=w(`${Bj}.sentry`,t=>new Qi(t)),jj=(t={})=>{let e={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},n={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes},r={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:t.tracePropagation??!0,ignoreOutgoingRequests:t.ignoreOutgoingRequests},o=hp(e),s=Ep(n),i=t.spans??!1,a=t.disableIncomingRequestSpans??!1,c=i&&!a;return{name:Bj,setup(l){c&&s.setup(l)},setupOnce(){o.setupOnce(),fle(r)},processEvent(l){return s.processEvent(l)}}};b();var Fj=K(he(),1),qj=K(ne(),1);import*as jc from"diagnostics_channel";var Mr=mR(process.versions.node),ko=Mr.major,Ap=Mr.minor;var qy="sentry-trace",Im="baggage",mle="traceparent";function Hj(t,e){let n=Nm(t.origin,t.path),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Fi(n,r,e)?Pc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s,l=Array.isArray(t.headers)?t.headers:Tle(t.headers);if($y(l,qy),$y(l,Im),o&&$y(l,mle),!(Yy(l,qy)!==-1)){i&&l.push(qy,i),c&&Yy(l,"traceparent")===-1&&l.push("traceparent",c);let d=Yy(l,Im);if(a&&d===-1)l.push(Im,a);else if(a){let _=l[d+1],f=Sp(_,a);f&&(l[d+1]=f)}}Array.isArray(t.headers)||(t.headers=hle(l))}function Tle(t){let e=t.split(`\r
|
|
28
|
+
`),n=[];for(let r of e)try{let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&n.push(s,i)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function hle(t){let e=[];for(let n=0;n<t.length;n+=2){let r=t[n],o=t[n+1];!r||o==null||e.push(`${r}: ${o}`)}return e.length?e.join(`\r
|
|
29
|
+
`).concat(`\r
|
|
30
|
+
`):""}function $y(t,e){let n=-1;for(let r=0;r<t.length;r+=2){if(t[r]!==e)continue;if(n===-1){n=r;continue}let o=t[n+1];if(e===Im&&o){let s=Sp(t[r+1],o);s&&(t[n+1]=s)}t.splice(r,2),r-=2}}function Yy(t,e){return t.findIndex((n,r)=>r%2===0&&n===e)}function Vj(t,e){let n=Ele(t),r=e.statusCode,o=_p(r);tr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function Ele(t){try{let e=Nm(t.origin,t.path),n=Rs(e),r={url:ys(n),"http.method":t.method||"GET"};return n.search&&(r["http.query"]=n.search),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function Nm(t,e="/"){try{return new URL(e,t).toString()}catch{let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}}var Xi=class extends qj.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-node-fetch",pe,e),this._channelSubs=[],this._propagationDecisionMap=new Rn(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs=[]}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this._subscribeToChannel("undici:request:create",this._onRequestCreated.bind(this)),this._subscribeToChannel("undici:request:headers",this._onResponseHeaders.bind(this)))}_onRequestCreated({request:e}){let n=this.getConfig();if(!(n.enabled!==!1))return;let o=this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,o),!o&&n.tracePropagation!==!1&&Hj(e,this._propagationDecisionMap)}_onResponseHeaders({request:e,response:n}){let r=this.getConfig();if(!(r.enabled!==!1))return;let s=r.breadcrumbs,i=typeof s>"u"?!0:s,a=this._ignoreOutgoingRequestsMap.get(e);i&&!a&&Vj(e,n)}_subscribeToChannel(e,n){let r=ko>18||ko===18&&Ap>=19,o;if(r)jc.subscribe?.(e,n),o=()=>jc.unsubscribe?.(e,n);else{let s=jc.channel(e);s.subscribe(n),o=()=>s.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:o})}_shouldIgnoreOutgoingRequest(e){if((0,Fj.isTracingSuppressed)(P.active()))return!0;let n=Nm(e.origin,e.path),r=this.getConfig().ignoreOutgoingRequests;return typeof r!="function"||!n?!1:r(n)}};var Sle="NodeFetch",gle=w(`${Sle}.sentry`,Xi,t=>t),Ale=(t={})=>({name:"NodeFetch",setupOnce(){gle(t)}}),$j=Ale;var bV=K(zj(),1);le();b();b();var ln=K(he(),1),Ds=K(wI(),1),$I="sentry.parentIsRemote",Zc="sentry.graphql.operation";function YI(t){if("parentSpanId"in t)return t.parentSpanId;if("parentSpanContext"in t)return t.parentSpanContext?.spanId}function WI(t){let e=t;return!!e.attributes&&typeof e.attributes=="object"}function ude(t){return typeof t.kind=="number"}function lde(t){return!!t.status}function XH(t){return!!t.name}function pde(t){if(!WI(t))return{};let e=t.attributes[rs]||t.attributes[$a],n={url:e,"http.method":t.attributes[Ii]||t.attributes[Sl]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof e=="string"){let r=Rs(e);n.url=ys(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function dde(t){return ude(t)?t.kind:Oe.INTERNAL}var AT="sentry-trace",kI="baggage",zI="sentry.dsc",KI="sentry.sampled_not_recording",JH="sentry.url",_de="sentry.sample_rand",fde="sentry.sample_rate",QI=Ln("sentry_scopes"),GI=Ln("sentry_fork_isolation_scope"),BI=Ln("sentry_fork_set_scope"),jI=Ln("sentry_fork_set_isolation_scope"),ZH="_scopeContext";function eu(t){return t.getValue(QI)}function eV(t,e){return t.setValue(QI,e)}function mde(t,e){nt(t,ZH,e)}function Mp(t){return t[ZH]}function Jc(t){let{traceFlags:e,traceState:n}=t,r=n?n.get(KI)==="1":!1;if(e===Vt.SAMPLED)return!0;if(r)return!1;let o=n?n.get(zI):void 0,s=o?vo(o):void 0;if(s?.sampled==="true")return!0;if(s?.sampled==="false")return!1}function tV(t,e,n){let r=e[Ii]||e[Sl];if(r)return hde({attributes:e,name:t,kind:n},r);let o=e[yi]||e[Ng],s=typeof e[ee]=="string"&&e[ee].startsWith("cache.");if(o&&!s)return Tde({attributes:e,name:t});let i=e[Ue]==="custom"?"custom":"route";if(e[wg])return{...Pp(t,e,"route"),op:"rpc"};if(e[Ug])return{...Pp(t,e,i),op:"message"};let l=e[bg];return l?{...Pp(t,e,i),op:l.toString()}:{op:void 0,description:t,source:"custom"}}function nV(t){let e=WI(t)?t.attributes:{},n=XH(t)?t.name:"<unknown>",r=dde(t);return tV(n,e,r)}function Tde({attributes:t,name:e}){let n=t[Zn];if(typeof n=="string")return{op:"db",description:n,source:t[Ue]||"custom"};if(t[Ue]==="custom")return{op:"db",description:e,source:"custom"};let r=t[Og];return{op:"db",description:r?r.toString():e,source:"task"}}function hde({name:t,kind:e,attributes:n},r){let o=["http"];switch(e){case Oe.CLIENT:o.push("client");break;case Oe.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:s,url:i,query:a,fragment:c,hasRoute:l}=Sde(n,e);if(!s)return{...Pp(t,n),op:o.join(".")};let p=n[Zc],d=`${r} ${s}`,_=p?`${d} (${Ede(p)})`:d,f=l||s==="/"?"route":"url",m={};i&&(m.url=i),a&&(m["http.query"]=a),c&&(m["http.fragment"]=c);let T=e===Oe.CLIENT||e===Oe.SERVER,S=!`${n[W]||"manual"}`.startsWith("auto"),R=n[Ue]==="custom",I=n[Zn],x=!R&&I==null&&(T||!S),{description:V,source:B}=x?{description:_,source:f}:Pp(t,n);return{op:o.join("."),description:V,source:B,data:m}}function Ede(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}`}function Sde(t,e){let n=t[xg],r=t[$a]||t[rs],o=t[No],s=typeof r=="string"?Rs(r):void 0,i=s?ys(s):void 0,a=s?.search||void 0,c=s?.hash||void 0;return typeof o=="string"?{urlPath:o,url:i,query:a,fragment:c,hasRoute:!0}:e===Oe.SERVER&&typeof n=="string"?{urlPath:Do(n),url:i,query:a,fragment:c,hasRoute:!1}:s?{urlPath:i,url:i,query:a,fragment:c,hasRoute:!1}:typeof n=="string"?{urlPath:Do(n),url:i,query:a,fragment:c,hasRoute:!1}:{urlPath:void 0,url:i,query:a,fragment:c,hasRoute:!1}}function Pp(t,e,n="custom"){let r=e[Ue]||n,o=e[Zn];return o&&typeof o=="string"?{description:o,source:r}:{description:t,source:r}}function rV(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=Y(n).data[Ue],{description:i}=XH(n)?nV(n):{description:void 0};if(s!=="url"&&i&&(e.transaction=i),Xe()){let a=Jc(n.spanContext());e.sampled=a==null?void 0:String(a)}})}function oV(){return X.getActiveSpan()}var Us=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function sV({dsc:t,sampled:e}){let n=t?Ui(t):void 0,r=new ln.TraceState,o=n?r.set(zI,n):r;return e===!1?o.set(KI,"1"):o}var iV=new Set;function aV(){return Array.from(iV)}function NT(t){iV.add(t)}var RT=class extends ln.W3CBaggagePropagator{constructor(){super(),NT("SentryPropagator"),this._urlMatchesTargetsMap=new Rn(100)}inject(e,n,r){if((0,ln.isTracingSuppressed)(e)){Us&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=X.getSpan(e),s=o&&yde(o),{tracePropagationTargets:i,propagateTraceparent:a}=H()?.getOptions()||{};if(!Fi(s,i,this._urlMatchesTargetsMap)){Us&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",s);return}let c=Ade(n),l=Rde(n),p=Er.getBaggage(e)||Er.createBaggage({}),{dynamicSamplingContext:d,traceId:_,spanId:f,sampled:m}=cV(e);if(c){let T=wi(c);T&&Object.entries(T).forEach(([h,S])=>{!l&&h.startsWith(zr)||(p=p.setEntry(h,{value:S}))})}!l&&d&&(p=Object.entries(d).reduce((T,[h,S])=>S?T.setEntry(`${zr}${h}`,{value:S}):T,p)),!l&&_&&_!==Si&&(r.set(n,AT,hs(_,f,m)),a&&r.set(n,"traceparent",Es(_,f,m))),super.inject(Er.setBaggage(e,p),n,r)}extract(e,n,r){let o=r.get(n,AT),s=r.get(n,kI),i=o?Array.isArray(o)?o[0]:o:void 0;return lV(uV(e,{sentryTrace:i,baggage:s}))}fields(){return[AT,kI,"traceparent"]}};function cV(t,e={}){let n=X.getSpan(t);if(n?.spanContext().isRemote){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:void 0,sampled:Jc(a)}}if(n){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:a.spanId,sampled:Jc(a)}}let r=e.scope||eu(t)?.scope||Te(),o=e.client||H(),s=r.getPropagationContext();return{dynamicSamplingContext:o?Kr(o,r):void 0,traceId:s.traceId,spanId:s.propagationSpanId,sampled:s.sampled}}function uV(t,{sentryTrace:e,baggage:n}){let r=Hl(e,n),{traceId:o,parentSpanId:s,sampled:i,dsc:a}=r,c=H(),l=vo(n);if(!s||c&&!CR(c,l?.org_id))return t;let p=Ide({traceId:o,spanId:s,sampled:i,dsc:a});return X.setSpanContext(t,p)}function gde(t,e,n){let r=lV(uV(t,e));return P.with(r,n)}function lV(t){let e=eu(t),n={scope:e?e.scope:Te().clone(),isolationScope:e?e.isolationScope:ue()};return eV(t,n)}function Ade(t){try{let e=t[kI];return Array.isArray(e)?e.join(","):e}catch{return}}function Rde(t){try{return t[AT]}catch{return}}function yde(t){let e=Y(t).data,n=e[$a]||e[rs];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(JH);if(r)return r}function Ide({spanId:t,traceId:e,sampled:n,dsc:r}){let o=sV({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Vt.SAMPLED:Vt.NONE,traceState:o}}function pV(t,e,n){let r=_V(),{name:o,parentSpan:s}=t;return EV(s)(()=>{let a=TV(t.scope,t.forceTransaction),l=t.onlyIfParent&&!X.getSpan(a)?(0,ln.suppressTracing)(a):a,p=fV(t);if(!Xe()){let d=(0,ln.isTracingSuppressed)(l)?l:(0,ln.suppressTracing)(l);return P.with(d,()=>r.startActiveSpan(o,p,d,_=>(HI(_),P.with(a,()=>br(()=>e(_),()=>{Y(_).status===void 0&&_.setStatus({code:Be.ERROR})},n?()=>_.end():void 0)))))}return r.startActiveSpan(o,p,l,d=>(HI(d),br(()=>e(d),()=>{Y(d).status===void 0&&d.setStatus({code:Be.ERROR})},n?()=>d.end():void 0)))})}function Nde(t,e){return pV(t,e,!0)}function Ode(t,e){return pV(t,n=>e(n,()=>n.end()),!1)}function bde(t){let e=_V(),{name:n,parentSpan:r}=t;return EV(r)(()=>{let s=TV(t.scope,t.forceTransaction),a=t.onlyIfParent&&!X.getSpan(s)?(0,ln.suppressTracing)(s):s,c=fV(t);Xe()||(a=(0,ln.isTracingSuppressed)(a)?a:(0,ln.suppressTracing)(a));let l=e.startSpan(n,c,a);return HI(l),l})}function dV(t,e){let n=t?X.setSpan(P.active(),t):X.deleteSpan(P.active());return P.with(n,()=>e(Te()))}function _V(){return H()?.tracer||X.getTracer("@sentry/opentelemetry",pe)}function fV(t){let{startTime:e,attributes:n,kind:r,op:o,links:s}=t,i=typeof e=="number"?mV(e):e;return{attributes:o?{[ee]:o,...n}:n,kind:r,links:s,startTime:i}}function mV(t){return t<9999999999?t*1e3:t}function HI(t){let e=t.end.bind(t);t.end=n=>e(typeof n=="number"?mV(n):n)}function TV(t,e){let n=Cde(t),r=X.getSpan(n);if(!r||!e)return n;let o=X.deleteSpan(n),{spanId:s,traceId:i}=r.spanContext(),a=Jc(r.spanContext()),c=je(r),l=Je(c),p=sV({dsc:l,sampled:a}),d={traceId:i,spanId:s,isRemote:!0,traceFlags:a?Vt.SAMPLED:Vt.NONE,traceState:p};return X.setSpanContext(o,d)}function Cde(t){if(t){let e=Mp(t);if(e)return e}return P.active()}function Pde(t,e){return gde(P.active(),t,e)}function Mde(t){let e=Wt(),n=zt(),r={traceId:e,spanId:n,isRemote:!0,traceFlags:Vt.NONE},o=X.setSpanContext(P.active(),r);return P.with(o,()=>(Te().setPropagationContext({traceId:e,sampleRand:Rt()}),t()))}function hV(t,e){let n=Mp(e),r=n&&X.getSpan(n),o=r?Ss(r):Di(e);return[r?Je(r):Kr(t,e),o]}function EV(t){return t!==void 0?e=>dV(t,e):e=>e()}function xde(t){let e=(0,ln.suppressTracing)(P.active());return P.with(e,t)}function SV(t){t.on("preprocessEvent",e=>{let n=oV();if(!n||e.type==="transaction")return;e.contexts={trace:Ss(n),...e.contexts};let r=je(n);return e.sdkProcessingMetadata={dynamicSamplingContext:Je(r),...e.sdkProcessingMetadata},e})}function vde({span:t,scope:e,client:n,propagateTraceparent:r}={}){let o=(e&&Mp(e))??P.active();if(t){let{scope:p}=Ir(t);o=p&&Mp(p)||X.setSpan(P.active(),t)}let{traceId:s,spanId:i,sampled:a,dynamicSamplingContext:c}=cV(o,{scope:e,client:n}),l={"sentry-trace":hs(s,i,a),baggage:Ui(c)};return r&&(l.traceparent=Es(s,i,a)),l}function gV(){function t(){let a=P.active(),c=eu(a);return c||{scope:mc(),isolationScope:Jn()}}function e(a){let c=P.active();return P.with(c,()=>a(s()))}function n(a,c){let l=Mp(a)||P.active();return P.with(l.setValue(BI,a),()=>c(a))}function r(a){let c=P.active();return P.with(c.setValue(GI,!0),()=>a(i()))}function o(a,c){let l=P.active();return P.with(l.setValue(jI,a),()=>c(i()))}function s(){return t().scope}function i(){return t().isolationScope}ER({withScope:e,withSetScope:n,withSetIsolationScope:o,withIsolationScope:r,getCurrentScope:s,getIsolationScope:i,startSpan:Nde,startSpanManual:Ode,startInactiveSpan:bde,getActiveSpan:oV,suppressTracing:xde,getTraceData:vde,continueTrace:Pde,startNewTrace:Mde,withActiveSpan:dV})}function AV(t){class e extends t{constructor(...r){super(...r),NT("SentryContextManager")}with(r,o,s,...i){let a=eu(r),c=a?.scope||Te(),l=a?.isolationScope||ue(),p=r.getValue(GI)===!0,d=r.getValue(BI),_=r.getValue(jI),f=d||c.clone(),m=_||(p?l.clone():l),S=eV(r,{scope:f,isolationScope:m}).deleteValue(GI).deleteValue(BI).deleteValue(jI);return mde(f,S),super.with(S,o,s,...i)}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:QI}}}return e}function Lde(t){let e=new Map;for(let n of t)Dde(e,n);return Array.from(e,function([n,r]){return r})}function RV(t){return t.attributes[$I]===!0?void 0:YI(t)}function Dde(t,e){let n=e.spanContext().spanId,r=RV(e);if(!r){VI(t,{id:n,span:e,children:[]});return}let o=Ude(t,r),s=VI(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function Ude(t,e){let n=t.get(e);return n||VI(t,{id:e,children:[]})}function VI(t,e){let n=t.get(e.id);return n?.span?n:n&&!n.span?(n.span=e.span,n.parentNode=e.parentNode,n):(t.set(e.id,e),e)}var yV={1:"cancelled",2:"unknown_error",3:"invalid_argument",4:"deadline_exceeded",5:"not_found",6:"already_exists",7:"permission_denied",8:"resource_exhausted",9:"failed_precondition",10:"aborted",11:"out_of_range",12:"unimplemented",13:"internal_error",14:"unavailable",15:"data_loss",16:"unauthenticated"},wde=t=>Object.values(yV).includes(t);function IV(t){let e=WI(t)?t.attributes:{},n=lde(t)?t.status:void 0;if(n){if(n.code===Be.OK)return{code:1};if(n.code===Be.ERROR){if(typeof n.message>"u"){let o=zH(e);if(o)return o}return n.message&&wde(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=zH(e);return r||(n?.code===Be.UNSET?{code:1}:{code:2,message:"unknown_error"})}function zH(t){let e=t[Io]||t[Ri],n=t[kg],r=typeof e=="number"?e:typeof e=="string"?parseInt(e):void 0;if(typeof r=="number")return xo(r);if(typeof n=="string")return{code:2,message:yV[n]||"unknown_error"}}var KH=1e3,QH=300,FI=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||QH,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Xn()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=ny(this.flush.bind(this),1,{maxWait:100})}export(e){let n=Math.floor(Xn()/1e3);if(this._lastCleanupTimestampInS!==n){let i=0;this._finishedSpanBuckets.forEach((a,c)=>{a&&a.timestampInS<=n-this._finishedSpanBucketSize&&(i+=a.spans.size,this._finishedSpanBuckets[c]=void 0)}),i>0&&Us&&g.log(`SpanExporter dropped ${i} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(e),this._spansToBucketEntry.set(e,o);let s=RV(e);(!s||this._sentSpans.has(s))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]);this._flushSentSpanCache();let n=this._maybeSend(e),r=n.size,o=e.length-r;Us&&g.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);let s=Xn()+QH*1e3;for(let i of n){this._sentSpans.set(i.spanContext().spanId,s);let a=this._spansToBucketEntry.get(i);a&&a.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let n=Lde(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=Gde(i);if(s.parentNode&&this._sentSpans.has(s.parentNode.id)){let p=a.contexts?.trace?.data;p&&(p["sentry.parent_span_already_sent"]=!0)}let c=a.spans||[];for(let p of s.children)qI(p,c,r);a.spans=c.length>KH?c.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,KH):c;let l=Bi(i.events);l&&(a.measurements=l),jf(a)}return r}_flushSentSpanCache(){let e=Xn();for(let[n,r]of this._sentSpans.entries())r<=e&&this._sentSpans.delete(n)}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||this._sentSpans.has(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function kde(t){let e=t.attributes,n=e[W],r=e[ee],o=e[Ue];return{origin:n,op:r,source:o}}function Gde(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=NV(t),i=Ir(t),a=t.attributes[yr],c={[Ue]:s,[yr]:a,[ee]:e,[W]:o,...r,...OV(t.attributes)},{links:l}=t,{traceId:p,spanId:d}=t.spanContext(),_=YI(t),f=IV(t),m={parent_span_id:_,span_id:d,trace_id:p,data:c,origin:o,op:e,status:Gi(f),links:ki(l)},T=c[Io],h=typeof T=="number"?{response:{status_code:T}}:void 0;return{contexts:{trace:m,otel:{resource:t.resource.attributes},...h},spans:[],start_timestamp:gn(t.startTime),timestamp:gn(t.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:i.scope,capturedSpanIsolationScope:i.isolationScope,sampleRate:a,dynamicSamplingContext:Je(t)},...s&&{transaction_info:{source:s}}}}function qI(t,e,n){let r=t.span;if(r&&n.add(r),!r){t.children.forEach(I=>{qI(I,e,n)});return}let s=r.spanContext().spanId,i=r.spanContext().traceId,a=YI(r),{attributes:c,startTime:l,endTime:p,links:d}=r,{op:_,description:f,data:m,origin:T="manual"}=NV(r),h={[W]:T,[ee]:_,...OV(c),...m},S=IV(r),R={span_id:s,trace_id:i,data:h,description:f,parent_span_id:a,start_timestamp:gn(l),timestamp:gn(p)||void 0,status:Gi(S),op:_,origin:T,measurements:Bi(r.events),links:ki(d)};e.push(R),t.children.forEach(I=>{qI(I,e,n)})}function NV(t){let{op:e,source:n,origin:r}=kde(t),{op:o,description:s,source:i,data:a}=nV(t),c=e||o,l=n||i,p={...a,...Bde(t)};return{op:c,description:s,source:l,origin:r,data:p}}function OV(t){let e={...t};return delete e[yr],delete e[$I],delete e[Zn],e}function Bde(t){let e=t.attributes,n={};t.kind!==Oe.INTERNAL&&(n["otel.kind"]=Oe[t.kind]);let r=e[Ri];r&&(n[Io]=r);let o=pde(t);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function jde(t,e){let n=X.getSpan(e),r=eu(e);n&&!n.spanContext().isRemote&&Sc(n,t),n?.spanContext().isRemote&&t.setAttribute($I,!0),e===Ba&&(r={scope:mc(),isolationScope:Jn()}),r&&jl(t,r.scope,r.isolationScope),Wl(t),H()?.emit("spanStart",t)}function Hde(t){zl(t),H()?.emit("spanEnd",t)}var yT=class{constructor(e){NT("SentrySpanProcessor"),this._exporter=new FI(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,n){jde(e,n)}onEnd(e){Hde(e),this._exporter.export(e)}},IT=class{constructor(e){this._client=e,NT("SentrySampler")}shouldSample(e,n,r,o,s,i){let a=this._client.getOptions(),c=qde(e),l=c?.spanContext();if(!Xe(a))return Xc({decision:void 0,context:e,spanAttributes:s});let p=s[Sl]||s[Ii];if(o===Oe.CLIENT&&p&&(!c||l?.isRemote))return Xc({decision:void 0,context:e,spanAttributes:s});let d=c?Vde(c,n,r):void 0;if(!(!c||l?.isRemote))return Xc({decision:d?Ds.SamplingDecision.RECORD_AND_SAMPLED:Ds.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s});let{description:f,data:m,op:T}=tV(r,s,o),h={...m,...s};T&&(h[ee]=T);let S={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:h,spanName:f,parentSampled:d,parentContext:l},S),!S.decision)return Xc({decision:void 0,context:e,spanAttributes:s});let{isolationScope:R}=eu(e)??{},I=l?.traceState?l.traceState.get(zI):void 0,x=I?vo(I):void 0,V=Gn(x?.sample_rand)??Rt(),[B,se,ve]=Kl(a,{name:f,attributes:h,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:Gn(x?.sample_rate)},V),nn=`${p}`.toUpperCase();return nn==="OPTIONS"||nn==="HEAD"?(Us&&g.log(`[Tracing] Not sampling span because HTTP method is '${nn}' for ${r}`),Xc({decision:Ds.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:V,downstreamTraceSampleRate:0})):(!B&&d===void 0&&(Us&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate","transaction")),{...Xc({decision:B?Ds.SamplingDecision.RECORD_AND_SAMPLED:Ds.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:V,downstreamTraceSampleRate:ve?se:void 0}),attributes:{[yr]:ve?se:void 0}})}toString(){return"SentrySampler"}};function Vde(t,e,n){let r=t.spanContext();if(yo(r)&&r.traceId===e){if(r.isRemote){let s=Jc(t.spanContext());return Us&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${s}`),s}let o=Jc(r);return Us&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function Xc({decision:t,context:e,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o}){let s=Fde(e,n);return o!==void 0&&(s=s.set(fde,`${o}`)),r!==void 0&&(s=s.set(_de,`${r}`)),t==null?{decision:Ds.SamplingDecision.NOT_RECORD,traceState:s}:t===Ds.SamplingDecision.NOT_RECORD?{decision:t,traceState:s.set(KI,"1")}:{decision:t,traceState:s}}function Fde(t,e){let o=X.getSpan(t)?.spanContext()?.traceState||new ln.TraceState,s=e[$a]||e[rs];return s&&typeof s=="string"&&(o=o.set(JH,s)),o}function qde(t){let e=X.getSpan(t);return e&&yo(e.spanContext())?e:void 0}var XI=AV(bV.AsyncLocalStorageContextManager);b();function JI(){Dn.disable(),Dn.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},pt.DEBUG)}import*as ZI from"node:diagnostics_channel";var $de="ChildProcess",CV=(t={})=>({name:$de,setup(){ZI.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&Yde(e.process,t)}),ZI.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&Wde(e.worker,t)})}});function Yde(t,e){let n=!1,r;t.on("spawn",()=>{if(t.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:t.spawnfile},e.includeChildProcessArgs&&(r.spawnargs=t.spawnargs)}).on("exit",o=>{n||(n=!0,o!==null&&o!==0&&tr({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,tr({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function Wde(t,e){let n;t.on("online",()=>{n=t.threadId}).on("error",r=>{e.captureWorkerErrors!==!1?te(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):tr({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as zde}from"node:child_process";import{readFile as Kde,readdir as Qde}from"node:fs";import*as Ot from"node:os";import{join as Xde}from"node:path";import{promisify as MV}from"node:util";var Jde=MV(Kde),Zde=MV(Qde),e_e="Context",t_e=(t={})=>{let e,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...t};async function r(s){e===void 0&&(e=o());let i=n_e(await e);return s.contexts={...s.contexts,app:{...i.app,...s.contexts?.app},os:{...i.os,...s.contexts?.os},device:{...i.device,...s.contexts?.device},culture:{...i.culture,...s.contexts?.culture},cloud_resource:{...i.cloud_resource,...s.contexts?.cloud_resource}},s}async function o(){let s={};if(n.os&&(s.os=await r_e()),n.app&&(s.app=s_e()),n.device&&(s.device=i_e(n.device)),n.culture){let i=o_e();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=d_e()),s}return{name:e_e,processEvent(s){return r(s)}}},xV=t_e;function n_e(t){if(t.app?.app_memory&&(t.app.app_memory=process.memoryUsage().rss),t.app?.free_memory&&typeof process.availableMemory=="function"){let e=process.availableMemory?.();e!=null&&(t.app.free_memory=e)}return t.device?.free_memory&&(t.device.free_memory=Ot.freemem()),t}async function r_e(){let t=Ot.platform();switch(t){case"darwin":return l_e();case"linux":return p_e();default:return{name:a_e[t]||t,version:Ot.release()}}}function o_e(){try{if(typeof process.versions.icu!="string")return;let t=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(t)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function s_e(){let t=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:t};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function i_e(t){let e={},n;try{n=Ot.uptime()}catch{}if(typeof n=="number"&&(e.boot_time=new Date(Date.now()-n*1e3).toISOString()),e.arch=Ot.arch(),(t===!0||t.memory)&&(e.memory_size=Ot.totalmem(),e.free_memory=Ot.freemem()),t===!0||t.cpu){let r=Ot.cpus(),o=r?.[0];o&&(e.processor_count=r.length,e.cpu_description=o.model,e.processor_frequency=o.speed)}return e}var a_e={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},c_e=[{name:"fedora-release",distros:["Fedora"]},{name:"redhat-release",distros:["Red Hat Linux","Centos"]},{name:"redhat_version",distros:["Red Hat Linux"]},{name:"SuSE-release",distros:["SUSE Linux"]},{name:"lsb-release",distros:["Ubuntu Linux","Arch Linux"]},{name:"debian_version",distros:["Debian"]},{name:"debian_release",distros:["Debian"]},{name:"arch-release",distros:["Arch Linux"]},{name:"gentoo-release",distros:["Gentoo Linux"]},{name:"novell-release",distros:["SUSE Linux"]},{name:"alpine-release",distros:["Alpine Linux"]}],u_e={alpine:t=>t,arch:t=>oo(/distrib_release=(.*)/,t),centos:t=>oo(/release ([^ ]+)/,t),debian:t=>t,fedora:t=>oo(/release (..)/,t),mint:t=>oo(/distrib_release=(.*)/,t),red:t=>oo(/release ([^ ]+)/,t),suse:t=>oo(/VERSION = (.*)\n/,t),ubuntu:t=>oo(/distrib_release=(.*)/,t)};function oo(t,e){let n=t.exec(e);return n?n[1]:void 0}async function l_e(){let t={kernel_version:Ot.release(),name:"Mac OS X",version:`10.${Number(Ot.release().split(".")[0])-4}`};try{let e=await new Promise((n,r)=>{zde("/usr/bin/sw_vers",(o,s)=>{if(o){r(o);return}n(s)})});t.name=oo(/^ProductName:\s+(.*)$/m,e),t.version=oo(/^ProductVersion:\s+(.*)$/m,e),t.build=oo(/^BuildVersion:\s+(.*)$/m,e)}catch{}return t}function PV(t){return t.split(" ")[0].toLowerCase()}async function p_e(){let t={kernel_version:Ot.release(),name:"Linux"};try{let e=await Zde("/etc"),n=c_e.find(a=>e.includes(a.name));if(!n)return t;let r=Xde("/etc",n.name),o=(await Jde(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(PV(a))>=0)||s[0];let i=PV(t.name);t.version=u_e[i]?.(o)}catch{}return t}function d_e(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as __e}from"node:fs";import{createInterface as f_e}from"node:readline";var eN=new Rn(10),DV=new Rn(20),m_e=7,T_e="ContextLines",h_e=1e3,E_e=1e4;function S_e(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function g_e(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function A_e(t){return t.lineno!==void 0&&t.lineno>E_e||t.colno!==void 0&&t.colno>h_e}function R_e(t,e){let n=eN.get(t);if(n===void 0)return!1;for(let r=e[0];r<=e[1];r++)if(n[r]===void 0)return!1;return!0}function y_e(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=LV(r,e),s=[];for(;;){if(n===t.length-1){s.push(o);break}let i=t[n+1];if(typeof i!="number")break;i<=o[1]?o[1]=i+e:(s.push(o),o=LV(i,e)),n++}return s}function I_e(t,e,n){return new Promise((r,o)=>{let s=__e(t),i=f_e({input:s});function a(){s.destroy(),r()}let c=0,l=0,p=e[l];if(p===void 0){a();return}let d=p[0],_=p[1];function f(m){DV.set(t,1),re&&g.error(`Failed to read file: ${t}. Error: ${m}`),i.close(),i.removeAllListeners(),a()}s.on("error",f),i.on("error",f),i.on("close",a),i.on("line",m=>{if(c++,!(c<d)&&(n[c]=lR(m,0),c>=_)){if(l===e.length-1){i.close(),i.removeAllListeners();return}l++;let T=e[l];if(T===void 0){i.close(),i.removeAllListeners();return}d=T[0],_=T[1]}})})}async function N_e(t,e){let n={};if(e>0&&t.exception?.values){for(let s of t.exception.values)if(s.stacktrace?.frames?.length)for(let i=s.stacktrace.frames.length-1;i>=0;i--){let a=s.stacktrace.frames[i],c=a?.filename;if(!a||typeof c!="string"||typeof a.lineno!="number"||g_e(c)||A_e(a))continue;n[c]||(n[c]=[]),n[c].push(a.lineno)}}let r=Object.keys(n);if(r.length==0)return t;let o=[];for(let s of r){if(DV.get(s))continue;let i=n[s];if(!i)continue;i.sort((l,p)=>l-p);let a=y_e(i,e);if(a.every(l=>R_e(s,l)))continue;let c=S_e(eN,s,{});o.push(I_e(s,a,c))}if(await Promise.all(o).catch(()=>{re&&g.log("Failed to read one or more source files and resolve context lines")}),e>0&&t.exception?.values)for(let s of t.exception.values)s.stacktrace?.frames&&s.stacktrace.frames.length>0&&O_e(s.stacktrace.frames,e,eN);return t}function O_e(t,e,n){for(let r of t)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;b_e(r.lineno,r,e,o)}}function vV(t){delete t.pre_context,delete t.context_line,delete t.post_context}function b_e(t,e,n,r){if(e.lineno===void 0||r===void 0){re&&g.error("Cannot resolve context for frame with no lineno or file contents");return}e.pre_context=[];for(let s=UV(t,n);s<t;s++){let i=r[s];if(i===void 0){vV(e),re&&g.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){vV(e),re&&g.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=wV(t,n);e.post_context=[];for(let s=t+1;s<=o;s++){let i=r[s];if(i===void 0)break;e.post_context.push(i)}}function UV(t,e){return Math.max(1,t-e)}function wV(t,e){return t+e}function LV(t,e){return[UV(t,e),wV(t,e)]}var C_e=(t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:m_e;return{name:T_e,processEvent(n){return N_e(n,e)}}},kV=C_e;import{Worker as P_e}from"node:worker_threads";var OT;async function bT(){if(OT===void 0)try{OT=!!(await import("node:inspector")).url()}catch{OT=!1}return OT}var xp="__SENTRY_ERROR_LOCAL_VARIABLES__";function BV(t,e,n){let r=0,o=5,s=0;return setInterval(()=>{s===0?r>t&&(o*=2,n(o),o>86400&&(o=86400),s=o):(s-=1,s===0&&e()),r=0},1e3).unref(),()=>{r+=1}}function GV(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function CT(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||GV(t)&&GV(e)}var M_e="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ3LjAgKGE1YTRlNzMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function jV(...t){g.log("[LocalVariables]",...t)}var HV=(t={})=>{function e(s,i){let a=(s.stacktrace?.frames||[]).filter(c=>c.function!=="new Promise");for(let c=0;c<a.length;c++){let l=a.length-c-1,p=i[c],d=a[l];if(!d||!p)break;p.vars===void 0||d.in_app===!1&&t.includeOutOfAppFrames!==!0||!CT(d.function,p.function)||(d.vars=p.vars)}}function n(s,i){if(i.originalException&&typeof i.originalException=="object"&&xp in i.originalException&&Array.isArray(i.originalException[xp])){for(let a of s.exception?.values||[])e(a,i.originalException[xp]);i.originalException[xp]=void 0}return s}async function r(){let s=await import("node:inspector");s.url()||s.open(0)}function o(s){let i=new P_e(new URL(`data:application/javascript;base64,${M_e}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{jV("Worker error",a)}),i.once("exit",a=>{jV("Worker exit",a)}),i.unref()}return{name:"LocalVariablesAsync",async setup(s){if(!s.getOptions().includeLocalVariables)return;if(await bT()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...t,debug:g.isEnabled()};r().then(()=>{try{o(a)}catch(c){g.error("Failed to start worker",c)}},c=>{g.error("Failed to start inspector",c)})},processEvent(s,i){return n(s,i)}}};function VV(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function x_e(t,e){if(e!==void 0)return VV(t(e,1))}function FV(t){let e=[],n=!1;function r(i){e=[],!n&&(n=!0,t(i))}e.push(r);function o(i){e.push(i)}function s(i){let a=e.pop()||r;try{a(i)}catch{r(i)}}return{add:o,next:s}}var tN=class t{constructor(e){this._session=e}static async create(e){if(e)return e;let n=await import("node:inspector");return new t(new n.Session)}configureAndConnect(e,n){this._session.connect(),this._session.on("Debugger.paused",r=>{e(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(e){this._session.post("Debugger.setPauseOnExceptions",{state:e?"all":"uncaught"})}getLocalVariables(e,n){this._getProperties(e,r=>{let{add:o,next:s}=FV(n);for(let i of r)if(i.value?.objectId&&i.value.className==="Array"){let a=i.value.objectId;o(c=>this._unrollArray(a,i.name,c,s))}else if(i.value?.objectId&&i.value.className==="Object"){let a=i.value.objectId;o(c=>this._unrollObject(a,i.name,c,s))}else i.value&&o(a=>this._unrollOther(i,a,s));s({})})}_getProperties(e,n){this._session.post("Runtime.getProperties",{objectId:e,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(e,n,r,o){this._getProperties(e,s=>{r[n]=s.filter(i=>i.name!=="length"&&!isNaN(parseInt(i.name,10))).sort((i,a)=>parseInt(i.name,10)-parseInt(a.name,10)).map(i=>i.value?.value),o(r)})}_unrollObject(e,n,r,o){this._getProperties(e,s=>{r[n]=s.map(i=>[i.name,i.value?.value]).reduce((i,[a,c])=>(i[a]=c,i),{}),o(r)})}_unrollOther(e,n,r){e.value&&("value"in e.value?e.value.value===void 0||e.value.value===null?n[e.name]=`<${e.value.value}>`:n[e.name]=e.value.value:"description"in e.value&&e.value.type!=="function"?n[e.name]=`<${e.value.description}>`:e.value.type==="undefined"&&(n[e.name]="<undefined>")),r(n)}},v_e="LocalVariables",L_e=(t={},e)=>{let n=new Rn(20),r,o=!1;function s(l){let p=VV(l.stacktrace?.frames);if(p===void 0)return;let d=n.remove(p);if(d===void 0)return;let _=(l.stacktrace?.frames||[]).filter(f=>f.function!=="new Promise");for(let f=0;f<_.length;f++){let m=_.length-f-1,T=d[f],h=_[m];if(!h||!T)break;T.vars===void 0||h.in_app===!1&&t.includeOutOfAppFrames!==!0||!CT(h.function,T.function)||(h.vars=T.vars)}}function i(l){for(let p of l.exception?.values||[])s(p);return l}let a;async function c(){let p=H()?.getOptions();if(!p?.includeLocalVariables)return;if(ko<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await bT()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let _=await tN.create(e),f=(T,{params:{reason:h,data:S,callFrames:R}},I)=>{if(h!=="exception"&&h!=="promiseRejection"){I();return}r?.();let x=x_e(T,S.description);if(x==null){I();return}let{add:V,next:B}=FV(se=>{n.set(x,se),I()});for(let se=0;se<Math.min(R.length,5);se++){let{scopeChain:ve,functionName:nn,this:Ao}=R[se],es=ve.find(ht=>ht.type==="local"),Ti=Ao.className==="global"||!Ao.className?nn:`${Ao.className}.${nn}`;if(es?.object.objectId===void 0)V(ht=>{ht[se]={function:Ti},B(ht)});else{let ht=es.object.objectId;V(ka=>_.getLocalVariables(ht,Ga=>{ka[se]={function:Ti,vars:Ga},B(ka)}))}}B([])},m=t.captureAllExceptions!==!1;if(_.configureAndConnect((T,h)=>f(p.stackParser,T,h),m),m){let T=t.maxExceptionsPerSecond||50;r=BV(T,()=>{g.log("Local variables rate-limit lifted."),_.setPauseOnExceptions(!0)},h=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${h} seconds.`),_.setPauseOnExceptions(!1)})}o=!0}catch(_){g.log("The `LocalVariables` integration failed to start.",_)}}return{name:v_e,setupOnce(){a=c()},async processEvent(l){return await a,o?i(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}},qV=L_e;var $V=(t={})=>Mr.major<19?qV(t):HV(t);import{existsSync as D_e,readFileSync as KV}from"node:fs";import{dirname as U_e,join as QV}from"node:path";function vp(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var YV;function WV(){return vp()?!1:ko>=21||ko===20&&Ap>=6||ko===18&&Ap>=19?!0:(YV||(YV=!0,Qe(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})),!1)}var nN,w_e="Modules",k_e=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,G_e=()=>({name:w_e,processEvent(t){return t.modules={...t.modules,...zV()},t},getModules:zV}),XV=G_e;function B_e(){try{return U.cache?Object.keys(U.cache):[]}catch{return[]}}function j_e(){return{...k_e,...F_e(),...vp()?H_e():{}}}function H_e(){let t=U.main?.paths||[],e=B_e(),n={},r=new Set;return e.forEach(o=>{let s=o,i=()=>{let a=s;if(s=U_e(a),!s||a===s||r.has(a))return;if(t.indexOf(s)<0)return i();let c=QV(a,"package.json");if(r.add(a),!D_e(c))return i();try{let l=JSON.parse(KV(c,"utf8"));n[l.name]=l.version}catch{}};i()}),n}function zV(){return nN||(nN=j_e()),nN}function V_e(){try{let t=QV(process.cwd(),"package.json");return JSON.parse(KV(t,"utf8"))}catch{return{}}}function F_e(){let t=V_e();return{...t.dependencies,...t.devDependencies}}import{isMainThread as $_e}from"worker_threads";var q_e=2e3;function Lp(t){Qe(()=>{console.error(t)});let e=H();if(e===void 0){re&&g.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let n=e.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:q_e;e.close(r).then(o=>{o||re&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{re&&g.error(o)})}var Y_e="OnUncaughtException",JV=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:Y_e,setup(n){$_e&&global.process.on("uncaughtException",W_e(n,e))}}};function W_e(t,e){let r=!1,o=!1,s=!1,i,a=t.getOptions();return Object.assign(c=>{let l=Lp;e.onFatalError?l=e.onFatalError:a.onFatalError&&(l=a.onFatalError);let d=global.process.listeners("uncaughtException").filter(f=>f.name!=="domainUncaughtExceptionClear"&&f.tag!=="sentry_tracingErrorCallback"&&f._errorHandler!==!0).length===0,_=e.exitEvenIfOtherHandlersAreRegistered||d;r?_&&(s?(re&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Lp(c)):o||(o=!0,setTimeout(()=>{s||(s=!0,l(i,c))},2e3))):(i=c,r=!0,H()===t&&te(c,{originalException:c,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!s&&_&&(s=!0,l(c)))},{_errorHandler:!0})}var z_e="OnUnhandledRejection",K_e=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],Q_e=(t={})=>{let e={mode:t.mode??"warn",ignore:[...K_e,...t.ignore??[]]};return{name:z_e,setup(n){global.process.on("unhandledRejection",efe(n,e))}}},ZV=Q_e;function X_e(t){if(typeof t!="object"||t===null)return{name:"",message:String(t??"")};let e=t,n=typeof e.name=="string"?e.name:"",r=typeof e.message=="string"?e.message:String(t);return{name:n,message:r}}function J_e(t,e){let n=t.name===void 0||Co(e.name,t.name,!0),r=t.message===void 0||Co(e.message,t.message);return n&&r}function Z_e(t,e){let n=X_e(e);return t.some(r=>J_e(r,n))}function efe(t,e){return function(r,o){if(H()!==t||Z_e(e.ignore??[],r))return;let s=e.mode==="strict"?"fatal":"error",i=r&&typeof r=="object"?r._sentry_active_span:void 0;(i?c=>Rc(i,c):c=>c())(()=>{te(r,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:s},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),tfe(r,e.mode)}}function tfe(t,e){let n="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";e==="warn"?Qe(()=>{console.warn(n),console.error(t&&typeof t=="object"&&"stack"in t?t.stack:t)}):e==="strict"&&(Qe(()=>{console.warn(n)}),Lp(t))}var nfe="ProcessSession",eF=()=>({name:nfe,setupOnce(){$f(),process.on("beforeExit",()=>{ue().getSession()?.status!=="ok"&&Jl()})}});import*as tF from"node:http";var rN="Spotlight",rfe=(t={})=>{let e={sidecarUrl:t.sidecarUrl||"http://localhost:8969/stream"};return{name:rN,setup(n){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}ofe(n,e)}}},nF=rfe;function ofe(t,e){let n=sfe(e.sidecarUrl);if(!n)return;let r=0;t.on("beforeEnvelope",o=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let s=Yl(o);yc(()=>{let i=tF.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(r=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});i.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),i.write(s),i.end()})})}function sfe(t){try{return new URL(`${t}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}import*as rF from"node:util";var ife="NodeSystemError";function afe(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:rF.getSystemErrorMap().has(t.errno)}var oF=(t={})=>({name:ife,processEvent:(e,n,r)=>{if(!afe(n.originalException))return e;let o=n.originalException,s={...o};!r.getOptions().sendDefaultPii&&t.includePaths!==!0&&(delete s.path,delete s.dest),e.contexts={...e.contexts,node_system_error:s};for(let i of e.exception?.values||[])i.value&&(o.path&&i.value.includes(o.path)&&(i.value=i.value.replace(`'${o.path}'`,"").trim()),o.dest&&i.value.includes(o.dest)&&(i.value=i.value.replace(`'${o.dest}'`,"").trim()));return e}});import*as ufe from"node:http";import*as lfe from"node:https";import{Readable as pfe}from"node:stream";import{createGzip as dfe}from"node:zlib";import*as jo from"node:net";import*as sN from"node:tls";import*as oN from"node:http";var so=Symbol("AgentBaseInternalState"),PT=class extends oN.Agent{constructor(e){super(e),this[so]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
|
|
31
|
+
`).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(e,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(e,o)).then(s=>{if(s instanceof oN.Agent)return s.addRequest(e,o);this[so].currentSocket=s,super.createSocket(e,n,r)},r)}createConnection(){let e=this[so].currentSocket;if(this[so].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[so].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[so]&&(this[so].defaultPort=e)}get protocol(){return this[so].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[so]&&(this[so].protocol=e)}};function MT(...t){g.log("[https-proxy-agent:parse-proxy-response]",...t)}function sF(t){return new Promise((e,n)=>{let r=0,o=[];function s(){let p=t.read();p?l(p):t.once("readable",s)}function i(){t.removeListener("end",a),t.removeListener("error",c),t.removeListener("readable",s)}function a(){i(),MT("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function c(p){i(),MT("onerror %o",p),n(p)}function l(p){o.push(p),r+=p.length;let d=Buffer.concat(o,r),_=d.indexOf(`\r
|
|
32
|
+
\r
|
|
33
|
+
`);if(_===-1){MT("have not received end of HTTP headers yet..."),s();return}let f=d.subarray(0,_).toString("ascii").split(`\r
|
|
34
|
+
`),m=f.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let T=m.split(" "),h=+(T[1]||0),S=T.slice(2).join(" "),R={};for(let I of f){if(!I)continue;let x=I.indexOf(":");if(x===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${I}"`));let V=I.slice(0,x).toLowerCase(),B=I.slice(x+1).trimStart(),se=R[V];typeof se=="string"?R[V]=[se,B]:Array.isArray(se)?se.push(B):R[V]=B}MT("got proxy server response: %o %o",m,R),i(),e({connect:{statusCode:h,statusText:S,headers:R},buffered:d})}t.on("error",c),t.on("end",a),s()})}function Dp(...t){g.log("[https-proxy-agent]",...t)}var Up=class extends PT{static __initStatic(){this.protocols=["http","https"]}constructor(e,n){super(n),this.options={},this.proxy=typeof e=="string"?new URL(e):e,this.proxyHeaders=n?.headers??{},Dp("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?iF(n,"headers"):null,host:r,port:o}}async connect(e,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){Dp("Creating `tls.Socket`: %o",this.connectOpts);let _=this.connectOpts.servername||this.connectOpts.host;o=sN.connect({...this.connectOpts,servername:_&&jo.isIP(_)?void 0:_})}else Dp("Creating `net.Socket`: %o",this.connectOpts),o=jo.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=jo.isIPv6(n.host)?`[${n.host}]`:n.host,a=`CONNECT ${i}:${n.port} HTTP/1.1\r
|
|
35
|
+
`;if(r.username||r.password){let _=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(_).toString("base64")}`}s.Host=`${i}:${n.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let _ of Object.keys(s))a+=`${_}: ${s[_]}\r
|
|
36
|
+
`;let c=sF(o);o.write(`${a}\r
|
|
37
|
+
`);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",cfe),n.secureEndpoint){Dp("Upgrading socket connection to TLS");let _=n.servername||n.host;return sN.connect({...iF(n,"host","path","port"),socket:o,servername:jo.isIP(_)?void 0:_})}return o}o.destroy();let d=new jo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Dp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};Up.__initStatic();function cfe(t){t.resume()}function iF(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var _fe=1024*32;function ffe(t){return new pfe({read(){this.push(t),this.push(null)}})}function aF(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),tp(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=mfe(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?lfe:ufe,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new Up(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=Tfe(t,t.httpModule??o,i);return tp(t,a)}function mfe(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function Tfe(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{yc(()=>{let _=ffe(l.body),f={...t.headers};l.body.length>_fe&&(f["content-encoding"]="gzip",_=_.pipe(dfe()));let m=r.startsWith("["),T=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},h=>{h.on("data",()=>{}),h.on("end",()=>{}),h.setEncoding("utf8");let S=h.headers["retry-after"]??null,R=h.headers["x-sentry-rate-limits"]??null;p({statusCode:h.statusCode,headers:{"retry-after":S,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});T.on("error",d),_.pipe(T)})})}}function cF(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=bc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as hfe,sep as Efe}from"node:path";function uF(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function lF(t=process.argv[1]?iy(process.argv[1]):process.cwd(),e=Efe==="\\"){let n=e?uF(t):t;return r=>{if(!r)return;let o=e?uF(r):r,{dir:s,base:i,ext:a}=hfe.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function pF(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return e||n||r||t}var dF=hf(Gy(lF()));b();var fF=K(ne(),1);import*as _F from"node:os";import{threadId as Sfe,isMainThread as gfe}from"worker_threads";var Afe=6e4,xT=class extends np{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||_F.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,fF.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Vi(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${gfe?"main":`worker-${Sfe}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Nc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??Afe).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){ZR(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?hV(this,e):[void 0,void 0]}};var mF=K(GA(),1);import*as TF from"module";function iN(){if(WV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,mF.createAddHookMessageChannel)();TF.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){g.warn("Failed to register 'import-in-the-middle' hook",t)}}}function vT(){return[Zf(),Xf(),em(),tm(),oF(),ly(),rm(),jj(),$j(),JV(),ZV(),kV(),$V(),xV(),CV(),eF(),XV()]}function aN(t={}){return Rfe(t,vT)}function Rfe(t={},e){let n=yfe(t,e);n.debug===!0&&(re?g.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&iN(),gV(),Te().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===rN)&&n.integrations.push(nF({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Vi(n,"node-core");let o=new xT(n);return Te().setClient(o),o.init(),g.log(`SDK initialized from ${vp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),Ofe(),rV(o),SV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function cN(){if(!re)return;let t=aV(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||g.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function yfe(t,e){let n=Ife(t.release),r=cF(t.spotlight),o=Nfe(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??aF,stackParser:ZA(t.stackParser||dF),release:n,tracesSampleRate:o,spotlight:r,debug:bc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:$R({defaultIntegrations:a,integrations:i})}}function Ife(t){if(t!==void 0)return t;let e=pF();if(e!==void 0)return e}function Nfe(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function Ofe(){if(bc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Hl(t,e);Te().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function wp(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var uN="Http",hF="@opentelemetry_sentry-patched/instrumentation-http",LT=Mr.major===22&&Mr.minor>=12||Mr.major===23&&Mr.minor>=2||Mr.major>=24,bfe=w(`${uN}.sentry`,t=>new Qi(t)),Cfe=w(uN,t=>{let e=new EF.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=Dn.createComponentLogger({namespace:hF}),e.instrumentationName=hF}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function Pfe(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&<)}var SF=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=hp(r),i=Ep(o),a=e&&!n;return{name:uN,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=Pfe(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:LT||!l,createSpansForOutgoingRequests:LT,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=wp(_);if(f.startsWith("data:")){let m=Cc(f);d.setAttribute("http.url",m),d.setAttribute(Ts,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(bfe(p),l){let d=Mfe(t);Cfe(d)}},processEvent(c){return i.processEvent(c)}}};function Mfe(t={}){return{disableOutgoingRequestInstrumentation:LT,ignoreOutgoingRequestHook:n=>{let r=wp(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=wp(r);if(o.startsWith("data:")){let s=Cc(o);n.setAttribute("http.url",s),n.setAttribute(Ts,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var NF=K(yF(),1);var OF="NodeFetch",Lfe=w(OF,NF.UndiciInstrumentation,t=>kfe(t)),Dfe=w(`${OF}.sentry`,Xi,t=>t),Ufe=(t={})=>({name:"NodeFetch",setupOnce(){wfe(t,H()?.getOptions())&&Lfe(t),Dfe(t)}}),bF=Ufe;function IF(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function wfe(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function kfe(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=IF(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=IF(n.origin,n.path);if(r.startsWith("data:")){let o=Cc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[Ts]:o,[Zn]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var GF=K(kF(),1);var ft=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var BF="Express";function Zfe(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function eme(t,e){if(ue()===Jn())return ft&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var jF=w(BF,()=>new GF.ExpressInstrumentation({requestHook:t=>Zfe(t),spanNameHook:(t,e)=>eme(t,e)})),tme=()=>({name:BF,setupOnce(){jF()}}),HF=tme;var _$=K(a$(),1);import*as JN from"node:diagnostics_channel";b();var Ah=K(he(),1),ia=K(ne(),1);le();var Vo;(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})(Vo||(Vo={}));var Zp;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(Zp||(Zp={}));var ed;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(ed||(ed={}));b();var td=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function XN(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[td]||[];return s.push(o),Object.defineProperty(t,td,{enumerable:!1,configurable:!0,value:s}),o}function Sh(t,e){let n=t[td]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[td])}function u$(t,e,n){let r,o;try{o=t(),c$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!c$(o)&&(e(r,o),r))throw r;return o}}function c$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var Jhe="0.1.0",Zhe="@sentry/instrumentation-fastify-v3",l$="anonymous",eEe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),gh=class extends ia.InstrumentationBase{constructor(e={}){super(Zhe,Jhe,e)}init(){return[new ia.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,Ah.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===Ah.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${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||l$,c=`${ed.MIDDLEWARE} - ${a}`,l=i[1],p=XN(l,s.tracer,c,{[Vo.FASTIFY_TYPE]:Zp.MIDDLEWARE,[Vo.PLUGIN_NAME]:e,[Vo.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){Sh(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>u$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||Sh(l)}))}}_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(!eEe.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()),tEe(),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,ia.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),Sh(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,l=`${ed.REQUEST_HANDLER} - ${c||this.pluginName||l$}`,p={[Vo.PLUGIN_NAME]:this.pluginName,[Vo.FASTIFY_TYPE]:Zp.REQUEST_HANDLER,[Dg]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[Vo.FASTIFY_NAME]=c);let d=XN(o,e.tracer,l,p);p$(d);let{requestHook:_}=e.getConfig();return _&&(0,ia.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function tEe(){let t=H();t&&t.on("spanStart",e=>{p$(e)})}function p$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${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 Rh="Fastify",f$=w(`${Rh}.v3`,()=>new gh);function nEe(){let t=H();if(t)return t.getIntegrationByName(Rh)}function d$(t,e,n,r){let o=nEe()?.getShouldHandleError()||h$;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){ft&&g.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)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var m$=w(`${Rh}.v5`,()=>{let t=new _$.FastifyOtelInstrumentation,e=t.plugin();return JN.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?ft&&g.error("Failed to setup Fastify instrumentation",o):(oEe(),r&&sEe(r))})}),JN.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;d$.call(d$,r,o,s,"diagnostics-channel")}),t}),rEe=({shouldHandleError:t})=>{let e;return{name:Rh,setupOnce(){e=t||h$,f$(),m$()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},T$=(t={})=>rEe(t);function h$(t,e,n){let r=n.statusCode;return r>=500||r<=299}function E$(t){let e=Y(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[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function oEe(){let t=H();t&&t.on("spanStart",e=>{E$(e)})}function sEe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&E$(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var B$=K(G$(),1);var j$="Graphql",H$=w(j$,B$.GraphQLInstrumentation,t=>{let e=F$(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[Zc]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(Zc,p)):typeof p=="string"?c.setAttribute(Zc,[p,d]):c.setAttribute(Zc,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${OEe(p)})`)}}}}),NEe=(t={})=>({name:j$,setupOnce(){H$(F$(t))}}),V$=NEe;function F$(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function OEe(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 tY=K(eY(),1);var nY="Kafka",rY=w(nY,()=>new tY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),CEe=()=>({name:nY,setupOnce(){rY()}}),oY=CEe;var pY=K(lY(),1);var dY="LruMemoizer",_Y=w(dY,()=>new pY.LruMemoizerInstrumentation),MEe=()=>({name:dY,setupOnce(){_Y()}}),fY=MEe;var yY=K(RY(),1);var IY="Mongo",NY=w(IY,()=>new yY.MongoDBInstrumentation({dbStatementSerializer:UEe,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function UEe(t){let e=aO(t);return JSON.stringify(e)}function aO(t){if(Array.isArray(t))return t.map(e=>aO(e));if(wEe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,aO(r)]).reduce((n,r)=>(GEe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function wEe(t){return typeof t=="object"&&t!==null&&!kEe(t)}function kEe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function GEe(t){return Array.isArray(t)}var BEe=()=>({name:IY,setupOnce(){NY()}}),OY=BEe;var kY=K(wY(),1);var GY="Mongoose",BY=w(GY,()=>new kY.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),zEe=()=>({name:GY,setupOnce(){BY()}}),jY=zEe;var zY=K(WY(),1);var KY="Mysql",QY=w(KY,()=>new zY.MySQLInstrumentation({})),oSe=()=>({name:KY,setupOnce(){QY()}}),XY=oSe;var sW=K(oW(),1);var iW="Mysql2",aW=w(iW,()=>new sW.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),SSe=()=>({name:iW,setupOnce(){aW()}}),cW=SSe;var DW=K(TW(),1),UW=K(PW(),1);var GSe=["get","set","setex"],CO=["get","mget"],BSe=["set","setex"];function md(t,e){return t.includes(e.toLowerCase())}function PO(t){return md(CO,t)?"cache.get":md(BSe,t)?"cache.put":void 0}function jSe(t,e){return e.some(n=>t.startsWith(n))}function xW(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)?MW(o.map(s=>n(s))):["<unknown>"],r=e[0];return md(GSe,t)&&r!=null?n(r):MW(e.map(o=>n(o)))}catch{return}}function vW(t,e,n){if(!PO(t))return!1;for(let r of e)if(jSe(r,n))return!0;return!1}function LW(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 MW(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var sE="Redis",Td={},wW=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=xW(e,n),s=PO(e);if(!o||!s||!Td.cachePrefixes||!vW(e,o,Td.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=LW(r);c&&t.setAttribute(NR,c),md(CO,e)&&c!==void 0&&t.setAttribute(yR,c>0),t.setAttributes({[ee]:s,[IR]:o});let l=o.join(", ");t.updateName(Td.maxCacheKeyLength?ps(l,Td.maxCacheKeyLength):l)},HSe=w(`${sE}.IORedis`,()=>new DW.IORedisInstrumentation({responseHook:wW})),VSe=w(`${sE}.Redis`,()=>new UW.RedisInstrumentation({responseHook:wW})),kW=Object.assign(()=>{HSe(),VSe()},{id:sE}),FSe=(t={})=>({name:sE,setupOnce(){Td=t,kW()}}),GW=FSe;var tz=K(ez(),1);var nz="Postgres",rz=w(nz,tz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),oge=t=>({name:nz,setupOnce(){rz(t)}}),oz=oge;b();var Ks=K(ne(),1);le();var wO="PostgresJs",sz=[">=3.0.0 <4"],sge=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,ige=Symbol.for("sentry.query.from.instrumented.sql"),iz=w(wO,t=>new UO({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),UO=class extends Ks.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new Ks.InstrumentationNodeModuleDefinition("postgres",sz,n=>{try{return this._patchPostgres(n)}catch(r){return ft&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new Ks.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,sz,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 ft&&g.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return ft&&g.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return uy(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};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:(fp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(Ya,r);return}let o=n?.match(sge);o?.[1]&&e.setAttribute(Ya,o[1].toUpperCase())}_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[ige])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return yt({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[yi]:"postgres",[Hg]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,Ks.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),ft&&g.error(`Error in requestHook for ${wO} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(T){ft&&g.error("Error ending span in resolve callback:",T)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(Vg,m?.[0]?.code||"unknown"),a.setAttribute(Fg,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(T){ft&&g.error("Error ending span in reject callback:",T)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},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}},age=t=>({name:wO,setupOnce(){iz(t)}}),az=age;b();b();var LE=K(qz(),1);b();var CAe={name:"@prisma/instrumentation-contract",version:"7.6.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"}},PAe=CAe.version.split(".")[0],ib="PRISMA_INSTRUMENTATION",ab=`V${PAe}_PRISMA_INSTRUMENTATION`,Gu=globalThis;function MAe(){let t=Gu[ab];return t?.helper?t.helper:Gu[ib]?.helper}function xAe(t){let e={helper:t};Gu[ab]=e,Gu[ib]=e}function vAe(){delete Gu[ab],delete Gu[ib]}var LAe=process.env.PRISMA_SHOW_ALL_TRACES==="true",DAe="00-10-10-00";function UAe(t){switch(t){case"client":return Oe.CLIENT;case"internal":default:return Oe.INTERNAL}}var wAe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:DAe}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)Wz(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!LAe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(zz(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return $z(s,e(s,r))}return n.startActiveSpan(o,t,s=>$z(s,e(s,r)))}};function Wz(t,e,n,r,o){if(zz(e.name,o))return;let s={attributes:e.attributes,kind:UAe(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 l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)Wz(t,c,n,r,o);i.end(e.endTime)})}function $z(t,e){return kAe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function kAe(t){return t!=null&&typeof t.then=="function"}function zz(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var Kz={name:"@prisma/instrumentation",version:"7.6.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},Yz=Kz.version,GAe=Kz.name,BAe="@prisma/client",Qz=class extends LE.InstrumentationBase{tracerProvider;constructor(t={}){super(GAe,Yz,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new LE.InstrumentationNodeModuleDefinition(BAe,[Yz])]}enable(){let t=this._config;xAe(new wAe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){vAe()}isEnabled(){return MAe()!==void 0}};var Xz="Prisma";function jAe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function Jz(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var cb=class extends Qz{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=Jz();jAe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{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=HAe(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Vt.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Vt.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function HAe(t){switch(t){case"client":return Oe.CLIENT;case"internal":default:return Oe.INTERNAL}}var VAe=w(Xz,t=>new cb(t)),Zz=t=>({name:Xz,setupOnce(){VAe(t)},setup(e){Jz()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"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 uK=K(cK(),1);var lK="Hapi",pK=w(lK,()=>new uK.HapiInstrumentation),tRe=()=>({name:lK,setupOnce(){pK()}}),dK=tRe;le();var Zs={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Md={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var kE=K(ne(),1);var nRe="@sentry/instrumentation-hono",rRe="0.0.1",wE=class extends kE.InstrumentationBase{constructor(e={}){super(nRe,rRe,e)}init(){return[new kE.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 P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(xt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[Zs.HONO_TYPE]:l,[Zs.HONO_NAME]:l===Md.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[Zs.HONO_TYPE]:c,[Zs.HONO_NAME]:c===Md.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 xt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Md.MIDDLEWARE:Md.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var _K="Hono";function oRe(t){let e=Y(t).data,n=e[Zs.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[Zs.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===Jn()){ft&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[No],s=e[Ii];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var fK=w(_K,()=>new wE({responseHook:t=>{oRe(t)}})),sRe=()=>({name:_K,setupOnce(){fK()}}),mK=sRe;var bK=K(OK(),1);le();var CK="Koa",PK=w(CK,bK.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===Jn()){ft&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[No],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),fRe=(t={})=>({name:CK,setupOnce(){PK(t)}}),MK=fRe;var BK=K(GK(),1);var jK="Connect",HK=w(jK,()=>new BK.ConnectInstrumentation),IRe=()=>({name:jK,setupOnce(){HK()}}),VK=IRe;var JK=K(XK(),1);var PRe=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),ZK="Tedious",e2=w(ZK,()=>new JK.TediousInstrumentation({})),MRe=()=>{let t;return{name:ZK,setupOnce(){let e=e2();t=Tp(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";PRe.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},t2=MRe;var i2=K(s2(),1);var a2="GenericPool",c2=w(a2,()=>new i2.GenericPoolInstrumentation({})),vRe=()=>{let t;return{name:a2,setupOnce(){let e=c2();t=Tp(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},u2=vRe;var S2=K(E2(),1);var g2="Amqplib",FRe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},A2=w(g2,()=>new S2.AmqplibInstrumentation(FRe)),qRe=()=>({name:g2,setupOnce(){A2()}}),R2=qRe;var Ud="VercelAI";var eS=K(ne(),1);var $Re=[">=3.0.0 <7"],y2=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function YRe(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 WRe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(zRe(e.content),KRe(e.content))}function zRe(t){for(let e of t){if(!YRe(e))continue;let n=Py(e.toolCallId);n?wn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):wn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function KRe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&My(e.toolCallId)}function QRe(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 ZE=class t extends eS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new eS.InstrumentationNodeModuleDefinition("ai",$Re,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,l=H(),p=l?.getIntegrationByName(Ud),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=QRe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},br(()=>Reflect.apply(o,s,i),T=>{T&&typeof T=="object"&&nt(T,"_sentry_active_span",er())},()=>{},T=>{WRe(T)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of y2)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=y2.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var I2=w(Ud,()=>new ZE({}));function XRe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var JRe=(t={})=>{let e;return{name:Ud,options:t,setupOnce(){e=I2()},afterAllSetup(n){t.force??XRe(n)?dm(n):e?.callWhenPatched(()=>dm(n))}}},N2=JRe;var nS=K(ne(),1);var ZRe=[">=4.0.0 <7"],tS=class extends nS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new nS.InstrumentationNodeModuleDefinition("openai",ZRe,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(Hi(xs))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return fm(a,o)};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 O2=w(xs,t=>new tS(t)),eye=(t={})=>({name:xs,setupOnce(){O2(t)}}),b2=eye;var oS=K(ne(),1);var tye=[">=0.19.2 <1.0.0"],rS=class extends oS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new oS.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",tye,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(Hi(vs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return mm(i,r)};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 C2=w(vs,t=>new rS(t)),nye=(t={})=>({name:vs,options:t,setupOnce(){C2(t)}}),P2=nye;var Xu=K(ne(),1);var M2=[">=0.10.0 <2"],sS=class extends Xu.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new Xu.InstrumentationNodeModuleDefinition("@google/genai",M2,n=>this._patch(n),n=>n,[new Xu.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",M2,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(Hi(Ls))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Tm(i,r)};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 fp(e,"GoogleGenAI",o),e}};var x2=w(Ls,t=>new sS(t)),rye=(t={})=>({name:Ls,setupOnce(){x2(t)}}),v2=rye;var ci=K(ne(),1);var iS=[">=0.1.0 <2.0.0"];function oye(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function sye(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,l=oye(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var aS=class extends ci.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,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 ci.InstrumentationNodeModuleDefinition(r,iS,this._patch.bind(this),o=>o,[new ci.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,iS,this._patch.bind(this),o=>o)]));return e.push(new ci.InstrumentationNodeModuleDefinition("langchain",iS,this._patch.bind(this),r=>r,[new ci.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",iS,this._patch.bind(this),r=>r)])),e}_patch(e){JR([xs,vs,Ls]);let n=Em(this.getConfig());return this._patchRunnableMethods(e,n),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;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=sye(l,n))}}};var L2=w(hm,t=>new aS(t)),iye=(t={})=>({name:hm,setupOnce(){L2(t)}}),D2=iye;var Ju=K(ne(),1);var U2=[">=0.0.0 <2.0.0"],cS=class extends Ju.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new Ju.InstrumentationNodeModuleDefinition("@langchain/langgraph",U2,this._patch.bind(this),n=>n,[new Ju.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",U2,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&gm(e.StateGraph.prototype,this.getConfig()),e}};var w2=w(Sm,t=>new cS(t)),aye=(t={})=>({name:Sm,setupOnce(){w2(t)}}),k2=aye;var $2=K(ne(),1);b();var zo=K(ne(),1);le();import*as B2 from"node:net";function j2(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,zo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&Dn.error(d?.message)},!0)});let c=new zo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>G2(p,n,r,t,i)),l=["@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 p of l)c.files.push(new zo.InstrumentationNodeModuleFile(p,e,d=>G2(d,n,r,t,i),d=>H2(d,r)));return c}function G2(t,e,n,r,o){return H2(t,n),e(t,"addDoc",cye(r,o)),e(t,"getDocs",lye(r,o)),e(t,"setDoc",pye(r,o)),e(t,"deleteDoc",uye(r,o)),t}function H2(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,zo.isWrapped)(t[n])&&e(t,n);return t}function cye(t,e){return function(r){return function(o,s){let i=lS(t,"addDoc",o);return e(i),uS(i,()=>r(o,s))}}}function uye(t,e){return function(r){return function(o){let s=lS(t,"deleteDoc",o.parent||o);return e(s),uS(s,()=>r(o))}}}function lye(t,e){return function(r){return function(o){let s=lS(t,"getDocs",o);return e(s),uS(s,()=>r(o))}}}function pye(t,e){return function(r){return function(o,s,i){let a=lS(t,"setDoc",o.parent||o);return e(a),uS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function uS(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,zo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function lS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Oe.CLIENT});return _ye(r,n),r.setAttribute(Ya,e),r}function dye(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(B2.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 _ye(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[Bg]:e.path,[jg]:n.name,[yi]:"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}=dye(s);a&&(i[zg]=a),c&&(i[Kg]=c),t.setAttributes(i)}b();var Ko=K(ne(),1);function V2(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Ko.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&Dn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Ko.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&Dn.error(f?.message)},!0)});let p=new Ko.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:_,triggerType:f})=>{p.files.push(new Ko.InstrumentationNodeModuleFile(_,e,m=>fye(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>F2(m,r)))}),p}function hn(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(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Oe.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(T){f=T}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function fye(t,e,n,r,o,s){switch(F2(t,n),s){case"function":e(t,"onRequest",hn(r,o,"http.request")),e(t,"onCall",hn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",hn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",hn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",hn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",hn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",hn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",hn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",hn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",hn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",hn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",hn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",hn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",hn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",hn(r,o,"storage.object.metadataUpdated"));break}return t}function F2(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,Ko.isWrapped)(t[r])&&e(t,r);return t}var q2={},mye=[">=3.0.0 <5"],Tye=[">=6.0.0 <7"],pS=class extends $2.InstrumentationBase{constructor(e=q2){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...q2,...e})}init(){let e=[];return e.push(j2(this.tracer,mye,this._wrap,this._unwrap,this.getConfig())),e.push(V2(this.tracer,Tye,this._wrap,this._unwrap,this.getConfig())),e}};var Y2="Firebase",hye={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await Vf(2e3))}}},W2=w(Y2,()=>new pS(hye)),Eye=()=>({name:Y2,setupOnce(){W2()}}),z2=Eye;function K2(){return[HF(),T$(),V$(),mK(),OY(),jY(),XY(),cW(),GW(),oz(),Zz(),dK(),MK(),VK(),t2(),u2(),oY(),R2(),fY(),D2(),k2(),N2(),b2(),P2(),v2(),az(),z2()]}b();var dS=K(lI(),1),Q2=K(wI(),1);le();var bb=1e6;function X2(t,e={}){t.getOptions().debug&&JI();let[n,r]=Sye(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function Sye(t,e={}){let n=new Q2.BasicTracerProvider({sampler:new IT(t),resource:(0,dS.defaultResource)().merge((0,dS.resourceFromAttributes)({[Qg]:"node",[Gg]:"sentry",[Xg]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new yT({timeout:gye(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Er.setGlobalPropagator(new RT);let r=new XI;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function gye(t){if(t!=null){if(t>bb)return ft&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${bb}`),bb;if(t<=0||Number.isNaN(t)){ft&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function J2(){return vT().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(SF(),bF())}function Z2(t){return[...J2(),...Xe(t)?K2():[]]}function Cb(t={}){return Aye(t,Z2)}function Aye(t={},e){Vi(t,"node");let n=aN({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(X2(n,{spanProcessors:t.openTelemetrySpanProcessors}),cN()),n}var Rye="prod",t4="0.1.8",yye=`@tanagram/lore/${t4}`;function jt(){return Rye}function _S(){return t4}function n4(){return yye}Cb({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:jt(),release:_S(),sendDefaultPii:!0});Hf("service_name","lore-cli");import{pathToFileURL as $Ce}from"node:url";var Iye=/\d/,Nye=["-","_","/","."];function Oye(t=""){if(!Iye.test(t))return t!==t.toLowerCase()}function r4(t,e){let n=e??Nye,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=Oye(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function bye(t){return t?t[0].toUpperCase()+t.slice(1):""}function Cye(t){return t?t[0].toLowerCase()+t.slice(1):""}function Pye(t,e){return t?(Array.isArray(t)?t:r4(t)).map(n=>bye(e?.normalize?n.toLowerCase():n)).join(""):""}function wd(t,e){return Cye(Pye(t||"",e))}function fS(t,e){return t?(Array.isArray(t)?t:r4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function o4(t){return fS(t||"","_")}import{parseArgs as Mye}from"node:util";function SS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Pb(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
|
|
38
|
+
`)}function Wn(t){return typeof t=="function"?t():t}var ha=class extends Error{code;constructor(t,e){super(t),this.name="CLIError",this.code=e}};function xye(t=[],e={}){let n=new Set(e.boolean||[]),r=new Set(e.string||[]),o=e.alias||{},s=e.default||{},i=new Map,a=new Map;for(let[h,S]of Object.entries(o)){let R=S;for(let I of R)i.set(h,I),a.has(I)||a.set(I,[]),a.get(I).push(h),i.set(I,h),a.has(h)||a.set(h,[]),a.get(h).push(I)}let c={};function l(h){if(n.has(h))return"boolean";let S=a.get(h)||[];for(let R of S)if(n.has(R))return"boolean";return"string"}function p(h){if(r.has(h))return!0;let S=a.get(h)||[];for(let R of S)if(r.has(R))return!0;return!1}let d=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(s)]);for(let h of d)c[h]||(c[h]={type:l(h),default:s[h]});for(let[h,S]of i.entries())h.length===1&&c[S]&&!c[S].short&&(c[S].short=h);let _=[],f={};for(let h=0;h<t.length;h++){let S=t[h];if(S==="--"){_.push(...t.slice(h));break}if(S.startsWith("--no-")){let R=S.slice(5);f[R]=!0;continue}_.push(S)}let m;try{m=Mye({args:_,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:_}}let T={_:[]};T._=m.positionals;for(let[h,S]of Object.entries(m.values)){let R=S;l(h)==="boolean"&&typeof S=="string"?R=S!=="false":p(h)&&typeof S=="boolean"&&(R=""),T[h]=R}for(let[h]of Object.entries(f)){T[h]=!1;let S=i.get(h);S&&(T[S]=!1);let R=a.get(h);if(R)for(let I of R)T[I]=!1}for(let[h,S]of i.entries())T[h]!==void 0&&T[S]===void 0&&(T[S]=T[h]),T[S]!==void 0&&T[h]===void 0&&(T[h]=T[S]),T[h]!==T[S]&&s[S]===T[S]&&(T[S]=T[h]);return T}var vye=(()=>{let t=globalThis.process?.env??{};return t.NO_COLOR==="1"||t.TERM==="dumb"||t.TEST||t.CI})(),gS=(t,e=39)=>n=>vye?n:`\x1B[${t}m${n}\x1B[${e}m`,mS=gS(1,22),Ur=gS(36),hS=gS(90),TS=gS(4,24);function Lye(t,e){let n={boolean:[],string:[],alias:{},default:{}},r=a4(e);for(let a of r){if(a.type==="positional")continue;a.type==="string"||a.type==="enum"?n.string.push(a.name):a.type==="boolean"&&n.boolean.push(a.name),a.default!==void 0&&(n.default[a.name]=a.default),a.alias&&(n.alias[a.name]=a.alias);let c=wd(a.name),l=fS(a.name);if(c!==a.name||l!==a.name){let p=SS(n.alias[a.name]||[]);c!==a.name&&!p.includes(c)&&p.push(c),l!==a.name&&!p.includes(l)&&p.push(l),p.length>0&&(n.alias[a.name]=p)}}let o=xye(t,n),[...s]=o._,i=new Proxy(o,{get(a,c){return a[c]??a[wd(c)]??a[fS(c)]}});for(let[,a]of r.entries())if(a.type==="positional"){let c=s.shift();if(c!==void 0)i[a.name]=c;else{if(a.default===void 0&&a.required!==!1)throw new ha(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");i[a.name]=a.default}}else if(a.type==="enum"){let c=i[a.name],l=a.options||[];if(c!==void 0&&l.length>0&&!l.includes(c))throw new ha(`Invalid value for argument: ${Ur(`--${a.name}`)} (${Ur(c)}). Expected one of: ${l.map(p=>Ur(p)).join(", ")}.`,"EARG")}else if(a.required&&i[a.name]===void 0)throw new ha(`Missing required argument: --${a.name}`,"EARG");return i}function a4(t){let e=[];for(let[n,r]of Object.entries(t||{}))e.push({...r,name:n,alias:SS(r.alias)});return e}async function Dye(t){return Promise.all(t.map(e=>Wn(e)))}async function ES(t,e){let n=await Wn(t.args||{}),r=Lye(e.rawArgs,n),o={rawArgs:e.rawArgs,args:r,data:e.data,cmd:t},s=await Dye(t.plugins??[]),i,a;try{for(let p of s)await p.setup?.(o);typeof t.setup=="function"&&await t.setup(o);let l=await Wn(t.subCommands);if(l&&Object.keys(l).length>0){let p=Uye(e.rawArgs,n),d=e.rawArgs[p];if(d){let _=await s4(l,d);if(!_)throw new ha(`Unknown command ${Ur(d)}`,"E_UNKNOWN_COMMAND");await ES(_,{rawArgs:e.rawArgs.slice(p+1)})}else{let _=await Wn(t.default);if(_){if(t.run)throw new ha("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let f=await s4(l,_);if(!f)throw new ha(`Default sub command ${Ur(_)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await ES(f,{rawArgs:e.rawArgs})}else if(!t.run)throw new ha("No command specified.","E_NO_COMMAND")}}typeof t.run=="function"&&(i=await t.run(o))}catch(l){a=l}let c=[];if(typeof t.cleanup=="function")try{await t.cleanup(o)}catch(l){c.push(l)}for(let l of[...s].reverse())try{await l.cleanup?.(o)}catch(p){c.push(p)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw new Error("Multiple cleanup errors",{cause:c});return{result:i}}async function s4(t,e){if(e in t)return Wn(t[e]);for(let n of Object.values(t)){let r=await Wn(n),o=await Wn(r?.meta);if(o?.alias&&SS(o.alias).includes(e))return r}}function Uye(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&wye(r,e)&&n++;continue}return n}return-1}function wye(t,e){let n=t.replace(/^-{1,2}/,""),r=wd(n);for(let[o,s]of Object.entries(e))if(!(s.type!=="string"&&s.type!=="enum")&&(r===wd(o)||(Array.isArray(s.alias)?s.alias:s.alias?[s.alias]:[]).includes(n)))return!0;return!1}var kye=/^no[-A-Z]/;async function c4(t,e){let n=await Wn(t.meta||{}),r=a4(await Wn(t.args||{})),o=await Wn(e?.meta||{}),s=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),i=[],a=[],c=[],l=[];for(let f of r)if(f.type==="positional"){let m=f.name.toUpperCase(),T=f.required!==!1&&f.default===void 0;a.push([Ur(m+Mb(f)),i4(f,T)]),l.push(T?`<${m}>`:`[${m}]`)}else{let m=f.required===!0&&f.default===void 0,T=[...(f.alias||[]).map(h=>`-${h}`),`--${f.name}`].join(", ")+Mb(f);if(i.push([Ur(T),i4(f,m)]),f.type==="boolean"&&(f.default===!0||f.negativeDescription)&&!kye.test(f.name)){let h=[...(f.alias||[]).map(S=>`--no-${S}`),`--no-${f.name}`].join(", ");i.push([Ur(h),[f.negativeDescription,m?hS("(Required)"):""].filter(Boolean).join(" ")])}m&&l.push(`--${f.name}`+Mb(f))}if(t.subCommands){let f=[],m=await Wn(t.subCommands);for(let[T,h]of Object.entries(m)){let S=await Wn((await Wn(h))?.meta);if(S?.hidden)continue;let R=SS(S?.alias),I=[T,...R].join(", ");c.push([Ur(I),S?.description||""]),f.push(T,...R)}l.push(f.join("|"))}let p=[],d=n.version||o.version;p.push(hS(`${n.description} (${s+(d?` v${d}`:"")})`),"");let _=i.length>0||a.length>0;return p.push(`${TS(mS("USAGE"))} ${Ur(`${s}${_?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(p.push(TS(mS("ARGUMENTS")),""),p.push(Pb(a," ")),p.push("")),i.length>0&&(p.push(TS(mS("OPTIONS")),""),p.push(Pb(i," ")),p.push("")),c.length>0&&(p.push(TS(mS("COMMANDS")),""),p.push(Pb(c," ")),p.push("",`Use ${Ur(`${s} <command> --help`)} for more information about a command.`)),p.filter(f=>typeof f=="string").join(`
|
|
39
|
+
`)}function Mb(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${o4(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function i4(t,e){let n=e?hS("(Required)"):"",r=t.default===void 0?"":hS(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}var u={};US(u,{BRAND:()=>uIe,DIRTY:()=>Ea,EMPTY_PATH:()=>Hye,INVALID:()=>Q,NEVER:()=>WIe,OK:()=>Zt,ParseStatus:()=>Ht,Schema:()=>ce,ZodAny:()=>pi,ZodArray:()=>Zo,ZodBigInt:()=>ga,ZodBoolean:()=>Aa,ZodBranded:()=>Gd,ZodCatch:()=>va,ZodDate:()=>Ra,ZodDefault:()=>xa,ZodDiscriminatedUnion:()=>yS,ZodEffects:()=>hr,ZodEnum:()=>Pa,ZodError:()=>Mn,ZodFirstPartyTypeKind:()=>Z,ZodFunction:()=>NS,ZodIntersection:()=>Oa,ZodIssueCode:()=>O,ZodLazy:()=>ba,ZodLiteral:()=>Ca,ZodMap:()=>ol,ZodNaN:()=>il,ZodNativeEnum:()=>Ma,ZodNever:()=>wr,ZodNull:()=>Ia,ZodNullable:()=>Eo,ZodNumber:()=>Sa,ZodObject:()=>xn,ZodOptional:()=>mr,ZodParsedType:()=>D,ZodPipeline:()=>Bd,ZodPromise:()=>di,ZodReadonly:()=>La,ZodRecord:()=>IS,ZodSchema:()=>ce,ZodSet:()=>sl,ZodString:()=>li,ZodSymbol:()=>nl,ZodTransformer:()=>hr,ZodTuple:()=>ho,ZodType:()=>ce,ZodUndefined:()=>ya,ZodUnion:()=>Na,ZodUnknown:()=>Jo,ZodVoid:()=>rl,addIssueToContext:()=>M,any:()=>EIe,array:()=>RIe,bigint:()=>_Ie,boolean:()=>S4,coerce:()=>YIe,custom:()=>T4,date:()=>fIe,datetimeRegex:()=>f4,defaultErrorMap:()=>Qo,discriminatedUnion:()=>OIe,effect:()=>GIe,enum:()=>UIe,function:()=>vIe,getErrorMap:()=>Zu,getParsedType:()=>To,instanceof:()=>pIe,intersection:()=>bIe,isAborted:()=>AS,isAsync:()=>el,isDirty:()=>RS,isValid:()=>ui,late:()=>lIe,lazy:()=>LIe,literal:()=>DIe,makeIssue:()=>kd,map:()=>MIe,nan:()=>dIe,nativeEnum:()=>wIe,never:()=>gIe,null:()=>hIe,nullable:()=>jIe,number:()=>E4,object:()=>yIe,objectUtil:()=>xb,oboolean:()=>$Ie,onumber:()=>qIe,optional:()=>BIe,ostring:()=>FIe,pipeline:()=>VIe,preprocess:()=>HIe,promise:()=>kIe,quotelessJson:()=>Gye,record:()=>PIe,set:()=>xIe,setErrorMap:()=>jye,strictObject:()=>IIe,string:()=>h4,symbol:()=>mIe,transformer:()=>GIe,tuple:()=>CIe,undefined:()=>TIe,union:()=>NIe,unknown:()=>SIe,util:()=>de,void:()=>AIe});var de;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(de||(de={}));var xb;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(xb||(xb={}));var D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),To=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}};var O=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Gye=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Mn.create=t=>new Mn(t);var Bye=(t,e)=>{let n;switch(t.code){case O.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case O.invalid_union:n="Invalid input";break;case O.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case O.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:n="Invalid function arguments";break;case O.invalid_return_type:n="Invalid function return type";break;case O.invalid_date:n="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case O.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case O.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case O.custom:n="Invalid input";break;case O.invalid_intersection_types:n="Intersection results could not be merged";break;case O.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}},Qo=Bye;var u4=Qo;function jye(t){u4=t}function Zu(){return u4}var kd=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)a=l(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},Hye=[];function M(t,e){let n=Zu(),r=kd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Qo?void 0:Qo].filter(o=>!!o)});t.common.issues.push(r)}var Ht=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),Ea=t=>({status:"dirty",value:t}),Zt=t=>({status:"valid",value:t}),AS=t=>t.status==="aborted",RS=t=>t.status==="dirty",ui=t=>t.status==="valid",el=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));var Tr=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},l4=(t,e)=>{if(ui(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Mn(t.common.issues);return this._error=n,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:o}}var ce=class{get description(){return this._def.description}_getType(e){return To(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:To(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ht,ctx:{common:e.parent.common,data:e.data,parsedType:To(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(el(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:To(e)},o=this._parseSync({data:e,path:r.path,parent:r});return l4(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:To(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return ui(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>ui(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:To(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(el(o)?o:Promise.resolve(o));return l4(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:O.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new hr({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return mr.create(this,this._def)}nullable(){return Eo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zo.create(this)}promise(){return di.create(this,this._def)}or(e){return Na.create([this,e],this._def)}and(e){return Oa.create(this,e,this._def)}transform(e){return new hr({...ie(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new xa({...ie(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new Gd({typeName:Z.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new va({...ie(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Bd.create(this,e)}readonly(){return La.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Vye=/^c[^\s-]{8,}$/i,Fye=/^[0-9a-z]+$/,qye=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$ye=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Yye=/^[a-z0-9_-]{21}$/i,Wye=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zye=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kye=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qye="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vb,Xye=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Jye=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Zye=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,eIe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tIe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nIe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d4="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rIe=new RegExp(`^${d4}$`);function _4(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function oIe(t){return new RegExp(`^${_4(t)}$`)}function f4(t){let e=`${d4}T${_4(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function sIe(t,e){return!!((e==="v4"||!e)&&Xye.test(t)||(e==="v6"||!e)&&Zye.test(t))}function iIe(t,e){if(!Wye.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function aIe(t,e){return!!((e==="v4"||!e)&&Jye.test(t)||(e==="v6"||!e)&&eIe.test(t))}var li=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_type,expected:D.string,received:s.parsedType}),Q}let r=new Ht,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?M(o,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&M(o,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Kye.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"email",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")vb||(vb=new RegExp(Qye,"u")),vb.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"emoji",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")$ye.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"uuid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Yye.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"nanoid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Vye.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Fye.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid2",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")qye.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ulid",code:O.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),M(o,{validation:"url",code:O.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"regex",code:O.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?f4(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?rIe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?oIe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:O.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?zye.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"duration",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?sIe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ip",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?iIe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"jwt",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?aIe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cidr",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?tIe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64",code:O.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?nIe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64url",code:O.invalid_string,message:s.message}),r.dirty()):de.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:O.invalid_string,...j.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...j.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};li.create=t=>new li({checks:[],typeName:Z.ZodString,coerce:t?.coerce??!1,...ie(t)});function cIe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Sa=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_type,expected:D.number,received:s.parsedType}),Q}let r,o=new Ht;for(let s of this._def.checks)s.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:O.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?cIe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:O.not_finite,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&de.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Sa.create=t=>new Sa({checks:[],typeName:Z.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var ga=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r,o=new Ht;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),M(r,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return M(n,{code:O.invalid_type,expected:D.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ga.create=t=>new ga({checks:[],typeName:Z.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Aa=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.boolean,received:r.parsedType}),Q}return Zt(e.data)}};Aa.create=t=>new Aa({typeName:Z.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var Ra=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_type,expected:D.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return M(s,{code:O.invalid_date}),Q}let r=new Ht,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:O.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):de.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Ra.create=t=>new Ra({checks:[],coerce:t?.coerce||!1,typeName:Z.ZodDate,...ie(t)});var nl=class extends ce{_parse(e){if(this._getType(e)!==D.symbol){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.symbol,received:r.parsedType}),Q}return Zt(e.data)}};nl.create=t=>new nl({typeName:Z.ZodSymbol,...ie(t)});var ya=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.undefined,received:r.parsedType}),Q}return Zt(e.data)}};ya.create=t=>new ya({typeName:Z.ZodUndefined,...ie(t)});var Ia=class extends ce{_parse(e){if(this._getType(e)!==D.null){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.null,received:r.parsedType}),Q}return Zt(e.data)}};Ia.create=t=>new Ia({typeName:Z.ZodNull,...ie(t)});var pi=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Zt(e.data)}};pi.create=t=>new pi({typeName:Z.ZodAny,...ie(t)});var Jo=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zt(e.data)}};Jo.create=t=>new Jo({typeName:Z.ZodUnknown,...ie(t)});var wr=class extends ce{_parse(e){let n=this._getOrReturnCtx(e);return M(n,{code:O.invalid_type,expected:D.never,received:n.parsedType}),Q}};wr.create=t=>new wr({typeName:Z.ZodNever,...ie(t)});var rl=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.void,received:r.parsedType}),Q}return Zt(e.data)}};rl.create=t=>new rl({typeName:Z.ZodVoid,...ie(t)});var Zo=class t extends ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==D.array)return M(n,{code:O.invalid_type,expected:D.array,received:n.parsedType}),Q;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(M(n,{code:i?O.too_big:O.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(M(n,{code:O.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(M(n,{code:O.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Tr(n,i,n.path,a)))).then(i=>Ht.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Tr(n,i,n.path,a)));return Ht.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};Zo.create=(t,e)=>new Zo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ie(e)});function tl(t){if(t instanceof xn){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=mr.create(tl(r))}return new xn({...t._def,shape:()=>e})}else return t instanceof Zo?new Zo({...t._def,type:tl(t.element)}):t instanceof mr?mr.create(tl(t.unwrap())):t instanceof Eo?Eo.create(tl(t.unwrap())):t instanceof ho?ho.create(t.items.map(e=>tl(e))):t}var xn=class t extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){let l=this._getOrReturnCtx(e);return M(l,{code:O.invalid_type,expected:D.object,received:l.parsedType}),Q}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof wr&&this._def.unknownKeys==="strip"))for(let l in o.data)i.includes(l)||a.push(l);let c=[];for(let l of i){let p=s[l],d=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new Tr(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof wr){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&(M(o,{code:O.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let d=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new Tr(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let d=await p.key,_=await p.value;l.push({key:d,value:_,alwaysSet:p.alwaysSet})}return l}).then(l=>Ht.mergeObjectSync(r,l)):Ht.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return tl(this)}partial(e){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof mr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return m4(de.objectKeys(this.shape))}};xn.create=(t,e)=>new xn({shape:()=>t,unknownKeys:"strip",catchall:wr.create(),typeName:Z.ZodObject,...ie(e)});xn.strictCreate=(t,e)=>new xn({shape:()=>t,unknownKeys:"strict",catchall:wr.create(),typeName:Z.ZodObject,...ie(e)});xn.lazycreate=(t,e)=>new xn({shape:t,unknownKeys:"strip",catchall:wr.create(),typeName:Z.ZodObject,...ie(e)});var Na=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Mn(a.ctx.common.issues));return M(n,{code:O.invalid_union,unionErrors:i}),Q}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=c._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new Mn(c));return M(n,{code:O.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};Na.create=(t,e)=>new Na({options:t,typeName:Z.ZodUnion,...ie(e)});var Xo=t=>t instanceof ba?Xo(t.schema):t instanceof hr?Xo(t.innerType()):t instanceof Ca?[t.value]:t instanceof Pa?t.options:t instanceof Ma?de.objectValues(t.enum):t instanceof xa?Xo(t._def.innerType):t instanceof ya?[void 0]:t instanceof Ia?[null]:t instanceof mr?[void 0,...Xo(t.unwrap())]:t instanceof Eo?[null,...Xo(t.unwrap())]:t instanceof Gd||t instanceof La?Xo(t.unwrap()):t instanceof va?Xo(t._def.innerType):[],yS=class t extends ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return M(n,{code:O.invalid_type,expected:D.object,received:n.parsedType}),Q;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(M(n,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=Xo(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ie(r)})}};function Lb(t,e){let n=To(t),r=To(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){let o=de.objectKeys(e),s=de.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=Lb(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=Lb(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Oa=class extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(AS(s)||AS(i))return Q;let a=Lb(s.value,i.value);return a.valid?((RS(s)||RS(i))&&n.dirty(),{status:n.value,value:a.data}):(M(r,{code:O.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Oa.create=(t,e,n)=>new Oa({left:t,right:e,typeName:Z.ZodIntersection,...ie(n)});var ho=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return M(r,{code:O.invalid_type,expected:D.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return M(r,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(M(r,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Tr(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ht.mergeArray(n,i)):Ht.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ho.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ho({items:t,typeName:Z.ZodTuple,rest:null,...ie(e)})};var IS=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return M(r,{code:O.invalid_type,expected:D.object,received:r.parsedType}),Q;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Tr(r,a,r.path,a)),value:i._parse(new Tr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ht.mergeObjectAsync(n,o):Ht.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ce?new t({keyType:e,valueType:n,typeName:Z.ZodRecord,...ie(r)}):new t({keyType:li.create(),valueType:e,typeName:Z.ZodRecord,...ie(n)})}},ol=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return M(r,{code:O.invalid_type,expected:D.map,received:r.parsedType}),Q;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],l)=>({key:o._parse(new Tr(r,a,r.path,[l,"key"])),value:s._parse(new Tr(r,c,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of i){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}}}};ol.create=(t,e,n)=>new ol({valueType:e,keyType:t,typeName:Z.ZodMap,...ie(n)});var sl=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return M(r,{code:O.invalid_type,expected:D.set,received:r.parsedType}),Q;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(M(r,{code:O.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(M(r,{code:O.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(c){let l=new Set;for(let p of c){if(p.status==="aborted")return Q;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let a=[...r.data.values()].map((c,l)=>s._parse(new Tr(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};sl.create=(t,e)=>new sl({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,...ie(e)});var NS=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.function)return M(n,{code:O.invalid_type,expected:D.function,received:n.parsedType}),Q;function r(a,c){return kd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Zu(),Qo].filter(l=>!!l),issueData:{code:O.invalid_arguments,argumentsError:c}})}function o(a,c){return kd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Zu(),Qo].filter(l=>!!l),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof di){let a=this;return Zt(async function(...c){let l=new Mn([]),p=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(r(c,f)),l}),d=await Reflect.apply(i,this,p);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(o(d,f)),l})})}else{let a=this;return Zt(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new Mn([r(c,l.error)]);let p=Reflect.apply(i,this,l.data),d=a._def.returns.safeParse(p,s);if(!d.success)throw new Mn([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ho.create(e).rest(Jo.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||ho.create([]).rest(Jo.create()),returns:n||Jo.create(),typeName:Z.ZodFunction,...ie(r)})}},ba=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ba.create=(t,e)=>new ba({getter:t,typeName:Z.ZodLazy,...ie(e)});var Ca=class extends ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return M(n,{received:n.data,code:O.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ca.create=(t,e)=>new Ca({value:t,typeName:Z.ZodLiteral,...ie(e)});function m4(t,e){return new Pa({values:t,typeName:Z.ZodEnum,...ie(e)})}var Pa=class t extends ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{expected:de.joinValues(r),received:n.parsedType,code:O.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{received:n.data,code:O.invalid_enum_value,options:r}),Q}return Zt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Pa.create=m4;var Ma=class extends ce{_parse(e){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){let o=de.objectValues(n);return M(r,{expected:de.joinValues(o),received:r.parsedType,code:O.invalid_type}),Q}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=de.objectValues(n);return M(r,{received:r.data,code:O.invalid_enum_value,options:o}),Q}return Zt(e.data)}get enum(){return this._def.values}};Ma.create=(t,e)=>new Ma({values:t,typeName:Z.ZodNativeEnum,...ie(e)});var di=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return M(n,{code:O.invalid_type,expected:D.promise,received:n.parsedType}),Q;let r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return Zt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};di.create=(t,e)=>new di({type:t,typeName:Z.ZodPromise,...ie(e)});var hr=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{M(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?Ea(c.value):n.value==="dirty"?Ea(c.value):c});{if(n.value==="aborted")return Q;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?Ea(a.value):n.value==="dirty"?Ea(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ui(i))return Q;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>ui(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Q);de.assertNever(o)}};hr.create=(t,e,n)=>new hr({schema:t,typeName:Z.ZodEffects,effect:e,...ie(n)});hr.createWithPreprocess=(t,e,n)=>new hr({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,...ie(n)});var mr=class extends ce{_parse(e){return this._getType(e)===D.undefined?Zt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};mr.create=(t,e)=>new mr({innerType:t,typeName:Z.ZodOptional,...ie(e)});var Eo=class extends ce{_parse(e){return this._getType(e)===D.null?Zt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Eo.create=(t,e)=>new Eo({innerType:t,typeName:Z.ZodNullable,...ie(e)});var xa=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xa.create=(t,e)=>new xa({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var va=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return el(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Mn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};va.create=(t,e)=>new va({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var il=class extends ce{_parse(e){if(this._getType(e)!==D.nan){let r=this._getOrReturnCtx(e);return M(r,{code:O.invalid_type,expected:D.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};il.create=t=>new il({typeName:Z.ZodNaN,...ie(t)});var uIe=Symbol("zod_brand"),Gd=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Bd=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?(n.dirty(),Ea(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Z.ZodPipeline})}},La=class extends ce{_parse(e){let n=this._def.innerType._parse(e),r=o=>(ui(o)&&(o.value=Object.freeze(o.value)),o);return el(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};La.create=(t,e)=>new La({innerType:t,typeName:Z.ZodReadonly,...ie(e)});function p4(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function T4(t,e={},n){return t?pi.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=p4(e,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=p4(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):pi.create()}var lIe={object:xn.lazycreate},Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));var pIe=(t,e={message:`Input not instance of ${t.name}`})=>T4(n=>n instanceof t,e),h4=li.create,E4=Sa.create,dIe=il.create,_Ie=ga.create,S4=Aa.create,fIe=Ra.create,mIe=nl.create,TIe=ya.create,hIe=Ia.create,EIe=pi.create,SIe=Jo.create,gIe=wr.create,AIe=rl.create,RIe=Zo.create,yIe=xn.create,IIe=xn.strictCreate,NIe=Na.create,OIe=yS.create,bIe=Oa.create,CIe=ho.create,PIe=IS.create,MIe=ol.create,xIe=sl.create,vIe=NS.create,LIe=ba.create,DIe=Ca.create,UIe=Pa.create,wIe=Ma.create,kIe=di.create,GIe=hr.create,BIe=mr.create,jIe=Eo.create,HIe=hr.createWithPreprocess,VIe=Bd.create,FIe=()=>h4().optional(),qIe=()=>E4().optional(),$Ie=()=>S4().optional(),YIe={string:t=>li.create({...t,coerce:!0}),number:t=>Sa.create({...t,coerce:!0}),boolean:t=>Aa.create({...t,coerce:!0}),bigint:t=>ga.create({...t,coerce:!0}),date:t=>Ra.create({...t,coerce:!0})};var WIe=Q;var zIe=t=>typeof t?.safeParse=="function";var Db=t=>typeof t?.passthrough=="function";var KIe=(t,e)=>Db(t)?Db(e)?t.merge(e):t:Db(e)?e:Object.assign({},t,e);var X9e=u.object({name:u.literal("ZodError"),issues:u.array(u.object({path:u.array(u.union([u.string(),u.number()])),message:u.string().optional(),code:u.nativeEnum(u.ZodIssueCode)}).catchall(u.any()))}),QIe=Symbol("ContractNoBody"),A4=t=>"method"in t&&"path"in t;var R4=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return A4(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:KIe(e?.baseHeaders,r.headers),strictStatusCodes:(o=r.strictStatusCodes)!==null&&o!==void 0?o:e?.strictStatusCodes,validateResponseOnClient:(s=r.validateResponseOnClient)!==null&&s!==void 0?s:e?.validateResponseOnClient,responses:{...e?.commonResponses,...r.responses},metadata:e?.metadata?{...e?.metadata,...(i=r.metadata)!==null&&i!==void 0?i:{}}:r.metadata}]:[n,R4(r,e)]})),Ub=Symbol("ContractPlainType"),So=()=>({router:(t,e)=>R4(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>Ub,body:()=>Ub,type:()=>Ub,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>QIe}),XIe=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},JIe=(t,e=!1)=>{let n=e?ZIe(t):eNe(t);return n?.length>0?"?"+n:""},ZIe=t=>t?Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>{let r;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?r=n:r=JSON.stringify(n),`${encodeURIComponent(e)}=${encodeURIComponent(r)}`}).join("&"):"",eNe=t=>t?Object.keys(t).flatMap(e=>wb(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",wb=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>wb(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>wb(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var kb=class extends Error{constructor(e,n){let r=n.join(",");super(`Server returned unexpected response. Expected one of: ${r} got: ${e.status}`),this.response=e}};var tNe=async({route:t,path:e,method:n,headers:r,body:o,validateResponse:s,fetchOptions:i})=>{let a=await fetch(e,{...i,method:n,headers:r,body:o}),c=a.headers.get("content-type");if(c?.includes("application/")&&c?.includes("json")){let l={status:a.status,body:await a.json(),headers:a.headers},p=t.responses[l.status];return(s??t.validateResponseOnClient)&&zIe(p)?{...l,body:p.parse(l.body)}:l}return c?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},nNe=t=>{let e=new FormData,n=(r,o)=>{o instanceof File?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t).forEach(([r,o])=>{if(Array.isArray(o))for(let s of o)n(r,s);else n(r,o)}),e},g4=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),rNe=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:c}=t,l=n.api||tNe,p=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([f,m])=>typeof m=="function"?[f,m(t)]:[f,m])),d={...p&&g4(p),...g4(a)};Object.keys(d).forEach(f=>{d[f]===void 0&&delete d[f]});let _={route:r,path:e,method:r.method,headers:d,body:void 0,rawBody:o,rawQuery:s,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...c},...c?.signal&&{signal:c.signal},...c?.cache&&{cache:c.cache},...c&&"next"in c&&!!c?.next&&{next:c.next}};return r.method!=="GET"&&("contentType"in r&&r.contentType==="multipart/form-data"?_={..._,contentType:"multipart/form-data",body:o instanceof FormData?o:nNe(o)}:"contentType"in r&&r.contentType==="application/x-www-form-urlencoded"?_={..._,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",..._.headers},body:typeof o=="string"?o:new URLSearchParams(o)}:o!=null&&(_={..._,contentType:"application/json",headers:{"content-type":"application/json",..._.headers},body:JSON.stringify(o)})),l({..._,...i})},oNe=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:c,fetchOptions:l,cache:p,next:d,..._}=n||{},f={...e,...c};return{path:sNe(r,f.baseUrl,o,t,!!f.jsonQuery),clientArgs:f,route:t,body:s,query:r,extraInputArgs:_,fetchOptions:{...p&&{cache:p},...d&&{next:d},...l},headers:{...a,...i}}},sNe=(t,e,n,r,o)=>{let s=XIe({path:r.path,params:n}),i=JIe(t,o);return`${e}${s}${i}`},iNe=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=oNe(t,e,r),s=await rNe(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new kb(s,n)}},Gb=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>A4(r)?[n,iNe(r,e)]:[n,Gb(r,e)]));var Bb=["free","creator","team"],y4=typeof process<"u"&&process.env?.NODE_ENV!=="production",aNe={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:y4?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:y4?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var I4=aNe.stripe.plans,Z9e=Object.freeze(Object.fromEntries(I4.map(t=>[t.tier,t])));var cNe=So(),en=u.object({message:u.string()}),jb=u.record(u.unknown()),Da=u.string().regex(/^doc_[0-9A-Za-z]{22}$/),OS=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),uNe=["active","archived"],bS=u.enum(uNe),N4=u.object({id:u.string().min(1),display_name:u.string().min(1)}),O4=u.object({id:OS,name:u.string().min(1)}),Hb=u.object({id:Da,title:u.string().min(1),status:bS,author:N4,project:O4.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),lNe=u.object({type:u.literal("list"),list_type:u.literal("doc"),objects:u.array(Hb)}),pNe=u.object({project_id:OS.optional(),status:bS.optional()}),dNe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:jb.optional(),project_id:OS.nullable().optional()}),_Ne=u.object({id:Da,created_at:u.string().datetime()}),fNe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:jb.optional(),project_id:OS.nullable().optional(),status:bS.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),mNe=u.object({id:Da,updated_at:u.string().datetime()}),TNe=u.object({id:Da,title:u.string().min(1),prosemirror_json:jb,status:bS,author:N4,project:O4.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),b4=cNe.router({listDocs:{method:"GET",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),query:pNe,responses:{200:lNe,401:en,403:en},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),body:dNe,responses:{201:_Ne,401:en,403:en,404:en,422:en},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:u.object({docId:Da}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:TNe,401:en,403:en,404:en},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:u.object({docId:Da}),headers:u.object({authorization:u.string().min(1).optional()}),body:fNe,responses:{200:mNe,401:en,403:en,404:en,422:en},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:u.object({docId:Da}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:en,403:en,404:en},summary:"Hard-delete a doc and any mention references it owns"}});var hNe=So(),et=u.object({message:u.string()}),Vb=u.record(u.unknown()),go=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),ENe=["active","archived"],CS=u.enum(ENe),Fb=u.object({id:u.string().min(1),display_name:u.string().min(1)}),C4=u.object({thread_id:u.string().min(1),title:u.string().min(1),added_at:u.string().datetime(),added_by:Fb}),SNe=u.object({id:go,name:u.string().min(1),status:CS,author:Fb,thread_count:u.number().int().nonnegative(),doc_count:u.number().int().nonnegative(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),gNe=u.object({type:u.literal("list"),list_type:u.literal("project"),objects:u.array(SNe)}),ANe=u.object({status:CS.optional()}),RNe=u.object({name:u.string().trim().min(1).max(200),prosemirror_json:Vb.optional()}),yNe=u.object({id:go,created_at:u.string().datetime()}),INe=u.object({name:u.string().trim().min(1).max(200).optional(),prosemirror_json:Vb.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),NNe=u.object({id:go,updated_at:u.string().datetime()}),ONe=u.object({archived:u.boolean()}),bNe=u.object({id:go,status:CS,archived_at:u.string().datetime().nullable()}),CNe=u.object({id:go,name:u.string().min(1),prosemirror_json:Vb,status:CS,author:Fb,created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable(),threads:u.array(C4),docs:u.array(Hb)}),PNe=u.object({thread_id:u.string().min(1).max(64)}),MNe=C4,P4=hNe.router({listProjects:{method:"GET",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),query:ANe,responses:{200:gNe,401:et},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),body:RNe,responses:{201:yNe,401:et,422:et},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:u.object({projectId:go}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:CNe,401:et,403:et,404:et},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:u.object({projectId:go}),headers:u.object({authorization:u.string().min(1).optional()}),body:INe,responses:{200:NNe,401:et,403:et,404:et,422:et},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:u.object({projectId:go}),headers:u.object({authorization:u.string().min(1).optional()}),body:ONe,responses:{200:bNe,401:et,403:et,404:et},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:u.object({projectId:go}),headers:u.object({authorization:u.string().min(1).optional()}),body:PNe,responses:{201:MNe,401:et,403:et,404:et,409:et,422:et},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:u.object({projectId:go,threadId:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:et,403:et,404:et},summary:"Remove a thread membership from a project"}});var xNe=So(),PS=u.object({message:u.string()}),vNe=["thread","plan","doc","user"],MS=u.enum(vNe),LNe=["doc","project"],DNe=u.enum(LNe),UNe=u.object({kind:MS,id:u.string().min(1),title:u.string().min(1),href:u.string().min(1)}),wNe=u.object({type:u.literal("list"),list_type:u.literal("mention"),objects:u.array(UNe)}),kNe=u.object({q:u.string().trim().min(1).max(50),kinds:u.string().optional().transform(t=>{if(!t)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e:void 0}).pipe(u.array(MS).optional())}),GNe=u.object({source_kind:DNe,source_id:u.string().min(1),source_title:u.string().min(1),source_href:u.string().min(1),target_kind:MS,target_id:u.string().min(1),created_at:u.string().datetime()}),BNe=u.object({type:u.literal("list"),list_type:u.literal("backlink"),objects:u.array(GNe)}),jNe=u.object({target_kind:MS,target_id:u.string().min(1).max(64)}),M4=xNe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:u.object({authorization:u.string().min(1).optional()}),query:kNe,responses:{200:wNe,401:PS,422:PS},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:u.object({authorization:u.string().min(1).optional()}),query:jNe,responses:{200:BNe,401:PS,403:PS},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var HNe=So(),VNe=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(u.unknown())}),_i=u.object({message:u.string()}),x4=u.object({thread_id:u.string().min(1),is_favorited:u.boolean(),favorited_at:u.string().datetime().nullable()}),FNe=u.object({before:u.string().min(1).max(64).optional()}),v4=HNe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:x4,401:_i,403:_i,404:_i},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:x4,401:_i,403:_i,404:_i},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:FNe,responses:{200:VNe,401:_i,403:_i},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var qNe=So(),$Ne=u.object({id:u.string().uuid(),role:u.enum(["user","assistant"]),content:u.string().min(1),timestamp:u.string().datetime()}),YNe=u.object({id:u.string().uuid(),title:u.string().min(1),author:u.string().min(1),authorAvatar:u.string().min(1).max(4),model:u.string().min(1),turnCount:u.number().int().nonnegative(),createdAt:u.string().datetime(),preview:u.string()}),vQe=YNe.extend({messages:u.array($Ne)}),A=u.object({message:u.string()}),WNe=/^[a-zA-Z0-9_-]{2,32}$/,j4=u.string().regex(WNe,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),qb=u.object({id:u.string(),first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().nullable(),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),share_new_threads_to_workspace:u.boolean(),experimental_features_enabled:u.boolean(),onboarded_at:u.string().nullable()}),zNe=u.object({stytchMemberId:u.string().min(1).optional(),emailAddress:u.string().email(),name:u.string().nullable(),user:qb,is_admin:u.boolean()}),KNe=u.object({share_new_threads_to_workspace:u.boolean().optional(),experimental_features_enabled:u.boolean().optional(),onboarded_at:u.union([u.literal("now"),u.null()]).optional(),display_name:u.string().min(1).max(120).optional(),handle:j4.optional(),bio:u.string().max(280).nullable().optional(),avatar_storage_url:u.string().min(1).nullable().optional(),banner_storage_url:u.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),QNe=u.object({id:u.string(),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),visible_thread_count:u.number().int().nonnegative(),last_active_at:u.string().datetime().nullable()}),H4=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),organization_name:u.string().min(1).nullable(),created_at:u.string().min(1),visible_thread_count:u.number().int().nonnegative(),follower_count:u.number().int().nonnegative(),following_count:u.number().int().nonnegative(),published_project_count:u.number().int().nonnegative(),is_following:u.boolean(),is_self:u.boolean()}),XNe=u.object({type:u.literal("list"),list_type:u.literal("organization_member"),objects:u.array(QNe)}),JNe=u.object({email_address:u.string().email()}),ZNe=u.object({email_address:u.string().email(),member_id:u.string().min(1)}),eOe=u.object({location:u.string().trim().min(1),contact:u.string().trim().email()}),tOe=u.object({location:u.string().min(1),contact:u.string().email(),created_at:u.string().datetime()}),nOe=u.object({first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().min(1).optional()}),rOe=u.object({name:u.string().min(1),email_domains:u.array(u.string().min(1)).nonempty(),stytch_org_id:u.string().min(1)}),oOe=u.object({user:nOe,organization:rOe}),sOe=u.object({path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),iOe=u.object({repo_origin_path:u.string().min(1),building_blocks:u.array(sOe)}),V4=u.string().regex(/^th_[0-9A-Za-z]{22}$/),vS=u.string().regex(/^tb_[0-9A-Za-z]{22}$/),aOe=u.object({id:V4,author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),body:u.string(),created_at:u.string().datetime(),repo_origin_path:u.string().min(1),latest_revision_id:vS,revision_count:u.number().int().positive()}),cOe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),uOe=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:cOe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),lOe=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable(),comments:u.array(uOe)}),pOe=u.object({thread_block_id:vS,from_position:u.number().int().positive(),to_position:u.number().int().positive(),selected_text:u.string().min(1),content:u.string().trim().min(1)}),dOe=u.object({id:u.string().min(1)}),_Oe=u.object({content:u.string().trim().min(1)}),fOe=u.object({id:u.string().min(1)}),mOe=u.object({content:u.string().trim().min(1)}),TOe=u.object({id:u.string().min(1)}),hOe=u.object({content:u.string().trim().min(1)}),EOe=u.object({id:u.string().min(1)}),SOe=u.object({resolved:u.boolean()}),gOe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),AOe=u.object({resolved:u.boolean()}),ROe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),F4=u.record(u.unknown()),yOe=u.object({id:vS,body:u.string(),created_at:u.string().datetime(),prosemirror_json:F4,comment_threads:u.array(lOe)}),IOe=u.object({id:V4,created_at:u.string().datetime(),repo_origin_path:u.string().min(1),author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),latest_revision_id:vS,revision_count:u.number().int().positive(),revisions:u.array(yOe)}),NOe=u.object({type:u.literal("list"),list_type:u.literal("plan"),has_more:u.boolean(),objects:u.array(aOe)}),OOe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_id:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional()}),q4=u.object({id:u.string().min(1),organization_id:u.string().min(1),created_at:u.string().min(1),repo_origin_path:u.string().min(1),path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),bOe=u.array(q4),COe=u.object({type:u.literal("list"),list_type:u.literal("building_block"),has_more:u.boolean(),objects:u.array(q4)}),POe=u.object({repo_origin_path:u.string().min(1),before:u.string().min(1).optional(),after:u.string().min(1).optional()}),MOe=u.enum(["thread","building_block"]),xOe=u.object({repo_origin_path:u.string().min(1),sources:u.array(MOe).nonempty()}),vOe=u.object({type:u.literal("list"),list_type:u.literal("repository"),has_more:u.boolean(),objects:u.array(xOe)}),fi=u.enum(["claudeCode","codex","amp","cursor","unspecified"]),LOe=["transcript","plan"],DOe=u.enum(LOe),UOe=u.object({md5:u.string().min(1),harness:fi,filename:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional(),harness_internal_id:u.string().min(1).optional(),file_type:DOe.optional()}).refine(t=>(t.filename?.trim().length??0)>0||(t.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),Yb=u.object({id:u.string().min(1),display_name:u.string().min(1)}),wOe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),$4=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:wOe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),Y4=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable()}),kOe=Y4.extend({comments:u.array($4)}),jd=u.object({id:u.string().min(1),type:u.string().min(1),index_in_thread:u.number().int().nonnegative(),isCritiqued:u.boolean(),comment_threads:u.array(kOe).optional()}).passthrough(),W4=u.object({type:u.literal("list"),list_type:u.literal("thread_block"),has_more:u.boolean(),objects:u.array(jd)}),L4=jd.extend({type:u.literal("plan"),prosemirror_json:F4,thread_file_id:u.string().min(1)}),GOe=u.union([u.literal(-1),u.literal(1)]),z4=u.union([u.literal(-1),u.literal(0),u.literal(1)]),D4=u.object({score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:z4}),BOe=u.object({value:GOe}),jOe=u.object({id:u.string().min(1),display_name:u.string().min(1),avatar_url:u.string().nullable()}),Ua=u.object({id:u.string().min(1),thread_id:u.string().min(1),author_id:u.string().min(1).nullable(),author:jOe.nullable(),parent_comment_id:u.string().min(1).nullable(),content:u.string(),created_at:u.string().datetime(),updated_at:u.string().datetime(),deleted_at:u.string().datetime().nullable()}),HOe=u.object({type:u.literal("list"),list_type:u.literal("thread_comment"),objects:u.array(Ua)}),VOe=u.object({content:u.string().trim().min(1).max(4e3),parent_comment_id:u.string().min(1).optional()}),FOe=Ua,qOe=u.object({content:u.string().trim().min(1).max(4e3)}),$Oe=Ua,YOe=Ua,LQe=u.discriminatedUnion("kind",[u.object({kind:u.literal("created"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Ua}),u.object({kind:u.literal("updated"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Ua}),u.object({kind:u.literal("deleted"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Ua})]),WOe=u.enum(["pending","generating","ready","failed"]),zOe=u.enum(["pending","generating","ready","failed"]),KOe=u.enum(["pending","placeholder","ai","user"]),K4=u.enum(["pending","generating","ready","failed"]),QOe=u.enum(["asked","requested","decided","corrected","shared"]),XOe=u.object({id:u.string().min(1),kind:QOe,summary:u.string().min(1),block_id:u.string().min(1)}),JOe=u.object({type:u.literal("list"),list_type:u.literal("thread_decision"),status:K4,generated_at:u.string().nullable(),objects:u.array(XOe)}),al=u.object({id:u.string().min(1),thread_file_id:u.string().min(1),organization_id:u.string().min(1),author:Yb,repo:u.string().min(1),title:u.string().min(1),started_at:u.string().min(1),blocks:W4,user_message_count:u.number().int().nonnegative(),files_touched:u.array(u.string()),skills_invoked:u.array(u.string()),harness:fi,transcript_parsing_state:u.enum(["pending","parsed","too_large_to_parse"]),visibility:u.enum(["private","workspace","public"]),has_plan:u.boolean().optional(),summary:u.string().nullable(),summary_status:WOe,summary_generated_at:u.string().nullable(),title_status:zOe,title_generated_at:u.string().nullable(),title_source:KOe,decisions_status:K4,decisions_generated_at:u.string().nullable(),score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:z4,comment_count:u.number().int().nonnegative(),is_favorited:u.boolean()}),ZOe=u.object({storage_url:u.string().min(1)}),ebe=u.object({storage_url:u.string(),harness:fi,thread:al.nullable()}),tbe=u.object({status:u.literal("complete"),thread_files:u.array(ebe)}),nbe=u.object({id:u.string(),presigned_url:u.string().nullable(),presigned_url_expires_at:u.string().nullable(),storage_url:u.string(),harness:fi,expected_md5:u.string(),error:u.string().nullable(),thread:al.nullable()}),rbe=u.object({id:u.string(),substrate:u.enum(["s3","filesystem"]),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:u.array(nbe)}),obe=u.object({visibility:u.enum(["private","workspace","public"]).optional(),title:u.string().trim().min(1).max(200).optional()}).refine(t=>t.visibility!==void 0||t.title!==void 0,{message:"At least one of visibility or title must be provided"}),sbe=u.discriminatedUnion("visibility",[u.object({visibility:u.literal("private")}),u.object({visibility:u.literal("workspace")}),u.object({visibility:u.literal("public"),title:u.string().min(1),author_display_name:u.string().min(1),first_user_message:u.string().nullable(),summary:u.string().nullable(),started_at:u.string().min(1),harness:fi})]),ibe=al,U4=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(ibe)}),abe=u.enum(["recent","popular"]),cbe=al,ube=u.object({type:u.literal("list"),list_type:u.literal("discover_thread"),has_more:u.boolean(),objects:u.array(cbe)}),lbe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),sort:abe.optional(),harness:fi.optional(),search:u.string().max(200).optional()}),pbe=u.object({thread_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),organization_count:u.number().int().nonnegative(),harness_breakdown:u.record(fi,u.number().int().nonnegative())}),dbe=u.object({id:u.string(),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:u.string(),thread_count:u.number().int().nonnegative()}),_be=u.object({type:u.literal("list"),list_type:u.literal("upload_session"),objects:u.array(dbe)}),fbe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),mbe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_ids:u.string().min(1).optional(),created_at:u.string().min(1).optional(),filepath_prefixes:u.string().min(1).optional()}),Tbe=u.object({path:u.string().min(1),start_offset:u.number().int().nonnegative(),end_offset:u.number().int().positive()}),hbe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),usage_count_last_24h:u.number().int().nonnegative(),usage_count_last_7d:u.number().int().nonnegative()}),Ebe=u.object({type:u.literal("list"),list_type:u.literal("skill"),objects:u.array(hbe)}),Sbe=u.object({id:u.string(),title:u.string(),visibility:u.enum(["private","workspace","public"]),started_at:u.string(),author:Yb,skills_invoked:u.array(u.string())}),gbe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),threads:u.array(Sbe)}),Abe=u.object({path:u.string().min(1),text:u.string().max(64e3)}),Rbe=u.enum(["text_edit","redact","delete_block"]),ybe=u.object({id:u.string(),thread_block_id:u.string(),editor:u.object({id:u.string(),display_name:u.string()}),kind:Rbe,path:u.string().nullable(),previous_text:u.string().nullable(),new_text:u.string().nullable(),created_at:u.string()}),Ibe=u.object({type:u.literal("list"),list_type:u.literal("thread_block_edit"),objects:u.array(ybe)}),Nbe=u.object({organization_count:u.number().int().nonnegative(),user_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),thread_count_last_24h:u.number().int().nonnegative(),user_count_last_24h:u.number().int().nonnegative()}),Obe=u.object({id:u.string(),name:u.string(),email_domains:u.array(u.string()),stytch_org_id:u.string(),member_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),default_thread_visibility:u.enum(["private","workspace","public"]),created_at:u.string()}),bbe=u.object({type:u.literal("list"),list_type:u.literal("admin_organization"),objects:u.array(Obe)}),Q4=u.object({id:u.string(),name:u.string()}),Cbe=u.object({id:u.string(),display_name:u.string(),stytch_id:u.string().nullable(),thread_count:u.number().int().nonnegative(),onboarded_at:u.string().nullable(),created_at:u.string(),organizations:u.array(Q4)}),Pbe=u.object({type:u.literal("list"),list_type:u.literal("admin_user"),objects:u.array(Cbe)}),Mbe=u.object({id:u.string(),title:u.string(),started_at:u.string(),created_at:u.string(),deleted_at:u.string().nullable(),visibility:u.enum(["private","workspace","public"]),harness:fi,author:Yb,organization:Q4}),xbe=u.object({type:u.literal("list"),list_type:u.literal("admin_thread"),has_more:u.boolean(),objects:u.array(Mbe)}),vbe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),w4=u.object({token:u.string().min(1),thread_id:u.string().min(1)}),Lbe=u.object({visitor:u.string().min(1).max(64).optional()}),Dbe=u.object({user_id:u.string(),display_name:u.string(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative()}),Ube=u.object({window_days:u.number().int().positive(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative(),active_sharers:u.number().int().nonnegative(),k_factor:u.number().nullable(),shares_sent_sparkline:u.array(u.number().int().nonnegative()),top_sharers:u.array(Dbe)}),wbe=u.object({windows:u.array(Ube)}),kbe=u.object({quoted_text:u.string().min(1),comment:u.string().nullable(),type:u.enum(["comment","highlight:trapdoor"])}),Gbe=Y4,Bbe=$4.extend({comment_thread_id:u.string().min(1)}),jbe=u.object({markdown:u.string().min(1)}),Hbe=u.object({storage_url:u.string().min(1),thread_file_id:u.string().min(1),parsed_plan_block:L4,critiqued_plan_block:L4,annotations:u.array(kbe),comment_threads:u.array(Gbe),comments:u.array(Bbe)}),cl=u.enum(Bb),X4=u.object({skills:u.boolean(),workspace_scope:u.boolean(),review:u.boolean(),shared_thread_ttl_days:u.number().int().positive().nullable()}),$b=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),effective_plan:cl,admin_override:cl.nullable(),stripe_subscription_status:u.string().nullable(),cancel_at_period_end:u.boolean(),current_period_end:u.string().nullable(),seat_quantity:u.number().int().positive(),member_count:u.number().int().nonnegative().nullable(),features:X4}),Vbe=u.object({effective_plan:cl,features:X4,user:$b,organization:$b.nullable()}),Fbe=u.object({plan:u.enum(["creator","team"]),seat_quantity:u.number().int().positive().optional()}),qbe=u.object({checkout_url:u.string().min(1)}),$be=u.object({portal_url:u.string().min(1)}),Ybe=u.object({seat_quantity:u.number().int().positive()}),k4=u.object({plan:cl.nullable()}),xS=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),label:u.string().min(1),effective_plan:cl,admin_override:cl.nullable(),stripe_subscription_status:u.string().nullable(),seat_quantity:u.number().int().positive()}),Wbe=u.object({users:u.array(xS),organizations:u.array(xS)}),zbe=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable()}),Kbe=u.object({thread_id:u.string().min(1),title:u.string().min(1),author:zbe,last_active_at:u.string().datetime(),last_block_excerpt:u.string().nullable(),last_block_kind:u.string().min(1).nullable(),is_streaming:u.boolean()}),Qbe=u.object({type:u.literal("list"),list_type:u.literal("live_thread"),objects:u.array(Kbe)}),Xbe=u.object({thread_id:u.string().min(1)}),Jbe=u.object({thread_id:u.string().min(1),last_seen_at:u.string().datetime(),started_at:u.string().datetime()}),Zbe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!0),follower_count:u.number().int().nonnegative()}),eCe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!1),follower_count:u.number().int().nonnegative()}),J4=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable(),bio:u.string().max(280).nullable(),is_following:u.boolean(),is_self:u.boolean()}),G4=u.object({type:u.literal("list"),list_type:u.literal("user_follow"),objects:u.array(J4)}),tCe=u.object({date:u.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:u.number().int().nonnegative()}),nCe=u.object({window_start:u.string().datetime(),window_end:u.string().datetime(),total_contributions:u.number().int().nonnegative(),days_active:u.number().int().nonnegative(),daily_average:u.number().nonnegative(),current_streak_days:u.number().int().nonnegative(),days:u.array(tCe)}),rCe=u.object({type:u.literal("thread_created"),occurred_at:u.string().datetime(),id:u.string().min(1),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),oCe=u.object({type:u.literal("comment_posted"),occurred_at:u.string().datetime(),id:u.string().min(1),comment_excerpt:u.string(),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),sCe=u.object({type:u.literal("project_published"),occurred_at:u.string().datetime(),id:u.string().min(1),project:u.object({id:u.string().min(1),name:u.string().min(1)})}),iCe=u.object({type:u.literal("user_followed"),occurred_at:u.string().datetime(),id:u.string().min(1),followee:J4}),aCe=u.discriminatedUnion("type",[rCe,oCe,sCe,iCe]),cCe=u.object({type:u.literal("list"),list_type:u.literal("user_activity"),objects:u.array(aCe)}),uCe=u.object({id:u.string().min(1),name:u.string().min(1),excerpt:u.string(),published_at:u.string().datetime(),updated_at:u.string().datetime()}),lCe=u.object({type:u.literal("list"),list_type:u.literal("profile_published_project"),objects:u.array(uCe)}),B4=u.object({id:u.string().min(1),published_at:u.string().datetime().nullable()}),pCe=u.enum(["avatar","banner"]),dCe=u.enum(["image/png","image/jpeg","image/webp","image/gif"]),_Ce=u.object({kind:pCe,content_type:dCe,base64_data:u.string().min(1)}),fCe=u.object({substrate:u.enum(["s3","filesystem"]),storage_url:u.string().min(1)}),mCe=H4,Z4=qNe.router({health:{method:"GET",path:"/health",responses:{200:u.object({status:u.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:u.object({authorization:u.string().min(1).optional(),"x-lore-referral-token":u.string().min(1).max(16).optional()}),responses:{200:zNe,401:A},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:u.object({authorization:u.string().min(1).optional()}),body:Xbe,responses:{200:Jbe,401:A,403:A,404:A,422:A},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Qbe,401:A,403:A},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:mbe,responses:{200:U4,401:A},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:al,404:A},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:U4,404:A,409:A},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:fbe,responses:{200:W4,401:A},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:_Oe,responses:{201:fOe,401:A,404:A},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:hOe,responses:{201:EOe,401:A,404:A,409:A},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:AOe,responses:{200:ROe,401:A,404:A},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Ebe,401:A},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:u.object({name:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:gbe,401:A,404:A},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Tbe,responses:{200:jd,401:A,403:A,404:A,422:A},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Abe,responses:{200:jd,401:A,403:A,404:A,422:A},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:jd,401:A,403:A,404:A,409:A,422:A},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Ibe,401:A,404:A},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:JOe,401:A,404:A},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:obe,responses:{200:al,401:A,403:A,404:A},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread (author only)"},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:BOe,responses:{200:D4,401:A,403:A,404:A,422:A},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:D4,401:A,404:A},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:HOe,403:A,404:A},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:VOe,responses:{201:FOe,401:A,403:A,404:A,422:A},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:qOe,responses:{200:$Oe,401:A,403:A,404:A,422:A},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:YOe,401:A,403:A,404:A},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:u.object({id:u.string().min(1)}),responses:{200:sbe,404:A},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:u.object({authorization:u.string().min(1).optional()}),body:oOe,responses:{201:qb,401:A},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:H4,404:A},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:u.object({authorization:u.string().min(1).optional()}),body:KNe,responses:{200:qb,401:A,409:A,422:A},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:u.object({handle:j4}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:mCe,404:A},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:u.object({limit:u.coerce.number().int().positive().max(100).optional()}),responses:{200:cCe,404:A},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:nCe,404:A},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:G4,404:A},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:G4,404:A},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:Zbe,401:A,404:A,409:A,422:A},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:eCe,401:A,404:A},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:lCe,404:A},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:B4,401:A,403:A,404:A},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:B4,401:A,403:A,404:A},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:u.object({authorization:u.string().min(1).optional()}),body:_Ce,responses:{200:fCe,401:A,413:A,422:A},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:XNe,401:A},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:u.object({authorization:u.string().min(1).optional()}),body:JNe,responses:{201:ZNe,401:A,403:A,409:A,422:A},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:vOe,401:A,403:A},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),body:iOe,responses:{201:bOe,401:A,403:A},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:IOe,401:A,403:A,404:A},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:pOe,responses:{201:dOe,401:A,403:A,404:A,422:A},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:mOe,responses:{201:TOe,401:A,403:A,404:A,409:A},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:SOe,responses:{200:gOe,401:A,403:A,404:A},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:u.object({authorization:u.string().min(1).optional()}),query:OOe,responses:{200:NOe,401:A,403:A},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),query:POe,responses:{200:COe,401:A,403:A},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:_be,401:A},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(UOe).nonempty()}),responses:{201:rbe,400:A,401:A},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(ZOe).nonempty()}),responses:{200:tbe,400:A,401:A,404:A,409:A,422:A},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Nbe,401:A,403:A},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:bbe,401:A,403:A},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Pbe,401:A,403:A},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:vbe,responses:{200:xbe,401:A,403:A},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Permanently remove a thread. Tanagram admins only."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:lbe,responses:{200:ube},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:pbe},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:eOe,responses:{201:tOe,409:A},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:w4,401:A,403:A,404:A,409:A},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:u.object({token:u.string().min(1).max(16)}),query:Lbe,responses:{200:w4,404:A},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:wbe,401:A,403:A},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:u.object({authorization:u.string().min(1).optional()}),body:jbe,responses:{200:Hbe,401:A,403:A,409:A},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Vbe,401:A},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:u.object({authorization:u.string().min(1).optional()}),body:Fbe,responses:{200:qbe,400:A,401:A,403:A,503:A},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({subject_type:u.enum(["user","organization"]).default("user")}).optional(),responses:{200:$be,401:A,404:A,503:A},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:u.object({authorization:u.string().min(1).optional()}),body:Ybe,responses:{200:$b,400:A,401:A,403:A,404:A,503:A},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Wbe,401:A,403:A},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:k4,responses:{200:xS,401:A,403:A,404:A},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:k4,responses:{200:xS,401:A,403:A,404:A},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:P4,docs:b4,mentions:M4,favorites:v4},{pathPrefix:"/api"});import Vd from"node:fs";import t3 from"node:path";import TCe from"node:os";import e3 from"node:path";function Hd(){let t=jt()==="dev"?".lore-dev":".lore";return e3.join(TCe.homedir(),t)}function LS(){return e3.join(Hd(),"log.txt")}function DS(){return t3.join(Hd(),"token")}function Wb(){let t;try{t=Vd.readFileSync(DS(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let e=t.trim();return!e||ECe(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function n3(){return Wb().token}function r3(){return Vd.existsSync(DS())}function o3(t){let e=DS();Vd.mkdirSync(t3.dirname(e),{recursive:!0,mode:448}),Vd.writeFileSync(e,t,{mode:384})}function s3(){try{Vd.rmSync(DS())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function hCe(t){let e=t.split(".");if(e.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(e[1],"base64url").toString("utf8"))}function ECe(t,e){let n;try{n=hCe(t)}catch{return!1}let r=n["https://stytch.com/session"]?.expires_at;if(typeof r!="string")return!1;let o=Date.parse(r.trim());return Number.isNaN(o)?!1:e.getTime()>=o}var SCe={dev:"http://localhost:4000",prod:"https://lore.tanagram.ai"};function ul(t={}){let e=t.token??n3();return Gb(Z4,{baseUrl:SCe[jt()],baseHeaders:{"User-Agent":n4(),...e?{authorization:`Bearer ${e}`}:{}}})}import a3 from"node:fs";var i3=!1;function gCe(){i3||(a3.mkdirSync(Hd(),{recursive:!0}),i3=!0)}function ACe(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function RCe(t,e,n){let r=`${new Date().toISOString()} ${t} ${e}`;if(!n)return`${r}
|
|
40
|
+
`;let o=Object.entries(n).map(([s,i])=>`${s}=${ACe(i)}`).join(" ");return o?`${r} ${o}
|
|
41
|
+
`:`${r}
|
|
42
|
+
`}function zb(t,e,n){let r=RCe(t,e,n);gCe(),a3.appendFileSync(LS(),r),jt()==="dev"&&process.stderr.write(r)}var tn={info(t,e){zb("info",t,e)},warn(t,e){zb("warn",t,e)},error(t,e){zb("error",t,e)}};var c3={meta:{name:"health",description:"Check API health"},async run({data:t}){tn.info("command_start",{command:"health"});let n=await(t?.client??ul()).health();if(n.status===200){console.log(n.body.status);return}throw tn.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};var u3={meta:{name:"hello",description:"Print a friendly greeting"},run(){tn.info("command_start",{command:"hello"}),console.log("hello world")}};import{spawn as ICe}from"node:child_process";import d3 from"node:crypto";import NCe from"node:http";var yCe={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function l3(){return yCe[jt()]}var OCe=5*60*1e3;function bCe(){return d3.randomBytes(32).toString("base64url")}function CCe(t){return d3.createHash("sha256").update(t).digest("base64url")}function PCe(t){let e;try{e=JSON.parse(Buffer.from(t.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof e.session_jwt!="string"||!e.session_jwt)throw new Error("missing session token");if(typeof e.code_challenge!="string"||!e.code_challenge)throw new Error("missing code challenge");return{sessionJwt:e.session_jwt,codeChallenge:e.code_challenge}}function MCe(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function p3(t,e,n){let r=e==="success";t.writeHead(200,{"Content-Type":"text/html"}),t.end(`<!DOCTYPE html>
|
|
8
43
|
<html><head><meta charset="utf-8"><title>Lore CLI</title></head>
|
|
9
44
|
<body style="font-family:system-ui;display:flex;justify-content:center;align-items:center;min-height:100vh;margin:0;background:#fafafa">
|
|
10
45
|
<div style="text-align:center;max-width:400px;padding:40px;border:1px solid #e0e0e0;border-radius:10px;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,0.1)">
|
|
11
|
-
<div style="font-size:48px;margin-bottom:20px">${
|
|
12
|
-
<h1 style="margin:0 0 10px">${
|
|
13
|
-
<p style="color:#666">${
|
|
46
|
+
<div style="font-size:48px;margin-bottom:20px">${r?"\u2713":"\u2717"}</div>
|
|
47
|
+
<h1 style="margin:0 0 10px">${r?"Authorization Complete":"Authorization Cancelled"}</h1>
|
|
48
|
+
<p style="color:#666">${r?"You can close this window now.":MCe(n??"Authorization was cancelled.")}</p>
|
|
14
49
|
<p style="color:#999;font-size:14px">You can close this tab and return to your terminal.</p>
|
|
15
|
-
</div></body></html>`)}async function
|
|
50
|
+
</div></body></html>`)}async function xCe(){let t,e=new Promise(s=>{t=s}),n=NCe.createServer((s,i)=>{let a=new URL(s.url??"/","http://127.0.0.1");if(a.pathname!=="/callback"){i.writeHead(404),i.end();return}let c=a.searchParams.get("error");if(c){let p=a.searchParams.get("error_description")||c;p3(i,"error",p),t?.({type:"error",description:p});return}let l=a.searchParams.get("code");if(l){p3(i,"success"),t?.({type:"code",code:l});return}i.writeHead(400),i.end()});return await new Promise((s,i)=>{n.once("error",i),n.listen(0,"127.0.0.1",()=>{n.off("error",i),s()})}),{redirectURI:`http://127.0.0.1:${n.address().port}/callback`,waitForCallback(s){return new Promise((i,a)=>{let c=setTimeout(()=>{a(new Error("authorization timed out"))},s);e.then(l=>{clearTimeout(c),i(l)})})},close(){return new Promise((s,i)=>{n.close(a=>{if(a){i(a);return}s()})})}}}async function vCe(t){let{command:e,args:n}=LCe(process.platform,t);await new Promise((r,o)=>{let s=ICe(e,n,{detached:!0,stdio:"ignore"});s.once("error",o),s.once("spawn",()=>{s.unref(),r()})})}function LCe(t,e){return t==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",e]}:t==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}async function DCe(t){if(Wb().source==="none")return!1;try{return(await t.whoAmI({headers:{}})).status===200}catch{return!1}}async function UCe({client:t=ul(),openBrowser:e=vCe,setAccessToken:n=o3,webBaseURL:r=l3(),timeoutMs:o=OCe}={}){if(await DCe(t)){console.log(`
|
|
16
51
|
Already logged in. Use 'lore logout' if you want to sign out.
|
|
17
|
-
`);return}let
|
|
52
|
+
`);return}let s=bCe(),i=CCe(s),a=await xCe();try{let c=new URL("/cli-authorize",r);c.searchParams.set("redirect_uri",a.redirectURI),c.searchParams.set("code_challenge",i),c.searchParams.set("code_challenge_method","S256");try{await e(c.toString()),console.log(`
|
|
18
53
|
Opening browser to log in...`),console.log(`
|
|
19
|
-
If your browser didn't open, visit:`)}catch(
|
|
20
|
-
Visit this URL to log in:`)}console.log(` ${
|
|
21
|
-
`),console.log(" Waiting for authorization. Click Authorize in your browser...");let
|
|
22
|
-
Authorization denied: ${
|
|
23
|
-
`),new Error(
|
|
54
|
+
If your browser didn't open, visit:`)}catch(d){tn.warn("open_browser_failed",{error:d instanceof Error?d.message:String(d)}),console.log(`
|
|
55
|
+
Visit this URL to log in:`)}console.log(` ${c.toString()}
|
|
56
|
+
`),console.log(" Waiting for authorization. Click Authorize in your browser...");let l=await a.waitForCallback(o);if(l.type==="error")throw console.log(`
|
|
57
|
+
Authorization denied: ${l.description}
|
|
58
|
+
`),new Error(l.description);let p=PCe(l.code);if(p.codeChallenge!==i)throw console.log(`
|
|
24
59
|
Authorization code verification failed.
|
|
25
|
-
`),new Error("PKCE challenge mismatch");n(
|
|
60
|
+
`),new Error("PKCE challenge mismatch");n(p.sessionJwt),console.log(`
|
|
26
61
|
Logged in successfully.
|
|
27
|
-
`)}catch(
|
|
62
|
+
`)}catch(c){throw c instanceof Error&&c.message==="authorization timed out"&&console.log(`
|
|
28
63
|
Authorization timed out. Please try again.
|
|
29
|
-
`),
|
|
64
|
+
`),c}finally{await a.close()}}var _3={meta:{name:"login",description:"Authorize this CLI against your Lore workspace"},async run({data:t}){tn.info("command_start",{command:"login"}),await UCe({client:t?.client,openBrowser:t?.openBrowser,setAccessToken:t?.setAccessToken,webBaseURL:t?.webBaseURL,timeoutMs:t?.timeoutMs})}};var f3={meta:{name:"logout",description:"Log out of your Lore workspace"},run(){tn.info("command_start",{command:"logout"});let t=r3();if(s3(),!t){console.log(`
|
|
30
65
|
Not currently logged in.
|
|
31
66
|
`);return}console.log(`
|
|
32
67
|
Logged out successfully.
|
|
33
|
-
`)}};var
|
|
34
|
-
`),process.exit(1)}}process.argv[1]&&import.meta.url
|
|
68
|
+
`)}};var m3={meta:{name:"logs",description:"Print the path to the log file"},run(){tn.info("command_start",{command:"logs"}),console.log(LS())}};import{promises as mi}from"node:fs";import wCe from"node:os";import wa from"node:path";import{fileURLToPath as T3}from"node:url";function Kb(){return wa.join(wCe.homedir(),".claude","skills")}function h3(t){return t.map(e=>e.name).sort().join(", ")}function E3(t){return t[0]?wa.dirname(t[0].destination):Kb()}async function kCe(t){try{return(await mi.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function S3(){let t=[T3(new URL("../skills",import.meta.url)),T3(new URL("../../skills",import.meta.url))];for(let e of t)if(await kCe(e))return e;throw new Error("bundled skills directory not found")}function GCe(t,e){let n=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);if(!n)throw new Error("skill file is missing frontmatter");let[,r,o,s]=n,i=o.replace(/^name: .*$/m,`name: ${e}`);if(i===o)throw new Error("skill file frontmatter is missing a name");return`${r}${i}${s}${t.slice(n[0].length)}`}async function BCe({destination:t=Kb(),environment:e=jt(),sourceDir:n}={}){let r=n??await S3(),o=(await mi.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];await mi.mkdir(t,{recursive:!0});for(let a of o){let c=`${a.name}${s}`,l=wa.join(r,a.name),p=wa.join(t,c);if(await mi.cp(l,p,{recursive:!0,force:!0}),s){let d=wa.join(p,"SKILL.md"),_=await mi.readFile(d,"utf8");await mi.writeFile(d,GCe(_,c))}i.push({name:c,source:l,destination:p})}return i}async function jCe({destination:t=Kb(),environment:e=jt(),sourceDir:n}={}){let r=n??await S3(),o=(await mi.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];for(let a of o){let c=`${a.name}${s}`,l=wa.join(r,a.name),p=wa.join(t,c);await mi.rm(p,{recursive:!0,force:!0}),i.push({name:c,source:l,destination:p})}return i}var g3={meta:{name:"postinstall:install-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await BCe({destination:t.destination});console.log(`installed skills ${h3(e)} to ${E3(e)}`)}},A3={meta:{name:"postinstall:uninstall-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await jCe({destination:t.destination});console.log(`uninstalled skills ${h3(e)} from ${E3(e)}`)}};var R3={meta:{name:"whoami",description:"Print the authenticated Lore user",hidden:!0},async run({data:t}){tn.info("command_start",{command:"whoami"});let n=await(t?.client??ul()).whoAmI({headers:{}});if(n.status===200){console.log(n.body.emailAddress);return}throw console.error("Not authenticated. Run 'lore login' first."),new Error(`whoami failed: HTTP ${n.status}`)}};var HCe="phc_sMsUvf0nK50rZdztSlX9rDJqIreLcXj4dyGS0tORQpQ",VCe="https://phe.tanagram.ai/capture/",FCe=2e3;function y3(t){return process.env[t]??""}function qCe(t,e){let n=[t,e].filter(Boolean);return n.length>0?n.join("@"):"unknown-cli-user"}async function I3({commandName:t,durationMs:e}){let n=y3("USER"),r=y3("HOST"),o=new AbortController,s=setTimeout(()=>o.abort(),FCe);try{await fetch(VCe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:HCe,event:"lore.cli.command_run",properties:{distinct_id:qCe(n,r),command_name:t,cli_version:_S(),duration_ms:Math.round(e),environment:jt(),user:n,host:r}}),signal:o.signal})}catch(i){tn.warn("posthog_capture_failed",{command:t,error:i instanceof Error?i.message:String(i)})}finally{clearTimeout(s)}}var O3={hello:u3,health:c3,login:_3,logout:f3,whoami:R3,logs:m3,"postinstall:install-skills":g3,"postinstall:uninstall-skills":A3};function YCe(t){let e=t.find(n=>!n.startsWith("-"));return e||"hello"}var WCe={name:"cli-metrics",setup(t){t.data={...t.data,commandStartedAtMs:performance.now()}},async cleanup(t){let e=t.data?.commandStartedAtMs;if(typeof e!="number")return;let n=performance.now()-e;await(t.data?.captureCliCommandMetric??I3)({commandName:YCe(t.rawArgs),durationMs:n})}},Qb={meta:{name:"lore",description:"Lore CLI"},plugins:[WCe],subCommands:O3,default:"hello"};function N3(t){return t instanceof Error&&t.name==="CLIError"}function zCe(t){let e=t.find(r=>!r.startsWith("-")),n=e?O3[e]:void 0;return n?[n,Qb]:[Qb,void 0]}async function KCe(t){try{if(t.includes("--help")||t.includes("-h")){console.log(await c4(...zCe(t)));return}await ES(Qb,{rawArgs:t})}catch(e){if(N3(e)||jt()==="prod"&&e instanceof Error?console.error(e.message):console.error(e,`
|
|
69
|
+
`),!N3(e)){te(e),Ff(2e3).catch(()=>{}).finally(()=>{process.exit(1)});return}process.exit(1)}}process.argv[1]&&import.meta.url===$Ce(process.argv[1]).href&&await KCe(process.argv.slice(2));export{Qb as mainCommand};
|